From ffdc2456cbf00954c965d4d9a256cd452226b0d8 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 20 Oct 2023 12:46:28 -0400 Subject: [PATCH 01/13] Document datahpupdate --- data/battle_scripts_1.s | 4 +- include/battle.h | 15 +++++--- include/constants/battle.h | 2 +- src/battle_main.c | 4 +- src/battle_script_commands.c | 73 +++++++++++++++++++++++------------- src/battle_util.c | 24 ++++++------ 6 files changed, 72 insertions(+), 50 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index e7f592aacb..0c0dc72831 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -3208,7 +3208,7 @@ BattleScript_DamagingWeatherLoop:: jumpifword CMP_EQUAL, gBattleMoveDamage, 0, BattleScript_DamagingWeatherLoopIncrement printfromtable gSandStormHailDmgStringIds waitmessage B_WAIT_TIME_LONG - orword gHitMarker, HITMARKER_SKIP_DMG_TRACK | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE | HITMARKER_GRUDGE + orword gHitMarker, HITMARKER_IGNORE_BIDE | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE | HITMARKER_GRUDGE effectivenesssound hitanimation BS_ATTACKER healthbarupdate BS_ATTACKER @@ -3220,7 +3220,7 @@ BattleScript_DamagingWeatherLoopIncrement:: addbyte gBattleCommunication, 1 jumpifbytenotequal gBattleCommunication, gBattlersCount, BattleScript_DamagingWeatherLoop BattleScript_DamagingWeatherContinuesEnd:: - bicword gHitMarker, HITMARKER_SKIP_DMG_TRACK | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE | HITMARKER_GRUDGE + bicword gHitMarker, HITMARKER_IGNORE_BIDE | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE | HITMARKER_GRUDGE end2 BattleScript_SandStormHailEnds:: diff --git a/include/battle.h b/include/battle.h index bb0e42fb83..f4c5bd997e 100644 --- a/include/battle.h +++ b/include/battle.h @@ -54,6 +54,9 @@ #define BATTLE_BUFFER_LINK_SIZE 0x1000 +// Special indicator value for shellBellDmg in SpecialStatus +#define IGNORE_SHELL_BELL 0xFFFF + struct ResourceFlags { u32 flags[MAX_BATTLERS_COUNT]; @@ -133,7 +136,7 @@ struct SpecialStatus u32 ppNotAffectedByPressure:1; u32 faintedHasReplacement:1; u32 focusBanded:1; - s32 dmg; + s32 shellBellDmg; s32 physicalDmg; s32 specialDmg; u8 physicalBattlerId; @@ -445,9 +448,9 @@ struct BattleStruct // The assert below is to ensure palaceFlags is large enough to store these flags without overlap. STATIC_ASSERT(sizeof(((struct BattleStruct *)0)->palaceFlags) * 8 >= MAX_BATTLERS_COUNT + MAX_MON_MOVES, PalaceFlagsTooSmall) -#define F_DYNAMIC_TYPE_1 (1 << 6) -#define F_DYNAMIC_TYPE_2 (1 << 7) -#define DYNAMIC_TYPE_MASK (F_DYNAMIC_TYPE_1 - 1) +#define DYNAMIC_TYPE_MASK ((1 << 6) - 1) +#define F_DYNAMIC_TYPE_IGNORE_PHYSICALITY (1 << 6) // If set, the dynamic type's physicality won't be used for certain move effects. +#define F_DYNAMIC_TYPE_UNREAD (1 << 7) // Set for Hidden Power and Weather Ball but never apparently checked. #define GET_MOVE_TYPE(move, typeArg) \ { \ @@ -647,7 +650,7 @@ extern u16 gChosenMove; extern u16 gCalledMove; extern s32 gBattleMoveDamage; extern s32 gHpDealt; -extern s32 gTakenDmg[MAX_BATTLERS_COUNT]; +extern s32 gBideDmg[MAX_BATTLERS_COUNT]; extern u16 gLastUsedItem; extern u8 gLastUsedAbility; extern u8 gBattlerAttacker; @@ -673,7 +676,7 @@ extern u8 gLastHitBy[MAX_BATTLERS_COUNT]; extern u16 gChosenMoveByBattler[MAX_BATTLERS_COUNT]; extern u8 gMoveResultFlags; extern u32 gHitMarker; -extern u8 gTakenDmgByBattler[MAX_BATTLERS_COUNT]; +extern u8 gBideTarget[MAX_BATTLERS_COUNT]; extern u8 gUnusedFirstBattleVar2; extern u16 gSideStatuses[NUM_BATTLE_SIDES]; extern struct SideTimer gSideTimers[NUM_BATTLE_SIDES]; diff --git a/include/constants/battle.h b/include/constants/battle.h index ac83feb3a0..c4c1bc5e68 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -168,7 +168,7 @@ // Not really sure what a "hitmarker" is. #define HITMARKER_WAKE_UP_CLEAR (1 << 4) // Cleared when waking up. Never set or checked. -#define HITMARKER_SKIP_DMG_TRACK (1 << 5) +#define HITMARKER_IGNORE_BIDE (1 << 5) #define HITMARKER_DESTINYBOND (1 << 6) #define HITMARKER_NO_ANIMATIONS (1 << 7) #define HITMARKER_IGNORE_SUBSTITUTE (1 << 8) diff --git a/src/battle_main.c b/src/battle_main.c index b5c6cbbf07..c19089deb0 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -170,7 +170,7 @@ EWRAM_DATA u16 gChosenMove = 0; EWRAM_DATA u16 gCalledMove = 0; EWRAM_DATA s32 gBattleMoveDamage = 0; EWRAM_DATA s32 gHpDealt = 0; -EWRAM_DATA s32 gTakenDmg[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA s32 gBideDmg[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA u16 gLastUsedItem = 0; EWRAM_DATA u8 gLastUsedAbility = 0; EWRAM_DATA u8 gBattlerAttacker = 0; @@ -197,7 +197,7 @@ EWRAM_DATA u16 gChosenMoveByBattler[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA u8 gMoveResultFlags = 0; EWRAM_DATA u32 gHitMarker = 0; EWRAM_DATA static u8 sUnusedBattlersArray[MAX_BATTLERS_COUNT] = {0}; -EWRAM_DATA u8 gTakenDmgByBattler[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA u8 gBideTarget[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA u8 gUnusedFirstBattleVar2 = 0; // Never read EWRAM_DATA u16 gSideStatuses[NUM_BATTLE_SIDES] = {0}; EWRAM_DATA struct SideTimer gSideTimers[NUM_BATTLE_SIDES] = {0}; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 9d2c2cb715..fd87e94e2a 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1836,6 +1836,7 @@ static void Cmd_healthbarupdate(void) gBattlescriptCurrInstr += 2; } +// Update the active battler's HP and various HP trackers (Substitute, Bide, etc.) static void Cmd_datahpupdate(void) { u32 moveType; @@ -1843,9 +1844,13 @@ static void Cmd_datahpupdate(void) if (gBattleControllerExecFlags) return; + // moveType will be used later to record for Counter/Mirror Coat whether this was physical or special damage. + // For moves with a dynamic type that have F_DYNAMIC_TYPE_IGNORE_PHYSICALITY set (in vanilla, just Hidden Power) this will ignore + // the dynamic type and use the move's base type instead, meaning (as a Normal type) Hidden Power will only ever trigger Counter. + // It also means that Hidden Power Fire is unable to defrost targets. if (gBattleStruct->dynamicMoveType == 0) moveType = gBattleMoves[gCurrentMove].type; - else if (!(gBattleStruct->dynamicMoveType & F_DYNAMIC_TYPE_1)) + else if (!(gBattleStruct->dynamicMoveType & F_DYNAMIC_TYPE_IGNORE_PHYSICALITY)) moveType = gBattleStruct->dynamicMoveType & DYNAMIC_TYPE_MASK; else moveType = gBattleMoves[gCurrentMove].type; @@ -1855,23 +1860,26 @@ static void Cmd_datahpupdate(void) gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]); if (gBattleMons[gActiveBattler].status2 & STATUS2_SUBSTITUTE && gDisableStructs[gActiveBattler].substituteHP && !(gHitMarker & HITMARKER_IGNORE_SUBSTITUTE)) { + // Target has an active Substitute, deal damage to that instead. if (gDisableStructs[gActiveBattler].substituteHP >= gBattleMoveDamage) { - if (gSpecialStatuses[gActiveBattler].dmg == 0) - gSpecialStatuses[gActiveBattler].dmg = gBattleMoveDamage; + if (gSpecialStatuses[gActiveBattler].shellBellDmg == 0) + gSpecialStatuses[gActiveBattler].shellBellDmg = gBattleMoveDamage; gDisableStructs[gActiveBattler].substituteHP -= gBattleMoveDamage; gHpDealt = gBattleMoveDamage; } else { - if (gSpecialStatuses[gActiveBattler].dmg == 0) - gSpecialStatuses[gActiveBattler].dmg = gDisableStructs[gActiveBattler].substituteHP; + // Substitute has less HP than the damage dealt, set its HP to 0. + if (gSpecialStatuses[gActiveBattler].shellBellDmg == 0) + gSpecialStatuses[gActiveBattler].shellBellDmg = gDisableStructs[gActiveBattler].substituteHP; gHpDealt = gDisableStructs[gActiveBattler].substituteHP; gDisableStructs[gActiveBattler].substituteHP = 0; } - // check substitute fading + if (gDisableStructs[gActiveBattler].substituteHP == 0) { + // Substitute fades gBattlescriptCurrInstr += 2; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_SubstituteFade; @@ -1881,28 +1889,30 @@ static void Cmd_datahpupdate(void) else { gHitMarker &= ~HITMARKER_IGNORE_SUBSTITUTE; - if (gBattleMoveDamage < 0) // hp goes up + if (gBattleMoveDamage < 0) { - gBattleMons[gActiveBattler].hp -= gBattleMoveDamage; + // Negative damage is HP gain + gBattleMons[gActiveBattler].hp += -gBattleMoveDamage; if (gBattleMons[gActiveBattler].hp > gBattleMons[gActiveBattler].maxHP) gBattleMons[gActiveBattler].hp = gBattleMons[gActiveBattler].maxHP; - } - else // hp goes down + else { - if (gHitMarker & HITMARKER_SKIP_DMG_TRACK) + if (gHitMarker & HITMARKER_IGNORE_BIDE) { - gHitMarker &= ~HITMARKER_SKIP_DMG_TRACK; + gHitMarker &= ~HITMARKER_IGNORE_BIDE; } else { - gTakenDmg[gActiveBattler] += gBattleMoveDamage; + // Record damage/attacker for Bide + gBideDmg[gActiveBattler] += gBattleMoveDamage; if (gBattlescriptCurrInstr[1] == BS_TARGET) - gTakenDmgByBattler[gActiveBattler] = gBattlerAttacker; + gBideTarget[gActiveBattler] = gBattlerAttacker; else - gTakenDmgByBattler[gActiveBattler] = gBattlerTarget; + gBideTarget[gActiveBattler] = gBattlerTarget; } + // Deal damage to the battler if (gBattleMons[gActiveBattler].hp > gBattleMoveDamage) { gBattleMons[gActiveBattler].hp -= gBattleMoveDamage; @@ -1914,11 +1924,16 @@ static void Cmd_datahpupdate(void) gBattleMons[gActiveBattler].hp = 0; } - if (!gSpecialStatuses[gActiveBattler].dmg && !(gHitMarker & HITMARKER_PASSIVE_DAMAGE)) - gSpecialStatuses[gActiveBattler].dmg = gHpDealt; + // Record damage for Shell Bell + if (gSpecialStatuses[gActiveBattler].shellBellDmg == 0 && !(gHitMarker & HITMARKER_PASSIVE_DAMAGE)) + gSpecialStatuses[gActiveBattler].shellBellDmg = gHpDealt; + // Note: While physicalDmg/specialDmg below are only distinguished between for Counter/Mirror Coat, they are + // used in combination as general damage trackers for other purposes. specialDmg is additionally used + // to help determine if a fire move should defrost the target. if (IS_TYPE_PHYSICAL(moveType) && !(gHitMarker & HITMARKER_PASSIVE_DAMAGE) && gCurrentMove != MOVE_PAIN_SPLIT) { + // Record physical damage/attacker for Counter gProtectStructs[gActiveBattler].physicalDmg = gHpDealt; gSpecialStatuses[gActiveBattler].physicalDmg = gHpDealt; if (gBattlescriptCurrInstr[1] == BS_TARGET) @@ -1934,6 +1949,7 @@ static void Cmd_datahpupdate(void) } else if (!IS_TYPE_PHYSICAL(moveType) && !(gHitMarker & HITMARKER_PASSIVE_DAMAGE)) { + // Record special damage/attacker for Mirror Coat gProtectStructs[gActiveBattler].specialDmg = gHpDealt; gSpecialStatuses[gActiveBattler].specialDmg = gHpDealt; if (gBattlescriptCurrInstr[1] == BS_TARGET) @@ -1949,15 +1965,18 @@ static void Cmd_datahpupdate(void) } } gHitMarker &= ~HITMARKER_PASSIVE_DAMAGE; + + // Send updated HP BtlController_EmitSetMonData(BUFFER_A, REQUEST_HP_BATTLE, 0, sizeof(gBattleMons[gActiveBattler].hp), &gBattleMons[gActiveBattler].hp); MarkBattlerForControllerExec(gActiveBattler); } } else { + // MOVE_RESULT_NO_EFFECT was set gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]); - if (gSpecialStatuses[gActiveBattler].dmg == 0) - gSpecialStatuses[gActiveBattler].dmg = 0xFFFF; + if (gSpecialStatuses[gActiveBattler].shellBellDmg == 0) + gSpecialStatuses[gActiveBattler].shellBellDmg = IGNORE_SHELL_BELL; } gBattlescriptCurrInstr += 2; } @@ -7092,7 +7111,7 @@ static void Cmd_setbide(void) { gBattleMons[gBattlerAttacker].status2 |= STATUS2_MULTIPLETURNS; gLockedMoves[gBattlerAttacker] = gCurrentMove; - gTakenDmg[gBattlerAttacker] = 0; + gBideDmg[gBattlerAttacker] = 0; gBattleMons[gBattlerAttacker].status2 |= STATUS2_BIDE_TURN(2); gBattlescriptCurrInstr++; @@ -7984,7 +8003,7 @@ static void Cmd_painsplitdmgcalc(void) storeLoc[3] = (painSplitHp & 0xFF000000) >> 24; gBattleMoveDamage = gBattleMons[gBattlerAttacker].hp - hpDiff; - gSpecialStatuses[gBattlerTarget].dmg = 0xFFFF; + gSpecialStatuses[gBattlerTarget].shellBellDmg = IGNORE_SHELL_BELL; gBattlescriptCurrInstr += 5; } @@ -8822,7 +8841,7 @@ static void Cmd_hiddenpowercalc(void) gBattleStruct->dynamicMoveType = ((NUMBER_OF_MON_TYPES - 3) * typeBits) / 63 + 1; if (gBattleStruct->dynamicMoveType >= TYPE_MYSTERY) gBattleStruct->dynamicMoveType++; - gBattleStruct->dynamicMoveType |= F_DYNAMIC_TYPE_1 | F_DYNAMIC_TYPE_2; + gBattleStruct->dynamicMoveType |= F_DYNAMIC_TYPE_IGNORE_PHYSICALITY | F_DYNAMIC_TYPE_UNREAD; gBattlescriptCurrInstr++; } @@ -9699,15 +9718,15 @@ static void Cmd_setweatherballtype(void) if (gBattleWeather & B_WEATHER_ANY) gBattleScripting.dmgMultiplier = 2; if (gBattleWeather & B_WEATHER_RAIN) - *(&gBattleStruct->dynamicMoveType) = TYPE_WATER | F_DYNAMIC_TYPE_2; + *(&gBattleStruct->dynamicMoveType) = TYPE_WATER | F_DYNAMIC_TYPE_UNREAD; else if (gBattleWeather & B_WEATHER_SANDSTORM) - *(&gBattleStruct->dynamicMoveType) = TYPE_ROCK | F_DYNAMIC_TYPE_2; + *(&gBattleStruct->dynamicMoveType) = TYPE_ROCK | F_DYNAMIC_TYPE_UNREAD; else if (gBattleWeather & B_WEATHER_SUN) - *(&gBattleStruct->dynamicMoveType) = TYPE_FIRE | F_DYNAMIC_TYPE_2; + *(&gBattleStruct->dynamicMoveType) = TYPE_FIRE | F_DYNAMIC_TYPE_UNREAD; else if (gBattleWeather & B_WEATHER_HAIL) - *(&gBattleStruct->dynamicMoveType) = TYPE_ICE | F_DYNAMIC_TYPE_2; + *(&gBattleStruct->dynamicMoveType) = TYPE_ICE | F_DYNAMIC_TYPE_UNREAD; else - *(&gBattleStruct->dynamicMoveType) = TYPE_NORMAL | F_DYNAMIC_TYPE_2; + *(&gBattleStruct->dynamicMoveType) = TYPE_NORMAL | F_DYNAMIC_TYPE_UNREAD; } gBattlescriptCurrInstr++; diff --git a/src/battle_util.c b/src/battle_util.c index 50c560bccf..5a2b6392f0 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1448,7 +1448,7 @@ u8 DoBattlerEndTurnEffects(void) { u8 effect = 0; - gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_SKIP_DMG_TRACK); + gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_IGNORE_BIDE); while (gBattleStruct->turnEffectsBattlerId < gBattlersCount && gBattleStruct->turnEffectsTracker <= ENDTURN_BATTLER_COUNT) { gActiveBattler = gBattlerAttacker = gBattlerByTurnOrder[gBattleStruct->turnEffectsBattlerId]; @@ -1761,13 +1761,13 @@ u8 DoBattlerEndTurnEffects(void) return effect; } } - gHitMarker &= ~(HITMARKER_GRUDGE | HITMARKER_SKIP_DMG_TRACK); + gHitMarker &= ~(HITMARKER_GRUDGE | HITMARKER_IGNORE_BIDE); return 0; } bool8 HandleWishPerishSongOnTurnEnd(void) { - gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_SKIP_DMG_TRACK); + gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_IGNORE_BIDE); switch (gBattleStruct->wishPerishSongState) { @@ -1796,7 +1796,7 @@ bool8 HandleWishPerishSongOnTurnEnd(void) gBattlerTarget = gActiveBattler; gBattlerAttacker = gWishFutureKnock.futureSightAttacker[gActiveBattler]; gBattleMoveDamage = gWishFutureKnock.futureSightDmg[gActiveBattler]; - gSpecialStatuses[gBattlerTarget].dmg = 0xFFFF; + gSpecialStatuses[gBattlerTarget].shellBellDmg = IGNORE_SHELL_BELL; BattleScriptExecute(BattleScript_MonTookFutureAttack); if (gWishFutureKnock.futureSightCounter[gActiveBattler] == 0 @@ -1867,7 +1867,7 @@ bool8 HandleWishPerishSongOnTurnEnd(void) break; } - gHitMarker &= ~(HITMARKER_GRUDGE | HITMARKER_SKIP_DMG_TRACK); + gHitMarker &= ~(HITMARKER_GRUDGE | HITMARKER_IGNORE_BIDE); return FALSE; } @@ -2212,11 +2212,11 @@ u8 AtkCanceller_UnableToUseMove(void) { // This is removed in FRLG and Emerald for some reason //gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_MULTIPLETURNS; - if (gTakenDmg[gBattlerAttacker]) + if (gBideDmg[gBattlerAttacker]) { gCurrentMove = MOVE_BIDE; - *bideDmg = gTakenDmg[gBattlerAttacker] * 2; - gBattlerTarget = gTakenDmgByBattler[gBattlerAttacker]; + *bideDmg = gBideDmg[gBattlerAttacker] * 2; + gBattlerTarget = gBideTarget[gBattlerAttacker]; if (gAbsentBattlerFlags & gBitTable[gBattlerTarget]) gBattlerTarget = GetMoveTarget(MOVE_BIDE, MOVE_TARGET_SELECTED + 1); gBattlescriptCurrInstr = BattleScript_BideAttack; @@ -3769,8 +3769,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) break; case HOLD_EFFECT_SHELL_BELL: if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) - && gSpecialStatuses[gBattlerTarget].dmg != 0 - && gSpecialStatuses[gBattlerTarget].dmg != 0xFFFF + && gSpecialStatuses[gBattlerTarget].shellBellDmg != 0 + && gSpecialStatuses[gBattlerTarget].shellBellDmg != IGNORE_SHELL_BELL && gBattlerAttacker != gBattlerTarget && gBattleMons[gBattlerAttacker].hp != gBattleMons[gBattlerAttacker].maxHP && gBattleMons[gBattlerAttacker].hp != 0) @@ -3778,10 +3778,10 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) gLastUsedItem = atkItem; gPotentialItemEffectBattler = gBattlerAttacker; gBattleScripting.battler = gBattlerAttacker; - gBattleMoveDamage = (gSpecialStatuses[gBattlerTarget].dmg / atkHoldEffectParam) * -1; + gBattleMoveDamage = (gSpecialStatuses[gBattlerTarget].shellBellDmg / atkHoldEffectParam) * -1; if (gBattleMoveDamage == 0) gBattleMoveDamage = -1; - gSpecialStatuses[gBattlerTarget].dmg = 0; + gSpecialStatuses[gBattlerTarget].shellBellDmg = 0; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ItemHealHP_Ret; effect++; From 5712777dc23aa9b64e9b246b2b1a946de38fb639 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 20 Oct 2023 12:57:36 -0400 Subject: [PATCH 02/13] Correct dynamic type flag name --- include/battle.h | 2 +- src/battle_script_commands.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/battle.h b/include/battle.h index f4c5bd997e..68beaf219f 100644 --- a/include/battle.h +++ b/include/battle.h @@ -450,7 +450,7 @@ STATIC_ASSERT(sizeof(((struct BattleStruct *)0)->palaceFlags) * 8 >= MAX_BATTLER #define DYNAMIC_TYPE_MASK ((1 << 6) - 1) #define F_DYNAMIC_TYPE_IGNORE_PHYSICALITY (1 << 6) // If set, the dynamic type's physicality won't be used for certain move effects. -#define F_DYNAMIC_TYPE_UNREAD (1 << 7) // Set for Hidden Power and Weather Ball but never apparently checked. +#define F_DYNAMIC_TYPE_SET (1 << 7) // Set for all dynamic types to distinguish a dynamic type of Normal (0) from no dynamic type. #define GET_MOVE_TYPE(move, typeArg) \ { \ diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index fd87e94e2a..96ae0e68a3 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8841,7 +8841,7 @@ static void Cmd_hiddenpowercalc(void) gBattleStruct->dynamicMoveType = ((NUMBER_OF_MON_TYPES - 3) * typeBits) / 63 + 1; if (gBattleStruct->dynamicMoveType >= TYPE_MYSTERY) gBattleStruct->dynamicMoveType++; - gBattleStruct->dynamicMoveType |= F_DYNAMIC_TYPE_IGNORE_PHYSICALITY | F_DYNAMIC_TYPE_UNREAD; + gBattleStruct->dynamicMoveType |= F_DYNAMIC_TYPE_IGNORE_PHYSICALITY | F_DYNAMIC_TYPE_SET; gBattlescriptCurrInstr++; } @@ -9718,15 +9718,15 @@ static void Cmd_setweatherballtype(void) if (gBattleWeather & B_WEATHER_ANY) gBattleScripting.dmgMultiplier = 2; if (gBattleWeather & B_WEATHER_RAIN) - *(&gBattleStruct->dynamicMoveType) = TYPE_WATER | F_DYNAMIC_TYPE_UNREAD; + *(&gBattleStruct->dynamicMoveType) = TYPE_WATER | F_DYNAMIC_TYPE_SET; else if (gBattleWeather & B_WEATHER_SANDSTORM) - *(&gBattleStruct->dynamicMoveType) = TYPE_ROCK | F_DYNAMIC_TYPE_UNREAD; + *(&gBattleStruct->dynamicMoveType) = TYPE_ROCK | F_DYNAMIC_TYPE_SET; else if (gBattleWeather & B_WEATHER_SUN) - *(&gBattleStruct->dynamicMoveType) = TYPE_FIRE | F_DYNAMIC_TYPE_UNREAD; + *(&gBattleStruct->dynamicMoveType) = TYPE_FIRE | F_DYNAMIC_TYPE_SET; else if (gBattleWeather & B_WEATHER_HAIL) - *(&gBattleStruct->dynamicMoveType) = TYPE_ICE | F_DYNAMIC_TYPE_UNREAD; + *(&gBattleStruct->dynamicMoveType) = TYPE_ICE | F_DYNAMIC_TYPE_SET; else - *(&gBattleStruct->dynamicMoveType) = TYPE_NORMAL | F_DYNAMIC_TYPE_UNREAD; + *(&gBattleStruct->dynamicMoveType) = TYPE_NORMAL | F_DYNAMIC_TYPE_SET; } gBattlescriptCurrInstr++; From f472d768ddddb46cfcf94e5b1efd7d840bef37e0 Mon Sep 17 00:00:00 2001 From: Bassoonian Date: Sat, 28 Oct 2023 16:32:55 +0200 Subject: [PATCH 03/13] Rename Undiscovered to No Eggs Discovered --- include/constants/pokemon.h | 34 ++++++++-------- src/data/pokemon/species_info.h | 70 ++++++++++++++++----------------- src/daycare.c | 2 +- 3 files changed, 53 insertions(+), 53 deletions(-) diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index e515378d4c..6265c027aa 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -24,24 +24,24 @@ #define NUMBER_OF_MON_TYPES 18 // Pokemon egg groups -#define EGG_GROUP_NONE 0 -#define EGG_GROUP_MONSTER 1 -#define EGG_GROUP_WATER_1 2 -#define EGG_GROUP_BUG 3 -#define EGG_GROUP_FLYING 4 -#define EGG_GROUP_FIELD 5 -#define EGG_GROUP_FAIRY 6 -#define EGG_GROUP_GRASS 7 -#define EGG_GROUP_HUMAN_LIKE 8 -#define EGG_GROUP_WATER_3 9 -#define EGG_GROUP_MINERAL 10 -#define EGG_GROUP_AMORPHOUS 11 -#define EGG_GROUP_WATER_2 12 -#define EGG_GROUP_DITTO 13 -#define EGG_GROUP_DRAGON 14 -#define EGG_GROUP_UNDISCOVERED 15 +#define EGG_GROUP_NONE 0 +#define EGG_GROUP_MONSTER 1 +#define EGG_GROUP_WATER_1 2 +#define EGG_GROUP_BUG 3 +#define EGG_GROUP_FLYING 4 +#define EGG_GROUP_FIELD 5 +#define EGG_GROUP_FAIRY 6 +#define EGG_GROUP_GRASS 7 +#define EGG_GROUP_HUMAN_LIKE 8 +#define EGG_GROUP_WATER_3 9 +#define EGG_GROUP_MINERAL 10 +#define EGG_GROUP_AMORPHOUS 11 +#define EGG_GROUP_WATER_2 12 +#define EGG_GROUP_DITTO 13 +#define EGG_GROUP_DRAGON 14 +#define EGG_GROUP_NO_EGGS_DISCOVERED 15 -#define EGG_GROUPS_PER_MON 2 +#define EGG_GROUPS_PER_MON 2 // Pokemon natures #define NATURE_HARDY 0 diff --git a/src/data/pokemon/species_info.h b/src/data/pokemon/species_info.h index 2ef0629b52..afd671a4c0 100644 --- a/src/data/pokemon/species_info.h +++ b/src/data/pokemon/species_info.h @@ -25,7 +25,7 @@ .eggCycles = 120, \ .friendship = 0, \ .growthRate = GROWTH_MEDIUM_FAST, \ - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED, }, \ + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED, }, \ .abilities = {ABILITY_NONE, ABILITY_NONE}, \ .safariZoneFleeRate = 0, \ .bodyColor = BODY_COLOR_BLACK, \ @@ -929,7 +929,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 20, .friendship = STANDARD_FRIENDSHIP, .growthRate = GROWTH_MEDIUM_SLOW, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_POISON_POINT, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_BLUE, @@ -959,7 +959,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 20, .friendship = STANDARD_FRIENDSHIP, .growthRate = GROWTH_MEDIUM_SLOW, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_POISON_POINT, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_BLUE, @@ -4349,7 +4349,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 80, .friendship = 35, .growthRate = GROWTH_SLOW, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_PRESSURE, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_BLUE, @@ -4379,7 +4379,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 80, .friendship = 35, .growthRate = GROWTH_SLOW, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_PRESSURE, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_YELLOW, @@ -4409,7 +4409,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 80, .friendship = 35, .growthRate = GROWTH_SLOW, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_PRESSURE, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_YELLOW, @@ -4529,7 +4529,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 120, .friendship = 0, .growthRate = GROWTH_SLOW, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_PRESSURE, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_PURPLE, @@ -4559,7 +4559,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 120, .friendship = 100, .growthRate = GROWTH_MEDIUM_SLOW, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_SYNCHRONIZE, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_PINK, @@ -5189,7 +5189,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 10, .friendship = STANDARD_FRIENDSHIP, .growthRate = GROWTH_MEDIUM_FAST, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_STATIC, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_YELLOW, @@ -5219,7 +5219,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 10, .friendship = 140, .growthRate = GROWTH_FAST, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_CUTE_CHARM, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_PINK, @@ -5249,7 +5249,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 10, .friendship = STANDARD_FRIENDSHIP, .growthRate = GROWTH_FAST, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_CUTE_CHARM, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_PINK, @@ -5279,7 +5279,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 10, .friendship = STANDARD_FRIENDSHIP, .growthRate = GROWTH_FAST, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_HUSTLE, ABILITY_SERENE_GRACE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_WHITE, @@ -6059,7 +6059,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 40, .friendship = STANDARD_FRIENDSHIP, .growthRate = GROWTH_MEDIUM_FAST, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_LEVITATE, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_BLACK, @@ -7109,7 +7109,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 25, .friendship = STANDARD_FRIENDSHIP, .growthRate = GROWTH_MEDIUM_FAST, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_GUTS, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_PURPLE, @@ -7169,7 +7169,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 25, .friendship = STANDARD_FRIENDSHIP, .growthRate = GROWTH_MEDIUM_FAST, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_OBLIVIOUS, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_PINK, @@ -7199,7 +7199,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 25, .friendship = STANDARD_FRIENDSHIP, .growthRate = GROWTH_MEDIUM_FAST, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_STATIC, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_YELLOW, @@ -7229,7 +7229,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 25, .friendship = STANDARD_FRIENDSHIP, .growthRate = GROWTH_MEDIUM_FAST, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_FLAME_BODY, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_RED, @@ -7319,7 +7319,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 80, .friendship = 35, .growthRate = GROWTH_SLOW, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_PRESSURE, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_YELLOW, @@ -7349,7 +7349,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 80, .friendship = 35, .growthRate = GROWTH_SLOW, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_PRESSURE, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_BROWN, @@ -7379,7 +7379,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 80, .friendship = 35, .growthRate = GROWTH_SLOW, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_PRESSURE, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_BLUE, @@ -7499,7 +7499,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 120, .friendship = 0, .growthRate = GROWTH_SLOW, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_PRESSURE, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_WHITE, @@ -7529,7 +7529,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 120, .friendship = 0, .growthRate = GROWTH_SLOW, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_PRESSURE, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_RED, @@ -7559,7 +7559,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 120, .friendship = 100, .growthRate = GROWTH_MEDIUM_SLOW, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_NATURAL_CURE, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_GREEN, @@ -9829,7 +9829,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 10, .friendship = STANDARD_FRIENDSHIP, .growthRate = GROWTH_FAST, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_THICK_FAT, ABILITY_HUGE_POWER}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_BLUE, @@ -10129,7 +10129,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 20, .friendship = STANDARD_FRIENDSHIP, .growthRate = GROWTH_MEDIUM_FAST, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_SHADOW_TAG, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_BLUE, @@ -11359,7 +11359,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 80, .friendship = 35, .growthRate = GROWTH_SLOW, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_CLEAR_BODY, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_BROWN, @@ -11389,7 +11389,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 80, .friendship = 35, .growthRate = GROWTH_SLOW, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_CLEAR_BODY, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_BLUE, @@ -11419,7 +11419,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 80, .friendship = 35, .growthRate = GROWTH_SLOW, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_CLEAR_BODY, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_GRAY, @@ -11449,7 +11449,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 120, .friendship = 0, .growthRate = GROWTH_SLOW, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_DRIZZLE, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_BLUE, @@ -11479,7 +11479,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 120, .friendship = 0, .growthRate = GROWTH_SLOW, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_DROUGHT, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_RED, @@ -11509,7 +11509,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 120, .friendship = 0, .growthRate = GROWTH_SLOW, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_AIR_LOCK, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_GREEN, @@ -11539,7 +11539,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 120, .friendship = 90, .growthRate = GROWTH_SLOW, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_LEVITATE, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_RED, @@ -11569,7 +11569,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 120, .friendship = 90, .growthRate = GROWTH_SLOW, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_LEVITATE, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_BLUE, @@ -11599,7 +11599,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 120, .friendship = 100, .growthRate = GROWTH_SLOW, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_SERENE_GRACE, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_YELLOW, @@ -11629,7 +11629,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .eggCycles = 120, .friendship = 0, .growthRate = GROWTH_SLOW, - .eggGroups = { EGG_GROUP_UNDISCOVERED, EGG_GROUP_UNDISCOVERED }, + .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED }, .abilities = {ABILITY_PRESSURE, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_RED, diff --git a/src/daycare.c b/src/daycare.c index d618db78ec..d62bd589d0 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -1033,7 +1033,7 @@ static u8 GetDaycareCompatibilityScore(struct DayCare *daycare) } // check unbreedable egg group - if (eggGroups[0][0] == EGG_GROUP_UNDISCOVERED || eggGroups[1][0] == EGG_GROUP_UNDISCOVERED) + if (eggGroups[0][0] == EGG_GROUP_NO_EGGS_DISCOVERED || eggGroups[1][0] == EGG_GROUP_NO_EGGS_DISCOVERED) return PARENTS_INCOMPATIBLE; // two Ditto can't breed if (eggGroups[0][0] == EGG_GROUP_DITTO && eggGroups[1][0] == EGG_GROUP_DITTO) From cd9ef3a5662a1d6800e44ff09b5e1f059a27add7 Mon Sep 17 00:00:00 2001 From: Bassoonian Date: Sat, 28 Oct 2023 16:34:11 +0200 Subject: [PATCH 04/13] Formatting fix --- src/data/pokemon/species_info.h | 54 ++++++++++++++++----------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/data/pokemon/species_info.h b/src/data/pokemon/species_info.h index afd671a4c0..fbd3bcba2a 100644 --- a/src/data/pokemon/species_info.h +++ b/src/data/pokemon/species_info.h @@ -2,34 +2,34 @@ // 255 (MON_GENDERLESS) is reserved for genderless Pokémon. #define PERCENT_FEMALE(percent) min(254, ((percent * 255) / 100)) -#define OLD_UNOWN_SPECIES_INFO \ - { \ - .baseHP = 50, \ - .baseAttack = 150, \ - .baseDefense = 50, \ - .baseSpeed = 150, \ - .baseSpAttack = 150, \ - .baseSpDefense = 50, \ - .types = { TYPE_NORMAL, TYPE_NORMAL}, \ - .catchRate = 3, \ - .expYield = 1, \ - .evYield_HP = 2, \ - .evYield_Attack = 2, \ - .evYield_Defense = 2, \ - .evYield_Speed = 2, \ - .evYield_SpAttack = 2, \ - .evYield_SpDefense = 2, \ - .itemCommon = ITEM_NONE, \ - .itemRare = ITEM_NONE, \ - .genderRatio = MON_GENDERLESS, \ - .eggCycles = 120, \ - .friendship = 0, \ - .growthRate = GROWTH_MEDIUM_FAST, \ +#define OLD_UNOWN_SPECIES_INFO \ + { \ + .baseHP = 50, \ + .baseAttack = 150, \ + .baseDefense = 50, \ + .baseSpeed = 150, \ + .baseSpAttack = 150, \ + .baseSpDefense = 50, \ + .types = { TYPE_NORMAL, TYPE_NORMAL}, \ + .catchRate = 3, \ + .expYield = 1, \ + .evYield_HP = 2, \ + .evYield_Attack = 2, \ + .evYield_Defense = 2, \ + .evYield_Speed = 2, \ + .evYield_SpAttack = 2, \ + .evYield_SpDefense = 2, \ + .itemCommon = ITEM_NONE, \ + .itemRare = ITEM_NONE, \ + .genderRatio = MON_GENDERLESS, \ + .eggCycles = 120, \ + .friendship = 0, \ + .growthRate = GROWTH_MEDIUM_FAST, \ .eggGroups = { EGG_GROUP_NO_EGGS_DISCOVERED, EGG_GROUP_NO_EGGS_DISCOVERED, }, \ - .abilities = {ABILITY_NONE, ABILITY_NONE}, \ - .safariZoneFleeRate = 0, \ - .bodyColor = BODY_COLOR_BLACK, \ - .noFlip = FALSE, \ + .abilities = {ABILITY_NONE, ABILITY_NONE}, \ + .safariZoneFleeRate = 0, \ + .bodyColor = BODY_COLOR_BLACK, \ + .noFlip = FALSE, \ } const struct SpeciesInfo gSpeciesInfo[] = From d44b2a972d2b9fd1da64dacc4fd2b2224fb294a4 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Tue, 31 Oct 2023 04:36:46 -0300 Subject: [PATCH 05/13] =?UTF-8?q?Renamed=20SendMonToPC=20to=20CopyMonToPC?= =?UTF-8?q?=20instead=20"SendMonToPC"=20implies=20that=20the=20Pok=C3=A9mo?= =?UTF-8?q?n=20affected=20is=20actually=20sent=20over=20to=20the=20PC,=20b?= =?UTF-8?q?ut=20in=20reality=20the=20function=20simply=20copies=20the=20da?= =?UTF-8?q?ta=20of=20the=20Pok=C3=A9mon=20and=20then=20pastes=20it=20in=20?= =?UTF-8?q?the=20first=20available=20slot=20of=20the=20Pok=C3=A9mon=20Stor?= =?UTF-8?q?age=20System.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pokemon.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pokemon.c b/src/pokemon.c index 3925d77fe3..d3a570e72f 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -70,7 +70,7 @@ static void Task_PlayMapChosenOrBattleBGM(u8 taskId); static bool8 ShouldGetStatBadgeBoost(u16 flagId, u8 battlerId); static u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move); static bool8 ShouldSkipFriendshipChange(void); -static u8 SendMonToPC(struct Pokemon *mon); +static u8 CopyMonToPC(struct Pokemon *mon); EWRAM_DATA static u8 sLearningMoveTableID = 0; EWRAM_DATA u8 gPlayerPartyCount = 0; @@ -4405,14 +4405,14 @@ u8 GiveMonToPlayer(struct Pokemon *mon) } if (i >= PARTY_SIZE) - return SendMonToPC(mon); + return CopyMonToPC(mon); CopyMon(&gPlayerParty[i], mon, sizeof(*mon)); gPlayerPartyCount = i + 1; return MON_GIVEN_TO_PARTY; } -static u8 SendMonToPC(struct Pokemon *mon) +static u8 CopyMonToPC(struct Pokemon *mon) { s32 boxNo, boxPos; From 3122d744f535194e4e9747a6c0be8e457764f98b Mon Sep 17 00:00:00 2001 From: kaboissonneault Date: Thu, 2 Nov 2023 09:48:13 -0400 Subject: [PATCH 06/13] Added BUGFIX for "dual non-immunity" glitch. In certain AI script commands, the call to TypeCalc does not assign effectiveness flags properly, resulting in the check for immunity always failing --- src/battle_ai_script_commands.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 9a63031dd2..8bb76705ec 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -1484,7 +1484,13 @@ static void Cmd_get_highest_type_effectiveness(void) if (gCurrentMove != MOVE_NONE) { + // TypeCalc does not assign to gMoveResultFlags, Cmd_TypeCalc does + // This makes the check for gMoveResultFlags below always fail +#ifdef BUGFIX + gMoveResultFlags = TypeCalc(gCurrentMove, sBattler_AI, gBattlerTarget); +#else TypeCalc(gCurrentMove, sBattler_AI, gBattlerTarget); +#endif if (gBattleMoveDamage == 120) // Super effective STAB. gBattleMoveDamage = AI_EFFECTIVENESS_x2; @@ -1519,7 +1525,16 @@ static void Cmd_if_type_effectiveness(void) gBattleMoveDamage = AI_EFFECTIVENESS_x1; gCurrentMove = AI_THINKING_STRUCT->moveConsidered; + // TypeCalc does not assign to gMoveResultFlags, Cmd_TypeCalc does + // This makes the check for gMoveResultFlags below always fail + // This is how you get the "dual non-immunity" glitch, where AI + // will use ineffective moves on immune pokémon if the second type + // has a non-neutral, non-immune effectiveness +#ifdef BUGFIX + gMoveResultFlags = TypeCalc(gCurrentMove, sBattler_AI, gBattlerTarget); +#else TypeCalc(gCurrentMove, sBattler_AI, gBattlerTarget); +#endif if (gBattleMoveDamage == 120) // Super effective STAB. gBattleMoveDamage = AI_EFFECTIVENESS_x2; From 5ddf3e2ee514cfd9250e68772c8a19ee2e8fb21d Mon Sep 17 00:00:00 2001 From: kaboissonneault Date: Thu, 2 Nov 2023 11:17:57 -0400 Subject: [PATCH 07/13] Fixed casing in comment on "dual non-immunity" glitch --- src/battle_ai_script_commands.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 8bb76705ec..d8a9760ff2 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -1484,7 +1484,7 @@ static void Cmd_get_highest_type_effectiveness(void) if (gCurrentMove != MOVE_NONE) { - // TypeCalc does not assign to gMoveResultFlags, Cmd_TypeCalc does + // TypeCalc does not assign to gMoveResultFlags, Cmd_typecalc does // This makes the check for gMoveResultFlags below always fail #ifdef BUGFIX gMoveResultFlags = TypeCalc(gCurrentMove, sBattler_AI, gBattlerTarget); @@ -1525,7 +1525,7 @@ static void Cmd_if_type_effectiveness(void) gBattleMoveDamage = AI_EFFECTIVENESS_x1; gCurrentMove = AI_THINKING_STRUCT->moveConsidered; - // TypeCalc does not assign to gMoveResultFlags, Cmd_TypeCalc does + // TypeCalc does not assign to gMoveResultFlags, Cmd_typecalc does // This makes the check for gMoveResultFlags below always fail // This is how you get the "dual non-immunity" glitch, where AI // will use ineffective moves on immune pokémon if the second type From a093e402d554816595d606eb8a575a0f701a69fd Mon Sep 17 00:00:00 2001 From: quocmanh94 Date: Fri, 3 Nov 2023 12:50:47 +0700 Subject: [PATCH 08/13] Delete the redundant files generated after running build --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 7476a9dc31..5c073b36ca 100644 --- a/Makefile +++ b/Makefile @@ -236,8 +236,7 @@ clean-tools: @$(foreach tooldir,$(TOOLDIRS),$(MAKE) clean -C $(tooldir);) mostlyclean: tidynonmodern tidymodern - rm -f $(SAMPLE_SUBDIR)/*.bin - rm -f $(CRY_SUBDIR)/*.bin + find sound -iname '*.bin' -exec rm {} + rm -f $(MID_SUBDIR)/*.s find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.rl' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec rm {} + rm -f $(DATA_ASM_SUBDIR)/layouts/layouts.inc $(DATA_ASM_SUBDIR)/layouts/layouts_table.inc From 81f397360e391507534b154e4f976c2b99c09731 Mon Sep 17 00:00:00 2001 From: Icedude907 <34080011+Icedude907@users.noreply.github.com> Date: Sun, 12 Nov 2023 14:28:11 +1300 Subject: [PATCH 09/13] Moved files - spinda spots, jp fonts, redyellowgreen_frame.bin --- ..._female_font.png => japanese_frlg_female.png} | Bin ...frlg_male_font.png => japanese_frlg_male.png} | Bin .../spinda/spots}/spot_0.png | Bin .../spinda/spots}/spot_1.png | Bin .../spinda/spots}/spot_2.png | Bin .../spinda/spots}/spot_3.png | Bin graphics/unused/.gitignore | 1 + graphics/unused/redyellowgreen_frame.bin | Bin 8192 -> 0 bytes graphics_file_rules.mk | 6 +++--- src/pokemon.c | 8 ++++---- 10 files changed, 8 insertions(+), 7 deletions(-) rename graphics/fonts/{japanese_frlg_female_font.png => japanese_frlg_female.png} (100%) rename graphics/fonts/{japanese_frlg_male_font.png => japanese_frlg_male.png} (100%) rename graphics/{spinda_spots => pokemon/spinda/spots}/spot_0.png (100%) rename graphics/{spinda_spots => pokemon/spinda/spots}/spot_1.png (100%) rename graphics/{spinda_spots => pokemon/spinda/spots}/spot_2.png (100%) rename graphics/{spinda_spots => pokemon/spinda/spots}/spot_3.png (100%) create mode 100644 graphics/unused/.gitignore delete mode 100644 graphics/unused/redyellowgreen_frame.bin diff --git a/graphics/fonts/japanese_frlg_female_font.png b/graphics/fonts/japanese_frlg_female.png similarity index 100% rename from graphics/fonts/japanese_frlg_female_font.png rename to graphics/fonts/japanese_frlg_female.png diff --git a/graphics/fonts/japanese_frlg_male_font.png b/graphics/fonts/japanese_frlg_male.png similarity index 100% rename from graphics/fonts/japanese_frlg_male_font.png rename to graphics/fonts/japanese_frlg_male.png diff --git a/graphics/spinda_spots/spot_0.png b/graphics/pokemon/spinda/spots/spot_0.png similarity index 100% rename from graphics/spinda_spots/spot_0.png rename to graphics/pokemon/spinda/spots/spot_0.png diff --git a/graphics/spinda_spots/spot_1.png b/graphics/pokemon/spinda/spots/spot_1.png similarity index 100% rename from graphics/spinda_spots/spot_1.png rename to graphics/pokemon/spinda/spots/spot_1.png diff --git a/graphics/spinda_spots/spot_2.png b/graphics/pokemon/spinda/spots/spot_2.png similarity index 100% rename from graphics/spinda_spots/spot_2.png rename to graphics/pokemon/spinda/spots/spot_2.png diff --git a/graphics/spinda_spots/spot_3.png b/graphics/pokemon/spinda/spots/spot_3.png similarity index 100% rename from graphics/spinda_spots/spot_3.png rename to graphics/pokemon/spinda/spots/spot_3.png diff --git a/graphics/unused/.gitignore b/graphics/unused/.gitignore new file mode 100644 index 0000000000..b929a6cae7 --- /dev/null +++ b/graphics/unused/.gitignore @@ -0,0 +1 @@ +redyellowgreen_frame.bin \ No newline at end of file diff --git a/graphics/unused/redyellowgreen_frame.bin b/graphics/unused/redyellowgreen_frame.bin deleted file mode 100644 index 6852998fb85d057fa16a892b867f0343b6764ec7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8192 zcmeI!+X{m)5CqV9D7fD5|NpC{Hc%{3u4D}*?zg_@9F)gu3!3ct5E`l3oKZj+Ni*e z*{PlGf6B{`3;g%`S!{J`qyJBO|M=|B;PapAPd{#Ilz;>zAOQ(TKmrnwz)c0-iL^Nf diff --git a/graphics_file_rules.mk b/graphics_file_rules.mk index 090620ebe8..92cc3338dc 100644 --- a/graphics_file_rules.mk +++ b/graphics_file_rules.mk @@ -21,7 +21,7 @@ JPCONTESTGFXDIR := graphics/contest/japanese POKEDEXGFXDIR := graphics/pokedex STARTERGFXDIR := graphics/starter_choose NAMINGGFXDIR := graphics/naming_screen -SPINDAGFXDIR := graphics/spinda_spots +SPINDAGFXDIR := graphics/pokemon/spinda/spots types := normal fight flying poison ground rock bug ghost steel mystery fire water grass electric psychic ice dragon dark contest_types := cool beauty cute smart tough @@ -290,10 +290,10 @@ $(FONTGFXDIR)/short.fwjpnfont: $(FONTGFXDIR)/japanese_short.png $(FONTGFXDIR)/braille.fwjpnfont: $(FONTGFXDIR)/braille.png $(GFX) $< $@ -$(FONTGFXDIR)/frlg_male.fwjpnfont: $(FONTGFXDIR)/japanese_frlg_male_font.png +$(FONTGFXDIR)/frlg_male.fwjpnfont: $(FONTGFXDIR)/japanese_frlg_male.png $(GFX) $< $@ -$(FONTGFXDIR)/frlg_female.fwjpnfont: $(FONTGFXDIR)/japanese_frlg_female_font.png +$(FONTGFXDIR)/frlg_female.fwjpnfont: $(FONTGFXDIR)/japanese_frlg_female.png $(GFX) $< $@ diff --git a/src/pokemon.c b/src/pokemon.c index d3a570e72f..6ee052fda5 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -1354,10 +1354,10 @@ static const u16 sHoennToNationalOrder[NUM_SPECIES - 1] = const struct SpindaSpot gSpindaSpotGraphics[] = { - {.x = 16, .y = 7, .image = INCBIN_U16("graphics/spinda_spots/spot_0.1bpp")}, - {.x = 40, .y = 8, .image = INCBIN_U16("graphics/spinda_spots/spot_1.1bpp")}, - {.x = 22, .y = 25, .image = INCBIN_U16("graphics/spinda_spots/spot_2.1bpp")}, - {.x = 34, .y = 26, .image = INCBIN_U16("graphics/spinda_spots/spot_3.1bpp")} + {.x = 16, .y = 7, .image = INCBIN_U16("graphics/pokemon/spinda/spots/spot_0.1bpp")}, + {.x = 40, .y = 8, .image = INCBIN_U16("graphics/pokemon/spinda/spots/spot_1.1bpp")}, + {.x = 22, .y = 25, .image = INCBIN_U16("graphics/pokemon/spinda/spots/spot_2.1bpp")}, + {.x = 34, .y = 26, .image = INCBIN_U16("graphics/pokemon/spinda/spots/spot_3.1bpp")} }; #include "data/pokemon/item_effects.h" From a0bf504bc1364e15d7c60e1d8a043e6044376770 Mon Sep 17 00:00:00 2001 From: Icedude907 <34080011+Icedude907@users.noreply.github.com> Date: Sun, 12 Nov 2023 15:19:50 +1300 Subject: [PATCH 10/13] Linkerscript now tracks RAM/ROM usage --- .gitignore | 1 - Makefile | 9 ++- gflib/malloc.c | 3 + gflib/malloc.h | 3 +- ld_script.txt => ld_script.ld | 50 ++++++++--------- ld_script_modern.txt => ld_script_modern.ld | 61 ++++++++++----------- 6 files changed, 64 insertions(+), 63 deletions(-) rename ld_script.txt => ld_script.ld (99%) rename ld_script_modern.txt => ld_script_modern.ld (83%) diff --git a/.gitignore b/.gitignore index 082430d794..9fa431e143 100644 --- a/.gitignore +++ b/.gitignore @@ -21,7 +21,6 @@ sound/**/*.bin sound/songs/midi/*.s tools/agbcc *.map -*.ld *.bat *.dump *.sa* diff --git a/Makefile b/Makefile index 5c073b36ca..50953be79c 100644 --- a/Makefile +++ b/Makefile @@ -119,8 +119,6 @@ ifneq ($(MODERN),1) CPPFLAGS += -I tools/agbcc/include -I tools/agbcc -nostdinc -undef endif -LDFLAGS = -Map ../../$(MAP) - SHA1 := $(shell { command -v sha1sum || command -v shasum; } 2>/dev/null) -c GFX := tools/gbagfx/gbagfx$(EXE) AIF := tools/aif2pcm/aif2pcm$(EXE) @@ -406,19 +404,20 @@ $(OBJ_DIR)/sym_ewram.ld: sym_ewram.txt $(RAMSCRGEN) ewram_data $< ENGLISH > $@ ifeq ($(MODERN),0) -LD_SCRIPT := ld_script.txt +LD_SCRIPT := ld_script.ld LD_SCRIPT_DEPS := $(OBJ_DIR)/sym_bss.ld $(OBJ_DIR)/sym_common.ld $(OBJ_DIR)/sym_ewram.ld else -LD_SCRIPT := ld_script_modern.txt +LD_SCRIPT := ld_script_modern.ld LD_SCRIPT_DEPS := endif $(OBJ_DIR)/ld_script.ld: $(LD_SCRIPT) $(LD_SCRIPT_DEPS) cd $(OBJ_DIR) && sed "s#tools/#../../tools/#g" ../../$(LD_SCRIPT) > ld_script.ld +LDFLAGS = -Map ../../$(MAP) $(ELF): $(OBJ_DIR)/ld_script.ld $(OBJS) libagbsyscall @echo "cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld -o ../../$@ " - @cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld -o ../../$@ $(OBJS_REL) $(LIB) + @cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld --print-memory-usage -o ../../$@ $(OBJS_REL) $(LIB) | cat $(FIX) $@ -t"$(TITLE)" -c$(GAME_CODE) -m$(MAKER_CODE) -r$(REVISION) --silent $(ROM): $(ELF) diff --git a/gflib/malloc.c b/gflib/malloc.c index d0b9497635..7229c20e8b 100644 --- a/gflib/malloc.c +++ b/gflib/malloc.c @@ -1,8 +1,11 @@ #include "global.h" +#include "malloc.h" static void *sHeapStart; static u32 sHeapSize; +__attribute__((section("__EWRAM_HEAP"))) u8 gHeap[HEAP_SIZE] = {0}; + #define MALLOC_SYSTEM_ID 0xA3A3 struct MemBlock { diff --git a/gflib/malloc.h b/gflib/malloc.h index 851db83a62..2792ff1cb7 100644 --- a/gflib/malloc.h +++ b/gflib/malloc.h @@ -1,7 +1,6 @@ #ifndef GUARD_ALLOC_H #define GUARD_ALLOC_H -#define HEAP_SIZE 0x1C000 #define FREE_AND_SET_NULL(ptr) \ { \ @@ -11,6 +10,8 @@ #define TRY_FREE_AND_SET_NULL(ptr) if (ptr != NULL) FREE_AND_SET_NULL(ptr) +// 122 KB. Max size of the heap without running into other data +#define HEAP_SIZE 0x1C000 extern u8 gHeap[]; void *Alloc(u32 size); diff --git a/ld_script.txt b/ld_script.ld similarity index 99% rename from ld_script.txt rename to ld_script.ld index 4be5965240..ee0556d5a0 100644 --- a/ld_script.txt +++ b/ld_script.ld @@ -3,6 +3,13 @@ ENTRY(Start) gNumMusicPlayers = 4; gMaxLines = 0; +MEMORY +{ + EWRAM (rwx) : ORIGIN = 0x2000000, LENGTH = 256K + IWRAM (rwx) : ORIGIN = 0x3000000, LENGTH = 32K + ROM (rx) : ORIGIN = 0x8000000, LENGTH = 16M +} + /* Modify the following load addresses as needed to make more room. Alternately, delete both the declarations below and their references further down to get rid of the gaps. */ @@ -10,28 +17,22 @@ __anim_mon_load_address = 0x8b00000; __gfx_load_address = 0x8c00000; SECTIONS { - . = 0x2000000; - ewram (NOLOAD) : + ewram 0x2000000 (NOLOAD) : ALIGN(4) { - gHeap = .; - - . = 0x1C000; + *(__EWRAM_HEAP); INCLUDE "sym_ewram.ld" - src/*.o(ewram_data); - gflib/*.o(ewram_data); + src/*.o(ewram_data); /**/ + gflib/*.o(ewram_data); /**/ *libc.a:impure.o(.data); *libc.a:locale.o(.data); *libc.a:mallocr.o(.data); - . = 0x40000; - } + } > EWRAM - . = 0x3000000; - - iwram (NOLOAD) : + iwram 0x3000000 (NOLOAD) : ALIGN(4) { /* .bss starts at 0x3000000 */ @@ -46,10 +47,9 @@ SECTIONS { /* COMMON starts at 0x30022A8 */ INCLUDE "sym_common.ld" *libc.a:sbrkr.o(COMMON); - end = .; - . = 0x8000; - } + } > IWRAM + /* BEGIN ROM DATA */ . = 0x8000000; .text : @@ -343,7 +343,7 @@ SECTIONS { src/gym_leader_rematch.o(.text); src/battle_transition_frontier.o(.text); src/international_string_util.o(.text); - } =0 + } > ROM =0 script_data : ALIGN(4) @@ -356,7 +356,7 @@ SECTIONS { data/battle_ai_scripts.o(script_data); data/contest_ai_scripts.o(script_data); data/mystery_event_script_cmd_table.o(script_data); - } =0 + } > ROM =0 lib_text : ALIGN(4) @@ -440,7 +440,7 @@ SECTIONS { *libc.a:libcfunc.o(.text); *libc.a:lseekr.o(.text); *libc.a:readr.o(.text); - } =0 + } > ROM =0 .rodata : ALIGN(4) @@ -705,7 +705,7 @@ SECTIONS { data/mystery_gift.o(.rodata); src/m4a_tables.o(.rodata); data/sound_data.o(.rodata); - } =0 + } > ROM =0 song_data : ALIGN(4) @@ -1240,7 +1240,7 @@ SECTIONS { sound/songs/midi/ph_nurse_blend.o(.rodata); sound/songs/midi/ph_nurse_held.o(.rodata); sound/songs/midi/ph_nurse_solo.o(.rodata); - } =0 + } > ROM =0 lib_rodata : SUBALIGN(4) @@ -1293,7 +1293,7 @@ SECTIONS { *libc.a:lseekr.o(.rodata); *libc.a:readr.o(.rodata); src/libisagbprn.o(.rodata); - } =0 + } > ROM =0 multiboot_data : ALIGN(4) @@ -1301,19 +1301,19 @@ SECTIONS { data/multiboot_ereader.o(.rodata); data/multiboot_berry_glitch_fix.o(.rodata); data/multiboot_pokemon_colosseum.o(.rodata); - } =0 + } > ROM =0 anim_mon_front_pic_data __anim_mon_load_address : ALIGN(4) { src/anim_mon_front_pics.o(.rodata); - } =0 + } > ROM =0 gfx_data __gfx_load_address : ALIGN(4) { src/graphics.o(.rodata); - } =0 + } > ROM =0 extra : ALIGN(4) @@ -1323,7 +1323,7 @@ SECTIONS { src/*.o(.rodata); gflib/*.o(.rodata); data/*.o(.rodata); - } = 0 + } > ROM = 0 /* DWARF debug sections. Symbols in the DWARF debugging sections are relative to the beginning diff --git a/ld_script_modern.txt b/ld_script_modern.ld similarity index 83% rename from ld_script_modern.txt rename to ld_script_modern.ld index 549d040e1e..05b2b815ff 100644 --- a/ld_script_modern.txt +++ b/ld_script_modern.ld @@ -3,28 +3,28 @@ ENTRY(Start) gNumMusicPlayers = 4; gMaxLines = 0; -SECTIONS { - . = 0x2000000; - - ewram (NOLOAD) : - ALIGN(4) - { - gHeap = .; - - . = 0x1C000; - - src/*.o(ewram_data); - gflib/*.o(ewram_data); - - . = 0x40000; +/* Memory Spaces */ +MEMORY +{ + EWRAM (rwx) : ORIGIN = 0x2000000, LENGTH = 256K + IWRAM (rwx) : ORIGIN = 0x3000000, LENGTH = 32K + ROM (rx) : ORIGIN = 0x8000000, LENGTH = 16M } - . = 0x3000000; +SECTIONS { - iwram (NOLOAD) : + ewram 0x2000000 (NOLOAD) : + ALIGN(4) + { + *(__EWRAM_HEAP); + + src/*.o(ewram_data); /**/ + gflib/*.o(ewram_data); /**/ + } > EWRAM + + iwram 0x3000000 (NOLOAD) : ALIGN(4) { - /* .bss starts at 0x3000000 */ src/*.o(.bss); gflib/*.o(.bss); data/*.o(.bss); @@ -35,14 +35,13 @@ SECTIONS { src/m4a.o(.bss.code); /* COMMON starts at 0x30022A8 */ - src/*.o(COMMON); - gflib/*.o(COMMON); - *libc.a:*.o(COMMON); + src/*.o(COMMON); /**/ + gflib/*.o(COMMON); /**/ + *libc.a:*.o(COMMON); *libnosys.a:*.o(COMMON); - end = .; - . = 0x8000; - } + } > IWRAM + /* BEGIN ROM DATA */ . = 0x8000000; .text : @@ -55,13 +54,13 @@ SECTIONS { gflib/*.o(.text*); src/*.o(.text*); asm/*.o(.text*); - } =0 + } > ROM =0 script_data : ALIGN(4) { data/*.o(script_data); - } =0 + } > ROM =0 lib_text : ALIGN(4) @@ -82,7 +81,7 @@ SECTIONS { *libc.a:*.o(.text*); *libnosys.a:*.o(.text*); src/libisagbprn.o(.text); - } =0 + } > ROM =0 .rodata : ALIGN(4) @@ -90,13 +89,13 @@ SECTIONS { src/*.o(.rodata*); gflib/*.o(.rodata*); data/*.o(.rodata*); - } =0 + } > ROM =0 song_data : ALIGN(4) { sound/songs/*.o(.rodata); - } =0 + } > ROM =0 lib_rodata : SUBALIGN(4) @@ -121,19 +120,19 @@ SECTIONS { data/multiboot_ereader.o(.rodata); data/multiboot_berry_glitch_fix.o(.rodata); data/multiboot_pokemon_colosseum.o(.rodata); - } =0 + } > ROM =0 anim_mon_front_pic_data : ALIGN(4) { src/anim_mon_front_pics.o(.rodata); - } =0 + } > ROM =0 gfx_data : ALIGN(4) { src/graphics.o(.rodata); - } =0 + } > ROM =0 /* DWARF debug sections. Symbols in the DWARF debugging sections are relative to the beginning From 190e77e9c886174e0edaecbe8bb44365e55bfebd Mon Sep 17 00:00:00 2001 From: SnorlaxMonster Date: Sat, 18 Nov 2023 12:53:00 +1100 Subject: [PATCH 11/13] Rename HITMARKER_IGNORE_SAFEGUARD Rename HITMARKER_IGNORE_SAFEGUARD to HITMARKER_STATUS_ABILITY_EFFECT. This flag is used exclusively by status-inflicting Abilities, and has 3 main functions: - Whether the effect bypasses Shield Dust - Whether the effect bypasses Safeguard - Which text string to display when the status condition is inflicted (i.e. whether it was inflicted by a move or Ability) I believe this new name better represents what the flag actually does. This name was structured to parallel HITMARKER_SYNCHRONISE_EFFECT. --- include/constants/battle.h | 2 +- src/battle_script_commands.c | 30 +++++++++++++++--------------- src/battle_util.c | 16 ++++++++-------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/include/constants/battle.h b/include/constants/battle.h index c4c1bc5e68..50c93083f8 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -176,7 +176,7 @@ #define HITMARKER_ATTACKSTRING_PRINTED (1 << 10) #define HITMARKER_NO_PPDEDUCT (1 << 11) #define HITMARKER_SWAP_ATTACKER_TARGET (1 << 12) -#define HITMARKER_IGNORE_SAFEGUARD (1 << 13) +#define HITMARKER_STATUS_ABILITY_EFFECT (1 << 13) #define HITMARKER_SYNCHRONISE_EFFECT (1 << 14) #define HITMARKER_RUN (1 << 15) #define HITMARKER_IGNORE_ON_AIR (1 << 16) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 96ae0e68a3..2bc8e73f43 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2246,11 +2246,11 @@ void SetMoveEffect(bool8 primary, u8 certain) gBattleScripting.battler = gBattlerAttacker; } - if (gBattleMons[gEffectBattler].ability == ABILITY_SHIELD_DUST && !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + if (gBattleMons[gEffectBattler].ability == ABILITY_SHIELD_DUST && !(gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) && !primary && gBattleCommunication[MOVE_EFFECT_BYTE] <= 9) INCREMENT_RESET_RETURN - if (gSideStatuses[GET_BATTLER_SIDE(gEffectBattler)] & SIDE_STATUS_SAFEGUARD && !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + if (gSideStatuses[GET_BATTLER_SIDE(gEffectBattler)] & SIDE_STATUS_SAFEGUARD && !(gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) && !primary && gBattleCommunication[MOVE_EFFECT_BYTE] <= 7) INCREMENT_RESET_RETURN @@ -2300,10 +2300,10 @@ void SetMoveEffect(bool8 primary, u8 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_PSNPrevention; - if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS; - gHitMarker &= ~HITMARKER_IGNORE_SAFEGUARD; + gHitMarker &= ~HITMARKER_STATUS_ABILITY_EFFECT; } else { @@ -2312,7 +2312,7 @@ void SetMoveEffect(bool8 primary, u8 certain) RESET_RETURN } if ((IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_POISON) || IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_STEEL)) - && (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + && (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) && (primary == TRUE || certain == MOVE_EFFECT_CERTAIN)) { BattleScriptPush(gBattlescriptCurrInstr + 1); @@ -2341,10 +2341,10 @@ void SetMoveEffect(bool8 primary, u8 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_BRNPrevention; - if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS; - gHitMarker &= ~HITMARKER_IGNORE_SAFEGUARD; + gHitMarker &= ~HITMARKER_STATUS_ABILITY_EFFECT; } else { @@ -2353,7 +2353,7 @@ void SetMoveEffect(bool8 primary, u8 certain) RESET_RETURN } if (IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_FIRE) - && (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + && (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) && (primary == TRUE || certain == MOVE_EFFECT_CERTAIN)) { BattleScriptPush(gBattlescriptCurrInstr + 1); @@ -2397,10 +2397,10 @@ void SetMoveEffect(bool8 primary, u8 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_PRLZPrevention; - if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS; - gHitMarker &= ~HITMARKER_IGNORE_SAFEGUARD; + gHitMarker &= ~HITMARKER_STATUS_ABILITY_EFFECT; } else { @@ -2425,10 +2425,10 @@ void SetMoveEffect(bool8 primary, u8 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_PSNPrevention; - if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS; - gHitMarker &= ~HITMARKER_IGNORE_SAFEGUARD; + gHitMarker &= ~HITMARKER_STATUS_ABILITY_EFFECT; } else { @@ -2437,7 +2437,7 @@ void SetMoveEffect(bool8 primary, u8 certain) RESET_RETURN } if ((IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_POISON) || IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_STEEL)) - && (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + && (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) && (primary == TRUE || certain == MOVE_EFFECT_CERTAIN)) { BattleScriptPush(gBattlescriptCurrInstr + 1); @@ -2480,10 +2480,10 @@ void SetMoveEffect(bool8 primary, u8 certain) BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gEffectBattler].status1), &gBattleMons[gEffectBattler].status1); MarkBattlerForControllerExec(gActiveBattler); - if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) + if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STATUSED_BY_ABILITY; - gHitMarker &= ~HITMARKER_IGNORE_SAFEGUARD; + gHitMarker &= ~HITMARKER_STATUS_ABILITY_EFFECT; } else { diff --git a/src/battle_util.c b/src/battle_util.c index 5a2b6392f0..735d1ba810 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -649,7 +649,7 @@ void HandleAction_NothingIsFainted(void) gCurrentTurnActionNumber++; gCurrentActionFuncId = gActionsByTurnOrder[gCurrentTurnActionNumber]; gHitMarker &= ~(HITMARKER_DESTINYBOND | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_ATTACKSTRING_PRINTED - | HITMARKER_NO_PPDEDUCT | HITMARKER_IGNORE_SAFEGUARD | HITMARKER_IGNORE_ON_AIR + | HITMARKER_NO_PPDEDUCT | HITMARKER_STATUS_ABILITY_EFFECT | HITMARKER_IGNORE_ON_AIR | HITMARKER_IGNORE_UNDERGROUND | HITMARKER_IGNORE_UNDERWATER | HITMARKER_PASSIVE_DAMAGE | HITMARKER_OBEYS | HITMARKER_WAKE_UP_CLEAR | HITMARKER_SYNCHRONISE_EFFECT | HITMARKER_CHARGING | HITMARKER_NEVER_SET); @@ -662,7 +662,7 @@ void HandleAction_ActionFinished(void) gCurrentActionFuncId = gActionsByTurnOrder[gCurrentTurnActionNumber]; SpecialStatusesClear(); gHitMarker &= ~(HITMARKER_DESTINYBOND | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_ATTACKSTRING_PRINTED - | HITMARKER_NO_PPDEDUCT | HITMARKER_IGNORE_SAFEGUARD | HITMARKER_IGNORE_ON_AIR + | HITMARKER_NO_PPDEDUCT | HITMARKER_STATUS_ABILITY_EFFECT | HITMARKER_IGNORE_ON_AIR | HITMARKER_IGNORE_UNDERGROUND | HITMARKER_IGNORE_UNDERWATER | HITMARKER_PASSIVE_DAMAGE | HITMARKER_OBEYS | HITMARKER_WAKE_UP_CLEAR | HITMARKER_SYNCHRONISE_EFFECT | HITMARKER_CHARGING | HITMARKER_NEVER_SET); @@ -2782,7 +2782,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA gBattleCommunication[MOVE_EFFECT_BYTE] += MOVE_EFFECT_AFFECTS_USER; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect; - gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT; effect++; } break; @@ -2797,7 +2797,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_POISON; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect; - gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT; effect++; } break; @@ -2812,7 +2812,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_PARALYSIS; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect; - gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT; effect++; } break; @@ -2827,7 +2827,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_BURN; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect; - gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT; effect++; } break; @@ -2963,7 +2963,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA gBattleScripting.battler = gBattlerTarget; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_SynchronizeActivates; - gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT; effect++; } break; @@ -2979,7 +2979,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA gBattleScripting.battler = gBattlerAttacker; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_SynchronizeActivates; - gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; + gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT; effect++; } break; From e5ac2a103ee301bbac1db281136b047192287362 Mon Sep 17 00:00:00 2001 From: Icedude907 <34080011+Icedude907@users.noreply.github.com> Date: Fri, 24 Nov 2023 10:13:50 +1300 Subject: [PATCH 12/13] Incorporate review changes --- gflib/malloc.c | 2 +- gflib/malloc.h | 3 +-- ld_script.ld | 8 +++----- ld_script_modern.ld | 17 ++++++----------- sym_ewram.txt | 1 + 5 files changed, 12 insertions(+), 19 deletions(-) diff --git a/gflib/malloc.c b/gflib/malloc.c index 7229c20e8b..f54c751a4c 100644 --- a/gflib/malloc.c +++ b/gflib/malloc.c @@ -4,7 +4,7 @@ static void *sHeapStart; static u32 sHeapSize; -__attribute__((section("__EWRAM_HEAP"))) u8 gHeap[HEAP_SIZE] = {0}; +EWRAM_DATA u8 gHeap[HEAP_SIZE] = {0}; #define MALLOC_SYSTEM_ID 0xA3A3 diff --git a/gflib/malloc.h b/gflib/malloc.h index 2792ff1cb7..72e1a5e1d3 100644 --- a/gflib/malloc.h +++ b/gflib/malloc.h @@ -10,9 +10,8 @@ #define TRY_FREE_AND_SET_NULL(ptr) if (ptr != NULL) FREE_AND_SET_NULL(ptr) -// 122 KB. Max size of the heap without running into other data #define HEAP_SIZE 0x1C000 -extern u8 gHeap[]; +extern u8 gHeap[HEAP_SIZE]; void *Alloc(u32 size); void *AllocZeroed(u32 size); diff --git a/ld_script.ld b/ld_script.ld index ee0556d5a0..c4abf075f8 100644 --- a/ld_script.ld +++ b/ld_script.ld @@ -7,7 +7,7 @@ MEMORY { EWRAM (rwx) : ORIGIN = 0x2000000, LENGTH = 256K IWRAM (rwx) : ORIGIN = 0x3000000, LENGTH = 32K - ROM (rx) : ORIGIN = 0x8000000, LENGTH = 16M + ROM (rx) : ORIGIN = 0x8000000, LENGTH = 32M } /* Modify the following load addresses as needed to make more room. Alternately, delete both the @@ -21,11 +21,9 @@ SECTIONS { ewram 0x2000000 (NOLOAD) : ALIGN(4) { - *(__EWRAM_HEAP); - INCLUDE "sym_ewram.ld" - src/*.o(ewram_data); /**/ - gflib/*.o(ewram_data); /**/ + src/*.o(ewram_data); + gflib/*.o(ewram_data); *libc.a:impure.o(.data); *libc.a:locale.o(.data); diff --git a/ld_script_modern.ld b/ld_script_modern.ld index 05b2b815ff..4ccbfbaa0f 100644 --- a/ld_script_modern.ld +++ b/ld_script_modern.ld @@ -3,12 +3,11 @@ ENTRY(Start) gNumMusicPlayers = 4; gMaxLines = 0; -/* Memory Spaces */ MEMORY { EWRAM (rwx) : ORIGIN = 0x2000000, LENGTH = 256K IWRAM (rwx) : ORIGIN = 0x3000000, LENGTH = 32K - ROM (rx) : ORIGIN = 0x8000000, LENGTH = 16M + ROM (rx) : ORIGIN = 0x8000000, LENGTH = 32M } SECTIONS { @@ -16,10 +15,8 @@ SECTIONS { ewram 0x2000000 (NOLOAD) : ALIGN(4) { - *(__EWRAM_HEAP); - - src/*.o(ewram_data); /**/ - gflib/*.o(ewram_data); /**/ + src/*.o(ewram_data); + gflib/*.o(ewram_data); } > EWRAM iwram 0x3000000 (NOLOAD) : @@ -31,13 +28,11 @@ SECTIONS { *libc.a:*.o(.bss*); *libnosys.a:*.o(.bss*); - /* .bss.code starts at 0x3001AA8 */ src/m4a.o(.bss.code); - /* COMMON starts at 0x30022A8 */ - src/*.o(COMMON); /**/ - gflib/*.o(COMMON); /**/ - *libc.a:*.o(COMMON); + src/*.o(COMMON); + gflib/*.o(COMMON); + *libc.a:*.o(COMMON); *libnosys.a:*.o(COMMON); } > IWRAM diff --git a/sym_ewram.txt b/sym_ewram.txt index 414b7a3b23..31c507ee9b 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -1,3 +1,4 @@ + .include "gflib/malloc.o" .include "src/decompress.o" .include "src/main.o" .include "gflib/window.o" From 05708ace88b4c5cf3e57b4b4aa4bcb6a7a11abe3 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sat, 2 Dec 2023 12:11:22 -0300 Subject: [PATCH 13/13] Updated the size of the struct InGameTrade's otName variable --- src/trade.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/trade.c b/src/trade.c index 5728a6ee51..ec9486afa1 100644 --- a/src/trade.c +++ b/src/trade.c @@ -157,7 +157,7 @@ struct InGameTrade { u32 personality; u16 heldItem; u8 mailNum; - u8 otName[11]; + u8 otName[TRAINER_NAME_LENGTH + 1]; u8 otGender; u8 sheen; u16 requestedSpecies;