Skip to Content
The Alchemy Project

src/field/script_commands_messages.c

The scene scripts' speech: a message window opened beside the actor who speaks, with the speaker's portrait, a yes-or-no question, two speakers at once, and the speaker's voice. More…

Included by script_commands.c.

Macros

NameDescription
#defineMESSAGE_VOICE_NONE 0x80000000fdMessageSetVoiceFromActor's actor id for no voice: it clears the voice.
#definePORTRAIT_WINDOW_TILES 5mnPortraitOpenWindow's window is 5 tiles square, and a tile wider under Mind Read.
#defineMESSAGE_POSITION_WIDTH 320fdScriptShowSpeakerMessage and fdScriptShowMessageAtPos move a position MESSAGE_POSITION_SHIFT away from the middle row of a MESSAGE_POSITION_WIDTH by MESSAGE_POSITION_HEIGHT area, larger than the 240 by 160 screen, and hold it MESSAGE_POSITION_MARGIN_X and MESSAGE_POSITION_MARGIN_Y inside the area.
#defineMESSAGE_POSITION_HEIGHT 240
#defineMESSAGE_POSITION_MARGIN_X 8
#defineMESSAGE_POSITION_MARGIN_Y 20
#defineMESSAGE_POSITION_SHIFT 32

Functions

NameDescription
WINDOW *fdMessageShowAtActor (Sint32 speaker, Sint32 unusedFlags)Opens the script'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. speaker is the actor id with SPEAKER_ bits above it; the script's flags argument is not read.
voidfdScriptShowMessageAndWait (Sint32 actorId, Sint32 flags)Opens the current message at actorId (fdMessageShowAtActor) and waits until it has been read and its window has closed; the speaker's portrait is closed once the text is typed out.
voidfdScriptShowMessageThenWait (Sint32 actorId, Sint32 flags, Sint32 ticks)Shows the message, then waits the given number of ticks.
Sint32fdScriptAskYesNoAndShowResponse (Sint32 actorId, Sint32 flags)Opens the question at actorId, lets the leader answer, then shows the next message for yes or the one after it for no.
voidfdScriptNoOperationCallback (void)Unused: an empty callback, reached only through a bare stub in engine_stubs.s.
voidfdScriptShowSpeakerMessage (Sint32 speaker)Unused: reached only through a bare stub in field/engine_stubs.s, which has no symbol, so no code can call it.
voidfdScriptForwardShowMessageAtPos (Sint32 unusedA, Sint32 unusedB, Sint32 x, Sint32 y)Unused: reached only through a bare stub in engine_stubs.s; forwards its arguments to fdScriptShowMessageAtPos.
voidfdScriptShowMessageAtPos (Sint32 unusedA, Sint32 unusedB, Sint32 x, Sint32 y)Unused: reached only through a bare stub in engine_stubs.s.
voidfdActorClosePortrait (Sint32 actorId)Closes the portrait of an actor's sprite, if it has one.
voidfdScriptShowTwoMessagesAndWait (Sint32 first, Sint32 firstX, Sint32 firstY, Sint32 firstPortraitX, Sint32 firstPortraitY, Sint32 second, Sint32 secondX, Sint32 secondY, Sint32 secondPortraitX, Sint32 secondPortraitY)Two actors speak at once, each message at its own (x, y) with its portrait at (portraitX, portraitY), all in tiles.
voidfdMessageSetVoiceFromActor (Sint32 actorId)Sets the voice of the messages that follow to that of actorId's sprite, at the rate the message speed option picks (MessageSpeedVoiceRates); MESSAGE_VOICE_NONE clears it.

Description

The scene scripts' speech: a message window opened beside the actor who speaks, with the speaker's portrait, a yes-or-no question, two speakers at once, and the speaker's voice. Part of script_commands.c.

Macros in detail

MESSAGE_VOICE_NONE

#define MESSAGE_VOICE_NONE 0x80000000

