Skip to Content
The Alchemy Project

src/game/game_flags.c

The game flags: bits, bytes and nibbles. More…

Included by game.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
BoolgmFlagGet (Sint32 flag)Returns 1 when flags is set.
Sint32gmFlagSet (Sint32 flag)Sets flags and returns its byte number.
voidgmFlagClear (Sint32 flag)Clears flags.
Uint32gmFlagToggle (Sint32 flag)Flips flags and returns its new value.
Sint32gmFlagGetByte (Sint32 flag)Returns the whole byte flags is in, a counter kept among the flags.
voidgmFlagSetByte (Sint32 flag, Sint32 value)Sets the whole byte flags is in.
Uint8gmFlagIncrementByte (Sint32 flag)Adds 1 to the byte flags is in, stopping at GAME_FLAG_BYTE_MAX, and returns it.
Uint8gmFlagDecrementByte (Sint32 flag)Takes 1 from the byte flags is in, stopping at 0, and returns it.
Sint32gmFlagGetNibble (Uint32 flag)Returns the four bits a flag is in, 0 to 15.
voidgmFlagSetNibble (Sint32 flag, Sint32 value)Sets the four bits flags is in.

Description

The game flags: bits, bytes and nibbles. Part of game.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 gmFlagIncrementByte().

Definition at line 72 of file game_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 gmFlagGetNibble() and gmFlagSetNibble().

Definition at line 99 of file game_flags.c.

Functions in detail

gmFlagGet

Bool gmFlagGet(Sint32 flag)

Returns 1 when flags is set. Every module tests flags through it, as gmFlagGetStub, and the scripts directly or through script.h.

References GameFlagBytes and Sint32.

Referenced by fdScriptGetFlag(), gmClassDetermine(), gmDjinnGiveToParty(), gmPartyCountMembers(), gmPartyRestorePpInLighthouse(), gmUnitCalculate(), scAlpineCrossingFeizhiArrives(), scAltinApplyWaterLevel(), scAltinPeakReadFallingRockSign(), scAltinPeakRestoreFallingRocksRoom(), scAltinPeakRestoreFirstWaterBeastRoom(), scAltinPeakRestoreHydrosStatueRoom(), scAltinPeakRestorePoolRoom(), scAltinPeakRestoreSecondWaterBeastRoom(), scAltinPeakRestoreSouthEntranceRoom(), scAltinPeakRestoreSpritzRoom(), scAltinPeakRestoreThirdWaterBeastRoom(), scAltinPeakRunBoulderChase(), scAltinTalkToArmorMerchant(), scAltinTalkToItemMerchant(), scAltinTalkToThirstyOldWoman(), scAltmillerCaveBabiCallsPartyBack(), scAltmillerCaveEndReveal(), scAltmillerCaveInitDarkness(), scBabiLighthouseInspectTruthDoorSwitch(), scBabiLighthouseOpenTruthDoor(), scBabiLighthouseShowTruthDoorSwitch(), scBabiPalaceMeetBabiAfterColosso(), scBabiPalaceRestInPalaceBeds(), scBattleArenaAskToParticipate(), scBattleArenaChooseBattleMode(), scBattleArenaEnterBattle(), scBattleArenaExchangePartyRecords(), scBattleArenaPartyContains(), scBattleArenaPeerSlotMatches(), scBattleArenaTalkByProgress(), scBattleArenaTalkToVisitor(), scBattleArenaWatchOpponent(), scBilibinCaveRestoreEntrance(), scBilibinCaveRestoreIceRoom(), scBilibinCaveRestoreRapierRoom(), scBilibinCaveUpdateThirdPuddleFromTorches(), scBilibinJillGivesHardNut(), scBilibinSetUpBarricade(), scBilibinSetUpTreasury(), scBilibinSetUpVillage(), scColosseumEntranceApplyArrivalState(), scColosseumEntranceCrowdRecognizesIsaac(), scColosseumEntranceDiscussLuckyGuessSeats(), scColosseumEntranceDiscussLuckyGuessWinnings() and 403 more.

