diff options
Diffstat (limited to 'engine/overworld')
-rw-r--r-- | engine/overworld/decorations.asm | 33 | ||||
-rw-r--r-- | engine/overworld/events.asm | 60 | ||||
-rw-r--r-- | engine/overworld/map_object_action.asm | 3 | ||||
-rw-r--r-- | engine/overworld/map_objects.asm | 16 | ||||
-rw-r--r-- | engine/overworld/map_setup.asm | 2 | ||||
-rw-r--r-- | engine/overworld/player_movement.asm | 2 | ||||
-rw-r--r-- | engine/overworld/scripting.asm | 22 | ||||
-rw-r--r-- | engine/overworld/time.asm | 16 | ||||
-rw-r--r-- | engine/overworld/warp_connection.asm | 43 |
9 files changed, 100 insertions, 97 deletions
diff --git a/engine/overworld/decorations.asm b/engine/overworld/decorations.asm index 6c56330ed..6cc86181a 100644 --- a/engine/overworld/decorations.asm +++ b/engine/overworld/decorations.asm @@ -44,7 +44,7 @@ _PlayerDecorationMenu: .MenuData: db STATICMENU_CURSOR | STATICMENU_WRAP ; flags db 0 ; items - dw wd002 + dw wNumOwnedDecoCategories dw PlaceNthMenuStrings dw .pointers @@ -75,7 +75,7 @@ _PlayerDecorationMenu: ld a, 7 call .AppendToStringBuffer2 ld hl, wStringBuffer2 - ld de, wd002 + ld de, wDecoNameBuffer ld bc, ITEM_NAME_LENGTH call CopyBytes ret @@ -133,10 +133,11 @@ _PlayerDecorationMenu: Deco_FillTempWithMinusOne: xor a - ld hl, wd002 + ld hl, wNumOwnedDecoCategories ld [hli], a + assert wNumOwnedDecoCategories + 1 == wOwnedDecoCategories ld a, -1 - ld bc, $10 + ld bc, 16 call ByteFill ret @@ -161,10 +162,11 @@ CheckAllDecorationFlags: ret AppendDecoIndex: - ld hl, wd002 + ld hl, wNumOwnedDecoCategories inc [hl] + assert wNumOwnedDecoCategories + 1 == wOwnedDecoCategories ld e, [hl] - ld d, $0 + ld d, 0 add hl, de ld [hl], a ret @@ -176,7 +178,7 @@ FindOwnedDecosInCategory: pop hl call CheckAllDecorationFlags pop bc - ld a, [wd002] + ld a, [wNumOwnedDecoCategories] and a ret z @@ -335,7 +337,7 @@ DecoExitMenu: ret PopulateDecoCategoryMenu: - ld a, [wd002] + ld a, [wNumOwnedDecoCategories] and a jr z, .empty cp 8 @@ -353,9 +355,10 @@ PopulateDecoCategoryMenu: ret .beyond_eight - ld hl, wd002 + ld hl, wNumOwnedDecoCategories ld e, [hl] dec [hl] + assert wNumOwnedDecoCategories + 1 == wOwnedDecoCategories ld d, 0 add hl, de ld [hl], -1 @@ -395,7 +398,7 @@ PopulateDecoCategoryMenu: .NonscrollingMenuData: db STATICMENU_CURSOR | STATICMENU_WRAP ; flags db 0 ; items - dw wd002 + dw wDecoNameBuffer dw DecorationMenuFunction dw DecorationAttributes @@ -409,10 +412,10 @@ PopulateDecoCategoryMenu: db SCROLLINGMENU_DISPLAY_ARROWS ; flags db 8, 0 ; rows, columns db SCROLLINGMENU_ITEMS_NORMAL ; item format - dbw 0, wd002 ; text pointer + dbw 0, wDecoNameBuffer ; text pointer dba DecorationMenuFunction - dbw 0, 0 - dbw 0, 0 + dbw 0, NULL + dbw 0, NULL GetDecorationData: ld hl, DecorationAttributes @@ -549,7 +552,7 @@ GetDecoName: ld a, e jr .getpokename -.unused +.unused ; unreferenced push de call .getdeconame pop de @@ -939,7 +942,7 @@ GetDecorationID: pop hl ret -SetAllDecorationFlags: +SetAllDecorationFlags: ; unreferenced ld hl, DecorationIDs .loop ld a, [hli] diff --git a/engine/overworld/events.asm b/engine/overworld/events.asm index 218b7efc0..822b9ebf9 100644 --- a/engine/overworld/events.asm +++ b/engine/overworld/events.asm @@ -25,76 +25,76 @@ OverworldLoop:: DisableEvents: xor a - ld [wScriptFlags3], a + ld [wScriptFlags2], a ret EnableEvents:: ld a, $ff - ld [wScriptFlags3], a + ld [wScriptFlags2], a ret -CheckBit5_ScriptFlags3: - ld hl, wScriptFlags3 +CheckBit5_ScriptFlags2: + ld hl, wScriptFlags2 bit 5, [hl] ret -DisableWarpsConnxns: - ld hl, wScriptFlags3 +DisableWarpsConnxns: ; unreferenced + ld hl, wScriptFlags2 res 2, [hl] ret -DisableCoordEvents: - ld hl, wScriptFlags3 +DisableCoordEvents: ; unreferenced + ld hl, wScriptFlags2 res 1, [hl] ret -DisableStepCount: - ld hl, wScriptFlags3 +DisableStepCount: ; unreferenced + ld hl, wScriptFlags2 res 0, [hl] ret -DisableWildEncounters: - ld hl, wScriptFlags3 +DisableWildEncounters: ; unreferenced + ld hl, wScriptFlags2 res 4, [hl] ret -EnableWarpsConnxns: - ld hl, wScriptFlags3 +EnableWarpsConnxns: ; unreferenced + ld hl, wScriptFlags2 set 2, [hl] ret -EnableCoordEvents: - ld hl, wScriptFlags3 +EnableCoordEvents: ; unreferenced + ld hl, wScriptFlags2 set 1, [hl] ret -EnableStepCount: - ld hl, wScriptFlags3 +EnableStepCount: ; unreferenced + ld hl, wScriptFlags2 set 0, [hl] ret EnableWildEncounters: - ld hl, wScriptFlags3 + ld hl, wScriptFlags2 set 4, [hl] ret CheckWarpConnxnScriptFlag: - ld hl, wScriptFlags3 + ld hl, wScriptFlags2 bit 2, [hl] ret CheckCoordEventScriptFlag: - ld hl, wScriptFlags3 + ld hl, wScriptFlags2 bit 1, [hl] ret CheckStepCountScriptFlag: - ld hl, wScriptFlags3 + ld hl, wScriptFlags2 bit 0, [hl] ret CheckWildEncountersScriptFlag: - ld hl, wScriptFlags3 + ld hl, wScriptFlags2 bit 4, [hl] ret @@ -135,7 +135,7 @@ EnterMap: ld [wMapStatus], a ret -UnusedWait30Frames: +UnusedWait30Frames: ; unreferenced ld c, 30 call DelayFrames ret @@ -248,7 +248,7 @@ PlayerEvents: and a ret nz - call Dummy_CheckScriptFlags3Bit5 ; This is a waste of time + call Dummy_CheckScriptFlags2Bit5 ; This is a waste of time call CheckTrainerBattle_GetPlayerEvent jr c, .ok @@ -395,8 +395,8 @@ SetMinTwoStepWildEncounterCooldown: ld [wWildEncounterCooldown], a ret -Dummy_CheckScriptFlags3Bit5: - call CheckBit5_ScriptFlags3 +Dummy_CheckScriptFlags2Bit5: + call CheckBit5_ScriptFlags2 ret z call SetXYCompareFlags ret @@ -480,8 +480,8 @@ CheckTimeEvents: scf ret -.unused - ld a, 8 +.unused ; unreferenced + ld a, $8 ; ??? scf ret @@ -812,7 +812,7 @@ PlayerMovement: CheckMenuOW: xor a ldh [hMenuReturn], a - ldh [hUnusedFFA1], a + ldh [hUnusedByte], a ldh a, [hJoyPressed] bit SELECT_F, a diff --git a/engine/overworld/map_object_action.asm b/engine/overworld/map_object_action.asm index 35de22030..5c68f6b0f 100644 --- a/engine/overworld/map_object_action.asm +++ b/engine/overworld/map_object_action.asm @@ -273,7 +273,8 @@ SetFacingBoulderDust: and 2 ld a, FACING_BOULDER_DUST_1 jr z, .ok - inc a ; FACING_BOULDER_DUST_2 + inc a + assert FACING_BOULDER_DUST_1 + 1 == FACING_BOULDER_DUST_2 .ok ld [hl], a ret diff --git a/engine/overworld/map_objects.asm b/engine/overworld/map_objects.asm index 59b8abf84..f6157ce83 100644 --- a/engine/overworld/map_objects.asm +++ b/engine/overworld/map_objects.asm @@ -2894,20 +2894,20 @@ InitSprites: ldh [hCurSpriteTile], a xor a bit 7, [hl] - jr nz, .skip1 + jr nz, .not_vram1 or VRAM_BANK_1 -.skip1 +.not_vram1 ld hl, OBJECT_FLAGS2 add hl, bc ld e, [hl] bit OBJ_FLAGS2_7, e - jr z, .skip2 + jr z, .not_priority or PRIORITY -.skip2 +.not_priority bit USE_OBP1_F, e - jr z, .skip3 + jr z, .not_obp_num or OBP_NUM -.skip3 +.not_obp_num ld hl, OBJECT_PALETTE add hl, bc ld d, a @@ -2917,9 +2917,9 @@ InitSprites: ld d, a xor a bit OVERHEAD_F, e - jr z, .skip4 + jr z, .not_overhead or PRIORITY -.skip4 +.not_overhead ldh [hCurSpriteOAMFlags], a ld hl, OBJECT_SPRITE_X add hl, bc diff --git a/engine/overworld/map_setup.asm b/engine/overworld/map_setup.asm index 9a96d6700..e70f9ab7b 100644 --- a/engine/overworld/map_setup.asm +++ b/engine/overworld/map_setup.asm @@ -82,7 +82,7 @@ LoadMapObjects: farcall InitializeVisibleSprites ret -; unused +MapSetup_DummyFunction: ; unreferenced ret ResetPlayerObjectAction: diff --git a/engine/overworld/player_movement.asm b/engine/overworld/player_movement.asm index fcf147dd0..4ef04d79b 100644 --- a/engine/overworld/player_movement.asm +++ b/engine/overworld/player_movement.asm @@ -311,7 +311,7 @@ DoPlayerMovement:: scf ret -; unused +.unused ; unreferenced xor a ret diff --git a/engine/overworld/scripting.asm b/engine/overworld/scripting.asm index 7e86795fc..d9878269b 100644 --- a/engine/overworld/scripting.asm +++ b/engine/overworld/scripting.asm @@ -458,11 +458,11 @@ Script_verbosegiveitem: ld de, GiveItemScript jp ScriptCall -ret_96f76: +GiveItemScript_DummyFunction: ret GiveItemScript: - callasm ret_96f76 + callasm GiveItemScript_DummyFunction writetext .ReceivedItemText iffalse .Full waitsfx @@ -1703,7 +1703,7 @@ Script_givepokemail: push bc inc hl ld bc, MAIL_MSG_LENGTH - ld de, wd002 + ld de, wMonMailMessageBuffer ld a, [wScriptBank] call FarCopyBytes pop bc @@ -2173,8 +2173,7 @@ Script_warpcheck: farcall EnableEvents ret -Script_enableevents: -; unused +Script_enableevents: ; unreferenced farcall EnableEvents ret @@ -2204,7 +2203,8 @@ Script_writeunusedbytebuffer: ld [wUnusedScriptByteBuffer], a ret - db closetext_command ; unused +UnusedClosetextScript: ; unreferenced + closetext Script_closetext: call _OpenAndCloseMenu_HDMATransferTilemapAndAttrmap @@ -2316,13 +2316,13 @@ Script_endall: ret Script_halloffame: - ld hl, wGameTimerPause - res GAMETIMERPAUSE_TIMER_PAUSED_F, [hl] + ld hl, wGameTimerPaused + res GAME_TIMER_PAUSED_F, [hl] farcall StubbedTrainerRankings_HallOfFame farcall StubbedTrainerRankings_HallOfFame2 farcall HallOfFame - ld hl, wGameTimerPause - set GAMETIMERPAUSE_TIMER_PAUSED_F, [hl] + ld hl, wGameTimerPaused + set GAME_TIMER_PAUSED_F, [hl] jr ReturnFromCredits Script_credits: @@ -2353,7 +2353,7 @@ Script_checksave: ld [wScriptVar], a ret -; unused +Script_checkver_duplicate: ; unreferenced ld a, [.gs_version] ld [wScriptVar], a ret diff --git a/engine/overworld/time.asm b/engine/overworld/time.asm index 86807119d..4299a69ab 100644 --- a/engine/overworld/time.asm +++ b/engine/overworld/time.asm @@ -203,7 +203,7 @@ CheckPokerusTick:: xor a ret -SetUnusedTwoDayTimer: +SetUnusedTwoDayTimer: ; unreferenced ld a, 2 ld hl, wUnusedTwoDayTimer ld [hl], a @@ -220,12 +220,12 @@ CheckUnusedTwoDayTimer: call UpdateTimeRemaining ret -; unused +UnusedSetSwarmFlag: ; unreferenced ld hl, wDailyFlags1 set DAILYFLAGS1_FISH_SWARM_F, [hl] ret -; unused +UnusedCheckSwarmFlag: ; unreferenced and a ld hl, wDailyFlags1 bit DAILYFLAGS1_FISH_SWARM_F, [hl] @@ -272,7 +272,7 @@ DoMysteryGiftIfDayHasPassed: ld hl, wBuffer1 call InitOneDayCountdown call CloseSRAM - farcall Function1050c8 + farcall ResetDailyMysteryGiftLimitIfUnlocked .not_timed_out ld a, BANK(sMysteryGiftTimer) @@ -308,7 +308,7 @@ UpdateTimeRemaining: scf ret -GetSecondsSinceIfLessThan60: +GetSecondsSinceIfLessThan60: ; unreferenced ld a, [wDaysSince] and a jr nz, GetTimeElapsed_ExceedsUnitLimit @@ -330,7 +330,7 @@ GetMinutesSinceIfLessThan60: ld a, [wMinutesSince] ret -GetHoursSinceIfLessThan24: +GetHoursSinceIfLessThan24: ; unreferenced ld a, [wDaysSince] and a jr nz, GetTimeElapsed_ExceedsUnitLimit @@ -349,7 +349,7 @@ CalcDaysSince: xor a jr _CalcDaysSince -CalcHoursDaysSince: +CalcHoursDaysSince: ; unreferenced inc hl xor a jr _CalcHoursDaysSince @@ -423,7 +423,7 @@ CopyDayToHL: ld [hl], a ret -CopyDayHourToHL: +CopyDayHourToHL: ; unreferenced ld a, [wCurDay] ld [hli], a ldh a, [hHours] diff --git a/engine/overworld/warp_connection.asm b/engine/overworld/warp_connection.asm index 866480d5c..0b87de722 100644 --- a/engine/overworld/warp_connection.asm +++ b/engine/overworld/warp_connection.asm @@ -175,7 +175,8 @@ EnterMapWarp: ; MOUNT_MOON_SQUARE and TIN_TOWER_ROOF are outdoor maps within indoor maps. ; Dig and Escape Rope should not take you to them. ld a, [wPrevMapGroup] - cp GROUP_MOUNT_MOON_SQUARE ; aka GROUP_TIN_TOWER_ROOF + cp GROUP_MOUNT_MOON_SQUARE + assert GROUP_MOUNT_MOON_SQUARE == GROUP_TIN_TOWER_ROOF jr nz, .not_mt_moon_or_tin_tower ld a, [wPrevMapNumber] cp MAP_MOUNT_MOON_SQUARE @@ -390,44 +391,42 @@ GetMapScreenCoords:: ld hl, wOverworldMapBlocks ld a, [wXCoord] bit 0, a - jr nz, .increment_then_halve1 + jr nz, .odd_x +; even x srl a - add $1 - jr .resume - -.increment_then_halve1 - add $1 + add 1 + jr .got_block_x +.odd_x + add 1 srl a - -.resume +.got_block_x ld c, a - ld b, $0 + ld b, 0 add hl, bc ld a, [wMapWidth] - add $6 + add MAP_CONNECTION_PADDING_WIDTH * 2 ld c, a - ld b, $0 + ld b, 0 ld a, [wYCoord] bit 0, a - jr nz, .increment_then_halve2 + jr nz, .odd_y +; even y srl a - add $1 - jr .resume2 - -.increment_then_halve2 - add $1 + add 1 + jr .got_block_y +.odd_y + add 1 srl a - -.resume2 +.got_block_y call AddNTimes ld a, l ld [wOverworldMapAnchor], a ld a, h ld [wOverworldMapAnchor + 1], a ld a, [wYCoord] - and $1 + and 1 ld [wMetatileStandingY], a ld a, [wXCoord] - and $1 + and 1 ld [wMetatileStandingX], a ret |