Alchemy
Loading...
Searching...
No Matches

party.c File Reference

Enemy units, the active party, coins and counters, and summons. More...

Go to the source code of this file.

Data Structures

struct  TradeFlags
 The party's Djinn recovery table as the summon list reads it: a mask of summons, bit n for summon n. More...

Macros

#define ENEMY_SUFFIX_FIRST   '1'
#define ENEMY_SUFFIX_LAST   8
#define PARTY_DEFINE_ADJUST(name, field, max)
 Each adds amount to a game state counter, kept between 0 and max, and returns the new value.

Functions

s32 BattleUnitSet (s32 unitId, s32 enemyId, s32 suffix)
 Fills battle unit unitId (0x80 to 0x86) with enemy enemyId: stats, name with its suffix letter, the items it carries, rewards and elements.
s32 Party_CountActiveOwners (void)
 Returns the number of party members, counted from game flags 0 to 7.
s32 Party_AddActiveOwner (s32 owner)
 Adds character owner to the end of the party: sets its game flag and appends it to gGameState.activeOwners unless it is already listed.
s32 Party_RemoveActiveOwner (s32 owner)
 Takes character owner out of the party: clears its game flag and closes the gap it leaves in gGameState.activeOwners.
s32 Party_ListActiveOwners (s16 *owners)
 Writes the party members to owners, ending with 0xff, and returns how many there are.
s32 Party_AdjustCoins (s32 amount)
 Adds amount to the party's coins, kept between 0 and 999999, and returns the new total.
s32 Party_AdjustShopCredit (s32 amount)
s32 Party_AdjustShopGifts (s32 amount)
s32 Summon_ListLearned (u8 *output)
 Writes the summons whose bit is set in the first word of the party's Djinn table to output, in menu order, ending with 32.
const struct SummonDefinition * SummonDefinition_GetNear (u32 summonId)
 Returns summon summonId's definition, or NULL past the sixteenth.

Detailed Description

Enemy units, the active party, coins and counters, and summons.

Part of game.c, the game object, compiled only through it.

Definition in file party.c.

Macro Definition Documentation

◆ ENEMY_SUFFIX_FIRST

#define ENEMY_SUFFIX_FIRST   '1'

Definition at line 10 of file party.c.

Referenced by BattleUnitSet().

◆ ENEMY_SUFFIX_LAST

#define ENEMY_SUFFIX_LAST   8

Definition at line 11 of file party.c.

Referenced by BattleUnitSet().

◆ PARTY_DEFINE_ADJUST

#define PARTY_DEFINE_ADJUST ( name,
field,
max )
Value:
s32 name(s32 amount) { \
s32 value; \
struct GameState *progress = &gGameState; \
\
value = progress->field; \
value += amount; \
if (value > max) \
value = max; \
if (value < 0) \
value = 0; \
progress->field = value; \
return value; \
}
struct GameState gGameState
The game's state: play time, coins, the scene and the leader's position, the active party and the opt...
Definition game_state.h:14
signed int s32
Definition types.h:14

Each adds amount to a game state counter, kept between 0 and max, and returns the new value.

The shops call the two: each purchase adds its price to the credit, and each Game Ticket given spends credit and counts one more gift.

Definition at line 225 of file party.c.

Referenced by Party_AdjustShopCredit(), and Party_AdjustShopGifts().

Function Documentation

◆ BattleUnitSet()

s32 BattleUnitSet ( s32 unitId,
s32 enemyId,
s32 suffix )

Fills battle unit unitId (0x80 to 0x86) with enemy enemyId: stats, name with its suffix letter, the items it carries, rewards and elements.

Enemies 158 to 171 fight on the party's side. Returns 0 for an id out of range. Called by the battle set-up (Battle_RunEncounter, BattleFormation_BuildEnemyList) and by BattleTargetExec when an enemy calls for help. XXX: which enemies 158 to 171 are, and when they join the party's side, is unknown; the encounter tables that place them would say.

Definition at line 25 of file party.c.

Referenced by BattleUnitSet().

◆ Party_CountActiveOwners()

◆ Party_AddActiveOwner()

s32 Party_AddActiveOwner ( s32 owner)

Adds character owner to the end of the party: sets its game flag and appends it to gGameState.activeOwners unless it is already listed.

Returns the party size. Called by the scenes where a character joins, by the member chooser and the file select screen, and by the debug presets.

Definition at line 135 of file party.c.

Referenced by BabiPalace_RestorePartyAndInventory(), ColosseumEntrance_ApplyArrivalState(), ColosseumEntrance_EscortToEastExit(), ColosseumEntrance_EscortToWestExit(), Colosso_ControlCharacterAlone(), Colosso_OfferCheeringSpot(), CommandTable_ConfigureCommandList(), GameState_InitDefaults(), Party_AddActiveOwner(), and SaveMenu_Run().

◆ Party_RemoveActiveOwner()

s32 Party_RemoveActiveOwner ( s32 owner)

Takes character owner out of the party: clears its game flag and closes the gap it leaves in gGameState.activeOwners.

Returns the party size. Called by the scenes where a character leaves, by the member chooser and the file select screen, and by the debug presets.

Definition at line 154 of file party.c.

Referenced by ColosseumEntrance_EscortToEastExit(), ColosseumEntrance_EscortToWestExit(), Colosso_ControlCharacterAlone(), Colosso_OfferCheeringSpot(), CommandTable_ConfigureCommandList(), Party_RemoveActiveOwner(), and SaveMenu_Run().

◆ Party_ListActiveOwners()

s32 Party_ListActiveOwners ( s16 * owners)

Writes the party members to owners, ending with 0xff, and returns how many there are.

Every screen that lists the party starts here: the menus, the shops, the inn and the party inventory searches.

Definition at line 173 of file party.c.

Referenced by FieldParty_ListActiveOwners(), Party_ListActiveOwners(), Party_SumDjinnCounts(), PartyInventory_Add(), PartyInventory_CountFreeSlots(), PartyInventory_CountItem(), PartyInventory_FindOwner(), and PartyInventory_HasSpace().

◆ Party_AdjustCoins()

s32 Party_AdjustCoins ( s32 amount)

Adds amount to the party's coins, kept between 0 and 999999, and returns the new total.

Called by the shops, the inn and the sanctum to charge, by the battle spoils to pay, and by the Lucky Dice game.

Definition at line 195 of file party.c.

Referenced by KalayTolbiDocks_TalkToTicketSeller(), Party_AdjustCoins(), and TolbiSpring_RunSpringGame().

◆ Party_AdjustShopCredit()

s32 Party_AdjustShopCredit ( s32 amount)

Definition at line 240 of file party.c.

Referenced by Party_AdjustShopCredit().

◆ Party_AdjustShopGifts()

s32 Party_AdjustShopGifts ( s32 amount)

Definition at line 241 of file party.c.

Referenced by Party_AdjustShopGifts().

◆ Summon_ListLearned()

s32 Summon_ListLearned ( u8 * output)

Writes the summons whose bit is set in the first word of the party's Djinn table to output, in menu order, ending with 32.

Returns how many. Called by SummonMenu_SelectSummon to list the battle's Summon command.

Definition at line 246 of file party.c.

Referenced by Summon_ListLearned().

◆ SummonDefinition_GetNear()

const struct SummonDefinition * SummonDefinition_GetNear ( u32 summonId)

Returns summon summonId's definition, or NULL past the sixteenth.

Reached only through GAME.S, as SummonDefinition_Get.

Definition at line 265 of file party.c.

Referenced by SummonDefinition_GetNear().