From 9ab48c5f8ba009629860180eade244f5cbbef5f7 Mon Sep 17 00:00:00 2001 From: Vortyne <104168801+Vortyne@users.noreply.github.com> Date: Sun, 19 Nov 2023 01:43:43 -0500 Subject: [PATCH 1/9] Update PokemonMansion1F.asm --- scripts/PokemonMansion1F.asm | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/PokemonMansion1F.asm b/scripts/PokemonMansion1F.asm index c1fef205a3..887f9876c5 100644 --- a/scripts/PokemonMansion1F.asm +++ b/scripts/PokemonMansion1F.asm @@ -14,31 +14,31 @@ Mansion1Subscript1: res 5, [hl] ret z CheckEvent EVENT_MANSION_SWITCH_ON - jr nz, .asm_442ec + jr nz, .switchTurnedOn lb bc, 6, 12 - call Mansion1Script_4430b + call Mansion1LoadEmptyFloorTileBlock lb bc, 3, 8 - call Mansion1Script_44304 + call Mansion1LoadHorizontalGateBlock lb bc, 8, 10 - call Mansion1Script_44304 + call Mansion1LoadHorizontalGateBlock lb bc, 13, 13 - jp Mansion1Script_44304 -.asm_442ec + jp Mansion1LoadHorizontalGateBlock +.switchTurnedOn lb bc, 6, 12 - call Mansion1Script_44304 + call Mansion1LoadHorizontalGateBlock lb bc, 3, 8 - call Mansion1Script_4430b + call Mansion1LoadEmptyFloorTileBlock lb bc, 8, 10 - call Mansion1Script_4430b + call Mansion1LoadEmptyFloorTileBlock lb bc, 13, 13 - jp Mansion1Script_4430b + jp Mansion1LoadEmptyFloorTileBlock -Mansion1Script_44304: +Mansion1LoadHorizontalGateBlock: ld a, $2d ld [wNewTileBlockID], a jr Mansion1ReplaceBlock -Mansion1Script_4430b: +Mansion1LoadEmptyFloorTileBlock: ld a, $e ld [wNewTileBlockID], a Mansion1ReplaceBlock: From 2bf69e223e2ac23c319b0ed7b6b4a50f48ef7769 Mon Sep 17 00:00:00 2001 From: Vortyne <104168801+Vortyne@users.noreply.github.com> Date: Sun, 19 Nov 2023 02:30:29 -0500 Subject: [PATCH 2/9] Name unnamed seafoam/mansion labels --- engine/overworld/push_boulder.asm | 2 +- scripts/PokemonMansion1F.asm | 4 ++-- scripts/PokemonMansion2F.asm | 22 ++++++++--------- scripts/PokemonMansion3F.asm | 24 +++++++++---------- scripts/PokemonMansionB1F.asm | 24 +++++++++---------- scripts/SeafoamIslands1F.asm | 12 +++++----- scripts/SeafoamIslandsB1F.asm | 12 +++++----- scripts/SeafoamIslandsB2F.asm | 12 +++++----- scripts/SeafoamIslandsB3F.asm | 40 +++++++++++++++---------------- scripts/SeafoamIslandsB4F.asm | 34 +++++++++++++------------- 10 files changed, 93 insertions(+), 93 deletions(-) diff --git a/engine/overworld/push_boulder.asm b/engine/overworld/push_boulder.asm index a8e532d312..96c506c026 100644 --- a/engine/overworld/push_boulder.asm +++ b/engine/overworld/push_boulder.asm @@ -94,7 +94,7 @@ DoBoulderDustAnimation:: call DiscardButtonPresses ld [wJoyIgnore], a call ResetBoulderPushFlags - set 7, [hl] + set 7, [hl] ; [wFlags_0xcd60] ld a, [wBoulderSpriteIndex] ldh [hSpriteIndex], a call GetSpriteMovementByte2Pointer diff --git a/scripts/PokemonMansion1F.asm b/scripts/PokemonMansion1F.asm index 887f9876c5..b294a24739 100644 --- a/scripts/PokemonMansion1F.asm +++ b/scripts/PokemonMansion1F.asm @@ -1,5 +1,5 @@ PokemonMansion1F_Script: - call Mansion1Subscript1 + call Mansion1CheckReplaceSwitchDoorBlocks call EnableAutoTextBoxDrawing ld hl, Mansion1TrainerHeaders ld de, PokemonMansion1F_ScriptPointers @@ -8,7 +8,7 @@ PokemonMansion1F_Script: ld [wPokemonMansion1FCurScript], a ret -Mansion1Subscript1: +Mansion1CheckReplaceSwitchDoorBlocks: ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] diff --git a/scripts/PokemonMansion2F.asm b/scripts/PokemonMansion2F.asm index a4322da730..bc3d78e9be 100644 --- a/scripts/PokemonMansion2F.asm +++ b/scripts/PokemonMansion2F.asm @@ -1,5 +1,5 @@ PokemonMansion2F_Script: - call Mansion2Script_51fee + call Mansion2CheckReplaceSwitchDoorBlocks call EnableAutoTextBoxDrawing ld hl, Mansion2TrainerHeaders ld de, PokemonMansion2F_ScriptPointers @@ -8,36 +8,36 @@ PokemonMansion2F_Script: ld [wPokemonMansion2FCurScript], a ret -Mansion2Script_51fee: +Mansion2CheckReplaceSwitchDoorBlocks: ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z CheckEvent EVENT_MANSION_SWITCH_ON - jr nz, .asm_52016 + jr nz, .switchTurnedOn ld a, $e lb bc, 2, 4 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ld a, $54 lb bc, 4, 9 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ld a, $5f lb bc, 11, 3 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ret -.asm_52016 +.switchTurnedOn ld a, $5f lb bc, 2, 4 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ld a, $e lb bc, 4, 9 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ld a, $e lb bc, 11, 3 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ret -Mansion2Script_5202f: +Mansion2ReplaceBlock: ld [wNewTileBlockID], a predef_jump ReplaceTileBlock diff --git a/scripts/PokemonMansion3F.asm b/scripts/PokemonMansion3F.asm index ddded4e93d..c3a9fba870 100644 --- a/scripts/PokemonMansion3F.asm +++ b/scripts/PokemonMansion3F.asm @@ -1,5 +1,5 @@ PokemonMansion3F_Script: - call Mansion3Script_52204 + call Mansion3CheckReplaceSwitchDoorBlocks call EnableAutoTextBoxDrawing ld hl, Mansion3TrainerHeaders ld de, PokemonMansion3F_ScriptPointers @@ -8,27 +8,27 @@ PokemonMansion3F_Script: ld [wPokemonMansion3FCurScript], a ret -Mansion3Script_52204: +Mansion3CheckReplaceSwitchDoorBlocks: ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z CheckEvent EVENT_MANSION_SWITCH_ON - jr nz, .asm_52224 + jr nz, .switchTurnedOn ld a, $e lb bc, 2, 7 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ld a, $5f lb bc, 5, 7 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ret -.asm_52224 +.switchTurnedOn ld a, $5f lb bc, 2, 7 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ld a, $e lb bc, 5, 7 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ret PokemonMansion3F_ScriptPointers: @@ -38,8 +38,8 @@ PokemonMansion3F_ScriptPointers: dw_const EndTrainerBattle, SCRIPT_POKEMONMANSION3F_END_BATTLE PokemonMansion3FDefaultScript: - ld hl, CoordsData_52254 - call Mansion3Script_5225b + ld hl, .holeCoords + call .isPlayerFallingDownHole ld a, [wWhichDungeonWarp] and a jp z, CheckFightingMapTrainers @@ -51,13 +51,13 @@ PokemonMansion3FDefaultScript: ld [wDungeonWarpDestinationMap], a ret -CoordsData_52254: +.holeCoords: dbmapcoord 16, 14 dbmapcoord 17, 14 dbmapcoord 19, 14 db -1 ; end -Mansion3Script_5225b: +.isPlayerFallingDownHole: xor a ld [wWhichDungeonWarp], a ld a, [wd72d] diff --git a/scripts/PokemonMansionB1F.asm b/scripts/PokemonMansionB1F.asm index 187a765f30..74f1648e7e 100644 --- a/scripts/PokemonMansionB1F.asm +++ b/scripts/PokemonMansionB1F.asm @@ -1,5 +1,5 @@ PokemonMansionB1F_Script: - call Mansion4Script_523cf + call MansionB1FCheckReplaceSwitchDoorBlocks call EnableAutoTextBoxDrawing ld hl, Mansion4TrainerHeaders ld de, PokemonMansionB1F_ScriptPointers @@ -8,39 +8,39 @@ PokemonMansionB1F_Script: ld [wPokemonMansionB1FCurScript], a ret -Mansion4Script_523cf: +MansionB1FCheckReplaceSwitchDoorBlocks: ld hl, wCurrentMapScriptFlags bit 5, [hl] res 5, [hl] ret z CheckEvent EVENT_MANSION_SWITCH_ON - jr nz, .asm_523ff + jr nz, .switchTurnedOn ld a, $e ld bc, $80d - call Mansion2Script_5202f + call Mansion2ReplaceBlock ld a, $e ld bc, $b06 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ld a, $5f ld bc, $304 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ld a, $54 ld bc, $808 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ret -.asm_523ff +.switchTurnedOn ld a, $2d ld bc, $80d - call Mansion2Script_5202f + call Mansion2ReplaceBlock ld a, $5f ld bc, $b06 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ld a, $e ld bc, $304 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ld a, $e ld bc, $808 - call Mansion2Script_5202f + call Mansion2ReplaceBlock ret Mansion4Script_Switches:: diff --git a/scripts/SeafoamIslands1F.asm b/scripts/SeafoamIslands1F.asm index eda3051bcc..27ddc2766b 100644 --- a/scripts/SeafoamIslands1F.asm +++ b/scripts/SeafoamIslands1F.asm @@ -4,34 +4,34 @@ SeafoamIslands1F_Script: ld hl, wFlags_0xcd60 bit 7, [hl] res 7, [hl] - jr z, .asm_4483b + jr z, .noBoulderWasPushed ld hl, Seafoam1HolesCoords call CheckBoulderCoords ret nc EventFlagAddress hl, EVENT_SEAFOAM1_BOULDER1_DOWN_HOLE ld a, [wCoordIndex] cp $1 - jr nz, .asm_44819 + jr nz, .boulder2FellDownHole SetEventReuseHL EVENT_SEAFOAM1_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_1F_BOULDER_1 ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_B1F_BOULDER_1 ld [wObjectToShow], a - jr .asm_44825 -.asm_44819 + jr .hideAndShowBoulderObjects +.boulder2FellDownHole SetEventAfterBranchReuseHL EVENT_SEAFOAM1_BOULDER2_DOWN_HOLE, EVENT_SEAFOAM1_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_1F_BOULDER_2 ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_B1F_BOULDER_2 ld [wObjectToShow], a -.asm_44825 +.hideAndShowBoulderObjects ld a, [wObjectToHide] ld [wMissableObjectIndex], a predef HideObject ld a, [wObjectToShow] ld [wMissableObjectIndex], a predef_jump ShowObject -.asm_4483b +.noBoulderWasPushed ld a, SEAFOAM_ISLANDS_B1F ld [wDungeonWarpDestinationMap], a ld hl, Seafoam1HolesCoords diff --git a/scripts/SeafoamIslandsB1F.asm b/scripts/SeafoamIslandsB1F.asm index 6a56c337e6..271775ed7b 100644 --- a/scripts/SeafoamIslandsB1F.asm +++ b/scripts/SeafoamIslandsB1F.asm @@ -3,34 +3,34 @@ SeafoamIslandsB1F_Script: ld hl, wFlags_0xcd60 bit 7, [hl] res 7, [hl] - jr z, .asm_46362 + jr z, .noBoulderWasPushed ld hl, Seafoam2HolesCoords call CheckBoulderCoords ret nc EventFlagAddress hl, EVENT_SEAFOAM2_BOULDER1_DOWN_HOLE ld a, [wCoordIndex] cp $1 - jr nz, .asm_46340 + jr nz, .boulder2FellDownHole SetEventReuseHL EVENT_SEAFOAM2_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_B1F_BOULDER_1 ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_B2F_BOULDER_1 ld [wObjectToShow], a - jr .asm_4634c -.asm_46340 + jr .hideAndShowBoulderObjects +.boulder2FellDownHole SetEventAfterBranchReuseHL EVENT_SEAFOAM2_BOULDER2_DOWN_HOLE, EVENT_SEAFOAM2_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_B1F_BOULDER_2 ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_B2F_BOULDER_2 ld [wObjectToShow], a -.asm_4634c +.hideAndShowBoulderObjects ld a, [wObjectToHide] ld [wMissableObjectIndex], a predef HideObject ld a, [wObjectToShow] ld [wMissableObjectIndex], a predef_jump ShowObject -.asm_46362 +.noBoulderWasPushed ld a, SEAFOAM_ISLANDS_B2F ld [wDungeonWarpDestinationMap], a ld hl, Seafoam2HolesCoords diff --git a/scripts/SeafoamIslandsB2F.asm b/scripts/SeafoamIslandsB2F.asm index 635d923fe7..71ae2e1ae1 100644 --- a/scripts/SeafoamIslandsB2F.asm +++ b/scripts/SeafoamIslandsB2F.asm @@ -3,34 +3,34 @@ SeafoamIslandsB2F_Script: ld hl, wFlags_0xcd60 bit 7, [hl] res 7, [hl] - jr z, .asm_4649e + jr z, .noBoulderWasPushed ld hl, Seafoam3HolesCoords call CheckBoulderCoords ret nc EventFlagAddress hl, EVENT_SEAFOAM3_BOULDER1_DOWN_HOLE ld a, [wCoordIndex] cp $1 - jr nz, .asm_4647c + jr nz, .boulder2FellDownHole SetEventReuseHL EVENT_SEAFOAM3_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_B2F_BOULDER_1 ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_B3F_BOULDER_3 ld [wObjectToShow], a - jr .asm_46488 -.asm_4647c + jr .hideAndShowBoulderObjects +.boulder2FellDownHole SetEventAfterBranchReuseHL EVENT_SEAFOAM3_BOULDER2_DOWN_HOLE, EVENT_SEAFOAM3_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_B2F_BOULDER_2 ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_B3F_BOULDER_4 ld [wObjectToShow], a -.asm_46488 +.hideAndShowBoulderObjects ld a, [wObjectToHide] ld [wMissableObjectIndex], a predef HideObject ld a, [wObjectToShow] ld [wMissableObjectIndex], a predef_jump ShowObject -.asm_4649e +.noBoulderWasPushed ld a, SEAFOAM_ISLANDS_B3F ld [wDungeonWarpDestinationMap], a ld hl, Seafoam3HolesCoords diff --git a/scripts/SeafoamIslandsB3F.asm b/scripts/SeafoamIslandsB3F.asm index a1e178331b..8c225dcc58 100644 --- a/scripts/SeafoamIslandsB3F.asm +++ b/scripts/SeafoamIslandsB3F.asm @@ -3,35 +3,35 @@ SeafoamIslandsB3F_Script: ld hl, wFlags_0xcd60 bit 7, [hl] res 7, [hl] - jr z, .asm_465dc + jr z, .noBoulderWasPushed ld hl, Seafoam4HolesCoords call CheckBoulderCoords ret nc EventFlagAddress hl, EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE ld a, [wCoordIndex] cp $1 - jr nz, .asm_465b8 + jr nz, .boulder2FellDownHole SetEventReuseHL EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_B3F_BOULDER_1 ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_B4F_BOULDER_1 ld [wObjectToShow], a - jr .asm_465c4 -.asm_465b8 + jr .hideAndShowBoulderObjects +.boulder2FellDownHole SetEventAfterBranchReuseHL EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE, EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_B3F_BOULDER_2 ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_B4F_BOULDER_2 ld [wObjectToShow], a -.asm_465c4 +.hideAndShowBoulderObjects ld a, [wObjectToHide] ld [wMissableObjectIndex], a predef HideObject ld a, [wObjectToShow] ld [wMissableObjectIndex], a predef ShowObject - jr .asm_465ed -.asm_465dc + jr .runCurrentMapScript +.noBoulderWasPushed ld a, SEAFOAM_ISLANDS_B4F ld [wDungeonWarpDestinationMap], a ld hl, Seafoam4HolesCoords @@ -39,7 +39,7 @@ SeafoamIslandsB3F_Script: ld a, [wd732] bit 4, a ret nz -.asm_465ed +.runCurrentMapScript ld hl, SeafoamIslandsB3F_ScriptPointers ld a, [wSeafoamIslandsB3FCurScript] jp CallFunctionInTable @@ -67,7 +67,7 @@ SeafoamIslandsB3FDefaultScript: cp 15 ret nz ld hl, wSimulatedJoypadStatesEnd - ld de, RLEMovement46632 + ld de, RLEList_ForcedSurfingStrongCurrentNearSteps call DecodeRLEList dec a ld [wSimulatedJoypadStatesIndex], a @@ -78,7 +78,7 @@ SeafoamIslandsB3FDefaultScript: ld [wSeafoamIslandsB3FCurScript], a ret -RLEMovement46632: +RLEList_ForcedSurfingStrongCurrentNearSteps: db D_DOWN, 6 db D_RIGHT, 5 db D_DOWN, 3 @@ -97,15 +97,15 @@ SeafoamIslandsB3FMoveObjectScript: ret z ld a, [wXCoord] cp 18 - jr z, .asm_4665e + jr z, .playerFellThroughHoleLeft cp 19 ld a, SCRIPT_SEAFOAMISLANDSB3F_DEFAULT - jr nz, .asm_4667b - ld de, RLEData_4667f - jr .asm_46661 -.asm_4665e - ld de, RLEData_46688 -.asm_46661 + jr nz, .playerNotInStrongCurrent + ld de, .RLEList_StrongCurrentNearRightBoulder + jr .forceSurfMovement +.playerFellThroughHoleLeft + ld de, .RLEList_StrongCurrentNearLeftBoulder +.forceSurfMovement ld hl, wSimulatedJoypadStatesEnd call DecodeRLEList dec a @@ -117,18 +117,18 @@ SeafoamIslandsB3FMoveObjectScript: ld hl, wFlags_D733 set 2, [hl] ld a, SCRIPT_SEAFOAMISLANDSB3F_OBJECT_MOVING2 -.asm_4667b +.playerNotInStrongCurrent ld [wSeafoamIslandsB3FCurScript], a ret -RLEData_4667f: +.RLEList_StrongCurrentNearRightBoulder: db D_DOWN, 6 db D_RIGHT, 2 db D_DOWN, 4 db D_LEFT, 1 db -1 ; end -RLEData_46688: +.RLEList_StrongCurrentNearLeftBoulder: db D_DOWN, 6 db D_RIGHT, 2 db D_DOWN, 4 diff --git a/scripts/SeafoamIslandsB4F.asm b/scripts/SeafoamIslandsB4F.asm index 98ea0a5ba7..7584cd81a7 100644 --- a/scripts/SeafoamIslandsB4F.asm +++ b/scripts/SeafoamIslandsB4F.asm @@ -4,7 +4,7 @@ SeafoamIslandsB4F_Script: ld hl, SeafoamIslandsB4F_ScriptPointers jp CallFunctionInTable -SeafoamIslands5Script_467a5: +SeafoamIslandsB4FResetScript: xor a ld [wSeafoamIslandsB4FCurScript], a ld [wJoyIgnore], a @@ -22,7 +22,7 @@ SeafoamIslandsB4F_ScriptPointers: SeafoamIslandsB4FObjectMoving3Script: ld a, [wIsInBattle] cp $ff - jr z, SeafoamIslands5Script_467a5 + jr z, SeafoamIslandsB4FResetScript call EndTrainerBattle ld a, SCRIPT_SEAFOAMISLANDSB4F_DEFAULT ld [wSeafoamIslandsB4FCurScript], a @@ -36,14 +36,14 @@ SeafoamIslandsB4FDefaultScript: ret nc ld a, [wCoordIndex] cp $3 - jr nc, .asm_467e6 + jr nc, .only1UpInputNeeded ld a, NPC_MOVEMENT_UP ld [wSimulatedJoypadStatesEnd + 1], a ld a, 2 - jr .asm_467e8 -.asm_467e6 + jr .forcePlayerUpFromSurfExit +.only1UpInputNeeded ld a, 1 -.asm_467e8 +.forcePlayerUpFromSurfExit ld [wSimulatedJoypadStatesIndex], a ld a, D_UP ld [wSimulatedJoypadStatesEnd], a @@ -74,26 +74,26 @@ SeafoamIslandsB4FObjectMoving1Script: SeafoamIslandsB4FMoveObjectScript: CheckBothEventsSet EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE ld a, SCRIPT_SEAFOAMISLANDSB4F_DEFAULT - jr z, .asm_46849 + jr z, .playerNotInStrongCurrent ld hl, .Coords call ArePlayerCoordsInArray ld a, SCRIPT_SEAFOAMISLANDSB4F_DEFAULT - jr nc, .asm_46849 + jr nc, .playerNotInStrongCurrent ld a, [wCoordIndex] cp $1 - jr nz, .asm_46837 - ld de, RLEMovementData_46859 - jr .asm_4683a -.asm_46837 - ld de, RLEMovementData_46852 -.asm_4683a + jr nz, .nearRightBoulder + ld de, .RLEList_StrongCurrentNearLeftBoulder + jr .forceSurfMovement +.nearRightBoulder + ld de, .RLEList_StrongCurrentNearRightBoulder +.forceSurfMovement ld hl, wSimulatedJoypadStatesEnd call DecodeRLEList dec a ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, SCRIPT_SEAFOAMISLANDSB4F_OBJECT_MOVING2 -.asm_46849 +.playerNotInStrongCurrent ld [wSeafoamIslandsB4FCurScript], a ret @@ -102,13 +102,13 @@ SeafoamIslandsB4FMoveObjectScript: dbmapcoord 5, 14 db -1 ; end -RLEMovementData_46852: +.RLEList_StrongCurrentNearRightBoulder: db D_UP, 3 db D_RIGHT, 2 db D_UP, 1 db -1 ; end -RLEMovementData_46859: +.RLEList_StrongCurrentNearLeftBoulder: db D_UP, 3 db D_RIGHT, 3 db D_UP, 1 From 81cc14cd2ca2f0f23c7c06eccf9da510c36356f5 Mon Sep 17 00:00:00 2001 From: Vortyne <104168801+Vortyne@users.noreply.github.com> Date: Sun, 19 Nov 2023 18:19:15 -0500 Subject: [PATCH 3/9] Two labels I missed naming --- scripts/PokemonMansion3F.asm | 4 ++-- scripts/SeafoamIslandsB4F.asm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/PokemonMansion3F.asm b/scripts/PokemonMansion3F.asm index c3a9fba870..f64357d576 100644 --- a/scripts/PokemonMansion3F.asm +++ b/scripts/PokemonMansion3F.asm @@ -45,9 +45,9 @@ PokemonMansion3FDefaultScript: jp z, CheckFightingMapTrainers cp $3 ld a, POKEMON_MANSION_1F - jr nz, .asm_52250 + jr nz, .fellDownHoleTo1F ld a, POKEMON_MANSION_2F -.asm_52250 +.fellDownHoleTo1F ld [wDungeonWarpDestinationMap], a ret diff --git a/scripts/SeafoamIslandsB4F.asm b/scripts/SeafoamIslandsB4F.asm index 7584cd81a7..bff27e9fd8 100644 --- a/scripts/SeafoamIslandsB4F.asm +++ b/scripts/SeafoamIslandsB4F.asm @@ -118,7 +118,7 @@ SeafoamIslandsB4FObjectMoving2Script: ld a, [wSimulatedJoypadStatesIndex] ld b, a cp $1 - call z, SeaFoamIslands5Script_46872 + call z, .doneForcedSurfMovement ld a, b and a ret nz @@ -126,7 +126,7 @@ SeafoamIslandsB4FObjectMoving2Script: ld [wSeafoamIslandsB4FCurScript], a ret -SeaFoamIslands5Script_46872: +.doneForcedSurfMovement: xor a ld [wWalkBikeSurfState], a ld [wWalkBikeSurfStateCopy], a From a71b342b9348ffc78534de0c6919d84db185b971 Mon Sep 17 00:00:00 2001 From: Vortyne <104168801+Vortyne@users.noreply.github.com> Date: Sun, 19 Nov 2023 19:20:45 -0500 Subject: [PATCH 4/9] Name unnamed hram variables hFFDC goes completely unused so does it even needed to be declared? --- engine/events/hidden_objects/bookshelves.asm | 4 +-- engine/overworld/sprite_collisions.asm | 38 ++++++++++---------- home/hidden_objects.asm | 2 +- ram/hram.asm | 11 +++--- 4 files changed, 27 insertions(+), 28 deletions(-) diff --git a/engine/events/hidden_objects/bookshelves.asm b/engine/events/hidden_objects/bookshelves.asm index b58444af8d..a2cfb648a0 100644 --- a/engine/events/hidden_objects/bookshelves.asm +++ b/engine/events/hidden_objects/bookshelves.asm @@ -24,7 +24,7 @@ PrintBookshelfText:: pop af call PrintPredefTextID xor a - ldh [hFFDB], a + ldh [hWasBookShelfTextFound], a ret .nextBookshelfEntry1 inc hl @@ -33,7 +33,7 @@ PrintBookshelfText:: jr .loop .noMatch ld a, $ff - ldh [hFFDB], a + ldh [hWasBookShelfTextFound], a farjp PrintCardKeyText INCLUDE "data/tilesets/bookshelf_tile_ids.asm" diff --git a/engine/overworld/sprite_collisions.asm b/engine/overworld/sprite_collisions.asm index dc57d5b9c3..e0fbe0fe04 100644 --- a/engine/overworld/sprite_collisions.asm +++ b/engine/overworld/sprite_collisions.asm @@ -80,7 +80,7 @@ DetectCollisionBetweenSprites: and $f0 or c - ldh [hFF90], a ; store Y coordinate adjusted for direction of movement + ldh [hSpriteCollisionsTempYStore], a ; store Y coordinate adjusted for direction of movement ld a, [hli] ; a = [i#SPRITESTATEDATA1_XSTEPVECTOR] (-1, 0, or 1) call SetSpriteCollisionValues @@ -93,7 +93,7 @@ DetectCollisionBetweenSprites: and $f0 or c - ldh [hFF91], a ; store X coordinate adjusted for direction of movement + ldh [hSpriteCollisionsTempXStore], a ; store X coordinate adjusted for direction of movement ld a, l add 7 @@ -103,15 +103,15 @@ DetectCollisionBetweenSprites: ld [hld], a ; zero [i#SPRITESTATEDATA1_0D] XXX what's this for? ld [hld], a ; zero [i#SPRITESTATEDATA1_COLLISIONDATA] - ldh a, [hFF91] + ldh a, [hSpriteCollisionsTempXStore] ld [hld], a ; [i#SPRITESTATEDATA1_XADJUSTED] - ldh a, [hFF90] + ldh a, [hSpriteCollisionsTempYStore] ld [hl], a ; [i#SPRITESTATEDATA1_YADJUSTED] xor a ; zero the loop counter .loop - ldh [hFF8F], a ; store loop counter + ldh [hSpriteCollisionsLoopCounter], a ; store loop counter swap a ld e, a ldh a, [hCurrentSpriteOffset] @@ -155,7 +155,7 @@ DetectCollisionBetweenSprites: cpl inc a .noCarry1 - ldh [hFF90], a ; store the distance between the two sprites' adjusted Y values + ldh [hSpriteCollisionsTempYStore], a ; store the distance between the two sprites' adjusted Y values ; Use the carry flag set by the above subtraction to determine which sprite's ; Y coordinate is larger. This information is used later to set @@ -177,11 +177,11 @@ DetectCollisionBetweenSprites: ld b, 9 .next1 - ldh a, [hFF90] ; a = distance between adjusted Y coordinates + ldh a, [hSpriteCollisionsTempYStore] ; a = distance between adjusted Y coordinates sub b - ldh [hFF92], a ; store distance adjusted using sprite i's direction + ldh [hSpriteCollisionsAdjustedDistance], a ; store distance adjusted using sprite i's direction ld a, b - ldh [hFF90], a ; store 7 or 9 depending on sprite i's delta Y + ldh [hSpriteCollisionsTempYStore], a ; store 7 or 9 depending on sprite i's delta Y jr c, .checkXDistance ; If sprite j's delta Y is 0, then b = 7, else b = 9. @@ -194,7 +194,7 @@ DetectCollisionBetweenSprites: ld b, 9 .next2 - ldh a, [hFF92] ; a = distance adjusted using sprite i's direction + ldh a, [hSpriteCollisionsAdjustedDistance] ; a = distance adjusted using sprite i's direction sub b ; adjust distance using sprite j's direction jr z, .checkXDistance jr nc, .next ; go to next sprite if distance is still positive after both adjustments @@ -226,7 +226,7 @@ DetectCollisionBetweenSprites: cpl inc a .noCarry2 - ldh [hFF91], a ; store the distance between the two sprites' adjusted X values + ldh [hSpriteCollisionsTempXStore], a ; store the distance between the two sprites' adjusted X values ; Use the carry flag set by the above subtraction to determine which sprite's ; X coordinate is larger. This information is used later to set @@ -248,11 +248,11 @@ DetectCollisionBetweenSprites: ld b, 9 .next3 - ldh a, [hFF91] ; a = distance between adjusted X coordinates + ldh a, [hSpriteCollisionsTempXStore] ; a = distance between adjusted X coordinates sub b - ldh [hFF92], a ; store distance adjusted using sprite i's direction + ldh [hSpriteCollisionsAdjustedDistance], a ; store distance adjusted using sprite i's direction ld a, b - ldh [hFF91], a ; store 7 or 9 depending on sprite i's delta X + ldh [hSpriteCollisionsTempXStore], a ; store 7 or 9 depending on sprite i's delta X jr c, .collision ; If sprite j's delta X is 0, then b = 7, else b = 9. @@ -265,15 +265,15 @@ DetectCollisionBetweenSprites: ld b, 9 .next4 - ldh a, [hFF92] ; a = distance adjusted using sprite i's direction + ldh a, [hSpriteCollisionsAdjustedDistance] ; a = distance adjusted using sprite i's direction sub b ; adjust distance using sprite j's direction jr z, .collision jr nc, .next ; go to next sprite if distance is still positive after both adjustments .collision - ldh a, [hFF91] ; a = 7 or 9 depending on sprite i's delta X + ldh a, [hSpriteCollisionsTempXStore] ; a = 7 or 9 depending on sprite i's delta X ld b, a - ldh a, [hFF90] ; a = 7 or 9 depending on sprite i's delta Y + ldh a, [hSpriteCollisionsTempYStore] ; a = 7 or 9 depending on sprite i's delta Y inc l ; If delta X isn't 0 and delta Y is 0, then b = %0011, else b = %1100. @@ -296,7 +296,7 @@ DetectCollisionBetweenSprites: ; to indicate which sprite the collision occurred with inc l inc l - ldh a, [hFF8F] ; a = loop counter + ldh a, [hSpriteCollisionsLoopCounter] ; a = loop counter ld de, SpriteCollisionBitTable add a add e @@ -313,7 +313,7 @@ DetectCollisionBetweenSprites: ld [hl], a .next - ldh a, [hFF8F] ; a = loop counter + ldh a, [hSpriteCollisionsLoopCounter] ; a = loop counter inc a cp $10 jp nz, .loop diff --git a/home/hidden_objects.asm b/home/hidden_objects.asm index 6e7d980a7d..723e3056b6 100644 --- a/home/hidden_objects.asm +++ b/home/hidden_objects.asm @@ -26,7 +26,7 @@ CheckForHiddenObjectOrBookshelfOrCardKeyDoor:: jr .done .hiddenObjectNotFound farcall PrintBookshelfText - ldh a, [hFFDB] + ldh a, [hWasBookShelfTextFound] and a jr z, .done .nothingFound diff --git a/ram/hram.asm b/ram/hram.asm index 0607a48437..1288efef8c 100644 --- a/ram/hram.asm +++ b/ram/hram.asm @@ -85,10 +85,10 @@ hSpriteScreenX:: db hSpriteScreenY:: db NEXTU -hFF8F:: db -hFF90:: db -hFF91:: db -hFF92:: db +hSpriteCollisionsLoopCounter:: db +hSpriteCollisionsTempYStore:: db +hSpriteCollisionsTempXStore:: db +hSpriteCollisionsAdjustedDistance:: db ENDU hTilePlayerStandingOn:: db @@ -330,8 +330,7 @@ hGymTrashCanRandNumMask:: db NEXTU -hFFDB:: db -hFFDC:: db +hWasBookShelfTextFound:: db ; set to 0 if found, $FF if not found when attempting to interact with a hidden object ENDU ds 1 From 844657fb23b7b7e5aae13113f00fd9a4f5de53e1 Mon Sep 17 00:00:00 2001 From: Vortyne <104168801+Vortyne@users.noreply.github.com> Date: Sun, 19 Nov 2023 19:32:04 -0500 Subject: [PATCH 5/9] This wram label seems easy to name --- engine/gfx/sprite_oam.asm | 4 ++-- ram/wram.asm | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engine/gfx/sprite_oam.asm b/engine/gfx/sprite_oam.asm index 69956a3172..2049002cfd 100644 --- a/engine/gfx/sprite_oam.asm +++ b/engine/gfx/sprite_oam.asm @@ -28,7 +28,7 @@ PrepareOAMData:: inc e inc e ld a, [de] ; [x#SPRITESTATEDATA1_IMAGEINDEX] - ld [wd5cd], a + ld [wSpriteImageIndexTempCopy], a cp $ff ; off-screen (don't draw) jr nz, .visible @@ -98,7 +98,7 @@ PrepareOAMData:: push bc ld b, a - ld a, [wd5cd] ; temp copy of [x#SPRITESTATEDATA1_IMAGEINDEX] + ld a, [wSpriteImageIndexTempCopy] ; temp copy of [x#SPRITESTATEDATA1_IMAGEINDEX] swap a ; high nybble determines sprite used (0 is always player sprite, next are some npcs) and $f diff --git a/ram/wram.asm b/ram/wram.asm index 753a967823..c00d5445cb 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -1914,7 +1914,7 @@ wMissableObjectFlagsEnd:: ds 7 ; temp copy of SPRITESTATEDATA1_IMAGEINDEX (used for sprite facing/anim) -wd5cd:: db +wSpriteImageIndexTempCopy:: db ; each entry consists of 2 bytes ; * the sprite ID (depending on the current map) From 4986764ded26f75b122f6806397c07f2d48f0451 Mon Sep 17 00:00:00 2001 From: Vortyne <104168801+Vortyne@users.noreply.github.com> Date: Sun, 19 Nov 2023 20:11:35 -0500 Subject: [PATCH 6/9] Update ram/hram.asm Co-authored-by: Rangi <35663410+Rangi42@users.noreply.github.com> --- ram/hram.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ram/hram.asm b/ram/hram.asm index 1288efef8c..9b8a5abc6c 100644 --- a/ram/hram.asm +++ b/ram/hram.asm @@ -86,8 +86,8 @@ hSpriteScreenY:: db NEXTU hSpriteCollisionsLoopCounter:: db -hSpriteCollisionsTempYStore:: db -hSpriteCollisionsTempXStore:: db +hSpriteCollisionsTempYCoord:: db +hSpriteCollisionsTempXCoord:: db hSpriteCollisionsAdjustedDistance:: db ENDU From e21079d58814e1ebdf9a37f7061798b0111f2e8f Mon Sep 17 00:00:00 2001 From: Vortyne <104168801+Vortyne@users.noreply.github.com> Date: Sun, 19 Nov 2023 20:12:48 -0500 Subject: [PATCH 7/9] Update naming --- engine/overworld/sprite_collisions.asm | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/engine/overworld/sprite_collisions.asm b/engine/overworld/sprite_collisions.asm index e0fbe0fe04..9fc9f93a77 100644 --- a/engine/overworld/sprite_collisions.asm +++ b/engine/overworld/sprite_collisions.asm @@ -80,7 +80,7 @@ DetectCollisionBetweenSprites: and $f0 or c - ldh [hSpriteCollisionsTempYStore], a ; store Y coordinate adjusted for direction of movement + ldh [hSpriteCollisionsTempYCoord], a ; store Y coordinate adjusted for direction of movement ld a, [hli] ; a = [i#SPRITESTATEDATA1_XSTEPVECTOR] (-1, 0, or 1) call SetSpriteCollisionValues @@ -93,7 +93,7 @@ DetectCollisionBetweenSprites: and $f0 or c - ldh [hSpriteCollisionsTempXStore], a ; store X coordinate adjusted for direction of movement + ldh [hSpriteCollisionsTempXCoord], a ; store X coordinate adjusted for direction of movement ld a, l add 7 @@ -103,9 +103,9 @@ DetectCollisionBetweenSprites: ld [hld], a ; zero [i#SPRITESTATEDATA1_0D] XXX what's this for? ld [hld], a ; zero [i#SPRITESTATEDATA1_COLLISIONDATA] - ldh a, [hSpriteCollisionsTempXStore] + ldh a, [hSpriteCollisionsTempXCoord] ld [hld], a ; [i#SPRITESTATEDATA1_XADJUSTED] - ldh a, [hSpriteCollisionsTempYStore] + ldh a, [hSpriteCollisionsTempYCoord] ld [hl], a ; [i#SPRITESTATEDATA1_YADJUSTED] xor a ; zero the loop counter @@ -155,7 +155,7 @@ DetectCollisionBetweenSprites: cpl inc a .noCarry1 - ldh [hSpriteCollisionsTempYStore], a ; store the distance between the two sprites' adjusted Y values + ldh [hSpriteCollisionsTempYCoord], a ; store the distance between the two sprites' adjusted Y values ; Use the carry flag set by the above subtraction to determine which sprite's ; Y coordinate is larger. This information is used later to set @@ -177,11 +177,11 @@ DetectCollisionBetweenSprites: ld b, 9 .next1 - ldh a, [hSpriteCollisionsTempYStore] ; a = distance between adjusted Y coordinates + ldh a, [hSpriteCollisionsTempYCoord] ; a = distance between adjusted Y coordinates sub b ldh [hSpriteCollisionsAdjustedDistance], a ; store distance adjusted using sprite i's direction ld a, b - ldh [hSpriteCollisionsTempYStore], a ; store 7 or 9 depending on sprite i's delta Y + ldh [hSpriteCollisionsTempYCoord], a ; store 7 or 9 depending on sprite i's delta Y jr c, .checkXDistance ; If sprite j's delta Y is 0, then b = 7, else b = 9. @@ -226,7 +226,7 @@ DetectCollisionBetweenSprites: cpl inc a .noCarry2 - ldh [hSpriteCollisionsTempXStore], a ; store the distance between the two sprites' adjusted X values + ldh [hSpriteCollisionsTempXCoord], a ; store the distance between the two sprites' adjusted X values ; Use the carry flag set by the above subtraction to determine which sprite's ; X coordinate is larger. This information is used later to set @@ -248,11 +248,11 @@ DetectCollisionBetweenSprites: ld b, 9 .next3 - ldh a, [hSpriteCollisionsTempXStore] ; a = distance between adjusted X coordinates + ldh a, [hSpriteCollisionsTempXCoord] ; a = distance between adjusted X coordinates sub b ldh [hSpriteCollisionsAdjustedDistance], a ; store distance adjusted using sprite i's direction ld a, b - ldh [hSpriteCollisionsTempXStore], a ; store 7 or 9 depending on sprite i's delta X + ldh [hSpriteCollisionsTempXCoord], a ; store 7 or 9 depending on sprite i's delta X jr c, .collision ; If sprite j's delta X is 0, then b = 7, else b = 9. @@ -271,9 +271,9 @@ DetectCollisionBetweenSprites: jr nc, .next ; go to next sprite if distance is still positive after both adjustments .collision - ldh a, [hSpriteCollisionsTempXStore] ; a = 7 or 9 depending on sprite i's delta X + ldh a, [hSpriteCollisionsTempXCoord] ; a = 7 or 9 depending on sprite i's delta X ld b, a - ldh a, [hSpriteCollisionsTempYStore] ; a = 7 or 9 depending on sprite i's delta Y + ldh a, [hSpriteCollisionsTempYCoord] ; a = 7 or 9 depending on sprite i's delta Y inc l ; If delta X isn't 0 and delta Y is 0, then b = %0011, else b = %1100. From f382da0c7c8f5dde81ca48505d7103a4d5dee575 Mon Sep 17 00:00:00 2001 From: Vortyne <104168801+Vortyne@users.noreply.github.com> Date: Sun, 19 Nov 2023 20:32:20 -0500 Subject: [PATCH 8/9] Tweak naming --- engine/events/hidden_objects/bookshelves.asm | 4 ++-- engine/gfx/sprite_oam.asm | 4 ++-- engine/overworld/sprite_collisions.asm | 18 +++++++++--------- home/hidden_objects.asm | 2 +- ram/hram.asm | 2 +- ram/wram.asm | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/engine/events/hidden_objects/bookshelves.asm b/engine/events/hidden_objects/bookshelves.asm index a2cfb648a0..813cfc49a4 100644 --- a/engine/events/hidden_objects/bookshelves.asm +++ b/engine/events/hidden_objects/bookshelves.asm @@ -24,7 +24,7 @@ PrintBookshelfText:: pop af call PrintPredefTextID xor a - ldh [hWasBookShelfTextFound], a + ldh [hInteractedWithBookshelf], a ret .nextBookshelfEntry1 inc hl @@ -33,7 +33,7 @@ PrintBookshelfText:: jr .loop .noMatch ld a, $ff - ldh [hWasBookShelfTextFound], a + ldh [hInteractedWithBookshelf], a farjp PrintCardKeyText INCLUDE "data/tilesets/bookshelf_tile_ids.asm" diff --git a/engine/gfx/sprite_oam.asm b/engine/gfx/sprite_oam.asm index 2049002cfd..4a31ab5e4d 100644 --- a/engine/gfx/sprite_oam.asm +++ b/engine/gfx/sprite_oam.asm @@ -28,7 +28,7 @@ PrepareOAMData:: inc e inc e ld a, [de] ; [x#SPRITESTATEDATA1_IMAGEINDEX] - ld [wSpriteImageIndexTempCopy], a + ld [wSpriteImageIndexBackup], a cp $ff ; off-screen (don't draw) jr nz, .visible @@ -98,7 +98,7 @@ PrepareOAMData:: push bc ld b, a - ld a, [wSpriteImageIndexTempCopy] ; temp copy of [x#SPRITESTATEDATA1_IMAGEINDEX] + ld a, [wSpriteImageIndexBackup] swap a ; high nybble determines sprite used (0 is always player sprite, next are some npcs) and $f diff --git a/engine/overworld/sprite_collisions.asm b/engine/overworld/sprite_collisions.asm index 9fc9f93a77..92106829e7 100644 --- a/engine/overworld/sprite_collisions.asm +++ b/engine/overworld/sprite_collisions.asm @@ -80,7 +80,7 @@ DetectCollisionBetweenSprites: and $f0 or c - ldh [hSpriteCollisionsTempYCoord], a ; store Y coordinate adjusted for direction of movement + ldh [hSpriteCollisionsTempYCoord], a ; y adjusted for direction of movement ld a, [hli] ; a = [i#SPRITESTATEDATA1_XSTEPVECTOR] (-1, 0, or 1) call SetSpriteCollisionValues @@ -93,7 +93,7 @@ DetectCollisionBetweenSprites: and $f0 or c - ldh [hSpriteCollisionsTempXCoord], a ; store X coordinate adjusted for direction of movement + ldh [hSpriteCollisionsTempXCoord], a ; x adjusted for direction of movement ld a, l add 7 @@ -111,7 +111,7 @@ DetectCollisionBetweenSprites: xor a ; zero the loop counter .loop - ldh [hSpriteCollisionsLoopCounter], a ; store loop counter + ldh [hSpriteCollisionsLoopCounter], a swap a ld e, a ldh a, [hCurrentSpriteOffset] @@ -179,7 +179,7 @@ DetectCollisionBetweenSprites: .next1 ldh a, [hSpriteCollisionsTempYCoord] ; a = distance between adjusted Y coordinates sub b - ldh [hSpriteCollisionsAdjustedDistance], a ; store distance adjusted using sprite i's direction + ldh [hSpriteCollisionsAdjustedDistance], a ld a, b ldh [hSpriteCollisionsTempYCoord], a ; store 7 or 9 depending on sprite i's delta Y jr c, .checkXDistance @@ -194,7 +194,7 @@ DetectCollisionBetweenSprites: ld b, 9 .next2 - ldh a, [hSpriteCollisionsAdjustedDistance] ; a = distance adjusted using sprite i's direction + ldh a, [hSpriteCollisionsAdjustedDistance] sub b ; adjust distance using sprite j's direction jr z, .checkXDistance jr nc, .next ; go to next sprite if distance is still positive after both adjustments @@ -250,7 +250,7 @@ DetectCollisionBetweenSprites: .next3 ldh a, [hSpriteCollisionsTempXCoord] ; a = distance between adjusted X coordinates sub b - ldh [hSpriteCollisionsAdjustedDistance], a ; store distance adjusted using sprite i's direction + ldh [hSpriteCollisionsAdjustedDistance], a ld a, b ldh [hSpriteCollisionsTempXCoord], a ; store 7 or 9 depending on sprite i's delta X jr c, .collision @@ -265,7 +265,7 @@ DetectCollisionBetweenSprites: ld b, 9 .next4 - ldh a, [hSpriteCollisionsAdjustedDistance] ; a = distance adjusted using sprite i's direction + ldh a, [hSpriteCollisionsAdjustedDistance] sub b ; adjust distance using sprite j's direction jr z, .collision jr nc, .next ; go to next sprite if distance is still positive after both adjustments @@ -296,7 +296,7 @@ DetectCollisionBetweenSprites: ; to indicate which sprite the collision occurred with inc l inc l - ldh a, [hSpriteCollisionsLoopCounter] ; a = loop counter + ldh a, [hSpriteCollisionsLoopCounter] ld de, SpriteCollisionBitTable add a add e @@ -313,7 +313,7 @@ DetectCollisionBetweenSprites: ld [hl], a .next - ldh a, [hSpriteCollisionsLoopCounter] ; a = loop counter + ldh a, [hSpriteCollisionsLoopCounter] inc a cp $10 jp nz, .loop diff --git a/home/hidden_objects.asm b/home/hidden_objects.asm index 723e3056b6..2e3510b04b 100644 --- a/home/hidden_objects.asm +++ b/home/hidden_objects.asm @@ -26,7 +26,7 @@ CheckForHiddenObjectOrBookshelfOrCardKeyDoor:: jr .done .hiddenObjectNotFound farcall PrintBookshelfText - ldh a, [hWasBookShelfTextFound] + ldh a, [hInteractedWithBookshelf] and a jr z, .done .nothingFound diff --git a/ram/hram.asm b/ram/hram.asm index 9b8a5abc6c..ea2c981e13 100644 --- a/ram/hram.asm +++ b/ram/hram.asm @@ -330,7 +330,7 @@ hGymTrashCanRandNumMask:: db NEXTU -hWasBookShelfTextFound:: db ; set to 0 if found, $FF if not found when attempting to interact with a hidden object +hInteractedWithBookshelf:: db ; set to 0 if you interacted with a bookshelf, $FF if not when attempting to interact with a hidden object ENDU ds 1 diff --git a/ram/wram.asm b/ram/wram.asm index c00d5445cb..8c246b8a6d 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -1914,7 +1914,7 @@ wMissableObjectFlagsEnd:: ds 7 ; temp copy of SPRITESTATEDATA1_IMAGEINDEX (used for sprite facing/anim) -wSpriteImageIndexTempCopy:: db +wSpriteImageIndexBackup:: db ; each entry consists of 2 bytes ; * the sprite ID (depending on the current map) From 3d436369da5c739b91536f8004761a7157e3cd99 Mon Sep 17 00:00:00 2001 From: Vortyne <104168801+Vortyne@users.noreply.github.com> Date: Mon, 20 Nov 2023 17:21:07 -0500 Subject: [PATCH 9/9] Tweak names further --- engine/overworld/sprite_collisions.asm | 38 +++++++++++++------------- ram/hram.asm | 12 ++++---- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/engine/overworld/sprite_collisions.asm b/engine/overworld/sprite_collisions.asm index 92106829e7..46c29e3e0a 100644 --- a/engine/overworld/sprite_collisions.asm +++ b/engine/overworld/sprite_collisions.asm @@ -80,7 +80,7 @@ DetectCollisionBetweenSprites: and $f0 or c - ldh [hSpriteCollisionsTempYCoord], a ; y adjusted for direction of movement + ldh [hCollidingSpriteTempYValue], a ; y adjusted for direction of movement ld a, [hli] ; a = [i#SPRITESTATEDATA1_XSTEPVECTOR] (-1, 0, or 1) call SetSpriteCollisionValues @@ -93,7 +93,7 @@ DetectCollisionBetweenSprites: and $f0 or c - ldh [hSpriteCollisionsTempXCoord], a ; x adjusted for direction of movement + ldh [hCollidingSpriteTempXValue], a ; x adjusted for direction of movement ld a, l add 7 @@ -103,15 +103,15 @@ DetectCollisionBetweenSprites: ld [hld], a ; zero [i#SPRITESTATEDATA1_0D] XXX what's this for? ld [hld], a ; zero [i#SPRITESTATEDATA1_COLLISIONDATA] - ldh a, [hSpriteCollisionsTempXCoord] + ldh a, [hCollidingSpriteTempXValue] ld [hld], a ; [i#SPRITESTATEDATA1_XADJUSTED] - ldh a, [hSpriteCollisionsTempYCoord] + ldh a, [hCollidingSpriteTempYValue] ld [hl], a ; [i#SPRITESTATEDATA1_YADJUSTED] xor a ; zero the loop counter .loop - ldh [hSpriteCollisionsLoopCounter], a + ldh [hCollidingSpriteOffset], a swap a ld e, a ldh a, [hCurrentSpriteOffset] @@ -155,7 +155,7 @@ DetectCollisionBetweenSprites: cpl inc a .noCarry1 - ldh [hSpriteCollisionsTempYCoord], a ; store the distance between the two sprites' adjusted Y values + ldh [hCollidingSpriteTempYValue], a ; store the distance between the two sprites' adjusted Y values ; Use the carry flag set by the above subtraction to determine which sprite's ; Y coordinate is larger. This information is used later to set @@ -177,11 +177,11 @@ DetectCollisionBetweenSprites: ld b, 9 .next1 - ldh a, [hSpriteCollisionsTempYCoord] ; a = distance between adjusted Y coordinates + ldh a, [hCollidingSpriteTempYValue] ; a = distance between adjusted Y coordinates sub b - ldh [hSpriteCollisionsAdjustedDistance], a + ldh [hCollidingSpriteAdjustedDistance], a ld a, b - ldh [hSpriteCollisionsTempYCoord], a ; store 7 or 9 depending on sprite i's delta Y + ldh [hCollidingSpriteTempYValue], a ; store 7 or 9 depending on sprite i's delta Y jr c, .checkXDistance ; If sprite j's delta Y is 0, then b = 7, else b = 9. @@ -194,7 +194,7 @@ DetectCollisionBetweenSprites: ld b, 9 .next2 - ldh a, [hSpriteCollisionsAdjustedDistance] + ldh a, [hCollidingSpriteAdjustedDistance] sub b ; adjust distance using sprite j's direction jr z, .checkXDistance jr nc, .next ; go to next sprite if distance is still positive after both adjustments @@ -226,7 +226,7 @@ DetectCollisionBetweenSprites: cpl inc a .noCarry2 - ldh [hSpriteCollisionsTempXCoord], a ; store the distance between the two sprites' adjusted X values + ldh [hCollidingSpriteTempXValue], a ; store the distance between the two sprites' adjusted X values ; Use the carry flag set by the above subtraction to determine which sprite's ; X coordinate is larger. This information is used later to set @@ -248,11 +248,11 @@ DetectCollisionBetweenSprites: ld b, 9 .next3 - ldh a, [hSpriteCollisionsTempXCoord] ; a = distance between adjusted X coordinates + ldh a, [hCollidingSpriteTempXValue] ; a = distance between adjusted X coordinates sub b - ldh [hSpriteCollisionsAdjustedDistance], a + ldh [hCollidingSpriteAdjustedDistance], a ld a, b - ldh [hSpriteCollisionsTempXCoord], a ; store 7 or 9 depending on sprite i's delta X + ldh [hCollidingSpriteTempXValue], a ; store 7 or 9 depending on sprite i's delta X jr c, .collision ; If sprite j's delta X is 0, then b = 7, else b = 9. @@ -265,15 +265,15 @@ DetectCollisionBetweenSprites: ld b, 9 .next4 - ldh a, [hSpriteCollisionsAdjustedDistance] + ldh a, [hCollidingSpriteAdjustedDistance] sub b ; adjust distance using sprite j's direction jr z, .collision jr nc, .next ; go to next sprite if distance is still positive after both adjustments .collision - ldh a, [hSpriteCollisionsTempXCoord] ; a = 7 or 9 depending on sprite i's delta X + ldh a, [hCollidingSpriteTempXValue] ; a = 7 or 9 depending on sprite i's delta X ld b, a - ldh a, [hSpriteCollisionsTempYCoord] ; a = 7 or 9 depending on sprite i's delta Y + ldh a, [hCollidingSpriteTempYValue] ; a = 7 or 9 depending on sprite i's delta Y inc l ; If delta X isn't 0 and delta Y is 0, then b = %0011, else b = %1100. @@ -296,7 +296,7 @@ DetectCollisionBetweenSprites: ; to indicate which sprite the collision occurred with inc l inc l - ldh a, [hSpriteCollisionsLoopCounter] + ldh a, [hCollidingSpriteOffset] ld de, SpriteCollisionBitTable add a add e @@ -313,7 +313,7 @@ DetectCollisionBetweenSprites: ld [hl], a .next - ldh a, [hSpriteCollisionsLoopCounter] + ldh a, [hCollidingSpriteOffset] inc a cp $10 jp nz, .loop diff --git a/ram/hram.asm b/ram/hram.asm index ea2c981e13..72e9e13a20 100644 --- a/ram/hram.asm +++ b/ram/hram.asm @@ -85,10 +85,10 @@ hSpriteScreenX:: db hSpriteScreenY:: db NEXTU -hSpriteCollisionsLoopCounter:: db -hSpriteCollisionsTempYCoord:: db -hSpriteCollisionsTempXCoord:: db -hSpriteCollisionsAdjustedDistance:: db +hCollidingSpriteOffset:: db +hCollidingSpriteTempYValue:: db +hCollidingSpriteTempXValue:: db +hCollidingSpriteAdjustedDistance:: db ENDU hTilePlayerStandingOn:: db @@ -327,10 +327,8 @@ hItemCounter:: hSavedCoordIndex:: hMissableObjectIndex:: hGymTrashCanRandNumMask:: +hInteractedWithBookshelf:: db - -NEXTU -hInteractedWithBookshelf:: db ; set to 0 if you interacted with a bookshelf, $FF if not when attempting to interact with a hidden object ENDU ds 1