src/game/game_djinn.c
The Djinn the party holds: a Djinni found and given to a member, set or put on standby, moved between members and back from recovery, and the counts the menus show. More…
Included by game.c.
Macros
| Name | Description | |
|---|---|---|
#define | DJINN_HELD_PER_ELEMENT_MAX 10 | The most Djinn of one element a party member holds or sets. |
#define | DJINN_COUNT_NONE 999 | More Djinn than any party member can hold: where the search for the member holding fewest starts, and what it still reads when nobody has room. |
Functions
| Name | Description | |
|---|---|---|
const DJINN_DEFINITION * | gmDjinnGetDefinition (Uint32 element, Uint32 djinn) | Returns the definition of Djinni djinn of element; anything out of range gives DJINNI_FLINT's. |
Sint32 | gmDjinnGiveToParty (Sint32 element, Sint32 djinn) | Gives a newly found Djinni to the party member holding the fewest Djinn who has room, on standby. |
Sint32 | gmDjinnGive (Sint32 unitId, Sint32 element, Sint32 djinnIndex) | Gives a Djinni to a unit. |
Bool | gmDjinnCanSet (Sint32 unitId, Sint32 element, Sint32 djinnIndex) | Returns 1 when the unit holds the Djinni and it can be set: not set, not recovering and not held by a summon. |
Uint32 | gmDjinnIsSet (Sint32 unitId, Sint32 element, Sint32 djinnIndex) | Returns 1 when the Djinni is set on the unit. |
Sint32 | gmDjinnSet (Sint32 unitId, Sint32 element, Sint32 djinnIndex) | Sets a ready Djinni on the unit, counts it and works out the unit's class again. |
Uint32 | gmDjinnPutOnStandby (Sint32 unitId, Sint32 element, Sint32 djinnIndex) | Takes a set Djinni off the unit and works out its class again. |
Sint32 | gmDjinnRecoveryRemove (Sint32 unitId, Sint32 element, Sint32 djinnIndex) | Takes the Djinni off its side's standby and recovery list, closing the gap. |
Uint32 * | gmDjinnRecoveryAddStandby (Uint32 unitId, Uint32 element, Uint32 djinnIndex) | Puts a unit's Djinni at the end of its side's list on standby, and returns the address of the list's count. |
Sint32 | gmDjinnTransfer (Sint32 src, Sint32 element, Sint32 djinnIndex, Sint32 target) | Moves a Djinni from one unit to another, set or on standby as it was. |
Sint32 | gmDjinnRecoveryCountStandby (Uint8 *counts) | Counts the party's Djinn on standby, and by element into counts when it is given. |
Uint16 | gmDjinnGetAbilityId (Uint32 element, Uint32 djinn) | Returns the ability the Djinni performs when it is unleashed. |
Sint32 | gmOwnerSumDjinnCounts (Sint32 unitId, Sint32 element) | Returns how many Djinn of element the unit holds, or of every element for -1. |
Sint32 | gmPartySumDjinnCounts (Sint32 element) | Returns how many Djinn of element the party holds, or of all elements for -1. |
void | gmDjinnSetAllForParty (void) | Counts the Djinn recovery down, then sets every Djinni each party member holds and can set, taking it off the recovery list. |
Description
The Djinn the party holds: a Djinni found and given to a member, set or put
on standby, moved between members and back from recovery, and the counts the
menus show. Part of game.c.
Macros in detail
DJINN_HELD_PER_ELEMENT_MAX
#define DJINN_HELD_PER_ELEMENT_MAX 10
The most Djinn of one element a party member holds or sets.
Referenced by gmDjinnCanSet(), gmDjinnGive() and gmDjinnGiveToParty().
Definition at line 6 of file game_djinn.c.
DJINN_COUNT_NONE
#define DJINN_COUNT_NONE 999
More Djinn than any party member can hold: where the search for the member holding fewest starts, and what it still reads when nobody has room.
Referenced by gmDjinnGiveToParty().
Definition at line 9 of file game_djinn.c.
Functions in detail
gmDjinnGetDefinition
const DJINN_DEFINITION *gmDjinnGetDefinition(Uint32 element, Uint32 djinn)
Returns the definition of Djinni djinn of element; anything out of range
gives DJINNI_FLINT's.
References DjinnDefinitionTable and Sint32.
Referenced by gmDjinnGetAbilityId() and gmUnitCalculate().
Definition at line 13 of file game_djinn.c.
gmDjinnGiveToParty
Sint32 gmDjinnGiveToParty(Sint32 element, Sint32 djinn)
Gives a newly found Djinni to the party member holding the fewest Djinn who has room, on standby. Returns who got it, -1 if found before, -2 when nobody has room.
References gmDjinnGive(), gmDjinnRecoveryAddStandby(), gmPartyCountMembers(), gmUnitGet(), MainRoutineStateWork, Sint32, syGameFlagGet() and syGameFlagSet().
Referenced by dbShopTestGivePartyDjinn(), gmDataTransferGiveDefaultDjinn() and scClearApplyImportedData().
Definition at line 25 of file game_djinn.c.
gmDjinnGive
Sint32 gmDjinnGive(Sint32 unitId, Sint32 element, Sint32 djinnIndex)
Gives a Djinni to a unit. Returns -1 when the unit holds
DJINN_HELD_PER_ELEMENT_MAX of the element or has it already.
References gmUnitGet() and Sint32.
Referenced by dbPsynergyTestGiveDjinni(), dbShopTestGiveDjinni(), gmDjinnAddFoundToOwner(), gmDjinnGiveToParty(), gmDjinnTransfer(), gmPartyGivePiersDjinn() and scWorldMapMeetEcho().
Definition at line 67 of file game_djinn.c.
gmDjinnCanSet
Bool gmDjinnCanSet(Sint32 unitId, Sint32 element, Sint32 djinnIndex)
Returns 1 when the unit holds the Djinni and it can be set: not set, not recovering and not held by a summon.
References gmDjinnGetRecoveryTable(), gmUnitGet() and Sint32.
Referenced by gmDjinnSet() and gmDjinnSetAllForParty().
Definition at line 82 of file game_djinn.c.
gmDjinnIsSet
Uint32 gmDjinnIsSet(Sint32 unitId, Sint32 element, Sint32 djinnIndex)
Returns 1 when the Djinni is set on the unit.
References gmUnitGet() and Sint32.
Referenced by gmDjinnPutOnStandby() and gmDjinnTransfer().
Definition at line 117 of file game_djinn.c.
gmDjinnSet
Sint32 gmDjinnSet(Sint32 unitId, Sint32 element, Sint32 djinnIndex)
Sets a ready Djinni on the unit, counts it and works out the unit's class again. Returns 1 when it was set.
References gmDjinnCanSet(), gmUnitGet(), gmUnitUpdateClass() and Sint32.
Referenced by dbPsynergyTestGiveDjinni(), dbShopTestGiveDjinni(), gmDjinnSetAllForParty(), gmDjinnTransfer() and gmPartyGivePiersDjinn().
Definition at line 126 of file game_djinn.c.
gmDjinnPutOnStandby
Uint32 gmDjinnPutOnStandby(Sint32 unitId, Sint32 element, Sint32 djinnIndex)
Takes a set Djinni off the unit and works out its class again. Returns 1 when it was set.
References gmDjinnIsSet(), gmUnitGet(), gmUnitUpdateClass() and Sint32.
Referenced by gmDjinnTransfer().
Definition at line 145 of file game_djinn.c.
gmDjinnRecoveryRemove
Sint32 gmDjinnRecoveryRemove(Sint32 unitId, Sint32 element, Sint32 djinnIndex)
Takes the Djinni off its side's standby and recovery list, closing the gap. Returns 1 when it was there.
References gmDjinnGetRecoveryTable() and Sint32.
Referenced by gmDjinnRecoveryAddStandby(), gmDjinnSetAllForParty() and gmDjinnTransfer().
Definition at line 161 of file game_djinn.c.
gmDjinnRecoveryAddStandby
Uint32 * gmDjinnRecoveryAddStandby(Uint32 unitId, Uint32 element, Uint32 djinnIndex)
Puts a unit's Djinni at the end of its side's list on standby, and returns the address of the list's count. Nothing checks the list's capacity.
References gmDjinnGetRecoveryTable(), gmDjinnRecoveryRemove() and Sint32.
Referenced by gmDjinnAddFoundToOwner(), gmDjinnGiveToParty(), gmDjinnTransfer() and scWorldMapMeetEcho().
Definition at line 187 of file game_djinn.c.
gmDjinnTransfer
Sint32 gmDjinnTransfer(Sint32 src, Sint32 element, Sint32 djinnIndex, Sint32 target)
Moves a Djinni from one unit to another, set or on standby as it was. Returns -1 when it cannot.
References gmDjinnGive(), gmDjinnIsSet(), gmDjinnPutOnStandby(), gmDjinnRecoveryAddStandby(), gmDjinnRecoveryRemove(), gmDjinnSet(), gmUnitGet() and Sint32.
Referenced by gmPartyBalanceDjinn().
Definition at line 206 of file game_djinn.c.
gmDjinnRecoveryCountStandby
Sint32 gmDjinnRecoveryCountStandby(Uint8 *counts)
Counts the party's Djinn on standby, and by element into counts when it is
given.
References gmDjinnGetRecoveryTable() and Sint32.
Definition at line 238 of file game_djinn.c.
gmDjinnGetAbilityId
Uint16 gmDjinnGetAbilityId(Uint32 element, Uint32 djinn)
Returns the ability the Djinni performs when it is unleashed.
References gmDjinnGetDefinition().
Definition at line 267 of file game_djinn.c.
gmOwnerSumDjinnCounts
Sint32 gmOwnerSumDjinnCounts(Sint32 unitId, Sint32 element)
Returns how many Djinn of element the unit holds, or of every element for
-1.
References gmUnitGet(), result and Sint32.
Definition at line 274 of file game_djinn.c.
gmPartySumDjinnCounts
Sint32 gmPartySumDjinnCounts(Sint32 element)
Returns how many Djinn of element the party holds, or of all elements for
-1.
References gmPartyListMembers(), gmUnitGet() and Sint32.
Definition at line 296 of file game_djinn.c.
gmDjinnSetAllForParty
void gmDjinnSetAllForParty(void)
Counts the Djinn recovery down, then sets every Djinni each party member holds and can set, taking it off the recovery list.
References btDjinnRecoverAllStub(), gmDjinnCanSet(), gmDjinnRecoveryRemove(), gmDjinnSet(), gmPartyListMembers() and Sint32.
Referenced by gmDataTransferApply(), gmDataTransferGiveDefaultDjinn() and gmPartyAddIsaacsParty().
Definition at line 324 of file game_djinn.c.