vale_storm.c
Vale on the stormy night: the paths and doors the party passes as the storm rages, with Dora and Kyle on the first arrival.
games/tbs/src/scene/vale_storm.c on GitHub
Vale on the stormy night: the paths and doors the party passes as the storm rages, with Dora and Kyle on the first arrival.
Functions
ValeStorm_RerollHeadingOnCountdown
static s32 ValeStorm_RerollHeadingOnCountdown(struct ScriptInterpreter *interpreter)
Chooses a new random heading whenever the actor countdown expires.
Used by gValeStorm_LookAroundScript.
ValeStorm_GetEntrances
const struct SceneEntrance *ValeStorm_GetEntrances(void)
Returns where the party appears; entrance 15 is where Dora and Isaac run in from the south-west of Vale (ValeBabi's exit 21).
Event_SetPathCellOverride
static void Event_SetPathCellOverride(void)
Swaps the upper path's collision cells as the leader steps onto it. Reached by stepping on cell code 15. Sets FLAG_SCENE_TEMP_10, which ValeStorm_Initialize reads to swap them again.
Used by ValeStorm_Initialize, gValeStorm_Events.
Event_ClearPathCellOverride
static void Event_ClearPathCellOverride(void)
Restores the upper path's collision cells as the leader steps off it. Reached by stepping on cell code 14. Clears FLAG_SCENE_TEMP_10.
Used by ValeStorm_ShowBoulderSweepingDownriver, gValeStorm_Events.
ValeStorm_OpenBackdropExit11
UNUSED static void ValeStorm_OpenBackdropExit11(void)
Opens a door and takes exit 11, to ValeInteriors' entrance 1. No event row names it.
Event_LeaveByExit1
static void Event_LeaveByExit1(void)
Stepping on cell code 2 requests exit 1, which has no table row. Scene_TakeExit therefore falls back to scene 5, entrance 0 (ValeHome), using the first exit's scene.
Used by gValeStorm_Events.
Event_LeaveByExit3
static void Event_LeaveByExit3(void)
Reached by stepping on cell code 3; takes exit 3, to Kraden's cottage (ValeKraden's entrance 1).
Used by gValeStorm_Events.
Event_LeaveByExit4
static void Event_LeaveByExit4(void)
Reached by stepping on cell code 4; takes exit 4, to Kraden's cottage (ValeKraden's entrance 2).
Used by gValeStorm_Events.
Event_LeaveByExit2
static void Event_LeaveByExit2(void)
Reached by stepping on cell code 5; takes exit 2, to ValeHome's entrance 8. After the river gathering Garet first leaves Isaac (ValeStorm_GaretLeavesIsaac).
Used by gValeStorm_Events.
Event_LeaveByExit5
static void Event_LeaveByExit5(void)
Opens the door and goes in. Reached by walking north into cell code 6; takes exit 5, to Vale's houses (ValeInteriors' entrance 6).
Used by gValeStorm_Events.
Event_LeaveByExit6
static void Event_LeaveByExit6(void)
Isaac's first time at the door of exit 6: a villager runs out and shoves him; afterwards the door opens as usual. "Huh? Isaac?" Reached by walking north into cell code 7. The shove plays until FLAG_VALE_STORM_BUMPED_INTO_VILLAGER or FLAG_VALE_STORM_SECOND_ROCK_FELL is set, and sets FLAG_SCENE_TEMP_06; otherwise takes exit 6, to ValeInteriors' entrance 5.
Used by gValeStorm_Events.
Event_LeaveByExit7
static void Event_LeaveByExit7(void)
Opens the door, unless Dora and Kyle left it open, and goes in. Reached by walking north into cell code 8; takes exit 7, to the south-west of Vale (ValeBabi's entrance 6).
Used by gValeStorm_Events.
Event_LeaveByExit8
static void Event_LeaveByExit8(void)
Opens the door and goes in. Reached by walking north into cell code 9; takes exit 8, to ValeInteriors' entrance 2.
Used by gValeStorm_Events.
Event_LeaveByExit9
static void Event_LeaveByExit9(void)
Opens the door and goes in. Reached by walking north into cell code 10; takes exit 9, to ValeInteriors' entrance 1.
Used by gValeStorm_Events.
Event_LeaveByExit10
static void Event_LeaveByExit10(void)
Opens the door and goes in. Reached by walking north into cell code 11; takes exit 10, to ValeInteriors' entrance 1.
Used by gValeStorm_Events.
Event_LeaveByExit12
static void Event_LeaveByExit12(void)
Opens the door and goes in. Reached by walking north into cell code 12; takes exit 12, to ValeBabi's entrance 11.
Used by gValeStorm_Events.
Event_LeaveByExit13
static void Event_LeaveByExit13(void)
Opens the door and goes in. Reached by walking north into cell code 13; takes exit 13, to ValeBabi's entrance 12.
Used by gValeStorm_Events.
ValeStorm_Initialize
s32 ValeStorm_Initialize(void)
Restores the fallen rocks, the river scene and the Boulder from their flags, starts the storm, and plays the scene with Dora and Kyle on the first arrival by entrance 15. Called by Field_RunScene once the actors are placed. Sets FLAG_VALE_STORM; after a battle (FLAG_KEEP_PARTY_POSITION) the two doors close again. Garet, until he joins, is shown struggling with his things.
Event_DoraSendsIsaacToThePlaza
static void Event_DoraSendsIsaacToThePlaza(void)
Dora and Kyle come out into the storm with Isaac and send him to the plaza while they go to help. "Kyle... Will they be able to stop the Boulder?" Called by ValeStorm_Initialize on arrival by entrance 15 until FLAG_VALE_STORM_SENT_TO_PLAZA is set. Sets it and FLAG_SCENE_TEMP_05, clears FLAG_SHOW_LOCATION_NAME, and removes Dora and Kyle.
Used by ValeStorm_Initialize.
Event_Rock11Falls
static void Event_Rock11Falls(void)
Walking past: rock 11 falls across the path, and Garet, once with Isaac, says they cannot get around it. Reached by stepping on cell code 41 until FLAG_VALE_STORM_FIRST_ROCK_PASSED is set, which this sets. Sets FLAG_VALE_STORM_FIRST_ROCK_FELL as the rock falls; with Garet along, before the river gathering, his first comment on any rock sets FLAG_VALE_STORM_GARET_SAW_BLOCKED_PATH.
Used by gValeStorm_Events.
ValeStorm_ApplyRock11Collision
static void ValeStorm_ApplyRock11Collision(void)
Applies the collision cells left by rock 11. Called by Event_Rock11Falls and, once the rock has fallen, by ValeStorm_Initialize.
Used by Event_Rock11Falls, ValeStorm_Initialize.
Event_Rock12Falls
static void Event_Rock12Falls(void)
Walking past: rock 12 falls down the path. Reached by stepping on cell code 42; the second rock, as Event_Rock11Falls does the first, with FLAG_VALE_STORM_SECOND_ROCK_FELL and FLAG_VALE_STORM_SECOND_ROCK_PASSED.
Used by gValeStorm_Events.
ValeStorm_ApplyRock12Collision
static void ValeStorm_ApplyRock12Collision(void)
Applies the collision cells left by rock 12. Called by Event_Rock12Falls and, once the rock has fallen, by ValeStorm_Initialize.
Used by Event_Rock12Falls, ValeStorm_Initialize.
Event_Rock13Falls
static void Event_Rock13Falls(void)
Walking past: rock 13 falls down the path. Reached by stepping on cell code 43; the third rock, as Event_Rock11Falls does the first, with FLAG_VALE_STORM_THIRD_ROCK_FELL and FLAG_VALE_STORM_THIRD_ROCK_PASSED.
Used by gValeStorm_Events.
ValeStorm_ApplyRock13Collision
static void ValeStorm_ApplyRock13Collision(void)
Applies the collision cells left by rock 13. Called by Event_Rock13Falls and, once the rock has fallen, by ValeStorm_Initialize.
Used by Event_Rock13Falls, ValeStorm_Initialize.
Event_Rock14Falls
static void Event_Rock14Falls(void)
Walking past: rock 14 falls down the path. Reached by stepping on cell code 44; the fourth rock, as Event_Rock11Falls does the first, with FLAG_VALE_STORM_FOURTH_ROCK_FELL and FLAG_VALE_STORM_FOURTH_ROCK_PASSED.
Used by gValeStorm_Events.
ValeStorm_ApplyRock14Collision
static void ValeStorm_ApplyRock14Collision(void)
Applies the collision cells left by rock 14. Called by Event_Rock14Falls and, once the rock has fallen, by ValeStorm_Initialize.
Used by Event_Rock14Falls, ValeStorm_Initialize.
ValeStorm_MeetVillagerAtExit6
static void ValeStorm_MeetVillagerAtExit6(void)
Stops the leader at exit 6 for the first villager conversation. The villager runs out of the door, knocks Isaac back and runs off to the plaza. "Huh? Isaac?" Called by Event_LeaveByExit6. Sets FLAG_VALE_STORM_BUMPED_INTO_VILLAGER.
Used by Event_LeaveByExit6.
Event_HearGaretStruggling
static void Event_HearGaretStruggling(void)
Isaac hears Garet struggling with his things. "Ugh... Hrnghhh..." Reached by stepping on cell code 30, until Garet has joined. Sets FLAG_VALE_STORM_HEARD_GARET.
Used by gValeStorm_Events.
Event_GaretCallsAfterIsaac
static void Event_GaretCallsAfterIsaac(void)
Walking away from him, Garet calls after Isaac, asking whether he will just leave him there. Reached by stepping on cell code 31 once Isaac has heard Garet and before Garet joins; ValeStorm_RunCallOutSequence brings him along.
Used by gValeStorm_Events.
Event_TalkToGaret
static void Event_TalkToGaret(void)
Talking to Garet: whether to leave his things behind, or, after the river, the Boulder. Reached by talking to Garet (actor 22): before he joins, ValeStorm_RunCallOutSequence brings him along.
Used by gValeStorm_Events.
ValeStorm_RunCallOutSequence
static void ValeStorm_RunCallOutSequence(void)
Resolves the belongings conversation and brings Garet into the party. Called by Event_GaretCallsAfterIsaac and Event_TalkToGaret. Sets FLAG_VALE_STORM_GARET_JOINED and puts Garet in the party.
Used by Event_GaretCallsAfterIsaac, Event_TalkToGaret.
Event_GaretJoinsIsaac
static void Event_GaretJoinsIsaac(void)
Garet catches up and joins Isaac. "Hey! Isaac!" Reached by stepping on cell code 32 until Garet has joined. Sets FLAG_VALE_STORM_GARET_JOINED and puts Garet in the party.
Used by gValeStorm_Events.
Event_WarnAboutMtAleph
static void Event_WarnAboutMtAleph(void)
Garet warns where the path north leads. It leads to Mt. Aleph. Reached by stepping on cell code 33, every time; Isaac is walked back south.
Used by gValeStorm_Events.
ValeStorm_GaretCommentsOnBlockedPath
static void ValeStorm_GaretCommentsOnBlockedPath(s32 x, s32 y)
Brings Garet out to discuss a blocked path, then returns him to Isaac. Called by the four rock events; x and y are the pixels where Garet stands.
Used by Event_Rock11Falls, Event_Rock12Falls, Event_Rock13Falls, Event_Rock14Falls.
Event_WatchBoulderFall
static void Event_WatchBoulderFall(void)
The Boulder falls toward Vale while the elders hold it with their Psynergy. "Ahhh! The Boulder! It's falling!"
Used by gValeStorm_Events.
Storm_SetActorFrameMode
static void Storm_SetActorFrameMode(struct FieldActor *actor, s32 mode)
Applies an animation parameter to each active entry of a single sprite.
Used by ValeStorm_FlashBoulderSceneAnimationEntries.
ValeStorm_FlashBoulderSceneAnimationEntries
UNUSED static void ValeStorm_FlashBoulderSceneAnimationEntries(void)
Alternates four actors between the normal and flashing parameters.
Event_WitnessRiverRescue
static void Event_WitnessRiverRescue(void)
At the river, Jenna cries out for her brother as the villagers try to save Felix. "Oh no! My brother!"
Used by gValeStorm_Events.
ValeStorm_RunRiverSearch
static void ValeStorm_RunRiverSearch(void)
Sends the searchers along the river and asks Isaac to help.
Used by Event_WitnessRiverRescue.
Event_TalkAboutRescuingFelix
static void Event_TalkAboutRescuingFelix(void)
A villager at the river talks of rescuing Felix.
Used by gValeStorm_Events.
Event_GatherAfterRiverRescue
static void Event_GatherAfterRiverRescue(void)
Jenna comes back to the river, and the scene ends with the Boulder sweeping down it. "Mom! Dad! We're back!"
Used by gValeStorm_Events.
ValeStorm_PlaceActor
static __inline__ void ValeStorm_PlaceActor(struct FieldActor *object, s32 horizontalPosition, s32 groundPosition)
Places an actor and its motion targets at the supplied coordinates.
Used by ValeStorm_ShowBoulderSweepingDownriver.
ValeStorm_PlayImpactBeat
static __inline__ void ValeStorm_PlayImpactBeat(s32 shakeAmplitude, s32 frames)
Shakes the scene at the impact cue and waits for the beat.
Used by ValeStorm_ShowBoulderSweepingDownriver.
ValeStorm_ShowBoulderSweepingDownriver
static void ValeStorm_ShowBoulderSweepingDownriver(void)
Follows the boulder downriver, then restores the riverbank actors.
Used by Event_GatherAfterRiverRescue.
ValeStorm_FlashLightning
static void ValeStorm_FlashLightning(void)
Flashes the scene layers before fading back to the storm palette.
Used by ValeStorm_ShowBoulderSweepingDownriver.
ValeStorm_UpdatePulsingGlow
static void ValeStorm_UpdatePulsingGlow(void)
Tracks the boulder and pulses its glow with the movement script phases.
Used by ValeStorm_ShowBoulderSweepingDownriver.
ValeStorm_FlickerGlowOffset
static void ValeStorm_FlickerGlowOffset(void)
Alternates the glow vertical offset on successive frames.
Used by ValeStorm_ShowBoulderSweepingDownriver.
Event_VillagerAsksForHelp
static void Event_VillagerAsksForHelp(void)
A villager who cannot move asks Isaac to get help. "I can't move..."
Used by gValeStorm_Events.
ValeStorm_GaretLeavesIsaac
static void ValeStorm_GaretLeavesIsaac(void)
Has Garet leave Isaac at the restored riverbank.
Used by Event_LeaveByExit2.
ValeStorm_RebuildRiverbank
static void ValeStorm_RebuildRiverbank(void)
Redraws the riverbank cells after the boulder has passed.
Used by ValeStorm_Initialize, ValeStorm_ShowBoulderSweepingDownriver.
Event_FightThirdMonster
static void Event_FightThirdMonster(void)
On the stormy night, a monster attacks on the paths (encounter 2 of table 12).
Used by gValeStorm_Events.
Event_FightFourthMonster
static void Event_FightFourthMonster(void)
On the stormy night, another monster attacks (encounter 3 of table 12).
Used by gValeStorm_Events.
ValeStorm_FlashPaletteAndSpawnEffects
static void ValeStorm_FlashPaletteAndSpawnEffects(struct FieldActor *actor)
Flashes the actor palette and emits paired effects at the shake interval.
Used by Event_WatchBoulderFall.
ValeStorm_CyclePaletteAndSpawnEffects
static void ValeStorm_CyclePaletteAndSpawnEffects(struct FieldActor *actor)
Cycles six palettes and emits paired effects at the shake interval.
Used by ValeStorm_UpdateBoulderSceneEffects.
ValeStorm_CycleObjectPalettes
static void ValeStorm_CycleObjectPalettes(struct FieldActor *actor)
Cycles six actor palettes on alternate frames.
Used by ValeStorm_CycleBoulderPalette.
ValeStorm_SpawnEffectPair
static void ValeStorm_SpawnEffectPair(struct FieldActor *parent)
Creates the two linked effects that travel in opposite vertical directions.
Used by ValeStorm_CyclePaletteAndSpawnEffects, ValeStorm_FlashPaletteAndSpawnEffects.
ValeStorm_UpdateBoulderSceneEffects
static void ValeStorm_UpdateBoulderSceneEffects(void)
Updates the four boulder scene actors until the final reaction stops.
Used by Event_WatchBoulderFall.
ValeStorm_CopyLeaderSpritePriority
static void ValeStorm_CopyLeaderSpritePriority(void)
Keeps Garet and actor 8 at the leader sprite priority.
Used by ValeStorm_GaretLeavesIsaac, ValeStorm_Initialize, ValeStorm_ShowBoulderSweepingDownriver.
Event_SearchBrokenDoor
static void Event_SearchBrokenDoor(void)
The door won't open: the impact knocked it off its hinges.
Used by gValeStorm_Events.
Also, functions without a comment: ValeStorm_GetRegions, ValeStorm_GetExits, ValeStorm_GetPlacements, ValeStorm_GetEvents, ValeStorm_CycleBoulderPalette, Event_SearchValuablesChest.
Enumerations
StormNightActor
enum StormNightActor
The placed actors, numbered in the order of gValeStorm_Placements; the elders holding back the Boulder (gValeStorm_BoulderWatchers) follow as 28 to 33.
| Value | = | |
|---|---|---|
ACTOR_EXHAUSTED_VILLAGER | ACTOR_FIRST_PLACED | Worn out from holding the Boulder: "I... I'll go!", then "It's no use. I can't move..." |
ACTOR_DORA | ||
ACTOR_KYLE | ||
ACTOR_FIRST_ROCK | Rocks 11 to 14 fall across the paths (FLAG_VALE_STORM_FIRST_ROCK_FELL on); 15 to 18 already lie there. | |
ACTOR_BOULDER | ACTOR_FIRST_PLACED + 11 | drawn at twice its size |
ACTOR_SHOVING_VILLAGER | Runs out of his house and shoves Isaac. "Huh? Isaac?" | |
ACTOR_GARETS_CHEST | The things Garet struggles to save. "If a rock hits me now, I'll lose both my chest and my life." | |
ACTOR_GARET | the young Garet's sprite, 0x13 | |
ACTOR_FELIX | in the river | |
ACTOR_JENNAS_PARENT_A | The pair at the river whom Jenna calls "Mom! Dad!". "Hang on, Felix! Help is on the way!" | |
ACTOR_JENNAS_PARENT_B | "Don't let go, Felix!" | |
ACTOR_JENNA | "Oh no! My brother!" | |
ACTOR_BOULDER_GLOW | the light around the Boulder as it rolls |
StormNightPlaceFlag
enum StormNightPlaceFlag
Vale's place flags this scene keeps while the party is in Vale.
| Value | = | |
|---|---|---|
FLAG_VALE_STORM_VILLAGER_TRIED_TO_GO | 0x305 | The villager at the river tried to go for help and could not. |
FLAG_VALE_STORM_GARET_SAW_BLOCKED_PATH | 0x30c | Garet has said once that they cannot get around a fallen rock. |
FLAG_VALE_STORM_KYLE_GREETED_ISAAC | 0x30d | Kyle has greeted Isaac at the river. "Oh, Isaac..." |
FLAG_VALE_STORM_FIRST_ROCK_PASSED | 0x310 | The party has passed each rock's spot since coming to Vale, so its event does not play again. |
FLAG_VALE_STORM_SECOND_ROCK_PASSED | 0x311 | |
FLAG_VALE_STORM_THIRD_ROCK_PASSED | 0x312 | |
FLAG_VALE_STORM_FOURTH_ROCK_PASSED | 0x313 |
Globals, without a comment: sShakeDone, sShakeShift, gValeStorm_FrameModes, gValeStorm_ActorTwentyScript, gValeStorm_ActorTwentyTwoScriptA, gValeStorm_ActorTwentyTwoScriptB, gValeStorm_ActorNineteenScript, gValeStorm_LeaderScript, gValeStorm_ActorTwentyTwoScript, gValeStorm_ActorNineScriptA, gValeStorm_ActorTwentySixScriptA, gValeStorm_ActorNineScriptB, gValeStorm_ActorTwentySixScriptB, gValeStorm_ActorNineScriptC, gValeStorm_ActorTwentySixScriptC, gValeStorm_ActorNineScriptD, gValeStorm_StormRunActions, gValeStorm_ArriveScript, gValeStorm_GatherPath8, gValeStorm_GatherPath26, gValeStorm_GatherPath0, gValeStorm_GatherPath22, gValeStorm_LookAroundScript, gValeStorm_ActorEightScript, gValeStorm_ActorNineteenRiseScript, gValeStorm_Entrances, gValeStorm_Exits, gValeStorm_Placements, gValeStorm_BoulderWatchers, gValeStorm_Events, gValeStorm_CellSteps0, gValeStorm_CellSteps1, gValeStorm_CellSteps2, gValeStorm_CellSteps3, gValeStorm_CellSteps4, gValeStorm_CellSteps5.