Alchemy

messages.c

Messages shown at an actor, and the speaker's voice.

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

Messages shown at an actor, and the speaker's voice. Part of psynergy_effects.c, compiled only through it.

Functions

UiText_OpenMessageAtObject

struct UiWindow *UiText_OpenMessageAtObject(s32 actor, s32 unused)

The event command "open message": opens the event's current message in a speech window next to the speaking actor, with the speaker's portrait beside it when it has one, and moves on to the next message. The low 12 bits of actor are the speaker (0 to 7, a party member, speaks from the leader); its high bits place the windows: 0x1000 portrait on the left, 0x2000 on the right, 0x4000 message above the speaker, 0x8000 never above. Returns the message window once its text is typed out; the caller waits for it to be read. Records the speaker and both windows in the field work (speaker, messageWindow, sideWindow). With the debug fastForward set nothing opens and it returns NULL, but the message still advances.

Used by FieldEvent_AskYesNoAndShowResponse, FieldEvent_ShowMessageAndWait, SetSail, SolSanctumStatue_ExplainStatuePuzzle.

Line 27

FieldEvent_ShowMessageAndWait

void FieldEvent_ShowMessageAndWait(s32 actor, s32 flags)

The event command "show message": opens the current message at actor (UiText_OpenMessageAtObject) and waits until it has been read and its window has closed; the speaker's portrait is closed once the text is typed out. The message closes by itself after 600 frames, or at once while Select, L, R and A are all held. About 70 scenes reach it as Engine_EventShowMessage (Event_ShowMessage, MESSAGE_PUT); the scene event runner (object/events.c), Field_RunEventAction (dispatch.c), Field_UseItem for an item event that is a message (object/items.c) and the debug menu's message test call it too.

Used by BattlePres_RunActionThenWaitIfModeZero, DebugMenu_RunMessageTest, FieldEvent_AskYesNoAndShowResponse, Field_RunEventAction, Field_UseItem, Scene_RunRaisedEvent, Scene_RunTouchOrExit, Scene_TalkToActor.

Line 263

BattlePres_RunActionThenWaitIfModeZero

void BattlePres_RunActionThenWaitIfModeZero(s32 actor, s32 flags, s32 wait)

The event command "show message and wait": shows the message, then waits wait frames.

Used by SolSanctumElementalStarRoom_DemandElementalStars.

Line 300

FieldEvent_AskYesNoAndShowResponse

s32 FieldEvent_AskYesNoAndShowResponse(s32 actor, s32 flags)

The event command "ask yes or no": opens the question at actor, lets the leader answer, then shows the next message for yes or the one after it for no. Returns 0 for yes, 1 for no. Either way the event's message number ends past both answers, so the script goes on with the same message whatever was chosen.

Line 310

Event_ShowSpeakerMessage

void Event_ShowSpeakerMessage(s32 speaker)

A speaker-message entry point retained by its overlay veneer, with no current scene caller. Records the speaker, waits for the message unless fast-forwarding, and advances the message index. XXX: this and Event_ShowMessageAtPosition apply a 32-unit offset and 312/220 limits before calling a window service that takes tiles. A caller establishing the intended position would settle its units and conversion.

Line 338

ObjectTable_CallRefreshHook

void ObjectTable_CallRefreshHook(s32 unused0, s32 unused1, s32 x, s32 y)

Retained by its overlay veneer; no current caller establishes the coordinates forwarded to Event_ShowMessageAtPosition.

Line 411

Event_ShowMessageAtPosition

void Event_ShowMessageAtPosition(s32 unused0, s32 unused1, s32 x, s32 y)

A retained coordinate-message entry point: waits for the message and advances the event's message index. Its placement units are unresolved, as in Event_ShowSpeakerMessage.

Used by ObjectTable_CallRefreshHook.

Line 418

ObjectTable_RunIfActive

void ObjectTable_RunIfActive(s32 actor)

Closes the portrait of an actor's sprite, if it has one.

Line 444

Battle_ShowPairedUnitWorkAndWait

void Battle_ShowPairedUnitWorkAndWait(s32 first, s32 firstX, s32 firstY, s32 firstPortraitX, s32 firstPortraitY, s32 second, s32 secondX, s32 secondY, s32 secondPortraitX, s32 secondPortraitY)

The event command "show two messages and wait": two actors speak at once, each message at its own (x, y) with its portrait at (portraitX, portraitY), all in tiles. Waits for A, B, L or R, then closes both.

Line 455

Ui_SetMessageVoiceFromActor

void Ui_SetMessageVoiceFromActor(s32 actor)

Sets the voice of the messages that follow to that of actor's sprite, at the rate the message speed option picks (gUi_RenderResultValues). With 0x80000000 the messages are silent.

Used by Event_DoraWakesIsaac, Kalay_WatchTourGroupDeparture, TolbiShipDeck_MonsterLandsOnDeck, TolbiShipDeck_MonstersAttackCrew, TolbiShipDeck_MonstersBoard, TolbiShipInteriors_ReportMonstersBelowdecks, TolbiShipInteriors_TurnBackFromStairs.

Line 502

Also, functions without a comment: BattleEventRuntime_EmptyCallback.

Structures

WorkPointers

struct WorkPointers

The work slots from the window work's onward, seen as the window work and, twelve slots on, the event work in slot 27.

FieldDeclared as
windowu8 *window
unk04u8 unk04[0x2c]
eventstruct FieldWork *event

Used by UiText_OpenMessageAtObject.

Line 10

On this page