struct MAIN_ROUTINE_STATE
The main routine's state: the transition data the main routine reads between engines (the scene and entrance it runs next, engineResult, the return point, the after-battle and defeat destinations and the restart point), and what every engine shares (the party, coins, Djinn, play time and options).
Declared in main_routine_state.h.
Fields
| Name | Description | |
|---|---|---|
Uint32 | buildStamp | gmBuildStampGetTime's value when the game was last saved; its low half goes into the file's summary. |
Uint32 | playTime | Ticks, copied from PlayTimeTicks when saving. |
Uint8 | unused [4] | |
PARTY_HOLDINGS | holdings | |
Uint8 | unusedAfterPrizes [132] | |
Sint16 | next | What the main routine runs next: a scene (a SceneId row of ScenesWork), which means the field engine running that scene, or an ENGINE_ value above the table's rows for another engine. |
Sint16 | entrance | The destination's entrance; in ENGINE_BATTLE, the formation to fight. |
Sint16 | restartScene | The restart point, usually the last Sanctum: read after a defeat with no defeat destination, and by the File Screen. |
Sint16 | restartEntrance | The restart point's entrance. |
Sint16 | returnScene | The return point: the scene that was running when a battle or minigame started, where gmReturnFromEngine returns unless an after-battle destination is set. |
Sint16 | returnEntrance | The return point's entrance. |
Sint16 | area | The current scene's area; a new one resets its flags. |
Sint16 | afterBattleScene | The after-battle destination, -1 for none: read by gmReturnFromEngine when the party was not defeated, before the return point (a minigame's return reads it too), and cleared as each scene starts. |
Sint16 | afterBattleEntrance | Its entrance; -1 for none. |
Sint16 | defeatScene | The defeat destination, -1 for none: read by gmReturnFromEngine after a defeat, before the restart point. |
Sint16 | defeatEntrance | Its entrance; -1 for none. |
Sint16 | battleBg | The battle background chosen for the |
Uint8 | unusedAfterBg [2] | scene or battle environment. |
Sint16 | mapId | The scene's map (SCENE.mapIndex); the World Map's is MAP_INDEX_WORLD. |
FIXED | x | 16.16 fixed-point pixels. |
FIXED | y | 16.16 fixed-point pixels. |
FIXED | z | 16.16 fixed-point pixels. |
Uint32 | heading | 1/65536 turns. |
Uint16 | layer | The leader's layer, kept with its position. |
Sint16 | battleMusic | The battle music chosen for the encounter. |
Sint16 | sceneMusic | The current scene's field music. |
Uint8 | movementMode | 1 while the leader is climbing, 0 otherwise. |
Sint32 | leaderActorId | The leader: its unit and its actor. |
Uint8 | party [8] | The party in order. |
Uint8 | unusedAfterParty [5] | |
Uint8 | windowHue | The "Window color" setting, 0 to 23. |
Uint8 | windowBrightness | The "Window brightness" setting, 0 to |
Uint8 | unusedAfterBrightness [3] | 14. |
Uint8 | speech | The voice sound option: 1, as on a new game, plays each speaker's voice sound as their message types (fdSpeakerGetVoice). |
Uint8 | unusedAfterSpeech | 1 on a new game; nothing reads it. |
Uint8 | msgSpeed | 0 to 2; 1 on a new game. |
Uint8 | unusedAfterMsgSpeed [2] | |
Uint8 | sendFlag | Set on saving at the end of the game, marking the file cleared: its data can be sent. |
Uint16 | aKeys | Examine; KEY_A. |
Uint16 | bKeys | |
Uint16 | selectKeys | The menu; KEY_SELECT. |
Uint16 | startKeys | |
Uint16 | firstShortcutKeys | |
Uint16 | secondShortcutKeys | |
Uint16 | dashKeys | |
Sint16 | returnMusic | Music playing when the field left; -1 for none. |
Uint16 | firstShortcut | The shortcuts' assignments. bits: 15..14 |
Uint16 | secondShortcut | kind (0 Psynergy, 1 an item) | 13..0 which one. |
Uint8 | perspectiveMap | Set to 1 on the world map. |
Uint8 | unusedAfterPerspective [5] | |
Uint8 | idleSleepEnabled | The option, saved from IdleSleepEnabled. |
Uint8 | battleType | An BATTLE_TYPE. |
Sint16 | hazardLimit | Hazardous ground (the Lamakan Desert's heat): when hazardSteps reaches hazardLimit the party takes hazardDamage and the count starts again. |
Sint16 | hazardMode | An HAZARD_MODE. |
Sint16 | hazardDamage | bits: 8 the amount is a percentage of maximum HP | 7..0 the amount |
Sint16 | hazardSteps | Reset on entering a new area. |
Sint16 | pendingDjinni | The Djinni battle pending (DJINNI_BATTLE_SCRIPT_FIRST plus its number, flags in bits 15 to 11), resolved on returning to the field. |
Sint16 | engineResult | The last battle's result; -1 for a defeat. |
Sint32 | encounterSteps | The encounter count, reset with a new area. |
Uint16 | pendingItem | Given on returning to the field if the party has room. |
Sint16 | sceneType | The current scene's variant from its row in ScenesWork. |
Sint16 | retreatScene | Where Retreat goes: the scene and |
Sint16 | retreatEntrance | entrance the party came into the area by. |
FIXED | avoidDistance | Distance left of Avoid, 16.16 pixels; 0 when off. |
Sint8 | avoidByItem | Avoid came from an item (the Sacred Feather). |
Sint8 | haltedColorMode | Halt: the stopped actor's sprite colour mode, which Halt flickers and puts back when the actor resumes. |
Sint16 | haltedActor | Halt: the stopped actor; -1 for none. |
Sint16 | cloaked | 1 under Cloak, which prevents battles. |
Uint32 | haltedUpdate | Halt: the stopped actor's per-tick |
Uint8 | unusedAfterHalt [80] | update, put back when it resumes. |
Uint16 | linkTallies [8] | The Battle Arena's tallies: 4 the total |
Uint8 | unusedAfterTallies [4] | wins and 7 the consecutive wins it reports, 3 cleared on choosing a monster battle; the others not named by the game. |
Uint32 | startStamp | gmBuildStampGetTime's value at a new |
Uint8 | unusedAfterStartStamp [4] | game. |
Description
The main routine's state: the transition data the main routine reads between engines (the scene and entrance it runs next, engineResult, the return point, the after-battle and defeat destinations and the restart point), and what every engine shares (the party, coins, Djinn, play time and options).
struct MAIN_ROUTINE_STATE
Referenced by fdDjinnResolvePending(), fdPsynergyResumeHaltedActor(), fdRequestDjinnBattle(), fdScriptAskYesNoAndShowResponse(), fdUsePsynergy(), gmPartyAdjustCoins(), MainRoutineStateWork, offsetof, scColosseumNavampaMatchRideMovingSidewalk(), scCrossboneIsleKeysCheckFifthStatueCue(), scInit(), scKalayTolbiDocksTalkToWomanSellingTickets(), scTolbiSpringRunSpringGame(), scWorldMapMeetCorona() and scWorldMapMeetHail().
Definition at line 85 of file main_routine_state.h.
Fields in detail
buildStamp
Uint32 buildStamp
gmBuildStampGetTime's value when the game was
last saved; its low half goes into the file's
summary.
playTime
Uint32 playTime
Ticks, copied from PlayTimeTicks when saving.
unused
Uint8 unused[4]
holdings
PARTY_HOLDINGS holdings
unusedAfterPrizes
Uint8 unusedAfterPrizes[132]
next
Sint16 next
What the main routine runs next: a
scene (a SceneId row of ScenesWork),
which means the field engine running
that scene, or an ENGINE_ value above
the table's rows for another engine.
entrance
Sint16 entrance
The destination's entrance; in
ENGINE_BATTLE, the formation to
fight.
restartScene
Sint16 restartScene
The restart point, usually the last Sanctum: read after a defeat with no defeat destination, and by the File Screen.
restartEntrance
Sint16 restartEntrance
The restart point's entrance.
returnScene
Sint16 returnScene
The return point: the scene that was
running when a battle or minigame
started, where gmReturnFromEngine
returns unless an after-battle
destination is set.
returnEntrance
Sint16 returnEntrance
The return point's entrance.
area
Sint16 area
The current scene's area; a new one resets its flags.
afterBattleScene
Sint16 afterBattleScene
The after-battle destination, -1 for
none: read by gmReturnFromEngine when
the party was not defeated, before
the return point (a minigame's return
reads it too), and cleared as each
scene starts.
afterBattleEntrance
Sint16 afterBattleEntrance
Its entrance; -1 for none.
defeatScene
Sint16 defeatScene
The defeat destination, -1 for none:
read by gmReturnFromEngine after a
defeat, before the restart point.
defeatEntrance
Sint16 defeatEntrance
Its entrance; -1 for none.
battleBg
Sint16 battleBg
The battle background chosen for the
unusedAfterBg
Uint8 unusedAfterBg[2]
scene or battle environment.
mapId
Sint16 mapId
The scene's map (SCENE.mapIndex); the
World Map's is MAP_INDEX_WORLD.
x
FIXED x
16.16 fixed-point pixels.
y
FIXED y
16.16 fixed-point pixels.
z
FIXED z
16.16 fixed-point pixels.
heading
Uint32 heading
1/65536 turns.
layer
Uint16 layer
The leader's layer, kept with its position.
battleMusic
Sint16 battleMusic
The battle music chosen for the encounter.
sceneMusic
Sint16 sceneMusic
The current scene's field music.
movementMode
Uint8 movementMode
1 while the leader is climbing, 0 otherwise.
leaderActorId
Sint32 leaderActorId
The leader: its unit and its actor.
party
Uint8 party[8]
The party in order.
unusedAfterParty
Uint8 unusedAfterParty[5]
windowHue
Uint8 windowHue
The "Window color" setting, 0 to 23.
windowBrightness
Uint8 windowBrightness
The "Window brightness" setting, 0 to
unusedAfterBrightness
Uint8 unusedAfterBrightness[3]
speech
Uint8 speech
The voice sound option: 1, as on a
new game, plays each speaker's voice
sound as their message types
(fdSpeakerGetVoice).
unusedAfterSpeech
Uint8 unusedAfterSpeech
1 on a new game; nothing reads it.
msgSpeed
Uint8 msgSpeed
0 to 2; 1 on a new game.
unusedAfterMsgSpeed
Uint8 unusedAfterMsgSpeed[2]
sendFlag
Uint8 sendFlag
Set on saving at the end of the game, marking the file cleared: its data can be sent. Copied to the file's summary as sendFlag.
aKeys
Uint16 aKeys
Examine; KEY_A.
bKeys
Uint16 bKeys
selectKeys
Uint16 selectKeys
The menu; KEY_SELECT.
startKeys
Uint16 startKeys
firstShortcutKeys
Uint16 firstShortcutKeys
secondShortcutKeys
Uint16 secondShortcutKeys
dashKeys
Uint16 dashKeys
returnMusic
Sint16 returnMusic
Music playing when the field left; -1 for none.
firstShortcut
Uint16 firstShortcut
The shortcuts' assignments. bits: 15..14
secondShortcut
Uint16 secondShortcut
kind (0 Psynergy, 1 an item) | 13..0 which one.
perspectiveMap
Uint8 perspectiveMap
Set to 1 on the world map.
unusedAfterPerspective
Uint8 unusedAfterPerspective[5]
idleSleepEnabled
Uint8 idleSleepEnabled
The option, saved from IdleSleepEnabled.
battleType
Uint8 battleType
An BATTLE_TYPE.
hazardLimit
Sint16 hazardLimit
Hazardous ground (the Lamakan Desert's heat): when hazardSteps reaches hazardLimit the party takes hazardDamage and the count starts again. Pixels walked on hazard metatiles, or ticks, by hazardMode.
hazardMode
Sint16 hazardMode
An HAZARD_MODE.
hazardDamage
Sint16 hazardDamage
bits: 8 the amount is a percentage of maximum HP | 7..0 the amount
hazardSteps
Sint16 hazardSteps
Reset on entering a new area.
pendingDjinni
Sint16 pendingDjinni
The Djinni battle pending
(DJINNI_BATTLE_SCRIPT_FIRST plus its
number, flags in bits 15 to 11),
resolved on returning to the field.
engineResult
Sint16 engineResult
The last battle's result; -1 for a defeat.
encounterSteps
Sint32 encounterSteps
The encounter count, reset with a new area.
pendingItem
Uint16 pendingItem
Given on returning to the field if the party has room.
sceneType
Sint16 sceneType
The current scene's variant from its row
in ScenesWork.
retreatScene
Sint16 retreatScene
Where Retreat goes: the scene and
retreatEntrance
Sint16 retreatEntrance
entrance the party came into the area by.
avoidDistance
FIXED avoidDistance
Distance left of Avoid, 16.16 pixels; 0 when off.
avoidByItem
Sint8 avoidByItem
Avoid came from an item (the Sacred Feather).
haltedColorMode
Sint8 haltedColorMode
Halt: the stopped actor's sprite colour mode, which Halt flickers and puts back when the actor resumes.
haltedActor
Sint16 haltedActor
Halt: the stopped actor; -1 for none.
cloaked
Sint16 cloaked
1 under Cloak, which prevents battles.
haltedUpdate
Uint32 haltedUpdate
Halt: the stopped actor's per-tick
unusedAfterHalt
Uint8 unusedAfterHalt[80]
update, put back when it resumes.
linkTallies
Uint16 linkTallies[8]
The Battle Arena's tallies: 4 the total
unusedAfterTallies
Uint8 unusedAfterTallies[4]
wins and 7 the consecutive wins it reports, 3 cleared on choosing a monster battle; the others not named by the game.
startStamp
Uint32 startStamp
gmBuildStampGetTime's value at a new
unusedAfterStartStamp
Uint8 unusedAfterStartStamp[4]
game.