From 1360b3a477f1107785900cd0c4e73ebf018f058c Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Thu, 4 Apr 2019 17:05:46 -0400 Subject: RGB Constants --- src/battle_script_commands.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/battle_script_commands.c') diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 0a0c34ad2..e9db4a1ad 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -50,6 +50,7 @@ #include "pokemon_summary_screen.h" #include "pokenav.h" #include "menu_specialized.h" +#include "constants/rgb.h" extern struct MusicPlayerInfo gMPlayInfo_BGM; @@ -5695,7 +5696,7 @@ static void atk5A_yesnoboxlearnmove(void) if (gBattleCommunication[1] == 0) { HandleBattleWindow(0x18, 0x8, 0x1D, 0xD, WINDOW_CLEAR); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, 0); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); gBattleScripting.learnMoveState++; } else @@ -10274,7 +10275,7 @@ static void atkF2_displaydexinfo(void) switch (gBattleCommunication[0]) { case 0: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, 0); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); gBattleCommunication[0]++; break; case 1: @@ -10305,7 +10306,7 @@ static void atkF2_displaydexinfo(void) case 4: if (!IsDma3ManagerBusyWithBgCopy()) { - BeginNormalPaletteFade(0xFFFF, 0, 0x10, 0, 0); + BeginNormalPaletteFade(0xFFFF, 0, 0x10, 0, RGB_BLACK); ShowBg(0); ShowBg(3); gBattleCommunication[0]++; -- cgit v1.2.3 From dd24597d529cd5d9c06aa4699526dbe13d7c9b8e Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Thu, 4 Apr 2019 21:24:21 +0200 Subject: Finish up menu specialised --- src/battle_script_commands.c | 59 ++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 30 deletions(-) (limited to 'src/battle_script_commands.c') diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 2e78e1ca0..fc396b5e3 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -66,8 +66,8 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8, const u8* BS_ptr); static bool32 IsMonGettingExpSentOut(void); static void sub_804F17C(void); static bool8 sub_804F1CC(void); -static void sub_804F100(void); -static void sub_804F144(void); +static void DrawLevelUpWindow1(void); +static void DrawLevelUpWindow2(void); static bool8 sub_804F344(void); static void PutMonIconOnLvlUpBox(void); static void PutLevelAndGenderOnLvlUpBox(void); @@ -3238,9 +3238,8 @@ static void atk23_getexp(void) s32 i; // also used as stringId u8 holdEffect; s32 sentIn; - s32 viaExpShare = 0; - u16* exp = &gBattleStruct->expValue; + u16 *exp = &gBattleStruct->expValue; gBattlerFainted = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]); sentIn = gSentPokesToOpponent[(gBattlerFainted & 2) >> 1]; @@ -3391,14 +3390,14 @@ static void atk23_getexp(void) } } else + { gBattleStruct->expGetterBattlerId = 0; + } - PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gBattleStruct->expGetterBattlerId, gBattleStruct->expGetterMonId) - + PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gBattleStruct->expGetterBattlerId, gBattleStruct->expGetterMonId); // buffer 'gained' or 'gained a boosted' - PREPARE_STRING_BUFFER(gBattleTextBuff2, i) - - PREPARE_WORD_NUMBER_BUFFER(gBattleTextBuff3, 5, gBattleMoveDamage) + PREPARE_STRING_BUFFER(gBattleTextBuff2, i); + PREPARE_WORD_NUMBER_BUFFER(gBattleTextBuff3, 5, gBattleMoveDamage); PrepareStringBattle(STRINGID_PKMNGAINEDEXP, gBattleStruct->expGetterBattlerId); MonGainEVs(&gPlayerParty[gBattleStruct->expGetterMonId], gBattleMons[gBattlerFainted].species); @@ -3414,12 +3413,12 @@ static void atk23_getexp(void) gBattleBufferB[gBattleStruct->expGetterBattlerId][0] = 0; if (GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_HP) && GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL) != MAX_LEVEL) { - gBattleResources->statsBeforeLvlUp->hp = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_MAX_HP); - gBattleResources->statsBeforeLvlUp->atk = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_ATK); - gBattleResources->statsBeforeLvlUp->def = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_DEF); - gBattleResources->statsBeforeLvlUp->spd = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPEED); - gBattleResources->statsBeforeLvlUp->spAtk = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPATK); - gBattleResources->statsBeforeLvlUp->spDef = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPDEF); + gBattleResources->beforeLvlUp->stats[STAT_HP] = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_MAX_HP); + gBattleResources->beforeLvlUp->stats[STAT_ATK] = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_ATK); + gBattleResources->beforeLvlUp->stats[STAT_DEF] = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_DEF); + gBattleResources->beforeLvlUp->stats[STAT_SPEED] = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPEED); + gBattleResources->beforeLvlUp->stats[STAT_SPATK] = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPATK); + gBattleResources->beforeLvlUp->stats[STAT_SPDEF] = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPDEF); gActiveBattler = gBattleStruct->expGetterBattlerId; BtlController_EmitExpUpdate(0, gBattleStruct->expGetterMonId, gBattleMoveDamage); @@ -3437,9 +3436,8 @@ static void atk23_getexp(void) if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gBattlerPartyIndexes[gActiveBattler] == gBattleStruct->expGetterMonId) HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gActiveBattler, gBattleStruct->expGetterMonId) - - PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff2, 3, GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL)) + PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gActiveBattler, gBattleStruct->expGetterMonId); + PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff2, 3, GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL)); BattleScriptPushCursor(); gLeveledUpInBattle |= gBitTable[gBattleStruct->expGetterMonId]; @@ -3487,7 +3485,9 @@ static void atk23_getexp(void) break; case 5: // looper increment if (gBattleMoveDamage) // there is exp to give, goto case 3 that gives exp + { gBattleScripting.atk23_state = 3; + } else { gBattleStruct->expGetterMonId++; @@ -5911,8 +5911,7 @@ static void atk5D_getmoneyreward(void) moneyReward += GetTrainerMoneyToGive(gTrainerBattleOpponent_B); AddMoney(&gSaveBlock1Ptr->money, moneyReward); - - PREPARE_WORD_NUMBER_BUFFER(gBattleTextBuff1, 5, moneyReward) + PREPARE_WORD_NUMBER_BUFFER(gBattleTextBuff1, 5, moneyReward); gBattlescriptCurrInstr++; } @@ -6233,7 +6232,7 @@ static void atk6C_drawlvlupbox(void) gBattleScripting.atk6C_state = 4; break; case 4: - sub_804F100(); + DrawLevelUpWindow1(); PutWindowTilemap(13); CopyWindowToVram(13, 3); gBattleScripting.atk6C_state++; @@ -6250,7 +6249,7 @@ static void atk6C_drawlvlupbox(void) if (gMain.newKeys != 0) { PlaySE(SE_SELECT); - sub_804F144(); + DrawLevelUpWindow2(); CopyWindowToVram(13, 2); gBattleScripting.atk6C_state++; } @@ -6291,20 +6290,20 @@ static void atk6C_drawlvlupbox(void) } } -static void sub_804F100(void) +static void DrawLevelUpWindow1(void) { - struct StatsArray currentStats; + u16 currStats[NUM_STATS]; - GetMonLevelUpWindowStats(&gPlayerParty[gBattleStruct->expGetterMonId], (u16*) ¤tStats); - DrawLevelUpWindowPg1(0xD, (u16*) gBattleResources->statsBeforeLvlUp,(u16*) ¤tStats, 0xE, 0xD, 0xF); + GetMonLevelUpWindowStats(&gPlayerParty[gBattleStruct->expGetterMonId], currStats); + DrawLevelUpWindowPg1(0xD, gBattleResources->beforeLvlUp->stats, currStats, 0xE, 0xD, 0xF); } -static void sub_804F144(void) +static void DrawLevelUpWindow2(void) { - struct StatsArray currentStats; + u16 currStats[NUM_STATS]; - GetMonLevelUpWindowStats(&gPlayerParty[gBattleStruct->expGetterMonId], (u16*) ¤tStats); - DrawLevelUpWindowPg2(0xD, (u16*) ¤tStats, 0xE, 0xD, 0xF); + GetMonLevelUpWindowStats(&gPlayerParty[gBattleStruct->expGetterMonId], currStats); + DrawLevelUpWindowPg2(0xD, currStats, 0xE, 0xD, 0xF); } static void sub_804F17C(void) -- cgit v1.2.3 From 8751fafad148d1c2a6790b6b4fcba9be39f3c1e3 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Fri, 5 Apr 2019 00:05:51 +0200 Subject: Make it compile --- src/battle_script_commands.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/battle_script_commands.c') diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index fc396b5e3..c002eefbc 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -50,6 +50,7 @@ #include "pokemon_summary_screen.h" #include "pokenav.h" #include "menu_specialized.h" +#include "data.h" extern struct MusicPlayerInfo gMPlayInfo_BGM; -- cgit v1.2.3 From 106a89eace1cb4de5f7b45683d14c484c4cfdd90 Mon Sep 17 00:00:00 2001 From: hjk321 <37224753+hjk321@users.noreply.github.com> Date: Sat, 27 Apr 2019 16:41:37 -0600 Subject: Document magic number from atk04_critcalc --- src/battle_script_commands.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/battle_script_commands.c') diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 7e783bef5..f7eed0760 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1276,8 +1276,8 @@ static void atk04_critcalc(void) + 2 * (holdEffect == HOLD_EFFECT_LUCKY_PUNCH && gBattleMons[gBattlerAttacker].species == SPECIES_CHANSEY) + 2 * (holdEffect == HOLD_EFFECT_STICK && gBattleMons[gBattlerAttacker].species == SPECIES_FARFETCHD); - if (critChance > 4) - critChance = 4; + if (critChance > ARRAY_COUNT(sCriticalHitChance) - 1 ) + critChance = ARRAY_COUNT(sCriticalHitChance) - 1; if ((gBattleMons[gBattlerTarget].ability != ABILITY_BATTLE_ARMOR && gBattleMons[gBattlerTarget].ability != ABILITY_SHELL_ARMOR) && !(gStatuses3[gBattlerAttacker] & STATUS3_CANT_SCORE_A_CRIT) -- cgit v1.2.3 From ee4049d93edfeb24a315c40e3d6849278cdb33e5 Mon Sep 17 00:00:00 2001 From: hjk321 <37224753+hjk321@users.noreply.github.com> Date: Thu, 2 May 2019 22:26:11 -0500 Subject: Fix indentation Error --- src/battle_script_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/battle_script_commands.c') diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index f7eed0760..d2496881e 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1277,7 +1277,7 @@ static void atk04_critcalc(void) + 2 * (holdEffect == HOLD_EFFECT_STICK && gBattleMons[gBattlerAttacker].species == SPECIES_FARFETCHD); if (critChance > ARRAY_COUNT(sCriticalHitChance) - 1 ) - critChance = ARRAY_COUNT(sCriticalHitChance) - 1; + critChance = ARRAY_COUNT(sCriticalHitChance) - 1; if ((gBattleMons[gBattlerTarget].ability != ABILITY_BATTLE_ARMOR && gBattleMons[gBattlerTarget].ability != ABILITY_SHELL_ARMOR) && !(gStatuses3[gBattlerAttacker] & STATUS3_CANT_SCORE_A_CRIT) -- cgit v1.2.3 From 26114d45793c14602e7c9f565461bddac1d3fc40 Mon Sep 17 00:00:00 2001 From: hjk321 <37224753+hjk321@users.noreply.github.com> Date: Fri, 3 May 2019 07:56:44 -0500 Subject: Update comparison --- src/battle_script_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/battle_script_commands.c') diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index d2496881e..51b658250 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1276,7 +1276,7 @@ static void atk04_critcalc(void) + 2 * (holdEffect == HOLD_EFFECT_LUCKY_PUNCH && gBattleMons[gBattlerAttacker].species == SPECIES_CHANSEY) + 2 * (holdEffect == HOLD_EFFECT_STICK && gBattleMons[gBattlerAttacker].species == SPECIES_FARFETCHD); - if (critChance > ARRAY_COUNT(sCriticalHitChance) - 1 ) + if (critChance >= ARRAY_COUNT(sCriticalHitChance)) critChance = ARRAY_COUNT(sCriticalHitChance) - 1; if ((gBattleMons[gBattlerTarget].ability != ABILITY_BATTLE_ARMOR && gBattleMons[gBattlerTarget].ability != ABILITY_SHELL_ARMOR) -- cgit v1.2.3 From fe59902b8a0608eafb746222e8e6800cad2fca8b Mon Sep 17 00:00:00 2001 From: huderlem Date: Fri, 3 May 2019 18:17:45 -0500 Subject: Fix indentation --- src/battle_script_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/battle_script_commands.c') diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 51b658250..837fb5bac 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1277,7 +1277,7 @@ static void atk04_critcalc(void) + 2 * (holdEffect == HOLD_EFFECT_STICK && gBattleMons[gBattlerAttacker].species == SPECIES_FARFETCHD); if (critChance >= ARRAY_COUNT(sCriticalHitChance)) - critChance = ARRAY_COUNT(sCriticalHitChance) - 1; + critChance = ARRAY_COUNT(sCriticalHitChance) - 1; if ((gBattleMons[gBattlerTarget].ability != ABILITY_BATTLE_ARMOR && gBattleMons[gBattlerTarget].ability != ABILITY_SHELL_ARMOR) && !(gStatuses3[gBattlerAttacker] & STATUS3_CANT_SCORE_A_CRIT) -- cgit v1.2.3