include/game/game.h
The game's rules and the tables they read: items, summons, abilities, Djinn, classes, elements, enemies, the game flags and the shops' rare item stock.
#include "types.h"#include "edition.h"#include "battle/battle_sprites.h"#include "battle/battle_unit.h"#include "game/item.h"#include "game/character_ids.h"#include "game/character.h"#include "game/game_functions.h"
Included by battle_effect_internal.h, ability_table.c, character_table.c, class_table.c, djinn_table.c, element_table.c, enemy_table.c, experience_table.c, item_table.c, rare_item_stock.c, starting_equipment.c, summon_table.c, menu_internal.h, title_intro.c, sound.c, system_internal.h, screen_tables.c, debug.h, script.h and system_call.h.
Structures
| Name | Description | |
|---|---|---|
struct | ELEMENT_LEVEL_BONUS | The elemental power and resistance of one element level, in ElementPowerResistByLevel, which gmUnitCalculateBaseElements reads by whole level, 0 to 15. |
Macros
| Name | Description | |
|---|---|---|
#define | DJINN_ALL_ELEMENTS -1 | gmPartySumDjinnCounts's element for a count of every element's Djinn. |
#define | ENEMY_DEFINITION_COUNT 165 | The enemies' rows (enemy_table.c), from ENEMY_ID_FIRST to the last Djinni, then a closing row named 0xff. |
#define | SUMMON_END 32 | Ends a list of summon ids (gmSummonListLearned); the battle summon list also writes it over each summon it has moved to the front. |
#define | HEALING_BASE_POWER 100 | The element power at which gmBattleCalculateRecovery's healing is neither stronger nor weaker: each point above it counts as two points of element difference. |
#define | BATTLE_MULTIPLIER_ONE 256 | The battle's multipliers are 256ths: this one keeps an amount as it is. |
Enumerations
| Name | Description | |
|---|---|---|
enum | LIGHTHOUSE_GROUP { LIGHTHOUSE_GROUP_VENUS_MARS, LIGHTHOUSE_GROUP_MERCURY_JUPITE … } | The lighthouses inside which a character's PP is refilled at an aerie (gmPartyRestorePpInLighthouse). |
enum | anonymous enum { RARE_ITEM_STOCK_COUNT, RARE_ITEM_STOCK_MAX } | How many rare items the shops keep a stock of, and the most of each. |
Functions
| Name | Description | |
|---|---|---|
void | gmMemoryCopyBytesDirectional (Uint8 *first, Uint8 *second, Sint32 count, Sint32 direction) | Unused: copies count bytes from first to second when direction is set, and from second to first otherwise. |
const ITEM_DEFINITION * | gmInventoryGetEquippedDefinition (UNIT *unit, Sint32 type) | Returns the definition of the unit's equipped item of type, or NULL. |
Sint32 | gmRareItemStockAdjust (Sint32 index, Sint32 delta) | Adds delta to the shops' stock of rare item index, kept between 0 and RARE_ITEM_STOCK_MAX, and returns the new count (0 for an index from RARE_ITEM_STOCK_COUNT on). |
const CHARACTER_DEFINITION * | gmCharacterGetDefinition (Sint32 characterId) | Returns character characterId's definition: growth curves, starting level and equipment. |
LEVEL_UP_RESULT * | gmUnitLevelUp (Sint32 unitId, LEVEL_UP_RESULT *gains) | Raises a character one level, up to 99, each base stat growing along its curve with a random part. |
Sint32 | gmClassGetSeries (Sint32 primaryElement, Sint32 secondaryElement) | Returns the class series of a character whose strongest element is primaryElement and second secondaryElement, from the ELEMENT_COUNT by ELEMENT_COUNT table. |
Sint32 | gmUnitGetElementLevels (Sint32 unitId, const Uint8 *djinnHeld, Sint32 output[4]) | Writes each element level in tenths (ELEMENT_LEVEL_SCALE): an enemy's from its preset, a character's from the Djinn set on it plus its own bonus. |
Sint32 | gmEnemyGetAttackElement (UNIT *unit) | Returns the element an enemy attacks with, from its element preset. |
UNREAD_RESULT | gmUnitCalculateBaseElements (Sint32 unitId, BATTLE_ELEMENT_STATS *dest) | Writes a unit's base Power and Resist in each element, from its element levels. |
Sint32 | gmClassDetermine (Sint32 character, const Uint8 *djinn) | Returns the class a character has with these Djinn (UNIT.djinnHeld): the series of its two strongest elements, and the last class of it whose requirements it meets. |
CLASS_DEFINITION * | gmClassGetDefinition (Sint32 classId) | Returns class classId's definition: its series, element requirements, stat multipliers and the Psynergy it teaches by level. |
Sint32 | gmBattleGetElementMultiplier (Sint32 difference, Sint32 halve) | Returns the multiplier, 256 for 1x, for an element difference (power less resistance): 256 plus 1.28 a point, the difference held to -200 to 200, its effect half with halve. |
Uint32 | gmBattleRandomPercent (void) | Returns a battle random number from 0 to 99. |
Sint32 | gmBattleGetEffectBaseSuccessRate (Sint32 effectId) | Returns the base chance in percent of an effect; a negative one is fixed, and effects not listed always work. |
Bool | gmBattleAbilityIsWeakToEffect (const UNIT *target, Sint32 effectId) | Returns 1 when the unit is weak to the effect: one of those its enemy kind or class lists. |
const DJINN_DEFINITION * | gmDjinnGetDefinition (Uint32 element, Uint32 djinni) | Returns the definition of Djinni djinni of element; anything out of range gives DJINNI_FLINT's. |
void | gmInventoryAddAndEquip (Sint32 unitId, Sint32 itemId) | Gives a unit itemId and equips every exactly matching inventory entry. |
Variables
| Name | Description | |
|---|---|---|
extern const ITEM_DEFINITION | ItemDefinitionTable [] | The 324 items by item id (item_table.c), read through gmItemGetDefinition. |
extern const SUMMON_DEFINITION | SummonDefinitionTable [] | The 16 summons (summon_table.c) by summon id, the numbers SummonOrderList lists; read through gmSummonDefinitionGetNearStub. |
extern const ABILITY_DEFINITION | AbilityDefinitions [] | The 519 abilities by ability id (ability_table.c). |
extern const Uint8 | CharacterLighthouseGroupTable [] | Each character's LIGHTHOUSE_GROUP. |
extern const Uint32 | CharacterLevelExpTable [] | The experience each character needs for levels 1 to 99, 99 words a character (gmUnitGetExperienceForLevel). |
extern const Sint32 | CharacterNewGameIds [6] | Isaac, Garet, Ivan, Mia and Jenna, ended by -1: the characters gmPartyInitCharacters equips with their definitions' items at a new game. |
extern const Sint16 | DjinnElementSprites [] | The Djinni sprite of each element, SPRITE_VENUS_DJINNI to SPRITE_JUPITER_DJINNI, whose picture mnDjinnShowJoinedMessage shows as the portrait. |
extern ELEMENT_LEVEL_BONUS | ElementPowerResistByLevel [16] | The power and resistance by element level (element_table.c); nothing writes it, though it is not declared const. |
extern const Sint32 | ClassSeriesByElements [] | The class series by a character's strongest and second element, a 4 by 4 table read as [strongest * 4 + second] (gmClassGetSeries). |
extern const DJINN_DEFINITION | DjinnDefinitionTable [] | The 80 Djinn, 20 of each element in element order (djinn_table.c). |
extern const Sint16 | ElementPowerResistCurve [5][2] | Pairs of an element difference (power less resistance) and what it adds to the multiplier in 256ths (256 = 1x), from 200 (+256) down to -200 (-256); gmBattleGetElementMultiplier interpolates and adds 256. |
extern const ENEMY_DEFINITION | EnemyDefinitions [ENEMY_DEFINITION_COUNT] | The enemies, by enemy id less ENEMY_ID_FIRST. |
extern const ENEMY_ELEMENT_PRESET | EnemyElementPresetTable [] | The enemies' element presets (element_table.c): attack element, levels and base power and resistance. |
extern Uint8 | GameFlagBytes [] | The game flags, 4096 bits in 512 bytes, saved with the game: flag n is bit n & 7 of byte GAME_FLAG_BYTE(n). |
extern Uint16 | InventorySnapshotWork [] | The party's equipment put aside while the Colosso takes it away: a sentinel, four 15-slot inventories, the two shortcuts and the party order. |
extern Uint8 | RareItemStock [RARE_ITEM_STOCK_COUNT] | How many of each rare item the shops' Artifacts offer, 0 to RARE_ITEM_STOCK_MAX, by stock number (ItemRareItemStockIndex; gmRareItemStockAdjust). |
extern Uint8 | BattleArenaSaveStamp [] | The 64-byte save stamp, in the first half of the save buffer, that the Battle Arena writes into the current file alone. |
extern const Uint8 | ItemRareItemStockIndex [] | Each item's place in RareItemStock plus one, or 0 for an item the shops keep no stock of (gmItemAdjustRareItemStock). |
extern const Sint16 | CharacterSpriteTable [] | Each party member's sprite, by character; Piers, who has none, keeps his character number. |
extern const Sint16 | CharacterChildSpriteTable [] | Each party member's sprite during the prologue (FLAG_CHILDHOOD): SPRITE_ISAAC_CHILD, SPRITE_GARET_CHILD, SPRITE_FELIX_CHILD and SPRITE_JENNA_CHILD in place of their own. |
extern const Uint8 | SummonOrderList [16] | The summon ids in menu order (gmSummonListLearned). |
Description
The game's rules and the tables they read: items, summons, abilities, Djinn, classes, elements, enemies, the game flags and the shops' rare item stock.
Macros in detail
DJINN_ALL_ELEMENTS
#define DJINN_ALL_ELEMENTS -1
gmPartySumDjinnCounts's element for a count of every element's Djinn.
Referenced by gmPartySumDjinnCounts(), mnBattleStatusScreenRun(), mnFieldMenuSelectCommand(), mnStatusScreenDrawStatusPage(), mnStatusScreenRun() and mnStatusScreenRunStatusPage().
Definition at line 79 of file game.h.
ENEMY_DEFINITION_COUNT
#define ENEMY_DEFINITION_COUNT 165
The enemies' rows (enemy_table.c), from ENEMY_ID_FIRST to the last Djinni,
then a closing row named 0xff.
Referenced by EnemyDefinitions, gmBattleUnitSet() and gmEnemyGetDefinition().
Definition at line 86 of file game.h.
SUMMON_END
#define SUMMON_END 32
Ends a list of summon ids (gmSummonListLearned); the battle summon list also
writes it over each summon it has moved to the front.
Referenced by gmSummonListLearned() and mnBattleSummonMenuRun().
Definition at line 126 of file game.h.
HEALING_BASE_POWER
#define HEALING_BASE_POWER 100
The element power at which gmBattleCalculateRecovery's healing is neither
stronger nor weaker: each point above it counts as two points of element
difference.
Referenced by gmBattleCalculateRecovery() and mnAbilityApplyToTargets().
Definition at line 153 of file game.h.
BATTLE_MULTIPLIER_ONE
#define BATTLE_MULTIPLIER_ONE 256
The battle's multipliers are 256ths: this one keeps an amount as it is.
Referenced by gmBattleCalculateAttackDamage(), gmBattleCalculatePsynergyPower(), gmBattleCalculateRecovery(), gmBattleGetElementMultiplier() and mnAbilityApplyToTargets().
Definition at line 155 of file game.h.
Enumerations in detail
LIGHTHOUSE_GROUP
enum LIGHTHOUSE_GROUP
The lighthouses inside which a character's PP is refilled at an aerie
(gmPartyRestorePpInLighthouse).
| Enumerator | Value | Description |
|---|---|---|
LIGHTHOUSE_GROUP_VENUS_MARS | Isaac, Garet, Felix and Jenna | |
LIGHTHOUSE_GROUP_MERCURY_JUPITER | Ivan, Mia, Sheba and Piers |
Definition at line 39 of file game.h.
anonymous enum
enum { RARE_ITEM_STOCK_COUNT, RARE_ITEM_STOCK_MAX }
How many rare items the shops keep a stock of, and the most of each.
| Enumerator | Value | Description |
|---|---|---|
RARE_ITEM_STOCK_COUNT | 128 | |
RARE_ITEM_STOCK_MAX | 99 |
Definition at line 99 of file game.h.
Variables in detail
GameFlagBytes
extern Uint8 GameFlagBytes[]
The game flags, 4096 bits in 512 bytes, saved with the game: flag n is bit n
& 7 of byte GAME_FLAG_BYTE(n).
Referenced by gmFlagClear(), gmFlagDecrementByte(), gmFlagGet(), gmFlagGetByte(), gmFlagGetNibble(), gmFlagIncrementByte(), gmFlagSet(), gmFlagSetByte(), gmFlagSetNibble(), gmFlagToggle(), gmMainRoutineStateInitDefaults() and mnSaveBuildFileSummary().
Definition at line 93 of file game.h.
InventorySnapshotWork
extern Uint16 InventorySnapshotWork[]
The party's equipment put aside while the Colosso takes it away: a sentinel, four 15-slot inventories, the two shortcuts and the party order.
Referenced by gmInventorySnapshotRestore(), gmInventorySnapshotSave() and mnSaveBuildFileSummary().
Definition at line 96 of file game.h.
RareItemStock
extern Uint8 RareItemStock[RARE_ITEM_STOCK_COUNT]
How many of each rare item the shops' Artifacts offer, 0 to
RARE_ITEM_STOCK_MAX, by stock number (ItemRareItemStockIndex;
gmRareItemStockAdjust).
Referenced by gmRareItemStockAdjust().
Definition at line 108 of file game.h.
BattleArenaSaveStamp
extern Uint8 BattleArenaSaveStamp[]
The 64-byte save stamp, in the first half of the save buffer, that the Battle Arena writes into the current file alone.
Referenced by mnSaveWriteLinkTallies().
Definition at line 111 of file game.h.