Alchemy

events.c

Event commands: waits, received items, questions and destinations.

games/tbs/src/object/psynergy_effects/events.c on GitHub

Event commands: waits, received items, questions and destinations. Part of psynergy_effects.c, compiled only through it.

Functions

ItemGift_ShowGotItem

static inline void ItemGift_ShowGotItem(s32 item, s32 flags)

Shows the message for an item the party has just received. The message is Isaac got <item>.; the German release has its own sentence for the Black Orb. flags are the message window flags of UiText_ShowPositionedMessageAndWait.

Used by PartyInventory_GiveItem.

Line 27

Event_UpdateDebugSkip

void Event_UpdateDebugSkip(void)

Debug only: while debug mode is on, R makes every event wait (FieldEvent_WaitFrames) end at once and L restores normal waits. Runs as a scheduler callback for the length of an event (FieldEvent_Begin). R also skips the actors' messages, which open nothing while fastForward is set (UiText_OpenMessageAtObject).

Used by FieldEvent_Begin, FieldEvent_End.

Line 43

FieldEvent_WaitFrames

void FieldEvent_WaitFrames(s32 frames)

The event command "wait": waits the requested frames, unless debug fast forward (Event_UpdateDebugSkip) is on. Scene scripts reach it as Engine_EventWait (the WAIT command); this object's actor, message, camera and climbing commands wait through it too.

Used by BattlePres_RunActionThenWaitIfModeZero, Camera_WaitForArrival, Field_ClimbDown, Field_ClimbUp, Field_SearchTile, ObjectMotion_ArmCallback, ObjectMotion_Launch, ObjectMotion_SetAngleToward, Object_LinkPair.

Line 60

Leader_StopMoving

void Leader_StopMoving(void)

Stops the leader where it stands: no horizontal velocity, the normal walking speed (1.0) and acceleration (0.5), no destination, and the standing pose, or the climbing pose (12) while the leader is on a climbable wall. Called by FieldEvent_Begin, by Field_RunScene before it handles several requests, by Field_UsePsynergy, Scene_TalkToActor, Field_CheckExitRegions and the world map's zoom (BattleFx_RunVisibilityTransition).

Used by BattleFx_RunVisibilityTransition, Event_GaretRefusesToLeave, FieldEvent_Begin, Field_CheckExitRegions, Field_RunScene, Field_SearchTile, Field_UsePsynergy, Scene_TalkToActor.

Line 72

FieldEvent_Begin

void FieldEvent_Begin(void)

The event command "begin event": closes any timed notice, stops the leader, resets the message and timing state, and starts the debug fast-forward callback with the leader as the message speaker. Scene scripts reach it as Engine_EventBegin (EV_BEGIN); the field's item, Psynergy, Djinni, Retreat and climbing events open with it too. Clears the field work's name window, fastForward and messageWindow, sets transitionFrames to 16 and the speaker to the leader.

Used by Djinn_JoinParty, Djinn_RunBattleStartHop, FieldFx_RunRetreat, Field_ClimbDown, Field_ClimbUp, Field_RunEventAction, Field_SearchTile, Field_TryJumpForward, Field_UseItem, Scene_RunRaisedEvent, Scene_RunTouchOrExit, Scene_TalkToActor.

Line 96

FieldEvent_End

void FieldEvent_End(void)

Ends an event: stops the debug fast-forward callback, gives the camera back to the leader and refreshes FLAG_LURE_CAP (GameFlag_RefreshLureCap). Scene scripts reach it as Engine_EventEnd (EV_END), and every event that opens with FieldEvent_Begin closes with it.

Used by Djinn_JoinParty, Djinn_RunBattleStartHop, Field_ClimbDown, Field_ClimbUp, Field_RunEventAction, Field_SearchTile, Field_TryJumpForward, Field_UseItem, Scene_RunRaisedEvent, Scene_RunTouchOrExit, Scene_TalkToActor.

Line 125

Event_NoOpHookA

UNUSED void Event_NoOpHookA(void)

Nothing calls it.

Line 132

Event_NoOpHook

void Event_NoOpHook(void)

An empty hook; it does nothing in the released game. Only Event_RunObjectHookAndWait calls it.

Used by Event_RunObjectHookAndWait.

Line 136

Event_RunObjectHookAndWait

void Event_RunObjectHookAndWait(struct ScenePlacement *table)

Respawns the scene's actors from a placement table and waits one frame for them to appear. Reached only through an unnamed veneer in the object bank's far-call table; nothing in ☀️ names it.

Line 141

Event_CallWithLastActiveObjectId

void Event_CallWithLastActiveObjectId(struct ScenePlacement *table)

Spawns the actors of a placement table after the last actor in use. Called by the Kolima, Kalay and Tolbi ship scene scripts to bring actors in during a scene.

