Finish up menu specialised

This commit is contained in:
DizzyEggg 2019-04-04 21:24:21 +02:00 committed by huderlem
parent 9e74409bb2
commit dd24597d52
7 changed files with 230 additions and 544 deletions

View File

@ -1,72 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
gUnknown_08625AD0:: @ 8625AD0
.2byte 0
.2byte 0x4000
.2byte 0
.2byte 0
gUnknown_08625AD8:: @ 8625AD8
.2byte 0
.2byte 5
.2byte 4
.2byte 5
gUnknown_08625AE0:: @ 8625AE0
.2byte 8
.2byte 5
.2byte 12
.2byte 5
gUnknown_08625AE8:: @ 8625AE8
.2byte 16
.2byte 5
.2byte 20
.2byte 5
gUnknown_08625AF0:: @ 8625AF0
.2byte 24
.2byte 5
.2byte 0xFFFF
.2byte 0
gUnknown_08625AF8:: @ 8625AF8
.4byte gUnknown_08625AD8
.4byte gUnknown_08625AE0
gUnknown_08625B00:: @ 8625B00
.4byte gUnknown_08625AE8
.4byte gUnknown_08625AF0
gUnknown_08625B08:: @ 8625B08
.4byte gUnknown_08625AF8
.4byte gUnknown_08625B00
.4byte gUnknown_08625B08
gUnknown_08625B14:: @ 8625B14
spr_template 0x68, 0x68, gUnknown_08625AD0, gUnknown_08625AF8, NULL gDummySpriteAffineAnimTable, sub_81D3564
gUnknown_08625B2C:: @ 8625B2C
.2byte 0, 0xFFDD
.2byte 20, 0xFFE4
.2byte 33, 0xFFF6
.2byte 33, 10
.2byte 20, 28
.2byte 0, 35
.2byte 0xFFEC, 28
.2byte 0xFFDF, 10
.2byte 0xFFDF, 0xFFF6
.2byte 0xFFEC, 0xFFE4
gUnknown_08625B54:: @ 8625B54
.4byte gUnknown_085EEA46
.4byte gUnknown_085EEA4E
.4byte gUnknown_085EEA55
.4byte gUnknown_085EEA63
.4byte gUnknown_085EEA6B
.4byte gUnknown_085EEA5D

View File

@ -276,12 +276,7 @@ struct BattleCallbacksStack
struct StatsArray struct StatsArray
{ {
u16 hp; u16 stats[NUM_STATS];
u16 atk;
u16 def;
u16 spd;
u16 spAtk;
u16 spDef;
}; };
struct BattleResources struct BattleResources
@ -290,7 +285,7 @@ struct BattleResources
struct UnknownFlags *flags; struct UnknownFlags *flags;
struct BattleScriptsStack* battleScriptsStack; struct BattleScriptsStack* battleScriptsStack;
struct BattleCallbacksStack* battleCallbackStack; struct BattleCallbacksStack* battleCallbackStack;
struct StatsArray* statsBeforeLvlUp; struct StatsArray* beforeLvlUp;
struct AI_ThinkingStruct *ai; struct AI_ThinkingStruct *ai;
struct BattleHistory *battleHistory; struct BattleHistory *battleHistory;
struct BattleScriptsStack *AI_ScriptsStack; struct BattleScriptsStack *AI_ScriptsStack;

View File

