Alchemy

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.

FieldDeclared as
buildStampu32 buildStampRuntime_GetBuildStampTime's value when the game was last saved; its low half goes into the file's summary.
playTimeu32 playTimeframes, copied from gPlayTimeFrames when saving
unk008u8 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.
coinss32 coins
unk014u8 unk014[0x104]The party's Djinn recovery list (struct DjinnRecoveryList), read through Djinn_GetRecoveryTable; not named by TBS code.
shopCredits32 shopCreditspent on a Game Ticket; not written by name in TBS
shopGiftss8 shopGiftsindexes the Game Ticket's credit cost
prizeWeightss8 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.
wonPrizess8 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.
unk13cu8 unk13c[0x84]not named by TBS code
scenes16 scene
entrances16 entrance
savedScenes16 savedScenewhere a defeat returns to without a defeat point
savedEntrances16 savedEntrancewhere a defeat returns to without a defeat point
defaultScenes16 defaultScenethe scene being run, kept as it starts
defaultEntrances16 defaultEntrancethe entrance it was entered by
sceneGroups16 sceneGroupthe current scene's group; a new group resets its flags
nextScenes16 nextScenewhere the event sends the party next; -1 for none
nextEntrances16 nextEntrancewhere the event sends the party next; -1 for none
defeatScenes16 defeatScenewhere a defeat returns to; -1 for none
defeatEntrances16 defeatEntrancewhere a defeat returns to; -1 for none
specials16 specialthe battle backdrop chosen for the scene or terrain
unk1d8u8 unk1d8[2]not named by TBS code
maps16 mapthe scene's map; SceneId_Clear for the world map
xs32 x16.16 fixed-point pixels
ys32 y16.16 fixed-point pixels
zs32 z16.16 fixed-point pixels
headingu32 heading1/65536 turns
turnu16 turnthe leader's terrainId, kept with its position
sceneCues16 sceneCuethe battle music chosen for the encounter
cues16 cuethe current scene's field music
movementModeu8 movementMode1 while the leader is climbing, 0 otherwise
unk1f3u8 unk1f3not named by TBS code
selectedActors32 selectedActorthe leader: its unit and its actor
activeOwnersu8 activeOwners[8]the party in order
unk200u8 unk200[5]not named by TBS code
paletteGlowu8 paletteGlow[2]window hue (0 to 24), brightness
unk207u8 unk207[3]not named by TBS code
speechu8 speech1 shows speakers' portraits beside their messages
unk20bu8 unk20b1 on a new game; not read by name in TBS
messageSpeedu8 messageSpeed0 to 2; 1 on a new game
unk20du8 unk20d[2]not named by TBS code
unk20fu8 unk20fSet on saving at the end of the game; copied to the file's summary as sendFlag.
aKeysu16 aKeysThe buttons for each field command, as KEY_ masks; read with gKeysPressed except dashKeys, held. @{ examine; KEY_A
bKeysu16 bKeysKEY_B; not read by name in TBS
selectKeysu16 selectKeysthe menu; KEY_SELECT
startKeysu16 startKeysKEY_START
firstShortcutKeysu16 firstShortcutKeysfirstShortcut; KEY_L
secondShortcutKeysu16 secondShortcutKeyssecondShortcut; KEY_R
dashKeysu16 dashKeysKEY_B
returnCues16 returnCue@} music playing when the field left; -1 for none
firstShortcutu16 firstShortcutThe shortcuts' assignments. bits: 15..14 kind (0 Psynergy, 1 an item) | 13..0 which one. @{
secondShortcutu16 secondShortcut
perspectiveSceneu8 perspectiveScene@} set to 1 on the world map; not read by name in TBS
unk225u8 unk225[5]not named by TBS code
idleSleepEnabledu8 idleSleepEnabledthe option, saved from gIdleSleepEnabled
battleStartu8 battleStarthow the next battle starts (Battle_SetStart)
hazardLimits16 hazardLimitHazardous ground (the Lamakan Desert's heat): every hazardLimit steps the party takes hazardDamage (bit 8 a flag, bits 7 to 0 the amount). @{
hazardModes16 hazardMode0 counts on hazard cells only; 1 counts every step
hazardDamages16 hazardDamage
hazardStepss16 hazardStepsreset on entering a new scene group
pendingDjinnEvents16 pendingDjinnEvent@} The Djinni battle pending (DJINNI_0 plus its number, flags in bits 15 to 11), resolved on returning to the field.
sceneChangeReasons16 sceneChangeReasonthe last battle's result; -1 for a defeat
encounterStepss32 encounterStepsthe encounter count, reset with a new group
pendingItemu16 pendingItemgiven on returning to the field if the party has room
sceneVariants16 sceneVariantthe current scene's variant from its record
retreatScenes16 retreatScenewhere Retreat goes; the group's first entrance
retreatEntrances16 retreatEntrancewhere Retreat goes; the group's first entrance
avoidDistances32 avoidDistancedistance left of Avoid, 16.16 pixels; 0 when off
avoidByItems8 avoidByItemAvoid came from an item (the Sacred Feather)
pausedPoses8 pausedPoseHalt: the stopped object's first animation param
pausedObjects16 pausedObjectHalt: the stopped object; -1 for none
cloakeds16 cloaked1 under Cloak, which prevents battles
unk24eu8 unk24e[2]not named by TBS code
pausedUpdateu32 pausedUpdateHalt: the stopped object's update; not read by name
unk254u8 unk254[0x50]not named by TBS code
linkTalliesu16 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.
unk2b4u8 unk2b4[4]not named by TBS code
startStampu32 startStampRuntime_GetBuildStampTime's value at a new game
unk2bcu8 unk2bc[4]not named by TBS code
ownersstruct 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.

Line 14

Macros, without a comment: Battle_SetStart.

Globals, without a comment: gGameState.

On this page