Alchemy
Loading...
Searching...
No Matches

flags.c File Reference

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

Go to the source code of this file.

Functions

s32 GameFlag_Test (s32 flag)
 Returns 1 when flag is set.
s32 GameFlag_SetBit (s32 flag)
 Sets flag and returns its byte number.
void GameFlag_ClearBit (s32 flag)
 Clears flag.
u32 GameFlag_Toggle (s32 flag)
 Flips flag and returns its new value.
s32 GameFlag_GetByte (s32 flag)
 Returns the whole byte flag is in, a counter kept among the flags.
void GameFlag_SetByte (s32 flag, s32 value)
 Sets the whole byte flag is in.
u8 GameFlag_IncrementByte (s32 flag)
 Adds 1 to the byte flag is in, stopping at 255, and returns it.
u8 GameFlag_DecrementByte (s32 flag)
 Takes 1 from the byte flag is in, stopping at 0, and returns it.
s32 GameFlag_GetNibble (u32 flag)
 Returns the four bits flag is in (bit 2 of the number picks the half).
void GameFlag_SetNibble (s32 flag, s32 value)
 Sets the four bits flag is in.

Detailed Description

The game flags: bits, bytes and nibbles.

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

Definition in file flags.c.

Function Documentation

◆ GameFlag_Test()

s32 GameFlag_Test ( s32 flag)

Returns 1 when flag is set.

Every bank tests flags through it, as GameFlag_TestFar, and the scenes through the event layer.

Definition at line 13 of file flags.c.

Referenced by Class_Determine(), Djinn_AddToLeastLoadedOwner(), GameFlag_Test(), Party_CountActiveOwners(), Party_RestorePpOfLitElements(), and UnitCalc().

◆ GameFlag_SetBit()

s32 GameFlag_SetBit ( s32 flag)

Sets flag and returns its byte number.

Called from every bank, as GameFlag_SetBitFar, and by the scenes through the event layer.

Definition at line 27 of file flags.c.

Referenced by Djinn_AddToLeastLoadedOwner(), GameFlag_RefreshLureCap(), GameFlag_SetBit(), InventorySnapshot_Save(), Party_AddActiveOwner(), Party_BeginChildhood(), and Party_EndChildhood().

◆ GameFlag_ClearBit()

void GameFlag_ClearBit ( s32 flag)

Clears flag.

Called from every bank, as GameFlag_ClearBitFar, and by the scenes through the event layer.

Definition at line 40 of file flags.c.

Referenced by GameFlag_ClearBit(), GameFlag_RefreshLureCap(), InventorySnapshot_Restore(), Party_EndChildhood(), Party_RemoveActiveOwner(), and SaveMenu_Run().

◆ GameFlag_Toggle()

u32 GameFlag_Toggle ( s32 flag)

Flips flag and returns its new value.

Only GAME.S's bare veneer reaches it; nothing calls it by name.

Definition at line 52 of file flags.c.

Referenced by GameFlag_Toggle().

◆ GameFlag_GetByte()

s32 GameFlag_GetByte ( s32 flag)

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

Called by the battle encounter code and, through FieldGameFlag_GetByte, by the Colosso scenes and the Battle Arena.

Definition at line 68 of file flags.c.

Referenced by FieldGameFlag_GetByte(), and GameFlag_GetByte().

◆ GameFlag_SetByte()

void GameFlag_SetByte ( s32 flag,
s32 value )

Sets the whole byte flag is in.

Reached through FieldGameFlag_SetByte by the Colosso scenes, the world map and the Battle Arena's win counts.

Definition at line 78 of file flags.c.

Referenced by FieldGameFlag_SetByte(), and GameFlag_SetByte().

◆ GameFlag_IncrementByte()

u8 GameFlag_IncrementByte ( s32 flag)

Adds 1 to the byte flag is in, stopping at 255, and returns it.

Only GAME.S's bare veneer reaches it; nothing calls it by name.

Definition at line 86 of file flags.c.

Referenced by GameFlag_IncrementByte().

◆ GameFlag_DecrementByte()

u8 GameFlag_DecrementByte ( s32 flag)

Takes 1 from the byte flag is in, stopping at 0, and returns it.

Only GAME.S's bare veneer reaches it; nothing calls it by name.

Definition at line 99 of file flags.c.

Referenced by GameFlag_DecrementByte().

◆ GameFlag_GetNibble()

s32 GameFlag_GetNibble ( u32 flag)

Returns the four bits flag is in (bit 2 of the number picks the half).

Only GAME.S's bare veneer reaches it; nothing calls it by name.

Definition at line 112 of file flags.c.

Referenced by GameFlag_GetNibble().

◆ GameFlag_SetNibble()

void GameFlag_SetNibble ( s32 flag,
s32 value )

Sets the four bits flag is in.

Only GAME.S's bare veneer reaches it; nothing calls it by name.

Definition at line 128 of file flags.c.

Referenced by GameFlag_SetNibble().