From 907492fd6e724d8dc2e5d2eff372be85e6f0d30c Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Mon, 4 Mar 2019 23:26:51 -0500 Subject: Split rom asm file in half The first half is ui/menu stuff, while the second half is link-related stuff. --- src/battle_script_commands.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/battle_script_commands.c') diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index a53fa30f2..89c2baca9 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -54,9 +54,9 @@ extern struct MusicPlayerInfo gMPlayInfo_BGM; extern const u8* const gBattleScriptsForMoveEffects[]; // functions -extern void sub_81D388C(struct Pokemon* mon, void* statStoreLocation); // pokenav.s -extern void sub_81D3640(u16 arg0, void* statStoreLocation1, void* statStoreLocation2, u8 arg3, u8 arg4, u8 arg5); // pokenav.s -extern void sub_81D3784(u16 arg0, void* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4); // pokenav.s +extern void GetMonLevelUpWindowStats(struct Pokemon* mon, void* statStoreLocation); // pokenav.s +extern void DrawLevelUpWindowPg1(u16 arg0, void* statStoreLocation1, void* statStoreLocation2, u8 arg3, u8 arg4, u8 arg5); // pokenav.s +extern void DrawLevelUpWindowPg2(u16 arg0, void* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4); // pokenav.s extern u8 sub_813B21C(void); #define DEFENDER_IS_PROTECTED ((gProtectStructs[gBattlerTarget].protected) && (gBattleMoves[gCurrentMove].flags & FLAG_PROTECT_AFFECTED)) @@ -6321,16 +6321,16 @@ static void sub_804F100(void) { struct StatsArray currentStats; - sub_81D388C(&gPlayerParty[gBattleStruct->expGetterMonId], ¤tStats); - sub_81D3640(0xD, gBattleResources->statsBeforeLvlUp, ¤tStats, 0xE, 0xD, 0xF); + GetMonLevelUpWindowStats(&gPlayerParty[gBattleStruct->expGetterMonId], ¤tStats); + DrawLevelUpWindowPg1(0xD, gBattleResources->statsBeforeLvlUp, ¤tStats, 0xE, 0xD, 0xF); } static void sub_804F144(void) { struct StatsArray currentStats; - sub_81D388C(&gPlayerParty[gBattleStruct->expGetterMonId], ¤tStats); - sub_81D3784(0xD, ¤tStats, 0xE, 0xD, 0xF); + GetMonLevelUpWindowStats(&gPlayerParty[gBattleStruct->expGetterMonId], ¤tStats); + DrawLevelUpWindowPg2(0xD, ¤tStats, 0xE, 0xD, 0xF); } static void sub_804F17C(void) -- cgit v1.2.3 From 9848f84b9ec2d5950cb5dc4600b7651486ff986a Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Mon, 11 Mar 2019 03:12:15 -0400 Subject: Use constants for Oam .shape and .size fields Also some general formatting fixes for constants. --- 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 ac9fb3073..025d694e4 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -733,10 +733,10 @@ static const struct OamData sOamData_MonIconOnLvlUpBox = .objMode = 0, .mosaic = 0, .bpp = 0, - .shape = 0, + .shape = SPRITE_SHAPE(32x32), .x = 0, .matrixNum = 0, - .size = 2, + .size = SPRITE_SIZE(32x32), .tileNum = 0, .priority = 0, .paletteNum = 0, -- cgit v1.2.3 From 35cffea9874a8b135eddade958b62ee2ecf441c1 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 30 Mar 2019 12:37:18 +0100 Subject: Helpful macros for atk49 --- src/battle_script_commands.c | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) (limited to 'src/battle_script_commands.c') diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 0eb6dfec0..0a0c34ad2 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -4480,28 +4480,6 @@ static void atk48_playstatchangeanimation(void) } } -enum -{ - ATK49_RAGE, - ATK49_DEFROST, - ATK49_SYNCHRONIZE_TARGET, - ATK49_MOVE_END_ABILITIES, - ATK49_STATUS_IMMUNITY_ABILITIES, - ATK49_SYNCHRONIZE_ATTACKER, - ATK49_CHOICE_MOVE, - ATK49_CHANGED_ITEMS, - ATK49_ATTACKER_INVISIBLE, - ATK49_ATTACKER_VISIBLE, - ATK49_TARGET_VISIBLE, - ATK49_ITEM_EFFECTS_ALL, - ATK49_KINGSROCK_SHELLBELL, - ATK49_SUBSTITUTE, - ATK49_UPDATE_LAST_MOVES, - ATK49_MIRROR_MOVE, - ATK49_NEXT_TARGET, - ATK49_COUNT, -}; - static void atk49_moveend(void) { s32 i; @@ -7210,6 +7188,9 @@ static void atk88_negativedamage(void) gBattlescriptCurrInstr++; } +#define STAT_CHANGE_WORKED 0 +#define STAT_CHANGE_DIDNT_WORK 1 + static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr) { bool8 certain = FALSE; -- cgit v1.2.3 From 91a94a0ca1f2df00a776c85b40d76c193977d13a Mon Sep 17 00:00:00 2001 From: ultima-soul Date: Wed, 3 Apr 2019 21:13:26 -0700 Subject: Try to get closer to matching. --- src/battle_script_commands.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/battle_script_commands.c') diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 0a0c34ad2..d1d8d87ac 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -6295,16 +6295,16 @@ static void sub_804F100(void) { struct StatsArray currentStats; - GetMonLevelUpWindowStats(&gPlayerParty[gBattleStruct->expGetterMonId], ¤tStats); - DrawLevelUpWindowPg1(0xD, gBattleResources->statsBeforeLvlUp, ¤tStats, 0xE, 0xD, 0xF); + GetMonLevelUpWindowStats(&gPlayerParty[gBattleStruct->expGetterMonId], (u16*) ¤tStats); + DrawLevelUpWindowPg1(0xD, (u16*) gBattleResources->statsBeforeLvlUp,(u16*) ¤tStats, 0xE, 0xD, 0xF); } static void sub_804F144(void) { struct StatsArray currentStats; - GetMonLevelUpWindowStats(&gPlayerParty[gBattleStruct->expGetterMonId], ¤tStats); - DrawLevelUpWindowPg2(0xD, ¤tStats, 0xE, 0xD, 0xF); + GetMonLevelUpWindowStats(&gPlayerParty[gBattleStruct->expGetterMonId], (u16*) ¤tStats); + DrawLevelUpWindowPg2(0xD, (u16*) ¤tStats, 0xE, 0xD, 0xF); } static void sub_804F17C(void) -- cgit v1.2.3 From 704f025a00e32a910b6fd70a54511844e755663f Mon Sep 17 00:00:00 2001 From: AJ Fontaine <36677462+Fontbane@users.noreply.github.com> Date: Wed, 3 Apr 2019 10:36:50 -0400 Subject: Fix a typo in as(s)istattackselect --- src/battle_script_commands.c | 6 +++--- 1 file changed, 3 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 d1d8d87ac..2e78e1ca0 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -296,7 +296,7 @@ static void atkDA_tryswapabilities(void); static void atkDB_tryimprison(void); static void atkDC_trysetgrudge(void); static void atkDD_weightdamagecalculation(void); -static void atkDE_asistattackselect(void); +static void atkDE_assistattackselect(void); static void atkDF_trysetmagiccoat(void); static void atkE0_trysetsnatch(void); static void atkE1_trygetintimidatetarget(void); @@ -548,7 +548,7 @@ void (* const gBattleScriptingCommandsTable[])(void) = atkDB_tryimprison, atkDC_trysetgrudge, atkDD_weightdamagecalculation, - atkDE_asistattackselect, + atkDE_assistattackselect, atkDF_trysetmagiccoat, atkE0_trysetsnatch, atkE1_trygetintimidatetarget, @@ -9660,7 +9660,7 @@ static void atkDD_weightdamagecalculation(void) gBattlescriptCurrInstr++; } -static void atkDE_asistattackselect(void) +static void atkDE_assistattackselect(void) { s32 chooseableMovesNo = 0; struct Pokemon* party; -- 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