2020-08-04 08:49:11 +02:00
|
|
|
#include "common.h"
|
|
|
|
|
2020-08-17 19:44:41 +02:00
|
|
|
INCLUDE_ASM("code_dba20_len_350", clear_saved_variables);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-17 19:44:41 +02:00
|
|
|
INCLUDE_ASM("code_dba20_len_350", clear_area_flags);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-17 19:44:41 +02:00
|
|
|
INCLUDE_ASM("code_dba20_len_350", clear_global_flag);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-17 19:44:41 +02:00
|
|
|
INCLUDE_ASM("code_dba20_len_350", set_global_flag);
|
2020-09-19 17:16:02 +02:00
|
|
|
/*s32 set_global_flag(s32 index) {
|
|
|
|
//SaveData* saveFile = &gCurrentSaveFile;
|
|
|
|
s32 flag;
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-19 17:16:02 +02:00
|
|
|
if (index <= -120000000) {
|
|
|
|
index += 130000000;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-19 17:16:02 +02:00
|
|
|
flag = gCurrentSaveFile->globalFlags[index / 32] & (1 << (index % 32));
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-19 17:16:02 +02:00
|
|
|
if (flag) {
|
|
|
|
flag = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
gCurrentSaveFile->globalFlags[index / 32] |= (1 << (index % 32));
|
|
|
|
return flag;
|
|
|
|
}*/
|
|
|
|
|
|
|
|
s32 INCLUDE_ASM("code_dba20_len_350", get_global_flag, s32 index);
|
|
|
|
/*s32 get_global_flag(s32 index) {
|
|
|
|
s32 bitIdx;
|
|
|
|
s32 wordIdx;
|
|
|
|
s32 bit;
|
|
|
|
s32 phi_return;
|
|
|
|
|
|
|
|
if (index <= -120000000) {
|
|
|
|
index += 130000000;
|
|
|
|
}
|
|
|
|
wordIdx = index / 32;
|
|
|
|
bitIdx = index % 32;
|
|
|
|
bit = gCurrentSaveFile->globalFlags[wordIdx] & (1 << bitIdx);
|
|
|
|
|
|
|
|
if (bit != 0) {
|
|
|
|
bit = 1;
|
|
|
|
}
|
|
|
|
return bit;
|
|
|
|
//return (bit != 0) ? 1 : bit; // ??? surely this is `bit != 0`
|
|
|
|
}*/
|
|
|
|
|
|
|
|
s8 set_global_byte(s32 index, s8 value) {
|
|
|
|
SaveData* saveFile = &gCurrentSaveFile;
|
|
|
|
s32 ret = saveFile->globalBytes[index];
|
|
|
|
|
|
|
|
saveFile->globalBytes[index] = value;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
s8 get_global_byte(s32 index) {
|
|
|
|
return gCurrentSaveFile.globalBytes[index];
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-17 19:44:41 +02:00
|
|
|
INCLUDE_ASM("code_dba20_len_350", clear_area_flag);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-17 19:44:41 +02:00
|
|
|
INCLUDE_ASM("code_dba20_len_350", set_area_flag);
|
2020-09-19 17:16:02 +02:00
|
|
|
/*s32 set_area_flag(s32 index) {
|
|
|
|
SaveData* saveFile = &gCurrentSaveFile;
|
|
|
|
s32 flag;
|
|
|
|
s32 flagIdx;
|
|
|
|
s32 flagShift;
|
|
|
|
|
|
|
|
flagIdx = index / 32;
|
|
|
|
flagShift = index % 32;
|
|
|
|
|
|
|
|
flag = saveFile->areaFlags[flagIdx] & (1 << flagShift);
|
|
|
|
|
|
|
|
if (flag != 0) {
|
|
|
|
flag = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
saveFile->areaFlags[flagIdx] |= (1 << flagShift);
|
|
|
|
|
|
|
|
return flag;
|
|
|
|
}*/
|
|
|
|
|
|
|
|
s32 get_area_flag(s32 index) {
|
|
|
|
s32 flag;
|
|
|
|
s32 flagIdx;
|
|
|
|
s32 flagShift;
|
|
|
|
|
|
|
|
flagIdx = index / 32;
|
|
|
|
flagShift = index % 32;
|
|
|
|
|
|
|
|
flag = gCurrentSaveFile.areaFlags[flagIdx] & (1 << flagShift);
|
|
|
|
|
|
|
|
if (flag != 0) {
|
|
|
|
flag = 1;
|
|
|
|
}
|
|
|
|
return flag;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-19 17:16:02 +02:00
|
|
|
s8 set_area_byte(s32 index, s8 value) {
|
|
|
|
SaveData* saveFile = &gCurrentSaveFile;
|
|
|
|
s32 ret = saveFile->areaBytes[index];
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-19 17:16:02 +02:00
|
|
|
saveFile->areaBytes[index] = value;
|
|
|
|
return ret;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-19 17:16:02 +02:00
|
|
|
s8 get_area_byte(s32 index) {
|
|
|
|
return gCurrentSaveFile.areaBytes[index];
|
|
|
|
}
|