diff options
Diffstat (limited to 'engine/overworld')
| -rwxr-xr-x | engine/overworld/card_key.asm | 2 | ||||
| -rw-r--r-- | engine/overworld/check_player_state.asm | 4 | ||||
| -rwxr-xr-x | engine/overworld/cut.asm | 2 | ||||
| -rw-r--r-- | engine/overworld/get_coords_tile_in_front_of_player.asm | 4 | ||||
| -rwxr-xr-x | engine/overworld/hidden_objects.asm | 2 | ||||
| -rwxr-xr-x | engine/overworld/ledges.asm | 2 | ||||
| -rw-r--r-- | engine/overworld/map_sprite_functions1.asm | 2 | ||||
| -rwxr-xr-x | engine/overworld/map_sprites.asm | 124 | ||||
| -rw-r--r-- | engine/overworld/movement.asm | 4 | ||||
| -rwxr-xr-x | engine/overworld/player_animations.asm | 6 | ||||
| -rwxr-xr-x | engine/overworld/pokecenter.asm | 2 | ||||
| -rwxr-xr-x | engine/overworld/ssanne.asm | 2 | ||||
| -rw-r--r-- | engine/overworld/step_functions.asm | 2 | ||||
| -rw-r--r-- | engine/overworld/try_pushing_boulder.asm | 2 | 
14 files changed, 83 insertions, 77 deletions
| diff --git a/engine/overworld/card_key.asm b/engine/overworld/card_key.asm index 48b2380d..62d1d4fb 100755 --- a/engine/overworld/card_key.asm +++ b/engine/overworld/card_key.asm @@ -89,7 +89,7 @@ GetCoordsInFrontOfPlayer: ; 5265f (14:665f)  	ld d, a  	ld a, [wXCoord]  	ld e, a -	ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction +	ld a, [wPlayerFacingDirection] ; player's sprite facing direction  	and a  	jr nz, .notFacingDown  ; facing down diff --git a/engine/overworld/check_player_state.asm b/engine/overworld/check_player_state.asm index 157649a7..0fc73bc7 100644 --- a/engine/overworld/check_player_state.asm +++ b/engine/overworld/check_player_state.asm @@ -90,7 +90,7 @@ IsPlayerFacingEdgeOfMap: ; c148 (3:4148)  	push hl  	push de  	push bc -	ld a, [wSpriteStateData1 + 9] ; player sprite's facing direction +	ld a, [wPlayerFacingDirection] ; player sprite's facing direction  	srl a  	ld c, a  	ld b, $0 @@ -160,7 +160,7 @@ IsWarpTileInFrontOfPlayer: ; c197 (3:4197)  	ld a, [wCurMap]  	cp SS_ANNE_5  	jr z, .ssAnne5 -	ld a, [wSpriteStateData1 + 9] ; player sprite's facing direction +	ld a, [wPlayerFacingDirection] ; player sprite's facing direction  	srl a  	ld c, a  	ld b, 0 diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index 3978cb9c..488bc4de 100755 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -188,7 +188,7 @@ ReplaceTreeTileBlock: ; ef1f (3:6f1f)  	ld h, [hl]  	ld l, a  	add hl, bc -	ld a, [wSpriteStateData1 + 9] ; player sprite's facing direction +	ld a, [wPlayerFacingDirection] ; player sprite's facing direction  	and a  	jr z, .down  	cp SPRITE_FACING_UP diff --git a/engine/overworld/get_coords_tile_in_front_of_player.asm b/engine/overworld/get_coords_tile_in_front_of_player.asm index a0d38d7c..ce45e79c 100644 --- a/engine/overworld/get_coords_tile_in_front_of_player.asm +++ b/engine/overworld/get_coords_tile_in_front_of_player.asm @@ -6,7 +6,7 @@ _GetTileAndCoordsInFrontOfPlayer: ; c2d4 (3:42d4)  	ld d, a  	ld a, [wXCoord]  	ld e, a -	ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction +	ld a, [wPlayerFacingDirection] ; player's sprite facing direction  	and a ; cp SPRITE_FACING_DOWN  	jr nz, .notFacingDown  ; facing down @@ -45,7 +45,7 @@ GetTileTwoStepsInFrontOfPlayer: ; c309 (3:4309)  	ld a, [hli]  	ld d, a  	ld e, [hl] -	ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction +	ld a, [wPlayerFacingDirection] ; player's sprite facing direction  	and a ; cp SPRITE_FACING_DOWN  	jr nz, .notFacingDown  ; facing down diff --git a/engine/overworld/hidden_objects.asm b/engine/overworld/hidden_objects.asm index cba2a221..6e515b5a 100755 --- a/engine/overworld/hidden_objects.asm +++ b/engine/overworld/hidden_objects.asm @@ -61,7 +61,7 @@ CheckForHiddenObject: ; f25f8 (3c:65f8)  ; checks if the coordinates in front of the player's sprite match Y in b and X in c  ; [hCoordsInFrontOfPlayerMatch] = $00 if they match, $ff if they don't match  CheckIfCoordsInFrontOfPlayerMatch: ; 46a01 (11:6a01) -	ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction +	ld a, [wPlayerFacingDirection] ; player's sprite facing direction  	cp SPRITE_FACING_UP  	jr z, .facingUp  	cp SPRITE_FACING_LEFT diff --git a/engine/overworld/ledges.asm b/engine/overworld/ledges.asm index a6ebd9be..5d95cb18 100755 --- a/engine/overworld/ledges.asm +++ b/engine/overworld/ledges.asm @@ -6,7 +6,7 @@ HandleLedges: ; 1a7f4 (6:67f4)  	and a ; OVERWORLD  	ret nz  	predef GetTileAndCoordsInFrontOfPlayer -	ld a, [wSpriteStateData1 + 9] +	ld a, [wPlayerFacingDirection]  	ld b, a  	aCoord 8, 9  	ld c, a diff --git a/engine/overworld/map_sprite_functions1.asm b/engine/overworld/map_sprite_functions1.asm index 48eed56e..46479a9f 100644 --- a/engine/overworld/map_sprite_functions1.asm +++ b/engine/overworld/map_sprite_functions1.asm @@ -28,7 +28,7 @@ _UpdateSprites: ; 4bb7 (1:4bb7)  	and a  	jp z, UpdatePlayerSprite  	cp $f0 ; pikachu -	jp z, Func_1552 +	jp z, SpawnPikachu  	ld a, [hl]  UpdateNonPlayerSprite: ; 4be3 (1:4be3) diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm index 9f25c585..68f6b006 100755 --- a/engine/overworld/map_sprites.asm +++ b/engine/overworld/map_sprites.asm @@ -20,26 +20,26 @@ _InitMapSprites: ; 1401b (5:401b)  ; Loads sprite set for outside maps (cities and routes) and sets VRAM slots.  ; sets carry if the map is a city or route, unsets carry if not  InitOutsideMapSprites: ; 14029 (5:4029) -	ld a,[wCurMap] -	cp a,REDS_HOUSE_1F ; is the map a city or a route (map ID less than $25)? +	ld a, [wCurMap] +	cp a, REDS_HOUSE_1F ; is the map a city or a route (map ID less than $25)?  	ret nc ; if not, return  	call GetSplitMapSpriteSetID  ; if so, choose the appropriate one -	ld b,a ; b = spriteSetID -	ld a,[wFontLoaded] -	bit 0,a ; reloading upper half of tile patterns after displaying text? -	jr nz,.loadSpriteSet ; if so, forcibly reload the sprite set -	ld a,[wSpriteSetID] +	ld b, a ; b = spriteSetID +	ld a, [wFontLoaded] +	bit 0, a ; reloading upper half of tile patterns after displaying text? +	jr nz, .loadSpriteSet ; if so, forcibly reload the sprite set +	ld a, [wSpriteSetID]  	cp b ; has the sprite set ID changed? -	jr z,.skipLoadingSpriteSet ; if not, don't load it again +	jr z, .skipLoadingSpriteSet ; if not, don't load it again  .loadSpriteSet -	ld a,b -	ld [wSpriteSetID],a +	ld a, b +	ld [wSpriteSetID], a  	dec a -	ld c,a -	ld b,0 +	ld c, a +	ld b, 0  	ld a, (wSpriteSetID - wSpriteSet) -	ld hl,SpriteSets +	ld hl, SpriteSets  	call AddNTimes ; get sprite set offset  	ld de, wSpriteSet  	ld bc, (wSpriteSetID - wSpriteSet) @@ -64,8 +64,8 @@ LoadSpriteSetFromMapHeader: ; 14061 (5:4061)  	call FillMemory  	ld a, SPRITE_PIKACHU ; load Pikachu separately  	ld [wSpriteSet], a -	ld hl,wSpriteStateData1 + $10 -	ld a,$0e +	ld hl, wSprite01SpriteStateData1 +	ld a, 14  .storeVRAMSlotsLoop  	push af  	ld a, [hl] ; $C1X0 (picture ID) (zero if sprite slot is not used) @@ -79,13 +79,14 @@ LoadSpriteSetFromMapHeader: ; 14061 (5:4061)  	ld b, 2  	call CheckIfPictureIDAlreadyLoaded  	jr .continue +  .isFourTileSprite  ; loop through the space reserved for regular picture IDs   	ld de, wSpriteSet  	ld b, 9  	call CheckIfPictureIDAlreadyLoaded  .continue -	ld de, $10 +	ld de, wSprite02SpriteStateData1 - wSprite01SpriteStateData1  	add hl, de  	pop af  	dec a @@ -96,6 +97,7 @@ CheckIfPictureIDAlreadyLoaded: ; 1409b (5:409b)  ; Check if the current picture ID has already had its tile patterns loaded.  ; This done by looping through the previous sprite slots and seeing if any of  ; their picture ID's match that of the current sprite slot. +.loop  	ld a, [de]  	and a ; is sprite set slot not taken up yet?  	jr z, .spriteSlotNotTaken ; if so, load it as it signifies we've reached  @@ -106,7 +108,8 @@ CheckIfPictureIDAlreadyLoaded: ; 1409b (5:409b)  	dec b ; have we reached the end of the sprite set?  	jr z, .spriteNotAlreadyLoaded ; if so, we're done here  	inc de -	jr CheckIfPictureIDAlreadyLoaded +	jr .loop +  .spriteSlotNotTaken  	ld a, c  	ld [de], a @@ -127,6 +130,7 @@ CheckForFourTileSprite: ; 140ac (5:40ac)  ; regular sprite  	and a  	ret +  .notYellowSprite  	scf   	ret @@ -140,6 +144,7 @@ LoadMapSpriteTilePatterns: ; 140b7 (5:40b7)  	call LoadStillTilePattern  	call LoadWalkingTilePattern  	jr .continue +  .fourTileSprite  	call LoadStillTilePattern  .continue @@ -202,7 +207,7 @@ GetSpriteVRAMAddress: ; 14018 (5:4108)  SpriteVRAMAddresses: ; 14118 (5:4118)  ; Equivalent to multiplying $C0 (number of bytes in 12 tiles) times the VRAM  ; slot and adding the result to $8000 (the VRAM base address). -	dw vChars0 + $c0 +	dw vChars0 + $0c0  	dw vChars0 + $180  	dw vChars0 + $240  	dw vChars0 + $300 @@ -211,8 +216,8 @@ SpriteVRAMAddresses: ; 14118 (5:4118)  	dw vChars0 + $540  	dw vChars0 + $600  	dw vChars0 + $6c0 -	dw vChars0 + $780 -	dw vChars0 + $7c0 +	dw vChars0 + $780 ; 4-tile sprites +	dw vChars0 + $7c0 ; 4-tile sprites  ReadSpriteSheetData: ; 1412e (5:412e)  	ld a, [hVRAMSlot] @@ -246,12 +251,12 @@ ReadSpriteSheetData: ; 1412e (5:412e)  Func_14150: ; 14150 (5:4150)  	ld a, $1 -	ld [wSpriteStateData2 + $e], a ; vram slot for player +	ld [wPlayerSpriteImageBaseOffset], a ; vram slot for player  	ld a, $2 -	ld [wSpriteStateData2 + $fe], a ; vram slot for Pikachu +	ld [wPikachuSpriteImageBaseOffset], a ; vram slot for Pikachu  	ld a, $e -	ld hl, wSpriteStateData1 + $10 +	ld hl, wSprite01SpriteStateData1  .loop  	ld [hVRAMSlot], a ; store current sprite set slot as a counter  	ld a, [hl] ; $c1x0 (picture ID) @@ -259,12 +264,12 @@ Func_14150: ; 14150 (5:4150)  	jr z, .spriteUnused  	call Func_14179  	push hl -	ld de, (wSpriteStateData2 + $e) - (wSpriteStateData1) ; $10e +	ld de, (wPlayerSpriteImageBaseOffset) - (wSpriteStateData1) ; $10e  	add hl, de ; get $c2xe (sprite image base offset)  	ld [hl], a ; write offset  	pop hl  .spriteUnused -	ld de, $10 +	ld de, wSprite02SpriteStateData1 - wSprite01SpriteStateData1  	add hl, de  	ld a, [hVRAMSlot]  	dec a @@ -297,67 +302,68 @@ Func_14179: ; 14179 (5:4179)  GetSplitMapSpriteSetID: ; 14193 (5:4193)  	ld e, a  	ld d, 0 -	ld hl,MapSpriteSets +	ld hl, MapSpriteSets  	add hl, de -	ld a,[hl] ; a = spriteSetID -	cp a,$f0 ; does the map have 2 sprite sets? +	ld a, [hl] ; a = spriteSetID +	cp a, $f0 ; does the map have 2 sprite sets?  	ret c  ; Chooses the correct sprite set ID depending on the player's position within  ; the map for maps with two sprite sets. -	cp a,$f8 -	jr z,.route20 -	ld hl,SplitMapSpriteSets -	and a,$0f +	cp a, $f8 +	jr z, .route20 +	ld hl, SplitMapSpriteSets +	and a, $0f  	dec a  	add a  	add a  	add l -	ld l,a -	jr nc,.noCarry +	ld l, a +	jr nc, .noCarry  	inc h  .noCarry -	ld a,[hli] ; determines whether the map is split East/West or North/South -	cp a,$01 -	ld a,[hli] ; position of dividing line -	ld b,a -	jr z,.eastWestDivide +	ld a, [hli] ; determines whether the map is split East/West or North/South +	cp a, $01 +	ld a, [hli] ; position of dividing line +	ld b, a +	jr z, .eastWestDivide  .northSouthDivide -	ld a,[wYCoord] +	ld a, [wYCoord]  	jr .compareCoord +  .eastWestDivide -	ld a,[wXCoord] +	ld a, [wXCoord]  .compareCoord  	cp b -	jr c,.loadSpriteSetID +	jr c, .loadSpriteSetID  ; if in the East side or South side  	inc hl  .loadSpriteSetID -	ld a,[hl] +	ld a, [hl]  	ret  ; Uses sprite set $01 for West side and $0A for East side.  ; Route 20 is a special case because the two map sections have a more complex  ; shape instead of the map simply being split horizontally or vertically.  .route20 -	ld hl,wXCoord -	ld a,[hl] -	cp a,$2b -	ld a,$01 +	ld hl, wXCoord +	ld a, [hl] +	cp a, $2b +	ld a, $01  	ret c -	ld a,[hl] -	cp a,$3e -	ld a,$0a +	ld a, [hl] +	cp a, $3e +	ld a, $0a  	ret nc -	ld a,[hl] -	cp a,$37 -	ld b,$08 -	jr nc,.next -	ld b,$0d +	ld a, [hl] +	cp a, $37 +	ld b, $08 +	jr nc, .next +	ld b, $0d  .next -	ld a,[wYCoord] +	ld a, [wYCoord]  	cp b -	ld a,$0a +	ld a, $0a  	ret c -	ld a,$01 +	ld a, $01  	ret -INCLUDE "data/sprite_sets.asm"
\ No newline at end of file +INCLUDE "data/sprite_sets.asm" diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index dfd1c012..6bd28dad 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -53,7 +53,7 @@ UpdatePlayerSprite: ; 4da5 (1:4da5)  	ld a, SPRITE_FACING_RIGHT  	jr .next  .next -	ld [wSpriteStateData1 + 9], a ; facing direction +	ld [wPlayerFacingDirection], a ; facing direction  	ld a, [wFontLoaded]  	bit 0, a  	jr z, .moving @@ -89,7 +89,7 @@ UpdatePlayerSprite: ; 4da5 (1:4da5)  Func_4e32: ; 4e32 (1:4e32)  	ld a, [wSpriteStateData1 + 8]  	ld b, a -	ld a, [wSpriteStateData1 + 9] +	ld a, [wPlayerFacingDirection]  	add b  	ld [wSpriteStateData1 + 2], a  	ret diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm index d883f0e3..d0b1cde4 100755 --- a/engine/overworld/player_animations.asm +++ b/engine/overworld/player_animations.asm @@ -35,7 +35,7 @@ EnterMapAnim: ; 70567 (1c:4567)  	ld hl, wFacingDirectionList  	call PlayerSpinInPlace  	ld a, $1 -	ld [wd431], a +	ld [wPikachuSpawnState], a  .restoreDefaultMusic  	call PlayDefaultMusic  .done @@ -46,7 +46,7 @@ EnterMapAnim: ; 70567 (1c:4567)  	call DelayFrames  	call PlayerSpinWhileMovingDown  	ld a, $0 -	ld [wd431], a +	ld [wPikachuSpawnState], a  	jr .done  .flyAnimation  	pop hl @@ -63,7 +63,7 @@ EnterMapAnim: ; 70567 (1c:4567)  	call DoFlyAnimation  	call LoadPlayerSpriteGraphics  	ld a, $1 -	ld [wd431], a +	ld [wPikachuSpawnState], a  	jr .restoreDefaultMusic  FlyAnimationEnterScreenCoords: ; 705ed (1c:45ed) diff --git a/engine/overworld/pokecenter.asm b/engine/overworld/pokecenter.asm index b9307517..63137433 100755 --- a/engine/overworld/pokecenter.asm +++ b/engine/overworld/pokecenter.asm @@ -63,7 +63,7 @@ DisplayPokemonCenterDialogue_: ; 6d97 (1:6d97)  	callab IsStarterPikachuInOurParty  	call c, Func_6eaa  	ld a, $5 -	ld [wd431], a +	ld [wPikachuSpawnState], a  	call Func_1525  .doNotReturnPikachu  	lb bc, 1, 0 diff --git a/engine/overworld/ssanne.asm b/engine/overworld/ssanne.asm index ece4446d..d0d957be 100755 --- a/engine/overworld/ssanne.asm +++ b/engine/overworld/ssanne.asm @@ -32,7 +32,7 @@ AnimateBoulderDust: ; 7a0fb (1e:60fb)  	jp LoadPlayerSpriteGraphics  GetMoveBoulderDustFunctionPointer: ; 7913f (1e:613f) -	ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction +	ld a, [wPlayerFacingDirection] ; player's sprite facing direction  	ld hl, MoveBoulderDustFunctionPointerTable  	ld c, a  	ld b, $0 diff --git a/engine/overworld/step_functions.asm b/engine/overworld/step_functions.asm index 58667e51..64d215a1 100644 --- a/engine/overworld/step_functions.asm +++ b/engine/overworld/step_functions.asm @@ -2,7 +2,7 @@ ApplyOutOfBattlePoisonDamage: ; c3de (3:43de)  	ld a, [wd730]  	add a  	jp c, .noBlackOut ; no black out if joypad states are being simulated -	ld a, [wPreventBlackout] +	ld a, [wd492]  	bit 7, a  	jp nz, .noBlackOut  	ld a, [wd72e] diff --git a/engine/overworld/try_pushing_boulder.asm b/engine/overworld/try_pushing_boulder.asm index 89e83ff9..b7e04092 100644 --- a/engine/overworld/try_pushing_boulder.asm +++ b/engine/overworld/try_pushing_boulder.asm @@ -38,7 +38,7 @@ Func_f0a7: ; f0a7 (3:70a7)  	jp nz, ResetBoulderPushFlags  	ld a, [hJoyHeld]  	ld b, a -	ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction +	ld a, [wPlayerFacingDirection] ; player's sprite facing direction  	cp SPRITE_FACING_UP  	jr z, .pushBoulderUp  	cp SPRITE_FACING_LEFT | 
