Alchemy
Loading...
Searching...
No Matches

events.c File Reference

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

Go to the source code of this file.

Macros

#define GIFT_RECEIVED_MESSAGE   (MsgColossoIsaacGotItem + 1)
#define GIFT_RECEIVED_MESSAGE_MODE   3

Functions

static void ItemGift_ShowGotItem (s32 item, s32 flags)
 Shows the message for an item the party has just received.
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.
void FieldEvent_WaitFrames (s32 frames)
 The event command "wait": waits the requested frames, unless debug fast forward (Event_UpdateDebugSkip) is on.
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.
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.
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).
UNUSED void Event_NoOpHookA (void)
 Nothing calls it.
void Event_NoOpHook (void)
 An empty hook; it does nothing in the released game.
void Event_RunObjectHookAndWait (struct ScenePlacement *table)
 Respawns the scene's actors from a placement table and waits one frame for them to appear.
void Event_CallWithLastActiveObjectId (struct ScenePlacement *table)
 Spawns the actors of a placement table after the last actor in use.
void Event_SetSceneEvents (const struct SceneEvent *events)
 Sets the scene's event table, which the field checks as the leader moves: writes work->events.
void Event_PrepareObjectAndApplyValue (s32 unit, s32 announce)
 Adds unit to the party.
void Event_PrepareTwoObjectsAndApply (s32 first, s32 second)
 Adds two units to the party and announces them together.
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.
void Event_ClearInvalidPackedValues (void)
 Clears each button shortcut whose Psynergy can no longer be cast: zeroes gGameState.firstShortcut or secondShortcut.
void Party_RemoveOwnerRestored (s32 unit)
 Takes unit out of the party, fully restoring its HP and PP and curing its poison.
s32 Party_CheckItemLimit (s32 item)
 Checks whether the party can carry one more of item: each member carries at most 30 of one item.
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.
s32 Inventory_TryAddAndReturnOwner (s32 item, s32 unused, s32 unit)
 Gives item to one party member.
void Inventory_NoOpCallback (void)
 An empty function; nothing in ☀️ calls it.
void Inventory_ReservedNoOp (void)
 An empty function; nothing in ☀️ calls it.
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.
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.
s32 Menu_AskYesNo (s32 atBottom)
 Asks yes or no at the top of the screen, or at the bottom with atBottom set.
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.
void Event_StartScreenTransition (void)
 The event command "open screen": starts the event's screen transition and sets work->transitionActive.
void Event_FinishScreenTransition (void)
 The event command "close screen": finishes the event's screen transition and clears work->transitionActive.
void Event_WaitTransitionFrames (void)
 The event command "wait for screen": waits as long as the transition runs (work->transitionFrames).
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.
void Event_SetSavedDestination (u16 scene, u16 entrance)
 Makes the event leave and records scene and entrance as the saved destination.
void Event_SetExitRequest (u16 request)
 The event command "request exit": sets the field's exit request (999 leaves for gGameState's scene and entrance).

Detailed Description

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

Part of psynergy_effects.c, compiled only through it.

Definition in file events.c.

Macro Definition Documentation

◆ GIFT_RECEIVED_MESSAGE

#define GIFT_RECEIVED_MESSAGE   (MsgColossoIsaacGotItem + 1)

Definition at line 16 of file events.c.

Referenced by PartyInventory_GiveItem().

◆ GIFT_RECEIVED_MESSAGE_MODE

#define GIFT_RECEIVED_MESSAGE_MODE   3

Definition at line 17 of file events.c.

Referenced by PartyInventory_GiveItem().

Function Documentation

◆ ItemGift_ShowGotItem()

void ItemGift_ShowGotItem ( s32 item,
s32 flags )
inlinestatic

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.

Definition at line 24 of file events.c.

Referenced by ItemGift_ShowGotItem(), and PartyInventory_GiveItem().

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

Definition at line 38 of file events.c.

Referenced by Event_UpdateDebugSkip(), FieldEvent_Begin(), and FieldEvent_End().

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

Definition at line 55 of file events.c.

Referenced by BattleFx_SpawnLinked(), BattlePres_RunActionThenWaitIfModeZero(), Camera_WaitForArrival(), Field_ClimbDown(), Field_ClimbUp(), Field_SearchTile(), FieldEvent_WaitFrames(), Object_LinkPair(), ObjectEffect_RunPendingFlagEvent(), ObjectMotion_ArmCallback(), ObjectMotion_Launch(), and ObjectMotion_SetAngleToward().

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

Definition at line 67 of file events.c.

Referenced by BattleFx_RunVisibilityTransition(), Event_GaretRefusesToLeave(), Field_CheckExitRegions(), Field_RunScene(), Field_SearchTile(), Field_UsePsynergy(), FieldEvent_Begin(), Leader_StopMoving(), and Scene_TalkToActor().

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

Definition at line 91 of file events.c.

