Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
game_state.h File Reference

The game state: modes, party, items, cards, flags (game/) More...

#include "common.h"
#include <sys/types.h>
#include <libgte.h>
#include <libgpu.h>
#include "engine/gfx.h"
#include "engine/story.h"
Include dependency graph for game_state.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GameFuncs
 The game state's methods (GAME.funcs) More...
 
struct  GameFlags
 FLAGS_00, the first flag bitset, followed by the event functions: FIELDSTG and the stages call them through here (+0xC applies an action, +0x10 checks a condition). More...
 
struct  DigimonData
 Digimon definition (DIGIMON_DATA, 52 of them; the first 8 are the partners) More...
 
struct  TechData
 A technique (TECHS, from 1: technique n is TECHS[n - 1]) More...
 
struct  WeaponData
 ItemInfo.data's record for a weapon (types 2-14, WEAPON_DATA) More...
 
struct  ArmorData
 An armour's (types 15-20, ARMOR_DATA) More...
 
struct  AccessoryData
 An accessory's (types 21-24, ACCESSORY_DATA) More...
 
union  ItemData
 ItemInfo.data's record, by ItemInfo.type. More...
 
struct  ItemEffect
 What a usable item does (its ItemInfo.data, an ITEM_EFFECT_*) More...
 
union  ItemRecord
 What ItemInfo.data points to: a weapon's, an armour's or an accessory's record, or a usable item's effect. More...
 
struct  ItemInfo
 An item (ITEMS, ITEM_FUNCS) More...
 
struct  PartnerEntry
 One of a partner's Digimon (getPartnerEntry, setPartnerEntry) More...
 
struct  EquipSet
 A partner's equipment set: the four items computeStats compares with equip[0-3]. More...
 
struct  Deck
 A card deck. More...
 
struct  PartnerStats
 A partner Digimon from its name on (Partner.info), as getPartnerStats gives it. More...
 
struct  PartnerEquip
 PartnerStats.equip as a whole: STSTATUS and STITSHOP save it with a struct copy before they equip an item to compute the stats with it, and put it back. More...
 
struct  StatBlock
 PartnerStats' stats[] and the status[] after them as one block, which computeStats and STITSHOP_computeStats copy whole. More...
 
struct  PlayTime
 GameState's play time, which a memory card save copies whole. More...
 
struct  PartnerAnim
 A partner Digimon's animation in a menu: up to seven sprite ids, -1 ending it early (the sprites are each overlay's own) More...
 
struct  Partner
 One of the eight partner Digimon. More...
 
