Merge Xeon’s stuff.

hg-commit-id: 6a40706a4bb2
This commit is contained in:
IIMarckus 2012-05-13 16:26:38 -06:00
commit e1560808da

122
main.asm
View file

@ -470,8 +470,8 @@ EnterMap: ; 3A6
call Bankswitch ; display fly/teleport in graphical effect call Bankswitch ; display fly/teleport in graphical effect
call $2429 ; move sprites call $2429 ; move sprites
.didNotFlyOrTeleportIn\@ .didNotFlyOrTeleportIn\@
ld b,$03 ld b,BANK(CheckForceBikeOrSurf)
ld hl,$438b ld hl,CheckForceBikeOrSurf
call Bankswitch ; handle currents in SF islands and forced bike riding in cycling road call Bankswitch ; handle currents in SF islands and forced bike riding in cycling road
ld hl,$d72d ld hl,$d72d
res 5,[hl] res 5,[hl]
@ -2850,7 +2850,16 @@ SwitchToMapRomBank: ; 12BC
pop hl pop hl
ret ret
INCBIN "baserom.gbc",$12DA,$12F8 - $12DA INCBIN "baserom.gbc",$12DA,$12ED-$12DA
;appears to be called twice inside function $C38B
;if $d700,$d11a == $1 then biking
;if $d700,$d11a == $2 then surfing
ForceBikeOrSurf: ; 12ED
ld b,5 ;graphics bank 5
ld hl,LoadPlayerSpriteGraphics ;load player sprite graphics
call Bankswitch ;loads bank 5 and then calls LoadPlayerSpriteGraphics
jp $2307 ;update map/player state?
; this is used to check if the player wants to interrupt the opening sequence at several points ; this is used to check if the player wants to interrupt the opening sequence at several points
; XXX is this used anywhere else? ; XXX is this used anywhere else?
@ -6891,7 +6900,22 @@ LoadHpBarAndStatusTilePatterns: ; 36C0
ld bc,(BANK(HpBarAndStatusGraphics) << 8 | $1e) ld bc,(BANK(HpBarAndStatusGraphics) << 8 | $1e)
jp CopyVideoData ; if LCD is on, transfer during V-blank jp CopyVideoData ; if LCD is on, transfer during V-blank
INCBIN "baserom.gbc",$36E0,$3739 - $36E0 ;Fills memory range with the specified byte.
;input registers a = fill_byte, bc = length, hl = address
FillMemory: ;36E0
push de
ld d, a
.loop\@
ld a, d
ldi [hl], a
dec bc
ld a, b
or c
jr nz, .loop\@
pop de
ret
INCBIN "baserom.gbc",$36EB,$3739 - $36EB
DelayFrames: ; 3739 DelayFrames: ; 3739
; wait n frames, where n is the value in c ; wait n frames, where n is the value in c
@ -7923,7 +7947,25 @@ Predef: ; 3E6D
ld [$2000],a ld [$2000],a
ret ret
INCBIN "baserom.gbc",$3E94,$3F22 - $3E94 ;loads hl from cc4f, de from cc51, and bc from cc53
Load16BitRegisters: ;3e94
ld a, [$cc4f]
ld h, a
ld a, [$cc50]
ld l, a
ld a, [$cc51]
ld d, a
ld a, [$cc52]
ld e, a
ld a, [$cc53]
ld b, a
ld a, [$cc54]
ld c, a
ret
; 0x3ead
INCBIN "baserom.gbc",$3EAD,$3F22 - $3EAD
; 0x3F22 ; 0x3F22
dw $66ee dw $66ee
@ -10863,7 +10905,75 @@ MapHeaderBanks: ; 423D
db BANK(Bruno_h) db BANK(Bruno_h)
db BANK(Agatha_h) db BANK(Agatha_h)
INCBIN "baserom.gbc",$C335,$C766-$C335 INCBIN "baserom.gbc",$C335,$C38B-$C335
CheckForceBikeOrSurf: ; C38B
ld hl, $D732
bit 5, [hl]
ret nz
ld hl, ForcedBikeOrSurfMaps
ld a, [W_YCOORD]
ld b, a
ld a, [W_XCOORD]
ld c, a
ld a, [W_CURMAP]
ld d, a
.loop\@
ld a, [hli]
cp $ff
ret z ;if we reach FF then it's not part of the list
cp d ;compare to current map
jr nz, .incorrectMap\@
ld a, [hli]
cp b ;compare y-coord
jr nz, .incorrectY\@
ld a, [hli]
cp c ;compare x-coord
jr nz, .loop\@ ; incorrect x-coord, check next item
ld a, [W_CURMAP]
cp SEAFOAM_ISLANDS_4
ld a, $2
ld [$d666], a
jr z, .forceSurfing\@
ld a, [$d35e]
cp SEAFOAM_ISLANDS_5
ld a, $2
ld [$d668], a
jr z, .forceSurfing\@
;force bike riding
ld hl, $d732
set 5, [hl]
ld a, $1
ld [$d700], a
ld [$d11a], a
jp ForceBikeOrSurf
.incorrectMap\@
inc hl
.incorrectY\@
inc hl
jr .loop\@
.forceSurfing\@
ld a, $2
ld [$d700], a
ld [$d11a], a
jp ForceBikeOrSurf
; 0xc3e6
ForcedBikeOrSurfMaps: ;C3e6
; map id, y, x
db ROUTE_16,$0A,$11
db ROUTE_16,$0B,$11
db ROUTE_18,$08,$21
db ROUTE_18,$09,$21
db SEAFOAM_ISLANDS_4,$07,$12
db SEAFOAM_ISLANDS_4,$07,$13
db SEAFOAM_ISLANDS_5,$0E,$04
db SEAFOAM_ISLANDS_5,$0E,$05
db $FF ;end
; 0xc3ff
INCBIN "baserom.gbc",$C3FF,$C766-$C3FF
ld hl, TilesetsHeadPtr ld hl, TilesetsHeadPtr
INCBIN "baserom.gbc",$C769,$C7BE-$C769 INCBIN "baserom.gbc",$C769,$C7BE-$C769