@ -32,8 +32,6 @@ u8 sub_81D1DC0(struct PlayerPCItemPageStruct *page);
void sub_81D1E90(struct PlayerPCItemPageStruct *page); void sub_81D1E90(struct PlayerPCItemPageStruct *page);
void sub_81D1EC0(void); void sub_81D1EC0(void);
void sub_81D1D04(u8 a0); void sub_81D1D04(u8 a0);
void DrawLevelUpWindowPg1(u16 arg0, u16 *statStoreLocation1, u16 *statStoreLocation2, u8 arg3, u8 arg4, u8 arg5);
void DrawLevelUpWindowPg2(u16 arg0, u16 *statStoreLocation1, u8 arg2, u8 arg3, u8 arg4);
void sub_81D1ED4(struct UnknownStruct_81D1ED4 *a0); void sub_81D1ED4(struct UnknownStruct_81D1ED4 *a0);
void sub_81D2108(struct UnknownStruct_81D1ED4 *arg0); void sub_81D2108(struct UnknownStruct_81D1ED4 *arg0);
void sub_81D20AC(struct UnknownStruct_81D1ED4 *arg0); void sub_81D20AC(struct UnknownStruct_81D1ED4 *arg0);
@ -47,7 +45,6 @@ bool16 MoveRelearnerRunTextPrinters(void);
void MoveRelearnerCreateYesNoMenu(void); void MoveRelearnerCreateYesNoMenu(void);
u8 LoadMoveRelearnerMovesList(const struct ListMenuItem *items, u16 numChoices); u8 LoadMoveRelearnerMovesList(const struct ListMenuItem *items, u16 numChoices);
void InitMoveRelearnerWindows(bool8 useContextWindow); void InitMoveRelearnerWindows(bool8 useContextWindow);
void GetMonLevelUpWindowStats(struct Pokemon *mon, u16 *statStoreLocation);
s32 GetBoxOrPartyMonData(u16 boxId, u16 monId, s32 request, u8 *dst); s32 GetBoxOrPartyMonData(u16 boxId, u16 monId, s32 request, u8 *dst);
void sub_81D2ED4(u8 *dst, u8 *nameDst, u16 boxId, u16 monId, u16 arg5, u16 arg6, bool8 arg7); void sub_81D2ED4(u8 *dst, u8 *nameDst, u16 boxId, u16 monId, u16 arg5, u16 arg6, bool8 arg7);
void sub_81D2F78(struct UnknownStruct_81D1ED4 *arg0, u8 *sheen, u16 boxId, u16 monId, u16 arg5, u16 id, u16 arg7, bool8 arg8); void sub_81D2F78(struct UnknownStruct_81D1ED4 *arg0, u8 *sheen, u16 boxId, u16 monId, u16 arg5, u16 id, u16 arg7, bool8 arg8);
@ -63,5 +60,8 @@ void sub_81D3464(struct Sprite **sprites);
void sub_81D3480(struct Sprite **sprites, u8 arg1, u8 arg2); void sub_81D3480(struct Sprite **sprites, u8 arg1, u8 arg2);
void sub_81D3520(struct Sprite **sprites); void sub_81D3520(struct Sprite **sprites);
void sub_81D354C(struct Sprite **sprites); void sub_81D354C(struct Sprite **sprites);
void DrawLevelUpWindowPg1(u16 windowId, u16 *statsBefore, u16 *statsAfter, u8 bgClr, u8 fgClr, u8 shadowClr);
void DrawLevelUpWindowPg2(u16 windowId, u16 *currStats, u8 bgClr, u8 fgClr, u8 shadowClr);
void GetMonLevelUpWindowStats(struct Pokemon *mon, u16 *currStats);
#endif // GUARD_MENU_SPECIALIZED_H #endif // GUARD_MENU_SPECIALIZED_H

View File

@ -471,6 +471,12 @@ extern const u8 gText_EggCantBattle[];
extern const u8 gText_PkmnAlreadySelected[]; extern const u8 gText_PkmnAlreadySelected[];
extern const u8 gText_PkmnAlreadyInBattle[]; extern const u8 gText_PkmnAlreadyInBattle[];
extern const u8 gText_PkmnCantSwitchOut[]; extern const u8 gText_PkmnCantSwitchOut[];
extern const u8 gUnknown_085EEA46[];
extern const u8 gUnknown_085EEA4E[];
extern const u8 gUnknown_085EEA55[];
extern const u8 gUnknown_085EEA63[];
extern const u8 gUnknown_085EEA6B[];
extern const u8 gUnknown_085EEA5D[];
extern const u8 gText_Dash[]; extern const u8 gText_Dash[];
extern const u8 gText_UnkCtrlF904[]; extern const u8 gText_UnkCtrlF904[];

View File