struct  BattleEnemy
 An enemy of a battle (FIELDSTG's encounter table points to these) More...
 
struct  BattleSetup
 The next battle: FIELDSTG_startEncounter fills it (the stage select its first words), FIGHTSTG and WFIGHTMN read it; the gauges carry over from battle to battle. More...
 
struct  BattleResult
 What the battle left for the report (BATTLE_RESULT, cleared by WFIGHTMN) More...
 
union  PartnerTotals
 computeStats' result: the stats with the equipment added, by STAT_* or by name. More...
 
struct  GameState
 The game state (GAME): the first 0x26BC bytes are what newGame clears (the save data), then the current game mode and the methods. More...
 
struct  SpecialCondition
 A special condition (SPECIAL(id)): checkSpecialCondition runs the check function of kind check >> 4 (checkItemSet, checkPartner, ...) with check & 0xF and arg. More...
 
struct  ItemFuncs
 The item functions (ITEM_FUNCS) More...
 

Macros

#define FLAG(group, id)   ((group) << 8 | (id))
 The codes of the (code, value) pairs that FLAGS_00 checks as conditions and applies as actions (events.c's checkCondition and applyAction): the talks' and characters' lists, which end with CODES_END, and a StageSlot's two conditions, CODES_END for none.
 
#define PROGRESS(n)   (0x6000 | (n))
 GAME.progress is n.
 
#define SPECIAL(id)   (0x7000 | (id))
 SPECIAL_CONDITIONS entry id.
 
#define PARTY_STAT(id)   (0x7200 | (id))
 checkPartyStat
 
#define EVENT_BATTLE(id)   (0x7400 | (id))
 action: FIELDSTG_battleFuncs.startEventBattle
 
#define CARD_BATTLE(opponent, kind)   ((0x7600 + (kind) * 0x200) | (opponent))
 action: startCardBattle
 
#define PLACE(n)   (0x7E00 | ((n) - 1))
 the place and its argument the last exit or warp set (checkWarpArg): the numbers of the stage's StagePoints, place 1-30
 
#define PLACE_ARG(n)   (0x7E00 | ((n) + 29))
 GAME.placeArg is n.
 
#define ITEM(kind, id)   (0x8000 | (kind) << 9 | (id))
 an item, in the bag or equipped; kind (bits 9-11) isn't read, and the scripts set it after the item's kind loosely
 
#define START_EVENT(index)   (0x9000 | (index))
 action: FIELDSTG_startListedEvent
 
#define CARD(id)   (0x9200 | (id))
 a card: the player has one, or gets or loses one
 
#define CODES_END   0xFFFF
 
#define EQUIP_KIND_RIGHT_HAND   1
 Where an equipment item goes (its record's kind), as the shop's and STSTATUS's strings name the kinds: the slots of PartnerStats.equip are 0 head, 1 body, 2 right hand, 3 left hand, 4 and 5 accessories.
 
#define EQUIP_KIND_LEFT_HAND   2
 
#define EQUIP_KIND_EITHER_HAND   3
 
#define EQUIP_KIND_HEAD   4
 
#define EQUIP_KIND_BODY   5
 
#define EQUIP_KIND_ACCESSORY   6
 
#define EQUIP_KIND_BOTH_HANDS   7
 takes slots 2 and 3
 
#define EQUIP_KIND_GROUP_ACCESSORY   8
 one of its group at a time
 
#define ITEM_USE_MENU   1
 ItemEffect.flags.
 
#define ITEM_USE_BATTLE   2
 usable in battle (FIGHTSTG's item menu)
 
#define ITEM_CARD_PACK   4
 on the card boosters, which nothing tests it on
 
#define ITEM_KIND_KEY   1
 ItemInfo.kind: the item list (ITEM_LISTS) an item is in, from 1.
 
#define ITEM_KIND_USABLE   2
 
#define ITEM_KIND_WEAPON   3
 
#define ITEM_KIND_ARMOR   4
 
#define ITEM_KIND_ACCESSORY   5
 
#define IS_WEAPON_TYPE(type)   ((u8)((type) - 2) < 13)
 ItemInfo.type's ranges: 2-14 weapons, 15-20 armour, 21-24 accessories, each tested as one unsigned byte compare.
 
#define IS_ARMOR_TYPE(type)   ((u8)((type) - 15) < 6)
 
#define IS_ACCESSORY_TYPE(type)   ((u8)((type) - 21) < 4)
 
#define PARTNER_ENTRY_COUNT   44
 The Digimon a partner can have, and the ones it takes to battle.
 
#define PARTNER_SLOT_COUNT   3
 
#define FIRST_ENTRY_ID   3
 The first PartnerEntry.id of a Digimon: 0 is a free entry, 1 and 2 unused ones.
 
#define SKILL_ID   0x1FFF
 PartnerEntry.skills.
 
#define SKILL_KNOWN   0x2000
 
#define SKILL_MARKED   0x4000
 marked in the lab (STGDGLAB_updateSkillPanel)
 
#define SKILL_LAST   0x8000
 the sixth skill
 
#define DECK_SIZE   40
 The cards of a deck, and the decks the player has.
 
#define DECK_COUNT   3
 
#define CARD_COPIES_MAX   9
 The copies of a card the player can have.
 
#define STAT_LEVEL   0
 Indices of a partner's stats (PartnerStats.stats, computeStats, setStat)
 
#define STAT_TP   1
 what the training's intensities cost
 
#define STAT_HP   2
 
#define STAT_MAX_HP   3
 
#define STAT_MP   4
 
#define STAT_MAX_MP   5
 
#define STAT_STRENGTH   6
 the six battle stats
 
#define STAT_DEFENSE   7
 
#define STAT_SPIRIT   8
 
#define STAT_WISDOM   9
 
#define STAT_SPEED   10
 
#define STAT_CHARISMA   11
 
#define STAT_RESISTS   12
 the first of the seven resistances
 
#define STAT_COUNT   19
 
#define BATTLE_BLOCK_POISON   0
 BattleSetup.blocks' indices: the encounter keeps the player from inflicting a status, draining, stealing, lowering a stat of the enemy's or running away.
 
#define BATTLE_BLOCK_PARALYSIS   1
 
#define BATTLE_BLOCK_CONFUSION   2
 
#define BATTLE_BLOCK_SLEEP   3
 
#define BATTLE_BLOCK_KNOCK_OUT   4
 
#define BATTLE_BLOCK_DRAIN   5
 
#define BATTLE_BLOCK_STEAL   7
 
#define BATTLE_BLOCK_LOWER_ATTACK   8
 to 10: attack, defense, speed (a technique's boost stat + 8)
 
#define BATTLE_BLOCK_LOWER_DEFENSE   9
 
#define BATTLE_BLOCK_LOWER_SPEED   10
 
#define BATTLE_BLOCK_RUN_AWAY   11
 
#define MODE_NEW_GAME   0x2D7
 Game modes (GameState: mode >> 8 is the overlay) that more than their own overlay asks for.
 
#define MODE_DECK_EDITOR   0x400
 STCRDDEK.
 
#define MODE_PLAYER_NAME   0x500
 STPLNMET: the player's name entry.
 
#define MODE_BATTLE   0x600
 FIGHTSTG.
 
#define MODE_CARD_GAME   0x700
 CARDGAME: a card battle.
 
#define MODE_TRAINING   0xA00
 STGTRAIN.
 
#define MODE_NAMING   0xB00
 STDGNAME.
 
#define MODE_CONTINUE   0xC00
 STGMCARD, to load a game.
 
#define MODE_DIGI_LAB   0xD00
 STGDGLAB.
 
#define MODE_TITLE   0xE00
 STDWTITL's title screen; its movies follow.
 
#define MODE_OPENING   0xE01
 STDWTITL's first movie.
 
#define MODE_OPENING_2   0xE02
 STDWTITL's second opening movie: LANGUAGE 0 alternates the two, the others play only it.
 
#define MODE_BATTLE_MOVIE   0xE0A
 
#define MODE_ENDING   0xE0B
 
#define MODE_ITEM_SHOP   0xF00
 STITSHOP.
 
#define MODE_STATUS   0x1000
 STSTATUS: the field menu's screens (FIELD_MENU_CHOICE)
 
#define MODE_CARD_ALBUM   0x1200
 STCRDABM.
 
#define MODE_CARD_SHOP   0x1300
 STCRDSHP.
 
#define MODE_BATTLE_REPORT   0x1400
 STFGTREP.
 
#define MODE_STAGE_SELECT   0x1500
 STAGSLCT, the debug stage select.
 
#define MODE_COUNTRY_SELECT   0x1600
 CNTY_SEL, where the European version starts.
 
#define MODE_OVERLAY(mode)   ((mode) & 0xFF00)
 The first mode of a mode's overlay: MODE_OVERLAY(mode) == MODE_TITLE for all of STDWTITL's.
 
#define PARTY_SIZE   3
 How many partners the party holds.
 
#define MONEY_MAX   9999999
 The most money the player can have.
 
#define GAME_SAVE_SIZE   0x26C4
 The saved part of the game state, GAME up to mode: a save's data section (stgmcard.h's GameSave)
 

Enumerations

enum  PartnerId {
  PARTNER_KOTEMON , PARTNER_KUMAMON , PARTNER_MONMON , PARTNER_AGUMON ,
  PARTNER_VEEMON , PARTNER_GUILMON , PARTNER_RENAMON , PARTNER_PATAMON ,
  PARTNER_COUNT
}
 The partner Digimon (GAME.partners' index): partner i is DIGNAM's string i + 1, as the registration's choice shows them. More...
 
enum  StarterPack { STARTER_PACK_BALANCED , STARTER_PACK_POWERFUL , STARTER_PACK_MANIAC }
 The registration's starter packs (GAME.partySet, STARTER_PARTIES' rows): NAMEET's strings 10-12 name them. More...
 

Functions

void newGame (void)
 Clears the save data and sets up a new game.
 
void commitMode (void)
 Makes the requested mode current (main calls it before recreating the mode task)
 
s32 getPrevMode (void)
 The game mode before the current one.
 
s32 getMode (void)
 The current game mode.
 
s32 getModeArg (void)
 The argument the current mode was requested with.
 
void requestMode (s32 mode, s32 arg)
 Asks for a mode change, applied when main recreates the mode task.
 
s32 isModeChangePending (void)
 Whether a mode change was requested.
 
s32 unequipItem (s32 slot, s32 item)
 Takes item item off a partner (one of type 7 empties slots 2 and 3 both); 1 if it had it.
 
void changeItem (s32 item, s32 add)
 Actions 0x80-0x8E: gives an item (up to 99) or takes one, from the bag or else off a partner.
 
void changeCard (s32 card, s32 add)
 Actions 0x92: gives or takes a copy of a card.
 
void startCardBattle (s32 opponent, s32 kind)
 Actions 0x76 and 0x78: a card battle (MODE_CARD_GAME) against an opponent.
 
s32 checkPartner (u32 op, s32 arg)
 Special conditions 0x10: tests partners (unlocked, in the party, levels) or unlocks one; the European and Japanese versions add four.
 
s32 checkMoney (s32 op, s32 item)
 Special conditions 0x20: whether the player has MONEY_REQUIRED[item], or gives or takes an amount.
 
s32 checkProgressRange (s32 unused, s32 index)
 Special conditions 0x30: whether GAME.progress is within PROGRESS_RANGES[index].
 
s32 checkFlagCount (s32 unused, s32 mode)
 Special conditions 0x40: group 0 as in the USA version; group 1 whether four flags of group 0x10 are set.
 
s32 showActorIcon (s32 op, s32 arg)
 Special condition 0x50: the field actor's icon (FIELDSTG's task 0x16, FIELD_TASK_ICON) plays its animation 3, as event command 0x34A does.
 
s32 checkSpecialCondition (s32 id, s32 expected)
 Runs SPECIAL_CONDITIONS entry id; whether its result equals expected
 
s32 checkProgress (s32 value, s32 mode)
 Conditions 0x60: whether GAME.progress is value (mode != 0) or not.
 
s32 checkItem (s32 index, s32 mode)
 Conditions 0x80-0x8E: whether the player has item index, in the bag or equipped (mode != 0), or not.
 
s32 checkCard (s32 card, s32 have)
 Conditions 0x92: whether the player has card item (have != 0) or not.
 
s32 checkPartyStat (s32 index, s32 mode)
 Conditions 0x72: whether the party's total of battle stat 5 reaches PARTY_STAT_THRESHOLDS[index] (mode != 0) or not.
 
s32 checkWarpArg (s32 id, s32 mode)
 Conditions 0x7E: the values a warp leaves for its stage (GAME.place for ids under 30, GAME.placeArg above)
 
s32 findDigimon (s32 id)
 The index in DIGIMON_DATA of Digimon id (the first 52 entries are searched), or -1.
 
void clearBattleGauges (void)
 Empties the battle gauges (BATTLE_SETUP.gauges, up to 1000 in a battle)
 
ItemInfo * getItem (s32 id)
 The ITEMS entry of item id (from 1), or NULL.
 
s32 getItemCategory (s32 id)
 The category of an item's type (ITEM_TYPE_CATEGORIES); an s32, as the menus that call it through ITEM_FUNCS don't truncate the result to a byte.
 
s32 isItemKind (s32 item, s32 kind)
 ITEM_FUNCS.isKind.
 
s32 listItems (s32 type, s16 *out)
 Copies the items of ITEM_LISTS[type] the player has (with the top bit, equipped ones too); returns how many.
 
DigimonData * getDigimon (s32 id)
 The DIGIMON_DATA entry of Digimon id, or NULL.
 
void initNewGameData (void)
 The new game's player name, deck names, starter deck and partners.
 
void addCards (s32 card, s32 count)
 Gives count copies of a card (up to CARD_COPIES_MAX) and marks it seen.
 
s32 findPartnerEntry (s32 slot, s32 id)
 The index of Digimon id among a partner's entries, or -1.
 
void applyAction (s32 code, s32 value)
 Actions: the same flag groups (set to value), 0x70 special actions, 0x74 an overlay hook, 0x76/0x78, 0x7A, 0x7C, 0x94 mode changes through the overlay (0x8008AEB4), 0x80-0x8E give/take an item, 0x92 a card.
 
s32 checkConditions (u16 *list)
 All the (code, value) pairs until 0xFFFF must hold.
 
void applyActions (u16 *list)
 Runs every (code, value) action until 0xFFFF.
 
void updateModeFlags (void)
 On a mode change: clears the temporary flags if asked, and sets flags 0x10-0x12 after a card battle.
 
s32 checkCondition (u16, u16)
 Event scripts test conditions and run actions given as (code, value) pairs.
 
s32 testBit (u8 *bits, s32 index, s32 set)
 Whether bit index of a bitset is set (set != 0) or clear (set 0)
 
void setBit (u8 *bits, s32 index, s32 set)
 Sets or clears bit index of a bitset.
 
s32 checkItemSet (s32 op, s32 arg)
 Special condition 0x00: the player has every item of a set (the European and Japanese versions have a second set)
 
s32 getPartnerSlots (s32 partner, s16 *out)
 Copies the ids of the Digimon a partner takes to battle; returns how many there are.
 
void setPartnerSlots (s32 partner, s16 *ids)
 Picks the Digimon a partner takes to battle (-1 for ids it does not have)
 
s32 listPartnerEntries (s32 partner, u16 *out)
 Copies the ids of a partner's Digimon, zero-filled; returns how many there are.
 
s32 addPartnerEntry (s32 partner, s32 id)
 Gives a partner Digimon id at level 1; 0 if it has it already or has no room.
 
s32 getPartnerEntry (s32 partner, s32 id, PartnerEntry *out)
 Copies a partner's Digimon id; returns its index, or -1.
 
s32 setPartnerEntry (s32 partner, s32 id, PartnerEntry *in)
 Overwrites a partner's Digimon id; returns its index, or -1.
 
void addStatBonus (s16 *p, s32 stat, s32 delta)
 Adds an equipment bonus to a stat of computeStats' result (7 raises every battle stat)
 
PartnerStats * getPartnerStats (s32 partner)
 A partner's name, stats and Digimon.
 
s32 getPartyMember (u32 index)
 The partner index of party member index, or -1.
 
void setParty (s32 set)
 Gives the party STARTER_PARTIES[set], unlocking its partners.
 
void giveStarterDeck (void)
 Gives the starter deck's cards and puts them in every deck.
 
void resetPlayTime (void)
 Sets the play time to zero.
 
void updatePlayTime (void)
 Turns the vsync-counted frames into seconds, minutes and hours, stopping at 999:59:59.
 
s32 getPartyPartner (u32 index)
 The partner id of party member index (its unlocked value - 3), or -1.
 
void setStat (s32 partner, u32 stat, s16 value)
 Sets a partner's stat, kept within 0-99 (level, TP), 0-9999 (HP, MP) or 0-999.
 
void addStat (s32 partner, u32 stat, s32 delta)
 Adds to a partner's stat, kept within the same limits as setStat.
 
void computeStats (s32 partner, PartnerTotals *out)
 A partner's stats with its equipment (and its equipment set bonus) added.
 

Variables

DigimonData DIGIMON_DATA []
 55 entries: the 52 Digimon, then three placeholders (0x1D4-0x1D6)
 
DigimonData *(* GET_DIGIMON )(s32 id)
 getDigimon
 
BattleSetup BATTLE_SETUP
 
BattleResult BATTLE_RESULT
 
ItemInfo ITEMS []
 The items, from 1: getItem(id) is ITEMS[id - 1].
 
TechData TECHS []
 The techniques, from 1: technique n is TECHS[n - 1].
 
ItemFuncs ITEM_FUNCS
 
u8 ITEM_TYPE_CATEGORIES []
 The categories' strings, by item type.
 
s32 MONEY_REQUIRED []
 checkMoney's amounts, by its argument
 
SpecialCondition SPECIAL_CONDITIONS []
 checkSpecialCondition's conditions, up to an id of 0xFF
 
s32 MONEY_GAINS []
 
s32 MONEY_LOSSES []
 
GameFlags FLAGS_00
 The flag bitset FLAGS_00 and the event functions.
 
s32 STARTER_DECK [40]
 The cards of giveStarterDeck's deck.
 
u8 STARTER_PARTIES [][3]
 setParty's partners, by starter pack
 
u8 PROGRESS_RANGES [][2]
 checkProgressRange's ranges of GAME.progress: { min, max }; 0x63 is past the end of the story
 
s32 PARTY_STAT_THRESHOLDS []
 checkPartyStat's thresholds
 
EquipSet EQUIP_SETS []
 Each partner's equipment set and what wearing it whole adds (computeStats)
 
s16 EQUIP_SET_BONUSES [][6]
 
u16 * ITEM_LISTS []
 listItems' lists, 0-terminated
 
GameState GAME
 The save data, the game mode and the methods.
 

Detailed Description

The game state: modes, party, items, cards, flags (game/)

Definition in file game_state.h.

Macro Definition Documentation

◆ FLAG

#define FLAG (   group,
  id 
)    ((group) << 8 | (id))

The codes of the (code, value) pairs that FLAGS_00 checks as conditions and applies as actions (events.c's checkCondition and applyAction): the talks' and characters' lists, which end with CODES_END, and a StageSlot's two conditions, CODES_END for none.

code >> 8 & 0xFE is the kind, code & 0x1FF the flag, value or item. A condition holds when the flag is value, or when the test is (1) or isn't (0) true; an action sets the flag to value. The kinds the stages use and these don't name (0x7A, 0x7C and 0x94, actions that change the mode) stay numbers. group 0x00-0x40: FLAGS_00, GAME.flags02-flags40

Definition at line 68 of file game_state.h.

◆ PROGRESS

#define PROGRESS (   n)    (0x6000 | (n))

GAME.progress is n.

Definition at line 69 of file game_state.h.

◆ SPECIAL

#define SPECIAL (   id)    (0x7000 | (id))

SPECIAL_CONDITIONS entry id.

Definition at line 70 of file game_state.h.

◆ PARTY_STAT

#define PARTY_STAT (   id)    (0x7200 | (id))

checkPartyStat

Definition at line 71 of file game_state.h.

◆ EVENT_BATTLE

#define EVENT_BATTLE (   id)    (0x7400 | (id))

action: FIELDSTG_battleFuncs.startEventBattle

Definition at line 72 of file game_state.h.

◆ CARD_BATTLE

#define CARD_BATTLE (   opponent,
  kind 
)    ((0x7600 + (kind) * 0x200) | (opponent))

action: startCardBattle

Definition at line 73 of file game_state.h.

◆ PLACE

#define PLACE (   n)    (0x7E00 | ((n) - 1))

the place and its argument the last exit or warp set (checkWarpArg): the numbers of the stage's StagePoints, place 1-30

GAME.place is n

Definition at line 76 of file game_state.h.

◆ PLACE_ARG

#define PLACE_ARG (   n)    (0x7E00 | ((n) + 29))

GAME.placeArg is n.

Definition at line 77 of file game_state.h.

◆ ITEM

#define ITEM (   kind,
  id 
)    (0x8000 | (kind) << 9 | (id))

an item, in the bag or equipped; kind (bits 9-11) isn't read, and the scripts set it after the item's kind loosely

Definition at line 80 of file game_state.h.

◆ START_EVENT

#define START_EVENT (   index)    (0x9000 | (index))

action: FIELDSTG_startListedEvent

Definition at line 81 of file game_state.h.

◆ CARD

#define CARD (   id)    (0x9200 | (id))

a card: the player has one, or gets or loses one

Definition at line 82 of file game_state.h.

◆ CODES_END

#define CODES_END   0xFFFF

Definition at line 83 of file game_state.h.

◆ EQUIP_KIND_RIGHT_HAND

#define EQUIP_KIND_RIGHT_HAND   1

Where an equipment item goes (its record's kind), as the shop's and STSTATUS's strings name the kinds: the slots of PartnerStats.equip are 0 head, 1 body, 2 right hand, 3 left hand, 4 and 5 accessories.

Definition at line 134 of file game_state.h.

◆ EQUIP_KIND_LEFT_HAND

#define EQUIP_KIND_LEFT_HAND   2

Definition at line 135 of file game_state.h.

◆ EQUIP_KIND_EITHER_HAND

#define EQUIP_KIND_EITHER_HAND   3

Definition at line 136 of file game_state.h.

◆ EQUIP_KIND_HEAD

#define EQUIP_KIND_HEAD   4

Definition at line 137 of file game_state.h.

◆ EQUIP_KIND_BODY

#define EQUIP_KIND_BODY   5

Definition at line 138 of file game_state.h.

◆ EQUIP_KIND_ACCESSORY

#define EQUIP_KIND_ACCESSORY   6

Definition at line 139 of file game_state.h.

◆ EQUIP_KIND_BOTH_HANDS

#define EQUIP_KIND_BOTH_HANDS   7

takes slots 2 and 3

Definition at line 140 of file game_state.h.

◆ EQUIP_KIND_GROUP_ACCESSORY

#define EQUIP_KIND_GROUP_ACCESSORY   8

one of its group at a time

Definition at line 141 of file game_state.h.

◆ ITEM_USE_MENU

#define ITEM_USE_MENU   1

ItemEffect.flags.

usable from the status menu (STSTATUS)

Definition at line 195 of file game_state.h.

◆ ITEM_USE_BATTLE

#define ITEM_USE_BATTLE   2

usable in battle (FIGHTSTG's item menu)

Definition at line 196 of file game_state.h.

◆ ITEM_CARD_PACK

#define ITEM_CARD_PACK   4

on the card boosters, which nothing tests it on

Definition at line 197 of file game_state.h.

◆ ITEM_KIND_KEY

#define ITEM_KIND_KEY   1

ItemInfo.kind: the item list (ITEM_LISTS) an item is in, from 1.

the key items, and the ids no item uses

Definition at line 218 of file game_state.h.

◆ ITEM_KIND_USABLE

#define ITEM_KIND_USABLE   2

Definition at line 219 of file game_state.h.

◆ ITEM_KIND_WEAPON

#define ITEM_KIND_WEAPON   3

Definition at line 220 of file game_state.h.

◆ ITEM_KIND_ARMOR

#define ITEM_KIND_ARMOR   4

Definition at line 221 of file game_state.h.

◆ ITEM_KIND_ACCESSORY

#define ITEM_KIND_ACCESSORY   5

Definition at line 222 of file game_state.h.

◆ IS_WEAPON_TYPE

#define IS_WEAPON_TYPE (   type)    ((u8)((type) - 2) < 13)

ItemInfo.type's ranges: 2-14 weapons, 15-20 armour, 21-24 accessories, each tested as one unsigned byte compare.

Definition at line 235 of file game_state.h.

◆ IS_ARMOR_TYPE

#define IS_ARMOR_TYPE (   type)    ((u8)((type) - 15) < 6)

Definition at line 236 of file game_state.h.

◆ IS_ACCESSORY_TYPE

#define IS_ACCESSORY_TYPE (   type)    ((u8)((type) - 21) < 4)

Definition at line 237 of file game_state.h.

◆ PARTNER_ENTRY_COUNT

#define PARTNER_ENTRY_COUNT   44

The Digimon a partner can have, and the ones it takes to battle.

Definition at line 240 of file game_state.h.

◆ PARTNER_SLOT_COUNT

#define PARTNER_SLOT_COUNT   3

Definition at line 241 of file game_state.h.

◆ FIRST_ENTRY_ID

#define FIRST_ENTRY_ID   3

The first PartnerEntry.id of a Digimon: 0 is a free entry, 1 and 2 unused ones.

Definition at line 244 of file game_state.h.

◆ SKILL_ID

#define SKILL_ID   0x1FFF

PartnerEntry.skills.

the skill, from 1 (TECHS[id - 1])

Definition at line 255 of file game_state.h.

◆ SKILL_KNOWN

#define SKILL_KNOWN   0x2000

Definition at line 256 of file game_state.h.

◆ SKILL_MARKED

#define SKILL_MARKED   0x4000

marked in the lab (STGDGLAB_updateSkillPanel)

Definition at line 257 of file game_state.h.

◆ SKILL_LAST

#define SKILL_LAST   0x8000

the sixth skill

Definition at line 258 of file game_state.h.

◆ DECK_SIZE

#define DECK_SIZE   40

The cards of a deck, and the decks the player has.

Definition at line 261 of file game_state.h.

◆ DECK_COUNT

#define DECK_COUNT   3

Definition at line 262 of file game_state.h.

◆ CARD_COPIES_MAX

#define CARD_COPIES_MAX   9

The copies of a card the player can have.

Definition at line 265 of file game_state.h.

◆ STAT_LEVEL

#define STAT_LEVEL   0

Indices of a partner's stats (PartnerStats.stats, computeStats, setStat)

Definition at line 279 of file game_state.h.

◆ STAT_TP

#define STAT_TP   1

what the training's intensities cost

Definition at line 280 of file game_state.h.

◆ STAT_HP

#define STAT_HP   2

Definition at line 281 of file game_state.h.

◆ STAT_MAX_HP

#define STAT_MAX_HP   3

Definition at line 282 of file game_state.h.

◆ STAT_MP

#define STAT_MP   4

Definition at line 283 of file game_state.h.

◆ STAT_MAX_MP

#define STAT_MAX_MP   5

Definition at line 284 of file game_state.h.

◆ STAT_STRENGTH

#define STAT_STRENGTH   6

the six battle stats

Definition at line 286 of file game_state.h.

◆ STAT_DEFENSE

#define STAT_DEFENSE   7

Definition at line 287 of file game_state.h.

◆ STAT_SPIRIT

#define STAT_SPIRIT   8

Definition at line 288 of file game_state.h.

◆ STAT_WISDOM

#define STAT_WISDOM   9

Definition at line 289 of file game_state.h.

◆ STAT_SPEED

#define STAT_SPEED   10

Definition at line 290 of file game_state.h.

◆ STAT_CHARISMA

#define STAT_CHARISMA   11

Definition at line 291 of file game_state.h.

◆ STAT_RESISTS

#define STAT_RESISTS   12

the first of the seven resistances

Definition at line 292 of file game_state.h.

◆ STAT_COUNT

#define STAT_COUNT   19

Definition at line 293 of file game_state.h.

◆ BATTLE_BLOCK_POISON

#define BATTLE_BLOCK_POISON   0

BattleSetup.blocks' indices: the encounter keeps the player from inflicting a status, draining, stealing, lowering a stat of the enemy's or running away.

Definition at line 364 of file game_state.h.

◆ BATTLE_BLOCK_PARALYSIS

#define BATTLE_BLOCK_PARALYSIS   1

Definition at line 365 of file game_state.h.

◆ BATTLE_BLOCK_CONFUSION

#define BATTLE_BLOCK_CONFUSION   2

Definition at line 366 of file game_state.h.

◆ BATTLE_BLOCK_SLEEP

#define BATTLE_BLOCK_SLEEP   3

Definition at line 367 of file game_state.h.

◆ BATTLE_BLOCK_KNOCK_OUT

#define BATTLE_BLOCK_KNOCK_OUT   4

Definition at line 368 of file game_state.h.

◆ BATTLE_BLOCK_DRAIN

#define BATTLE_BLOCK_DRAIN   5

Definition at line 369 of file game_state.h.

◆ BATTLE_BLOCK_STEAL

#define BATTLE_BLOCK_STEAL   7

Definition at line 370 of file game_state.h.

◆ BATTLE_BLOCK_LOWER_ATTACK

#define BATTLE_BLOCK_LOWER_ATTACK   8

to 10: attack, defense, speed (a technique's boost stat + 8)

Definition at line 371 of file game_state.h.

◆ BATTLE_BLOCK_LOWER_DEFENSE

#define BATTLE_BLOCK_LOWER_DEFENSE   9

Definition at line 372 of file game_state.h.

◆ BATTLE_BLOCK_LOWER_SPEED

#define BATTLE_BLOCK_LOWER_SPEED   10

Definition at line 373 of file game_state.h.

◆ BATTLE_BLOCK_RUN_AWAY

#define BATTLE_BLOCK_RUN_AWAY   11

Definition at line 374 of file game_state.h.

◆ MODE_NEW_GAME

#define MODE_NEW_GAME   0x2D7

Game modes (GameState: mode >> 8 is the overlay) that more than their own overlay asks for.

FIELDSTG, where a new game starts

Definition at line 429 of file game_state.h.

◆ MODE_DECK_EDITOR

#define MODE_DECK_EDITOR   0x400

STCRDDEK.

Definition at line 430 of file game_state.h.

◆ MODE_PLAYER_NAME

#define MODE_PLAYER_NAME   0x500

STPLNMET: the player's name entry.

Definition at line 431 of file game_state.h.

◆ MODE_BATTLE

#define MODE_BATTLE   0x600

FIGHTSTG.

Definition at line 432 of file game_state.h.

◆ MODE_CARD_GAME

#define MODE_CARD_GAME   0x700

CARDGAME: a card battle.

Definition at line 433 of file game_state.h.

◆ MODE_TRAINING

#define MODE_TRAINING   0xA00

STGTRAIN.

Definition at line 434 of file game_state.h.

◆ MODE_NAMING

#define MODE_NAMING   0xB00

STDGNAME.

Definition at line 435 of file game_state.h.

◆ MODE_CONTINUE

#define MODE_CONTINUE   0xC00

STGMCARD, to load a game.

Definition at line 436 of file game_state.h.

◆ MODE_DIGI_LAB

#define MODE_DIGI_LAB   0xD00

STGDGLAB.

Definition at line 437 of file game_state.h.

◆ MODE_TITLE

#define MODE_TITLE   0xE00

STDWTITL's title screen; its movies follow.

Definition at line 438 of file game_state.h.

◆ MODE_OPENING

#define MODE_OPENING   0xE01

STDWTITL's first movie.

Definition at line 439 of file game_state.h.

◆ MODE_OPENING_2

#define MODE_OPENING_2   0xE02

STDWTITL's second opening movie: LANGUAGE 0 alternates the two, the others play only it.

Definition at line 445 of file game_state.h.

◆ MODE_BATTLE_MOVIE

#define MODE_BATTLE_MOVIE   0xE0A

Definition at line 446 of file game_state.h.

◆ MODE_ENDING

#define MODE_ENDING   0xE0B

Definition at line 447 of file game_state.h.

◆ MODE_ITEM_SHOP

#define MODE_ITEM_SHOP   0xF00

STITSHOP.

Definition at line 449 of file game_state.h.

◆ MODE_STATUS

#define MODE_STATUS   0x1000

STSTATUS: the field menu's screens (FIELD_MENU_CHOICE)

Definition at line 450 of file game_state.h.

◆ MODE_CARD_ALBUM

#define MODE_CARD_ALBUM   0x1200

STCRDABM.

Definition at line 451 of file game_state.h.

◆ MODE_CARD_SHOP

#define MODE_CARD_SHOP   0x1300

STCRDSHP.

Definition at line 452 of file game_state.h.

◆ MODE_BATTLE_REPORT

#define MODE_BATTLE_REPORT   0x1400

STFGTREP.

Definition at line 453 of file game_state.h.

◆ MODE_STAGE_SELECT

#define MODE_STAGE_SELECT   0x1500

STAGSLCT, the debug stage select.

Definition at line 454 of file game_state.h.

◆ MODE_COUNTRY_SELECT

#define MODE_COUNTRY_SELECT   0x1600

CNTY_SEL, where the European version starts.

Definition at line 455 of file game_state.h.

◆ MODE_OVERLAY

#define MODE_OVERLAY (   mode)    ((mode) & 0xFF00)

The first mode of a mode's overlay: MODE_OVERLAY(mode) == MODE_TITLE for all of STDWTITL's.

Definition at line 459 of file game_state.h.

◆ PARTY_SIZE

#define PARTY_SIZE   3

How many partners the party holds.

Definition at line 475 of file game_state.h.

◆ MONEY_MAX

#define MONEY_MAX   9999999

The most money the player can have.

Definition at line 482 of file game_state.h.

◆ GAME_SAVE_SIZE

#define GAME_SAVE_SIZE   0x26C4

The saved part of the game state, GAME up to mode: a save's data section (stgmcard.h's GameSave)

Definition at line 591 of file game_state.h.

Enumeration Type Documentation

◆ PartnerId

enum PartnerId

The partner Digimon (GAME.partners' index): partner i is DIGNAM's string i + 1, as the registration's choice shows them.

Enumerator
PARTNER_KOTEMON 
PARTNER_KUMAMON 
PARTNER_MONMON 
PARTNER_AGUMON 
PARTNER_VEEMON 
PARTNER_GUILMON 
PARTNER_RENAMON 
PARTNER_PATAMON 
PARTNER_COUNT 

Definition at line 463 of file game_state.h.

◆ StarterPack

The registration's starter packs (GAME.partySet, STARTER_PARTIES' rows): NAMEET's strings 10-12 name them.

Enumerator
STARTER_PACK_BALANCED 
STARTER_PACK_POWERFUL 
STARTER_PACK_MANIAC 

Definition at line 479 of file game_state.h.

Function Documentation

◆ newGame()

void newGame ( void  )

Clears the save data and sets up a new game.

< CNTY_SEL, where the European version starts

< CNTY_SEL, where the European version starts

Definition at line 5 of file state.c.

Here is the call graph for this function:

◆ commitMode()

void commitMode ( void  )

Makes the requested mode current (main calls it before recreating the mode task)

Definition at line 26 of file state.c.

◆ getPrevMode()

s32 getPrevMode ( void  )

The game mode before the current one.

Definition at line 38 of file state.c.

◆ getMode()

s32 getMode ( void  )

The current game mode.

Definition at line 43 of file state.c.

◆ getModeArg()

s32 getModeArg ( void  )

The argument the current mode was requested with.

Definition at line 48 of file state.c.

◆ requestMode()

void requestMode ( s32  mode,
s32  arg 
)

Asks for a mode change, applied when main recreates the mode task.

Definition at line 53 of file state.c.

◆ isModeChangePending()

s32 isModeChangePending ( void  )

Whether a mode change was requested.

Definition at line 59 of file state.c.

◆ unequipItem()

s32 unequipItem ( s32  slot,
s32  item 
)

Takes item item off a partner (one of type 7 empties slots 2 and 3 both); 1 if it had it.

Definition at line 436 of file events.c.

Referenced by changeItem().

Here is the caller graph for this function:

◆ changeItem()

void changeItem ( s32  item,
s32  add 
)

Actions 0x80-0x8E: gives an item (up to 99) or takes one, from the bag or else off a partner.

Definition at line 457 of file events.c.

Referenced by applyAction().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ changeCard()

void changeCard ( s32  card,
s32  add 
)

Actions 0x92: gives or takes a copy of a card.

Definition at line 485 of file events.c.

Referenced by applyAction().

Here is the caller graph for this function:

◆ startCardBattle()

void startCardBattle ( s32  opponent,
s32  kind 
)

Actions 0x76 and 0x78: a card battle (MODE_CARD_GAME) against an opponent.

< CARDGAME: a card battle

Definition at line 497 of file events.c.

Referenced by applyAction().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkPartner()

s32 checkPartner ( u32  op,
s32  arg 
)

Special conditions 0x10: tests partners (unlocked, in the party, levels) or unlocks one; the European and Japanese versions add four.

Definition at line 65 of file events.c.

Referenced by checkSpecialCondition().

Here is the caller graph for this function:

◆ checkMoney()

s32 checkMoney ( s32  op,
s32  item 
)

Special conditions 0x20: whether the player has MONEY_REQUIRED[item], or gives or takes an amount.

Definition at line 156 of file events.c.

Referenced by checkSpecialCondition().

Here is the caller graph for this function:

◆ checkProgressRange()

s32 checkProgressRange ( s32  unused,
s32  index 
)

Special conditions 0x30: whether GAME.progress is within PROGRESS_RANGES[index].

Definition at line 182 of file events.c.

Referenced by checkSpecialCondition().

Here is the caller graph for this function:

◆ checkFlagCount()

s32 checkFlagCount ( s32  unused,
s32  mode 
)

Special conditions 0x40: group 0 as in the USA version; group 1 whether four flags of group 0x10 are set.

Definition at line 231 of file events.c.

Referenced by checkSpecialCondition().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ showActorIcon()

s32 showActorIcon ( s32  op,
s32  arg 
)

Special condition 0x50: the field actor's icon (FIELDSTG's task 0x16, FIELD_TASK_ICON) plays its animation 3, as event command 0x34A does.

Definition at line 277 of file events.c.

Referenced by checkSpecialCondition().

Here is the caller graph for this function:

◆ checkSpecialCondition()

s32 checkSpecialCondition ( s32  id,
s32  expected 
)

Runs SPECIAL_CONDITIONS entry id; whether its result equals expected

Definition at line 285 of file events.c.

Referenced by applyAction(), and checkCondition().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkProgress()

s32 checkProgress ( s32  value,
s32  mode 
)

Conditions 0x60: whether GAME.progress is value (mode != 0) or not.

Definition at line 322 of file events.c.

Referenced by checkCondition().

Here is the caller graph for this function:

◆ checkItem()

s32 checkItem ( s32  index,
s32  mode 
)

Conditions 0x80-0x8E: whether the player has item index, in the bag or equipped (mode != 0), or not.

Definition at line 339 of file events.c.

Referenced by checkCondition().

Here is the caller graph for this function:

◆ checkCard()

s32 checkCard ( s32  card,
s32  have 
)

Conditions 0x92: whether the player has card item (have != 0) or not.

Definition at line 353 of file events.c.

Referenced by checkCondition().

Here is the caller graph for this function:

◆ checkPartyStat()

s32 checkPartyStat ( s32  index,
s32  mode 
)

Conditions 0x72: whether the party's total of battle stat 5 reaches PARTY_STAT_THRESHOLDS[index] (mode != 0) or not.

Definition at line 370 of file events.c.

Referenced by checkCondition().

Here is the caller graph for this function:

◆ checkWarpArg()

s32 checkWarpArg ( s32  id,
s32  mode 
)

Conditions 0x7E: the values a warp leaves for its stage (GAME.place for ids under 30, GAME.placeArg above)

Definition at line 397 of file events.c.

Referenced by checkCondition().

Here is the caller graph for this function:

◆ findDigimon()

s32 findDigimon ( s32  id)

The index in DIGIMON_DATA of Digimon id (the first 52 entries are searched), or -1.

Definition at line 121 of file digimon.c.

Referenced by getDigimon().

Here is the caller graph for this function:

◆ clearBattleGauges()

void clearBattleGauges ( void  )

Empties the battle gauges (BATTLE_SETUP.gauges, up to 1000 in a battle)

Definition at line 7 of file items.c.

◆ getItem()

ItemInfo * getItem ( s32  id)

The ITEMS entry of item id (from 1), or NULL.

Definition at line 16 of file items.c.

Referenced by getItemCategory(), and isItemKind().

Here is the caller graph for this function:

◆ getItemCategory()

s32 getItemCategory ( s32  id)

The category of an item's type (ITEM_TYPE_CATEGORIES); an s32, as the menus that call it through ITEM_FUNCS don't truncate the result to a byte.

Definition at line 27 of file items.c.

Here is the call graph for this function:

◆ isItemKind()

s32 isItemKind ( s32  item,
s32  kind 
)

ITEM_FUNCS.isKind.

Definition at line 32 of file items.c.

Here is the call graph for this function:

◆ listItems()

s32 listItems ( s32  type,
s16 *  out 
)

Copies the items of ITEM_LISTS[type] the player has (with the top bit, equipped ones too); returns how many.

Definition at line 40 of file items.c.

◆ getDigimon()

DigimonData * getDigimon ( s32  id)

The DIGIMON_DATA entry of Digimon id, or NULL.

Definition at line 134 of file digimon.c.

Here is the call graph for this function:

◆ initNewGameData()

void initNewGameData ( void  )

The new game's player name, deck names, starter deck and partners.

< NAMEDT: the keyboard's

< CRDSHP: STCRDSHP's, and STCRDDEK's

< DIGNAM

Definition at line 5 of file party.c.

Referenced by newGame().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addCards()

void addCards ( s32  card,
s32  count 
)

Gives count copies of a card (up to CARD_COPIES_MAX) and marks it seen.

Definition at line 63 of file party.c.

Referenced by giveStarterDeck().

Here is the caller graph for this function:

◆ findPartnerEntry()

s32 findPartnerEntry ( s32  slot,
s32  id 
)

The index of Digimon id among a partner's entries, or -1.

Definition at line 4 of file partner.c.

Referenced by addPartnerEntry(), getPartnerEntry(), getPartnerSlots(), setPartnerEntry(), and setPartnerSlots().

Here is the caller graph for this function:

◆ applyAction()

void applyAction ( s32  code,
s32  value 
)

Actions: the same flag groups (set to value), 0x70 special actions, 0x74 an overlay hook, 0x76/0x78, 0x7A, 0x7C, 0x94 mode changes through the overlay (0x8008AEB4), 0x80-0x8E give/take an item, 0x92 a card.

< STGTRAIN

< STITSHOP

< STCRDSHP

< STGDGLAB

< STDGNAME

Definition at line 563 of file events.c.

Referenced by applyActions(), and updateModeFlags().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkConditions()

s32 checkConditions ( u16 *  list)

All the (code, value) pairs until 0xFFFF must hold.

Definition at line 652 of file events.c.

Here is the call graph for this function:

◆ applyActions()

void applyActions ( u16 *  list)

Runs every (code, value) action until 0xFFFF.

Definition at line 665 of file events.c.

Here is the call graph for this function:

◆ updateModeFlags()

void updateModeFlags ( void  )

On a mode change: clears the temporary flags if asked, and sets flags 0x10-0x12 after a card battle.

< CARDGAME: a card battle

< 0 0x00-0x40: FLAGS_00, GAME.flags02-flags40

< 0 0x00-0x40: FLAGS_00, GAME.flags02-flags40

< 0 0x00-0x40: FLAGS_00, GAME.flags02-flags40

Definition at line 678 of file events.c.

Here is the call graph for this function:

◆ checkCondition()

s32 checkCondition ( u16  code,
u16  value 
)

Event scripts test conditions and run actions given as (code, value) pairs.

code >> 9 picks the kind, code & 0x1FF the flag or item: groups 0x00-0x40 (code >> 8 & ~1): the flag bitsets FLAGS_00 and GAME.flags02-flags40 0x60 GAME.progress, 0x70 SPECIAL_CONDITIONS, 0x72 party stat totals, 0x80-0x8E items, 0x92 cards. A condition holds when it equals value.

Definition at line 509 of file events.c.

Referenced by checkConditions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ testBit()

s32 testBit ( u8 *  bits,
s32  index,
s32  set 
)

Whether bit index of a bitset is set (set != 0) or clear (set 0)

Definition at line 5 of file events.c.

Referenced by checkCondition(), and checkFlagCount().

Here is the caller graph for this function:

◆ setBit()

void setBit ( u8 *  bits,
s32  index,
s32  set 
)

Sets or clears bit index of a bitset.

Definition at line 16 of file events.c.

Referenced by applyAction().

Here is the caller graph for this function:

◆ checkItemSet()

s32 checkItemSet ( s32  op,
s32  arg 
)

Special condition 0x00: the player has every item of a set (the European and Japanese versions have a second set)

Definition at line 29 of file events.c.

Referenced by checkSpecialCondition().

Here is the caller graph for this function:

◆ getPartnerSlots()

s32 getPartnerSlots ( s32  partner,
s16 *  out 
)

Copies the ids of the Digimon a partner takes to battle; returns how many there are.

Definition at line 19 of file partner.c.

Here is the call graph for this function:

◆ setPartnerSlots()

void setPartnerSlots ( s32  partner,
s16 *  ids 
)

Picks the Digimon a partner takes to battle (-1 for ids it does not have)

Definition at line 40 of file partner.c.

Here is the call graph for this function:

◆ listPartnerEntries()

s32 listPartnerEntries ( s32  partner,
u16 *  out 
)

Copies the ids of a partner's Digimon, zero-filled; returns how many there are.

Definition at line 55 of file partner.c.

◆ addPartnerEntry()

s32 addPartnerEntry ( s32  partner,
s32  id 
)

Gives a partner Digimon id at level 1; 0 if it has it already or has no room.

Definition at line 74 of file partner.c.

Here is the call graph for this function:

◆ getPartnerEntry()

s32 getPartnerEntry ( s32  partner,
s32  id,
PartnerEntry *  out 
)

Copies a partner's Digimon id; returns its index, or -1.

Definition at line 97 of file partner.c.

Here is the call graph for this function:

◆ setPartnerEntry()

s32 setPartnerEntry ( s32  partner,
s32  id,
PartnerEntry *  in 
)

Overwrites a partner's Digimon id; returns its index, or -1.

Definition at line 107 of file partner.c.

Here is the call graph for this function:

◆ addStatBonus()

void addStatBonus ( s16 *  p,
s32  stat,
s32  delta 
)

Adds an equipment bonus to a stat of computeStats' result (7 raises every battle stat)

Definition at line 146 of file stats.c.

Referenced by computeStats().

Here is the caller graph for this function:

◆ getPartnerStats()

PartnerStats * getPartnerStats ( s32  partner)

A partner's name, stats and Digimon.

Definition at line 117 of file partner.c.

◆ getPartyMember()

s32 getPartyMember ( u32  index)

The partner index of party member index, or -1.

Definition at line 42 of file party.c.

◆ setParty()

void setParty ( s32  set)

Gives the party STARTER_PARTIES[set], unlocking its partners.

Definition at line 50 of file party.c.

◆ giveStarterDeck()

void giveStarterDeck ( void  )

Gives the starter deck's cards and puts them in every deck.

Definition at line 72 of file party.c.

Here is the call graph for this function:

◆ resetPlayTime()

void resetPlayTime ( void  )

Sets the play time to zero.

Definition at line 5 of file play_time.c.

◆ updatePlayTime()

void updatePlayTime ( void  )

Turns the vsync-counted frames into seconds, minutes and hours, stopping at 999:59:59.

Definition at line 14 of file play_time.c.

◆ getPartyPartner()

s32 getPartyPartner ( u32  index)

The partner id of party member index (its unlocked value - 3), or -1.

Definition at line 5 of file stats.c.

◆ setStat()

void setStat ( s32  partner,
u32  stat,
s16  value 
)

Sets a partner's stat, kept within 0-99 (level, TP), 0-9999 (HP, MP) or 0-999.

Definition at line 13 of file stats.c.

◆ addStat()

void addStat ( s32  partner,
u32  stat,
s32  delta 
)

Adds to a partner's stat, kept within the same limits as setStat.

Definition at line 39 of file stats.c.

◆ computeStats()

void computeStats ( s32  partner,
PartnerTotals *  out 
)

A partner's stats with its equipment (and its equipment set bonus) added.

Definition at line 65 of file stats.c.

Here is the call graph for this function:

Variable Documentation

◆ DIGIMON_DATA

◆ GET_DIGIMON

◆ BATTLE_SETUP

◆ BATTLE_RESULT

◆ ITEMS

ItemInfo ITEMS[]
extern

The items, from 1: getItem(id) is ITEMS[id - 1].

Definition at line 481 of file items.c.

Referenced by getItem().

◆ TECHS

TechData TECHS[]
extern

The techniques, from 1: technique n is TECHS[n - 1].

Definition at line 906 of file items.c.

Referenced by announceFirstTech(), announceTech(), confirmSwitchIn(), dealTechDamage(), drawEntryPanel(), FIGHTSTG_adjustDamage(), FIGHTSTG_applyTechEffect(), FIGHTSTG_computeCounterDamage(), FIGHTSTG_computeDamage(), FIGHTSTG_computeHeal(), FIGHTSTG_computeMagicDamage(), FIGHTSTG_drainMp(), FIGHTSTG_drawTechIcons(), FIGHTSTG_drawTechMenu(), FIGHTSTG_getTechCost(), FIGHTSTG_lowerAttack(), FIGHTSTG_lowerDefense(), FIGHTSTG_raiseAllStatus(), FIGHTSTG_raiseEachStatus(), FIGHTSTG_raiseOneStatus(), FIGHTSTG_reviveFighter(), FIGHTSTG_rollCritical(), FIGHTSTG_rollDrain(), FIGHTSTG_rollHit(), FIGHTSTG_rollMagicCritical(), FIGHTSTG_rollMagicHit(), FIGHTSTG_rollMultiHit(), FIGHTSTG_rollPoison(), FIGHTSTG_rollSleep(), FIGHTSTG_rollStatusRaise(), FIGHTSTG_rollSteal(), FIGHTSTG_showSwitchInChoices(), FIGHTSTG_startAction(), FIGHTSTG_startEndBattle(), FIGHTSTG_startRestriction(), FIGHTSTG_tryConfusion(), FIGHTSTG_tryDrain(), FIGHTSTG_tryNoSwitch(), FIGHTSTG_tryParalysis(), FIGHTSTG_trySleep(), FIGHTSTG_trySteal(), FIGHTSTG_updateTechAction(), markTechEffect(), playCounterTech(), rollStatus(), rollTechChance(), setUpItemTech(), STGDGLAB_drawEntryList(), STGDGLAB_drawSkillPanel(), STGDGLAB_showSkillPanel(), STSTATUS_chooseTech(), STSTATUS_drawDigivolvePanel(), STSTATUS_getChosenTech(), STSTATUS_getTechHealing(), STSTATUS_showChosenTech(), STSTATUS_showPartnerTech(), STSTATUS_showTechCost(), STSTATUS_useTech(), useEnemyTech(), wakeUpOrCounter(), WFIGHTMN_bringLastEnemy(), WFIGHTMN_recordTech(), and WFIGHTMN_startTech().

◆ ITEM_FUNCS

◆ ITEM_TYPE_CATEGORIES

u8 ITEM_TYPE_CATEGORIES[]
extern

The categories' strings, by item type.

Definition at line 898 of file items.c.

Referenced by getItemCategory().

◆ MONEY_REQUIRED

s32 MONEY_REQUIRED[]
extern

checkMoney's amounts, by its argument

Definition at line 762 of file events.c.

Referenced by checkMoney().

◆ SPECIAL_CONDITIONS

SpecialCondition SPECIAL_CONDITIONS[]
extern

checkSpecialCondition's conditions, up to an id of 0xFF

Definition at line 706 of file events.c.

Referenced by checkSpecialCondition().

◆ MONEY_GAINS

s32 MONEY_GAINS[]
extern

Definition at line 765 of file events.c.

Referenced by checkMoney().

◆ MONEY_LOSSES

s32 MONEY_LOSSES[]
extern

Definition at line 768 of file events.c.

Referenced by checkMoney().

◆ FLAGS_00

GameFlags FLAGS_00
extern

The flag bitset FLAGS_00 and the event functions.

Definition at line 701 of file events.c.

Referenced by applyAction(), CARDGAME_updateBattle(), checkCondition(), createCharacters(), createCommand827(), createParty(), createTileLift(), endEvent100(), endEvent1000(), endEvent101(), endEvent1010(), endEvent1020(), endEvent1030(), endEvent1040(), endEvent1041(), endEvent1050(), endEvent1060(), endEvent1070(), endEvent1080(), endEvent1245(), endEvent1260(), endEvent1261(), endEvent1262(), endEvent1263(), endEvent1264(), endEvent1265(), endEvent1266(), endEvent1267(), endEvent1268(), endEvent1269(), endEvent1270(), endEvent1271(), endEvent1272(), endEvent1273(), endEvent1274(), endEvent1275(), endEvent1276(), endEvent1277(), endEvent1278(), endEvent1279(), endEvent1280(), endEvent1281(), endEvent1282(), endEvent1283(), endEvent1284(), endEvent1285(), endEvent1286(), endEvent1287(), endEvent1288(), endEvent1289(), endEvent1290(), endEvent1291(), endEvent1292(), endEvent1293(), endEvent1294(), endEvent1295(), endEvent1296(), endEvent1297(), endEvent1298(), endEvent1300(), endEvent1301(), endEvent1302(), endEvent1303(), endEvent1304(), endEvent1305(), endEvent1415(), endEvent1455(), endEvent1456(), endEvent1457(), endEvent1458(), endEvent1459(), endEvent1460(), endEvent1461(), endEvent1462(), endEvent1463(), endEvent1464(), endEvent150(), endEvent1530(), endEvent1600(), endEvent1608(), endEvent1612(), endEvent1646(), endEvent1648(), endEvent170(), endEvent180(), endEvent230(), endEvent250(), endEvent260(), endEvent261(), endEvent271(), endEvent272(), endEvent290(), endEvent310(), endEvent340(), endEvent350(), endEvent351(), endEvent352(), endEvent360(), endEvent370(), endEvent375(), endEvent376(), endEvent380(), endEvent390(), endEvent400(), endEvent410(), endEvent421(), endEvent422(), endEvent430(), endEvent431(), endEvent440(), endEvent450(), endEvent460(), endEvent470(), endEvent480(), endEvent490(), endEvent50(), endEvent500(), endEvent510(), endEvent511(), endEvent520(), endEvent530(), endEvent532(), endEvent540(), endEvent550(), endEvent552(), endEvent570(), endEvent571(), endEvent572(), endEvent580(), endEvent60(), endEvent61(), endEvent660(), endEvent680(), endEvent681(), endEvent682(), endEvent685(), endEvent70(), endEvent700(), endEvent71(), endEvent710(), endEvent720(), endEvent730(), endEvent735(), endEvent740(), endEvent741(), endEvent745(), endEvent750(), endEvent751(), endEvent760(), endEvent780(), endEvent781(), endEvent790(), endEvent791(), endEvent80(), endEvent800(), endEvent801(), endEvent810(), endEvent811(), endEvent830(), endEvent840(), endEvent850(), endEvent860(), endEvent870(), endEvent871(), endEvent880(), endEvent881(), endEvent882(), endEvent883(), endEvent884(), endEvent885(), endEvent890(), endEvent891(), endEvent892(), endEvent894(), endEvent900(), endEvent9000(), endEvent9001(), endEvent9002(), endEvent9003(), endEvent9004(), endEvent9005(), endEvent9006(), endEvent9007(), endEvent9008(), endEvent9009(), endEvent901(), endEvent9010(), endEvent9011(), endEvent9012(), endEvent9013(), endEvent9014(), endEvent9015(), endEvent910(), endEvent911(), endEvent920(), endEvent921(), endEvent925(), endEvent931(), endEvent932(), endEvent933(), endEvent934(), endEvent960(), endEvent970(), endEvent981(), endEvent990(), endEvents1507To1509(), FIELDSTG_controlPlayer(), FIELDSTG_createLift(), FIELDSTG_offerTrigger(), FIELDSTG_runStoryEvents(), FIELDSTG_startEventBattle5(), runTalk(), setupStage(), setUsedFlag(), startField(), STSTATUS_getVisitedAreas(), updateModeFlags(), updateStage(), and updateTimer().

◆ STARTER_DECK

s32 STARTER_DECK[40]
extern

The cards of giveStarterDeck's deck.

Definition at line 94 of file party.c.

Referenced by giveStarterDeck().

◆ STARTER_PARTIES

u8 STARTER_PARTIES[][3]
extern

setParty's partners, by starter pack

Definition at line 87 of file party.c.

Referenced by setParty().

◆ PROGRESS_RANGES

u8 PROGRESS_RANGES[][2]
extern

checkProgressRange's ranges of GAME.progress: { min, max }; 0x63 is past the end of the story

Definition at line 773 of file events.c.

Referenced by checkProgressRange().

◆ PARTY_STAT_THRESHOLDS

s32 PARTY_STAT_THRESHOLDS[]
extern

checkPartyStat's thresholds

Definition at line 811 of file events.c.

Referenced by checkPartyStat().

◆ EQUIP_SETS

EquipSet EQUIP_SETS[]
extern

Each partner's equipment set and what wearing it whole adds (computeStats)

Definition at line 174 of file stats.c.

Referenced by computeStats().

◆ EQUIP_SET_BONUSES

s16 EQUIP_SET_BONUSES[][6]
extern

Definition at line 180 of file stats.c.

Referenced by computeStats().

◆ ITEM_LISTS

u16* ITEM_LISTS[]
extern

listItems' lists, 0-terminated

Definition at line 903 of file items.c.

Referenced by listItems().

◆ GAME

GameState GAME
extern

The save data, the game mode and the methods.

Definition at line 64 of file state.c.

Referenced by addCards(), addFighters(), addPartnerEntry(), addStat(), applyAction(), CARDGAME_createDeckWindow(), CARDGAME_updateBattle(), CARDGAME_updateDeckWindow(), CARDGAME_updateScene(), changeCard(), changeItem(), checkCard(), checkCondition(), checkFlagCount(), checkItem(), checkItemSet(), checkMoney(), checkPartner(), checkPartyStat(), checkProgress(), checkProgressRange(), checkWarpArg(), chooseFieldMenuOption(), chooseInnAnswer(), CNTY_SEL_tickMenu(), commitMode(), computeStats(), createParty(), createTalkBox(), drawEntryPanel(), drawFrame(), drawTimer(), editParty(), editProgress(), endEvent0(), endEvent1(), endEvent1035(), endEvent1080(), endEvent1500(), endEvent152(), endEvent171(), endEvent205(), endEvent230(), endEvent261(), endEvent273(), endEvent300(), endEvent352(), endEvent370(), endEvent413(), endEvent431(), endEvent5(), endEvent511(), endEvent52(), endEvent531(), endEvent534(), endEvent551(), endEvent560(), endEvent661(), endEvent685(), endEvent690(), endEvent695(), endEvent71(), endEvent711(), endEvent743(), endEvent751(), endEvent760(), endEvent781(), endEvent820(), endEvent886(), endEvent893(), endEvent895(), endEvent90(), endEvent901(), endEvent911(), endEvent922(), endEvent935(), endEvent961(), endEvent982(), endEvents10To12(), FIELDSTG_checkFlightProbe(), FIELDSTG_closeField(), FIELDSTG_controlFlight(), FIELDSTG_countBattleSteps(), FIELDSTG_createActor(), FIELDSTG_createActorIcon(), FIELDSTG_createHiddenSpots(), FIELDSTG_createLaunch(), FIELDSTG_getWalkStep(), FIELDSTG_hidePrize(), FIELDSTG_keepsFileCache(), FIELDSTG_offerTrigger(), FIELDSTG_pickStage(), FIELDSTG_playBattleTransition(), FIELDSTG_requestInnNames(), FIELDSTG_rollBattleSteps(), FIELDSTG_runActorAction(), FIELDSTG_runGauge(), FIELDSTG_runStoryEvents(), FIELDSTG_scrollCamera(), FIELDSTG_setFirstMap(), FIELDSTG_setMap(), FIELDSTG_setOffTrigger(), FIELDSTG_setupField(), FIELDSTG_showAreaName(), FIELDSTG_startEncounter(), FIELDSTG_updateActor(), FIELDSTG_updateRoot(), FIGHTSTG_computeStats(), FIGHTSTG_createSwitchInMenu(), FIGHTSTG_drawHud(), FIGHTSTG_getGaugeGain(), FIGHTSTG_getPairDigimon(), FIGHTSTG_getTechCost(), FIGHTSTG_raiseAllStatus(), FIGHTSTG_raiseEachStatus(), FIGHTSTG_raiseOneStatus(), FIGHTSTG_setConfusedName(), FIGHTSTG_setMessageName(), FIGHTSTG_showDigivolveNames(), FIGHTSTG_showFighterNames(), FIGHTSTG_showFightersMessage(), FIGHTSTG_showItemPage(), FIGHTSTG_showSwitchFighters(), FIGHTSTG_updateDigivolveMenu(), FIGHTSTG_updateItem(), FIGHTSTG_updatePartnerInfo(), FIGHTSTG_updateRoot(), FIGHTSTG_updateTechMenu(), fillGauge(), findPartnerEntry(), getFieldZone(), getMode(), getModeArg(), getPartnerEntry(), getPartnerSlots(), getPartnerStats(), getPartyMember(), getPartyPartner(), getPrevMode(), giveDigimonExp(), giveItem(), giveMoney(), giveNextSkill(), giveStarterDeck(), healParty(), initNewGameData(), isModeChangePending(), learnNextDigimon(), listItems(), listPartnerEntries(), listSlotTechs(), listSwitchInDigimon(), loadChosenDeck(), loadModeOverlay(), loadSlotScreen(), main(), markNextSkillKnown(), measureText(), moveTransitionTile(), newGame(), openFieldMenu(), openFieldMenu(), pickBattleDigivolve(), pickEvenFighterPrize(), pickMember(), pickOddFighterPrize(), pickPartner(), putPickedEntry(), raisePartnerLevel(), requestMode(), resetPlayTime(), reviveParty(), runDigivolveMenu(), setBattleKind(), setPartnerEntry(), setPartnerSlots(), setParty(), setStat(), setUpBattle(), setupStage(), SHOCKTST_updateLoader(), showFieldMenuMoney(), showPartnerPage(), showRecipeTitle(), sleepAtInn(), SOUNDTST_updateScene(), SOUNDTST_updateSoundTest(), STAGSLCT_startStageSelect(), STAGSLCT_updateStageSelect(), startEvent9000(), startEvent9001(), startField(), STCRDABM_drawCards(), STCRDABM_drawTurningSlots(), STCRDABM_findPageCards(), STCRDABM_pageHasCards(), STCRDABM_showCardInfo(), STCRDABM_updateAlbum(), STCRDDEK_buildCardList(), STCRDDEK_chooseListCard(), STCRDDEK_countCardKinds(), STCRDDEK_drawDeckCards(), STCRDDEK_drawEditor(), STCRDDEK_loadNextCard(), STCRDDEK_openChosen(), STCRDDEK_showDeckRow(), STCRDDEK_showEditorWindows(), STCRDDEK_sortDeck(), STCRDDEK_updateScreen(), STCRDSHP_chooseBuyCard(), STCRDSHP_confirmBuyCard(), STCRDSHP_createShop(), STCRDSHP_openPack(), STCRDSHP_runPackOpen(), STCRDSHP_showBuyCard(), STCRDSHP_showMoney(), STCRDSHP_showPack(), STCRDSHP_showPackCard(), STCRDSHP_showTitle(), STCRDSHP_updateShop(), STDGNAME_drawMenu(), STDGNAME_showMenuWindow(), STDGNAME_stepScreen(), STDGNAME_updateMenu(), STDGNAME_updateScreen(), STDWTITL_leaveTitle(), STDWTITL_tickMovie(), STDWTITL_tickScreen(), STDWTITL_tickSplash(), stealEnemyItem(), stepFieldMenuFade(), STFGTREP_addDigimonExp(), STFGTREP_addExp(), STFGTREP_addSkill(), STFGTREP_boostExp(), STFGTREP_drawPartner(), STFGTREP_fillPartnerWindows(), STFGTREP_getDigimonExp(), STFGTREP_learnDigimon(), STFGTREP_learnSkill(), STFGTREP_raiseStats(), STFGTREP_runPartner(), STFGTREP_updatePartner(), STFGTREP_updateReport(), STGDGLAB_drawEntryList(), STGDGLAB_drawMenu(), STGDGLAB_drawPartyScreen(), STGDGLAB_packParty(), STGDGLAB_runMenu(), STGDGLAB_runPartyScreen(), STGDGLAB_runSlotScreen(), STGDGLAB_showEntryList(), STGDGLAB_showEntryPanel(), STGDGLAB_showMenuPage(), STGDGLAB_showPartyPage(), STGDGLAB_showSlotScreen(), STGDGLAB_updateEntryList(), STGDGLAB_updateEntryPanel(), STGDGLAB_updateLab(), STGDGLAB_updatePartyScreen(), STGDGLAB_updateRecipeScreen(), STGDGLAB_updateSkillPanel(), STGMCARD_createScreen(), STGMCARD_fillSave(), STGMCARD_updateScreen(), STGTRAIN_answerToTrain(), STGTRAIN_createResult(), STGTRAIN_createScreen(), STGTRAIN_drawScreen(), STGTRAIN_getAccessoryBonus(), STGTRAIN_lowerStat(), STGTRAIN_pickIntensity(), STGTRAIN_raiseMaxHpMp(), STGTRAIN_raiseResistance(), STGTRAIN_raiseStat(), STGTRAIN_runScreen(), STGTRAIN_showBattleStats(), STGTRAIN_showStatChanges(), STGTRAIN_showTp(), STGTRAIN_showVitals(), STGTRAIN_startBonusTry(), STGTRAIN_takeBonusTry(), STGTRAIN_updateMenu(), STGTRAIN_updateResult(), STGTRAIN_updateScreen(), STITSHOP_chooseBuyQuantity(), STITSHOP_chooseEquipPartner(), STITSHOP_closeSellTotal(), STITSHOP_compareEquip(), STITSHOP_computeStats(), STITSHOP_confirmBuy(), STITSHOP_confirmSell(), STITSHOP_createShop(), STITSHOP_drawStatsPage(), STITSHOP_endBuyTotal(), STITSHOP_endEquipped(), STITSHOP_equip(), STITSHOP_fillPartnerRows(), STITSHOP_openSellQuantity(), STITSHOP_pickBuyItem(), STITSHOP_runShop(), STITSHOP_showEquipMarker(), STITSHOP_showItemRows(), STITSHOP_showMoney(), STITSHOP_showPartnerStats(), STITSHOP_startBuyQuantity(), STITSHOP_updateInfo(), STITSHOP_updateShop(), STPLNMET_stepScreen(), STPLNMET_updateScreen(), STSTATUS_animateItemPortraits(), STSTATUS_animateSortPortraits(), STSTATUS_animateTechPortraits(), STSTATUS_answerDigivolveQuestion(), STSTATUS_chooseDemoOption(), STSTATUS_createEquipPanel(), STSTATUS_drawCardScreen(), STSTATUS_drawDemoScreen(), STSTATUS_drawDigivolvePanel(), STSTATUS_drawEquipPanel(), STSTATUS_drawItemScreen(), STSTATUS_drawMapScreen(), STSTATUS_drawSortScreen(), STSTATUS_drawStatusScreen(), STSTATUS_drawTechScreen(), STSTATUS_endCardScreen(), STSTATUS_equip(), STSTATUS_getArea(), STSTATUS_getChosenTech(), STSTATUS_getGameHalf(), STSTATUS_getTechHealing(), STSTATUS_listFieldTechs(), STSTATUS_previewStats(), STSTATUS_runDigivolvePanel(), STSTATUS_runStatusChoice(), STSTATUS_showBattleMessage(), STSTATUS_showCardPage(), STSTATUS_showChosenItem(), STSTATUS_showChosenPage(), STSTATUS_showDemoChoices(), STSTATUS_showDemoPage(), STSTATUS_showDigivolveChoices(), STSTATUS_showDigivolveSlots(), STSTATUS_showDigivolveStats(), STSTATUS_showEquipList(), STSTATUS_showEquipment(), STSTATUS_showItemPage(), STSTATUS_showMoney(), STSTATUS_showPartnerEquipment(), STSTATUS_showPartnerSlots(), STSTATUS_showPartnerStats(), STSTATUS_showPartnerTech(), STSTATUS_showSlotItem(), STSTATUS_showSortPage(), STSTATUS_showStatusPage(), STSTATUS_showTechCost(), STSTATUS_showTechPage(), STSTATUS_swapMembers(), STSTATUS_updateCardScreen(), STSTATUS_updateDemoScreen(), STSTATUS_updateDigivolvePanel(), STSTATUS_updateItemScreen(), STSTATUS_updateSortScreen(), STSTATUS_updateStatusScreen(), STSTATUS_updateTechScreen(), STSTATUS_useItem(), STSTATUS_useTech(), takePartyDepth(), textCodePlayerName(), textWindowInsertPlayerName(), unequipItem(), updateDarkness(), updateEvent9015(), updateGlow(), updateInn(), updateInnMenu(), updateModeFlags(), updateModeTask(), updatePlayTime(), updateStage(), updateStage(), updateTimer(), vsyncCallback(), warpAway(), WFIGHTMN_blast(), WFIGHTMN_cancelBlast(), WFIGHTMN_chargeGauge(), WFIGHTMN_checkEquip(), WFIGHTMN_digidevolve(), WFIGHTMN_endAutoRecover(), WFIGHTMN_endBattle(), WFIGHTMN_initFighters(), WFIGHTMN_markFought(), WFIGHTMN_markPicked(), WFIGHTMN_rollAmbush(), and WFIGHTMN_tag().