diff --git a/Makefile b/Makefile index 3c018258d..7542b7189 100644 --- a/Makefile +++ b/Makefile @@ -62,7 +62,7 @@ sub: ; @$(MAKE) -C sub ROMSPEC := rom.rsf MAKEROM_FLAGS := $(DEFINES) -$(ALL_OBJS): files_for_compile +$(ALL_GAME_OBJS): files_for_compile $(ELF): files_for_compile libsyscall libsyscall: files_for_compile @@ -90,7 +90,9 @@ FX_CONST_H := $(WORK_DIR)/lib/include/nitro/fx/fx_const.h PROJECT_CLEAN_TARGETS += $(FX_CONST_H) $(FX_CONST_H): $(MKFXCONST) $(TOOLSDIR)/gen_fx_consts/fx_const.csv $(MKFXCONST) $@ -sdk: $(FX_CONST_H) + +$(ALL_LIB_OBJS): $(FX_CONST_H) +sdk9: $(ALL_LIB_OBJS) $(WORK_DIR)/include/global.h: $(FX_CONST_H) ; # Convenience targets diff --git a/asm/include/overlay_01_021EDAFC.inc b/asm/include/overlay_01_021EDAFC.inc index 836777ce6..7f1581222 100644 --- a/asm/include/overlay_01_021EDAFC.inc +++ b/asm/include/overlay_01_021EDAFC.inc @@ -44,7 +44,7 @@ .public Save_PlayerData_GetProfile .public Save_PlayerData_GetCoinsAddr .public PlayerProfile_GetMoney -.public CheckCoins +.public Coins_GetValue .public FrontierData_BattlePointAction .public Save_FrontierData_Get .public SaveData_GetPhoneCallPersistentState diff --git a/asm/overlay_01_021EDAFC.s b/asm/overlay_01_021EDAFC.s index 5b1ef7b80..8ace9cf66 100644 --- a/asm/overlay_01_021EDAFC.s +++ b/asm/overlay_01_021EDAFC.s @@ -2354,7 +2354,7 @@ _021EECBA: add r4, r0, #0 ldr r0, [r5, #0xc] bl Save_PlayerData_GetCoinsAddr - bl CheckCoins + bl Coins_GetValue add r2, r0, #0 b _021EED04 _021EECD2: diff --git a/files/data/mmodel/mmodel/mmodel_00000280.bin b/files/data/mmodel/mmodel/mmodel_00000280.bin deleted file mode 100644 index 5edb326f5..000000000 Binary files a/files/data/mmodel/mmodel/mmodel_00000280.bin and /dev/null differ diff --git a/files/data/mmodel/mmodel/mmodel_00000281.bin b/files/data/mmodel/mmodel/mmodel_00000281.bin deleted file mode 100644 index dfd121d49..000000000 Binary files a/files/data/mmodel/mmodel/mmodel_00000281.bin and /dev/null differ diff --git a/files/data/mmodel/mmodel/mmodel_00000282.bin b/files/data/mmodel/mmodel/mmodel_00000282.bin deleted file mode 100644 index 2a23be6ed..000000000 Binary files a/files/data/mmodel/mmodel/mmodel_00000282.bin and /dev/null differ diff --git a/files/data/mmodel/mmodel/mmodel_00000283.bin b/files/data/mmodel/mmodel/mmodel_00000283.bin deleted file mode 100644 index 2c8a883c6..000000000 Binary files a/files/data/mmodel/mmodel/mmodel_00000283.bin and /dev/null differ diff --git a/files/data/mmodel/mmodel/mmodel_00000284.bin b/files/data/mmodel/mmodel/mmodel_00000284.bin deleted file mode 100644 index 6c34688f7..000000000 Binary files a/files/data/mmodel/mmodel/mmodel_00000284.bin and /dev/null differ diff --git a/files/data/mmodel/mmodel/mmodel_00000285.bin b/files/data/mmodel/mmodel/mmodel_00000285.bin deleted file mode 100644 index 2c8a883c6..000000000 Binary files a/files/data/mmodel/mmodel/mmodel_00000285.bin and /dev/null differ diff --git a/files/data/mmodel/mmodel/mmodel_00000286.bin b/files/data/mmodel/mmodel/mmodel_00000286.bin deleted file mode 100644 index 5edb326f5..000000000 Binary files a/files/data/mmodel/mmodel/mmodel_00000286.bin and /dev/null differ diff --git a/files/data/mmodel/mmodel/mmodel_00000287.bin b/files/data/mmodel/mmodel/mmodel_00000287.bin deleted file mode 100644 index e729a2a13..000000000 Binary files a/files/data/mmodel/mmodel/mmodel_00000287.bin and /dev/null differ diff --git a/files/data/mmodel/mmodel/mmodel_00000288.bin b/files/data/mmodel/mmodel/mmodel_00000288.bin deleted file mode 100644 index 5cc4f97de..000000000 Binary files a/files/data/mmodel/mmodel/mmodel_00000288.bin and /dev/null differ diff --git a/files/data/mmodel/mmodel/mmodel_00000289.bin b/files/data/mmodel/mmodel/mmodel_00000289.bin deleted file mode 100644 index bf286ae4d..000000000 Binary files a/files/data/mmodel/mmodel/mmodel_00000289.bin and /dev/null differ diff --git a/files/data/mmodel/mmodel/mmodel_00000290.bin b/files/data/mmodel/mmodel/mmodel_00000290.bin deleted file mode 100644 index 428be0d81..000000000 Binary files a/files/data/mmodel/mmodel/mmodel_00000290.bin and /dev/null differ diff --git a/files/data/mmodel/mmodel/mmodel_00000291.bin b/files/data/mmodel/mmodel/mmodel_00000291.bin deleted file mode 100644 index f4441114b..000000000 Binary files a/files/data/mmodel/mmodel/mmodel_00000291.bin and /dev/null differ diff --git a/files/data/mmodel/mmodel/mmodel_00000292.bin b/files/data/mmodel/mmodel/mmodel_00000292.bin deleted file mode 100644 index 9100afb5d..000000000 Binary files a/files/data/mmodel/mmodel/mmodel_00000292.bin and /dev/null differ diff --git a/files/data/mmodel/mmodel/mmodel_00000293.bin b/files/data/mmodel/mmodel/mmodel_00000293.bin deleted file mode 100644 index 1b948353d..000000000 Binary files a/files/data/mmodel/mmodel/mmodel_00000293.bin and /dev/null differ diff --git a/files/data/mmodel/mmodel/mmodel_00000294.bin b/files/data/mmodel/mmodel/mmodel_00000294.bin deleted file mode 100644 index 42e44e03d..000000000 Binary files a/files/data/mmodel/mmodel/mmodel_00000294.bin and /dev/null differ diff --git a/files/data/mmodel/mmodel/mmodel_00000295.bin b/files/data/mmodel/mmodel/mmodel_00000295.bin deleted file mode 100644 index 6b7c15f3e..000000000 Binary files a/files/data/mmodel/mmodel/mmodel_00000295.bin and /dev/null differ diff --git a/files/data/mmodel/mmodel/mmodel_00000296.bin b/files/data/mmodel/mmodel/mmodel_00000296.bin deleted file mode 100644 index 6b7c15f3e..000000000 Binary files a/files/data/mmodel/mmodel/mmodel_00000296.bin and /dev/null differ diff --git a/files/poketool/trainer/trpoke.json.txt b/files/poketool/trainer/trpoke.json.txt index deba602c9..c4cf185e0 100644 --- a/files/poketool/trainer/trpoke.json.txt +++ b/files/poketool/trainer/trpoke.json.txt @@ -15,7 +15,7 @@ gTrainerPoke_{{ i }}: .byte {{ poke.difficulty }} .byte {{ poke.genderOverride }} | ({{ poke.abilityOverride }} << 4) .short {{ poke.level }} - .short {{ poke.species }}{% if existsIn(poke, "item") %} + .short {{ poke.species }}{% if existsIn(poke, "form") %} | ({{ poke.form }} << 10){% endif %}{% if existsIn(poke, "item") %} .short {{ poke.item }}{% endif %}{% if existsIn(poke, "moves") %}{% for move in poke.moves %} .short {{ move }}{% endfor %}{% for k in range(4 - length(poke.moves)) %} .short MOVE_NONE{% endfor %}{% endif %} diff --git a/include/battle/battle.h b/include/battle/battle.h index 8af0d3340..b138310c4 100644 --- a/include/battle/battle.h +++ b/include/battle/battle.h @@ -258,7 +258,7 @@ typedef struct BattleMon { u8 unk78; u8 msgFlag; u8 gender : 4; - u8 metGender : 4; + u8 otGender : 4; u8 ball; u32 moveEffectFlags; u32 moveEffectFlagsTemp; diff --git a/include/coins.h b/include/coins.h index e26c1c110..5c20ced39 100644 --- a/include/coins.h +++ b/include/coins.h @@ -6,44 +6,52 @@ #define MAX_COINS 50000 /* - * void InitCoins(u16 *coins) - * * Initialize the player's coin case * - * @param coins: Pointer to coin case amount + * @param coins: Pointer to coin case amount */ -void InitCoins(u16 *coins); +void Coins_Init(u16 *coins); /* - * u16 CheckCoins(u16* coins) - * * Gets the amount of coins owned * - * @param coins: Pointer to coin case amount + * @param coins: Pointer to coin case amount * * @returns: The amount of coins owned */ -u16 CheckCoins(u16 *coins); +u16 Coins_GetValue(u16 *coins); /* - * BOOL GiveCoins(u16* coins, u16 amount) - * BOOL CanGiveCoins(u16* coins, u16 amount) - * BOOL TakeCoins(u16* coins, u16 amount) + * Adds an amount of coins. It will fail if the + * coin case would overflow. * - * GiveCoins adds an amount of coins. It will fail if the - * coin case would overflow. - * CanGiveCoins follows the same logic but does not modify - * the coin case, instead only reports success or failure. - * TakeCoins deducts the amount of coins. It will fail if - * the coin case would underflow. - * - * @param coins: Pointer to coin case amount - * @param amount: Number of coins to adjust by + * @param coins: Pointer to coin case amount + * @param amount: Number of coins to add * * @returns: TRUE if success, otherwise FALSE */ -BOOL GiveCoins(u16 *coins, u16 amount); -BOOL CanGiveCoins(u16 *coins, u16 amount); -BOOL TakeCoins(u16 *coins, u16 amount); +BOOL Coins_Add(u16 *coins, u16 amount); + +/* + * Checks if a certain amount of coins can be + * added to the coin case without making it overflow. + * + * @param coins: Pointer to coin case amount + * @param amount: Number of coins to add + * + * @returns: TRUE if success, otherwise FALSE + */ +BOOL Coins_CanAdd(u16 *coins, u16 amount); + +/* + * Subtracts an amount of coins. It will fail if the + * coin case would overflow. + * + * @param coins: Pointer to coin case amount + * @param amount: Number of coins to subtract + * + * @returns: TRUE if success, otherwise FALSE + */ +BOOL Coins_Subtract(u16 *coins, u16 amount); #endif // POKEHEARTGOLD_COINS_H diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 9c883eacb..2bda57810 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -315,7 +315,7 @@ #define MON_DATA_POKERUS 154 #define MON_DATA_POKEBALL 155 #define MON_DATA_MET_LEVEL 156 -#define MON_DATA_MET_GENDER 157 +#define MON_DATA_OT_GENDER 157 #define MON_DATA_ENCOUNTER_TYPE 158 // HGSS #define MON_DATA_RESERVED_159 159 #define MON_DATA_STATUS 160 diff --git a/include/pokemon_types_def.h b/include/pokemon_types_def.h index 74f9ec291..a2f762209 100644 --- a/include/pokemon_types_def.h +++ b/include/pokemon_types_def.h @@ -104,7 +104,7 @@ typedef struct { /* 0x1A */ u8 pokerus; /* 0x1B */ u8 pokeball; /* 0x1C */ u8 metLevel : 7; - u8 metGender : 1; + u8 otGender : 1; /* 0x1D */ u8 encounterType; /* 0x1E */ u8 HGSS_Pokeball; /* 0x1F */ s8 mood; diff --git a/src/bag_view.c b/src/bag_view.c index a20e5f8ca..deabd6c3f 100644 --- a/src/bag_view.c +++ b/src/bag_view.c @@ -90,7 +90,7 @@ u8 sub_0207791C(BagView *bagView) { } static u16 GetCoinCount(SaveData *saveData) { - return CheckCoins(Save_PlayerData_GetCoinsAddr(saveData)); + return Coins_GetValue(Save_PlayerData_GetCoinsAddr(saveData)); } static u32 GetSealCount(SaveData *saveData) { diff --git a/src/battle/overlay_12_0224E4FC.c b/src/battle/overlay_12_0224E4FC.c index 622a547f2..ebdc2aca4 100644 --- a/src/battle/overlay_12_0224E4FC.c +++ b/src/battle/overlay_12_0224E4FC.c @@ -119,7 +119,7 @@ void BattleSystem_GetBattleMon(BattleSystem *battleSystem, BattleContext *ctx, i ctx->battleMons[battlerId].exp = GetMonData(mon, MON_DATA_EXPERIENCE, NULL); ctx->battleMons[battlerId].personality = GetMonData(mon, MON_DATA_PERSONALITY, NULL); ctx->battleMons[battlerId].otid = GetMonData(mon, MON_DATA_OTID, NULL); - ctx->battleMons[battlerId].metGender = GetMonData(mon, MON_DATA_MET_GENDER, NULL); + ctx->battleMons[battlerId].otGender = GetMonData(mon, MON_DATA_OT_GENDER, NULL); ctx->battleMons[battlerId].ball = BattleSystem_GetMonBall(battleSystem, mon); @@ -395,7 +395,7 @@ int GetBattlerVar(BattleContext *ctx, int battlerId, u32 id, void *data) { case BMON_DATA_MSG_FLAG: return mon->msgFlag; case BMON_DATA_OT_GENDER: - return mon->metGender; + return mon->otGender; case BMON_DATA_MOVE_EFFECT: return mon->moveEffectFlags; case BMON_DATA_MOVE_EFFECT_TEMP: @@ -639,7 +639,7 @@ void SetBattlerVar(BattleContext *ctx, int battlerId, u32 id, void *data) { mon->msgFlag = *data8; break; case BMON_DATA_OT_GENDER: - mon->metGender = *data8; + mon->otGender = *data8; break; case BMON_DATA_MOVE_EFFECT: mon->moveEffectFlags = *data32; @@ -5254,7 +5254,7 @@ BOOL ov12_02256854(BattleSystem *battleSystem, BattleContext *ctx) { u32 gender = PlayerProfile_GetTrainerGender(profile); const u16 *name = PlayerProfile_GetNamePtr(profile); - if (trainerId == ctx->battleMons[ctx->battlerIdAttacker].otid && gender == ctx->battleMons[ctx->battlerIdAttacker].metGender && !StringNotEqualN(name, &ctx->battleMons[ctx->battlerIdAttacker].otName[0], PLAYER_NAME_LENGTH)) { + if (trainerId == ctx->battleMons[ctx->battlerIdAttacker].otid && gender == ctx->battleMons[ctx->battlerIdAttacker].otGender && !StringNotEqualN(name, &ctx->battleMons[ctx->battlerIdAttacker].otName[0], PLAYER_NAME_LENGTH)) { return TRUE; } @@ -5270,7 +5270,7 @@ BOOL ov12_022568B0(BattleSystem *battleSystem, Pokemon *mon) { GetMonData(mon, MON_DATA_OT_NAME, otName); - if (trainerId == GetMonData(mon, MON_DATA_OTID, NULL) && gender == GetMonData(mon, MON_DATA_MET_GENDER, NULL) && !StringNotEqualN(name, otName, PLAYER_NAME_LENGTH)) { + if (trainerId == GetMonData(mon, MON_DATA_OTID, NULL) && gender == GetMonData(mon, MON_DATA_OT_GENDER, NULL) && !StringNotEqualN(name, otName, PLAYER_NAME_LENGTH)) { return TRUE; } diff --git a/src/coins.c b/src/coins.c index 28b6a7b9f..daca3484d 100644 --- a/src/coins.c +++ b/src/coins.c @@ -2,20 +2,21 @@ #include "global.h" -void InitCoins(u16 *coins) { +void Coins_Init(u16 *coins) { *coins = 0; } -u16 CheckCoins(u16 *coins) { +u16 Coins_GetValue(u16 *coins) { return *coins; } -BOOL GiveCoins(u16 *coins, u16 amount) { +BOOL Coins_Add(u16 *coins, u16 amount) { if (*coins >= MAX_COINS) { return FALSE; } *coins += amount; + if (*coins > MAX_COINS) { *coins = MAX_COINS; } @@ -23,11 +24,11 @@ BOOL GiveCoins(u16 *coins, u16 amount) { return TRUE; } -BOOL CanGiveCoins(u16 *coins, u16 amount) { +BOOL Coins_CanAdd(u16 *coins, u16 amount) { return (u32)(amount + *coins) <= MAX_COINS; } -BOOL TakeCoins(u16 *coins, u16 amount) { +BOOL Coins_Subtract(u16 *coins, u16 amount) { if (*coins < amount) { return FALSE; } diff --git a/src/get_egg.c b/src/get_egg.c index 7dc558dbc..5e4f4e79e 100644 --- a/src/get_egg.c +++ b/src/get_egg.c @@ -657,7 +657,7 @@ void SetEggStats(Pokemon *mon, int species, u8 metLocation, PlayerProfile *profi name = PlayerProfile_GetPlayerName_NewString(profile, HEAP_ID_32); SetMonData(mon, MON_DATA_OT_NAME_2, name); SetMonData(mon, MON_DATA_OTID, &otId); - SetMonData(mon, MON_DATA_MET_GENDER, &gender); + SetMonData(mon, MON_DATA_OT_GENDER, &gender); String_Delete(name); } MonSetTrainerMemo(mon, profile, trainerMemoStrat, eggLocation, HEAP_ID_DEFAULT); @@ -1045,7 +1045,7 @@ static void sub_0206D038(Pokemon *mon, HeapID heapId) { pokerus = GetMonData(mon, MON_DATA_POKERUS, NULL); fateful = GetMonData(mon, MON_DATA_FATEFUL_ENCOUNTER, NULL); GetMonData(mon, MON_DATA_OT_NAME_2, string); - otGender = GetMonData(mon, MON_DATA_MET_GENDER, NULL); + otGender = GetMonData(mon, MON_DATA_OT_GENDER, NULL); otId = GetMonData(mon, MON_DATA_OTID, NULL); form = GetMonData(mon, MON_DATA_FORM, NULL); if (species == SPECIES_MANAPHY && GetMonData(mon, MON_DATA_EGG_MET_LOCATION, NULL) == sub_02017FE4(MAPSECTYPE_EXTERNAL, 1)) { @@ -1071,7 +1071,7 @@ static void sub_0206D038(Pokemon *mon, HeapID heapId) { SetMonData(tmpMon, MON_DATA_POKERUS, &pokerus); SetMonData(tmpMon, MON_DATA_FATEFUL_ENCOUNTER, &fateful); SetMonData(tmpMon, MON_DATA_OT_NAME_2, string); - SetMonData(tmpMon, MON_DATA_MET_GENDER, &otGender); + SetMonData(tmpMon, MON_DATA_OT_GENDER, &otGender); SetMonData(tmpMon, MON_DATA_OTID, &otId); SetMonData(tmpMon, MON_DATA_FORM, &form); metLoc = GetMonData(mon, MON_DATA_EGG_MET_LOCATION, NULL); diff --git a/src/npc_trade.c b/src/npc_trade.c index 914972be9..ece9b424e 100644 --- a/src/npc_trade.c +++ b/src/npc_trade.c @@ -223,7 +223,7 @@ static void _CreateTradeMon(Pokemon *mon, NPCTrade *trade_dat, u32 level, NpcTra SetMonData(mon, MON_DATA_OT_NAME_2, name); String_Delete(name); - SetMonData(mon, MON_DATA_MET_GENDER, &trade_dat->gender); + SetMonData(mon, MON_DATA_OT_GENDER, &trade_dat->gender); SetMonData(mon, MON_DATA_GAME_LANGUAGE, &trade_dat->language); mapsec = MapHeader_GetMapSec(mapno); diff --git a/src/overlay_22.c b/src/overlay_22.c index 872f5e9d0..c1c9f0b2a 100644 --- a/src/overlay_22.c +++ b/src/overlay_22.c @@ -33,28 +33,28 @@ BOOL ScrCmd_118(ScriptContext *ctx) { BOOL ScrCmd_GetCoinAmount(ScriptContext *ctx) { u16 *ptr = ScriptGetVarPointer(ctx); - *ptr = CheckCoins(Save_PlayerData_GetCoinsAddr(ctx->fieldSystem->saveData)); + *ptr = Coins_GetValue(Save_PlayerData_GetCoinsAddr(ctx->fieldSystem->saveData)); return FALSE; } BOOL ScrCmd_GiveCoins(ScriptContext *ctx) { FieldSystem *fieldSystem = ctx->fieldSystem; u16 amount = ScriptGetVar(ctx); - GiveCoins(Save_PlayerData_GetCoinsAddr(fieldSystem->saveData), amount); + Coins_Add(Save_PlayerData_GetCoinsAddr(fieldSystem->saveData), amount); return FALSE; } BOOL ScrCmd_TakeCoins(ScriptContext *ctx) { FieldSystem *fieldSystem = ctx->fieldSystem; u16 amount = ScriptGetVar(ctx); - TakeCoins(Save_PlayerData_GetCoinsAddr(fieldSystem->saveData), amount); + Coins_Subtract(Save_PlayerData_GetCoinsAddr(fieldSystem->saveData), amount); return FALSE; } BOOL ScrCmd_569(ScriptContext *ctx) { FieldSystem *fieldSystem = ctx->fieldSystem; u16 *ptr = ScriptGetVarPointer(ctx); - TakeCoins(Save_PlayerData_GetCoinsAddr(fieldSystem->saveData), *ptr); + Coins_Subtract(Save_PlayerData_GetCoinsAddr(fieldSystem->saveData), *ptr); return FALSE; } @@ -62,7 +62,7 @@ BOOL ScrCmd_CheckCoinsImmediate(ScriptContext *ctx) { FieldSystem *fieldSystem = ctx->fieldSystem; u16 *ptr = ScriptGetVarPointer(ctx); u32 amount = ScriptReadWord(ctx); - u16 coins = CheckCoins(Save_PlayerData_GetCoinsAddr(fieldSystem->saveData)); + u16 coins = Coins_GetValue(Save_PlayerData_GetCoinsAddr(fieldSystem->saveData)); if (coins < amount) { *ptr = FALSE; } else { @@ -75,7 +75,7 @@ BOOL ScrCmd_CheckCoinsVar(ScriptContext *ctx) { FieldSystem *fieldSystem = ctx->fieldSystem; u16 *resultPtr = ScriptGetVarPointer(ctx); u16 *amountPtr = ScriptGetVarPointer(ctx); - u16 coins = CheckCoins(Save_PlayerData_GetCoinsAddr(fieldSystem->saveData)); + u16 coins = Coins_GetValue(Save_PlayerData_GetCoinsAddr(fieldSystem->saveData)); if (coins < *amountPtr) { *resultPtr = FALSE; } else { @@ -88,7 +88,7 @@ BOOL ScrCmd_CheckGiveCoins(ScriptContext *ctx) { FieldSystem *fieldSystem = ctx->fieldSystem; u16 *ptr = ScriptGetVarPointer(ctx); u16 amount = ScriptGetVar(ctx); - *ptr = CanGiveCoins(Save_PlayerData_GetCoinsAddr(fieldSystem->saveData), amount); + *ptr = Coins_CanAdd(Save_PlayerData_GetCoinsAddr(fieldSystem->saveData), amount); return FALSE; } diff --git a/src/player_data.c b/src/player_data.c index 88f13992e..09f392c00 100644 --- a/src/player_data.c +++ b/src/player_data.c @@ -11,7 +11,7 @@ void Save_PlayerData_Init(PLAYERDATA *player) { Options_Init(&player->options); PlayerProfile_Init(&player->profile); - InitCoins(&player->coins); + Coins_Init(&player->coins); InitIGT(&player->igt); } diff --git a/src/pokemon.c b/src/pokemon.c index 3006c21bd..c49e5c029 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -840,8 +840,8 @@ static u32 GetBoxMonDataInternal(BoxPokemon *boxMon, int attr, void *dest) { case MON_DATA_MET_LEVEL: ret = blockD->metLevel; break; - case MON_DATA_MET_GENDER: - ret = blockD->metGender; + case MON_DATA_OT_GENDER: + ret = blockD->otGender; break; case MON_DATA_ENCOUNTER_TYPE: ret = blockD->encounterType; @@ -1308,8 +1308,8 @@ static void SetBoxMonDataInternal(BoxPokemon *boxMon, int attr, const void *valu case MON_DATA_MET_LEVEL: blockD->metLevel = VALUE(u8); break; - case MON_DATA_MET_GENDER: - blockD->metGender = VALUE(u8); + case MON_DATA_OT_GENDER: + blockD->otGender = VALUE(u8); break; case MON_DATA_ENCOUNTER_TYPE: blockD->encounterType = VALUE(u8); @@ -1676,7 +1676,7 @@ static void AddBoxMonDataInternal(BoxPokemon *boxMon, int attr, int value) { case MON_DATA_POKERUS: case MON_DATA_POKEBALL: case MON_DATA_MET_LEVEL: - case MON_DATA_MET_GENDER: + case MON_DATA_OT_GENDER: case MON_DATA_ENCOUNTER_TYPE: case MON_DATA_RESERVED_159: case MON_DATA_STATUS: @@ -4115,7 +4115,7 @@ BOOL BoxmonBelongsToPlayer(BoxPokemon *boxMon, PlayerProfile *profile, HeapID he u32 myId = PlayerProfile_GetTrainerID(profile); u32 otId = GetBoxMonData(boxMon, MON_DATA_OTID, NULL); u32 myGender = PlayerProfile_GetTrainerGender(profile); - u32 otGender = GetBoxMonData(boxMon, MON_DATA_MET_GENDER, NULL); + u32 otGender = GetBoxMonData(boxMon, MON_DATA_OT_GENDER, NULL); String *r7 = PlayerProfile_GetPlayerName_NewString(profile, heapId); String *r6 = String_New(PLAYER_NAME_LENGTH + 1, heapId); BOOL ret = FALSE; diff --git a/src/scrcmd_mystery_gift.c b/src/scrcmd_mystery_gift.c index a26edf9f5..89050b6e4 100644 --- a/src/scrcmd_mystery_gift.c +++ b/src/scrcmd_mystery_gift.c @@ -292,7 +292,7 @@ static void MGGive_Mon(FieldSystem *fieldSys, MysteryGiftData *unused) { CopyPokemonToPokemon(pokemon, tmpPokemon); SetMonData(tmpPokemon, MON_DATA_OT_NAME_2, playerName); SetMonData(tmpPokemon, MON_DATA_OTID, &trainerId); - SetMonData(tmpPokemon, MON_DATA_MET_GENDER, &gender); + SetMonData(tmpPokemon, MON_DATA_OT_GENDER, &gender); pokemon = tmpPokemon; String_Delete(playerName); } diff --git a/src/trainer_memo.c b/src/trainer_memo.c index ad6790475..c8bf30f51 100644 --- a/src/trainer_memo.c +++ b/src/trainer_memo.c @@ -799,7 +799,7 @@ static void BoxMon_SetOriginalTrainerData(BoxPokemon *boxMon, PlayerProfile *pro String *name = PlayerProfile_GetPlayerName_NewString(profile, heapId); SetBoxMonData(boxMon, MON_DATA_OTID, &otId); - SetBoxMonData(boxMon, MON_DATA_MET_GENDER, &gender); + SetBoxMonData(boxMon, MON_DATA_OT_GENDER, &gender); SetBoxMonData(boxMon, MON_DATA_OT_NAME_2, name); String_Delete(name); diff --git a/src/unk_0206D494.c b/src/unk_0206D494.c index 303c9b039..c690dffcd 100644 --- a/src/unk_0206D494.c +++ b/src/unk_0206D494.c @@ -293,7 +293,7 @@ BOOL MonIsFromTogepiEgg(Pokemon *mon, SaveData *saveData) { if (word != PlayerProfile_GetTrainerID(profile)) { return FALSE; } - u8 byte = GetMonData(mon, MON_DATA_MET_GENDER, NULL); + u8 byte = GetMonData(mon, MON_DATA_OT_GENDER, NULL); if (byte != PlayerProfile_GetTrainerGender(profile)) { return FALSE; } @@ -337,7 +337,7 @@ static BOOL MonIsInGameTradePokeInternal(Pokemon *mon, NPCTrade *trade, NpcTrade if (pid != trade->pid) { return FALSE; } - u8 gender = GetMonData(mon, MON_DATA_MET_GENDER, NULL); + u8 gender = GetMonData(mon, MON_DATA_OT_GENDER, NULL); if (gender != trade->gender) { return FALSE; } diff --git a/src/voltorb_flip/voltorb_flip.c b/src/voltorb_flip/voltorb_flip.c index 3f99e06ae..ee95af1fb 100644 --- a/src/voltorb_flip/voltorb_flip.c +++ b/src/voltorb_flip/voltorb_flip.c @@ -160,7 +160,7 @@ static void RenderCoinPayoutScreen(VoltorbFlipAppWork *work) { GfGfxLoader_LoadScrnDataFromOpenNarc(work->narc, NARC_voltorb_flip_voltorb_flip_00000006_bin, work->bgConfig, GF_BG_LYR_SUB_0, 0, 0, 1, work->heapId); int payout = GamePayout(work->game); - u16 coins = (u32)CheckCoins(work->coins); + u16 coins = (u32)Coins_GetValue(work->coins); PrintCoins(work, COIN_DISPLAY_PAYOUT, payout); PrintCoins(work, COIN_DISPLAY_TOTAL, coins); @@ -271,7 +271,7 @@ static BOOL ov122_021E5B5C(WorkflowEngine *workflow, VoltorbFlipAppWork *work) { } BOOL ov122_021E5BA8(WorkflowEngine *workflow, VoltorbFlipAppWork *work) { - u32 coins = CheckCoins(work->coins); + u32 coins = Coins_GetValue(work->coins); if (coins >= 50000) { // "You’ve gathered 50,000 Coins. You cannot gather..." PrintTextWindow(work, msg_0039_00014, 1); @@ -778,7 +778,7 @@ BOOL ov122_021E6594(WorkflowEngine *workflow, VoltorbFlipAppWork *work) { ov122_021E8E40(work->unk240); int payout = GamePayout(work->game); - u16 coins = (u32)CheckCoins(work->coins); + u16 coins = (u32)Coins_GetValue(work->coins); PrintCoins(work, COIN_DISPLAY_PAYOUT, payout); PrintCoins(work, COIN_DISPLAY_TOTAL, coins); @@ -1026,12 +1026,12 @@ static BOOL AddCoinsToPayout(VoltorbFlipAppWork *work) { static BOOL AwardPayoutToPlayer(VoltorbFlipAppWork *work) { BOOL payoutDeducted; // only TRUE for incremental deduction - u16 coins = (u32)CheckCoins(work->coins); + u16 coins = (u32)Coins_GetValue(work->coins); u16 payout = GamePayout(work->game); if (System_GetTouchNew() || gSystem.newKeys != 0 || coins >= 50000) { DeductFromPayout(work->game, (u8)payout); - GiveCoins(work->coins, payout); + Coins_Add(work->coins, payout); int newTotal = coins + payout; if (newTotal > 50000) { @@ -1046,7 +1046,7 @@ static BOOL AwardPayoutToPlayer(VoltorbFlipAppWork *work) { } if (payoutDeducted) { - GiveCoins(work->coins, 1); + Coins_Add(work->coins, 1); PrintCoins(work, COIN_DISPLAY_PAYOUT, (u16)(payout - 1)); PrintCoins(work, COIN_DISPLAY_TOTAL, (u16)(coins + 1)); if (payout % 4 == 0) { @@ -1981,7 +1981,7 @@ static void ov122_021E8094(OverlayManager *man) { ov122_021E73FC(work); ov122_021E6B38(work); - u16 coins = (u32)CheckCoins(work->coins); + u16 coins = (u32)Coins_GetValue(work->coins); PrintCoins(work, COIN_DISPLAY_TOTAL, coins); ov122_021E7AEC(work); ov122_021E7BD4(work); diff --git a/tools/gen_fx_consts/Makefile b/tools/gen_fx_consts/Makefile index 9c9d3f4ef..1770743fc 100644 --- a/tools/gen_fx_consts/Makefile +++ b/tools/gen_fx_consts/Makefile @@ -17,7 +17,7 @@ all: $(prog) clean: ; $(RM) -r $(DEPDIR) $(OBJS) $(prog) $(prog).exe $(prog): $(OBJS) - $(CC) $(LDFLAGS) -o $@ $^ + $(CC) $(LDFLAGS) -lm -o $@ $^ $(OBJS): %.o: %.c $(OBJS): %.o: %.c $(DEPDIR)/%.d | $(DEPDIR)