Alchemy

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.

Line 123

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).

Line 142

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.

Line 159

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.

Line 166

ValeStorm_OpenBackdropExit11

UNUSED static void ValeStorm_OpenBackdropExit11(void)

Opens a door and takes exit 11, to ValeInteriors' entrance 1. No event row names it.

Line 175

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.

Line 186

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.

Line 193

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.

Line 200

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.

Line 208

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.

Line 220

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.

Line 234

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.

Line 253

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.

Line 266

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.

Line 277

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.

Line 288

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.

Line 299

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.

Line 310

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.

Line 324

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.

Line 543

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.

Line 651

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.

Line 716

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.

Line 728

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.

Line 789

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.

Line 804

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.

Line 864

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.

Line 875

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.

Line 932

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.

Line 944

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.

Line 978

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.

Line 1000

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.

Line 1016

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.

Line 1038

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.

Line 1081

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.

Line 1131

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.

Line 1167

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.

Line 1201

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.

Line 1377

ValeStorm_FlashBoulderSceneAnimationEntries

UNUSED static void ValeStorm_FlashBoulderSceneAnimationEntries(void)

Alternates four actors between the normal and flashing parameters.

Line 1404

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.

Line 1420

ValeStorm_RunRiverSearch

static void ValeStorm_RunRiverSearch(void)

Sends the searchers along the river and asks Isaac to help.

Used by Event_WitnessRiverRescue.

Line 1662

Event_TalkAboutRescuingFelix

static void Event_TalkAboutRescuingFelix(void)

A villager at the river talks of rescuing Felix.

Used by gValeStorm_Events.

Line 1803

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.

Line 1840

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.

Line 1954

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.

Line 1966

ValeStorm_ShowBoulderSweepingDownriver

static void ValeStorm_ShowBoulderSweepingDownriver(void)

Follows the boulder downriver, then restores the riverbank actors.

Used by Event_GatherAfterRiverRescue.

Line 1974

ValeStorm_FlashLightning

static void ValeStorm_FlashLightning(void)

Flashes the scene layers before fading back to the storm palette.

Used by ValeStorm_ShowBoulderSweepingDownriver.

Line 2319

ValeStorm_UpdatePulsingGlow

static void ValeStorm_UpdatePulsingGlow(void)

Tracks the boulder and pulses its glow with the movement script phases.

Used by ValeStorm_ShowBoulderSweepingDownriver.

Line 2345

ValeStorm_FlickerGlowOffset

static void ValeStorm_FlickerGlowOffset(void)

Alternates the glow vertical offset on successive frames.

Used by ValeStorm_ShowBoulderSweepingDownriver.

Line 2402

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.

Line 2415

ValeStorm_GaretLeavesIsaac

static void ValeStorm_GaretLeavesIsaac(void)

Has Garet leave Isaac at the restored riverbank.

Used by Event_LeaveByExit2.

Line 2477

ValeStorm_RebuildRiverbank

static void ValeStorm_RebuildRiverbank(void)

Redraws the riverbank cells after the boulder has passed.

Used by ValeStorm_Initialize, ValeStorm_ShowBoulderSweepingDownriver.

Line 2510

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.

Line 2531

Event_FightFourthMonster

static void Event_FightFourthMonster(void)

On the stormy night, another monster attacks (encounter 3 of table 12).

Used by gValeStorm_Events.

Line 2545

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.

Line 2559

ValeStorm_CyclePaletteAndSpawnEffects

static void ValeStorm_CyclePaletteAndSpawnEffects(struct FieldActor *actor)

Cycles six palettes and emits paired effects at the shake interval.

Used by ValeStorm_UpdateBoulderSceneEffects.

Line 2578

ValeStorm_CycleObjectPalettes

static void ValeStorm_CycleObjectPalettes(struct FieldActor *actor)

Cycles six actor palettes on alternate frames.

Used by ValeStorm_CycleBoulderPalette.

Line 2594

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.

Line 2607

ValeStorm_UpdateBoulderSceneEffects

static void ValeStorm_UpdateBoulderSceneEffects(void)

Updates the four boulder scene actors until the final reaction stops.

Used by Event_WatchBoulderFall.

Line 2660

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.

Line 2674

Event_SearchBrokenDoor

static void Event_SearchBrokenDoor(void)

