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 c1fef205a3..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,37 +8,37 @@ PokemonMansion1F_Script: ld [wPokemonMansion1FCurScript], a ret -Mansion1Subscript1: +Mansion1CheckReplaceSwitchDoorBlocks: ld hl, wCurrentMapScriptFlags bit 5, [hl] 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: 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