fdMessageSetVoiceFromActor's actor id for no voice: it clears the voice.

Referenced by fdMessageSetVoiceFromActor().

Definition at line 8 of file script_commands_messages.c.

PORTRAIT_WINDOW_TILES

#define PORTRAIT_WINDOW_TILES 5

mnPortraitOpenWindow's window is 5 tiles square, and a tile wider under Mind Read.

Referenced by fdMessageShowAtActor().

Definition at line 12 of file script_commands_messages.c.

MESSAGE_POSITION_WIDTH

#define MESSAGE_POSITION_WIDTH 320

fdScriptShowSpeakerMessage and fdScriptShowMessageAtPos move a position MESSAGE_POSITION_SHIFT away from the middle row of a MESSAGE_POSITION_WIDTH by MESSAGE_POSITION_HEIGHT area, larger than the 240 by 160 screen, and hold it MESSAGE_POSITION_MARGIN_X and MESSAGE_POSITION_MARGIN_Y inside the area.

Referenced by fdScriptShowMessageAtPos() and fdScriptShowSpeakerMessage().

Definition at line 371 of file script_commands_messages.c.

MESSAGE_POSITION_HEIGHT

#define MESSAGE_POSITION_HEIGHT 240

Referenced by fdScriptShowMessageAtPos() and fdScriptShowSpeakerMessage().

Definition at line 372 of file script_commands_messages.c.

MESSAGE_POSITION_MARGIN_X

#define MESSAGE_POSITION_MARGIN_X 8

Referenced by fdScriptShowMessageAtPos() and fdScriptShowSpeakerMessage().

Definition at line 373 of file script_commands_messages.c.

MESSAGE_POSITION_MARGIN_Y

#define MESSAGE_POSITION_MARGIN_Y 20

Referenced by fdScriptShowMessageAtPos() and fdScriptShowSpeakerMessage().

Definition at line 374 of file script_commands_messages.c.

MESSAGE_POSITION_SHIFT

#define MESSAGE_POSITION_SHIFT 32

Referenced by fdScriptShowMessageAtPos() and fdScriptShowSpeakerMessage().

Definition at line 375 of file script_commands_messages.c.

Functions in detail

fdMessageShowAtActor

WINDOW *fdMessageShowAtActor(Sint32 speaker, Sint32 unusedFlags)

Opens the script'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. speaker is the actor id with SPEAKER_ bits above it; the script's flags argument is not read.

References fdActorGetScreenPos(), fdActorGetSpriteById(), fdActorLookup(), fdSpeakerGetVoice(), MainRoutineStateWork, mnMessageAllTypedStub(), mnMessageOpenWindowStub(), mnPortraitGetForSpeakerStub(), mnPortraitOpenWindowStub(), mnTextGetMessageSizeAllPagesStub(), mnTextGetMessageSizeStub(), Sint32, state, syConvert3Dto2D(), sySynch() and width.

Referenced by fdScriptAskYesNoAndShowResponse(), fdScriptOpenMessage(), fdScriptShowMessageAndWait(), scColossoAskDoneCheering() and scColossoGreetAtStage().

Definition at line 18 of file script_commands_messages.c.

fdScriptShowMessageAndWait

void fdScriptShowMessageAndWait(Sint32 actorId, Sint32 flags)

Opens the current message at actorId (fdMessageShowAtActor) and waits until it has been read and its window has closed; the speaker's portrait is closed once the text is typed out.

References fdActorGetSpriteById(), fdFindActorPlacement(), fdMessageShowAtActor(), mnMessageCloseFinishedWindowsStub(), mnPortraitCloseWindowStub(), mnWindowIsClosedStub(), PerData, Sint32, state and sySynch().

