Skip to Content
The Alchemy Project

src/field/field_engine_requests.c

Battles and destinations a script requests, and the queued sound. More…

Included by field_engine.c.

Macros

NameDescription
#defineDJINN_ACTOR_MASK 0xffThe low bits of fdRequestDjinnBattle's flags: the Djinni's actor.

Functions

NameDescription
voidfdRequestBattleFromEncounterTable (Sint32 row, Sint32 column)Sets up a battle with the formation at row and column of the encounter table.
voidfdRequestDjinnBattle (Uint32 flags, Uint32 djinn)Sets up the battle with Djinni djinn, DJINN_PER_ELEMENT to an element; an element's last Djinni stands for the one of The Broken Seal's chosen for it (SCENE_STATE_CHOSEN_DJINN; none: nothing happens).
voidfdScriptSetAfterBattleDestination (Sint32 sceneId, Sint32 entrance)Sets the after-battle destination (MainRoutineStateWork.afterBattleScene and afterBattleEntrance), where the party goes once the coming battle is won.
voidfdScriptSetDefeatDestination (Sint32 sceneId, Sint32 entrance)Sets the defeat destination (MainRoutineStateWork.defeatScene and defeatEntrance), where the party goes if it loses the coming battle.
voidfdScriptLeaveFor (Uint16 sceneId, Uint16 entrance)Makes the script leave for entrance entrance of scene sceneId: sets MainRoutineStateWork.next and entrance and raises the exit request EXIT_KEEP_DESTINATION, so the field engine leaves on its next pass.
voidfdQueueMusic (Sint32 soundId)Plays SE_STOP_EXIT_SE, then soundId (SOUND_FADE_OUT_ACTION_SE for -1), and remembers soundId for fdPlayQueuedMusic in the field state's queuedSound; -1 is remembered as none, so it plays SOUND_FADE_OUT_ACTION_SE now and nothing later.
voidfdScriptNoOperation (void)A script that does nothing.
voidfdPlayQueuedMusic (void)Plays the sound fdQueueMusic remembered, if any.
voidfdScriptShowMessageAndOfferScoop (Sint32 msg)Shows message in a script and clears FLAG_NOTHING_HAPPENS; when someone in the party has Scoop, the field menu then opens.
voidfdActorPlaySoundInView (ACTOR *actor, Sint32 sound)Plays sound when the actor is in view: within 152 pixels across and 112 up or down the screen of the actor the camera follows.
voidfdScriptCountAnswer (void)Counts one more weird answer Felix gives (MainRoutineStateWork.weirdAnswers).

Description

Battles and destinations a script requests, and the queued sound. Part of field_engine.c.

Macros in detail

DJINN_ACTOR_MASK

#define DJINN_ACTOR_MASK 0xff

The low bits of fdRequestDjinnBattle's flags: the Djinni's actor.

Referenced by fdRequestDjinnBattle().

Definition at line 17 of file field_engine_requests.c.

Functions in detail

fdRequestBattleFromEncounterTable

void fdRequestBattleFromEncounterTable(Sint32 row, Sint32 column)

Sets up a battle with the formation at row and column of the encounter table.

References fdActorLookup(), fdEncounterGetFormationAtSlot(), fdEncounterResolveWorldMapZoneAndBackdrop(), fdEncounterSelectBattleMusic(), fdPartyGetLeaderActor() and Sint32.

Referenced by dbPsynergyTest2RaiseStatue(), dbPsynergyTest2StepIntoBattle(), dbPsynergyTestFightMadPlant(), dbPsynergyTestRaiseStatue(), dbShopTestRaiseStatue(), scAnemosInnerSanctumDullahanShadowChallenges(), scChampaCliffCavesFightAvimander(), scEasternAlhafraShipMayorArrives(), scGabombaCatacombsUncoverMadPlant(), scGaiaRockInsideChallengeSerpent(), scGaiaRockInsideCycloneMadPlant(), scIsletCaveSentinelAwaits(), scJupiterLighthouseBeaconIsLit(), scJupiterLighthouseIsaacAndIvanAreHurt(), scJupiterLighthouseJennaJoinsTheFight(), scJupiterLighthouseShebaJoinsTheFight(), scJupiterLighthouseUncoverMadPlant(), scKandoreanTempleFightChestbeaters(), scLemurianShipFightAquaHydra(), scLinkLobbyEnterBattle(), scMarsLighthouseAerieFaceDoomDragon(), scMarsLighthouseStarRoomWakeFlameDragons(), scSeaOfTimeFacePoseidon(), scShamanVillageCaveFightGladiators(), scShamanVillageCaveMeetGladiators(), scSuhallaGateFightPunchAnt(), scSuhallaGateRuffiansAmbushParty(), scSuhallaGateRuffianSpotsParty(), scTaopoSwampStartMadPlantBattle(), scTreasureIsleMeetStarMagician(), scTrialRoadChallengeMoapa(), scTrialRoadScatterWeedsHidingMadPlant(), scVenusLighthouseEntranceRuffianWaitsForBackup(), scWorldMapExplainGivingDjinn(), scWorldMapFightBanditAndThieves(), scYampiDesertCaveMeetGuardianOfFire() and scYampiDesertLandAndFightKingScorpion().