Definition at line 10 of file game_flags.c.

gmFlagSet

Sint32 gmFlagSet(Sint32 flag)

Sets flags and returns its byte number.

References GameFlagBytes and Sint32.

Referenced by fdScriptSetFlag(), gmDjinnGiveToParty(), gmFlagRefreshLureCap(), gmInventorySnapshotSave(), gmPartyAddMember(), gmPartyEndChildhood(), gmPartyStartChildhood(), scAlpineCrossingFeizhiArrives(), scAlpineCrossingFreezePuddle(), scAlpineCrossingGrowSprout(), scAlpineCrossingHamaReachesHsu(), scAlpineCrossingLiftBoulder(), scAltinCheckStatueMoved(), scAltinPeakCelebrateHydrosVictory(), scAltinPeakDrainAfterSecondBeast(), scAltinPeakDrainAfterThirdBeast(), scAltinPeakDrainFirstWater(), scAltinPeakDrainSecondWater(), scAltinPeakDrainThirdWater(), scAltinPeakFirstBeastHopsAway(), scAltinPeakFlipPoolRoomSwitch(), scAltinPeakFlipSpritzRoomSwitch(), scAltinPeakFreezeFirstWaterBeastRoomPuddle(), scAltinPeakFreezeFirstWaterBeastRoomSecondPuddle(), scAltinPeakFreezePoolRoomPuddle(), scAltinPeakFreezeSpritzRoomPuddle(), scAltinPeakFreezeSpritzRoomSecondPuddle(), scAltinPeakFreezeSpritzRoomThirdPuddle(), scAltinPeakFreezeThirdWaterBeastRoomPuddle(), scAltinPeakReadFallingRockSign(), scAltinPeakRunBoulderChase(), scAltinPeakShowFirstBeastRoute(), scAltinPeakToggleSecondWaterBeastRoomSwitchMetatiles(), scAltinPeakToggleThirdWaterBeastRoomSwitchMetatiles(), scAltinScareOffBeast(), scAltmillerCaveBabiCallsPartyBack(), scAltmillerCaveDropPillarIntoPit(), scAltmillerCaveFreezePuddle(), scAltmillerCaveMeetInvisibleBabi(), scAltmillerCaveRestoreBabiAndInviteParty(), scBabiLighthouseCloseTruthDoor(), scBabiLighthouseExplainTruthDoor(), scBabiLighthouseFaranAsksPartyToOpenDoor(), scBabiLighthouseOpenGrowthPassage(), scBabiLighthouseOpenTruthDoor(), scBabiPalaceHearSoldiersReport(), scBabiPalaceOfferCloakBall(), scBabiPalaceOfferRest(), scBabiPalacePassOnBabisWord(), scBabiPalaceReadShebasMind() and 514 more.

Definition at line 21 of file game_flags.c.

gmFlagClear

void gmFlagClear(Sint32 flag)

Clears flags.

References GameFlagBytes and Sint32.