Referenced by dbIncreaseItemAndLevelEllipsisAndSpeak(), dbIncreaseItemAndLevelWinceAndSpeak(), fdRunPsynergyScript(), fdRunRaisedCue(), fdRunStepCueOrExit(), fdScriptAskYesNoAndShowResponse(), fdScriptShowMessage(), fdScriptShowMessageThenWait(), fdTalkToActor(), fdUseItem(), scColossoAskDoneCheering(), scColossoAskDoneLookingAround(), scColossoGreetAtStage(), scColossoRepeatStageNumber(), scColossoTakePlaceForMatch(), scVaultFindBone() and scVaultShowThought().

Definition at line 284 of file script_commands_messages.c.

fdScriptShowMessageThenWait

void fdScriptShowMessageThenWait(Sint32 actorId, Sint32 flags, Sint32 ticks)

Shows the message, then waits the given number of ticks.

References fdScriptShowMessageAndWait(), fdScriptWait() and Sint32.

Referenced by scAlpineCrossingFeizhiArrives(), scAlpineCrossingHamaReachesHsu(), scAlpineCrossingLiftBoulder(), scAlpineCrossingTalkToFeizhi(), scAltinPeakCelebrateHydrosVictory(), scAltinPeakReadFallingRockSign(), scAltinTalkToThirstyOldWoman(), scBilibinJillGivesHardNut(), scColosseumEntranceCrowdRecognizesIsaac(), scColosseumEntranceTalkToDekka(), scCottageRoomsAGaretComesHome(), scCottageRoomsAGiveFarewellHerb(), scCottageRoomsBAskIsaacHisBusiness(), scCottageRoomsBDoraWakesIsaac(), scCottageRoomsBHurryToThePlaza(), scCottageRoomsBTalkToDora(), scCottageRoomsBVisitSickDora(), scCottageRoomsCTalkToHungryDiner(), scFieldScriptShowMessageThenWait(), scFuchinTempleFehAsksToSeeChi(), scFuchinTempleFehSeesChi(), scFuchinTempleFeizhiLeavesForHsu(), scFuchinTempleMonkAsksWhetherTestIsDone(), scFuchinTempleMonkLetsPartyIntoGrotto(), scFuchinTempleNyunpaOffersTest(), scFuchinTempleNyunpaTeachesKi(), scFuchinTempleRunHamasRevealLesson(), scFuchinTempleStudentExplainsChiRules(), scFuchinTempleStudentsSeeTreeFall(), scGomaCaveEntranceIvanJoins(), scHammetPalaceHammetsHomecoming(), scHammetPalaceIvanReportsToLayana(), scHammetPalaceLayanaScoldsLunpaVisit(), scImilMeetMiaAtOldCouplesHouse(), scImilMiaSaysFarewellToApprentices(), scImilTalkToOldMan(), scInit(), scKalayHammetReturnsToPalace(), scKalayIvanMeetsPalaceGuards(), scKalayTolbiDocksTalkToWomanSellingTickets(), scKalayWatchTourGroupDeparture(), scKolimaForestTreeRestoreTret(), scKolimaForestTreeTalkToLaurel(), scLacquerRoomsBFeizhiThanksParty(), scLamaTempleRunHamasFarewell(), scLogRoomsBWelcomeIsaacBack(), scMcCoyPalaceAudienceWithMcCoy(), scMcCoyPalaceCaptainSeesPartyOff(), scMcCoyPalaceCaptainTalksAboutBarricade(), scMcCoyPalaceGroundsGuardsArrestParty() and 98 more.

Definition at line 329 of file script_commands_messages.c.

fdScriptAskYesNoAndShowResponse

Sint32 fdScriptAskYesNoAndShowResponse(Sint32 actorId, Sint32 flags)

Opens the question at actorId, lets the leader answer, then shows the next message for yes or the one after it for no.

References fdMessageShowAtActor(), fdScriptAskYesNoWithActorAnimation(), fdScriptShowMessageAndWait(), MainRoutineStateWork, Sint32 and state.

Referenced by fdScriptAskYesNo() and scColossoAskDoneLookingAround().