Definition at line 5 of file field_engine_requests.c.

fdRequestDjinnBattle

void fdRequestDjinnBattle(Uint32 flags, Uint32 djinn)

Sets up the battle with Djinni djinn, DJINN_PER_ELEMENT to an element; an element's last Djinni stands for the one of The Broken Seal's chosen for it (SCENE_STATE_CHOSEN_DJINN; none: nothing happens). The low 8 bits of flags are the Djinni's actor, which hops first unless DJINN_NO_HOP is set.

References fdActorLookup(), fdDjinnRunBattleStartHop(), fdEncounterGetDjinnFormation(), fdEncounterResolveWorldMapZoneAndBackdrop(), fdEncounterSelectBattleMusic(), fdPartyGetLeaderActor(), MainRoutineStateWork, SceneLocalState and Sint32.

Referenced by fdScriptRequestDjinnBattle(), scAquaRockInsideFightSteam(), scDehkanPlateauFightCannon(), scGabombaCatacombsFightMud(), scGabombaStatueFightSteel(), scGondowanCliffsFightKindle(), scIsletCaveFightMeld(), scIsletCaveFightSerac(), scJupiterLighthouseFightWhorl(), scKandoreanTempleFightFog(), scKibomboMountainsFightWaft(), scMagmaRockFightFury(), scMagmaRockInsideFightFury(), scMarsLighthouseEntranceFightBalm(), scMarsLighthouseEntranceFightFugue(), scShrineOfTheSeaGodFightBreath(), scSuhallaGateFightDew(), scTaopoSwampFightFlower(), scTreasureIsleFightGale(), scTrialRoadFightGasp() and scYampiDesertFightBlitz().

Definition at line 23 of file field_engine_requests.c.

fdScriptSetAfterBattleDestination

void fdScriptSetAfterBattleDestination(Sint32 sceneId, Sint32 entrance)

Sets the after-battle destination (MainRoutineStateWork.afterBattleScene and afterBattleEntrance), where the party goes once the coming battle is won.

References MainRoutineStateWork and Sint32.

Referenced by scChampaCliffCavesFightAvimander(), scContigoOfferLuckyDice(), scContigoOfferLuckyWheels(), scContigoOfferSuperLuckyDice(), scEasternAlhafraShipMayorArrives(), scFieldScriptSetAfterBattleDestination(), scKandoreanTempleFightChestbeaters(), scLemurianShipFightAquaHydra(), scLinkLobbyEnterBattle(), scSeaOfTimeFacePoseidon(), scSuhallaGateFightPunchAnt(), scSuhallaGateRuffianSpotsParty(), scTrialRoadChallengeMoapa() and scYampiDesertLandAndFightKingScorpion().

Definition at line 60 of file field_engine_requests.c.

fdScriptSetDefeatDestination

void fdScriptSetDefeatDestination(Sint32 sceneId, Sint32 entrance)

Sets the defeat destination (MainRoutineStateWork.defeatScene and defeatEntrance), where the party goes if it loses the coming battle.

References MainRoutineStateWork and Sint32.

Referenced by scChampaCliffCavesFightAvimander(), scGaiaRockInsideChallengeSerpent(), scJupiterLighthouseBeaconIsLit(), scJupiterLighthouseIsaacAndIvanAreHurt(), scJupiterLighthouseJennaJoinsTheFight(), scJupiterLighthouseShebaJoinsTheFight(), scLinkLobbyEnterBattle(), scShamanVillageCaveFightGladiators(), scShamanVillageCaveMeetGladiators(), scSuhallaGateFightPunchAnt(), scSuhallaGateRuffiansAmbushParty(), scSuhallaGateRuffianSpotsParty(), scTrialRoadChallengeMoapa(), scVenusLighthouseEntranceRuffianWaitsForBackup() and scWorldMapFightBanditAndThieves().

