requests.c
Battles and destinations an event requests, and the queued sound.
games/tbs/src/object/psynergy_effects/requests.c on GitHub
Battles and destinations an event requests, and the queued sound. Part of psynergy_effects.c, compiled only through it.
Functions
Field_RequestBattleFromEncounterTable
void Field_RequestBattleFromEncounterTable(s32 zoneNo, s32 slotNo)
Sets up a battle with enemy group slot of encounter table zone. On the world map (mode 3) the terrain under the leader picks the battle backdrop. Sets the field work's battle request, which the scene loop then handles, and the battle cue; zone 98's first slot also sets gGameState.special to the Aerie's storm backdrop. About 35 scenes reach it through Field_RequestBattleFromEncounterTableFar, and the lobby calls it directly. The battle starts only once the event that asked for it has returned.
Used by Event_ConfrontSaturosAndMenardi, Event_DouseStorm, Event_DouseTravelMarker, Event_EnterGuardedRoom, Event_FightFinalGuards, Event_FightFirstMonster, Event_FightFourthMonster, Event_FightSecondMonster, Event_FightThirdMonster, Event_FightTret, Event_FreeRooferAndConfrontThieves, Event_ReachArena, FallIntoPit, FightSandMonster, MercuryLighthouseAerie_ConfrontSaturos, MogallForest_FirstArea_ApeAttacks, MogallForest_KillerApeAttacks, MogallForest_ThirdArea_ApeAttacks, TolbiShipDeck_JumpIntoKrakenBattle, TolbiShipInteriors_FightMonstersInHold, ValeHome_FightTravelers, VaultInteriors_ConfrontThievesAgain, VenusLighthouseAerie_CombineSaturosAndMenardi, WorldMap_ShowDjinnTutorial.
Field_RequestDjinnBattle
void Field_RequestDjinnBattle(s32 flag, s32 no)
Sets up the battle with Djinni number no. The low 8 bits of flag are the
Djinni's actor, which hops first unless DJINN_NO_HOP is set. Djinn are
numbered 20 to an element (Djinn_ResolvePendingEvent). Sets
gGameState.pendingDjinnEvent and the field work's battle request; when
the scene is entered again after the battle, Djinn_ResolvePendingEvent
reads the pending event to make the Djinni join or hide it. About 20
scenes reach it through Field_RequestDjinnBattleFar.
Used by AltinPeak_TalkToDjinni, AltmillerCave_StartDjinnBattle, BabiLighthouse_StartDjinnBattle, Event_FightDjinni, Event_FightForge, Event_MeetCorona, Event_MeetHail, Event_MeetVine, Event_TalkToBreeze, Fuchin_StartDjinnBattle, MercuryLighthouse_StartDjinnBattle, MogallForest_StartDjinnBattle.
Event_SetNextDestination
void Event_SetNextDestination(s32 scene, s32 entrance)
Sets the scene and entrance that the field goes to next (gGameState.nextScene and nextEntrance). About 30 scenes and the lobby reach it through Event_SetNextDestinationFar.
Used by Event_ConfrontSaturosAndMenardi, Event_EnterGuardedRoom, Event_FightFinalGuards, Event_FightTret, Event_FreeRooferAndConfrontThieves, Event_ReachArena, FightSandMonster, MercuryLighthouseAerie_ConfrontSaturos, MogallForest_KillerApeAttacks, TolbiShipDeck_JumpIntoKrakenBattle, TolbiShipInteriors_FightMonstersInHold, TolbiSpring_OfferLuckyDice, TolbiSpring_OfferLuckyWheels, ValeHome_FightTravelers, VaultInteriors_ConfrontThievesAgain, VenusLighthouseAerie_CombineSaturosAndMenardi.
Event_SetDefeatDestination
void Event_SetDefeatDestination(s32 scene, s32 entrance)
Sets where the party wakes up after losing a battle (gGameState.defeatScene and defeatEntrance). The scenes before scripted battles (Colosso, the Vault, Vale, the Aerie) and the lobby reach it through Event_SetDefeatDestinationFar.
Used by Event_ConfrontSaturosAndMenardi, Event_FreeRooferAndConfrontThieves, Event_ReachArena, ValeHome_FightTravelers, VaultInteriors_ConfrontThievesAgain, VenusLighthouseAerie_CombineSaturosAndMenardi.
Event_RequestDestination
void Event_RequestDestination(u16 scene, u16 entrance)
Makes the event leave for entrance entrance of scene scene: sets gGameState.scene and entrance and raises the exit request EXIT_NONE (999), so the scene loop leaves on its next pass. Only Tolbi's spring reaches it, through Event_RequestDestinationFar.
Used by TolbiSpring_OfferLuckyDice, TolbiSpring_OfferLuckyWheels.
BattleFx_SetQueuedSoundAndPlay
void BattleFx_SetQueuedSoundAndPlay(s32 soundId)
Plays SE_298, then soundId (SE_289 for -1), and remembers soundId for BattleFx_PlayQueuedSound in the field work's queuedSound; -1 is remembered as none, so it plays SE_289 now and nothing later. About 30 scenes reach it through the far alias, and the ground particles (weather.c) queue SE_170 with it.
Used by FieldFx_StartGroundParticles, Kalay_PrepareTunnel, Kalay_StartWindowTransition, LamakanDesert_Initialize, Scene_Initialize, Scene_RunEntrySetup, SolSanctumEntrance_RestoreInteriorState, SolSanctumLunaSolRooms_Initialize, SolSanctumLunaSolRooms_ShowFloatingEye, SolSanctumStatue_Initialize, ValeStorm_Initialize, VenusLighthouse_AnimateEastTileWave, VenusLighthouse_AnimatePairedTileWaves, VenusLighthouse_AnimateWestTileWave, Village_ApplyWaterLevel, Village_ScareOffBeast.
BattleFx_PlayQueuedSound
void BattleFx_PlayQueuedSound(void)
Plays the sound BattleFx_SetQueuedSoundAndPlay remembered, if any. Called by scenes, by the event runner (object/events.c), by setup.c and by an actor's landing (actor_commands.c).
Used by Actor_JumpDownLedge, BattleEffect_CleanupSceneObjects, Event_DoraSendsIsaacToThePlaza, Event_IvanRejoins, Event_PushWestPillar, Event_Rock11Falls, Event_Rock12Falls, Event_Rock13Falls, Event_Rock14Falls, Event_WatchBoulderFall, Event_WitnessRiverRescue, Field_SearchTile, Kalay_PushTunnelBlock, MercuryLighthouse_ArriveWithSparks, StagedActor_AdvancePair, ValeStorm_MeetVillagerAtExit6, ValeStorm_RunRiverSearch, ValeStorm_ShowBoulderSweepingDownriver, VenusLighthouse_ArriveThroughSparkPassage, VenusLighthouse_LandWithRadialDust, VenusLighthouse_PushAdjacentBlock.
Macros
AERIE
#define AERIE 98
The zone of the scripted battles (Suhalla Desert, Lunpa Fortress, the Aerie, the world map); its slot 0 is the Aerie's second battle.