Definition at line 337 of file script_commands_messages.c.

fdScriptNoOperationCallback

void fdScriptNoOperationCallback(void)

Unused: an empty callback, reached only through a bare stub in engine_stubs.s.

Definition at line 363 of file script_commands_messages.c.

fdScriptShowSpeakerMessage

void fdScriptShowSpeakerMessage(Sint32 speaker)

Unused: reached only through a bare stub in field/engine_stubs.s, which has no symbol, so no code can call it. It would record the speaker, open the message near it and wait unless fast-forwarding, then advance the message index. It places the message as fdScriptShowMessageAtPos does, before passing the position to a window function that takes tiles; with no caller, the units it expected can't be told.

References fdActorGetScreenPos(), fdActorLookup(), mnMessageOpenWindowStub(), mnWindowIsClosedStub(), Sint32, state, syConvert3Dto2D() and sySynch().

Definition at line 383 of file script_commands_messages.c.

fdScriptForwardShowMessageAtPos

void fdScriptForwardShowMessageAtPos(Sint32 unusedA, Sint32 unusedB, Sint32 x, Sint32 y)

Unused: reached only through a bare stub in engine_stubs.s; forwards its arguments to fdScriptShowMessageAtPos.

References fdScriptShowMessageAtPos() and Sint32.

Definition at line 463 of file script_commands_messages.c.

fdScriptShowMessageAtPos

void fdScriptShowMessageAtPos(Sint32 unusedA, Sint32 unusedB, Sint32 x, Sint32 y)

Unused: reached only through a bare stub in engine_stubs.s. It would open the script's message at (x, y), moved and held as MESSAGE_POSITION_WIDTH says, wait for it and advance the message index; its units are as unknown as fdScriptShowSpeakerMessage's.

References mnMessageOpenWindowStub(), mnWindowIsClosedStub(), Sint32, state and sySynch().

Referenced by fdScriptForwardShowMessageAtPos().

Definition at line 475 of file script_commands_messages.c.

fdActorClosePortrait

void fdActorClosePortrait(Sint32 actorId)

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

References fdActorGetSpriteById(), mnPortraitCloseWindowStub() and Sint32.

Definition at line 506 of file script_commands_messages.c.

fdScriptShowTwoMessagesAndWait

void fdScriptShowTwoMessagesAndWait(Sint32 first, Sint32 firstX, Sint32 firstY, Sint32 firstPortraitX, Sint32 firstPortraitY, Sint32 second, Sint32 secondX, Sint32 secondY, Sint32 secondPortraitX, Sint32 secondPortraitY)

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.

References fdActorGetSpriteById(), fdSpeakerGetVoice(), mnMessageAllTypedStub(), mnMessageCloseFinishedWindowsStub(), mnMessageOpenWindowStub(), mnPortraitCloseWindowStub(), mnPortraitOpenWindowStub(), mnWindowIsClosedStub(), PerPush, Sint32, state and sySynch().

Definition at line 518 of file script_commands_messages.c.

fdMessageSetVoiceFromActor

void fdMessageSetVoiceFromActor(Sint32 actorId)

Sets the voice of the messages that follow to that of actorId's sprite, at the rate the message speed option picks (MessageSpeedVoiceRates); MESSAGE_VOICE_NONE clears it.

References fdActorGetSpriteById(), fdSpeakerGetVoice(), MainRoutineStateWork, MessageSpeedVoiceRates and Sint32.

Referenced by scCottageRoomsBDoraWakesIsaac(), scKalayWatchTourGroupDeparture(), scShipRoomsCallLeaderBackToBeasts(), scShipRoomsReportMonstersBelowdecks(), scTolbiShipDeckMonsterLandsOnDeck(), scTolbiShipDeckMonstersAttackCrew() and scTolbiShipDeckMonstersBoard().

Definition at line 573 of file script_commands_messages.c.