src/game/game_units.c
The party's units and their stats, a new game, HP and PP, and the data transfer from The Broken Seal up to Isaac's party joining at Contigo. More…
#include "macros.h"#include "field/engine_stubs.h"#include "window/stubs.h"#include "window/window.h"
Included by game.c.
Macros
| Name | Description | |
|---|---|---|
#define | UNIT_STAT_DIFF (a, b) ((a) - (b) < 0 ? (b) - (a) : (a) - (b)) | The distance between a and b, |a - b|. |
#define | SCALE_EFFECT (kind) ((kind) - EQUIP_EFFECT_SCALE_HP) | A scaling effect's number among the eight, from EQUIP_EFFECT_SCALE_HP. |
#define | BUILD_STAMP_MARK 0x1000 | Set in every build stamp's time. |
#define | BUILD_STAMP_DEBUG 0xffff8000 | Set on top of the time in a debug build's stamp (DebugMode): bit 15, sign-extended, so that its stamp is above every release build's. |
#define | BUILD_STAMP_SECONDS_PER_MINUTE 64 | A build stamp's time counts 64 seconds to a minute and 16 minutes to an hour, so the minutes past 15 reach into the hours. |
#define | BUILD_STAMP_MINUTES_PER_HOUR 16 | |
#define | SCENE_STATE_WORDS 1992 | The words a new game clears from SceneLocalState up to SoundFlags: the scene's state, the actor snapshot, the rare item stock, the scene state and the inventory snapshot. |
#define | NEW_GAME_COINS 200 | The coins a new game starts with. |
#define | SCENE_STATE_SNAPSHOT_SLOTS 4 | Where SceneLocalState holds the actor snapshot's slot ids, ACTOR_SNAPSHOT_CAPACITY bytes before SnapshotObjects. |
#define | SCENE_STATE_RANDOM_ROWS 4536 | The two tables a new game fills just after RareItemStock's ITEM_COUNTER_COUNT counters, as places in SceneLocalState: 32 rows of eight random numbers 0 to 4, SCENE_STATE_RANDOM_ROW_BYTES apart, then a copy of NewGameSceneStateTable. |
#define | SCENE_STATE_RANDOM_ROW_COUNT 32 | |
#define | SCENE_STATE_RANDOM_ROW_BYTES 12 | |
#define | SCENE_STATE_TABLE_COPY | |
#define | DJINN_COUNT_ABOVE_ANY 999 | More Djinn than a party member can hold: where the search for the fewest starts. |
#define | DEFAULT_TRANSFER_DJINN 16 | The Djinn of The Broken Seal handed out at random, besides Flint and Fizz, when the player transfers none. |
#define | UNIT_DEFINE_SET (name, field, maximum) | Each sets the unit's HP or PP, clamped to 0 and its maximum, and recomputes its HP and PP gauges. |
#define | UNIT_DEFINE_ADD (type, name, field, maximum) | Each adds delta to the HP or PP of unit unitId, clamped to 0 and its maximum, recomputes its gauges and returns the new value, as type. |
Functions
| Name | Description | |
|---|---|---|
void | gmRestartQuest (void) | Starts a new game: clears the main routine's state and restarts at the opening. |
DJINN_RECOVERY_TABLE * | gmDjinnGetRecoveryTable (Sint32 enemySide) | Returns a side's Djinn recovery table, its standby Djinn and their turns to recover: the party's, or for the enemy side (a link battle's opponent) the fourth enemy unit's memory, which an opponent of three never fills. |
Uint32 | gmPartyGetAverageLevel (void) | Returns the average level of the party members, rounded down (0 with no party members). |
const ENEMY_DEFINITION * | gmEnemyGetDefinition (Sint32 enemyId) | Returns the definition of enemy enemyId; enemy ids start past the eight characters', so that one id names any unit. |
void | gmMemoryCopyBytesDirectional (Uint8 *first, Uint8 *second, Sint32 count, Sint32 direction) | Copies count bytes from first to second when direction is set, and from second to first otherwise. |
void | gmUnitCalculate (Sint32 unitId) | Works out a unit's stats from its base stats, equipment, set Djinn, class and battle stat levels; its HP and PP keep their share of a new maximum. |
void | gmFlagRefreshLureCap (void) | Sets FLAG_LURE_CAP when any party member has the Lure Cap (the one item with EQUIP_EFFECT_LURE) equipped, and clears it otherwise. |
static __inline__ FIXED | gmUnitGetPpRatio (Sint32 unitId) | Returns the unit's PP over its maximum PP, in 16.16; 0 with no maximum. |
FIXED | gmPartyGetPpRatio (void) | Returns the party's PP over its maximum PP, in 16.16; 0 with no members. |
Sint32 | gmPartyDrainPpFromFullest (void) | Takes 1 PP from the member whose PP is fullest for its maximum. |
void | gmPartyDrainPp (Sint32 count) | Takes count PP from the party, one at a time from the fullest member. |
Uint32 | gmBuildStampGetTime (void) | Encodes the build stamp's time, which a new game takes as its start stamp and the file list compares saves with. |
static __inline__ void | gmWaitDMA (DMA_REGISTERS volatile *channel) | Waits until the DMA channel's transfer is done. |
void | gmMainRoutineStateInitDefaults (void) | Starts a new game's state: clears MainRoutineStateWork, the scene state and the snapshots, the flags and the characters by DMA, builds the characters, sets the defaults (the button layout, Felix and Jenna in the party, their first Psynergy, NEW_GAME_COINS, the message settings and the play time clock) and fills the two tables after the rare item stock. |
void | gmPartySetLeaderJenna (void) | Makes Jenna the leader. |
void | gmPartySetLeaderFelix (void) | Makes Felix the leader, with Jenna and Sheba out of the party. |
void | gmPartyGivePiersDjinn (void) | Gives Piers his two Mercury Djinn, Spring and Shade (Mercury 9 and 10), set, then evens out the party's Djinn and recalculates its members. |
void | gmPartyRestoreHpPp (Sint32 cureConditions) | Restores every party member's HP and PP; with cureConditions 1 it also cures poison and haunting. |
void | gmPartyRestorePpInLighthouse (void) | Restores the PP of each party member whose element group's lighthouse the party is inside: Venus or Mars for Isaac, Garet, Felix and Jenna, Mercury or Jupiter for the others. |
Sint32 | gmUnitFindLastDjinn (Sint32 unitId, Sint32 *elementOut, Sint32 *indexOut) | Writes the element and index of the unit's last Djinni and returns 0, or returns -1 when it has none. |
void | gmPartyBalanceDjinn (void) | Until the party members' Djinn counts are within one, moves the last Djinni of the member holding most to the member holding fewest. |
Sint32 | gmFlagBitsTest (Uint8 *bytes, Sint32 flag) | Returns flag flag of flag bytes laid out as GameFlagBytes: another save's flags, as gmDataTransferApply reads them. |
void | gmDataTransferApply (Uint8 *save, Sint32 byPassword) | The data transfer from Golden Sun ("Transfer data from Golden Sun", MsgTransferDataFromGoldenSun): copies the Djinn, six of the flags, the coins, the options (when the data came by link rather than by password) and the four units of a save of The Broken Seal into this game's state. |
void | gmClearDataApply (Uint8 *save) | Carries Clear Data over to a new quest: the options, coins and each unit's base stats, level and experience. |
void | gmPartyGiveItemIfMissing (Sint32 item, Sint32 unitId) | Gives item to unitId unless a party member already carries one. |
void | gmPartyAddIsaacsParty (void) | Isaac's party joins: the transferred Djinn flags move to their places, Isaac, Garet, Ivan and Mia join with their Djinn evened out and restored, a missing Djinni of each element is picked, and the transferred items and coins are given. |
void | gmUnitReservedNoOperation (void) | Unused: does nothing; its entry in the game's stub table (stubs.s) has no caller. |
void | gmDjinnAddFoundToOwner (Sint32 unitId, Sint32 element, Sint32 djinn) | Gives character unitId a Djinni on standby and sets its found flag, as if met in the field. |
void | gmDataTransferGiveDefaultDjinn (void) | Stands in for transferred data when the player transfers none: unless the transferred Djinn are already set, sets the party aside, makes Isaac's party the party, gives it Flint and Fizz, then hands out DEFAULT_TRANSFER_DJINN random Djinn of The Broken Seal's still unowned, keeping the elements' counts within one, each with its chance in DataTransferDjinnChances; then moves the Djinn flags to the transferred ones and puts the party back. |
void | gmUnitRecalculateGauges (Sint32 unitId) | Recomputes the HP and PP gauges of unitId from its current HP and PP, so that gmUnitCalculate keeps the same fractions. |
static inline Sint32 | gmUnitClampGaugeValue (Sint32 value, Sint32 maximum) | Clamps a new HP or PP value to 0 and the maximum. |
Description
The party's units and their stats, a new game, HP and PP, and the data
transfer from The Broken Seal up to Isaac's party joining at Contigo. Part of
game.c.
Macros in detail
UNIT_STAT_DIFF
#define UNIT_STAT_DIFF(a, b) ((a) - (b) < 0 ? (b) - (a) : (a) - (b))
The distance between a and b, |a - b|.
Referenced by gmUnitCalculate().
Definition at line 85 of file game_units.c.
SCALE_EFFECT
#define SCALE_EFFECT(kind) ((kind) - EQUIP_EFFECT_SCALE_HP)
A scaling effect's number among the eight, from EQUIP_EFFECT_SCALE_HP.
Referenced by gmUnitCalculate().
Definition at line 88 of file game_units.c.
BUILD_STAMP_MARK
#define BUILD_STAMP_MARK 0x1000
Set in every build stamp's time.
Referenced by gmBuildStampGetTime().
Definition at line 537 of file game_units.c.
BUILD_STAMP_DEBUG
#define BUILD_STAMP_DEBUG 0xffff8000
Set on top of the time in a debug build's stamp (DebugMode): bit 15,
sign-extended, so that its stamp is above every release build's.
Referenced by gmBuildStampGetTime().
Definition at line 540 of file game_units.c.
BUILD_STAMP_SECONDS_PER_MINUTE
#define BUILD_STAMP_SECONDS_PER_MINUTE 64
A build stamp's time counts 64 seconds to a minute and 16 minutes to an hour, so the minutes past 15 reach into the hours.
Referenced by gmBuildStampGetTime().
Definition at line 543 of file game_units.c.
BUILD_STAMP_MINUTES_PER_HOUR
#define BUILD_STAMP_MINUTES_PER_HOUR 16
Referenced by gmBuildStampGetTime().
Definition at line 544 of file game_units.c.
SCENE_STATE_WORDS
#define SCENE_STATE_WORDS 1992
The words a new game clears from SceneLocalState up to SoundFlags: the
scene's state, the actor snapshot, the rare item stock, the scene state and
the inventory snapshot.
Referenced by gmMainRoutineStateInitDefaults().
Definition at line 586 of file game_units.c.
NEW_GAME_COINS
#define NEW_GAME_COINS 200
The coins a new game starts with.
Referenced by gmMainRoutineStateInitDefaults().
Definition at line 588 of file game_units.c.
SCENE_STATE_SNAPSHOT_SLOTS
#define SCENE_STATE_SNAPSHOT_SLOTS 4
Where SceneLocalState holds the actor snapshot's slot ids,
ACTOR_SNAPSHOT_CAPACITY bytes before SnapshotObjects.
Referenced by gmMainRoutineStateInitDefaults().
Definition at line 591 of file game_units.c.
SCENE_STATE_RANDOM_ROWS
#define SCENE_STATE_RANDOM_ROWS 4536
The two tables a new game fills just after RareItemStock's ITEM_COUNTER_COUNT
counters, as places in SceneLocalState: 32 rows of eight random numbers 0 to
4, SCENE_STATE_RANDOM_ROW_BYTES apart, then a copy of NewGameSceneStateTable.
Referenced by gmMainRoutineStateInitDefaults().
Definition at line 595 of file game_units.c.
SCENE_STATE_RANDOM_ROW_COUNT
#define SCENE_STATE_RANDOM_ROW_COUNT 32
Referenced by gmMainRoutineStateInitDefaults().
Definition at line 596 of file game_units.c.
SCENE_STATE_RANDOM_ROW_BYTES
#define SCENE_STATE_RANDOM_ROW_BYTES 12
Referenced by gmMainRoutineStateInitDefaults().
Definition at line 597 of file game_units.c.
SCENE_STATE_TABLE_COPY
#define SCENE_STATE_TABLE_COPY
Referenced by gmMainRoutineStateInitDefaults().
Definition at line 598 of file game_units.c.
DJINN_COUNT_ABOVE_ANY
#define DJINN_COUNT_ABOVE_ANY 999
More Djinn than a party member can hold: where the search for the fewest starts.
Referenced by gmPartyBalanceDjinn().
Definition at line 851 of file game_units.c.
DEFAULT_TRANSFER_DJINN
#define DEFAULT_TRANSFER_DJINN 16
The Djinn of The Broken Seal handed out at random, besides Flint and Fizz, when the player transfers none.
Referenced by gmDataTransferGiveDefaultDjinn().
Definition at line 1147 of file game_units.c.
UNIT_DEFINE_SET
#define UNIT_DEFINE_SET(name, field, maximum)
Each sets the unit's HP or PP, clamped to 0 and its maximum, and recomputes its HP and PP gauges.
Definition at line 1268 of file game_units.c.
UNIT_DEFINE_ADD
#define UNIT_DEFINE_ADD(type, name, field, maximum)
Each adds delta to the HP or PP of unit unitId, clamped to 0 and its maximum,
recomputes its gauges and returns the new value, as type.
Definition at line 1282 of file game_units.c.
Functions in detail
gmRestartQuest
void gmRestartQuest(void)
Starts a new game: clears the main routine's state and restarts at the opening.
References gmMainRoutineRunStub() and gmMainRoutineStateInitDefaults().
Definition at line 12 of file game_units.c.
gmDjinnGetRecoveryTable
DJINN_RECOVERY_TABLE *gmDjinnGetRecoveryTable(Sint32 enemySide)
Returns a side's Djinn recovery table, its standby Djinn and their turns to recover: the party's, or for the enemy side (a link battle's opponent) the fourth enemy unit's memory, which an opponent of three never fills.
References gmUnitGet(), MainRoutineStateWork and Sint32.
Referenced by gmDjinnCanSet(), gmDjinnRecoveryAddStandby(), gmDjinnRecoveryCountStandby(), gmDjinnRecoveryRemove(), gmSummonLearn(), gmSummonListLearned(), scClearApplyImportedData(), scLinkLobbyReceivePartyRecords() and scLinkLobbySendPartyRecords().
Definition at line 21 of file game_units.c.
gmPartyGetAverageLevel
Uint32 gmPartyGetAverageLevel(void)
Returns the average level of the party members, rounded down (0 with no party members).
References gmPartyCountMembers(), gmUnitGet(), MainRoutineStateWork and Sint32.
Referenced by scContigoOfferLuckyDice() and scContigoOfferSuperLuckyDice().
Definition at line 30 of file game_units.c.
gmEnemyGetDefinition
const ENEMY_DEFINITION *gmEnemyGetDefinition(Sint32 enemyId)
Returns the definition of enemy enemyId; enemy ids start past the eight
characters', so that one id names any unit.
References EnemyDefinitions and Sint32.
Referenced by gmBattleAbilityIsWeakToEffect(), gmEnemyGetAttackElement(), gmUnitCalculateBaseElements() and gmUnitGetElementLevels().
Definition at line 46 of file game_units.c.
gmMemoryCopyBytesDirectional
void gmMemoryCopyBytesDirectional(Uint8 *first, Uint8 *second, Sint32 count, Sint32 direction)
Copies count bytes from first to second when direction is set, and
from second to first otherwise.
References Sint32.
Definition at line 65 of file game_units.c.
gmUnitCalculate
void gmUnitCalculate(Sint32 unitId)
Works out a unit's stats from its base stats, equipment, set Djinn, class and battle stat levels; its HP and PP keep their share of a new maximum.
References gmClassGetDefinition(), gmDjinnGetDefinition(), gmItemGetDefinition(), gmUnitGet(), Sint32, syGameFlagGet(), syHeapAllocateEWRAM() and syHeapRelease().
Referenced by dbIncreaseItemAndLevelRaiseMemberLevel(), dbIncreaseItemAndLevelRunLevelEditor(), dbPsynergyTestDamageAndAfflictParty(), dbPsynergyTestGivePartyDjinn(), dbPsynergyTestGiveTreasureTestStock(), dbShopTestRaisePartyLevels(), gmBattleUnitSet(), gmClearDataApply(), gmDataTransferApply(), gmInventoryClearSlot(), gmInventoryEquip(), gmInventoryRemove(), gmInventorySnapshotRestore(), gmInventorySnapshotSave(), gmPartyAddIsaacsParty(), gmPartyGivePiersDjinn(), gmPartyInitCharacters(), gmUnitLevelUp(), gmUnitLevelUpTo(), scClearApplyImportedData(), scClearReceiveByLink(), scDailaRoomsGiveItem() and scJupiterLighthouseIsaacAndIvanAreHurt().
Definition at line 92 of file game_units.c.
gmFlagRefreshLureCap
void gmFlagRefreshLureCap(void)
Sets FLAG_LURE_CAP when any party member has the Lure Cap (the one item with
EQUIP_EFFECT_LURE) equipped, and clears it otherwise.
References gmItemGetDefinition(), gmPartyCountMembers(), gmUnitGet(), MainRoutineStateWork, Sint32, syGameFlagClear() and syGameFlagSet().
Referenced by dbShopTestDamageAndAfflictParty() and dbShopTestGivePartyDjinn().
Definition at line 438 of file game_units.c.
gmUnitGetPpRatio
static __inline__ FIXED gmUnitGetPpRatio(Sint32 unitId)
Returns the unit's PP over its maximum PP, in 16.16; 0 with no maximum.
References gmUnitGet() and Sint32.
Referenced by gmPartyDrainPpFromFullest().
Definition at line 468 of file game_units.c.
gmPartyGetPpRatio
FIXED gmPartyGetPpRatio(void)
Returns the party's PP over its maximum PP, in 16.16; 0 with no members.
References gmPartyCountMembers(), gmUnitGet(), MainRoutineStateWork and Sint32.
Referenced by gmPartyDrainPp() and scGaugeUpdate().
Definition at line 478 of file game_units.c.
gmPartyDrainPpFromFullest
Sint32 gmPartyDrainPpFromFullest(void)
Takes 1 PP from the member whose PP is fullest for its maximum.
References gmPartyCountMembers(), gmUnitAddPp(), gmUnitGetPpRatio(), MainRoutineStateWork and Sint32.
Referenced by gmPartyDrainPp().
Definition at line 500 of file game_units.c.
gmPartyDrainPp
void gmPartyDrainPp(Sint32 count)
Takes count PP from the party, one at a time from the fullest member.
References gmPartyDrainPpFromFullest(), gmPartyGetPpRatio() and Sint32.
Referenced by scGaugeUpdate().
Definition at line 526 of file game_units.c.
gmBuildStampGetTime
Uint32 gmBuildStampGetTime(void)
Encodes the build stamp's time, which a new game takes as its start stamp and the file list compares saves with.
References DebugMode, Sint32 and syResourceGetTableEntry().
Referenced by gmMainRoutineStateInitDefaults() and scInit().
Definition at line 548 of file game_units.c.
gmWaitDMA
static __inline__ void gmWaitDMA(DMA_REGISTERS volatile *channel)
Waits until the DMA channel's transfer is done.
Referenced by gmMainRoutineStateInitDefaults().
Definition at line 576 of file game_units.c.
gmMainRoutineStateInitDefaults
void gmMainRoutineStateInitDefaults(void)
Starts a new game's state: clears MainRoutineStateWork, the scene state and
the snapshots, the flags and the characters by DMA, builds the characters,
sets the defaults (the button layout, Felix and Jenna in the party, their
first Psynergy, NEW_GAME_COINS, the message settings and the play time clock)
and fills the two tables after the rare item stock.
References AnyFileCleared, BupSlot, CharacterUnits, GameFlagBytes, gmBuildStampGetTime(), gmPartyAddMember(), gmPartyInitCharacters(), gmUnitLearnPsynergy(), gmWaitDMA(), IdleSleepEnabled, IdleTicks, MainRoutineStateWork, NewGameSceneStateTable, PlayTimeTicks, SceneLocalState and Sint32.
Referenced by gmRestartQuest(), scClearEnterPassword() and scInit().
Definition at line 607 of file game_units.c.
gmPartySetLeaderJenna
void gmPartySetLeaderJenna(void)
Makes Jenna the leader.
References MainRoutineStateWork.
Referenced by scInit().
Definition at line 712 of file game_units.c.
gmPartySetLeaderFelix
void gmPartySetLeaderFelix(void)
Makes Felix the leader, with Jenna and Sheba out of the party.
References gmPartyAddMember(), gmPartyRemoveMember() and MainRoutineStateWork.
Referenced by scInit().
Definition at line 718 of file game_units.c.
gmPartyGivePiersDjinn
void gmPartyGivePiersDjinn(void)
Gives Piers his two Mercury Djinn, Spring and Shade (Mercury 9 and 10), set,
then evens out the party's Djinn and recalculates its members. Kibombo calls
it when Piers joins, and the world map (WORLD_MAP_PIERS_DJINN).
References gmDjinnGive(), gmDjinnSet(), gmPartyBalanceDjinn(), gmPartyCountMembers(), gmUnitCalculate(), MainRoutineStateWork, Sint32 and syGameFlagSet().
Referenced by scInit() and scKibomboPiersJoinsParty().
Definition at line 729 of file game_units.c.
gmPartyRestoreHpPp
void gmPartyRestoreHpPp(Sint32 cureConditions)
Restores every party member's HP and PP; with cureConditions 1 it also
cures poison and haunting.
References gmPartyCountMembers(), gmUnitGet(), MainRoutineStateWork and Sint32.
Referenced by gmDataTransferApply(), gmInventorySnapshotSave(), gmPartyAddIsaacsParty(), scInit(), scJupiterLighthouseAlexHealsTheParty(), scLemuriaDrinkFromSpring(), scLemuriaSpringDrinkFromSpring(), scMarsLighthouseAerieUrgeOnToBeacon(), scShamanVillageSetUpHouses() and scWorldMapMeetEcho().
Definition at line 752 of file game_units.c.
gmPartyRestorePpInLighthouse
void gmPartyRestorePpInLighthouse(void)
Restores the PP of each party member whose element group's lighthouse the party is inside: Venus or Mars for Isaac, Garet, Felix and Jenna, Mercury or Jupiter for the others. Nothing calls it or its stub.
References CharacterElementGroupTable, gmPartyCountMembers(), gmUnitGet(), MainRoutineStateWork, Sint32 and syGameFlagGet().
Definition at line 778 of file game_units.c.
gmUnitFindLastDjinn
Sint32 gmUnitFindLastDjinn(Sint32 unitId, Sint32 *elementOut, Sint32 *indexOut)
Writes the element and index of the unit's last Djinni and returns 0, or returns -1 when it has none.
References gmUnitGet() and Sint32.
Referenced by gmPartyBalanceDjinn().
Definition at line 823 of file game_units.c.
gmPartyBalanceDjinn
void gmPartyBalanceDjinn(void)
Until the party members' Djinn counts are within one, moves the last Djinni of the member holding most to the member holding fewest.
References gmDjinnTransfer(), gmPartyCountMembers(), gmUnitFindLastDjinn(), gmUnitGet(), MainRoutineStateWork and Sint32.
Referenced by gmPartyAddIsaacsParty() and gmPartyGivePiersDjinn().
Definition at line 855 of file game_units.c.
gmFlagBitsTest
Sint32 gmFlagBitsTest(Uint8 *bytes, Sint32 flag)
Returns flag flag of flag bytes laid out as GameFlagBytes: another save's
flags, as gmDataTransferApply reads them.
References Sint32.
Referenced by gmDataTransferApply().
Definition at line 907 of file game_units.c.
gmDataTransferApply
void gmDataTransferApply(Uint8 *save, Sint32 byPassword)
The data transfer from Golden Sun ("Transfer data from Golden Sun",
MsgTransferDataFromGoldenSun): copies the Djinn, six of the flags, the coins,
the options (when the data came by link rather than by password) and the four
units of a save of The Broken Seal into this game's state.
References DataTransferFlags, gmDjinnSetAllForParty(), gmFlagBitsTest(), gmInventoryRemove(), gmItemGetDefinition(), gmPartyRestoreHpPp(), gmUnitCalculate(), gmUnitGet(), MainRoutineStateWork, memcpy(), mnWindowColorApplyStub(), PlayTimeTicks, Sint32, syGameFlagClear(), syGameFlagGet() and syGameFlagSet().
Referenced by scInit().
Definition at line 920 of file game_units.c.
gmClearDataApply
void gmClearDataApply(Uint8 *save)
Carries Clear Data over to a new quest: the options, coins and each unit's base stats, level and experience.
References gmUnitCalculate(), gmUnitGet(), MainRoutineStateWork, mnWindowColorApplyStub() and Sint32.
Referenced by scInit().
Definition at line 1012 of file game_units.c.
gmPartyGiveItemIfMissing
void gmPartyGiveItemIfMissing(Sint32 item, Sint32 unitId)
Gives item to unitId unless a party member already carries one.
References gmInventoryAddItem(), gmPartyInventoryFindMember() and Sint32.
Referenced by gmPartyAddIsaacsParty().
Definition at line 1053 of file game_units.c.
gmPartyAddIsaacsParty
void gmPartyAddIsaacsParty(void)
Isaac's party joins: the transferred Djinn flags move to their places, Isaac, Garet, Ivan and Mia join with their Djinn evened out and restored, a missing Djinni of each element is picked, and the transferred items and coins are given. Contigo calls it.
References gmDjinnSetAllForParty(), gmPartyAddMember(), gmPartyBalanceDjinn(), gmPartyGiveItemIfMissing(), gmPartyInventoryRemove(), gmPartyRestoreHpPp(), gmUnitCalculate(), MainRoutineStateWork, SceneLocalState, Sint32, syGameFlagGet(), syGameFlagSet() and syRandom().
Referenced by scContigoTheReunion() and scInit().
Definition at line 1063 of file game_units.c.
gmUnitReservedNoOperation
void gmUnitReservedNoOperation(void)
Unused: does nothing; its entry in the game's stub table (stubs.s) has no
caller.
Definition at line 1129 of file game_units.c.
gmDjinnAddFoundToOwner
void gmDjinnAddFoundToOwner(Sint32 unitId, Sint32 element, Sint32 djinn)
Gives character unitId a Djinni on standby and sets its found flag, as if
met in the field.
References gmDjinnGive(), gmDjinnRecoveryAddStandby(), Sint32 and syGameFlagSet().
Referenced by gmDataTransferGiveDefaultDjinn().
Definition at line 1135 of file game_units.c.
gmDataTransferGiveDefaultDjinn
void gmDataTransferGiveDefaultDjinn(void)
Stands in for transferred data when the player transfers none: unless the
transferred Djinn are already set, sets the party aside, makes Isaac's party
the party, gives it Flint and Fizz, then hands out DEFAULT_TRANSFER_DJINN
random Djinn of The Broken Seal's still unowned, keeping the elements' counts
within one, each with its chance in DataTransferDjinnChances; then moves the
Djinn flags to the transferred ones and puts the party back.
References DataTransferDjinnChances, gmDjinnAddFoundToOwner(), gmDjinnGiveToParty(), gmDjinnSetAllForParty(), gmPartyAddMember(), gmPartyCountMembers(), gmPartyRemoveMember(), MainRoutineStateWork, Sint32, syGameFlagClear(), syGameFlagGet() and syGameFlagSet().
Referenced by scInit().
Definition at line 1155 of file game_units.c.
gmUnitRecalculateGauges
void gmUnitRecalculateGauges(Sint32 unitId)
Recomputes the HP and PP gauges of unitId from its current HP and PP, so
that gmUnitCalculate keeps the same fractions.
References gmUnitGet() and Sint32.
Definition at line 1242 of file game_units.c.
gmUnitClampGaugeValue
static inline Sint32 gmUnitClampGaugeValue(Sint32 value, Sint32 maximum)
Clamps a new HP or PP value to 0 and the maximum.
Definition at line 1251 of file game_units.c.