Referenced by Djinn_JoinParty(), Djinn_RunBattleStartHop(), Field_ClimbDown(), Field_ClimbUp(), Field_RunEventAction(), Field_SearchTile(), Field_TryJumpForward(), Field_UseItem(), FieldEvent_Begin(), FieldFx_RunRetreat(), Scene_RunRaisedEvent(), Scene_RunTouchOrExit(), and Scene_TalkToActor().

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

Definition at line 120 of file events.c.

Referenced by Djinn_JoinParty(), Djinn_RunBattleStartHop(), Field_ClimbDown(), Field_ClimbUp(), Field_RunEventAction(), Field_SearchTile(), Field_TryJumpForward(), Field_UseItem(), FieldEvent_End(), Scene_RunRaisedEvent(), Scene_RunTouchOrExit(), and Scene_TalkToActor().

◆ Event_NoOpHookA()

UNUSED void Event_NoOpHookA ( void )

Nothing calls it.

Definition at line 127 of file events.c.

Referenced by Event_NoOpHookA().

◆ Event_NoOpHook()

void Event_NoOpHook ( void )

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

Only Event_RunObjectHookAndWait calls it.

Definition at line 131 of file events.c.

Referenced by Event_NoOpHook(), and Event_RunObjectHookAndWait().

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

Definition at line 136 of file events.c.

Referenced by Event_RunObjectHookAndWait().

◆ Event_CallWithLastActiveObjectId()

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

Definition at line 155 of file events.c.

Referenced by Event_SetSceneEvents().

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

Definition at line 165 of file events.c.

Referenced by Event_GaretJoinsIsaac(), Event_IvanRejoins(), Event_MeetSurvivingTravelers(), Event_PrepareObjectAndApplyValue(), MercuryLighthouse_MiaJoinsAfterRescue(), Scene_Initialize(), ValeStorm_RunCallOutSequence(), and VaultInteriors_IvanJoinsRodSearch().

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

Definition at line 175 of file events.c.

Referenced by Event_PrepareTwoObjectsAndApply().

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

Definition at line 186 of file events.c.

Referenced by Event_ClearInvalidPackedValues(), and Event_ValidatePackedId().

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

Definition at line 203 of file events.c.

Referenced by Event_ClearInvalidPackedValues(), Field_ProcessStep(), and Party_RemoveOwnerRestored().

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

Definition at line 214 of file events.c.

Referenced by Event_IvanStaysBehind(), Party_RemoveOwnerRestored(), SolSanctumElementalStarRoom_EnterStarRoom(), SolSanctumEruption_PlayHostageScene(), ValeStorm_ShowBoulderSweepingDownriver(), and VaultInteriors_ReturnStolenGoods().

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

Definition at line 248 of file events.c.

Referenced by Field_RunScene(), and Party_CheckItemLimit().

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

Definition at line 275 of file events.c.

Referenced by Field_RunScene(), and PartyInventory_GiveItem().

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

Definition at line 376 of file events.c.

Referenced by Inventory_TryAddAndReturnOwner().

◆ Inventory_NoOpCallback()

void Inventory_NoOpCallback ( void )

An empty function; nothing in ☀️ calls it.

Definition at line 383 of file events.c.

Referenced by Inventory_NoOpCallback().

◆ Inventory_ReservedNoOp()

void Inventory_ReservedNoOp ( void )

An empty function; nothing in ☀️ calls it.

Definition at line 386 of file events.c.

Referenced by Inventory_ReservedNoOp().

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

Definition at line 392 of file events.c.

Referenced by Actor_WaitForAnimationEnd(), and Event_AskYesNoWithActorAnimation().

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

Definition at line 416 of file events.c.

Referenced by Event_AskYesNoWithActorAnimation(), and FieldEvent_AskYesNoAndShowResponse().

◆ Menu_AskYesNo()

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.

Definition at line 468 of file events.c.

Referenced by Field_UseItem(), Field_UsePsynergy(), Menu_AskYesNo(), PartyInventory_GiveItem(), and SaveMenu_Run().

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

Definition at line 475 of file events.c.

Referenced by FuchinTemple_RunHamasRevealLesson(), and Party_LearnAbility().

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

Definition at line 488 of file events.c.

Referenced by Event_StartScreenTransition(), and Map_ShowWorldMap().

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

Definition at line 499 of file events.c.

Referenced by Event_FinishScreenTransition(), and Map_ShowWorldMap().

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

Definition at line 509 of file events.c.

Referenced by Event_WaitTransitionFrames(), and Map_ShowWorldMap().

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

Definition at line 517 of file events.c.

Referenced by Event_FinishAirborneTravel(), Event_SetDestination(), Event_StormCarriesPartyAway(), LinkLobby_LeaveArena(), SaveMenu_Run(), SetSail(), Title_Run(), TretTreeInteriors_EnterRoom(), TretTreeInteriors_StepOnCrackedFloor(), VenusLighthouseAerie_EruptBeacon(), WorldMap_Initialize(), and WorldMap_ShowEndingScene().

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

Definition at line 526 of file events.c.

Referenced by Event_SetSavedDestination().

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

Definition at line 536 of file events.c.

Referenced by Event_SetExitRequest().