Definition at line 68 of file field_engine_requests.c.

fdScriptLeaveFor

void fdScriptLeaveFor(Uint16 sceneId, Uint16 entrance)

Makes the script leave for entrance entrance of scene sceneId: sets MainRoutineStateWork.next and entrance and raises the exit request EXIT_KEEP_DESTINATION, so the field engine leaves on its next pass.

References MainRoutineStateWork.

Referenced by scContigoOfferLuckyDice(), scContigoOfferLuckyWheels() and scContigoOfferSuperLuckyDice().

Definition at line 77 of file field_engine_requests.c.

fdQueueMusic

void fdQueueMusic(Sint32 soundId)

Plays SE_STOP_EXIT_SE, then soundId (SOUND_FADE_OUT_ACTION_SE for -1), and remembers soundId for fdPlayQueuedMusic in the field state's queuedSound; -1 is remembered as none, so it plays SOUND_FADE_OUT_ACTION_SE now and nothing later.

References Sint32 and sySoundPlayStub().

Referenced by fdGroundParticlesStart(), fdWeatherStartRain(), scApojiiIslandsDouseAquaStone(), scApojiiIslandsInitHaze(), scAquaRockInsideUpdateVents(), scInit(), scKandoreanTempleStartCurrentRoom(), scKandoreanTempleStartLiftRoom(), scKandoreanTempleWatchVents(), scSettlementsStartWaterfall(), scTaopoSwampCycleLavaRocksVents(), scTaopoSwampCycleVentsRoomVents(), scYampiDesertSetUpCavern() and scYampiDesertSetUpSandSlides().

Definition at line 89 of file field_engine_requests.c.

fdScriptNoOperation

void fdScriptNoOperation(void)

A script that does nothing.

Referenced by fdActorJumpDownLedge(), fdLeaderPushObjectAhead(), fdPsynergyEnd(), scAirsRockDropOffLedge(), scAquaRockArriveFromPassage(), scLeaderRiseFromWater(), scMagmaRockInsidePushBlockOnto(), scPushedActorAdvancePair(), scPushTargetPush() and scYampiDesertCavePushLog().

Definition at line 101 of file field_engine_requests.c.

fdPlayQueuedMusic

void fdPlayQueuedMusic(void)

Plays the sound fdQueueMusic remembered, if any.

References sySoundPlayStub().

Definition at line 106 of file field_engine_requests.c.

fdScriptShowMessageAndOfferScoop

void fdScriptShowMessageAndOfferScoop(Sint32 msg)

Shows message in a script and clears FLAG_NOTHING_HAPPENS; when someone in the party has Scoop, the field menu then opens.

References fdScriptEnd(), fdScriptEndLastingPsynergy(), fdScriptStart(), gmPartyFindOwnerWithActionStub(), mnFieldMessageShowStub(), Sint32 and syGameFlagClear().

Definition at line 121 of file field_engine_requests.c.

fdActorPlaySoundInView

void fdActorPlaySoundInView(ACTOR *actor, Sint32 sound)

Plays sound when the actor is in view: within 152 pixels across and 112 up or down the screen of the actor the camera follows.

References Sint32 and sySoundPlayStub().

Referenced by scAirsRockInsideMovePooledWhirlwind(), scAirsRockInsideMoveWhirlwind(), scAirsRockInsideStatueBreathesPooledWhirlwind(), scAirsRockInsideStatueBreathesWhirlwind(), scAirsRockMoveWhirlwind(), scAirsRockStatueBreathesWhirlwind(), scGaiaRockStatueBlowsWind(), scMagmaRockBurnStatue(), scMagmaRockInsideTrailEmbers() and scMagmaRockLeaveEmbers().

Definition at line 134 of file field_engine_requests.c.

fdScriptCountAnswer

void fdScriptCountAnswer(void)

Counts one more weird answer Felix gives (MainRoutineStateWork.weirdAnswers).

References MainRoutineStateWork.

Definition at line 150 of file field_engine_requests.c.