@ -621,7 +621,6 @@ SECTIONS {
data/pokenav.o(.rodata); data/pokenav.o(.rodata);
src/pokenav_match_call.o(.rodata); src/pokenav_match_call.o(.rodata);
src/menu_specialized.o(.rodata); src/menu_specialized.o(.rodata);
data/menu_specialized.o(.rodata);
data/ereader_helpers.o(.rodata); data/ereader_helpers.o(.rodata);
src/faraway_island.o(.rodata); src/faraway_island.o(.rodata);
data/ereader_screen.o(.rodata); data/ereader_screen.o(.rodata);

View File

@ -66,8 +66,8 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8, const u8* BS_ptr);
static bool32 IsMonGettingExpSentOut(void); static bool32 IsMonGettingExpSentOut(void);
static void sub_804F17C(void); static void sub_804F17C(void);
static bool8 sub_804F1CC(void); static bool8 sub_804F1CC(void);
static void sub_804F100(void); static void DrawLevelUpWindow1(void);
static void sub_804F144(void); static void DrawLevelUpWindow2(void);
static bool8 sub_804F344(void); static bool8 sub_804F344(void);
static void PutMonIconOnLvlUpBox(void); static void PutMonIconOnLvlUpBox(void);
static void PutLevelAndGenderOnLvlUpBox(void); static void PutLevelAndGenderOnLvlUpBox(void);
@ -3238,7 +3238,6 @@ static void atk23_getexp(void)
s32 i; // also used as stringId s32 i; // also used as stringId
u8 holdEffect; u8 holdEffect;
s32 sentIn; s32 sentIn;
s32 viaExpShare = 0; s32 viaExpShare = 0;
u16 *exp = &gBattleStruct->expValue; u16 *exp = &gBattleStruct->expValue;
@ -3391,14 +3390,14 @@ static void atk23_getexp(void)
} }
} }
else else
{
gBattleStruct->expGetterBattlerId = 0; 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' // buffer 'gained' or 'gained a boosted'
PREPARE_STRING_BUFFER(gBattleTextBuff2, i) PREPARE_STRING_BUFFER(gBattleTextBuff2, i);
PREPARE_WORD_NUMBER_BUFFER(gBattleTextBuff3, 5, gBattleMoveDamage);
PREPARE_WORD_NUMBER_BUFFER(gBattleTextBuff3, 5, gBattleMoveDamage)
PrepareStringBattle(STRINGID_PKMNGAINEDEXP, gBattleStruct->expGetterBattlerId); PrepareStringBattle(STRINGID_PKMNGAINEDEXP, gBattleStruct->expGetterBattlerId);
MonGainEVs(&gPlayerParty[gBattleStruct->expGetterMonId], gBattleMons[gBattlerFainted].species); MonGainEVs(&gPlayerParty[gBattleStruct->expGetterMonId], gBattleMons[gBattlerFainted].species);
@ -3414,12 +3413,12 @@ static void atk23_getexp(void)
gBattleBufferB[gBattleStruct->expGetterBattlerId][0] = 0; gBattleBufferB[gBattleStruct->expGetterBattlerId][0] = 0;
if (GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_HP) && GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL) != MAX_LEVEL) 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->beforeLvlUp->stats[STAT_HP] = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_MAX_HP);
gBattleResources->statsBeforeLvlUp->atk = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_ATK); gBattleResources->beforeLvlUp->stats[STAT_ATK] = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_ATK);
gBattleResources->statsBeforeLvlUp->def = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_DEF); gBattleResources->beforeLvlUp->stats[STAT_DEF] = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_DEF);
gBattleResources->statsBeforeLvlUp->spd = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPEED); gBattleResources->beforeLvlUp->stats[STAT_SPEED] = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPEED);
gBattleResources->statsBeforeLvlUp->spAtk = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPATK); gBattleResources->beforeLvlUp->stats[STAT_SPATK] = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPATK);
gBattleResources->statsBeforeLvlUp->spDef = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPDEF); gBattleResources->beforeLvlUp->stats[STAT_SPDEF] = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPDEF);
gActiveBattler = gBattleStruct->expGetterBattlerId; gActiveBattler = gBattleStruct->expGetterBattlerId;
BtlController_EmitExpUpdate(0, gBattleStruct->expGetterMonId, gBattleMoveDamage); BtlController_EmitExpUpdate(0, gBattleStruct->expGetterMonId, gBattleMoveDamage);
@ -3437,9 +3436,8 @@ static void atk23_getexp(void)
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gBattlerPartyIndexes[gActiveBattler] == gBattleStruct->expGetterMonId) if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gBattlerPartyIndexes[gActiveBattler] == gBattleStruct->expGetterMonId)
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gActiveBattler, gBattleStruct->expGetterMonId) PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gActiveBattler, gBattleStruct->expGetterMonId);
PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff2, 3, GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL));
PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff2, 3, GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL))
BattleScriptPushCursor(); BattleScriptPushCursor();
gLeveledUpInBattle |= gBitTable[gBattleStruct->expGetterMonId]; gLeveledUpInBattle |= gBitTable[gBattleStruct->expGetterMonId];
@ -3487,7 +3485,9 @@ static void atk23_getexp(void)
break; break;
case 5: // looper increment case 5: // looper increment
if (gBattleMoveDamage) // there is exp to give, goto case 3 that gives exp if (gBattleMoveDamage) // there is exp to give, goto case 3 that gives exp
{
gBattleScripting.atk23_state = 3; gBattleScripting.atk23_state = 3;
}
else else
{ {
gBattleStruct->expGetterMonId++; gBattleStruct->expGetterMonId++;
@ -5911,8 +5911,7 @@ static void atk5D_getmoneyreward(void)
moneyReward += GetTrainerMoneyToGive(gTrainerBattleOpponent_B); moneyReward += GetTrainerMoneyToGive(gTrainerBattleOpponent_B);
AddMoney(&gSaveBlock1Ptr->money, moneyReward); AddMoney(&gSaveBlock1Ptr->money, moneyReward);
PREPARE_WORD_NUMBER_BUFFER(gBattleTextBuff1, 5, moneyReward);
PREPARE_WORD_NUMBER_BUFFER(gBattleTextBuff1, 5, moneyReward)
gBattlescriptCurrInstr++; gBattlescriptCurrInstr++;
} }
@ -6233,7 +6232,7 @@ static void atk6C_drawlvlupbox(void)
gBattleScripting.atk6C_state = 4; gBattleScripting.atk6C_state = 4;
break; break;
case 4: case 4:
sub_804F100(); DrawLevelUpWindow1();
PutWindowTilemap(13); PutWindowTilemap(13);
CopyWindowToVram(13, 3); CopyWindowToVram(13, 3);
gBattleScripting.atk6C_state++; gBattleScripting.atk6C_state++;
@ -6250,7 +6249,7 @@ static void atk6C_drawlvlupbox(void)
if (gMain.newKeys != 0) if (gMain.newKeys != 0)
{ {
PlaySE(SE_SELECT); PlaySE(SE_SELECT);
sub_804F144(); DrawLevelUpWindow2();
CopyWindowToVram(13, 2); CopyWindowToVram(13, 2);
gBattleScripting.atk6C_state++; 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*) &currentStats); GetMonLevelUpWindowStats(&gPlayerParty[gBattleStruct->expGetterMonId], currStats);
DrawLevelUpWindowPg1(0xD, (u16*) gBattleResources->statsBeforeLvlUp,(u16*) &currentStats, 0xE, 0xD, 0xF); 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*) &currentStats); GetMonLevelUpWindowStats(&gPlayerParty[gBattleStruct->expGetterMonId], currStats);
DrawLevelUpWindowPg2(0xD, (u16*) &currentStats, 0xE, 0xD, 0xF); DrawLevelUpWindowPg2(0xD, currStats, 0xE, 0xD, 0xF);
} }
static void sub_804F17C(void) static void sub_804F17C(void)

