Skip to Content
The Alchemy Project

include/game/game.h

The game's rules and data as the battles, the field and the menus share them: the tables of items, abilities, summons, Djinn, characters and enemies, the field Psynergy each ability casts, and the game module's functions the other modules call.

Included by battle_internal.h, battle_effect_internal.h, psynergy_test.c, psynergy_test_2.c, shop_test.c, test_scenes.c, field_engine_internal.h, field_internal.h, field_psynergy_internal.h, lucky_dice.c, psynergy_reach.c, script_commands_internal.h, super_lucky_dice.c, game_internal.h, credits.c, menu_internal.h, airs_rock.c, airs_rock_inside.c, alhafra.c, alhafra_manor.c, alhafra_rooms.c, alhafran_cave.c, ancient_lemuria.c, anemos_inner_sanctum.c, anemos_inner_sanctum_dullahan.c, ankohl_ruins.c, apojii_islands_cave.c, aqua_rock.c, aqua_rock_inside.c, atteka_inlet.c, caverns.c, champa.c, champa_cliff_caves.c, champa_rooms.c, champa_sanctum.c, clear.c, contigo.c, daila.c, daila_rooms.c, dehkan_plateau.c, eastern_alhafra.c, eastern_alhafra_ship.c, epilogue.c, gabomba_catacombs.c, gabomba_statue.c, gabomba_statue_chamber.c, gaia_rock.c, gaia_rock_inside.c, garoh.c, garoh_rooms.c and 74 more.

Structures

NameDescription
structELEMENT_LEVEL_BONUSThe elemental power and resistance of one element level, in ElementPowerResistByLevel.

Macros

NameDescription
#defineDRAGON_ENEMY_COUNT 47How many enemies EnemyDragonIds and EnemySeaCreatureIds list.
#defineSEA_CREATURE_ENEMY_COUNT 29
#defineSUMMON_COUNT 29How many summons there are (summon_table.c), and the number that ends a list of them (gmSummonListLearned).
#defineSUMMON_END 32Ends the summon lists, and marks a summon already moved to the front.
#defineINVENTORY_SNAPSHOT_SPARE 392Where InventorySnapshot's spare space begins, past the party's equipment gmInventorySnapshotSave keeps and the Trial Road's state: the scenes keep their own state there (scene/flame_throwers.h's FLAME_THROWERS_STATE).

Enumerations

