diff options
Diffstat (limited to 'engine')
-rw-r--r-- | engine/events.asm | 12 | ||||
-rw-r--r-- | engine/events_2.asm | 12 | ||||
-rwxr-xr-x | engine/events_3.asm | 10 | ||||
-rw-r--r-- | engine/map_setup.asm | 4 | ||||
-rw-r--r-- | engine/pokedex.asm | 8 | ||||
-rwxr-xr-x | engine/warp_connection.asm | 65 |
6 files changed, 52 insertions, 59 deletions
diff --git a/engine/events.asm b/engine/events.asm index 0e8b29afc..e7598b595 100644 --- a/engine/events.asm +++ b/engine/events.asm @@ -167,10 +167,10 @@ HandleMap: ; 96773 cp 2 ; HandleMap ret nz - call Function967d1 + call HandleMapObjects call NextOverworldFrame - call Function967e1 - call Function967f4 + call HandleMapBackground + call CheckPlayerState ret ; 96795 @@ -226,21 +226,21 @@ HandleMapTimeAndJoypad: ; 967c1 ret ; 967d1 -Function967d1: ; 967d1 +HandleMapObjects: ; 967d1 callba HandleNPCStep ; engine/map_objects.asm callba _HandlePlayerStep call _CheckObjectEnteringVisibleRange ret ; 967e1 -Function967e1: ; 967e1 +HandleMapBackground: ; 967e1 callba _UpdateSprites callba ScrollScreen callba PlaceMapNameSign ret ; 967f4 -Function967f4: ; 967f4 +CheckPlayerState: ; 967f4 ld a, [wPlayerStepFlags] bit 5, a ; in the middle of step jr z, .events diff --git a/engine/events_2.asm b/engine/events_2.asm index af0f8df17..42e3ed8e4 100644 --- a/engine/events_2.asm +++ b/engine/events_2.asm @@ -458,7 +458,7 @@ HandleQueuedCommand: ; 97e79 .okay ld e, a ld d, 0 - ld hl, .Jumptable_ba + ld hl, .Jumptable add hl, de add hl, de add hl, de @@ -472,7 +472,7 @@ HandleQueuedCommand: ; 97e79 ret ; 97e94 -.Jumptable_ba: ; 97e94 +.Jumptable: ; 97e94 dba CmdQueue_Null dba CmdQueue_Null2 dba CmdQueue_StoneTable @@ -531,9 +531,9 @@ CmdQueue_Type4: ; 97ebc ld a, [hl] dec a ld [hl], a - jr z, .asm_97eee + jr z, .finish and $1 - jr z, .asm_97ee4 + jr z, .add ld hl, 2 add hl, bc ld a, [hSCY] @@ -541,7 +541,7 @@ CmdQueue_Type4: ; 97ebc ld [hSCY], a ret -.asm_97ee4 +.add ld hl, 2 add hl, bc ld a, [hSCY] @@ -549,7 +549,7 @@ CmdQueue_Type4: ; 97ebc ld [hSCY], a ret -.asm_97eee +.finish ld hl, 4 add hl, bc ld a, [hl] diff --git a/engine/events_3.asm b/engine/events_3.asm index dfcf60e73..e3e197adf 100755 --- a/engine/events_3.asm +++ b/engine/events_3.asm @@ -276,13 +276,13 @@ CheckForHiddenItems: ; b8172 ; Checks to see if there are hidden items on the screen that have not yet been found. If it finds one, returns carry. call GetMapScriptHeaderBank ld [Buffer1], a -; Get the coordinate of the bottom right corner of the screen, and load it in wd1ec/wd1ed. +; Get the coordinate of the bottom right corner of the screen, and load it in Buffer3/Buffer4. ld a, [XCoord] add SCREEN_WIDTH / 4 - ld [wd1ed], a + ld [Buffer4], a ld a, [YCoord] add SCREEN_HEIGHT / 4 - ld [wd1ec], a + ld [Buffer3], a ; Get the pointer for the first signpost header in the map... ld hl, wCurrentMapSignpostHeaderPointer ld a, [hli] @@ -301,7 +301,7 @@ CheckForHiddenItems: ; b8172 call .GetFarByte ld e, a ; Is the Y coordinate of the signpost on the screen? If not, go to the next signpost. - ld a, [wd1ec] + ld a, [Buffer3] sub e jr c, .next cp SCREEN_HEIGHT / 2 @@ -309,7 +309,7 @@ CheckForHiddenItems: ; b8172 ; Is the X coordinate of the signpost on the screen? If not, go to the next signpost. call .GetFarByte ld d, a - ld a, [wd1ed] + ld a, [Buffer4] sub d jr c, .next cp SCREEN_WIDTH / 2 diff --git a/engine/map_setup.asm b/engine/map_setup.asm index 38aaf5fec..dc013ffdd 100644 --- a/engine/map_setup.asm +++ b/engine/map_setup.asm @@ -258,8 +258,8 @@ MapSetupCommands: ; 15440 dba LoadMapPalettes ; 11 dba LoadWildMonData ; 12 dba RefreshMapSprites ; 13 - dba RunCallback_05_03 ; 14 - dba RunCallback_03 ; 15 + dba HandleNewMap ; 14 + dba InitCommandQueue ; 15 dba LoadObjectsRunCallback_02 ; 16 dba LoadSpawnPoint ; 17 dba EnterMapConnection ; 18 diff --git a/engine/pokedex.asm b/engine/pokedex.asm index 4d8b22ef4..e61a24964 100644 --- a/engine/pokedex.asm +++ b/engine/pokedex.asm @@ -694,9 +694,9 @@ Pokedex_UpdateSearchScreen: ; 40471 (10:4471) .show_search_results ld [wDexListingEnd], a ld a, [wDexListingScrollOffset] - ld [wc7e0], a + ld [wDexListingScrollOffsetBackup], a ld a, [wDexListingCursor] - ld [wc7e1], a + ld [wDexListingCursorBackup], a ld a, [wLastDexEntry] ld [wcf65], a xor a @@ -777,9 +777,9 @@ Pokedex_UpdateSearchResultsScreen: ; 40562 (10:4562) ret .return_to_search_screen - ld a, [wc7e0] + ld a, [wDexListingScrollOffsetBackup] ld [wDexListingScrollOffset], a - ld a, [wc7e1] + ld a, [wDexListingCursorBackup] ld [wDexListingCursor], a ld a, [wcf65] ld [wLastDexEntry], a diff --git a/engine/warp_connection.asm b/engine/warp_connection.asm index 515edce40..180aada87 100755 --- a/engine/warp_connection.asm +++ b/engine/warp_connection.asm @@ -1,5 +1,5 @@ -RunCallback_05_03: ; 1045b0 +HandleNewMap: ; 1045b0 call Clearwc7e8 call ResetMapBufferEventFlags call ResetFlashIfOutOfCave @@ -7,7 +7,7 @@ RunCallback_05_03: ; 1045b0 call ResetBikeFlags ld a, MAPCALLBACK_NEWMAP call RunMapCallback -RunCallback_03: ; 1045c4 +InitCommandQueue: ; 1045c4 callba ClearCmdQueue ld a, MAPCALLBACK_CMDQUEUE call RunMapCallback @@ -20,18 +20,16 @@ EnterMapConnection: ; 1045d6 ; Return carry if a connection has been entered. ld a, [wPlayerStepDirection] and a - jp z, EnterSouthConnection - cp 1 - jp z, EnterNorthConnection - cp 2 - jp z, EnterWestConnection - cp 3 - jp z, EnterEastConnection + jp z, .south + cp UP + jp z, .north + cp LEFT + jp z, .west + cp RIGHT + jp z, .east ret -; 1045ed - -EnterWestConnection: ; 1045ed +.west ld a, [WestConnectedMapGroup] ld [MapGroup], a ld a, [WestConnectedMapNumber] @@ -64,11 +62,9 @@ EnterWestConnection: ; 1045ed ld [wOverworldMapAnchor], a ld a, h ld [wOverworldMapAnchor + 1], a - jp EnteredConnection -; 104629 + jp .done - -EnterEastConnection: ; 104629 +.east ld a, [EastConnectedMapGroup] ld [MapGroup], a ld a, [EastConnectedMapNumber] @@ -85,27 +81,25 @@ EnterEastConnection: ; 104629 ld h, [hl] ld l, a srl c - jr z, .skip_to_load + jr z, .skip_to_load2 ld a, [EastConnectedMapWidth] add 6 ld e, a ld d, 0 -.loop +.loop2 add hl, de dec c - jr nz, .loop + jr nz, .loop2 -.skip_to_load +.skip_to_load2 ld a, l ld [wOverworldMapAnchor], a ld a, h ld [wOverworldMapAnchor + 1], a - jp EnteredConnection -; 104665 - + jp .done -EnterNorthConnection: ; 104665 +.north ld a, [NorthConnectedMapGroup] ld [MapGroup], a ld a, [NorthConnectedMapNumber] @@ -128,11 +122,9 @@ EnterNorthConnection: ; 104665 ld [wOverworldMapAnchor], a ld a, h ld [wOverworldMapAnchor + 1], a - jp EnteredConnection -; 104696 + jp .done - -EnterSouthConnection: ; 104696 +.south ld a, [SouthConnectedMapGroup] ld [MapGroup], a ld a, [SouthConnectedMapNumber] @@ -155,10 +147,7 @@ EnterSouthConnection: ; 104696 ld [wOverworldMapAnchor], a ld a, h ld [wOverworldMapAnchor + 1], a - ; fallthrough -; 1046c4 - -EnteredConnection: ; 1046c4 +.done scf ret ; 1046c6 @@ -239,11 +228,11 @@ LoadMapTimeOfDay: ; 104750 callba ReplaceTimeOfDayPals callba UpdateTimeOfDayPal call OverworldTextModeSwitch - call Function104770 - call Function1047a3 + call .ClearBGMap + call .PushAttrMap ret -Function104770: ; 104770 (41:4770) +.ClearBGMap: ; 104770 (41:4770) ld a, VBGMap0 / $100 ld [wBGMapAnchor + 1], a xor a @@ -251,23 +240,27 @@ Function104770: ; 104770 (41:4770) ld [hSCY], a ld [hSCX], a callba ApplyBGMapAnchorToObjects + ld a, [rVBK] push af ld a, $1 ld [rVBK], a + xor a ld bc, VBGMap1 - VBGMap0 hlbgcoord 0, 0 call ByteFill + pop af ld [rVBK], a + ld a, $60 ld bc, VBGMap1 - VBGMap0 hlbgcoord 0, 0 call ByteFill ret -Function1047a3: ; 1047a3 (41:47a3) +.PushAttrMap: ; 1047a3 (41:47a3) decoord 0, 0 call .copy ld a, [hCGB] |