-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
127 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#include "global.h" | ||
#include "save_vars_flags.h" | ||
|
||
static u8 sTempFlags[NUM_TEMP_FLAGS / 8] = {0}; | ||
|
||
u32 Save_VarsFlags_sizeof(void) { | ||
return sizeof(SaveVarsFlags); | ||
} | ||
|
||
void Save_VarsFlags_Init(SaveVarsFlags *varsFlags) { | ||
memset(varsFlags, 0, sizeof(SaveVarsFlags)); | ||
} | ||
|
||
SaveVarsFlags *Save_VarsFlags_Get(SaveData *save) { | ||
return (SaveVarsFlags *)SaveArray_Get(save, SAVE_FLAGS); | ||
} | ||
|
||
BOOL Save_VarsFlags_CheckFlagInArray(SaveVarsFlags *varsFlags, u16 flagId) { | ||
u8 *flagAddr = Save_VarsFlags_GetFlagAddr(varsFlags, flagId); | ||
if (flagAddr != NULL) { | ||
if (*flagAddr & (1 << (flagId % 8))) { | ||
return TRUE; | ||
} | ||
} | ||
return FALSE; | ||
} | ||
|
||
void Save_VarsFlags_SetFlagInArray(SaveVarsFlags *varsFlags, u16 flagId) { | ||
u8 *flagAddr = Save_VarsFlags_GetFlagAddr(varsFlags, flagId); | ||
if (flagAddr == NULL) { | ||
return; | ||
} | ||
*flagAddr |= 1 << (flagId % 8); | ||
} | ||
|
||
void Save_VarsFlags_ClearFlagInArray(SaveVarsFlags *varsFlags, u16 flagId) { | ||
u8 *flagAddr = Save_VarsFlags_GetFlagAddr(varsFlags, flagId); | ||
if (flagAddr == NULL) { | ||
return; | ||
} | ||
*flagAddr &= 0xFF ^ (1 << (flagId % 8)); | ||
} | ||
|
||
u8 *Save_VarsFlags_GetFlagAddr(SaveVarsFlags *varsFlags, u16 flagId) { | ||
if (flagId == 0) { | ||
return NULL; | ||
} else if (flagId < TEMP_FLAG_BASE) { | ||
GF_ASSERT((flagId / 8) < (NUM_FLAGS / 8)); | ||
return &varsFlags->flags[flagId / 8]; | ||
} else { | ||
GF_ASSERT(((flagId - TEMP_FLAG_BASE) / 8) < (NUM_TEMP_FLAGS / 8)); | ||
return &sTempFlags[(flagId - TEMP_FLAG_BASE) / 8]; | ||
} | ||
} | ||
|
||
u16 *Save_VarsFlags_GetVarAddr(SaveVarsFlags * varsFlags, u16 varId) { | ||
GF_ASSERT((varId - VAR_BASE) < NUM_VARS); | ||
return &varsFlags->vars[varId - VAR_BASE]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.