vale_home.c
Vale's village: its doors, the Psynergy Stone, the stormy night when the villagers send Isaac to the elders and he overhears the two surviving travelers, the villagers' farewell when the party sets out (entrance 12), and the village after the party's return from Kalay.
games/tbs/src/scene/vale_home.c on GitHub
Vale's village: its doors, the Psynergy Stone, the stormy night when the villagers send Isaac to the elders and he overhears the two surviving travelers, the villagers' farewell when the party sets out (entrance 12), and the village after the party's return from Kalay.
Functions
ValeHome_GetExits
const u32 *ValeHome_GetExits(void)
Returns the stormy night's exits while FLAG_VALE_STORM is set, else the day's.
ValeHome_GetPlacements
const struct ScenePlacement *ValeHome_GetPlacements(void)
Selects the placements: the stormy night's, the farewell's (entrance 12), after Kalay, else the day's.
Event_UsePsynergyStone
static void Event_UsePsynergyStone(void)
Searching the Psynergy Stone restores the party's PP.
Reached by searching cell code 100 in every table but the farewell's. Clears FLAG_NOTHING_HAPPENS.
Used by gValeHome_Events, gValeHome_EventsAfterKalay, gValeHome_EventsAfterLeaving, gValeHome_StormEvents.
ValeHome_GetEvents
const struct SceneEvent *ValeHome_GetEvents(void)
Selects the events: after Kalay, after the party has left, the farewell's (entrance 12), the stormy night's, else the day's.
Event_AskAboutMeditation
static void Event_AskAboutMeditation(void)
A villager asks whether Isaac meditates on the mountain each day.
Reached by talking to actor 23 on the day the story begins.
Used by gValeHome_Events.
Event_RecallThreeYearsAgo
static void Event_RecallThreeYearsAgo(void)
A villager recalls the difficult time three years ago and asks Isaac about it.
Reached by talking to actor 24 on the day the story begins.
Used by gValeHome_Events.
Event_AskAboutTheTravelers
static void Event_AskAboutTheTravelers(void)
A villager asks whether the travelers went to meet the mayor.
Reached by talking to actor 15 on the day the story begins.
Used by gValeHome_Events.
Event_DemonstratePsynergy
static void Event_DemonstratePsynergy(void)
Before the party sets out, a villager shows Isaac his Psynergy and shakes the ground; later he asks whether they worry about crossing the land so few.
Reached by talking to actor 17 on the day the story begins and after the party has left. The display adds and removes the callback ValeHome_UpdateActor17Psynergy and shakes the map for three seconds.
Used by gValeHome_Events, gValeHome_EventsAfterLeaving.
Event_AskAboutJourney
static void Event_AskAboutJourney(void)
A villager asks whether Isaac can use Psynergy, then about the Wise One, then about the journey.
Reached by talking to actor 11 on the stormy night and after the party has left, and to actor 15 after Kalay; the story state picks the question.
Used by gValeHome_EventsAfterKalay, gValeHome_EventsAfterLeaving, gValeHome_StormEvents.
Event_TalkAboutFallenStone
static void Event_TalkAboutFallenStone(void)
A villager tells how the stone fell, and the camera looks at it.
Reached by talking to actor 26 after the party has left Vale.
Used by gValeHome_EventsAfterLeaving.
Event_DemonstrateLevitation
static void Event_DemonstrateLevitation(void)
A villager with some Psynergy left lifts actor 20 into the air.
Reached by talking to actor 15 on the stormy night. Adds and removes the callbacks ValeHome_UpdateActor15Psynergy and ValeHome_UpdateActor20Psynergy.
Used by gValeHome_StormEvents.
Event_TalkAboutHelping
static void Event_TalkAboutHelping(void)
On the stormy night, a villager tells Isaac which way the others went, or, once he has been sent to the elders, to help them.
Reached by talking to actor 16 on the stormy night.
Used by gValeHome_StormEvents.
Event_WelcomeIsaacHome
static void Event_WelcomeIsaacHome(void)
Back from Kalay, a villager welcomes Isaac home; later he only says this is Vale.
Reached by talking to actor 11 after Kalay. Sets FLAG_VALE_WELCOMED_HOME.
Used by gValeHome_EventsAfterKalay.
Event_PsynergyStoneIsGone
static void Event_PsynergyStoneIsGone(void)
The villager searching the ground stops and tells Isaac the Psynergy Stone is gone.
Reached after Kalay by talking to actor 21, or by Mind Read on it until FLAG_VALE_PSYNERGY_STONE_GONE_TOLD is set; sets it and restarts the search.
Used by gValeHome_EventsAfterKalay.
Event_OpenDoorAndWalkThrough
static inline void Event_OpenDoorAndWalkThrough(s32 cellX, s32 cellZ, s32 x, s32 z)
Opens a door's map cells and sends the leader through its threshold.
Used by Event_OpenCentralEastDoor, Event_OpenCentralWestDoor, Event_OpenNorthwestDoor, Event_OpenSoutheastDoor, Event_OpenSouthwestDoor, Event_OpenWestEdgeDoor.
Event_OpenNortheastDoor
static void Event_OpenNortheastDoor(void)
Opens the northeast doorway in two stages and walks inside.
Reached by walking north into cell code 2 after Kalay; the other tables have no door 2.
Used by gValeHome_EventsAfterKalay.
Event_OpenCentralWestDoor
static void Event_OpenCentralWestDoor(void)
Enters through the western door in the village's middle row.
Used by gValeHome_Events, gValeHome_EventsAfterKalay, gValeHome_EventsAfterLeaving, gValeHome_StormEvents.
Event_OpenCentralEastDoor
static void Event_OpenCentralEastDoor(void)
Enters through the eastern door in the village's middle row.
Used by gValeHome_Events, gValeHome_EventsAfterKalay, gValeHome_EventsAfterLeaving, gValeHome_StormEvents.
Event_LeaveThroughWestPassage
static void Event_LeaveThroughWestPassage(void)
Leaves by the west passage: stepping on cell code 9 on the stormy night takes exit 8.
Used by gValeHome_StormEvents.
Event_LeaveThroughSouthPassage
static void Event_LeaveThroughSouthPassage(void)
Leaves by the south passage once the party has begun its journey.
Reached by stepping on cell code 8; takes exit 10 once FLAG_PARTY_LEFT_VALE is set, else does nothing.
Used by gValeHome_Events, gValeHome_EventsAfterKalay, gValeHome_EventsAfterLeaving.
Event_ClearFirstWhirlwindTarget
static void Event_ClearFirstWhirlwindTarget(void)
Whirlwind clears the first target (actor 8).
Reached by Whirlwind on actor 8 by day, until it is cleared; sets FLAG_VALE_FIRST_WHIRLWIND_TARGET_CLEARED.
Used by gValeHome_Events, gValeHome_EventsAfterKalay, gValeHome_EventsAfterLeaving.
Event_ClearSecondWhirlwindTarget
static void Event_ClearSecondWhirlwindTarget(void)
Whirlwind clears the second target (actor 9).
Reached by Whirlwind on actor 9 by day, until it is cleared; sets FLAG_VALE_SECOND_WHIRLWIND_TARGET_CLEARED.
Used by gValeHome_Events, gValeHome_EventsAfterKalay, gValeHome_EventsAfterLeaving.
Event_ClearThirdWhirlwindTarget
static void Event_ClearThirdWhirlwindTarget(void)
Whirlwind clears the third target (actor 10).
Reached by Whirlwind on actor 10 by day, until it is cleared; sets FLAG_VALE_THIRD_WHIRLWIND_TARGET_CLEARED.
Used by gValeHome_Events, gValeHome_EventsAfterKalay, gValeHome_EventsAfterLeaving.
ValeHome_Initialize
s32 ValeHome_Initialize(void)
Arriving: hide the cleared Whirlwind targets, run entrances 97 to 99 (the return from the travelers' battle and two debug presets), and set up the storm, the farewell or the village after Kalay.
The scene's initialize entry. Entrance 98 sets FLAG_CHILDHOOD and takes exit 50; entrance 12 runs Event_DepartForQuest; entrance 19 (and 97) Event_TravelersLeaveAfterBattle; on the stormy night, once Garet has left Isaac (FLAG_VALE_STORM_GARET_LEFT), Event_MeetSurvivingTravelers. Once Isaac has been sent to the elders, it removes the villagers who sent him.
ValeHome_RejoinParty
static inline void ValeHome_RejoinParty(s32 actorId)
Walks a separate scene actor back to the leader, then hides it.
Used by Event_SentToAidElders.
Event_SentToAidElders
static void Event_SentToAidElders(void)
On the stormy night, villagers send Isaac and his companion to aid the elders holding back the Boulder. "Go aid the elders!"
Reached by stepping on cell code 20 on the stormy night, until FLAG_VALE_STORM_SENT_TO_AID_ELDERS is set; sets it.
Used by gValeHome_StormEvents.
Event_MeetSurvivingTravelers
static void Event_MeetSurvivingTravelers(void)
On the stormy night, Isaac overhears the two travelers who survived Sol Sanctum. "Only the two of us survived..."
Called by ValeHome_Initialize on the stormy night once FLAG_VALE_STORM_GARET_LEFT is set; goes on into ValeHome_FightTravelers.
Used by ValeHome_Initialize.
ValeHome_FightTravelers
static void ValeHome_FightTravelers(void)
The travelers catch Isaac eavesdropping and fight; win or lose, the party returns by entrance 19. "You must forget everything you heard."
Called by Event_MeetSurvivingTravelers. Starts encounter 4 of table 12 with both outcomes leading back to this scene's entrance 19, and sets FLAG_KEEP_MUSIC.
Used by Event_MeetSurvivingTravelers.
Event_TravelersLeaveAfterBattle
static void Event_TravelersLeaveAfterBattle(void)
After the battle the travelers leave Isaac and his companion lying in the storm, and the storm ends.
Called by ValeHome_Initialize from entrance 19, after the battle, or 97. Clears FLAG_VALE_STORM and takes exit 9.
Used by ValeHome_Initialize.
Event_DepartForQuest
static void Event_DepartForQuest(void)
The villagers give their supplies and farewells before the party leaves Vale.
Called by ValeHome_Initialize from entrance 12. Restores the party's HP and PP, gives a Herb and the Catch Beads (from Dora), and takes exit 10.
Used by ValeHome_Initialize.
ValeHome_FlashPsynergyPalette
static void ValeHome_FlashPsynergyPalette(struct FieldActor *actor)
Flashes the caster's palette and emits paired effects every sixteen frames.
Used by Event_DemonstrateLevitation, Event_DemonstratePsynergy.
ValeHome_CyclePsynergyPaletteAndSpawnEffects
static void ValeHome_CyclePsynergyPaletteAndSpawnEffects(struct FieldActor *actor)
Cycles six palette banks and emits the caster's paired effects.
Used by ValeHome_UpdateActor15Psynergy, ValeHome_UpdateActor17Psynergy.
ValeHome_CyclePsynergyPalette
static void ValeHome_CyclePsynergyPalette(struct FieldActor *actor)
Cycles the levitated actor through six palette banks.
Used by ValeHome_UpdateActor20Psynergy.
ValeHome_SpawnEffectPair
static void ValeHome_SpawnEffectPair(struct FieldActor *parent)
Creates the two vertical Psynergy effects using the shared sprite tiles.
Used by ValeHome_CyclePsynergyPaletteAndSpawnEffects, ValeHome_FlashPsynergyPalette.
ValeHome_UpdateActor15Psynergy
static void ValeHome_UpdateActor15Psynergy(void)
Updates the levitating villager's Psynergy display.
A callback Event_DemonstrateLevitation adds while the villager lifts.
Used by Event_DemonstrateLevitation.
ValeHome_UpdateActor17Psynergy
static void ValeHome_UpdateActor17Psynergy(void)
Updates the demonstrating villager's Psynergy display.
A callback Event_DemonstratePsynergy adds while the ground shakes.
Used by Event_DemonstratePsynergy.
ValeHome_UpdateActor20Psynergy
static void ValeHome_UpdateActor20Psynergy(void)
Updates the palette of the levitated actor.
A callback Event_DemonstrateLevitation adds while actor 20 rises.
Used by Event_DemonstrateLevitation.
ValeHome_SetProgressFlagsAndExit
static void ValeHome_SetProgressFlagsAndExit(void)
Arriving by entrance 99, a debug entrance: sets a preset of story flags, which differs by edition, and leaves by exit 40.
Called by ValeHome_Initialize from entrance 99. Sets FLAG_NO_ENCOUNTERS and flag 0x16d; from the third patch the whole story up to Kalay, before it FLAG_TRET_DEFEATED and FLAG_KOLIMA_CURSE_LIFTED.
Used by ValeHome_Initialize.
Also, functions without a comment: ValeHome_TurnAndWaitValue, ValeHome_GetEntrances, ValeHome_GetRegions, Event_OpenNorthwestDoor, Event_OpenSouthwestDoor, Event_OpenWestEdgeDoor, Event_OpenSoutheastDoor, Event_SayThenWait, ValeHome_FaceDirectionAndWait.
Enumerations
ValeHomeActor
enum ValeHomeActor
| Value | = | |
|---|---|---|
ACTOR_FIRST_TRAVELER | 23 | The two travelers who survived Sol Sanctum, Saturos and Menardi by their sprites (0x20 and 0x21, as in vale_kraden.c). "Only the two of us survived..." |
ACTOR_SECOND_TRAVELER | 24 | |
ACTOR_STORM_GARET | 25 | Garet as a child, who follows Isaac through the night. "Isaac! Wait!" |
Macros
FLAG_VALE_WELCOMED_HOME
#define FLAG_VALE_WELCOMED_HOME 0x302
Back from Kalay, a villager has welcomed Isaac home.
Used by Event_WelcomeIsaacHome.
FLAG_VALE_PSYNERGY_STONE_GONE_TOLD
#define FLAG_VALE_PSYNERGY_STONE_GONE_TOLD 0x306
Back from Kalay, the villager searching for the Psynergy Stone has told Isaac it is gone.
Used by Event_PsynergyStoneIsGone, gValeHome_EventsAfterKalay.
Also, macros without a comment: VALE_HOME_TURN_AND_WAIT, VALE_HOME_TURN_AND_WAIT.
Globals, without a comment: gValeHome_Actor22ActionsHead, gValeHome_Actor22Actions, gValeHome_Actor24Actions, gValeHome_Actor23Actions, gValeHome_LeaderActions, gValeHome_Actor25Actions, gValeHome_Actor23BounceActions, gValeHome_Actor24BounceActions, gValeHome_FaceTargetActions, gValeHome_Actor30Actions, gValeHome_Actor31Actions, gValeHome_Actor11Actions, gValeHome_Actor12Actions, gValeHome_Actor0And1Actions, gValeHome_Actor21Actions, gValeHome_Actor17Actions, gValeHome_LeaderStepActions, gValeHome_Actor25StepActions, gValeHome_Entrances, gValeHome_Exits, gValeHome_StormExits, gValeHome_Placements, gValeHome_StormPlacements, gValeHome_DeparturePlacements, gValeHome_PlacementsAfterKalay, gValeHome_Events, gValeHome_StormEvents, gValeHome_DepartureEvents, gValeHome_EventsAfterLeaving, gValeHome_EventsAfterKalay, gValeHome_DoorOpens.