Used by Event_WatchBoulderFall, Kalay_WatchTourGroupDeparture, Kolima_Initialize, TolbiShipDeck_ArriveAtTolbi, TolbiShipDeck_DepartWithParty, TolbiShipDeck_JumpIntoKrakenBattle, TolbiShipDeck_MonsterLandsOnDeck, TolbiShipDeck_MonstersAttackCrew, TolbiShipDeck_MonstersBoard, TolbiShipDeck_ReturnFromIsland, TolbiShipDeck_SetUpAfterKraken, TolbiShipDeck_SetUpAtAnchor, TolbiShipDeck_SetUpUnderSail, TolbiShipDeck_SightLand, TolbiShipDeck_SightSeaMonsters, TolbiShipDeck_ThankForKraken, TolbiShipInteriors_RunSceneCommand, TolbiShipMast_AnnounceLand, TolbiShipMast_RunAvastScene, TolbiShipMast_RunLandingSequence, TolbiShipMast_ShowMonsters.

Line 153

Event_SetSceneEvents

void Event_SetSceneEvents(const struct SceneEvent *events)

Sets the scene's event table, which the field checks as the leader moves: writes work->events. Altin Peak's scene script calls it as Event_LoadAreaScript.

Line 160

Event_PrepareObjectAndApplyValue

void Event_PrepareObjectAndApplyValue(s32 unit, s32 announce)

Adds unit to the party. With announce nonzero it also shows <name> joined your party. (Party_ShowJoinedMessage, which receives announce too). Called by six scene scripts as a character joins (Vale, the Vault, Goma Cave and Mercury Lighthouse among them).

Used by Event_GaretJoinsIsaac, Event_IvanRejoins, Event_MeetSurvivingTravelers, ValeStorm_RunCallOutSequence, VaultInteriors_IvanJoinsRodSearch.

Line 170

Event_PrepareTwoObjectsAndApply

void Event_PrepareTwoObjectsAndApply(s32 first, s32 second)

Adds two units to the party and announces them together. Vale's scene script calls it twice, as Engine_PartyAddMembers.

Line 180

Event_ValidatePackedId

s32 Event_ValidatePackedId(u32 shortcut)

Checks an L or R button shortcut, packed as the member in bits 10 to 13 and the Psynergy in bits 0 to 9. Returns 0 if it can still be cast, -1 for no such party member, -2 when that member is not in the party and -3 when the member no longer knows the Psynergy. Only Event_ClearInvalidPackedValues calls it.

Used by Event_ClearInvalidPackedValues.

Line 191

Event_ClearInvalidPackedValues

void Event_ClearInvalidPackedValues(void)

Clears each button shortcut whose Psynergy can no longer be cast: zeroes gGameState.firstShortcut or secondShortcut. Called whenever the party or what it knows may have changed: by Party_RemoveOwnerRestored, Inventory_Discard, and the field menu's item, Psynergy and Djinn screens.

Used by Field_ProcessStep, Party_RemoveOwnerRestored.

Line 209

Party_RemoveOwnerRestored

void Party_RemoveOwnerRestored(s32 unit)

Takes unit out of the party, fully restoring its HP and PP and curing its poison. If no member left standing has HP, the leader is given 1 HP so the party is never left all down. Called by the scene scripts where a member leaves: Vale in the storm, the Vault, and Sol Sanctum.

Used by SolSanctumElementalStarRoom_EnterStarRoom, SolSanctumEruption_PlayHostageScene, ValeStorm_ShowBoulderSweepingDownriver, VaultInteriors_ReturnStolenGoods.

Line 220

Party_CheckItemLimit

s32 Party_CheckItemLimit(s32 item)

Checks whether the party can carry one more of item: each member carries at most 30 of one item. When they are all full, says Isaac's party cannot carry any more <item>s... and Isaac threw the <item> as far away as possible. and returns -1; otherwise returns 0. Field_RunScene calls it before it gives gGameState.pendingItem with PartyInventory_GiveItem.

Used by Field_RunScene.

Line 254

PartyInventory_GiveItem

s32 PartyInventory_GiveItem(s32 item, s32 unused)

The event command "give item": gives item to the first party member with room for it and says so. When every bag is full, the player picks an item to drop to make room, or drops the new item instead (not allowed for an indispensable one). Returns the member who received the item, or -1 when it was left behind. Scene scripts reach it as Engine_PartyGiveItem (about 24 of them); Field_RunScene gives the pending item and the debug test menu gives items through it. The field work's message is restored afterwards.

Used by DebugMenu_GiveItemToParty, Field_RunScene.

Line 281

Inventory_TryAddAndReturnOwner