View File

@ -28,7 +28,6 @@
#include "gba/io_reg.h" #include "gba/io_reg.h"
extern const struct CompressedSpriteSheet gMonFrontPicTable[]; extern const struct CompressedSpriteSheet gMonFrontPicTable[];
extern const u8 *gUnknown_08625B54[];
EWRAM_DATA static u8 sUnknown_0203CF48[3] = {0}; EWRAM_DATA static u8 sUnknown_0203CF48[3] = {0};
EWRAM_DATA static struct ListMenuItem *sUnknown_0203CF4C = NULL; EWRAM_DATA static struct ListMenuItem *sUnknown_0203CF4C = NULL;
@ -39,7 +38,7 @@ static void sub_81D2634(struct UnknownStruct_81D1ED4 *a0);
static void MoveRelearnerCursorCallback(s32 itemIndex, bool8 onInit, struct ListMenu *list); static void MoveRelearnerCursorCallback(s32 itemIndex, bool8 onInit, struct ListMenu *list);
static void nullsub_79(void); static void nullsub_79(void);
static void sub_81D3408(struct Sprite *sprite); static void sub_81D3408(struct Sprite *sprite);
/*static*/ void sub_81D3564(struct Sprite *sprite); static void sub_81D3564(struct Sprite *sprite);
static void sub_81D35E8(struct Sprite *sprite); static void sub_81D35E8(struct Sprite *sprite);
static const struct WindowTemplate sUnknown_086253E8[] = static const struct WindowTemplate sUnknown_086253E8[] =
@ -1474,9 +1473,82 @@ static void sub_81D32F4(struct Sprite *sprite)
} }
} }
// Todo: Move these variables to C. static const struct OamData sOamData_8625AD0 =
extern const s16 gUnknown_08625B2C[][2]; {
extern const struct SpriteTemplate gUnknown_08625B14; .y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 0,
.x = 0,
.matrixNum = 0,
.size = 1,
.tileNum = 0,
.priority = 0,
.paletteNum = 0,
.affineParam = 0
};
static const union AnimCmd sSpriteAnim_8625AD8[] =
{
ANIMCMD_FRAME(0, 5),
ANIMCMD_FRAME(4, 5),
ANIMCMD_FRAME(8, 5),
ANIMCMD_FRAME(12, 5),
ANIMCMD_FRAME(16, 5),
ANIMCMD_FRAME(20, 5),
ANIMCMD_FRAME(24, 5),
ANIMCMD_END
};
static const union AnimCmd *const sSpriteAnimTable_8625AF8[] =
{
sSpriteAnim_8625AD8,
sSpriteAnim_8625AD8 + 2,
};
// unused
static const union AnimCmd *const sSpriteAnimTable_8625B00[] =
{
sSpriteAnim_8625AD8 + 4,
sSpriteAnim_8625AD8 + 6,
};
// unused
static const union AnimCmd *const sSpriteAnimTable_8625B08[] =
{
sSpriteAnim_8625AD8 + 8,
sSpriteAnim_8625AD8 + 10,
};
// unused
static const union AnimCmd *const *const sUnknown_08625B10 = sSpriteAnimTable_8625B08;
const struct SpriteTemplate gUnknown_08625B14 =
{
.tileTag = 104,
.paletteTag = 104,
.oam = &sOamData_8625AD0,
.anims = sSpriteAnimTable_8625AF8,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_81D3564,
};
static const s16 gUnknown_08625B2C[][2] =
{
{0, -35},
{20, -28},
{33, -10},
{33, 10},
{20, 28},
{0, 35},
{-20, 28},
{-33, 10},
{-33, -10},
{-20, -28},
};
void sub_81D3314(struct Sprite *sprite) void sub_81D3314(struct Sprite *sprite)
{ {
@ -1595,7 +1667,7 @@ void sub_81D354C(struct Sprite **sprites)
FreeSpritePaletteByTag(104); FreeSpritePaletteByTag(104);
} }
/*static*/ void sub_81D3564(struct Sprite *sprite) static void sub_81D3564(struct Sprite *sprite)
{ {
if (sprite->data[1] != 0) if (sprite->data[1] != 0)
{ {
@ -1641,440 +1713,127 @@ static void sub_81D35E8(struct Sprite *sprite)
} }
} }
static const u8 *const sLvlUpStatStrings[] =
#ifdef NONMATCHING
void DrawLevelUpWindowPg1(u16 arg0, u16 *statStoreLocation1, u16 *statStoreLocation2, u8 arg3, u8 arg4, u8 arg5)
{ {
u16 i; gUnknown_085EEA46,
s16 array[6]; gUnknown_085EEA4E,
u8 *text; gUnknown_085EEA55,
u8 text2; gUnknown_085EEA63,
s16 *statVal; gUnknown_085EEA6B,
s32 var; gUnknown_085EEA5D
u8 padding; };
s32 var3;
u8 color[11];
FillWindowPixelBuffer(arg0, PIXEL_FILL(arg3)); void DrawLevelUpWindowPg1(u16 windowId, u16 *statsBefore, u16 *statsAfter, u8 bgClr, u8 fgClr, u8 shadowClr)
array[0] = statStoreLocation2[STAT_HP] - statStoreLocation1[STAT_HP];
array[1] = statStoreLocation2[STAT_ATK] - statStoreLocation1[STAT_ATK];
array[2] = statStoreLocation2[STAT_DEF] - statStoreLocation1[STAT_DEF];
array[3] = statStoreLocation2[STAT_SPATK] - statStoreLocation1[STAT_SPATK];
array[4] = statStoreLocation2[STAT_SPDEF] - statStoreLocation1[STAT_SPDEF];
array[5] = statStoreLocation2[STAT_SPEED] - statStoreLocation1[STAT_SPEED];
color[0] = arg3;
color[1] = arg4;
color[2] = arg5;
for(i = 0; i <= 5; i++)
{ {
AddTextPrinterParameterized3(arg0, u16 i, x;
s16 statsDiff[NUM_STATS];
u8 text[12];
u8 color[3];
FillWindowPixelBuffer(windowId, PIXEL_FILL(bgClr));
statsDiff[0] = statsAfter[STAT_HP] - statsBefore[STAT_HP];
statsDiff[1] = statsAfter[STAT_ATK] - statsBefore[STAT_ATK];
statsDiff[2] = statsAfter[STAT_DEF] - statsBefore[STAT_DEF];
statsDiff[3] = statsAfter[STAT_SPATK] - statsBefore[STAT_SPATK];
statsDiff[4] = statsAfter[STAT_SPDEF] - statsBefore[STAT_SPDEF];
statsDiff[5] = statsAfter[STAT_SPEED] - statsBefore[STAT_SPEED];
color[0] = bgClr;
color[1] = fgClr;
color[2] = shadowClr;
for (i = 0; i < NUM_STATS; i++)
{
AddTextPrinterParameterized3(windowId,
1, 1,
0, 0,
15 * i, 15 * i,
color, color,
TEXT_SPEED_FF, -1,
gUnknown_08625B54[i]); sLvlUpStatStrings[i]);
statVal = &array[i];
text = array[i] >= 0 ? (u8 *) gText_UnkCtrlF904 : (u8 *) gText_Dash;//Plus sign for stat gain, dash for none maybe StringCopy(text, (statsDiff[i] >= 0) ? gText_UnkCtrlF904 : gText_Dash);
StringCopy(&text2, text); AddTextPrinterParameterized3(windowId,
AddTextPrinterParameterized3(arg0,
1, 1,
56, 56,
15 * i, 15 * i,
color, color,
TEXT_SPEED_FF, -1,
&text2); text);
var3 = *statVal; if (abs(statsDiff[i]) <= 9)
var = var3; x = 18;
else
x = 12;
if(var3 < 0) ConvertIntToDecimalStringN(text, abs(statsDiff[i]), STR_CONV_MODE_LEFT_ALIGN, 2);
{ AddTextPrinterParameterized3(windowId,
var = -var3;
}
padding = 12; //amount of padding
if(var <= 9)
{
padding = 18; //more padding for single digit numbers
}
if(var3 < 0)
{
var3 = -var3;
}
ConvertIntToDecimalStringN(&text2, var3, STR_CONV_MODE_LEFT_ALIGN, 2);
AddTextPrinterParameterized3(arg0,
1, 1,
padding + 56, 56 + x,
15 * i, 15 * i,
color, color,
TEXT_SPEED_FF, -1,
&text2); text);
} }
} }
#else
NAKED
void DrawLevelUpWindowPg1(u16 arg0, u16 *statStoreLocation1, u16 *statStoreLocation2, u8 arg3, u8 arg4, u8 arg5)
{
asm(".syntax unified\n\
push {r4-r7,lr}\n\
mov r7, r10\n\
mov r6, r9\n\
mov r5, r8\n\
push {r5-r7}\n\
sub sp, 0x2C\n\
mov r8, r0\n\
adds r6, r1, 0\n\
adds r5, r2, 0\n\
adds r4, r3, 0\n\
ldr r3, [sp, 0x4C]\n\
ldr r0, [sp, 0x50]\n\
mov r9, r0\n\
lsls r4, 24\n\
lsrs r4, 24\n\
lsls r3, 24\n\
lsrs r3, 24\n\
mov r1, r9\n\
lsls r1, 24\n\
lsrs r1, 24\n\
mov r9, r1\n\
mov r0, r8\n\
lsls r0, 24\n\
lsrs r0, 24\n\
mov r8, r0\n\
lsls r1, r4, 4\n\
orrs r1, r4\n\
lsls r1, 24\n\
lsrs r1, 24\n\
str r3, [sp, 0x28]\n\
bl FillWindowPixelBuffer\n\
add r2, sp, 0xC\n\
ldrh r0, [r5]\n\
ldrh r1, [r6]\n\
subs r0, r1\n\
strh r0, [r2]\n\
ldrh r0, [r5, 0x2]\n\
ldrh r1, [r6, 0x2]\n\
subs r0, r1\n\
strh r0, [r2, 0x2]\n\
ldrh r0, [r5, 0x4]\n\
ldrh r1, [r6, 0x4]\n\
subs r0, r1\n\
strh r0, [r2, 0x4]\n\
ldrh r0, [r5, 0x8]\n\
ldrh r1, [r6, 0x8]\n\
subs r0, r1\n\
strh r0, [r2, 0x6]\n\
ldrh r0, [r5, 0xA]\n\
ldrh r1, [r6, 0xA]\n\
subs r0, r1\n\
strh r0, [r2, 0x8]\n\
ldrh r0, [r5, 0x6]\n\
ldrh r1, [r6, 0x6]\n\
subs r0, r1\n\
strh r0, [r2, 0xA]\n\
add r0, sp, 0x24\n\
strb r4, [r0]\n\
ldr r3, [sp, 0x28]\n\
strb r3, [r0, 0x1]\n\
mov r1, r9\n\
strb r1, [r0, 0x2]\n\
movs r7, 0\n\
mov r10, r0\n\
movs r0, 0x1\n\
negs r0, r0\n\
mov r9, r0\n\
add r6, sp, 0x18\n\
_081D36CA:\n\
lsls r0, r7, 4\n\
subs r0, r7\n\
lsls r0, 24\n\
lsrs r5, r0, 24\n\
mov r1, r10\n\
str r1, [sp]\n\
mov r0, r9\n\
str r0, [sp, 0x4]\n\
ldr r1, =gUnknown_08625B54\n\
lsls r0, r7, 2\n\
adds r0, r1\n\
ldr r0, [r0]\n\
str r0, [sp, 0x8]\n\
mov r0, r8\n\
movs r1, 0x1\n\
movs r2, 0\n\
adds r3, r5, 0\n\
bl AddTextPrinterParameterized3\n\
lsls r0, r7, 1\n\
mov r4, sp\n\
adds r4, r0\n\
adds r4, 0xC\n\
movs r1, 0\n\
ldrsh r0, [r4, r1]\n\
ldr r1, =gText_Dash\n\
cmp r0, 0\n\
blt _081D3704\n\
ldr r1, =gText_UnkCtrlF904\n\
_081D3704:\n\
adds r0, r6, 0\n\
bl StringCopy\n\
mov r0, r10\n\
str r0, [sp]\n\
mov r1, r9\n\
str r1, [sp, 0x4]\n\
str r6, [sp, 0x8]\n\
mov r0, r8\n\
movs r1, 0x1\n\
movs r2, 0x38\n\
adds r3, r5, 0\n\
bl AddTextPrinterParameterized3\n\
movs r0, 0\n\
ldrsh r1, [r4, r0]\n\
adds r0, r1, 0\n\
cmp r1, 0\n\
bge _081D372C\n\
negs r0, r1\n\
_081D372C:\n\
movs r4, 0xC\n\
cmp r0, 0x9\n\
bgt _081D3734\n\
movs r4, 0x12\n\
_081D3734:\n\
cmp r1, 0\n\
bge _081D373A\n\
negs r1, r1\n\
_081D373A:\n\
adds r0, r6, 0\n\
movs r2, 0\n\
movs r3, 0x2\n\
bl ConvertIntToDecimalStringN\n\
adds r2, r4, 0\n\
adds r2, 0x38\n\
mov r1, r10\n\
str r1, [sp]\n\
mov r0, r9\n\
str r0, [sp, 0x4]\n\
str r6, [sp, 0x8]\n\
mov r0, r8\n\
movs r1, 0x1\n\
adds r3, r5, 0\n\
bl AddTextPrinterParameterized3\n\
adds r0, r7, 0x1\n\
lsls r0, 16\n\
lsrs r7, r0, 16\n\
cmp r7, 0x5\n\
bls _081D36CA\n\
add sp, 0x2C\n\
pop {r3-r5}\n\
mov r8, r3\n\
mov r9, r4\n\
mov r10, r5\n\
pop {r4-r7}\n\
pop {r0}\n\
bx r0\n\
.pool\n\
.syntax divided");
}
#endif // NONMATCHING
#ifdef NONMATCHING void DrawLevelUpWindowPg2(u16 windowId, u16 *currStats, u8 bgClr, u8 fgClr, u8 shadowClr)
void DrawLevelUpWindowPg2(u16 arg0, u16 *statStoreLocation1, u8 arg2, u8 arg3, u8 arg4)
{ {
s32 i; u16 i, numDigits, x;
s16 *var; s16 stats[NUM_STATS];
s32 numDigits; u8 text[12];
u8 text; u8 color[3];
s16 array[6];
u8 color[11];
FillWindowPixelBuffer(arg0, PIXEL_FILL(arg2)); FillWindowPixelBuffer(windowId, PIXEL_FILL(bgClr));
array[0] = statStoreLocation1[STAT_HP]; stats[0] = currStats[STAT_HP];
array[1] = statStoreLocation1[STAT_ATK]; stats[1] = currStats[STAT_ATK];
array[2] = statStoreLocation1[STAT_DEF]; stats[2] = currStats[STAT_DEF];
array[3] = statStoreLocation1[STAT_SPATK]; stats[3] = currStats[STAT_SPATK];
array[4] = statStoreLocation1[STAT_SPDEF]; stats[4] = currStats[STAT_SPDEF];
array[5] = statStoreLocation1[STAT_SPEED]; stats[5] = currStats[STAT_SPEED];
color[0] = arg2; color[0] = bgClr;
color[1] = arg3; color[1] = fgClr;
color[2] = arg4; color[2] = shadowClr;
for(i = 0; i <= 5; i++) for (i = 0; i < NUM_STATS; i++)
{ {
numDigits = 3; //3 digit stat if (stats[i] > 99)
if(array[i] <= 99) numDigits = 3;
{ else if (stats[i] > 9)
numDigits = 1; //1 digit stat numDigits = 2;
if(array[i] > 9) else
{ numDigits = 1;
numDigits = 2; //2 digit stat
} ConvertIntToDecimalStringN(text, stats[i], STR_CONV_MODE_LEFT_ALIGN, numDigits);
} x = 6 * (4 - numDigits);
ConvertIntToDecimalStringN(&text, array[i], STR_CONV_MODE_LEFT_ALIGN, numDigits);
AddTextPrinterParameterized3(arg0, AddTextPrinterParameterized3(windowId,
1, 1,
0, 0,
15 * i, 15 * i,
color, color,
TEXT_SPEED_FF, -1,
gUnknown_08625B54[i]); sLvlUpStatStrings[i]);
AddTextPrinterParameterized3(arg0,
AddTextPrinterParameterized3(windowId,
1, 1,
6 * (4 - numDigits) + 56, 56 + x,
15 * i, 15 * i,
color, color,
TEXT_SPEED_FF, -1,
&text); text);
} }
} }
#else
NAKED
void DrawLevelUpWindowPg2(u16 arg0, u16 *statStoreLocation1, u8 arg2, u8 arg3, u8 arg4)
{
asm(".syntax unified\n\
push {r4-r7,lr}\n\
mov r7, r10\n\
mov r6, r9\n\
mov r5, r8\n\
push {r5-r7}\n\
sub sp, 0x2C\n\
mov r8, r0\n\
adds r5, r1, 0\n\
adds r4, r2, 0\n\
adds r6, r3, 0\n\
ldr r2, [sp, 0x4C]\n\
lsls r4, 24\n\
lsrs r4, 24\n\
lsls r6, 24\n\
lsrs r6, 24\n\
lsls r2, 24\n\
lsrs r2, 24\n\
lsls r0, 24\n\
lsrs r0, 24\n\
mov r8, r0\n\
lsls r1, r4, 4\n\
orrs r1, r4\n\
lsls r1, 24\n\
lsrs r1, 24\n\
str r2, [sp, 0x28]\n\
bl FillWindowPixelBuffer\n\
add r1, sp, 0xC\n\
ldrh r0, [r5]\n\
strh r0, [r1]\n\
ldrh r0, [r5, 0x2]\n\
strh r0, [r1, 0x2]\n\
ldrh r0, [r5, 0x4]\n\
strh r0, [r1, 0x4]\n\
ldrh r0, [r5, 0x8]\n\
strh r0, [r1, 0x6]\n\
ldrh r0, [r5, 0xA]\n\
strh r0, [r1, 0x8]\n\
ldrh r0, [r5, 0x6]\n\
strh r0, [r1, 0xA]\n\
add r0, sp, 0x24\n\
strb r4, [r0]\n\
strb r6, [r0, 0x1]\n\
ldr r2, [sp, 0x28]\n\
strb r2, [r0, 0x2]\n\
movs r6, 0\n\
add r1, sp, 0x18\n\
mov r9, r1\n\
mov r7, r8\n\
mov r10, r0\n\
movs r2, 0x1\n\
negs r2, r2\n\
mov r8, r2\n\
_081D37EE:\n\
lsls r1, r6, 1\n\
mov r0, sp\n\
adds r0, r1\n\
adds r0, 0xC\n\
movs r2, 0\n\
ldrsh r0, [r0, r2]\n\
movs r4, 0x3\n\
cmp r0, 0x63\n\
bgt _081D3808\n\
movs r4, 0x1\n\
cmp r0, 0x9\n\
ble _081D3808\n\
movs r4, 0x2\n\
_081D3808:\n\
mov r0, sp\n\
adds r0, r1\n\
adds r0, 0xC\n\
movs r2, 0\n\
ldrsh r1, [r0, r2]\n\
mov r0, r9\n\
movs r2, 0\n\
adds r3, r4, 0\n\
bl ConvertIntToDecimalStringN\n\
movs r0, 0x4\n\
subs r0, r4\n\
lsls r4, r0, 1\n\
adds r4, r0\n\
lsls r4, 17\n\
lsrs r4, 16\n\
lsls r5, r6, 4\n\
subs r5, r6\n\
lsls r5, 24\n\
lsrs r5, 24\n\
mov r0, r10\n\
str r0, [sp]\n\
mov r1, r8\n\
str r1, [sp, 0x4]\n\
ldr r1, =gUnknown_08625B54\n\
lsls r0, r6, 2\n\
adds r0, r1\n\
ldr r0, [r0]\n\
str r0, [sp, 0x8]\n\
adds r0, r7, 0\n\
movs r1, 0x1\n\
movs r2, 0\n\
adds r3, r5, 0\n\
bl AddTextPrinterParameterized3\n\
adds r4, 0x38\n\
lsls r4, 24\n\
lsrs r4, 24\n\
mov r2, r10\n\
str r2, [sp]\n\
mov r0, r8\n\
str r0, [sp, 0x4]\n\
mov r1, r9\n\
str r1, [sp, 0x8]\n\
adds r0, r7, 0\n\
movs r1, 0x1\n\
adds r2, r4, 0\n\
adds r3, r5, 0\n\
bl AddTextPrinterParameterized3\n\
adds r0, r6, 0x1\n\
lsls r0, 16\n\
lsrs r6, r0, 16\n\
cmp r6, 0x5\n\
bls _081D37EE\n\
add sp, 0x2C\n\
pop {r3-r5}\n\
mov r8, r3\n\
mov r9, r4\n\
mov r10, r5\n\
pop {r4-r7}\n\
pop {r0}\n\
bx r0\n\
.pool\n\
.syntax divided");
}
#endif // NONMATCHING
void GetMonLevelUpWindowStats(struct Pokemon *mon, u16 *statStoreLocation) void GetMonLevelUpWindowStats(struct Pokemon *mon, u16 *currStats)
{ {
statStoreLocation[STAT_HP] = GetMonData(mon, MON_DATA_MAX_HP); currStats[STAT_HP] = GetMonData(mon, MON_DATA_MAX_HP);
statStoreLocation[STAT_ATK] = GetMonData(mon, MON_DATA_ATK); currStats[STAT_ATK] = GetMonData(mon, MON_DATA_ATK);
statStoreLocation[STAT_DEF] = GetMonData(mon, MON_DATA_DEF); currStats[STAT_DEF] = GetMonData(mon, MON_DATA_DEF);
statStoreLocation[STAT_SPEED] = GetMonData(mon, MON_DATA_SPEED); currStats[STAT_SPEED] = GetMonData(mon, MON_DATA_SPEED);
statStoreLocation[STAT_SPATK] = GetMonData(mon, MON_DATA_SPATK); currStats[STAT_SPATK] = GetMonData(mon, MON_DATA_SPATK);
statStoreLocation[STAT_SPDEF] = GetMonData(mon, MON_DATA_SPDEF); currStats[STAT_SPDEF] = GetMonData(mon, MON_DATA_SPDEF);
} }