NameDescription
enumFIELD_PSY { FIELD_PSYNERGY_MOVE, FIELD_PSYNERGY_MIND_READ, FIELD_PSYNERG … }What a Psynergy does when cast on the field (an ability's fieldPsynergy), each named for the abilities that have it in the English release.
enumFIELD_PSYNERGY_HANDLER { FIELD_PSYNERGY_HANDLER_UNTARGETED, FIELD_PSYNERGY_HANDLER_ON … }A step of the current field Psynergy (fdPsynergyRunHandler).
enumSUMMON_ID { SUMMON_VENUS, SUMMON_MERCURY, SUMMON_MARS, SUMMON_JUPITER, S … }The summons by summon id, each named for its ability, in the order of SummonAbilities (summon_table.c): the elements' own four, The Broken Seal's twelve, then this game's thirteen.

Functions

NameDescription
voidbtDjinnRecoverAllStub (void)Counts the Djinn recovery down twenty times, setting every recovering Djinni of a party member with HP (btDjinnRecoverAll).
Sint32gmDjinnGiveStub (Sint32 unitId, Sint32 element, Sint32 djinnIndex)Gives a Djinni to a unit.
voidfdPartyClearUnusableShortcutsStub (void)Clears each button shortcut whose Psynergy can no longer be cast (fdPartyClearUnusableShortcuts).
Sint32gmInventoryAddItemStub (Sint32 unitId, Sint32 itemId)Gives a unit one item, joining its first matching stack (up to INVENTORY_STACK_MAX) or taking the first free slot.
Sint32gmInventoryRemoveStub (Sint32 owner, Sint32 slot)Takes one item out of slot, closing up the inventory when it was the last.
voidgmUnitCalculateBaseElements (Sint32 unitId, BATTLE_ELEMENT_STATS *dest)A unit's base power and resistance in each element (game_classes.c).
Sint32gmClassDetermine (Sint32 character, Uint32 *djinn, Sint32 item)The class a character has with these Djinn and its class-changing item (game_classes.c).
Sint32gmUnitGetElementLevels (Sint32 characterOrEnemy, const Uint8 *djinn, Sint32 *output)A unit's level in each element (game_classes.c).
Sint32gmUnitRebuildPsynergyList (Sint32 owner)Rebuilds a character's Psynergy list from what it learned, its class and its items (game_levels.c).
voidmnMessageDecodeRawUnboundedStub (Sint32 msg, Uint16 *text)Decodes message into text with no length limit (mnMessageDecodeRawUnbounded).
const CHARACTER_DEFINITION *gmCharacterGetDefinition (Sint32 character)Returns character index's definition: growth curves, starting level and equipment.
voidgmPartyBalanceDjinn (void)Moves Djinn between the party members until each holds within one of the others.

Variables

NameDescription
extern const ITEM_DEFINITIONItemDefinitionTable []The definitions of the items (item_table.c) and the summons (summon_table.c).
extern const SUMMON_DEFINITIONSummonDefinitionTable []The 29 summons, by summon id, read through gmSummonDefinitionGetNearStub.
extern const Uint16EnemyDragonIds [DRAGON_ENEMY_COUNT]The dragons, by enemy id: the Hydras, Serpents, Dinos, Dragons, Lizards, Chimeras and the Doom Dragon.
extern const Uint16EnemySeaCreatureIds [SEA_CREATURE_ENEMY_COUNT]The sea creatures, by enemy id: the Cuttles, Jellies, Hydras, Poseidon, the shells and urchins, the Mermen, the sea Dragons, the Seabirds, the Lizard Men and the Kraken.
extern const ABILITY_DEFINITIONAbilityDefinitions []The definitions of the abilities, the Djinn and the enemies (the enemies' in enemy_table.c).
extern const DJINN_DEFINITIONDjinnDefinitionTable []The 80 Djinn, 20 of each element in element order.
extern const ENEMY_DEFINITIONEnemyDefinitions []
extern const Uint8SummonOrderList [SUMMON_COUNT]The summons in the order the Summon command lists them (summon_table.c).
extern const Uint32CharacterLevelExpTable []The experience each character needs for each level (experience_table.c).
extern const Sint16ElementPowerResistCurve [5][2]The curve gmBattleGetElementMultiplier reads an element's power against a resistance on, and the enemies' element presets (element_table.c).
extern const ENEMY_ELEMENT_PRESETEnemyElementPresetTable []The 48 enemy element presets, by ENEMY_DEFINITION.elementPreset; each is named by the enemies that have it, in the English release's words.
extern const CHARACTER_DEFINITIONCharacterDefinitionTable []The characters' definitions, and those a new game gives their starting equipment.
extern const Sint32CharacterNewGameIds []The characters gmPartyInitCharacters gives their starting equipment, ended by -1.
extern const Uint16ItemRareItemCounters [512]Each item's rare item counter number plus one, 0 for an ordinary item (rare_item_stock.c).
extern const Uint8CharacterElementGroupTable []Each character's element group (experience_table.c).
extern const Sint16DjinnElementSprites []The Djinni sprite of each element, SPRITE_VENUS_DJINNI to SPRITE_JUPITER_DJINNI, whose picture mnDjinnShowJoinedMessage shows as the portrait.
extern const Sint16CharacterSpriteTable []Each party member's sprite, by character; each is the character's own id.
extern const Sint32ClassSeriesByElements [4][4]The class series by a character's strongest and second element (element_table.c).
extern const Uint8NewGameSceneStateTable [4][5]Four rows of five numbers a new game copies after RareItemStock, which nothing is known to read (rare_item_stock.c).
extern const Uint16DataTransferFlags [TRANSFERRED_FLAG_COUNT]What "Transfer data from Golden Sun" takes from The Broken Seal's save: the flags it copies, and the chance of each of its Djinn being handed out when the player transfers none (experience_table.c).
extern const Sint16DataTransferDjinnChances [ELEMENT_COUNT] [TRANSFERRED_DJINN_PER_ELEMENT]The percent chance that gmDataTransferGiveDefaultDjinn hands out each of The Broken Seal's seven Djinn of each element, one row per element.

Description

The game's rules and data as the battles, the field and the menus share them: the tables of items, abilities, summons, Djinn, characters and enemies, the field Psynergy each ability casts, and the game module's functions the other modules call.

Macros in detail

DRAGON_ENEMY_COUNT

#define DRAGON_ENEMY_COUNT 47

How many enemies EnemyDragonIds and EnemySeaCreatureIds list.

Referenced by EnemyDragonIds and gmEnemyIsDragon().

Definition at line 88 of file game.h.

SEA_CREATURE_ENEMY_COUNT

#define SEA_CREATURE_ENEMY_COUNT 29

Referenced by EnemySeaCreatureIds and gmEnemyIsSeaCreature().

Definition at line 89 of file game.h.

SUMMON_COUNT

#define SUMMON_COUNT 29

How many summons there are (summon_table.c), and the number that ends a list of them (gmSummonListLearned).

Referenced by gmSummonDefinitionGetNear(), gmSummonListLearned() and SummonOrderList.

Definition at line 129 of file game.h.

SUMMON_END

#define SUMMON_END 32

Ends the summon lists, and marks a summon already moved to the front.

Referenced by gmSummonListLearned(), mnBattleSummonMenuRun(), mnSummonShowLearnedMessage(), SummonAbilities and SummonUnusedElements.

Definition at line 168 of file game.h.

INVENTORY_SNAPSHOT_SPARE

#define INVENTORY_SNAPSHOT_SPARE 392

Where InventorySnapshot's spare space begins, past the party's equipment gmInventorySnapshotSave keeps and the Trial Road's state: the scenes keep their own state there (scene/flame_throwers.h's FLAME_THROWERS_STATE).

Definition at line 215 of file game.h.

Enumerations in detail

FIELD_PSY

enum FIELD_PSY

What a Psynergy does when cast on the field (an ability's fieldPsynergy), each named for the abilities that have it in the English release. The field effect it starts keeps it as its animation.

EnumeratorValueDescription
FIELD_PSYNERGY_MOVE1
FIELD_PSYNERGY_MIND_READ2
FIELD_PSYNERGY_PLY3
FIELD_PSYNERGY_FORCE4
FIELD_PSYNERGY_DOUSE5
FIELD_PSYNERGY_FROST6
FIELD_PSYNERGY_LIFT7
FIELD_PSYNERGY_REVEAL8
FIELD_PSYNERGY_HALT9
FIELD_PSYNERGY_CLOAK10
FIELD_PSYNERGY_CARRY11
FIELD_PSYNERGY_GROWTH12
FIELD_PSYNERGY_CATCH13
FIELD_PSYNERGY_WHIRLWIND14Whirlwind and Gale.
FIELD_PSYNERGY_RETREAT15
FIELD_PSYNERGY_AVOID16
FIELD_PSYNERGY_LASH17
FIELD_PSYNERGY_POUND18
FIELD_PSYNERGY_TREMOR19
FIELD_PSYNERGY_SCOOP20
FIELD_PSYNERGY_BURST21
FIELD_PSYNERGY_PARCH22
FIELD_PSYNERGY_SAND23
FIELD_PSYNERGY_HOVER24
FIELD_PSYNERGY_CYCLONE25
FIELD_PSYNERGY_BLAZE26
FIELD_PSYNERGY_GRIND27
FIELD_PSYNERGY_RING28The two abilities whose names are question marks.
FIELD_PSYNERGY_ARROW29
FIELD_PSYNERGY_TELEPORT30

Definition at line 24 of file game.h.

FIELD_PSYNERGY_HANDLER

enum FIELD_PSYNERGY_HANDLER

A step of the current field Psynergy (fdPsynergyRunHandler).

EnumeratorValueDescription
FIELD_PSYNERGY_HANDLER_UNTARGETED0Casts it with no target (fdPsynergyRun).
FIELD_PSYNERGY_HANDLER_ON_TARGET1Casts it on its target, secondActorId (fdPsynergyDispatch).
FIELD_PSYNERGY_HANDLER_END_MIND_READ2Ends it, when it is Mind Read (fdPsynergyFinishMindRead).
FIELD_PSYNERGY_HANDLER_END3Ends a lasting one, Reveal, Cloak, Avoid, Sand, Hover or the Ring (fdPsynergyRunEnd).

Definition at line 61 of file game.h.

SUMMON_ID

enum SUMMON_ID

The summons by summon id, each named for its ability, in the order of SummonAbilities (summon_table.c): the elements' own four, The Broken Seal's twelve, then this game's thirteen.

EnumeratorValueDescription
SUMMON_VENUS
SUMMON_MERCURY
SUMMON_MARS
SUMMON_JUPITER
SUMMON_RAMSES
SUMMON_NEREID
SUMMON_KIRIN
SUMMON_ATALANTA
SUMMON_CYBELE
SUMMON_NEPTUNE
SUMMON_TIAMAT
SUMMON_PROCNE
SUMMON_JUDGMENT
SUMMON_BOREAS
SUMMON_METEOR
SUMMON_THOR
SUMMON_ZAGAN
SUMMON_MEGAERA
SUMMON_FLORA
SUMMON_MOLOCH
SUMMON_ULYSSES
SUMMON_HAURES
SUMMON_ECLIPSE
SUMMON_COATLICUE
SUMMON_DAEDALUS
SUMMON_AZUL
SUMMON_CATASTROPHE
SUMMON_CHARON
SUMMON_IRIS

Definition at line 134 of file game.h.

Functions in detail

btDjinnRecoverAllStub

void btDjinnRecoverAllStub(void)

Counts the Djinn recovery down twenty times, setting every recovering Djinni of a party member with HP (btDjinnRecoverAll).

Referenced by gmDjinnSetAllForParty().

Definition at line 100 of file game.h.

gmDjinnGiveStub

Sint32 gmDjinnGiveStub(Sint32 unitId, Sint32 element, Sint32 djinnIndex)

Gives a Djinni to a unit.

Referenced by btDebugParamSetLoad(), mnDjinnMenuDrawStatPreview(), mnDjinnMenuRunPreview() and mnDjinnSetFoundFlagAndAdd().

Definition at line 102 of file game.h.

fdPartyClearUnusableShortcutsStub

void fdPartyClearUnusableShortcutsStub(void)

Clears each button shortcut whose Psynergy can no longer be cast (fdPartyClearUnusableShortcuts).

Referenced by gmInventoryDiscard(), mnDjinnMenuRun(), mnItemMenuRun(), mnItemMenuRunCommands() and mnPsynergyMenuRun().

Definition at line 105 of file game.h.

gmInventoryAddItemStub

Sint32 gmInventoryAddItemStub(Sint32 unitId, Sint32 itemId)

Gives a unit one item, joining its first matching stack (up to INVENTORY_STACK_MAX) or taking the first free slot.

Referenced by btDebugParamSetLoad(), fdInventoryTryAddAndReturnMember(), mnDebugWarpArafura2(), mnDebugWarpJupiter(), mnItemMenuRunCommands(), mnShopBuyDone(), mnShopGiveGameTicket(), mnShopOpenDebugShop() and mnShopSelectBuy().

Definition at line 108 of file game.h.

gmInventoryRemoveStub

Sint32 gmInventoryRemoveStub(Sint32 owner, Sint32 slot)

Takes one item out of slot, closing up the inventory when it was the last.

Referenced by btDebugParamSetLoad(), btStagingRunItem(), fdUseItem(), mnForgeOfferItem(), mnInventoryMakeRoom(), mnItemMenuRunCommands(), mnItemUse(), mnShopGiveGameTicket() and mnShopSelectBuy().

Definition at line 110 of file game.h.

mnMessageDecodeRawUnboundedStub

void mnMessageDecodeRawUnboundedStub(Sint32 msg, Uint16 *text)

Decodes message into text with no length limit (mnMessageDecodeRawUnbounded).

Referenced by btLinkBattleReceiveParty() and gmPartyInitCharacters().

Definition at line 125 of file game.h.