s32 Inventory_TryAddAndReturnOwner(s32 item, s32 unused, s32 unit)

Gives item to one party member. Returns unit, or -1 if its bag is full. Reached only through an unnamed veneer in the object bank's far-call table; nothing in ☀️ names it.

Line 382

Inventory_NoOpCallback

void Inventory_NoOpCallback(void)

An empty function; nothing in ☀️ calls it.

Line 389

Inventory_ReservedNoOp

void Inventory_ReservedNoOp(void)

An empty function; nothing in ☀️ calls it.

Line 392

Actor_WaitForAnimationEnd

void Actor_WaitForAnimationEnd(s32 actor, s32 animation)

Waits, at most 90 frames, for an actor's animation to stop being animation: the actor has finished a one-off animation such as a nod. Only actors drawn as an animation object (animationKind 1) are waited for. Called by Event_AskYesNoWithActorAnimation.

Used by Event_AskYesNoWithActorAnimation.

Line 398

Event_AskYesNoWithActorAnimation

s32 Event_AskYesNoWithActorAnimation(s32 actor, s32 forceBottom)

The event command "choose yes or no": once the message on screen has been read, asks yes or no below it, or above it when the message windows reach past row 15 or forceBottom is set. The speaker nods (animation 3) at yes and shakes its head (animation 4) at no. Returns 0 for yes, 1 for no. Scene scripts reach it as Engine_EventChooseYesNo (about 54 of them); the link lobby and FieldEvent_AskYesNoAndShowResponse call it too.

Used by FieldEvent_AskYesNoAndShowResponse.

Line 422

s32 Menu_AskYesNo(s32 atBottom)

Asks yes or no at the top of the screen, or at the bottom with atBottom set. Returns 0 for yes, 1 for no. Called by PartyInventory_GiveItem, Field_UseItem, Field_UsePsynergy and the cleared game's menu.

Used by Field_UseItem, Field_UsePsynergy, PartyInventory_GiveItem, SaveMenu_Run.

Line 474

Party_LearnAbility

void Party_LearnAbility(s32 unit, s32 ability)

Teaches unit the Psynergy ability and says so with its jingle, waiting for the player to read it. The message is <unit> learned <ability>. Fuchin Temple's scene script calls it.

Line 481

Event_StartScreenTransition

void Event_StartScreenTransition(void)

The event command "open screen": starts the event's screen transition and sets work->transitionActive. Scene scripts reach it as Engine_EventOpenScreen; the inn, the title, cleared-game and link lobby menus and Map_ShowWorldMap call it too.

Used by Map_ShowWorldMap.

Line 494

Event_FinishScreenTransition

void Event_FinishScreenTransition(void)

The event command "close screen": finishes the event's screen transition and clears work->transitionActive. Scene scripts reach it as Engine_EventCloseScreen; the inn, the cleared-game menu and Map_ShowWorldMap call it too.

Used by Map_ShowWorldMap.

Line 505

Event_WaitTransitionFrames

void Event_WaitTransitionFrames(void)

The event command "wait for screen": waits as long as the transition runs (work->transitionFrames). Scene scripts reach it as Engine_EventWaitForScreen.

Used by Map_ShowWorldMap.

Line 515

Event_SetDestination

void Event_SetDestination(s32 scene, s32 entrance)

Makes the event leave for the given entrance of the given scene: raises the exit request 999 and writes gGameState.scene and entrance. Called by the title, cleared-game and link lobby menus, the debug battle command and five scene scripts (the Lemurian ship and the world map among them).

Used by Event_FinishAirborneTravel, Event_StormCarriesPartyAway, SaveMenu_Run, SetSail, Title_Run, TretTreeInteriors_EnterRoom, TretTreeInteriors_StepOnCrackedFloor, VenusLighthouseAerie_EruptBeacon, WorldMap_Initialize, WorldMap_ShowEndingScene.

Line 523

Event_SetSavedDestination

void Event_SetSavedDestination(u16 scene, u16 entrance)

Makes the event leave and records scene and entrance as the saved destination. Reached only through an unnamed veneer in the object bank's far-call table; nothing in ☀️ names it.

Line 532

Event_SetExitRequest

void Event_SetExitRequest(u16 request)

The event command "request exit": sets the field's exit request (999 leaves for gGameState's scene and entrance). Scene scripts reach it as Engine_EventRequestExit (about 61 of them).

Line 542

Macros, without a comment: GIFT_RECEIVED_MESSAGE, GIFT_RECEIVED_MESSAGE_MODE, GIFT_RECEIVED_MESSAGE, GIFT_RECEIVED_MESSAGE_MODE, GIFT_RECEIVED_MESSAGE, GIFT_RECEIVED_MESSAGE_MODE.

On this page