The door won't open: the impact knocked it off its hinges.

Used by gValeStorm_Events.

Line 2695

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_VILLAGERACTOR_FIRST_PLACEDWorn out from holding the Boulder: "I... I'll go!", then "It's no use. I can't move..."
ACTOR_DORA
ACTOR_KYLE
ACTOR_FIRST_ROCKRocks 11 to 14 fall across the paths (FLAG_VALE_STORM_FIRST_ROCK_FELL on); 15 to 18 already lie there.
ACTOR_BOULDERACTOR_FIRST_PLACED + 11drawn at twice its size
ACTOR_SHOVING_VILLAGERRuns out of his house and shoves Isaac. "Huh? Isaac?"
ACTOR_GARETS_CHESTThe things Garet struggles to save. "If a rock hits me now, I'll lose both my chest and my life."
ACTOR_GARETthe young Garet's sprite, 0x13
ACTOR_FELIXin the river
ACTOR_JENNAS_PARENT_AThe 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_GLOWthe light around the Boulder as it rolls

Line 70

StormNightPlaceFlag

enum StormNightPlaceFlag

Vale's place flags this scene keeps while the party is in Vale.

Value=
FLAG_VALE_STORM_VILLAGER_TRIED_TO_GO0x305The villager at the river tried to go for help and could not.
FLAG_VALE_STORM_GARET_SAW_BLOCKED_PATH0x30cGaret has said once that they cannot get around a fallen rock.
FLAG_VALE_STORM_KYLE_GREETED_ISAAC0x30dKyle has greeted Isaac at the river. "Oh, Isaac..."
FLAG_VALE_STORM_FIRST_ROCK_PASSED0x310The party has passed each rock's spot since coming to Vale, so its event does not play again.
FLAG_VALE_STORM_SECOND_ROCK_PASSED0x311
FLAG_VALE_STORM_THIRD_ROCK_PASSED0x312
FLAG_VALE_STORM_FOURTH_ROCK_PASSED0x313

Line 96

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.

On this page

FunctionsValeStorm_RerollHeadingOnCountdownValeStorm_GetEntrancesEvent_SetPathCellOverrideEvent_ClearPathCellOverrideValeStorm_OpenBackdropExit11Event_LeaveByExit1Event_LeaveByExit3Event_LeaveByExit4Event_LeaveByExit2Event_LeaveByExit5Event_LeaveByExit6Event_LeaveByExit7Event_LeaveByExit8Event_LeaveByExit9Event_LeaveByExit10Event_LeaveByExit12Event_LeaveByExit13ValeStorm_InitializeEvent_DoraSendsIsaacToThePlazaEvent_Rock11FallsValeStorm_ApplyRock11CollisionEvent_Rock12FallsValeStorm_ApplyRock12CollisionEvent_Rock13FallsValeStorm_ApplyRock13CollisionEvent_Rock14FallsValeStorm_ApplyRock14CollisionValeStorm_MeetVillagerAtExit6Event_HearGaretStrugglingEvent_GaretCallsAfterIsaacEvent_TalkToGaretValeStorm_RunCallOutSequenceEvent_GaretJoinsIsaacEvent_WarnAboutMtAlephValeStorm_GaretCommentsOnBlockedPathEvent_WatchBoulderFallStorm_SetActorFrameModeValeStorm_FlashBoulderSceneAnimationEntriesEvent_WitnessRiverRescueValeStorm_RunRiverSearchEvent_TalkAboutRescuingFelixEvent_GatherAfterRiverRescueValeStorm_PlaceActorValeStorm_PlayImpactBeatValeStorm_ShowBoulderSweepingDownriverValeStorm_FlashLightningValeStorm_UpdatePulsingGlowValeStorm_FlickerGlowOffsetEvent_VillagerAsksForHelpValeStorm_GaretLeavesIsaacValeStorm_RebuildRiverbankEvent_FightThirdMonsterEvent_FightFourthMonsterValeStorm_FlashPaletteAndSpawnEffectsValeStorm_CyclePaletteAndSpawnEffectsValeStorm_CycleObjectPalettesValeStorm_SpawnEffectPairValeStorm_UpdateBoulderSceneEffectsValeStorm_CopyLeaderSpritePriorityEvent_SearchBrokenDoorEnumerationsStormNightActorStormNightPlaceFlag