Referenced by dbTestGiveDjinni(), fdScriptClearFlag(), gmFlagRefreshLureCap(), gmInventorySnapshotRestore(), gmPartyEndChildhood(), gmPartyRemoveMember(), scAltinApplyWaterLevel(), scAltinCheckStatueMoved(), scAltinPeakCelebrateHydrosVictory(), scAltinPeakFlipPoolRoomSwitch(), scAltinPeakFlipSpritzRoomSwitch(), scAltinPeakRestoreSouthEntranceRoom(), scAltinPeakToggleSecondWaterBeastRoomSwitchMetatiles(), scAltinPeakToggleThirdWaterBeastRoomSwitchMetatiles(), scBabiLighthouseCloseTruthDoor(), scBabiLighthouseExplainTruthDoor(), scBabiPalaceShowBeds(), scBattleArenaAskToParticipate(), scBattleArenaChooseBattleMode(), scBattleArenaEnterBattle(), scBattleArenaExplainPartyOrder(), scBattleArenaPeerSlotMatches(), scBattleArenaReportLinkDisconnected(), scBattleArenaWatchOpponent(), scBilibinCaveUpdateThirdPuddleFromTorches(), scBilibinSetUpVillage(), scColosseumEntranceStepBackFromFinalsLine(), scColosseumNavampaMatchStepOffScales(), scColosseumSatrageMatchMoveWallPillar(), scColosseumSatrageMatchStartLifts(), scCrossboneIsleKeysFifthStatuePushesLeaderBack(), scCrossboneIsleKeysFirstStatuePushesLeaderBack(), scCrossboneIsleKeysSecondStatuePushesLeaderBack(), scCrossboneIsleKeysUseLadder(), scCrossboneIsleSteppingStonesFlipWaterSwitch(), scCrossboneIsleSteppingStonesFreezeThirdPuddle(), scCrossboneIsleSteppingStonesFrostStartsOnThirdPuddle(), scCrossboneIsleSteppingStonesMovePillar(), scCrossboneIsleSteppingStonesSortPillarActors(), scFuchinFallsCaveArcticBladeRoomMoveFirstLogNorth(), scFuchinFallsCaveArcticBladeRoomMoveSecondLogEast(), scFuchinFallsCaveArcticBladeRoomMoveThirdLogWest(), scFuchinFallsCaveClearFourthLogStops(), scFuchinFallsCaveDragonsEyeRoomMoveFirstLogEastFromMiddle(), scFuchinFallsCaveDragonsEyeRoomMoveFirstLogEastFromWestEnd(), scFuchinFallsCaveDragonsEyeRoomMoveFirstLogWest(), scFuchinFallsCaveDragonsEyeRoomMoveFirstLogWestIfClear(), scFuchinFallsCaveDragonsEyeRoomMoveFourthLogNorth(), scFuchinFallsCaveDragonsEyeRoomMoveSecondLogEast(), scFuchinFallsCaveDragonsEyeRoomMoveThirdLogNorthFromLowerStop() and 110 more.

Definition at line 32 of file game_flags.c.

gmFlagToggle

Uint32 gmFlagToggle(Sint32 flag)

Flips flags and returns its new value. Only stubs.s's bare stub reaches it; nothing calls it by name.

References GameFlagBytes and Sint32.

Definition at line 43 of file game_flags.c.

gmFlagGetByte

Sint32 gmFlagGetByte(Sint32 flag)

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

References GameFlagBytes and Sint32.

Referenced by scFieldGameFlagGetByte().

Definition at line 56 of file game_flags.c.

gmFlagSetByte

void gmFlagSetByte(Sint32 flag, Sint32 value)

Sets the whole byte flags is in.

References GameFlagBytes and Sint32.

Referenced by scFieldGameFlagSetByte().

Definition at line 64 of file game_flags.c.

gmFlagIncrementByte

Uint8 gmFlagIncrementByte(Sint32 flag)

Adds 1 to the byte flags is in, stopping at GAME_FLAG_BYTE_MAX, and returns it. Only stubs.s's bare stub reaches it; nothing calls it by name.

References GameFlagBytes and Sint32.

Definition at line 76 of file game_flags.c.

gmFlagDecrementByte

Uint8 gmFlagDecrementByte(Sint32 flag)

Takes 1 from the byte flags is in, stopping at 0, and returns it. Only stubs.s's bare stub reaches it; nothing calls it by name.

References GameFlagBytes and Sint32.

Definition at line 88 of file game_flags.c.

gmFlagGetNibble

Sint32 gmFlagGetNibble(Uint32 flag)

Returns the four bits a flag is in, 0 to 15.

References GameFlagBytes and Sint32.

Definition at line 102 of file game_flags.c.

gmFlagSetNibble

void gmFlagSetNibble(Sint32 flag, Sint32 value)

Sets the four bits flags is in. Only stubs.s's bare stub reaches it; nothing calls it by name.

References GameFlagBytes and Sint32.

Definition at line 113 of file game_flags.c.