game_state.h
games/tbs/include/game_state.h on GitHub
Structures
GameState
struct GameState
The game's state: play time, coins, the scene and the leader's position, the active party and the options.
| Field | Declared as | |
|---|---|---|
buildStamp | u32 buildStamp | Runtime_GetBuildStampTime's value when the game was last saved; its low half goes into the file's summary. |
playTime | u32 playTime | frames, copied from gPlayTimeFrames when saving |
unk008 | u8 unk008[8] | Not named by TBS code. The party's struct DjinnRecoveryTable (Djinn_GetRecoveryTable) starts at byte 4, its first 8 bytes running over coins. |
coins | s32 coins | |
unk014 | u8 unk014[0x104] | The party's Djinn recovery list (struct DjinnRecoveryList), read through Djinn_GetRecoveryTable; not named by TBS code. |
shopCredit | s32 shopCredit | spent on a Game Ticket; not written by name in TBS |
shopGifts | s8 shopGifts | indexes the Game Ticket's credit cost |
prizeWeights | s8 prizeWeights[0x0f] | The slot machine's prize weights, three prizes to each of 4, 8, 16, 32 and 64 on a new game; not read by name in TBS. |
wonPrizes | s8 wonPrizes[0x10] | Lucky Wheels: 0 to 7 the prize categories won, ended by -1 (-2 once awarded); 8 on the last variant given of each category. |
unk13c | u8 unk13c[0x84] | not named by TBS code |
scene | s16 scene | |
entrance | s16 entrance | |
savedScene | s16 savedScene | where a defeat returns to without a defeat point |
savedEntrance | s16 savedEntrance | where a defeat returns to without a defeat point |
defaultScene | s16 defaultScene | the scene being run, kept as it starts |
defaultEntrance | s16 defaultEntrance | the entrance it was entered by |
sceneGroup | s16 sceneGroup | the current scene's group; a new group resets its flags |
nextScene | s16 nextScene | where the event sends the party next; -1 for none |
nextEntrance | s16 nextEntrance | where the event sends the party next; -1 for none |
defeatScene | s16 defeatScene | where a defeat returns to; -1 for none |
defeatEntrance | s16 defeatEntrance | where a defeat returns to; -1 for none |
special | s16 special | the battle backdrop chosen for the scene or terrain |
unk1d8 | u8 unk1d8[2] | not named by TBS code |
map | s16 map | the scene's map; SceneId_Clear for the world map |
x | s32 x | 16.16 fixed-point pixels |
y | s32 y | 16.16 fixed-point pixels |
z | s32 z | 16.16 fixed-point pixels |
heading | u32 heading | 1/65536 turns |
turn | u16 turn | the leader's terrainId, kept with its position |
sceneCue | s16 sceneCue | the battle music chosen for the encounter |
cue | s16 cue | the current scene's field music |
movementMode | u8 movementMode | 1 while the leader is climbing, 0 otherwise |
unk1f3 | u8 unk1f3 | not named by TBS code |
selectedActor | s32 selectedActor | the leader: its unit and its actor |
activeOwners | u8 activeOwners[8] | the party in order |
unk200 | u8 unk200[5] | not named by TBS code |
paletteGlow | u8 paletteGlow[2] | window hue (0 to 24), brightness |
unk207 | u8 unk207[3] | not named by TBS code |
speech | u8 speech | 1 shows speakers' portraits beside their messages |
unk20b | u8 unk20b | 1 on a new game; not read by name in TBS |
messageSpeed | u8 messageSpeed | 0 to 2; 1 on a new game |
unk20d | u8 unk20d[2] | not named by TBS code |
unk20f | u8 unk20f | Set on saving at the end of the game; copied to the file's summary as sendFlag. |
aKeys | u16 aKeys | The buttons for each field command, as KEY_ masks; read with gKeysPressed except dashKeys, held. @{ examine; KEY_A |
bKeys | u16 bKeys | KEY_B; not read by name in TBS |
selectKeys | u16 selectKeys | the menu; KEY_SELECT |
startKeys | u16 startKeys | KEY_START |
firstShortcutKeys | u16 firstShortcutKeys | firstShortcut; KEY_L |
secondShortcutKeys | u16 secondShortcutKeys | secondShortcut; KEY_R |
dashKeys | u16 dashKeys | KEY_B |
returnCue | s16 returnCue | @} music playing when the field left; -1 for none |
firstShortcut | u16 firstShortcut | The shortcuts' assignments. bits: 15..14 kind (0 Psynergy, 1 an item) | 13..0 which one. @{ |
secondShortcut | u16 secondShortcut | |
perspectiveScene | u8 perspectiveScene | @} set to 1 on the world map; not read by name in TBS |
unk225 | u8 unk225[5] | not named by TBS code |
idleSleepEnabled | u8 idleSleepEnabled | the option, saved from gIdleSleepEnabled |
battleStart | u8 battleStart | how the next battle starts (Battle_SetStart) |
hazardLimit | s16 hazardLimit | Hazardous ground (the Lamakan Desert's heat): every hazardLimit steps the party takes hazardDamage (bit 8 a flag, bits 7 to 0 the amount). @{ |
hazardMode | s16 hazardMode | 0 counts on hazard cells only; 1 counts every step |
hazardDamage | s16 hazardDamage | |
hazardSteps | s16 hazardSteps | reset on entering a new scene group |
pendingDjinnEvent | s16 pendingDjinnEvent | @} The Djinni battle pending (DJINNI_0 plus its number, flags in bits 15 to 11), resolved on returning to the field. |
sceneChangeReason | s16 sceneChangeReason | the last battle's result; -1 for a defeat |
encounterSteps | s32 encounterSteps | the encounter count, reset with a new group |
pendingItem | u16 pendingItem | given on returning to the field if the party has room |
sceneVariant | s16 sceneVariant | the current scene's variant from its record |
retreatScene | s16 retreatScene | where Retreat goes; the group's first entrance |
retreatEntrance | s16 retreatEntrance | where Retreat goes; the group's first entrance |
avoidDistance | s32 avoidDistance | distance left of Avoid, 16.16 pixels; 0 when off |
avoidByItem | s8 avoidByItem | Avoid came from an item (the Sacred Feather) |
pausedPose | s8 pausedPose | Halt: the stopped object's first animation param |
pausedObject | s16 pausedObject | Halt: the stopped object; -1 for none |
cloaked | s16 cloaked | 1 under Cloak, which prevents battles |
unk24e | u8 unk24e[2] | not named by TBS code |
pausedUpdate | u32 pausedUpdate | Halt: the stopped object's update; not read by name |
unk254 | u8 unk254[0x50] | not named by TBS code |
linkTallies | u16 linkTallies[8] | The link lobby's tallies: 4 the total wins and 7 the consecutive wins it reports, 3 cleared on choosing a monster battle; the others not named by TBS code. |
unk2b4 | u8 unk2b4[4] | not named by TBS code |
startStamp | u32 startStamp | Runtime_GetBuildStampTime's value at a new game |
unk2bc | u8 unk2bc[4] | not named by TBS code |
owners | struct BattleUnit owners[8] | the characters |
Used by BabiLighthouse_SetupScene, BattleFx_ResumeObject, ColossoWall_ApproachFinishAndTakeItem, Djinn_ResolvePendingEvent, Event_DouseStorm, Event_MeetCorona, Event_MeetHail, Event_MoveBlock, Event_PassNorthWallOpening, Event_PassSouthWallOpening, Event_RideMovingSidewalk, FieldEvent_AskYesNoAndShowResponse, Field_RequestDjinnBattle, Field_UsePsynergy, KalayTolbiDocks_TalkToTicketSeller, Party_AdjustCoins, SaveMenu_Run, TolbiSpring_RunSpringGame, Vale_GetPlacements, WorldMap_Initialize, gGameState.
Macros, without a comment: Battle_SetStart.
Globals, without a comment: gGameState.