Skip to Content
The Alchemy Project

src/system/system_flags.c

gmUnitGet (moved here from TBS's game_units.c, keeping its gm prefix for TBS/TLA parity) and the game flags: bits, bytes and nibbles. More…

Included by system.c.

Macros

NameDescription
#defineGAME_FLAG_BYTE_MAX 255The most a counter byte among the flags holds.
#defineGAME_FLAG_NIBBLE_MASK 0xfThe bits of a nibble flag, low or high in its byte by its number's bit 2.

Functions

NameDescription
UNIT *gmUnitGet (Uint32 unitId)Returns the unit of unitId: ISAAC to PIERS the characters, the ENEMY_BATTLE_SIZE from FIRST_ENEMY_UNIT the enemies of the current battle; NULL for anything else.
Sint32syGameFlagGet (Sint32 flag)Returns 1 when flags is set and 0 when it is clear.
Sint32syGameFlagSet (Sint32 flag)Sets flags and returns its byte number.
voidsyGameFlagClear (Sint32 flag)Clears flags.
Uint32syGameFlagToggle (Sint32 flag)Unused: flips flags and returns its new value.
Sint32syGameFlagGetByte (Sint32 flag)Returns the whole byte flags is in, a counter kept among the flags.
Uint32syGameFlagSetByte (Uint32 flag, Uint8 value)Sets the whole byte flags is in.
Uint8syGameFlagIncrementByte (Sint32 flag)Unused: adds 1 to the byte flags is in, stopping at GAME_FLAG_BYTE_MAX, and returns it.
Uint8syGameFlagDecrementByte (Sint32 flag)Unused: takes 1 from the byte flags is in, stopping at 0, and returns it.
Sint32syGameFlagGetNibble (Uint32 flag)Unused: returns the four bits a flag is in, 0 to 15.
voidsyGameFlagSetNibble (Sint32 flag, Sint32 value)Unused: sets the four bits flags is in.

Description

gmUnitGet (moved here from TBS's game_units.c, keeping its gm prefix for TBS/TLA parity) and the game flags: bits, bytes and nibbles. Part of system.c.

Macros in detail

GAME_FLAG_BYTE_MAX

#define GAME_FLAG_BYTE_MAX 255

The most a counter byte among the flags holds.

Referenced by syGameFlagIncrementByte().

Definition at line 94 of file system_flags.c.

GAME_FLAG_NIBBLE_MASK

#define GAME_FLAG_NIBBLE_MASK 0xf

The bits of a nibble flag, low or high in its byte by its number's bit 2.

Referenced by syGameFlagGetNibble() and syGameFlagSetNibble().

Definition at line 120 of file system_flags.c.

Functions in detail

gmUnitGet

UNIT *gmUnitGet(Uint32 unitId)

Returns the unit of unitId: ISAAC to PIERS the characters, the ENEMY_BATTLE_SIZE from FIRST_ENEMY_UNIT the enemies of the current battle; NULL for anything else.

References CharacterUnits.

Referenced by btAbilityApplyToTarget(), btAbilityReplaceDefeated(), btActionOrderSort(), btActionRunBuild(), btAIChooseAction(), btAIChooseRandomTarget(), btAIChooseTarget(), btAutoBattleApplyDamage(), btAutoBattleBuildActions(), btAutoBattleRunAction(), btAutoBattleRunApproachAttack(), btAutoBattleRunPsynergy(), btAutoBattleShowDefend(), btAwardSpoils(), btBuildEnemyActions(), btDebugParamSetLoad(), btDjinnRecoveryCountDown(), btDjinnRecoveryCountDownSide(), btEffectRunAttackSlash(), btEffectRunTwistingColumn(), btEffectShowLivingTargets(), btEffectStartActorMotion(), btEffectStartActorMotionOutward(), btEffectStartActorMotionRandomDistance(), btEnemyAdjustLevel(), btEnemyGetFreeUnitId(), btEnemyLetterFirstOfKind(), btEnemyList(), btEnemyRecordDefeat(), btEnemyReleaseNameLetter(), btEnemySpriteLoadIntoSlots(), btFleeCheckSuccess(), btFormationBuildEnemyList(), btFormationSelectLevelMatchedCandidate(), btGatherActions(), btLinkBattleReceiveParty(), btLinkBattleSendParty(), btMotionApplyKnockback(), btMotionFlashHit(), btMotionPlayFall(), btMotionProjectCursorPoint(), btMotionShowDowned(), btObjectMake(), btObjectRemoveFromLists(), btObjectUpdatePose(), btObjectUpdateSpritePriorities(), btPartyClearBattleStatuses(), btPartyClearGuards(), btPartyPrepareMembers(), btPartyPrepareReserveOwners() and 205 more.

Definition at line 10 of file system_flags.c.

syGameFlagGet

Sint32 syGameFlagGet(Sint32 flag)

Returns 1 when flags is set and 0 when it is clear.

References GameFlagBytes and Sint32.

Referenced by btAbilityApplyToTarget(), btActionRunBuild(), btCameraApplyTransform(), btCameraSetRange(), btEnemyList(), btEnemyRecordDefeat(), btFormationAverageLevel(), btFormationBuildEnemyList(), btFormationSelectLevelMatchedCandidate(), btRun(), btTutorialGetDjinnGiveMessage(), btUnitListLiving(), btUnitListLivingWithReserve(), fdActorMoveOnWorldMap(), fdActorPlaceSprites(), fdActorSailOnMap(), fdActorScriptClearFlagAndTest(), fdActorScriptSetFlagAndTest(), fdActorScriptTestFlag(), fdActorScriptToggleFlagAndTest(), fdActorSetMetatileOpen(), fdActorSystemProjectSprites(), fdBattleBackgroundSelectForMap(), fdChooseMusic(), fdDjinnJoinParty(), fdDjinnRestoreActorAfterBattle(), fdEffectSpawnRevealMarkers(), fdEffectUpdateSparkles(), fdEncounterCountStepsAndSelectFormation(), fdEncounterResolveWorldMapZoneAndBackdrop(), fdEncounterSelectBattleMusic(), fdEncounterSelectMapZones(), fdEngineRun(), fdEntrancePlayArrival(), fdExamineMetatile(), fdFlagBlockApplyFlags(), fdFlagBlockPlaceAll(), fdFlagBlockPlaceAllMarkingEdges(), fdFlagIsClear(), fdFlagIsSet(), fdGameFlagIsConditionActive(), fdGroundParticlesDraw(), fdGroundParticlesUpdate(), fdMapApplySetFlagEdits(), fdMapGridLoadMap(), fdMapScreenInit(), fdMapScreenShow(), fdMapScreenStepToPlace(), fdMapScreenUpdateMarkers(), fdMotesUpdate() and 260 more.

Definition at line 36 of file system_flags.c.

syGameFlagSet

Sint32 syGameFlagSet(Sint32 flag)

Sets flags and returns its byte number.

References GameFlagBytes and Sint32.

Referenced by btDebugBattleRunMenu(), btEnemyRecordDefeat(), btFormationSelectLevelMatchedCandidate(), btGatherActions(), btRun(), dbShopTestGiveDjinni(), fdActorReturnHome(), fdActorScriptSetFlagAndTest(), fdActorScriptToggleFlagAndTest(), fdAssignViewFlags(), fdDjinnJoinParty(), fdDjinnResolvePending(), fdEngineRun(), fdExamineMetatile(), fdExitStartStairsDown(), fdExitStartStairsUp(), fdFlagBlockApplyFlags(), fdFlagSet(), fdMapScreenGetLeaderPoint(), fdMapScreenShow(), fdMapSetFlagAndApplyAttributeEdits(), fdMapSetFlagAndApplyEdits(), fdPoundSinkTarget(), fdRopeLayTied(), fdRopeThrow(), fdScriptPickUpItem(), fdScriptSetFlag(), fdStartColorTransition(), fdTalkToActor(), fdUseItem(), fdUsePsynergy(), fdWorldMapMarkPlaceVisited(), gmArrive(), gmDataTransferApply(), gmDataTransferGiveDefaultDjinn(), gmDjinnAddFoundToOwner(), gmDjinnGiveToParty(), gmFlagRefreshLureCap(), gmInventorySnapshotSave(), gmPartyAddIsaacsParty(), gmPartyAddMember(), gmPartyGivePiersDjinn(), gmReturnFromEngine(), mnCreditsDrawLine(), mnDebugFlagEditorHandleInput(), mnDebugWarpArafura2(), mnDebugWarpArafura3(), mnDebugWarpChampa2(), mnDebugWarpKaoruSpecial3(), mnDebugWarpKaoruSpecial4() and 241 more.

Definition at line 45 of file system_flags.c.

syGameFlagClear

void syGameFlagClear(Sint32 flag)

Clears flags.

References GameFlagBytes and Sint32.

Referenced by btDebugBattleRunMenu(), btFormationSelectLevelMatchedCandidate(), btGatherActions(), dbTestGiveDjinni(), fdActorSailOnWorldMap(), fdActorScriptClearFlagAndTest(), fdActorScriptToggleFlagAndTest(), fdAssignViewFlags(), fdEngineRun(), fdEntrancePlayArrival(), fdExamineMetatile(), fdFlagBlockApplyFlags(), fdFlagBlockPlaceAll(), fdFlagBlockPlaceAllMarkingEdges(), fdFlagClear(), fdMapGridLoadMap(), fdMapScreenGetLeaderPoint(), fdRopeRecoil(), fdScriptClearFlag(), fdScriptShowMessageAndOfferScoop(), fdScriptStart(), fdStartPaletteTransition(), fdUseItem(), fdUsePsynergy(), gmArrive(), gmDataTransferApply(), gmDataTransferGiveDefaultDjinn(), gmFlagRefreshLureCap(), gmInventorySnapshotRestore(), gmInventorySnapshotSave(), gmMainRoutineRun(), gmPartyRemoveMember(), mnDebugFlagEditorHandleInput(), mnDebugWarpArafura2(), mnItemMenuSelectTarget(), mnPsynergyMenuSelectMember(), mnPsynergyMenuSelectTarget(), mnPsynergyMenuShowSelectedRow(), mnResumeFieldEvents(), mnStartWatchingStart(), scAirsRockInsideBlowGust(), scAirsRockInsideCheckPsynergyStone(), scAirsRockInsideFinishPushingPillar(), scAirsRockInsideMoveTurningBridgePillar(), scAirsRockInsidePoundStake(), scAirsRockInsideRideWhirlwind(), scAirsRockInsideStepOntoStake(), scAlhafraManorBriggsEscapes(), scAncientLemuriaTremorShakesOutRime(), scAnemosInnerSanctumStepOffSymbol() and 63 more.

Definition at line 56 of file system_flags.c.

syGameFlagToggle

Uint32 syGameFlagToggle(Sint32 flag)

Unused: flips flags and returns its new value.

References GameFlagBytes and Sint32.

Definition at line 66 of file system_flags.c.

syGameFlagGetByte

Sint32 syGameFlagGetByte(Sint32 flag)

Returns the whole byte flags is in, a counter kept among the flags.

References GameFlagBytes and Sint32.

Referenced by btFormationSelectLevelMatchedCandidate(), btRun(), scFieldGameFlagGetByte(), scInit(), scTrialRoadMoveRival() and scYampiDesertCaveScoopDjinni().

Definition at line 79 of file system_flags.c.

syGameFlagSetByte

Uint32 syGameFlagSetByte(Uint32 flag, Uint8 value)

Sets the whole byte flags is in.

References GameFlagBytes.

Referenced by scAquaRockMovePillar(), scCrackedTilePlaceLanding(), scCrackedTileStep(), scFieldGameFlagSetByte(), scGaiaRockInsideRecordStumpSpots(), scInit(), scMarsLighthouseEntranceFallThroughCrack(), scTaopoSwampBlowAwayDripPuddle(), scTaopoSwampLandDrip() and scYampiDesertCaveMoveSandRipple().

Definition at line 86 of file system_flags.c.

syGameFlagIncrementByte

Uint8 syGameFlagIncrementByte(Sint32 flag)

Unused: adds 1 to the byte flags is in, stopping at GAME_FLAG_BYTE_MAX, and returns it.

References GameFlagBytes and Sint32.

Definition at line 98 of file system_flags.c.

syGameFlagDecrementByte

Uint8 syGameFlagDecrementByte(Sint32 flag)

Unused: takes 1 from the byte flags is in, stopping at 0, and returns it.

References GameFlagBytes and Sint32.

Definition at line 109 of file system_flags.c.

syGameFlagGetNibble

Sint32 syGameFlagGetNibble(Uint32 flag)

Unused: returns the four bits a flag is in, 0 to 15.

References GameFlagBytes and Sint32.

Definition at line 123 of file system_flags.c.

syGameFlagSetNibble

void syGameFlagSetNibble(Sint32 flag, Sint32 value)

Unused: sets the four bits flags is in.

References GameFlagBytes and Sint32.

Definition at line 133 of file system_flags.c.