2019-01-01 20:06:23 +00:00
|
|
|
SeafoamIslandsB4F_Script:
|
2014-05-18 18:19:10 +00:00
|
|
|
call EnableAutoTextBoxDrawing
|
2019-01-01 20:06:23 +00:00
|
|
|
ld a, [wSeafoamIslandsB4FCurScript]
|
|
|
|
ld hl, SeafoamIslandsB4F_ScriptPointers
|
2014-05-18 18:19:10 +00:00
|
|
|
jp CallFunctionInTable
|
|
|
|
|
2023-11-19 21:09:33 +00:00
|
|
|
SeafoamIslandsB4FResetScript:
|
2014-05-18 18:19:10 +00:00
|
|
|
xor a
|
2019-01-01 20:06:23 +00:00
|
|
|
ld [wSeafoamIslandsB4FCurScript], a
|
2014-05-25 17:51:53 +00:00
|
|
|
ld [wJoyIgnore], a
|
2014-05-18 18:19:10 +00:00
|
|
|
ret
|
|
|
|
|
2019-01-01 20:06:23 +00:00
|
|
|
SeafoamIslandsB4F_ScriptPointers:
|
2023-07-14 01:27:56 +00:00
|
|
|
def_script_pointers
|
|
|
|
dw_const SeafoamIslandsB4FDefaultScript, SCRIPT_SEAFOAMISLANDSB4F_DEFAULT
|
|
|
|
dw_const SeafoamIslandsB4FObjectMoving1Script, SCRIPT_SEAFOAMISLANDSB4F_OBJECT_MOVING1
|
|
|
|
dw_const SeafoamIslandsB4FMoveObjectScript, SCRIPT_SEAFOAMISLANDSB4F_MOVE_OBJECT
|
|
|
|
dw_const SeafoamIslandsB4FObjectMoving2Script, SCRIPT_SEAFOAMISLANDSB4F_OBJECT_MOVING2
|
|
|
|
dw_const SeafoamIslandsB4FObjectMoving3Script, SCRIPT_SEAFOAMISLANDSB4F_OBJECT_MOVING3
|
|
|
|
EXPORT SCRIPT_SEAFOAMISLANDSB4F_MOVE_OBJECT ; used by engine/overworld/player_state.asm
|
|
|
|
|
|
|
|
SeafoamIslandsB4FObjectMoving3Script:
|
2015-08-31 02:38:41 +00:00
|
|
|
ld a, [wIsInBattle]
|
2014-05-18 18:19:10 +00:00
|
|
|
cp $ff
|
2023-11-19 21:09:33 +00:00
|
|
|
jr z, SeafoamIslandsB4FResetScript
|
2014-05-18 18:19:10 +00:00
|
|
|
call EndTrainerBattle
|
2023-07-14 01:27:56 +00:00
|
|
|
ld a, SCRIPT_SEAFOAMISLANDSB4F_DEFAULT
|
2019-01-01 20:06:23 +00:00
|
|
|
ld [wSeafoamIslandsB4FCurScript], a
|
2014-05-18 18:19:10 +00:00
|
|
|
ret
|
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
SeafoamIslandsB4FDefaultScript:
|
2015-07-21 17:36:03 +00:00
|
|
|
CheckBothEventsSet EVENT_SEAFOAM3_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM3_BOULDER2_DOWN_HOLE
|
2014-05-18 18:19:10 +00:00
|
|
|
ret z
|
2016-04-07 02:58:45 +00:00
|
|
|
ld hl, .Coords
|
2014-05-18 18:19:10 +00:00
|
|
|
call ArePlayerCoordsInArray
|
|
|
|
ret nc
|
2015-07-19 03:49:52 +00:00
|
|
|
ld a, [wCoordIndex]
|
2014-05-18 18:19:10 +00:00
|
|
|
cp $3
|
2023-11-19 21:09:33 +00:00
|
|
|
jr nc, .only1UpInputNeeded
|
2015-07-26 02:26:54 +00:00
|
|
|
ld a, NPC_MOVEMENT_UP
|
|
|
|
ld [wSimulatedJoypadStatesEnd + 1], a
|
|
|
|
ld a, 2
|
2023-11-19 21:09:33 +00:00
|
|
|
jr .forcePlayerUpFromSurfExit
|
|
|
|
.only1UpInputNeeded
|
2015-07-26 02:26:54 +00:00
|
|
|
ld a, 1
|
2023-11-19 21:09:33 +00:00
|
|
|
.forcePlayerUpFromSurfExit
|
2014-09-10 03:55:19 +00:00
|
|
|
ld [wSimulatedJoypadStatesIndex], a
|
2015-07-17 07:52:25 +00:00
|
|
|
ld a, D_UP
|
2014-09-10 03:55:19 +00:00
|
|
|
ld [wSimulatedJoypadStatesEnd], a
|
|
|
|
call StartSimulatingJoypadStates
|
2015-08-31 02:38:41 +00:00
|
|
|
ld hl, wFlags_D733
|
2014-05-18 18:19:10 +00:00
|
|
|
res 2, [hl]
|
2023-07-14 01:27:56 +00:00
|
|
|
ld a, SCRIPT_SEAFOAMISLANDSB4F_OBJECT_MOVING1
|
2019-01-01 20:06:23 +00:00
|
|
|
ld [wSeafoamIslandsB4FCurScript], a
|
2014-05-18 18:19:10 +00:00
|
|
|
ret
|
|
|
|
|
2016-04-07 02:58:45 +00:00
|
|
|
.Coords
|
2020-07-16 16:32:19 +00:00
|
|
|
dbmapcoord 20, 17
|
|
|
|
dbmapcoord 21, 17
|
|
|
|
dbmapcoord 20, 16
|
|
|
|
dbmapcoord 21, 16
|
|
|
|
db -1 ; end
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
SeafoamIslandsB4FObjectMoving1Script:
|
2014-09-10 03:55:19 +00:00
|
|
|
ld a, [wSimulatedJoypadStatesIndex]
|
2014-05-18 18:19:10 +00:00
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
xor a
|
2014-05-25 17:51:53 +00:00
|
|
|
ld [wJoyIgnore], a
|
2023-07-14 01:27:56 +00:00
|
|
|
ld a, SCRIPT_SEAFOAMISLANDSB4F_DEFAULT
|
2019-01-01 20:06:23 +00:00
|
|
|
ld [wSeafoamIslandsB4FCurScript], a
|
2014-05-18 18:19:10 +00:00
|
|
|
ret
|
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
SeafoamIslandsB4FMoveObjectScript:
|
2015-07-21 17:36:03 +00:00
|
|
|
CheckBothEventsSet EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE
|
2023-07-14 01:27:56 +00:00
|
|
|
ld a, SCRIPT_SEAFOAMISLANDSB4F_DEFAULT
|
2023-11-19 21:09:33 +00:00
|
|
|
jr z, .playerNotInStrongCurrent
|
2016-04-07 02:58:45 +00:00
|
|
|
ld hl, .Coords
|
2014-05-18 18:19:10 +00:00
|
|
|
call ArePlayerCoordsInArray
|
2023-07-14 01:27:56 +00:00
|
|
|
ld a, SCRIPT_SEAFOAMISLANDSB4F_DEFAULT
|
2023-11-19 21:09:33 +00:00
|
|
|
jr nc, .playerNotInStrongCurrent
|
2015-07-19 03:49:52 +00:00
|
|
|
ld a, [wCoordIndex]
|
2014-05-18 18:19:10 +00:00
|
|
|
cp $1
|
2023-11-19 21:09:33 +00:00
|
|
|
jr nz, .nearRightBoulder
|
|
|
|
ld de, .RLEList_StrongCurrentNearLeftBoulder
|
|
|
|
jr .forceSurfMovement
|
|
|
|
.nearRightBoulder
|
|
|
|
ld de, .RLEList_StrongCurrentNearRightBoulder
|
|
|
|
.forceSurfMovement
|
2014-09-10 03:55:19 +00:00
|
|
|
ld hl, wSimulatedJoypadStatesEnd
|
2014-05-18 18:19:10 +00:00
|
|
|
call DecodeRLEList
|
|
|
|
dec a
|
2014-09-10 03:55:19 +00:00
|
|
|
ld [wSimulatedJoypadStatesIndex], a
|
|
|
|
call StartSimulatingJoypadStates
|
2023-07-14 01:27:56 +00:00
|
|
|
ld a, SCRIPT_SEAFOAMISLANDSB4F_OBJECT_MOVING2
|
2023-11-19 21:09:33 +00:00
|
|
|
.playerNotInStrongCurrent
|
2019-01-01 20:06:23 +00:00
|
|
|
ld [wSeafoamIslandsB4FCurScript], a
|
2014-05-18 18:19:10 +00:00
|
|
|
ret
|
|
|
|
|
2016-04-07 02:58:45 +00:00
|
|
|
.Coords
|
2020-07-16 16:32:19 +00:00
|
|
|
dbmapcoord 4, 14
|
|
|
|
dbmapcoord 5, 14
|
|
|
|
db -1 ; end
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2023-11-19 21:09:33 +00:00
|
|
|
.RLEList_StrongCurrentNearRightBoulder:
|
2020-07-16 16:32:19 +00:00
|
|
|
db D_UP, 3
|
|
|
|
db D_RIGHT, 2
|
|
|
|
db D_UP, 1
|
|
|
|
db -1 ; end
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2023-11-19 21:09:33 +00:00
|
|
|
.RLEList_StrongCurrentNearLeftBoulder:
|
2020-07-16 16:32:19 +00:00
|
|
|
db D_UP, 3
|
|
|
|
db D_RIGHT, 3
|
|
|
|
db D_UP, 1
|
|
|
|
db -1 ; end
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
SeafoamIslandsB4FObjectMoving2Script:
|
2014-09-10 03:55:19 +00:00
|
|
|
ld a, [wSimulatedJoypadStatesIndex]
|
2014-05-18 18:19:10 +00:00
|
|
|
ld b, a
|
|
|
|
cp $1
|
2023-11-19 23:37:59 +00:00
|
|
|
call z, .doneForcedSurfMovement
|
2014-05-18 18:19:10 +00:00
|
|
|
ld a, b
|
|
|
|
and a
|
|
|
|
ret nz
|
2023-07-14 01:27:56 +00:00
|
|
|
ld a, SCRIPT_SEAFOAMISLANDSB4F_DEFAULT
|
2019-01-01 20:06:23 +00:00
|
|
|
ld [wSeafoamIslandsB4FCurScript], a
|
2014-05-18 18:19:10 +00:00
|
|
|
ret
|
|
|
|
|
2023-11-19 23:37:59 +00:00
|
|
|
.doneForcedSurfMovement:
|
2014-05-18 18:19:10 +00:00
|
|
|
xor a
|
2014-09-13 07:50:56 +00:00
|
|
|
ld [wWalkBikeSurfState], a
|
|
|
|
ld [wWalkBikeSurfStateCopy], a
|
2014-05-18 18:19:10 +00:00
|
|
|
jp ForceBikeOrSurf
|
|
|
|
|
2019-01-01 20:06:23 +00:00
|
|
|
SeafoamIslandsB4F_TextPointers:
|
2023-07-14 01:27:56 +00:00
|
|
|
def_text_pointers
|
|
|
|
dw_const BoulderText, TEXT_SEAFOAMISLANDSB4F_BOULDER1
|
|
|
|
dw_const BoulderText, TEXT_SEAFOAMISLANDSB4F_BOULDER2
|
|
|
|
dw_const SeafoamIslandsB4FArticunoText, TEXT_SEAFOAMISLANDSB4F_ARTICUNO
|
|
|
|
dw_const SeafoamIslandsB4FBouldersSignText, TEXT_SEAFOAMISLANDSB4F_BOULDERS_SIGN
|
|
|
|
dw_const SeafoamIslandsB4FDangerSignText, TEXT_SEAFOAMISLANDSB4F_DANGER_SIGN
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2021-04-13 22:24:37 +00:00
|
|
|
; Articuno is object 3, but its event flag is bit 2.
|
|
|
|
; This is not a problem because its sight range is 0, and
|
|
|
|
; trainer headers were not stored by ExecuteCurMapScriptInTable.
|
|
|
|
def_trainers 2
|
2016-04-07 02:58:45 +00:00
|
|
|
ArticunoTrainerHeader:
|
2023-07-14 01:27:56 +00:00
|
|
|
trainer EVENT_BEAT_ARTICUNO, 0, SeafoamIslandsB4FArticunoBattleText, SeafoamIslandsB4FArticunoBattleText, SeafoamIslandsB4FArticunoBattleText
|
2020-07-14 19:45:36 +00:00
|
|
|
db -1 ; end
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
SeafoamIslandsB4FArticunoText:
|
2020-07-04 21:09:35 +00:00
|
|
|
text_asm
|
2016-04-07 02:58:45 +00:00
|
|
|
ld hl, ArticunoTrainerHeader
|
2014-05-18 18:19:10 +00:00
|
|
|
call TalkToTrainer
|
2023-07-14 01:27:56 +00:00
|
|
|
ld a, SCRIPT_SEAFOAMISLANDSB4F_OBJECT_MOVING3
|
2019-01-01 20:06:23 +00:00
|
|
|
ld [wSeafoamIslandsB4FCurScript], a
|
2014-05-18 18:19:10 +00:00
|
|
|
jp TextScriptEnd
|
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
SeafoamIslandsB4FArticunoBattleText:
|
|
|
|
text_far _SeafoamIslandsB4FArticunoBattleText
|
2020-07-04 21:09:35 +00:00
|
|
|
text_asm
|
2014-05-18 18:19:10 +00:00
|
|
|
ld a, ARTICUNO
|
|
|
|
call PlayCry
|
|
|
|
call WaitForSoundToFinish
|
|
|
|
jp TextScriptEnd
|
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
SeafoamIslandsB4FBouldersSignText:
|
|
|
|
text_far _SeafoamIslandsB4FBouldersSignText
|
2020-07-04 21:09:35 +00:00
|
|
|
text_end
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
SeafoamIslandsB4FDangerSignText:
|
|
|
|
text_far _SeafoamIslandsB4FDangerSignText
|
2020-07-04 21:09:35 +00:00
|
|
|
text_end
|