diff options
Diffstat (limited to 'home/map.asm')
-rw-r--r-- | home/map.asm | 300 |
1 files changed, 98 insertions, 202 deletions
diff --git a/home/map.asm b/home/map.asm index 02b25f3c6..a546c00f9 100644 --- a/home/map.asm +++ b/home/map.asm @@ -1,14 +1,13 @@ ; Functions dealing with rendering and interacting with maps. -Clearwc7e8:: ; 210f +Clearwc7e8:: ld hl, wc7e8 ld bc, wc7e8_End - wc7e8 ld a, 0 call ByteFill ret -; 211b -CheckScenes:: ; 211b +CheckScenes:: ; Checks wCurrMapSceneScriptPointer. If it's empty, returns -1 in a. Otherwise, returns the active scene ID in a. push hl ld hl, wCurrMapSceneScriptPointer @@ -23,9 +22,8 @@ CheckScenes:: ; 211b .scene_exists pop hl ret -; 212a -GetCurrentMapSceneID:: ; 212a +GetCurrentMapSceneID:: ; Grabs the wram map scene script pointer for the current map and loads it into wCurrMapSceneScriptPointer. ; If there is no scene, both bytes of wCurrMapSceneScriptPointer are wiped clean. ; Copy the current map group and number into bc. This is needed for GetMapSceneID. @@ -46,9 +44,8 @@ GetCurrentMapSceneID:: ; 212a ld [wCurrMapSceneScriptPointer + 1], a xor a ret -; 2147 -GetMapSceneID:: ; 2147 +GetMapSceneID:: ; Searches the scene script table for the map group and number loaded in bc, and returns the wram pointer in de. ; If the map is not in the scene script table, returns carry. push bc @@ -93,15 +90,13 @@ GetMapSceneID:: ; 2147 pop bc ret -; 2173 -OverworldTextModeSwitch:: ; 2173 +OverworldTextModeSwitch:: call LoadMapPart call FarCallSwapTextboxPalettes ret -; 217a -LoadMapPart:: ; 217a +LoadMapPart:: ld a, [hROMBank] push af @@ -121,9 +116,8 @@ LoadMapPart:: ; 217a pop af rst Bankswitch ret -; 2198 -LoadMetatiles:: ; 2198 +LoadMetatiles:: ; de <- wOverworldMapAnchor ld a, [wOverworldMapAnchor] ld e, a @@ -210,18 +204,16 @@ endr dec b jp nz, .row ret -; 222a -ReturnToMapFromSubmenu:: ; 222a +ReturnToMapFromSubmenu:: ld a, MAPSETUP_SUBMENU ld [hMapEntryMethod], a farcall RunMapSetupScript xor a ld [hMapEntryMethod], a ret -; 2238 -CheckWarpTile:: ; 2238 +CheckWarpTile:: call GetDestinationWarpNumber ret nc @@ -233,16 +225,14 @@ CheckWarpTile:: ; 2238 call CopyWarpData scf ret -; 224a -WarpCheck:: ; 224a +WarpCheck:: call GetDestinationWarpNumber ret nc call CopyWarpData ret -; 2252 -GetDestinationWarpNumber:: ; 2252 +GetDestinationWarpNumber:: farcall CheckWarpCollision ret nc @@ -256,9 +246,8 @@ GetDestinationWarpNumber:: ; 2252 ld a, d rst Bankswitch ret -; 2266 -.GetDestinationWarpNumber: ; 2266 +.GetDestinationWarpNumber: ld a, [wPlayerStandingMapY] sub 4 ld e, a @@ -315,9 +304,8 @@ GetDestinationWarpNumber:: ; 2252 inc hl scf ret -; 22a7 -CopyWarpData:: ; 22a7 +CopyWarpData:: ld a, [hROMBank] push af @@ -328,9 +316,8 @@ CopyWarpData:: ; 22a7 rst Bankswitch scf ret -; 22b4 -.CopyWarpData: ; 22b4 +.CopyWarpData: push bc ld hl, wCurrMapWarpsPointer ld a, [hli] @@ -364,16 +351,14 @@ CopyWarpData:: ; 22a7 ld [wPrevMapNumber], a scf ret -; 22ee -CheckOutdoorMap:: ; 22ee +CheckOutdoorMap:: cp ROUTE ret z cp TOWN ret -; 22f4 -CheckIndoorMap:: ; 22f4 +CheckIndoorMap:: cp INDOOR ret z cp CAVE @@ -382,7 +367,6 @@ CheckIndoorMap:: ; 22f4 ret z cp GATE ret -; 2300 ; unused cp INDOOR @@ -391,36 +375,32 @@ CheckIndoorMap:: ; 22f4 ret z cp ENVIRONMENT_5 ret -; 2309 -LoadMapAttributes:: ; 2309 +LoadMapAttributes:: call CopyMapPartialAndAttributes call SwitchToMapScriptsBank call ReadMapScripts xor a ; do not skip object_events call ReadMapEvents ret -; 2317 -LoadMapAttributes_SkipPeople:: ; 2317 +LoadMapAttributes_SkipPeople:: call CopyMapPartialAndAttributes call SwitchToMapScriptsBank call ReadMapScripts ld a, TRUE ; skip object events call ReadMapEvents ret -; 2326 -CopyMapPartialAndAttributes:: ; 2326 +CopyMapPartialAndAttributes:: call CopyMapPartial call SwitchToMapAttributesBank call GetMapAttributesPointer call CopyMapAttributes call GetMapConnections ret -; 2336 -ReadMapEvents:: ; 2336 +ReadMapEvents:: push af ld hl, wMapEventsPointer ld a, [hli] @@ -438,9 +418,8 @@ ReadMapEvents:: ; 2336 call ReadObjectEvents ret -; 234f -ReadMapScripts:: ; 234f +ReadMapScripts:: ld hl, wMapScriptsPointer ld a, [hli] ld h, [hl] @@ -448,9 +427,8 @@ ReadMapScripts:: ; 234f call ReadMapSceneScripts call ReadMapCallbacks ret -; 235c -CopyMapAttributes:: ; 235c +CopyMapAttributes:: ld de, wMapAttributes ld c, wMapAttributesEnd - wMapAttributes .loop @@ -460,9 +438,8 @@ CopyMapAttributes:: ; 235c dec c jr nz, .loop ret -; 2368 -GetMapConnections:: ; 2368 +GetMapConnections:: ld a, $ff ld [wNorthConnectedMapGroup], a ld [wSouthConnectedMapGroup], a @@ -497,9 +474,8 @@ GetMapConnections:: ; 2368 .no_east ret -; 23a3 -GetMapConnection:: ; 23a3 +GetMapConnection:: ; Load map connection struct at hl into de. ld c, wSouthMapConnection - wNorthMapConnection .loop @@ -509,9 +485,8 @@ GetMapConnection:: ; 23a3 dec c jr nz, .loop ret -; 23ac -ReadMapSceneScripts:: ; 23ac +ReadMapSceneScripts:: ld a, [hli] ; scene script count ld c, a ld [wCurrMapSceneScriptCount], a ; current map scene script count @@ -526,9 +501,8 @@ ReadMapSceneScripts:: ; 23ac ld bc, 4 ; scene_script size call AddNTimes ret -; 23c3 -ReadMapCallbacks:: ; 23c3 +ReadMapCallbacks:: ld a, [hli] ld c, a ld [wCurrMapCallbackCount], a @@ -543,9 +517,8 @@ ReadMapCallbacks:: ; 23c3 ld bc, 3 call AddNTimes ret -; 23da -ReadWarps:: ; 23da +ReadWarps:: ld a, [hli] ld c, a ld [wCurrMapWarpCount], a @@ -559,9 +532,8 @@ ReadWarps:: ; 23da ld bc, 5 call AddNTimes ret -; 23f1 -ReadCoordEvents:: ; 23f1 +ReadCoordEvents:: ld a, [hli] ld c, a ld [wCurrMapCoordEventCount], a @@ -577,9 +549,8 @@ ReadCoordEvents:: ; 23f1 ld bc, 8 call AddNTimes ret -; 2408 -ReadBGEvents:: ; 2408 +ReadBGEvents:: ld a, [hli] ld c, a ld [wCurrMapBGEventCount], a @@ -595,9 +566,8 @@ ReadBGEvents:: ; 2408 ld bc, 5 call AddNTimes ret -; 241f -ReadObjectEvents:: ; 241f +ReadObjectEvents:: push hl call ClearObjectStructs pop de @@ -641,9 +611,8 @@ ReadObjectEvents:: ; 241f ld h, d ld l, e ret -; 2457 -CopyMapObjectEvents:: ; 2457 +CopyMapObjectEvents:: and a ret z @@ -668,9 +637,8 @@ CopyMapObjectEvents:: ; 2457 dec c jr nz, .loop ret -; 2471 -ClearObjectStructs:: ; 2471 +ClearObjectStructs:: ld hl, wObject1Struct ld bc, OBJECT_STRUCT_LENGTH * (NUM_OBJECT_STRUCTS - 1) xor a @@ -687,9 +655,8 @@ ClearObjectStructs:: ; 2471 dec c jr nz, .loop ret -; 248a -RestoreFacingAfterWarp:: ; 248a +RestoreFacingAfterWarp:: call GetMapScriptsBank rst Bankswitch @@ -719,7 +686,6 @@ RestoreFacingAfterWarp:: ; 248a .skip farcall GetCoordOfUpperLeftCorner ret -; 24ba .backup ld a, [wPrevWarp] @@ -729,9 +695,8 @@ RestoreFacingAfterWarp:: ; 248a ld a, [wPrevMapNumber] ld [wBackupMapNumber], a ret -; 24cd -LoadBlockData:: ; 24cd +LoadBlockData:: ld hl, wOverworldMapBlocks ld bc, wOverworldMapBlocksEnd - wOverworldMapBlocks ld a, 0 @@ -741,9 +706,8 @@ LoadBlockData:: ; 24cd ld a, MAPCALLBACK_TILES call RunMapCallback ret -; 24e4 -ChangeMap:: ; 24e4 +ChangeMap:: ld a, [hROMBank] push af @@ -791,9 +755,8 @@ ChangeMap:: ; 24e4 pop af rst Bankswitch ret -; 2524 -FillMapConnections:: ; 2524 +FillMapConnections:: ; North ld a, [wNorthConnectedMapGroup] @@ -889,10 +852,9 @@ FillMapConnections:: ; 2524 .Done: ret -; 25d3 FillNorthConnectionStrip:: -FillSouthConnectionStrip:: ; 25d3 +FillSouthConnectionStrip:: ld c, 3 .y @@ -925,10 +887,9 @@ FillSouthConnectionStrip:: ; 25d3 dec c jr nz, .y ret -; 25f6 FillWestConnectionStrip:: -FillEastConnectionStrip:: ; 25f6 +FillEastConnectionStrip:: .loop ld a, [wMapWidth] @@ -964,14 +925,12 @@ FillEastConnectionStrip:: ; 25f6 dec b jr nz, .loop ret -; 261b -LoadMapStatus:: ; 261b +LoadMapStatus:: ld [wMapStatus], a ret -; 261f -CallScript:: ; 261f +CallScript:: ; Call a script at a:hl. ld [wScriptBank], a @@ -985,18 +944,16 @@ CallScript:: ; 261f scf ret -; 2631 -CallMapScript:: ; 2631 +CallMapScript:: ; Call a script at hl in the current bank if there isn't already a script running ld a, [wScriptRunning] and a ret nz call GetMapScriptsBank jr CallScript -; 263b -RunMapCallback:: ; 263b +RunMapCallback:: ; Will run the first callback found with execution index equal to a. ld b, a ld a, [hROMBank] @@ -1015,9 +972,8 @@ RunMapCallback:: ; 263b pop af rst Bankswitch ret -; 2653 -.FindCallback: ; 2653 +.FindCallback: ld a, [wCurrMapCallbackCount] ld c, a and a @@ -1046,9 +1002,8 @@ RunMapCallback:: ; 263b ld l, a scf ret -; 2674 -ExecuteCallbackScript:: ; 2674 +ExecuteCallbackScript:: ; Do map callback de and return to script bank b. farcall CallCallback ld a, [wScriptMode] @@ -1064,9 +1019,8 @@ ExecuteCallbackScript:: ; 2674 pop af ld [wScriptMode], a ret -; 269a -MapTextbox:: ; 269a +MapTextbox:: ld a, [hROMBank] push af @@ -1087,9 +1041,8 @@ MapTextbox:: ; 269a pop af rst Bankswitch ret -; 26b7 -Call_a_de:: ; 26b7 +Call_a_de:: ; Call a:de. ld [hBuffer], a @@ -1107,9 +1060,8 @@ Call_a_de:: ; 26b7 .de push de ret -; 26c7 -GetMovementData:: ; 26c7 +GetMovementData:: ; Initialize the movement data for object c at b:hl ld a, [hROMBank] push af @@ -1123,7 +1075,6 @@ GetMovementData:: ; 26c7 ld a, h rst Bankswitch ret -; 26d4 GetScriptByte:: ; 0x26d4 ; Return byte at wScriptBank:wScriptPos in a. @@ -1165,25 +1116,21 @@ ObjectEventText:: db "@" ; 0x26f7 -BGEvent:: ; 26f7 +BGEvent:: jumptext BGEventText -; 26fa -BGEventText:: ; 26fa +BGEventText:: text_jump UnknownText_0x1c46fc db "@" -; 26ff -CoordinatesEvent:: ; 26ff +CoordinatesEvent:: jumptext CoordinatesEventText -; 2702 -CoordinatesEventText:: ; 2702 +CoordinatesEventText:: text_jump UnknownText_0x1c4706 db "@" -; 2707 -CheckObjectMask:: ; 2707 +CheckObjectMask:: ld a, [hMapObjectIndexBuffer] ld e, a ld d, $0 @@ -1191,9 +1138,8 @@ CheckObjectMask:: ; 2707 add hl, de ld a, [hl] ret -; 2712 -MaskObject:: ; 2712 +MaskObject:: ld a, [hMapObjectIndexBuffer] ld e, a ld d, $0 @@ -1201,9 +1147,8 @@ MaskObject:: ; 2712 add hl, de ld [hl], -1 ; , masked ret -; 271e -UnmaskObject:: ; 271e +UnmaskObject:: ld a, [hMapObjectIndexBuffer] ld e, a ld d, $0 @@ -1211,9 +1156,8 @@ UnmaskObject:: ; 271e add hl, de ld [hl], 0 ; unmasked ret -; 272a -ScrollMapDown:: ; 272a +ScrollMapDown:: hlcoord 0, 0 ld de, wBGMapBuffer call BackupBGMapRow @@ -1227,9 +1171,8 @@ ScrollMapDown:: ; 272a ld a, $1 ld [hBGMapUpdate], a ret -; 2748 -ScrollMapUp:: ; 2748 +ScrollMapUp:: hlcoord 0, SCREEN_HEIGHT - 2 ld de, wBGMapBuffer call BackupBGMapRow @@ -1251,9 +1194,8 @@ ScrollMapUp:: ; 2748 ld a, $1 ld [hBGMapUpdate], a ret -; 2771 -ScrollMapRight:: ; 2771 +ScrollMapRight:: hlcoord 0, 0 ld de, wBGMapBuffer call BackupBGMapColumn @@ -1267,9 +1209,8 @@ ScrollMapRight:: ; 2771 ld a, $1 ld [hBGMapUpdate], a ret -; 278f -ScrollMapLeft:: ; 278f +ScrollMapLeft:: hlcoord SCREEN_WIDTH - 2, 0 ld de, wBGMapBuffer call BackupBGMapColumn @@ -1290,9 +1231,8 @@ ScrollMapLeft:: ; 278f ld a, $1 ld [hBGMapUpdate], a ret -; 27b7 -BackupBGMapRow:: ; 27b7 +BackupBGMapRow:: ld c, 2 * SCREEN_WIDTH .loop ld a, [hli] @@ -1301,9 +1241,8 @@ BackupBGMapRow:: ; 27b7 dec c jr nz, .loop ret -; 27c0 -BackupBGMapColumn:: ; 27c0 +BackupBGMapColumn:: ld c, SCREEN_HEIGHT .loop ld a, [hli] @@ -1322,9 +1261,8 @@ BackupBGMapColumn:: ; 27c0 dec c jr nz, .loop ret -; 27d3 -UpdateBGMapRow:: ; 27d3 +UpdateBGMapRow:: ld hl, wBGMapBufferPtrs push de call .iteration @@ -1354,9 +1292,8 @@ UpdateBGMapRow:: ; 27d3 ld a, SCREEN_WIDTH ld [hBGMapTileCount], a ret -; 27f8 -UpdateBGMapColumn:: ; 27f8 +UpdateBGMapColumn:: ld hl, wBGMapBufferPtrs ld c, SCREEN_HEIGHT .loop @@ -1381,7 +1318,6 @@ UpdateBGMapColumn:: ; 27f8 ld a, SCREEN_HEIGHT ld [hBGMapTileCount], a ret -; 2816 Unreferenced_Function2816:: ld hl, wBGMapBuffer @@ -1389,9 +1325,8 @@ Unreferenced_Function2816:: xor a call ByteFill ret -; 2821 -LoadTilesetGFX:: ; 2821 +LoadTilesetGFX:: ld hl, wTilesetAddress ld a, [hli] ld h, [hl] @@ -1446,9 +1381,8 @@ LoadTilesetGFX:: ; 2821 xor a ld [hTileAnimFrame], a ret -; 2879 -BufferScreen:: ; 2879 +BufferScreen:: ld hl, wOverworldMapAnchor ld a, [hli] ld h, [hl] @@ -1475,9 +1409,8 @@ BufferScreen:: ; 2879 dec c jr nz, .row ret -; 289d -SaveScreen:: ; 289d +SaveScreen:: ld hl, wOverworldMapAnchor ld a, [hli] ld h, [hl] @@ -1524,7 +1457,7 @@ SaveScreen:: ; 289d ld c, SCREEN_META_HEIGHT jr SaveScreen_LoadNeighbor -LoadNeighboringBlockData:: ; 28e3 +LoadNeighboringBlockData:: ld hl, wOverworldMapAnchor ld a, [hli] ld h, [hl] @@ -1536,7 +1469,7 @@ LoadNeighboringBlockData:: ; 28e3 ld b, SCREEN_META_WIDTH ld c, SCREEN_META_HEIGHT -SaveScreen_LoadNeighbor:: ; 28f7 +SaveScreen_LoadNeighbor:: .row push bc push hl @@ -1564,9 +1497,8 @@ SaveScreen_LoadNeighbor:: ; 28f7 dec c jr nz, .row ret -; 2914 -GetMovementPermissions:: ; 2914 +GetMovementPermissions:: xor a ld [wTilePermissions], a call .LeftRight @@ -1594,9 +1526,8 @@ GetMovementPermissions:: ; 2914 or [hl] ld [hl], a ret -; 2945 -.MovementPermissionsData: ; 2945 +.MovementPermissionsData: db DOWN_MASK db UP_MASK db LEFT_MASK @@ -1605,7 +1536,6 @@ GetMovementPermissions:: ; 2914 db UP_MASK | RIGHT_MASK db DOWN_MASK | LEFT_MASK db UP_MASK | LEFT_MASK -; 294d .UpDown: ld a, [wPlayerStandingMapX] @@ -1625,7 +1555,6 @@ GetMovementPermissions:: ; 2914 ld [wTileUp], a call .Up ret -; 296c .LeftRight: ld a, [wPlayerStandingMapX] @@ -1645,7 +1574,6 @@ GetMovementPermissions:: ; 2914 ld [wTileRight], a call .Right ret -; 298b .Down: call .CheckHiNybble @@ -1664,7 +1592,6 @@ GetMovementPermissions:: ; 2914 or FACE_DOWN ld [wTilePermissions], a ret -; 29a8 .Up: call .CheckHiNybble @@ -1683,7 +1610,6 @@ GetMovementPermissions:: ; 2914 or FACE_UP ld [wTilePermissions], a ret -; 29c5 .Right: call .CheckHiNybble @@ -1702,7 +1628,6 @@ GetMovementPermissions:: ; 2914 or FACE_RIGHT ld [wTilePermissions], a ret -; 29e2 .Left: call .CheckHiNybble @@ -1721,7 +1646,6 @@ GetMovementPermissions:: ; 2914 or FACE_LEFT ld [wTilePermissions], a ret -; 29ff .CheckHiNybble: and $f0 @@ -1729,9 +1653,8 @@ GetMovementPermissions:: ; 2914 ret z cp $c0 ret -; 2a07 -GetFacingTileCoord:: ; 2a07 +GetFacingTileCoord:: ; Return map coordinates in (d, e) and tile id in a ; of the tile the player is facing. @@ -1774,9 +1697,8 @@ GetFacingTileCoord:: ; 2a07 dw wTileLeft db 1, 0 dw wTileRight -; 2a3c -GetCoordTile:: ; 2a3c +GetCoordTile:: ; Get the collision byte for tile d, e call GetBlockLocation ld a, [hl] @@ -1809,9 +1731,8 @@ GetCoordTile:: ; 2a3c .nope ld a, -1 ret -; 2a66 -GetBlockLocation:: ; 2a66 +GetBlockLocation:: ld a, [wMapWidth] add 6 ld c, a @@ -1839,9 +1760,8 @@ GetBlockLocation:: ; 2a66 ld b, 0 add hl, bc ret -; 2a8b -CheckFacingBGEvent:: ; 2a8b +CheckFacingBGEvent:: call GetFacingTileCoord ; Load facing into b. ld b, a @@ -1866,9 +1786,8 @@ CheckFacingBGEvent:: ; 2a8b ld a, h rst Bankswitch ret -; 2aaa -CheckIfFacingTileCoordIsBGEvent:: ; 2aaa +CheckIfFacingTileCoordIsBGEvent:: ; Checks to see if you are facing a BG event. If so, copies it into wEngineBuffer1 and sets carry. ld hl, wCurrMapBGEventsPointer ld a, [hli] @@ -1905,9 +1824,8 @@ CheckIfFacingTileCoordIsBGEvent:: ; 2aaa call CopyBytes scf ret -; 2ad4 -CheckCurrentMapCoordEvents:: ; 2ad4 +CheckCurrentMapCoordEvents:: ; If there are no coord events, we don't need to be here. ld a, [wCurrMapCoordEventCount] and a @@ -1978,9 +1896,8 @@ CheckCurrentMapCoordEvents:: ; 2ad4 call CopyBytes scf ret -; 2b29 -FadeToMenu:: ; 2b29 +FadeToMenu:: xor a ld [hBGMapMode], a call LoadStandardMenuHeader @@ -1988,24 +1905,22 @@ FadeToMenu:: ; 2b29 call ClearSprites call DisableSpriteUpdates ret -; 2b3c -CloseSubmenu:: ; 2b3c +CloseSubmenu:: call ClearBGPalettes call ReloadTilesetAndPalettes call UpdateSprites call Call_ExitMenu call ret_d90 jr FinishExitMenu -; 2b4d -ExitAllMenus:: ; 2b4d +ExitAllMenus:: call ClearBGPalettes call Call_ExitMenu call ReloadTilesetAndPalettes call UpdateSprites call ret_d90 -FinishExitMenu:: ; 2b5c +FinishExitMenu:: ld b, SCGB_MAPPALS call GetSGBLayout farcall LoadOW_BGPal7 @@ -2013,7 +1928,6 @@ FinishExitMenu:: ; 2b5c farcall FadeInPalettes call EnableSpriteUpdates ret -; 2b74 ReturnToMapWithSpeechTextbox:: ; 0x2b74 push af @@ -2040,7 +1954,7 @@ ReturnToMapWithSpeechTextbox:: ; 0x2b74 ret ; 0x2bae -ReloadTilesetAndPalettes:: ; 2bae +ReloadTilesetAndPalettes:: call DisableLCD call ClearSprites farcall RefreshSprites @@ -2063,9 +1977,8 @@ ReloadTilesetAndPalettes:: ; 2bae call EnableLCD ret -; 2be5 -GetMapPointer:: ; 2be5 +GetMapPointer:: ld a, [wMapGroup] ld b, a ld a, [wMapNumber] @@ -2135,23 +2048,22 @@ GetAnyMapField:: ; 0x2c0c ret ; 0x2c1c -SwitchToMapAttributesBank:: ; 2c1c +SwitchToMapAttributesBank:: ld a, [wMapGroup] ld b, a ld a, [wMapNumber] ld c, a -SwitchToAnyMapAttributesBank:: ; 2c24 +SwitchToAnyMapAttributesBank:: call GetAnyMapAttributesBank rst Bankswitch ret -; 2c29 -GetMapAttributesBank:: ; 2c29 +GetMapAttributesBank:: ld a, [wMapGroup] ld b, a ld a, [wMapNumber] ld c, a -GetAnyMapAttributesBank:: ; 2c31 +GetAnyMapAttributesBank:: push hl push de ld de, MAP_MAPATTRIBUTES_BANK @@ -2160,9 +2072,8 @@ GetAnyMapAttributesBank:: ; 2c31 pop de pop hl ret -; 2c3d -CopyMapPartial:: ; 2c3d +CopyMapPartial:: ; Copy map data bank, tileset, environment, and map data address ; from the current map's entry within its group. ld a, [hROMBank] @@ -2178,20 +2089,17 @@ CopyMapPartial:: ; 2c3d pop af rst Bankswitch ret -; 2c52 -SwitchToMapScriptsBank:: ; 2c52 +SwitchToMapScriptsBank:: ld a, [wMapScriptsBank] rst Bankswitch ret -; 2c57 -GetMapScriptsBank:: ; 2c57 +GetMapScriptsBank:: ld a, [wMapScriptsBank] ret -; 2c5b -GetAnyMapBlocksBank:: ; 2c5b +GetAnyMapBlocksBank:: ; Return the blockdata bank for group b map c. push hl push de @@ -2219,7 +2127,6 @@ GetAnyMapBlocksBank:: ; 2c5b pop de pop hl ret -; 2c7d GetMapAttributesPointer:: ; 0x2c7d ; returns the current map's data pointer in hl. @@ -2232,9 +2139,8 @@ GetMapAttributesPointer:: ; 0x2c7d pop de pop bc ret -; 2c8a -GetMapEnvironment:: ; 2c8a +GetMapEnvironment:: push hl push de push bc @@ -2245,12 +2151,10 @@ GetMapEnvironment:: ; 2c8a pop de pop hl ret -; 2c98 ret ; unused -; 2c99 -GetAnyMapEnvironment:: ; 2c99 +GetAnyMapEnvironment:: push hl push de push bc @@ -2261,14 +2165,12 @@ GetAnyMapEnvironment:: ; 2c99 pop de pop hl ret -; 2ca7 -GetAnyMapTileset:: ; 2ca7 +GetAnyMapTileset:: ld de, MAP_TILESET call GetAnyMapField ld a, c ret -; 2caf GetWorldMapLocation:: ; 0x2caf ; given a map group/id in bc, return its location on the Pokégear map. @@ -2286,7 +2188,7 @@ GetWorldMapLocation:: ; 0x2caf ret ; 0x2cbd -GetMapMusic:: ; 2cbd +GetMapMusic:: push hl push bc ld de, MAP_MUSIC @@ -2329,22 +2231,19 @@ GetMapMusic:: ; 2cbd .clearedmahogany ld de, MUSIC_CHERRYGROVE_CITY jr .done -; 2cff -GetMapTimeOfDay:: ; 2cff +GetMapTimeOfDay:: call GetPhoneServiceTimeOfDayByte and $f ret -; 2d05 -GetMapPhoneService:: ; 2d05 +GetMapPhoneService:: call GetPhoneServiceTimeOfDayByte and $f0 swap a ret -; 2d0d -GetPhoneServiceTimeOfDayByte:: ; 2d0d +GetPhoneServiceTimeOfDayByte:: push hl push bc @@ -2355,9 +2254,8 @@ GetPhoneServiceTimeOfDayByte:: ; 2d0d pop bc pop hl ret -; 2d19 -GetFishingGroup:: ; 2d19 +GetFishingGroup:: push de push hl push bc @@ -2370,9 +2268,8 @@ GetFishingGroup:: ; 2d19 pop hl pop de ret -; 2d27 -LoadTileset:: ; 2d27 +LoadTileset:: push hl push bc @@ -2390,4 +2287,3 @@ LoadTileset:: ; 2d27 pop bc pop hl ret -; 2d43 |