diff options
Diffstat (limited to 'home/overworld.asm')
-rw-r--r-- | home/overworld.asm | 112 |
1 files changed, 56 insertions, 56 deletions
diff --git a/home/overworld.asm b/home/overworld.asm index e4f58d4a..fad9f29d 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -348,7 +348,7 @@ OverworldLoopLessDelay:: ; function to determine if there will be a battle and execute it (either a trainer battle or wild battle) ; sets carry if a battle occurred and unsets carry if not -NewBattle:: ; 0683 (0:0683) +NewBattle:: ld a,[wd72d] bit 4,a jr nz,.noBattle @@ -363,7 +363,7 @@ NewBattle:: ; 0683 (0:0683) ret ; function to make bikes twice as fast as walking -BikeSpeedup:: ; 06a0 (0:06a0) +BikeSpeedup:: ld a,[wNPCMovementScriptPointerTableNum] and a ret nz @@ -377,7 +377,7 @@ BikeSpeedup:: ; 06a0 (0:06a0) jp AdvancePlayerSprite ; check if the player has stepped onto a warp after having not collided -CheckWarpsNoCollision:: ; 06b4 (0:06b4) +CheckWarpsNoCollision:: ld a,[wNumberOfWarps] and a jp z,CheckMapConnections @@ -389,7 +389,7 @@ CheckWarpsNoCollision:: ; 06b4 (0:06b4) ld a,[wXCoord] ld e,a ld hl,wWarpEntries -CheckWarpsNoCollisionLoop:: ; 06cc (0:06cc) +CheckWarpsNoCollisionLoop:: ld a,[hli] ; check if the warp's Y position matches cp d jr nz,CheckWarpsNoCollisionRetry1 @@ -426,7 +426,7 @@ CheckWarpsNoCollisionLoop:: ; 06cc (0:06cc) jr WarpFound1 ; check if the player has stepped onto a warp after having collided -CheckWarpsCollision:: ; 0706 (0:0706) +CheckWarpsCollision:: ld a,[wNumberOfWarps] ld c,a ld hl,wWarpEntries @@ -455,20 +455,20 @@ CheckWarpsCollision:: ; 0706 (0:0706) jr nz,.loop jp OverworldLoop -CheckWarpsNoCollisionRetry1:: ; 072f (0:072f) +CheckWarpsNoCollisionRetry1:: inc hl -CheckWarpsNoCollisionRetry2:: ; 0730 (0:0730) +CheckWarpsNoCollisionRetry2:: inc hl inc hl jp ContinueCheckWarpsNoCollisionLoop -WarpFound1:: ; 0735 (0:0735) +WarpFound1:: ld a,[hli] ld [wDestinationWarpID],a ld a,[hli] ld [hWarpDestinationMap],a -WarpFound2:: ; 073c (0:073c) +WarpFound2:: ld a,[wNumberOfWarps] sub c ld [wWarpedFromWhichWarp],a ; save ID of used warp @@ -526,13 +526,13 @@ WarpFound2:: ; 073c (0:073c) call IgnoreInputForHalfSecond jp EnterMap -ContinueCheckWarpsNoCollisionLoop:: ; 07b5 (0:07b5) +ContinueCheckWarpsNoCollisionLoop:: inc b ; increment warp number dec c ; decrement number of warps jp nz,CheckWarpsNoCollisionLoop ; if no matching warp was found -CheckMapConnections:: ; 07ba (0:07ba) +CheckMapConnections:: .checkWestMap ld a,[wXCoord] cp a,$ff @@ -670,7 +670,7 @@ CheckMapConnections:: ; 07ba (0:07ba) jp OverworldLoop ; function to play a sound when changing maps -PlayMapChangeSound:: ; 08c9 (0:08c9) +PlayMapChangeSound:: aCoord 8, 8 ; upper left tile of the 4x4 square the player's sprite is standing on cp a,$0b ; door tile in tileset 0 jr nz,.didNotGoThroughDoor @@ -685,7 +685,7 @@ PlayMapChangeSound:: ; 08c9 (0:08c9) ret nz jp GBFadeOutToBlack -CheckIfInOutsideMap:: ; 08e1 (0:08e1) +CheckIfInOutsideMap:: ; If the player is in an outside map (a town or route), set the z flag ld a, [wCurMapTileset] and a ; most towns/routes have tileset 0 (OVERWORLD) @@ -699,7 +699,7 @@ CheckIfInOutsideMap:: ; 08e1 (0:08e1) ; "function 1" passes when the player is at the edge of the map and is facing towards the outside of the map ; "function 2" passes when the the tile in front of the player is among a certain set ; sets carry if the check passes, otherwise clears carry -ExtraWarpCheck:: ; 08e9 (0:08e9) +ExtraWarpCheck:: ld a, [wCurMap] cp SS_ANNE_3 jr z, .useFunction1 @@ -729,7 +729,7 @@ ExtraWarpCheck:: ; 08e9 (0:08e9) ld b, BANK(IsWarpTileInFrontOfPlayer) jp Bankswitch -MapEntryAfterBattle:: ; 091f (0:091f) +MapEntryAfterBattle:: callba IsPlayerStandingOnWarp ; for enabling warp testing after collisions ld a,[wMapPalOffset] and a @@ -853,7 +853,7 @@ IsBikeRidingAllowed:: INCLUDE "data/bike_riding_tilesets.asm" ; load the tile pattern data of the current tileset into VRAM -LoadTilesetTilePatternData:: ; 09e8 (0:09e8) +LoadTilesetTilePatternData:: ld a,[wTileSetGFXPtr] ld l,a ld a,[wTileSetGFXPtr + 1] @@ -865,7 +865,7 @@ LoadTilesetTilePatternData:: ; 09e8 (0:09e8) ; this loads the current maps complete tile map (which references blocks, not individual tiles) to C6E8 ; it can also load partial tile maps of connected maps into a border of length 3 around the current map -LoadTileBlockMap:: ; 09fc (0:09fc) +LoadTileBlockMap:: ; fill C6E8-CBFB with the background tile ld hl,wOverworldMap ld a,[wMapBackgroundTile] @@ -994,7 +994,7 @@ LoadTileBlockMap:: ; 09fc (0:09fc) .done ret -LoadNorthSouthConnectionsTileMap:: ; 0ade (0:0ade) +LoadNorthSouthConnectionsTileMap:: ld c,MAP_BORDER .loop push de @@ -1026,7 +1026,7 @@ LoadNorthSouthConnectionsTileMap:: ; 0ade (0:0ade) jr nz,.loop ret -LoadEastWestConnectionsTileMap:: ; 0b02 (0:0b02) +LoadEastWestConnectionsTileMap:: push hl push de ld c,MAP_BORDER @@ -1058,7 +1058,7 @@ LoadEastWestConnectionsTileMap:: ; 0b02 (0:0b02) ; function to check if there is a sign or sprite in front of the player ; if so, it is stored in [hSpriteIndexOrTextID] ; if not, [hSpriteIndexOrTextID] is set to 0 -IsSpriteOrSignInFrontOfPlayer:: ; 0b23 (0:0b23) +IsSpriteOrSignInFrontOfPlayer:: xor a ld [hSpriteIndexOrTextID],a ld a,[wNumSigns] @@ -1112,9 +1112,9 @@ IsSpriteOrSignInFrontOfPlayer:: ; 0b23 (0:0b23) ; part of the above function, but sometimes its called on its own, when signs are irrelevant ; the caller must zero [hSpriteIndexOrTextID] -IsSpriteInFrontOfPlayer:: ; 0b6b (0:0b6b) +IsSpriteInFrontOfPlayer:: ld d,$10 ; talking range in pixels (normal range) -IsSpriteInFrontOfPlayer2:: ; 0b6d (0:0b6d) +IsSpriteInFrontOfPlayer2:: lb bc, $3c, $40 ; Y and X position of player sprite ld a,[wSpriteStateData1 + 9] ; direction the player is facing .checkIfPlayerFacingUp @@ -1198,7 +1198,7 @@ IsSpriteInFrontOfPlayer2:: ; 0b6d (0:0b6d) ; function to check if the player will jump down a ledge and check if the tile ahead is passable (when not surfing) ; sets the carry flag if there is a collision, and unsets it if there isn't a collision -CollisionCheckOnLand:: ; 0bd1 (0:0bd1) +CollisionCheckOnLand:: ld a,[wd736] bit 6,a ; is the player jumping? jr nz,.noCollision @@ -1238,7 +1238,7 @@ CollisionCheckOnLand:: ; 0bd1 (0:0bd1) ; function that checks if the tile in front of the player is passable ; clears carry if it is, sets carry if not -CheckTilePassable:: ; 0c10 (0:0c10) +CheckTilePassable:: predef GetTileAndCoordsInFrontOfPlayer ; get tile in front of player ld a,[wTileInFrontOfPlayer] ; tile in front of player ld c,a @@ -1261,7 +1261,7 @@ CheckTilePassable:: ; 0c10 (0:0c10) ; and check for collisions that only occur between certain pairs of tiles ; Input: hl - address of directional collision data ; sets carry if there is a collision and unsets carry if not -CheckForJumpingAndTilePairCollisions:: ; 0c2a (0:0c2a) +CheckForJumpingAndTilePairCollisions:: push hl predef GetTileAndCoordsInFrontOfPlayer ; get the tile in front of the player push de @@ -1276,11 +1276,11 @@ CheckForJumpingAndTilePairCollisions:: ; 0c2a (0:0c2a) ret nz ; if not jumping -CheckForTilePairCollisions2:: ; 0c44 (0:0c44) +CheckForTilePairCollisions2:: aCoord 8, 9 ; tile the player is on ld [wTilePlayerStandingOn],a -CheckForTilePairCollisions:: ; 0c4a (0:0c4a) +CheckForTilePairCollisions:: ld a,[wTileInFrontOfPlayer] ld c,a .tilePairCollisionLoop @@ -1330,7 +1330,7 @@ CheckForTilePairCollisions:: ; 0c4a (0:0c4a) ; these entries indicate that the player may not cross between tile 1 and tile 2 ; it's mainly used to simulate differences in elevation -TilePairCollisionsLand:: ; 0c7e (0:0c7e) +TilePairCollisionsLand:: db CAVERN, $20, $05 db CAVERN, $41, $05 db FOREST, $30, $2E @@ -1344,14 +1344,14 @@ TilePairCollisionsLand:: ; 0c7e (0:0c7e) db FOREST, $5F, $2E db $FF -TilePairCollisionsWater:: ; 0ca0 (0:0ca0) +TilePairCollisionsWater:: db FOREST, $14, $2E db FOREST, $48, $2E db CAVERN, $14, $05 db $FF ; this builds a tile map from the tile block map based on the current X/Y coordinates of the player's character -LoadCurrentMapView:: ; 0caa (0:0caa) +LoadCurrentMapView:: ld a,[H_LOADEDROMBANK] push af ld a,[wTileSetBank] ; tile data ROM bank @@ -1441,7 +1441,7 @@ LoadCurrentMapView:: ; 0caa (0:0caa) ld [MBC1RomBank],a ; restore previous ROM bank ret -AdvancePlayerSprite:: ; 0d27 (0:0d27) +AdvancePlayerSprite:: ld a,[wSpriteStateData1 + 3] ; delta Y ld b,a ld a,[wSpriteStateData1 + 5] ; delta X @@ -1639,7 +1639,7 @@ AdvancePlayerSprite:: ; 0d27 (0:0d27) ; the following four functions are used to move the pointer to the upper left ; corner of the tile block map in the direction of motion -MoveTileBlockMapPointerEast:: ; 0e65 (0:0e65) +MoveTileBlockMapPointerEast:: ld a,[de] add a,$01 ld [de],a @@ -1650,7 +1650,7 @@ MoveTileBlockMapPointerEast:: ; 0e65 (0:0e65) ld [de],a ret -MoveTileBlockMapPointerWest:: ; 0e6f (0:0e6f) +MoveTileBlockMapPointerWest:: ld a,[de] sub a,$01 ld [de],a @@ -1661,7 +1661,7 @@ MoveTileBlockMapPointerWest:: ; 0e6f (0:0e6f) ld [de],a ret -MoveTileBlockMapPointerSouth:: ; 0e79 (0:0e79) +MoveTileBlockMapPointerSouth:: add a,MAP_BORDER * 2 ld b,a ld a,[de] @@ -1674,7 +1674,7 @@ MoveTileBlockMapPointerSouth:: ; 0e79 (0:0e79) ld [de],a ret -MoveTileBlockMapPointerNorth:: ; 0e85 (0:0e85) +MoveTileBlockMapPointerNorth:: add a,MAP_BORDER * 2 ld b,a ld a,[de] @@ -1690,7 +1690,7 @@ MoveTileBlockMapPointerNorth:: ; 0e85 (0:0e85) ; the following 6 functions are used to tell the V-blank handler to redraw ; the portion of the map that was newly exposed due to the player's movement -ScheduleNorthRowRedraw:: ; 0e91 (0:0e91) +ScheduleNorthRowRedraw:: coord hl, 0, 0 call CopyToRedrawRowOrColumnSrcTiles ld a,[wMapViewVRAMPointer] @@ -1701,7 +1701,7 @@ ScheduleNorthRowRedraw:: ; 0e91 (0:0e91) ld [hRedrawRowOrColumnMode],a ret -CopyToRedrawRowOrColumnSrcTiles:: ; 0ea6 (0:0ea6) +CopyToRedrawRowOrColumnSrcTiles:: ld de,wRedrawRowOrColumnSrcTiles ld c,2 * SCREEN_WIDTH .loop @@ -1712,7 +1712,7 @@ CopyToRedrawRowOrColumnSrcTiles:: ; 0ea6 (0:0ea6) jr nz,.loop ret -ScheduleSouthRowRedraw:: ; 0eb2 (0:0eb2) +ScheduleSouthRowRedraw:: coord hl, 0, 16 call CopyToRedrawRowOrColumnSrcTiles ld a,[wMapViewVRAMPointer] @@ -1731,7 +1731,7 @@ ScheduleSouthRowRedraw:: ; 0eb2 (0:0eb2) ld [hRedrawRowOrColumnMode],a ret -ScheduleEastColumnRedraw:: ; 0ed3 (0:0ed3) +ScheduleEastColumnRedraw:: coord hl, 18, 0 call ScheduleColumnRedrawHelper ld a,[wMapViewVRAMPointer] @@ -1749,7 +1749,7 @@ ScheduleEastColumnRedraw:: ; 0ed3 (0:0ed3) ld [hRedrawRowOrColumnMode],a ret -ScheduleColumnRedrawHelper:: ; 0ef2 (0:0ef2) +ScheduleColumnRedrawHelper:: ld de,wRedrawRowOrColumnSrcTiles ld c,SCREEN_HEIGHT .loop @@ -1769,7 +1769,7 @@ ScheduleColumnRedrawHelper:: ; 0ef2 (0:0ef2) jr nz,.loop ret -ScheduleWestColumnRedraw:: ; 0f08 (0:0f08) +ScheduleWestColumnRedraw:: coord hl, 0, 0 call ScheduleColumnRedrawHelper ld a,[wMapViewVRAMPointer] @@ -1782,7 +1782,7 @@ ScheduleWestColumnRedraw:: ; 0f08 (0:0f08) ; function to write the tiles that make up a tile block to memory ; Input: c = tile block ID, hl = destination address -DrawTileBlock:: ; 0f1d (0:0f1d) +DrawTileBlock:: push hl ld a,[wTileSetBlocksPtr] ; pointer to tiles ld l,a @@ -1823,7 +1823,7 @@ DrawTileBlock:: ; 0f1d (0:0f1d) ret ; function to update joypad state and simulate button presses -JoypadOverworld:: ; 0f4d (0:0f4d) +JoypadOverworld:: xor a ld [wSpriteStateData1 + 3],a ld [wSpriteStateData1 + 5],a @@ -1893,7 +1893,7 @@ JoypadOverworld:: ; 0f4d (0:0f4d) ; so the old value of c is used. 2429 is always called before this function, ; and 2429 always sets c to 0xF0. There is no 0xF0 background tile, so it ; is considered impassable and it is detected as a collision. -CollisionCheckOnWater:: ; 0fb7 (0:0fb7) +CollisionCheckOnWater:: ld a,[wd730] bit 7,a jp nz,.noCollision ; return and clear carry if button presses are being simulated @@ -1952,7 +1952,7 @@ CollisionCheckOnWater:: ; 0fb7 (0:0fb7) jr .stopSurfing ; if it is the boarding platform tile, stop surfing ; function to run the current map's script -RunMapScript:: ; 101b (0:101b) +RunMapScript:: push hl push de push bc @@ -1978,21 +1978,21 @@ RunMapScript:: ; 101b (0:101b) .return ret -LoadWalkingPlayerSpriteGraphics:: ; 104d (0:104d) +LoadWalkingPlayerSpriteGraphics:: ld de,RedSprite ld hl,vNPCSprites jr LoadPlayerSpriteGraphicsCommon -LoadSurfingPlayerSpriteGraphics:: ; 1055 (0:1055) +LoadSurfingPlayerSpriteGraphics:: ld de,SeelSprite ld hl,vNPCSprites jr LoadPlayerSpriteGraphicsCommon -LoadBikePlayerSpriteGraphics:: ; 105d (0:105d) +LoadBikePlayerSpriteGraphics:: ld de,RedCyclingSprite ld hl,vNPCSprites -LoadPlayerSpriteGraphicsCommon:: ; 1063 (0:1063) +LoadPlayerSpriteGraphicsCommon:: push de push hl lb bc, BANK(RedSprite), $0c @@ -2010,7 +2010,7 @@ LoadPlayerSpriteGraphicsCommon:: ; 1063 (0:1063) jp CopyVideoData ; function to load data from the map header -LoadMapHeader:: ; 107c (0:107c) +LoadMapHeader:: callba MarkTownVisitedAndLoadMissableObjects ld a,[wCurMapTileset] ld [wUnusedD119],a @@ -2289,7 +2289,7 @@ LoadMapHeader:: ; 107c (0:107c) ; function to copy map connection data from ROM to WRAM ; Input: hl = source, de = destination -CopyMapConnectionHeader:: ; 1238 (0:1238) +CopyMapConnectionHeader:: ld c,$0b .loop ld a,[hli] @@ -2300,7 +2300,7 @@ CopyMapConnectionHeader:: ; 1238 (0:1238) ret ; function to load map data -LoadMapData:: ; 1241 (0:1241) +LoadMapData:: ld a,[H_LOADEDROMBANK] push af call DisableLCD @@ -2362,7 +2362,7 @@ LoadMapData:: ; 1241 (0:1241) ; function to switch to the ROM bank that a map is stored in ; Input: a = map number -SwitchToMapRomBank:: ; 12bc (0:12bc) +SwitchToMapRomBank:: push hl push bc ld c,a @@ -2381,7 +2381,7 @@ SwitchToMapRomBank:: ; 12bc (0:12bc) pop hl ret -IgnoreInputForHalfSecond: ; 12da (0:12da) +IgnoreInputForHalfSecond: ld a, 30 ld [wIgnoreInputCounter], a ld hl, wd730 @@ -2390,12 +2390,12 @@ IgnoreInputForHalfSecond: ; 12da (0:12da) ld [hl], a ; set ignore input bit ret -ResetUsingStrengthOutOfBattleBit: ; 12e7 (0:12e7) +ResetUsingStrengthOutOfBattleBit: ld hl, wd728 res 0, [hl] ret -ForceBikeOrSurf:: ; 12ed (0:12ed) +ForceBikeOrSurf:: ld b, BANK(RedSprite) ld hl, LoadPlayerSpriteGraphics call Bankswitch |