Merge branch 'master' of https://github.com/pret/pokeemerald into decompile_pokedex
This commit is contained in:
+257
-262
File diff suppressed because it is too large
Load Diff
@@ -9,10 +9,6 @@
|
||||
#include "util.h"
|
||||
#include "constants/items.h"
|
||||
|
||||
extern const struct BattleMove gBattleMoves[];
|
||||
extern const u8 gTypeEffectiveness[];
|
||||
extern const u8 * const gItemEffectTable[]; // todo: fix once struct is declared
|
||||
|
||||
// this file's functions
|
||||
static bool8 HasSuperEffectiveMoveAgainstOpponents(bool8 noRng);
|
||||
static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent);
|
||||
|
||||
+110
-114
@@ -19,10 +19,6 @@
|
||||
// sprites start at 10000 and thus must be subtracted of 10000 to account for the true index.
|
||||
#define GET_TRUE_SPRITE_INDEX(i) ((i - 10000))
|
||||
|
||||
#define SCRIPT_READ_16(ptr) ((ptr)[0] | ((ptr)[1] << 8))
|
||||
#define SCRIPT_READ_32(ptr) (((ptr)[0]) + ((ptr)[1] << 8) + ((ptr)[2] << 16) + ((ptr)[3] << 24))
|
||||
#define SCRIPT_READ_PTR(ptr) ((const u8*)(SCRIPT_READ_32(ptr)))
|
||||
|
||||
#define ANIM_SPRITE_INDEX_COUNT 8
|
||||
|
||||
extern u16 gBattle_WIN0H;
|
||||
@@ -352,7 +348,7 @@ static void ScriptCmd_loadspritegfx(void)
|
||||
u16 index;
|
||||
|
||||
sBattleAnimScriptPtr++;
|
||||
index = SCRIPT_READ_16(sBattleAnimScriptPtr);
|
||||
index = T1_READ_16(sBattleAnimScriptPtr);
|
||||
LoadCompressedObjectPicUsingHeap(&gBattleAnimPicTable[GET_TRUE_SPRITE_INDEX(index)]);
|
||||
LoadCompressedObjectPaletteUsingHeap(&gBattleAnimPaletteTable[GET_TRUE_SPRITE_INDEX(index)]);
|
||||
sBattleAnimScriptPtr += 2;
|
||||
@@ -366,7 +362,7 @@ static void ScriptCmd_unloadspritegfx(void)
|
||||
u16 index;
|
||||
|
||||
sBattleAnimScriptPtr++;
|
||||
index = SCRIPT_READ_16(sBattleAnimScriptPtr);
|
||||
index = T1_READ_16(sBattleAnimScriptPtr);
|
||||
FreeSpriteTilesByTag(gBattleAnimPicTable[GET_TRUE_SPRITE_INDEX(index)].tag);
|
||||
FreeSpritePaletteByTag(gBattleAnimPicTable[GET_TRUE_SPRITE_INDEX(index)].tag);
|
||||
sBattleAnimScriptPtr += 2;
|
||||
@@ -382,7 +378,7 @@ static void ScriptCmd_createsprite(void)
|
||||
s16 subpriority;
|
||||
|
||||
sBattleAnimScriptPtr++;
|
||||
template = (const struct SpriteTemplate *)(SCRIPT_READ_32(sBattleAnimScriptPtr));
|
||||
template = (const struct SpriteTemplate *)(T2_READ_32(sBattleAnimScriptPtr));
|
||||
sBattleAnimScriptPtr += 4;
|
||||
|
||||
argVar = sBattleAnimScriptPtr[0];
|
||||
@@ -392,7 +388,7 @@ static void ScriptCmd_createsprite(void)
|
||||
sBattleAnimScriptPtr++;
|
||||
for (i = 0; i < argsCount; i++)
|
||||
{
|
||||
gBattleAnimArgs[i] = SCRIPT_READ_16(sBattleAnimScriptPtr);
|
||||
gBattleAnimArgs[i] = T1_READ_16(sBattleAnimScriptPtr);
|
||||
sBattleAnimScriptPtr += 2;
|
||||
}
|
||||
|
||||
@@ -433,7 +429,7 @@ static void ScriptCmd_createvisualtask(void)
|
||||
|
||||
sBattleAnimScriptPtr++;
|
||||
|
||||
taskFunc = (TaskFunc)SCRIPT_READ_32(sBattleAnimScriptPtr);
|
||||
taskFunc = (TaskFunc)T2_READ_32(sBattleAnimScriptPtr);
|
||||
sBattleAnimScriptPtr += 4;
|
||||
|
||||
taskPriority = sBattleAnimScriptPtr[0];
|
||||
@@ -444,7 +440,7 @@ static void ScriptCmd_createvisualtask(void)
|
||||
|
||||
for (i = 0; i < numArgs; i++)
|
||||
{
|
||||
gBattleAnimArgs[i] = SCRIPT_READ_16(sBattleAnimScriptPtr);
|
||||
gBattleAnimArgs[i] = T1_READ_16(sBattleAnimScriptPtr);
|
||||
sBattleAnimScriptPtr += 2;
|
||||
}
|
||||
|
||||
@@ -542,26 +538,26 @@ static void ScriptCmd_end(void)
|
||||
static void ScriptCmd_playse(void)
|
||||
{
|
||||
sBattleAnimScriptPtr++;
|
||||
PlaySE(SCRIPT_READ_16(sBattleAnimScriptPtr));
|
||||
PlaySE(T1_READ_16(sBattleAnimScriptPtr));
|
||||
sBattleAnimScriptPtr += 2;
|
||||
}
|
||||
|
||||
#define t1_MONBG_BANK 0
|
||||
#define t1_MONBG_BATTLER 0
|
||||
#define t1_MON_IN_BG2 1
|
||||
#define t1_CREATE_ANOTHER_TASK 2
|
||||
#define t1_IS_SECONDMON_BG 3
|
||||
|
||||
#define t2_BANK_SPRITE_ID 0
|
||||
#define t2_BATTLER_SPRITE_ID 0
|
||||
#define t2_MON_IN_BG2 5
|
||||
#define t2_MONBG_BANK 6
|
||||
#define t2_MONBG_BATTLER 6
|
||||
|
||||
static void sub_80A40F4(u8 taskId)
|
||||
{
|
||||
u8 newTaskId;
|
||||
|
||||
s16 *selfData = gTasks[taskId].data;
|
||||
u8 bankSpriteId = gBattlerSpriteIds[selfData[t1_MONBG_BANK]];
|
||||
gSprites[bankSpriteId].invisible = 1;
|
||||
u8 battlerSpriteId = gBattlerSpriteIds[selfData[t1_MONBG_BATTLER]];
|
||||
gSprites[battlerSpriteId].invisible = 1;
|
||||
|
||||
if (!selfData[t1_CREATE_ANOTHER_TASK])
|
||||
{
|
||||
@@ -570,9 +566,9 @@ static void sub_80A40F4(u8 taskId)
|
||||
}
|
||||
|
||||
newTaskId = CreateTask(task_pA_ma0A_obj_to_bg_pal, 10);
|
||||
gTasks[newTaskId].data[t2_BANK_SPRITE_ID] = bankSpriteId;
|
||||
gTasks[newTaskId].data[1] = gSprites[bankSpriteId].pos1.x + gSprites[bankSpriteId].pos2.x;
|
||||
gTasks[newTaskId].data[2] = gSprites[bankSpriteId].pos1.y + gSprites[bankSpriteId].pos2.y;
|
||||
gTasks[newTaskId].data[t2_BATTLER_SPRITE_ID] = battlerSpriteId;
|
||||
gTasks[newTaskId].data[1] = gSprites[battlerSpriteId].pos1.x + gSprites[battlerSpriteId].pos2.x;
|
||||
gTasks[newTaskId].data[2] = gSprites[battlerSpriteId].pos1.y + gSprites[battlerSpriteId].pos2.y;
|
||||
|
||||
if (!selfData[t1_MON_IN_BG2])
|
||||
{
|
||||
@@ -586,7 +582,7 @@ static void sub_80A40F4(u8 taskId)
|
||||
}
|
||||
|
||||
gTasks[newTaskId].data[t2_MON_IN_BG2] = selfData[t1_MON_IN_BG2];
|
||||
gTasks[newTaskId].data[t2_MONBG_BANK] = selfData[t1_MONBG_BANK];
|
||||
gTasks[newTaskId].data[t2_MONBG_BATTLER] = selfData[t1_MONBG_BATTLER];
|
||||
sMonAnimTaskIdArray[selfData[t1_IS_SECONDMON_BG]] = newTaskId;
|
||||
DestroyAnimVisualTask(taskId);
|
||||
}
|
||||
@@ -595,48 +591,48 @@ static void ScriptCmd_monbg(void)
|
||||
{
|
||||
bool8 toBG_2;
|
||||
u8 taskId;
|
||||
u8 bank;
|
||||
u8 battlerId;
|
||||
u8 animBank;
|
||||
|
||||
sBattleAnimScriptPtr++;
|
||||
|
||||
animBank = sBattleAnimScriptPtr[0];
|
||||
if (animBank & ANIM_TARGET)
|
||||
bank = gBattleAnimTarget;
|
||||
battlerId = gBattleAnimTarget;
|
||||
else
|
||||
bank = gBattleAnimAttacker;
|
||||
battlerId = gBattleAnimAttacker;
|
||||
|
||||
if (IsBattlerSpriteVisible(bank))
|
||||
if (IsBattlerSpriteVisible(battlerId))
|
||||
{
|
||||
u8 position = GetBattlerPosition(bank);
|
||||
u8 position = GetBattlerPosition(battlerId);
|
||||
if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest())
|
||||
toBG_2 = FALSE;
|
||||
else
|
||||
toBG_2 = TRUE;
|
||||
|
||||
sub_80A438C(bank, toBG_2, FALSE);
|
||||
sub_80A438C(battlerId, toBG_2, FALSE);
|
||||
taskId = CreateTask(sub_80A40F4, 10);
|
||||
gAnimVisualTaskCount++;
|
||||
gTasks[taskId].data[t1_MONBG_BANK] = bank;
|
||||
gTasks[taskId].data[t1_MONBG_BATTLER] = battlerId;
|
||||
gTasks[taskId].data[t1_MON_IN_BG2] = toBG_2;
|
||||
gTasks[taskId].data[t1_CREATE_ANOTHER_TASK] = TRUE;
|
||||
gTasks[taskId].data[t1_IS_SECONDMON_BG] = 0;
|
||||
|
||||
}
|
||||
|
||||
bank ^= BIT_FLANK;
|
||||
if (IsBattlerSpriteVisible(bank))
|
||||
battlerId ^= BIT_FLANK;
|
||||
if (IsBattlerSpriteVisible(battlerId))
|
||||
{
|
||||
u8 position = GetBattlerPosition(bank);
|
||||
u8 position = GetBattlerPosition(battlerId);
|
||||
if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest())
|
||||
toBG_2 = FALSE;
|
||||
else
|
||||
toBG_2 = TRUE;
|
||||
|
||||
sub_80A438C(bank, toBG_2, FALSE);
|
||||
sub_80A438C(battlerId, toBG_2, FALSE);
|
||||
taskId = CreateTask(sub_80A40F4, 10);
|
||||
gAnimVisualTaskCount++;
|
||||
gTasks[taskId].data[0] = bank;
|
||||
gTasks[taskId].data[0] = battlerId;
|
||||
gTasks[taskId].data[1] = toBG_2;
|
||||
gTasks[taskId].data[t1_CREATE_ANOTHER_TASK] = TRUE;
|
||||
gTasks[taskId].data[t1_IS_SECONDMON_BG] = 1;
|
||||
@@ -647,33 +643,33 @@ static void ScriptCmd_monbg(void)
|
||||
gAnimScriptCallback = WaitAnimFrameCount;
|
||||
}
|
||||
|
||||
bool8 IsBattlerSpriteVisible(u8 bank)
|
||||
bool8 IsBattlerSpriteVisible(u8 battlerId)
|
||||
{
|
||||
if (IsContest())
|
||||
{
|
||||
if (bank == gBattleAnimAttacker)
|
||||
if (battlerId == gBattleAnimAttacker)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
if (!IsBattlerSpritePresent(bank))
|
||||
if (!IsBattlerSpritePresent(battlerId))
|
||||
return FALSE;
|
||||
if (IsContest())
|
||||
return TRUE; // this line wont ever be reached.
|
||||
if (!gBattleSpritesDataPtr->battlerData[bank].invisible || !gSprites[gBattlerSpriteIds[bank]].invisible)
|
||||
if (!gBattleSpritesDataPtr->battlerData[battlerId].invisible || !gSprites[gBattlerSpriteIds[battlerId]].invisible)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void sub_80A438C(u8 bank, bool8 toBG_2, bool8 setSpriteInvisible)
|
||||
void sub_80A438C(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible)
|
||||
{
|
||||
struct UnknownAnimStruct2 unknownStruct;
|
||||
u8 bankSpriteId;
|
||||
u8 battlerSpriteId;
|
||||
|
||||
if (!toBG_2)
|
||||
{
|
||||
u8 bankIdentity;
|
||||
u8 battlerPosition;
|
||||
|
||||
if (IsContest() == TRUE)
|
||||
{
|
||||
@@ -694,28 +690,28 @@ void sub_80A438C(u8 bank, bool8 toBG_2, bool8 setSpriteInvisible)
|
||||
SetAnimBgAttribute(1, BG_ANIM_SCREEN_SIZE, 1);
|
||||
SetAnimBgAttribute(1, BG_ANIM_AREA_OVERFLOW_MODE, 0);
|
||||
|
||||
bankSpriteId = gBattlerSpriteIds[bank];
|
||||
battlerSpriteId = gBattlerSpriteIds[battlerId];
|
||||
|
||||
gBattle_BG1_X = -(gSprites[bankSpriteId].pos1.x + gSprites[bankSpriteId].pos2.x) + 0x20;
|
||||
gBattle_BG1_X = -(gSprites[battlerSpriteId].pos1.x + gSprites[battlerSpriteId].pos2.x) + 0x20;
|
||||
if (IsContest() && IsSpeciesNotUnown(gContestResources->field_18->field_0))
|
||||
gBattle_BG1_X--;
|
||||
|
||||
gBattle_BG1_Y = -(gSprites[bankSpriteId].pos1.y + gSprites[bankSpriteId].pos2.y) + 0x20;
|
||||
gBattle_BG1_Y = -(gSprites[battlerSpriteId].pos1.y + gSprites[battlerSpriteId].pos2.y) + 0x20;
|
||||
if (setSpriteInvisible)
|
||||
gSprites[gBattlerSpriteIds[bank]].invisible = 1;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].invisible = 1;
|
||||
|
||||
SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X);
|
||||
SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y);
|
||||
|
||||
LoadPalette(&gPlttBufferUnfaded[0x100 + bank * 16], unknownStruct.unk8 * 16, 0x20);
|
||||
CpuCopy32(&gPlttBufferUnfaded[0x100 + bank * 16], (void*)(BG_PLTT + unknownStruct.unk8 * 32), 0x20);
|
||||
LoadPalette(&gPlttBufferUnfaded[0x100 + battlerId * 16], unknownStruct.unk8 * 16, 0x20);
|
||||
CpuCopy32(&gPlttBufferUnfaded[0x100 + battlerId * 16], (void*)(BG_PLTT + unknownStruct.unk8 * 32), 0x20);
|
||||
|
||||
if (IsContest())
|
||||
bankIdentity = 0;
|
||||
battlerPosition = 0;
|
||||
else
|
||||
bankIdentity = GetBattlerPosition(bank);
|
||||
battlerPosition = GetBattlerPosition(battlerId);
|
||||
|
||||
sub_8118FBC(1, 0, 0, bankIdentity, unknownStruct.unk8, unknownStruct.unk0, unknownStruct.unk4, unknownStruct.unkA);
|
||||
sub_8118FBC(1, 0, 0, battlerPosition, unknownStruct.unk8, unknownStruct.unk0, unknownStruct.unk4, unknownStruct.unkA);
|
||||
|
||||
if (IsContest())
|
||||
sub_80A46A0();
|
||||
@@ -731,21 +727,21 @@ void sub_80A438C(u8 bank, bool8 toBG_2, bool8 setSpriteInvisible)
|
||||
SetAnimBgAttribute(2, BG_ANIM_SCREEN_SIZE, 1);
|
||||
SetAnimBgAttribute(2, BG_ANIM_AREA_OVERFLOW_MODE, 0);
|
||||
|
||||
bankSpriteId = gBattlerSpriteIds[bank];
|
||||
battlerSpriteId = gBattlerSpriteIds[battlerId];
|
||||
|
||||
gBattle_BG2_X = -(gSprites[bankSpriteId].pos1.x + gSprites[bankSpriteId].pos2.x) + 0x20;
|
||||
gBattle_BG2_Y = -(gSprites[bankSpriteId].pos1.y + gSprites[bankSpriteId].pos2.y) + 0x20;
|
||||
gBattle_BG2_X = -(gSprites[battlerSpriteId].pos1.x + gSprites[battlerSpriteId].pos2.x) + 0x20;
|
||||
gBattle_BG2_Y = -(gSprites[battlerSpriteId].pos1.y + gSprites[battlerSpriteId].pos2.y) + 0x20;
|
||||
|
||||
if (setSpriteInvisible)
|
||||
gSprites[gBattlerSpriteIds[bank]].invisible = 1;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].invisible = 1;
|
||||
|
||||
SetGpuReg(REG_OFFSET_BG2HOFS, gBattle_BG2_X);
|
||||
SetGpuReg(REG_OFFSET_BG2VOFS, gBattle_BG2_Y);
|
||||
|
||||
LoadPalette(&gPlttBufferUnfaded[0x100 + bank * 16], 0x90, 0x20);
|
||||
CpuCopy32(&gPlttBufferUnfaded[0x100 + bank * 16], (void*)(BG_PLTT + 0x120), 0x20);
|
||||
LoadPalette(&gPlttBufferUnfaded[0x100 + battlerId * 16], 0x90, 0x20);
|
||||
CpuCopy32(&gPlttBufferUnfaded[0x100 + battlerId * 16], (void*)(BG_PLTT + 0x120), 0x20);
|
||||
|
||||
sub_8118FBC(2, 0, 0, GetBattlerPosition(bank), unknownStruct.unk8, unknownStruct.unk0 + 0x1000, unknownStruct.unk4 + 0x400, unknownStruct.unkA);
|
||||
sub_8118FBC(2, 0, 0, GetBattlerPosition(battlerId), unknownStruct.unk8, unknownStruct.unk0 + 0x1000, unknownStruct.unk4 + 0x400, unknownStruct.unkA);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -852,7 +848,7 @@ static void task_pA_ma0A_obj_to_bg_pal(u8 taskId)
|
||||
static void ScriptCmd_clearmonbg(void)
|
||||
{
|
||||
u8 animBankId;
|
||||
u8 bank;
|
||||
u8 battlerId;
|
||||
u8 taskId;
|
||||
|
||||
sBattleAnimScriptPtr++;
|
||||
@@ -864,20 +860,20 @@ static void ScriptCmd_clearmonbg(void)
|
||||
animBankId = ANIM_DEF_PARTNER;
|
||||
|
||||
if (animBankId == ANIM_ATTACKER || animBankId == ANIM_ATK_PARTNER)
|
||||
bank = gBattleAnimAttacker;
|
||||
battlerId = gBattleAnimAttacker;
|
||||
else
|
||||
bank = gBattleAnimTarget;
|
||||
battlerId = gBattleAnimTarget;
|
||||
|
||||
if (sMonAnimTaskIdArray[0] != 0xFF)
|
||||
gSprites[gBattlerSpriteIds[bank]].invisible = 0;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].invisible = 0;
|
||||
if (animBankId > 1 && sMonAnimTaskIdArray[1] != 0xFF)
|
||||
gSprites[gBattlerSpriteIds[bank ^ BIT_FLANK]].invisible = 0;
|
||||
gSprites[gBattlerSpriteIds[battlerId ^ BIT_FLANK]].invisible = 0;
|
||||
else
|
||||
animBankId = 0;
|
||||
|
||||
taskId = CreateTask(sub_80A4980, 5);
|
||||
gTasks[taskId].data[0] = animBankId;
|
||||
gTasks[taskId].data[2] = bank;
|
||||
gTasks[taskId].data[2] = battlerId;
|
||||
|
||||
sBattleAnimScriptPtr++;
|
||||
}
|
||||
@@ -913,7 +909,7 @@ static void sub_80A4980(u8 taskId)
|
||||
static void ScriptCmd_monbg_22(void)
|
||||
{
|
||||
bool8 toBG_2;
|
||||
u8 bank;
|
||||
u8 battlerId;
|
||||
u8 animBankId;
|
||||
|
||||
sBattleAnimScriptPtr++;
|
||||
@@ -926,31 +922,31 @@ static void ScriptCmd_monbg_22(void)
|
||||
animBankId = ANIM_DEF_PARTNER;
|
||||
|
||||
if (animBankId == ANIM_ATTACKER || animBankId == ANIM_ATK_PARTNER)
|
||||
bank = gBattleAnimAttacker;
|
||||
battlerId = gBattleAnimAttacker;
|
||||
else
|
||||
bank = gBattleAnimTarget;
|
||||
battlerId = gBattleAnimTarget;
|
||||
|
||||
if (IsBattlerSpriteVisible(bank))
|
||||
if (IsBattlerSpriteVisible(battlerId))
|
||||
{
|
||||
u8 position = GetBattlerPosition(bank);
|
||||
u8 position = GetBattlerPosition(battlerId);
|
||||
if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest())
|
||||
toBG_2 = FALSE;
|
||||
else
|
||||
toBG_2 = TRUE;
|
||||
|
||||
sub_80A438C(bank, toBG_2, FALSE);
|
||||
sub_80A438C(battlerId, toBG_2, FALSE);
|
||||
}
|
||||
|
||||
bank ^= BIT_FLANK;
|
||||
if (animBankId > 1 && IsBattlerSpriteVisible(bank))
|
||||
battlerId ^= BIT_FLANK;
|
||||
if (animBankId > 1 && IsBattlerSpriteVisible(battlerId))
|
||||
{
|
||||
u8 position = GetBattlerPosition(bank);
|
||||
u8 position = GetBattlerPosition(battlerId);
|
||||
if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest())
|
||||
toBG_2 = FALSE;
|
||||
else
|
||||
toBG_2 = TRUE;
|
||||
|
||||
sub_80A438C(bank, toBG_2, FALSE);
|
||||
sub_80A438C(battlerId, toBG_2, FALSE);
|
||||
}
|
||||
|
||||
sBattleAnimScriptPtr++;
|
||||
@@ -959,7 +955,7 @@ static void ScriptCmd_monbg_22(void)
|
||||
static void ScriptCmd_clearmonbg_23(void)
|
||||
{
|
||||
u8 animBankId;
|
||||
u8 bank;
|
||||
u8 battlerId;
|
||||
u8 taskId;
|
||||
|
||||
sBattleAnimScriptPtr++;
|
||||
@@ -971,20 +967,20 @@ static void ScriptCmd_clearmonbg_23(void)
|
||||
animBankId = ANIM_DEF_PARTNER;
|
||||
|
||||
if (animBankId == ANIM_ATTACKER || animBankId == ANIM_ATK_PARTNER)
|
||||
bank = gBattleAnimAttacker;
|
||||
battlerId = gBattleAnimAttacker;
|
||||
else
|
||||
bank = gBattleAnimTarget;
|
||||
battlerId = gBattleAnimTarget;
|
||||
|
||||
if (IsBattlerSpriteVisible(bank))
|
||||
gSprites[gBattlerSpriteIds[bank]].invisible = 0;
|
||||
if (animBankId > 1 && IsBattlerSpriteVisible(bank ^ BIT_FLANK))
|
||||
gSprites[gBattlerSpriteIds[bank ^ BIT_FLANK]].invisible = 0;
|
||||
if (IsBattlerSpriteVisible(battlerId))
|
||||
gSprites[gBattlerSpriteIds[battlerId]].invisible = 0;
|
||||
if (animBankId > 1 && IsBattlerSpriteVisible(battlerId ^ BIT_FLANK))
|
||||
gSprites[gBattlerSpriteIds[battlerId ^ BIT_FLANK]].invisible = 0;
|
||||
else
|
||||
animBankId = 0;
|
||||
|
||||
taskId = CreateTask(sub_80A4BB0, 5);
|
||||
gTasks[taskId].data[0] = animBankId;
|
||||
gTasks[taskId].data[2] = bank;
|
||||
gTasks[taskId].data[2] = battlerId;
|
||||
|
||||
sBattleAnimScriptPtr++;
|
||||
}
|
||||
@@ -995,30 +991,30 @@ static void sub_80A4BB0(u8 taskId)
|
||||
if (gTasks[taskId].data[1] != 1)
|
||||
{
|
||||
bool8 toBG_2;
|
||||
u8 bank = gTasks[taskId].data[2];
|
||||
u8 position = GetBattlerPosition(bank);
|
||||
u8 battlerId = gTasks[taskId].data[2];
|
||||
u8 position = GetBattlerPosition(battlerId);
|
||||
if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest())
|
||||
toBG_2 = FALSE;
|
||||
else
|
||||
toBG_2 = TRUE;
|
||||
|
||||
if (IsBattlerSpriteVisible(bank))
|
||||
if (IsBattlerSpriteVisible(battlerId))
|
||||
sub_80A477C(toBG_2);
|
||||
if (gTasks[taskId].data[0] > 1 && IsBattlerSpriteVisible(bank ^ BIT_FLANK))
|
||||
if (gTasks[taskId].data[0] > 1 && IsBattlerSpriteVisible(battlerId ^ BIT_FLANK))
|
||||
sub_80A477C(toBG_2 ^ 1);
|
||||
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
|
||||
#undef t1_MONBG_BANK
|
||||
#undef t1_MONBG_BATTLER
|
||||
#undef t1_MON_IN_BG2
|
||||
#undef t1_CREATE_ANOTHER_TASK
|
||||
#undef t1_IS_SECONDMON_BG
|
||||
|
||||
#undef t2_BANK_SPRITE_ID
|
||||
#undef t2_BATTLER_SPRITE_ID
|
||||
#undef t2_MON_IN_BG2
|
||||
#undef t2_MONBG_BANK
|
||||
#undef t2_MONBG_BATTLER
|
||||
|
||||
static void ScriptCmd_setalpha(void)
|
||||
{
|
||||
@@ -1052,7 +1048,7 @@ static void ScriptCmd_call(void)
|
||||
{
|
||||
sBattleAnimScriptPtr++;
|
||||
sBattleAnimScriptRetAddr = sBattleAnimScriptPtr + 4;
|
||||
sBattleAnimScriptPtr = SCRIPT_READ_PTR(sBattleAnimScriptPtr);
|
||||
sBattleAnimScriptPtr = T2_READ_PTR(sBattleAnimScriptPtr);
|
||||
}
|
||||
|
||||
static void ScriptCmd_return(void)
|
||||
@@ -1069,7 +1065,7 @@ static void ScriptCmd_setarg(void)
|
||||
sBattleAnimScriptPtr++;
|
||||
argId = sBattleAnimScriptPtr[0];
|
||||
sBattleAnimScriptPtr++;
|
||||
value = SCRIPT_READ_16(sBattleAnimScriptPtr);
|
||||
value = T1_READ_16(sBattleAnimScriptPtr);
|
||||
sBattleAnimScriptPtr = addr + 4;
|
||||
gBattleAnimArgs[argId] = value;
|
||||
}
|
||||
@@ -1079,7 +1075,7 @@ static void ScriptCmd_choosetwoturnanim(void)
|
||||
sBattleAnimScriptPtr++;
|
||||
if (gAnimMoveTurn & 1)
|
||||
sBattleAnimScriptPtr += 4;
|
||||
sBattleAnimScriptPtr = SCRIPT_READ_PTR(sBattleAnimScriptPtr);
|
||||
sBattleAnimScriptPtr = T2_READ_PTR(sBattleAnimScriptPtr);
|
||||
}
|
||||
|
||||
static void ScriptCmd_jumpifmoveturn(void)
|
||||
@@ -1090,7 +1086,7 @@ static void ScriptCmd_jumpifmoveturn(void)
|
||||
sBattleAnimScriptPtr++;
|
||||
|
||||
if (toCheck == gAnimMoveTurn)
|
||||
sBattleAnimScriptPtr = SCRIPT_READ_PTR(sBattleAnimScriptPtr);
|
||||
sBattleAnimScriptPtr = T2_READ_PTR(sBattleAnimScriptPtr);
|
||||
else
|
||||
sBattleAnimScriptPtr += 4;
|
||||
}
|
||||
@@ -1098,7 +1094,7 @@ static void ScriptCmd_jumpifmoveturn(void)
|
||||
static void ScriptCmd_goto(void)
|
||||
{
|
||||
sBattleAnimScriptPtr++;
|
||||
sBattleAnimScriptPtr = SCRIPT_READ_PTR(sBattleAnimScriptPtr);
|
||||
sBattleAnimScriptPtr = T2_READ_PTR(sBattleAnimScriptPtr);
|
||||
}
|
||||
|
||||
// Uses of this function that rely on a TRUE return are expecting inBattle to not be ticked as defined in contest behavior. As a result, if misused, this function cannot reliably discern between field and contest status and could result in undefined behavior.
|
||||
@@ -1354,7 +1350,7 @@ static void ScriptCmd_playsewithpan(void)
|
||||
s8 pan;
|
||||
|
||||
sBattleAnimScriptPtr++;
|
||||
songId = SCRIPT_READ_16(sBattleAnimScriptPtr);
|
||||
songId = T1_READ_16(sBattleAnimScriptPtr);
|
||||
pan = sBattleAnimScriptPtr[2];
|
||||
PlaySE12WithPanning(songId, BattleAnimAdjustPanning(pan));
|
||||
sBattleAnimScriptPtr += 3;
|
||||
@@ -1385,7 +1381,7 @@ static void ScriptCmd_panse_1B(void)
|
||||
u8 taskId;
|
||||
|
||||
sBattleAnimScriptPtr++;
|
||||
songNum = SCRIPT_READ_16(sBattleAnimScriptPtr);
|
||||
songNum = T1_READ_16(sBattleAnimScriptPtr);
|
||||
currentPanArg = sBattleAnimScriptPtr[2];
|
||||
incrementPan = sBattleAnimScriptPtr[3];
|
||||
incrementPanArg = sBattleAnimScriptPtr[4];
|
||||
@@ -1457,7 +1453,7 @@ static void ScriptCmd_panse_26(void)
|
||||
u8 taskId;
|
||||
|
||||
sBattleAnimScriptPtr++;
|
||||
songId = SCRIPT_READ_16(sBattleAnimScriptPtr);
|
||||
songId = T1_READ_16(sBattleAnimScriptPtr);
|
||||
currentPan = sBattleAnimScriptPtr[2];
|
||||
targetPan = sBattleAnimScriptPtr[3];
|
||||
incrementPan = sBattleAnimScriptPtr[4];
|
||||
@@ -1484,7 +1480,7 @@ static void ScriptCmd_panse_27(void)
|
||||
u8 taskId;
|
||||
|
||||
sBattleAnimScriptPtr++;
|
||||
songId = SCRIPT_READ_16(sBattleAnimScriptPtr);
|
||||
songId = T1_READ_16(sBattleAnimScriptPtr);
|
||||
currentPanArg = sBattleAnimScriptPtr[2];
|
||||
targetPanArg = sBattleAnimScriptPtr[3];
|
||||
incrementPanArg = sBattleAnimScriptPtr[4];
|
||||
@@ -1528,7 +1524,7 @@ static void ScriptCmd_loopsewithpan(void)
|
||||
u8 taskId;
|
||||
|
||||
sBattleAnimScriptPtr++;
|
||||
songId = SCRIPT_READ_16(sBattleAnimScriptPtr);
|
||||
songId = T1_READ_16(sBattleAnimScriptPtr);
|
||||
panningArg = sBattleAnimScriptPtr[2];
|
||||
framesToWait = sBattleAnimScriptPtr[3];
|
||||
numberOfPlays = sBattleAnimScriptPtr[4];
|
||||
@@ -1585,7 +1581,7 @@ static void ScriptCmd_waitplaysewithpan(void)
|
||||
u8 taskId;
|
||||
|
||||
sBattleAnimScriptPtr++;
|
||||
songId = SCRIPT_READ_16(sBattleAnimScriptPtr);
|
||||
songId = T1_READ_16(sBattleAnimScriptPtr);
|
||||
panningArg = sBattleAnimScriptPtr[2];
|
||||
framesToWait = sBattleAnimScriptPtr[3];
|
||||
panning = BattleAnimAdjustPanning(panningArg);
|
||||
@@ -1620,13 +1616,13 @@ static void ScriptCmd_createsoundtask(void)
|
||||
s32 i;
|
||||
|
||||
sBattleAnimScriptPtr++;
|
||||
func = (TaskFunc)SCRIPT_READ_32(sBattleAnimScriptPtr);
|
||||
func = (TaskFunc)T2_READ_32(sBattleAnimScriptPtr);
|
||||
sBattleAnimScriptPtr += 4;
|
||||
numArgs = sBattleAnimScriptPtr[0];
|
||||
sBattleAnimScriptPtr++;
|
||||
for (i = 0; i < numArgs; i++)
|
||||
{
|
||||
gBattleAnimArgs[i] = SCRIPT_READ_16(sBattleAnimScriptPtr);
|
||||
gBattleAnimArgs[i] = T1_READ_16(sBattleAnimScriptPtr);
|
||||
sBattleAnimScriptPtr += 2;
|
||||
}
|
||||
taskId = CreateTask(func, 1);
|
||||
@@ -1669,10 +1665,10 @@ static void ScriptCmd_jumpargeq(void)
|
||||
|
||||
sBattleAnimScriptPtr++;
|
||||
argId = sBattleAnimScriptPtr[0];
|
||||
valueToCheck = SCRIPT_READ_16(sBattleAnimScriptPtr + 1);
|
||||
valueToCheck = T1_READ_16(sBattleAnimScriptPtr + 1);
|
||||
|
||||
if (valueToCheck == gBattleAnimArgs[argId])
|
||||
sBattleAnimScriptPtr = SCRIPT_READ_PTR(sBattleAnimScriptPtr + 3);
|
||||
sBattleAnimScriptPtr = T2_READ_PTR(sBattleAnimScriptPtr + 3);
|
||||
else
|
||||
sBattleAnimScriptPtr += 7;
|
||||
}
|
||||
@@ -1681,7 +1677,7 @@ static void ScriptCmd_jumpifcontest(void)
|
||||
{
|
||||
sBattleAnimScriptPtr++;
|
||||
if (IsContest())
|
||||
sBattleAnimScriptPtr = SCRIPT_READ_PTR(sBattleAnimScriptPtr);
|
||||
sBattleAnimScriptPtr = T2_READ_PTR(sBattleAnimScriptPtr);
|
||||
else
|
||||
sBattleAnimScriptPtr += 4;
|
||||
}
|
||||
@@ -1689,19 +1685,19 @@ static void ScriptCmd_jumpifcontest(void)
|
||||
static void ScriptCmd_monbgprio_28(void)
|
||||
{
|
||||
u8 wantedBank;
|
||||
u8 bank;
|
||||
u8 bankIdentity;
|
||||
u8 battlerId;
|
||||
u8 battlerPosition;
|
||||
|
||||
wantedBank = sBattleAnimScriptPtr[1];
|
||||
sBattleAnimScriptPtr += 2;
|
||||
|
||||
if (wantedBank != ANIM_ATTACKER)
|
||||
bank = gBattleAnimTarget;
|
||||
battlerId = gBattleAnimTarget;
|
||||
else
|
||||
bank = gBattleAnimAttacker;
|
||||
battlerId = gBattleAnimAttacker;
|
||||
|
||||
bankIdentity = GetBattlerPosition(bank);
|
||||
if (!IsContest() && (bankIdentity == B_POSITION_PLAYER_LEFT || bankIdentity == B_POSITION_OPPONENT_RIGHT))
|
||||
battlerPosition = GetBattlerPosition(battlerId);
|
||||
if (!IsContest() && (battlerPosition == B_POSITION_PLAYER_LEFT || battlerPosition == B_POSITION_OPPONENT_RIGHT))
|
||||
{
|
||||
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
|
||||
SetAnimBgAttribute(2, BG_ANIM_PRIORITY, 2);
|
||||
@@ -1721,20 +1717,20 @@ static void ScriptCmd_monbgprio_29(void)
|
||||
static void ScriptCmd_monbgprio_2A(void)
|
||||
{
|
||||
u8 wantedBank;
|
||||
u8 bankIdentity;
|
||||
u8 bank;
|
||||
u8 battlerPosition;
|
||||
u8 battlerId;
|
||||
|
||||
wantedBank = sBattleAnimScriptPtr[1];
|
||||
sBattleAnimScriptPtr += 2;
|
||||
if (GetBattlerSide(gBattleAnimAttacker) != GetBattlerSide(gBattleAnimTarget))
|
||||
{
|
||||
if (wantedBank != ANIM_ATTACKER)
|
||||
bank = gBattleAnimTarget;
|
||||
battlerId = gBattleAnimTarget;
|
||||
else
|
||||
bank = gBattleAnimAttacker;
|
||||
battlerId = gBattleAnimAttacker;
|
||||
|
||||
bankIdentity = GetBattlerPosition(bank);
|
||||
if (!IsContest() && (bankIdentity == B_POSITION_PLAYER_LEFT || bankIdentity == B_POSITION_OPPONENT_RIGHT))
|
||||
battlerPosition = GetBattlerPosition(battlerId);
|
||||
if (!IsContest() && (battlerPosition == B_POSITION_PLAYER_LEFT || battlerPosition == B_POSITION_OPPONENT_RIGHT))
|
||||
{
|
||||
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
|
||||
SetAnimBgAttribute(2, BG_ANIM_PRIORITY, 2);
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "trig.h"
|
||||
#include "sound.h"
|
||||
#include "constants/songs.h"
|
||||
#include "strings.h"
|
||||
#include "window.h"
|
||||
#include "text_window.h"
|
||||
#include "menu.h"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "battle_anim.h"
|
||||
#include "constants/battle_anim.h"
|
||||
#include "battle_ai_script_commands.h"
|
||||
#include "battle_link_817C95C.h"
|
||||
#include "battle_tv.h"
|
||||
#include "pokemon.h"
|
||||
#include "link.h"
|
||||
#include "util.h"
|
||||
@@ -32,9 +32,8 @@ extern struct MusicPlayerInfo gMPlayInfo_BGM;
|
||||
extern struct UnusedControllerStruct gUnknown_02022D0C;
|
||||
|
||||
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
|
||||
extern const struct BattleMove gBattleMoves[];
|
||||
|
||||
extern void sub_8172EF0(u8 bank, struct Pokemon *mon);
|
||||
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
|
||||
extern void sub_806A068(u16, u8);
|
||||
extern void sub_81851A8(u8 *);
|
||||
extern u16 sub_8068B48(void);
|
||||
@@ -104,7 +103,7 @@ static void LinkOpponentBufferExecCompleted(void);
|
||||
static void sub_8064DD0(void);
|
||||
static u32 CopyLinkOpponentMonData(u8 monId, u8 *dst);
|
||||
static void SetLinkOpponentMonData(u8 monId);
|
||||
static void sub_8066494(u8 bank, bool8 dontClearSubstituteBit);
|
||||
static void sub_8066494(u8 battlerId, bool8 dontClearSubstituteBit);
|
||||
static void DoSwitchOutAnimation(void);
|
||||
static void LinkOpponentDoMoveAnimation(void);
|
||||
static void sub_8067618(u8 taskId);
|
||||
@@ -1160,36 +1159,36 @@ static void LinkOpponentHandleSwitchInAnim(void)
|
||||
gBattlerControllerFuncs[gActiveBattler] = sub_8064F40;
|
||||
}
|
||||
|
||||
static void sub_8066494(u8 bank, bool8 dontClearSubstituteBit)
|
||||
static void sub_8066494(u8 battlerId, bool8 dontClearSubstituteBit)
|
||||
{
|
||||
u16 species;
|
||||
|
||||
ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit);
|
||||
gBattlerPartyIndexes[bank] = gBattleBufferA[bank][1];
|
||||
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES);
|
||||
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[bank]], bank);
|
||||
sub_806A068(species, GetBattlerPosition(bank));
|
||||
ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit);
|
||||
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
|
||||
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
|
||||
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||
sub_806A068(species, GetBattlerPosition(battlerId));
|
||||
|
||||
gBattlerSpriteIds[bank] = CreateSprite(
|
||||
gBattlerSpriteIds[battlerId] = CreateSprite(
|
||||
&gUnknown_0202499C,
|
||||
GetBattlerSpriteCoord(bank, 2),
|
||||
GetBattlerSpriteDefault_Y(bank),
|
||||
sub_80A82E4(bank));
|
||||
GetBattlerSpriteCoord(battlerId, 2),
|
||||
GetBattlerSpriteDefault_Y(battlerId),
|
||||
sub_80A82E4(battlerId));
|
||||
|
||||
gSprites[gUnknown_03005D7C[bank]].data[1] = gBattlerSpriteIds[bank];
|
||||
gSprites[gUnknown_03005D7C[bank]].data[2] = bank;
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId];
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId;
|
||||
|
||||
gSprites[gBattlerSpriteIds[bank]].data[0] = bank;
|
||||
gSprites[gBattlerSpriteIds[bank]].data[2] = species;
|
||||
gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].data[2] = species;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId;
|
||||
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]);
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]);
|
||||
|
||||
gSprites[gBattlerSpriteIds[bank]].invisible = TRUE;
|
||||
gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy;
|
||||
|
||||
gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT);
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT);
|
||||
}
|
||||
|
||||
static void LinkOpponentHandleReturnMonToBall(void)
|
||||
@@ -1338,7 +1337,7 @@ static void LinkOpponentHandleTrainerSlide(void)
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId;
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC;
|
||||
|
||||
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy2; // this line is redundant, because LinkOpponentBufferExecCompleted changes the battle bank function
|
||||
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy2; // this line is redundant, because LinkOpponentBufferExecCompleted changes the battle battlerId function
|
||||
LinkOpponentBufferExecCompleted();
|
||||
}
|
||||
|
||||
@@ -1414,7 +1413,7 @@ static void LinkOpponentHandleMoveAnimation(void)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
gBattlerControllerFuncs[gActiveBattler] = LinkOpponentDoMoveAnimation;
|
||||
sub_817E0FC(move, gWeatherMoveAnim, gAnimDisableStructPtr);
|
||||
BattleTv_SetDataBasedOnMove(move, gWeatherMoveAnim, gAnimDisableStructPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1478,7 +1477,7 @@ static void LinkOpponentHandlePrintString(void)
|
||||
BufferStringBattle(*stringId);
|
||||
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
|
||||
gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter;
|
||||
sub_817C95C(*stringId);
|
||||
BattleTv_SetDataBasedOnString(*stringId);
|
||||
}
|
||||
|
||||
static void LinkOpponentHandlePrintSelectionString(void)
|
||||
@@ -1549,11 +1548,11 @@ static void LinkOpponentHandleStatusIconUpdate(void)
|
||||
{
|
||||
if (!mplay_80342A4(gActiveBattler))
|
||||
{
|
||||
u8 bank;
|
||||
u8 battlerId;
|
||||
|
||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON);
|
||||
bank = gActiveBattler;
|
||||
gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0;
|
||||
battlerId = gActiveBattler;
|
||||
gBattleSpritesDataPtr->healthBoxesData[battlerId].statusAnimActive = 0;
|
||||
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation;
|
||||
}
|
||||
}
|
||||
@@ -1831,7 +1830,7 @@ static void LinkOpponentHandleBattleAnimation(void)
|
||||
else
|
||||
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation;
|
||||
|
||||
sub_817E32C(animationId);
|
||||
BattleTv_SetDataBasedOnAnimation(animationId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "battle_anim.h"
|
||||
#include "constants/battle_anim.h"
|
||||
#include "battle_ai_script_commands.h"
|
||||
#include "battle_link_817C95C.h"
|
||||
#include "battle_tv.h"
|
||||
#include "pokemon.h"
|
||||
#include "link.h"
|
||||
#include "util.h"
|
||||
@@ -31,9 +31,8 @@ extern struct UnusedControllerStruct gUnknown_02022D0C;
|
||||
|
||||
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
|
||||
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
|
||||
extern const struct BattleMove gBattleMoves[];
|
||||
|
||||
extern void sub_8172EF0(u8 bank, struct Pokemon *mon);
|
||||
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
|
||||
extern void sub_806A068(u16, u8);
|
||||
extern void sub_81851A8(u8 *);
|
||||
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
|
||||
@@ -102,7 +101,7 @@ static void LinkPartnerBufferExecCompleted(void);
|
||||
static void sub_814B554(void);
|
||||
static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst);
|
||||
static void SetLinkPartnerMonData(u8 monId);
|
||||
static void sub_814CC98(u8 bank, bool8 dontClearSubstituteBit);
|
||||
static void sub_814CC98(u8 battlerId, bool8 dontClearSubstituteBit);
|
||||
static void DoSwitchOutAnimation(void);
|
||||
static void LinkPartnerDoMoveAnimation(void);
|
||||
static void sub_814DCCC(u8 taskId);
|
||||
@@ -1046,35 +1045,35 @@ static void LinkPartnerHandleSwitchInAnim(void)
|
||||
gBattlerControllerFuncs[gActiveBattler] = sub_814B69C;
|
||||
}
|
||||
|
||||
static void sub_814CC98(u8 bank, bool8 dontClearSubstituteBit)
|
||||
static void sub_814CC98(u8 battlerId, bool8 dontClearSubstituteBit)
|
||||
{
|
||||
u16 species;
|
||||
|
||||
ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit);
|
||||
gBattlerPartyIndexes[bank] = gBattleBufferA[bank][1];
|
||||
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES);
|
||||
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||
sub_806A068(species, GetBattlerPosition(bank));
|
||||
ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit);
|
||||
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
|
||||
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
|
||||
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||
sub_806A068(species, GetBattlerPosition(battlerId));
|
||||
|
||||
gBattlerSpriteIds[bank] = CreateSprite(
|
||||
gBattlerSpriteIds[battlerId] = CreateSprite(
|
||||
&gUnknown_0202499C,
|
||||
GetBattlerSpriteCoord(bank, 2),
|
||||
GetBattlerSpriteDefault_Y(bank),
|
||||
sub_80A82E4(bank));
|
||||
GetBattlerSpriteCoord(battlerId, 2),
|
||||
GetBattlerSpriteDefault_Y(battlerId),
|
||||
sub_80A82E4(battlerId));
|
||||
|
||||
gSprites[gUnknown_03005D7C[bank]].data[1] = gBattlerSpriteIds[bank];
|
||||
gSprites[gUnknown_03005D7C[bank]].data[2] = bank;
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId];
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId;
|
||||
|
||||
gSprites[gBattlerSpriteIds[bank]].data[0] = bank;
|
||||
gSprites[gBattlerSpriteIds[bank]].data[2] = species;
|
||||
gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].data[2] = species;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId;
|
||||
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]);
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]);
|
||||
|
||||
gSprites[gBattlerSpriteIds[bank]].invisible = TRUE;
|
||||
gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy;
|
||||
|
||||
gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
|
||||
}
|
||||
|
||||
static void LinkPartnerHandleReturnMonToBall(void)
|
||||
@@ -1238,7 +1237,7 @@ static void LinkPartnerHandleMoveAnimation(void)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
gBattlerControllerFuncs[gActiveBattler] = LinkPartnerDoMoveAnimation;
|
||||
sub_817E0FC(move, gWeatherMoveAnim, gAnimDisableStructPtr);
|
||||
BattleTv_SetDataBasedOnMove(move, gWeatherMoveAnim, gAnimDisableStructPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1302,7 +1301,7 @@ static void LinkPartnerHandlePrintString(void)
|
||||
BufferStringBattle(*stringId);
|
||||
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
|
||||
gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter;
|
||||
sub_817C95C(*stringId);
|
||||
BattleTv_SetDataBasedOnString(*stringId);
|
||||
}
|
||||
|
||||
static void LinkPartnerHandlePrintSelectionString(void)
|
||||
@@ -1373,11 +1372,11 @@ static void LinkPartnerHandleStatusIconUpdate(void)
|
||||
{
|
||||
if (!mplay_80342A4(gActiveBattler))
|
||||
{
|
||||
u8 bank;
|
||||
u8 battlerId;
|
||||
|
||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON);
|
||||
bank = gActiveBattler;
|
||||
gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0;
|
||||
battlerId = gActiveBattler;
|
||||
gBattleSpritesDataPtr->healthBoxesData[battlerId].statusAnimActive = 0;
|
||||
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation;
|
||||
}
|
||||
}
|
||||
@@ -1666,7 +1665,7 @@ static void LinkPartnerHandleBattleAnimation(void)
|
||||
else
|
||||
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation;
|
||||
|
||||
sub_817E32C(animationId);
|
||||
BattleTv_SetDataBasedOnAnimation(animationId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "battle_interface.h"
|
||||
#include "battle_anim.h"
|
||||
#include "constants/battle_anim.h"
|
||||
#include "battle_link_817C95C.h"
|
||||
#include "battle_tv.h"
|
||||
#include "battle_ai_script_commands.h"
|
||||
#include "pokemon.h"
|
||||
#include "link.h"
|
||||
@@ -35,11 +35,10 @@ extern struct MusicPlayerInfo gMPlayInfo_BGM;
|
||||
extern struct UnusedControllerStruct gUnknown_02022D0C;
|
||||
|
||||
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
|
||||
extern const struct BattleMove gBattleMoves[];
|
||||
|
||||
extern void sub_8172EF0(u8 bank, struct Pokemon *mon);
|
||||
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
|
||||
extern void sub_806A068(u16, u8);
|
||||
extern void sub_81A57E4(u8 bank, u16 stringId);
|
||||
extern void sub_81A57E4(u8 battlerId, u16 stringId);
|
||||
extern u8 sub_81A4CB0(void);
|
||||
extern u8 sub_81D5588(u16 trainerId);
|
||||
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
|
||||
@@ -109,7 +108,7 @@ static void OpponentBufferExecCompleted(void);
|
||||
static void sub_805FC80(void);
|
||||
static u32 GetOpponentMonData(u8 monId, u8 *dst);
|
||||
static void SetOpponentMonData(u8 monId);
|
||||
static void sub_80613DC(u8 bank, bool8 dontClearSubstituteBit);
|
||||
static void sub_80613DC(u8 battlerId, bool8 dontClearSubstituteBit);
|
||||
static void DoSwitchOutAnimation(void);
|
||||
static void OpponentDoMoveAnimation(void);
|
||||
static void sub_806280C(struct Sprite *sprite);
|
||||
@@ -1154,36 +1153,36 @@ static void OpponentHandleSwitchInAnim(void)
|
||||
gBattlerControllerFuncs[gActiveBattler] = sub_805FDF0;
|
||||
}
|
||||
|
||||
static void sub_80613DC(u8 bank, bool8 dontClearSubstituteBit)
|
||||
static void sub_80613DC(u8 battlerId, bool8 dontClearSubstituteBit)
|
||||
{
|
||||
u16 species;
|
||||
|
||||
ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit);
|
||||
gBattlerPartyIndexes[bank] = gBattleBufferA[bank][1];
|
||||
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES);
|
||||
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[bank]], bank);
|
||||
sub_806A068(species, GetBattlerPosition(bank));
|
||||
ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit);
|
||||
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
|
||||
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
|
||||
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||
sub_806A068(species, GetBattlerPosition(battlerId));
|
||||
|
||||
gBattlerSpriteIds[bank] = CreateSprite(&gUnknown_0202499C,
|
||||
GetBattlerSpriteCoord(bank, 2),
|
||||
GetBattlerSpriteDefault_Y(bank),
|
||||
sub_80A82E4(bank));
|
||||
gBattlerSpriteIds[battlerId] = CreateSprite(&gUnknown_0202499C,
|
||||
GetBattlerSpriteCoord(battlerId, 2),
|
||||
GetBattlerSpriteDefault_Y(battlerId),
|
||||
sub_80A82E4(battlerId));
|
||||
|
||||
gSprites[gBattlerSpriteIds[bank]].data[0] = bank;
|
||||
gSprites[gBattlerSpriteIds[bank]].data[2] = species;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].data[2] = species;
|
||||
|
||||
gSprites[gUnknown_03005D7C[bank]].data[1] = gBattlerSpriteIds[bank];
|
||||
gSprites[gUnknown_03005D7C[bank]].data[2] = bank;
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId];
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId;
|
||||
|
||||
gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId;
|
||||
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]);
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]);
|
||||
|
||||
gSprites[gBattlerSpriteIds[bank]].invisible = TRUE;
|
||||
gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy;
|
||||
|
||||
gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT);
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT);
|
||||
}
|
||||
|
||||
static void OpponentHandleReturnMonToBall(void)
|
||||
@@ -1563,7 +1562,7 @@ static void OpponentHandleChooseMove(void)
|
||||
BtlController_EmitTwoReturnValues(1, 15, gBattlerTarget);
|
||||
break;
|
||||
default:
|
||||
if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & (MOVE_TARGET_USER | MOVE_TARGET_x10))
|
||||
if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & (MOVE_TARGET_USER_OR_SELECTED | MOVE_TARGET_USER))
|
||||
gBattlerTarget = gActiveBattler;
|
||||
if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & MOVE_TARGET_BOTH)
|
||||
{
|
||||
@@ -1585,7 +1584,7 @@ static void OpponentHandleChooseMove(void)
|
||||
move = moveInfo->moves[chosenMoveId];
|
||||
} while (move == MOVE_NONE);
|
||||
|
||||
if (gBattleMoves[move].target & (MOVE_TARGET_USER | MOVE_TARGET_x10))
|
||||
if (gBattleMoves[move].target & (MOVE_TARGET_USER_OR_SELECTED | MOVE_TARGET_USER))
|
||||
BtlController_EmitTwoReturnValues(1, 10, (chosenMoveId) | (gActiveBattler << 8));
|
||||
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||
BtlController_EmitTwoReturnValues(1, 10, (chosenMoveId) | (GetBattlerAtPosition(Random() & 2) << 8));
|
||||
@@ -1698,11 +1697,11 @@ static void OpponentHandleStatusIconUpdate(void)
|
||||
{
|
||||
if (!mplay_80342A4(gActiveBattler))
|
||||
{
|
||||
u8 bank;
|
||||
u8 battlerId;
|
||||
|
||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON);
|
||||
bank = gActiveBattler;
|
||||
gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0;
|
||||
battlerId = gActiveBattler;
|
||||
gBattleSpritesDataPtr->healthBoxesData[battlerId].statusAnimActive = 0;
|
||||
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "battle_interface.h"
|
||||
#include "battle_anim.h"
|
||||
#include "constants/battle_anim.h"
|
||||
#include "battle_link_817C95C.h"
|
||||
#include "battle_tv.h"
|
||||
#include "pokemon.h"
|
||||
#include "link.h"
|
||||
#include "util.h"
|
||||
@@ -42,22 +42,12 @@ extern struct SpriteTemplate gUnknown_0202499C;
|
||||
|
||||
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
|
||||
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
|
||||
extern const u8 gTypeNames[][7];
|
||||
extern const struct BattleMove gBattleMoves[];
|
||||
|
||||
extern const u8 gText_BattleSwitchWhich[];
|
||||
extern const u8 gText_MoveInterfacePP[];
|
||||
extern const u8 gText_MoveInterfaceType[];
|
||||
extern const u8 gText_LinkStandby[];
|
||||
extern const u8 gText_BattleMenu[];
|
||||
extern const u8 gText_WhatWillPkmnDo[];
|
||||
extern const u8 gText_BattleYesNoChoice[];
|
||||
|
||||
extern void sub_8172EF0(u8 bank, struct Pokemon *mon);
|
||||
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
|
||||
extern void sub_81B89AC(u8 arg0);
|
||||
extern void sub_81AABB0(void);
|
||||
extern void sub_806A068(u16, u8);
|
||||
extern void sub_81A57E4(u8 bank, u16 stringId);
|
||||
extern void sub_81A57E4(u8 battlerId, u16 stringId);
|
||||
extern void sub_81851A8(u8 *);
|
||||
|
||||
// this file's functions
|
||||
@@ -140,7 +130,7 @@ static void sub_80595A4(u8 taskId);
|
||||
static void PrintLinkStandbyMsg(void);
|
||||
static u32 CopyPlayerMonData(u8 monId, u8 *dst);
|
||||
static void SetPlayerMonData(u8 monId);
|
||||
static void sub_805B258(u8 bank, bool8 dontClearSubstituteBit);
|
||||
static void sub_805B258(u8 battlerId, bool8 dontClearSubstituteBit);
|
||||
static void DoSwitchOutAnimation(void);
|
||||
static void PlayerDoMoveAnimation(void);
|
||||
static void task05_08033660(u8 taskId);
|
||||
@@ -432,7 +422,7 @@ static void HandleInputChooseTarget(void)
|
||||
case B_POSITION_PLAYER_RIGHT:
|
||||
if (gActiveBattler != gMultiUsePlayerCursor)
|
||||
i++;
|
||||
else if (gBattleMoves[GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1 + gMoveSelectionCursor[gActiveBattler])].target & MOVE_TARGET_USER)
|
||||
else if (gBattleMoves[GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1 + gMoveSelectionCursor[gActiveBattler])].target & MOVE_TARGET_USER_OR_SELECTED)
|
||||
i++;
|
||||
break;
|
||||
case B_POSITION_OPPONENT_LEFT:
|
||||
@@ -474,7 +464,7 @@ static void HandleInputChooseTarget(void)
|
||||
case B_POSITION_PLAYER_RIGHT:
|
||||
if (gActiveBattler != gMultiUsePlayerCursor)
|
||||
i++;
|
||||
else if (gBattleMoves[GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1 + gMoveSelectionCursor[gActiveBattler])].target & MOVE_TARGET_USER)
|
||||
else if (gBattleMoves[GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1 + gMoveSelectionCursor[gActiveBattler])].target & MOVE_TARGET_USER_OR_SELECTED)
|
||||
i++;
|
||||
break;
|
||||
case B_POSITION_OPPONENT_LEFT:
|
||||
@@ -508,7 +498,7 @@ static void HandleInputChooseMove(void)
|
||||
if (moveInfo->moves[gMoveSelectionCursor[gActiveBattler]] == MOVE_CURSE)
|
||||
{
|
||||
if (moveInfo->monType1 != TYPE_GHOST && moveInfo->monType2 != TYPE_GHOST)
|
||||
moveTarget = MOVE_TARGET_x10;
|
||||
moveTarget = MOVE_TARGET_USER;
|
||||
else
|
||||
moveTarget = MOVE_TARGET_SELECTED;
|
||||
}
|
||||
@@ -517,26 +507,26 @@ static void HandleInputChooseMove(void)
|
||||
moveTarget = gBattleMoves[moveInfo->moves[gMoveSelectionCursor[gActiveBattler]]].target;
|
||||
}
|
||||
|
||||
if (moveTarget & MOVE_TARGET_x10)
|
||||
if (moveTarget & MOVE_TARGET_USER)
|
||||
gMultiUsePlayerCursor = gActiveBattler;
|
||||
else
|
||||
gMultiUsePlayerCursor = GetBattlerAtPosition((GetBattlerPosition(gActiveBattler) & BIT_SIDE) ^ BIT_SIDE);
|
||||
|
||||
if (!gBattleBufferA[gActiveBattler][1]) // not a double battle
|
||||
{
|
||||
if (moveTarget & MOVE_TARGET_USER && !gBattleBufferA[gActiveBattler][2])
|
||||
if (moveTarget & MOVE_TARGET_USER_OR_SELECTED && !gBattleBufferA[gActiveBattler][2])
|
||||
canSelectTarget++;
|
||||
}
|
||||
else // double battle
|
||||
{
|
||||
if (!(moveTarget & (MOVE_TARGET_RANDOM | MOVE_TARGET_BOTH | MOVE_TARGET_DEPENDS | MOVE_TARGET_FOES_AND_ALLY | MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_x10)))
|
||||
if (!(moveTarget & (MOVE_TARGET_RANDOM | MOVE_TARGET_BOTH | MOVE_TARGET_DEPENDS | MOVE_TARGET_FOES_AND_ALLY | MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_USER)))
|
||||
canSelectTarget++; // either selected or user
|
||||
|
||||
if (moveInfo->currentPp[gMoveSelectionCursor[gActiveBattler]] == 0)
|
||||
{
|
||||
canSelectTarget = FALSE;
|
||||
}
|
||||
else if (!(moveTarget & (MOVE_TARGET_x10 | MOVE_TARGET_USER)) && CountAliveMonsInBattle(BATTLE_ALIVE_EXCEPT_ACTIVE) <= 1)
|
||||
else if (!(moveTarget & (MOVE_TARGET_USER | MOVE_TARGET_USER_OR_SELECTED)) && CountAliveMonsInBattle(BATTLE_ALIVE_EXCEPT_ACTIVE) <= 1)
|
||||
{
|
||||
gMultiUsePlayerCursor = GetDefaultMoveTarget(gActiveBattler);
|
||||
canSelectTarget = FALSE;
|
||||
@@ -552,7 +542,7 @@ static void HandleInputChooseMove(void)
|
||||
{
|
||||
gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseTarget;
|
||||
|
||||
if (moveTarget & (MOVE_TARGET_x10 | MOVE_TARGET_USER))
|
||||
if (moveTarget & (MOVE_TARGET_USER | MOVE_TARGET_USER_OR_SELECTED))
|
||||
gMultiUsePlayerCursor = gActiveBattler;
|
||||
else if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT)])
|
||||
gMultiUsePlayerCursor = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
|
||||
@@ -881,7 +871,7 @@ static void sub_80586F8(void)
|
||||
gMain.callback1 = gPreBattleCallback1;
|
||||
SetMainCallback2(sub_8038D64);
|
||||
if (gBattleOutcome == B_OUTCOME_WON)
|
||||
sub_817E3F4();
|
||||
TryPutLinkBattleTvShowOnAir();
|
||||
FreeAllWindowBuffers();
|
||||
}
|
||||
}
|
||||
@@ -894,7 +884,7 @@ static void sub_80586F8(void)
|
||||
gMain.callback1 = gPreBattleCallback1;
|
||||
SetMainCallback2(sub_8038D64);
|
||||
if (gBattleOutcome == B_OUTCOME_WON)
|
||||
sub_817E3F4();
|
||||
TryPutLinkBattleTvShowOnAir();
|
||||
FreeAllWindowBuffers();
|
||||
}
|
||||
}
|
||||
@@ -1159,10 +1149,10 @@ static void CompleteOnInactiveTextPrinter(void)
|
||||
static void Task_GiveExpToMon(u8 taskId)
|
||||
{
|
||||
u32 monId = (u8)(gTasks[taskId].tExpTask_monId);
|
||||
u8 bank = gTasks[taskId].tExpTask_bank;
|
||||
u8 battlerId = gTasks[taskId].tExpTask_bank;
|
||||
s16 gainedExp = gTasks[taskId].tExpTask_gainedExp;
|
||||
|
||||
if (IsDoubleBattle() == TRUE || monId != gBattlerPartyIndexes[bank]) // give exp without the expbar
|
||||
if (IsDoubleBattle() == TRUE || monId != gBattlerPartyIndexes[battlerId]) // give exp without the expbar
|
||||
{
|
||||
struct Pokemon *mon = &gPlayerParty[monId];
|
||||
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||
@@ -1178,12 +1168,12 @@ static void Task_GiveExpToMon(u8 taskId)
|
||||
CalculateMonStats(mon);
|
||||
gainedExp -= nextLvlExp - currExp;
|
||||
savedActiveBank = gActiveBattler;
|
||||
gActiveBattler = bank;
|
||||
gActiveBattler = battlerId;
|
||||
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp);
|
||||
gActiveBattler = savedActiveBank;
|
||||
|
||||
if (IsDoubleBattle() == TRUE
|
||||
&& ((u16)(monId) == gBattlerPartyIndexes[bank] || (u16)(monId) == gBattlerPartyIndexes[bank ^ BIT_FLANK]))
|
||||
&& ((u16)(monId) == gBattlerPartyIndexes[battlerId] || (u16)(monId) == gBattlerPartyIndexes[battlerId ^ BIT_FLANK]))
|
||||
gTasks[taskId].func = sub_8059544;
|
||||
else
|
||||
gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter;
|
||||
@@ -1192,7 +1182,7 @@ static void Task_GiveExpToMon(u8 taskId)
|
||||
{
|
||||
currExp += gainedExp;
|
||||
SetMonData(mon, MON_DATA_EXP, &currExp);
|
||||
gBattlerControllerFuncs[bank] = CompleteOnInactiveTextPrinter;
|
||||
gBattlerControllerFuncs[battlerId] = CompleteOnInactiveTextPrinter;
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
@@ -1206,7 +1196,7 @@ static void Task_PrepareToGiveExpWithExpBar(u8 taskId)
|
||||
{
|
||||
u8 monIndex = gTasks[taskId].tExpTask_monId;
|
||||
s32 gainedExp = gTasks[taskId].tExpTask_gainedExp;
|
||||
u8 bank = gTasks[taskId].tExpTask_bank;
|
||||
u8 battlerId = gTasks[taskId].tExpTask_bank;
|
||||
struct Pokemon *mon = &gPlayerParty[monIndex];
|
||||
u8 level = GetMonData(mon, MON_DATA_LEVEL);
|
||||
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||
@@ -1216,7 +1206,7 @@ static void Task_PrepareToGiveExpWithExpBar(u8 taskId)
|
||||
|
||||
exp -= currLvlExp;
|
||||
expToNextLvl = gExperienceTables[gBaseStats[species].growthRate][level + 1] - currLvlExp;
|
||||
SetBattleBarStruct(bank, gHealthboxSpriteIds[bank], expToNextLvl, exp, -gainedExp);
|
||||
SetBattleBarStruct(battlerId, gHealthboxSpriteIds[battlerId], expToNextLvl, exp, -gainedExp);
|
||||
PlaySE(SE_EXP);
|
||||
gTasks[taskId].func = sub_8059400;
|
||||
}
|
||||
@@ -1231,11 +1221,11 @@ static void sub_8059400(u8 taskId)
|
||||
{
|
||||
u8 monId = gTasks[taskId].tExpTask_monId;
|
||||
s16 gainedExp = gTasks[taskId].tExpTask_gainedExp;
|
||||
u8 bank = gTasks[taskId].tExpTask_bank;
|
||||
u8 battlerId = gTasks[taskId].tExpTask_bank;
|
||||
s16 r4;
|
||||
|
||||
r4 = sub_8074AA0(bank, gHealthboxSpriteIds[bank], EXP_BAR, 0);
|
||||
SetHealthboxSpriteVisible(gHealthboxSpriteIds[bank]);
|
||||
r4 = sub_8074AA0(battlerId, gHealthboxSpriteIds[battlerId], EXP_BAR, 0);
|
||||
SetHealthboxSpriteVisible(gHealthboxSpriteIds[battlerId]);
|
||||
if (r4 == -1)
|
||||
{
|
||||
u8 level;
|
||||
@@ -1257,7 +1247,7 @@ static void sub_8059400(u8 taskId)
|
||||
CalculateMonStats(&gPlayerParty[monId]);
|
||||
gainedExp -= expOnNextLvl - currExp;
|
||||
savedActiveBank = gActiveBattler;
|
||||
gActiveBattler = bank;
|
||||
gActiveBattler = battlerId;
|
||||
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp);
|
||||
gActiveBattler = savedActiveBank;
|
||||
gTasks[taskId].func = sub_8059544;
|
||||
@@ -1266,7 +1256,7 @@ static void sub_8059400(u8 taskId)
|
||||
{
|
||||
currExp += gainedExp;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &currExp);
|
||||
gBattlerControllerFuncs[bank] = CompleteOnInactiveTextPrinter;
|
||||
gBattlerControllerFuncs[battlerId] = CompleteOnInactiveTextPrinter;
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
@@ -1275,30 +1265,30 @@ static void sub_8059400(u8 taskId)
|
||||
|
||||
static void sub_8059544(u8 taskId)
|
||||
{
|
||||
u8 bank = gTasks[taskId].tExpTask_bank;
|
||||
u8 battlerId = gTasks[taskId].tExpTask_bank;
|
||||
u8 monIndex = gTasks[taskId].tExpTask_monId;
|
||||
|
||||
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[bank ^ BIT_FLANK])
|
||||
bank ^= BIT_FLANK;
|
||||
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[battlerId ^ BIT_FLANK])
|
||||
battlerId ^= BIT_FLANK;
|
||||
|
||||
InitAndLaunchSpecialAnimation(bank, bank, bank, B_ANIM_LVL_UP);
|
||||
InitAndLaunchSpecialAnimation(battlerId, battlerId, battlerId, B_ANIM_LVL_UP);
|
||||
gTasks[taskId].func = sub_80595A4;
|
||||
}
|
||||
|
||||
static void sub_80595A4(u8 taskId)
|
||||
{
|
||||
u8 bank = gTasks[taskId].tExpTask_bank;
|
||||
u8 battlerId = gTasks[taskId].tExpTask_bank;
|
||||
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[bank].specialAnimActive)
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[battlerId].specialAnimActive)
|
||||
{
|
||||
u8 monIndex = gTasks[taskId].tExpTask_monId;
|
||||
|
||||
GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value
|
||||
|
||||
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[bank ^ BIT_FLANK])
|
||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[bank ^ BIT_FLANK], &gPlayerParty[monIndex], HEALTHBOX_ALL);
|
||||
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[battlerId ^ BIT_FLANK])
|
||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId ^ BIT_FLANK], &gPlayerParty[monIndex], HEALTHBOX_ALL);
|
||||
else
|
||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[bank], &gPlayerParty[monIndex], HEALTHBOX_ALL);
|
||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId], &gPlayerParty[monIndex], HEALTHBOX_ALL);
|
||||
|
||||
gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter;
|
||||
}
|
||||
@@ -1307,12 +1297,12 @@ static void sub_80595A4(u8 taskId)
|
||||
static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId)
|
||||
{
|
||||
u8 monIndex;
|
||||
u8 bank;
|
||||
u8 battlerId;
|
||||
|
||||
monIndex = gTasks[taskId].tExpTask_monId;
|
||||
GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value
|
||||
bank = gTasks[taskId].tExpTask_bank;
|
||||
gBattlerControllerFuncs[bank] = CompleteOnInactiveTextPrinter;
|
||||
battlerId = gTasks[taskId].tExpTask_bank;
|
||||
gBattlerControllerFuncs[battlerId] = CompleteOnInactiveTextPrinter;
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
@@ -2201,35 +2191,35 @@ static void PlayerHandleSwitchInAnim(void)
|
||||
gBattlerControllerFuncs[gActiveBattler] = sub_805902C;
|
||||
}
|
||||
|
||||
static void sub_805B258(u8 bank, bool8 dontClearSubstituteBit)
|
||||
static void sub_805B258(u8 battlerId, bool8 dontClearSubstituteBit)
|
||||
{
|
||||
u16 species;
|
||||
|
||||
ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit);
|
||||
gBattlerPartyIndexes[bank] = gBattleBufferA[bank][1];
|
||||
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES);
|
||||
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||
sub_806A068(species, GetBattlerPosition(bank));
|
||||
ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit);
|
||||
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
|
||||
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
|
||||
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||
sub_806A068(species, GetBattlerPosition(battlerId));
|
||||
|
||||
gBattlerSpriteIds[bank] = CreateSprite(
|
||||
gBattlerSpriteIds[battlerId] = CreateSprite(
|
||||
&gUnknown_0202499C,
|
||||
GetBattlerSpriteCoord(bank, 2),
|
||||
GetBattlerSpriteDefault_Y(bank),
|
||||
sub_80A82E4(bank));
|
||||
GetBattlerSpriteCoord(battlerId, 2),
|
||||
GetBattlerSpriteDefault_Y(battlerId),
|
||||
sub_80A82E4(battlerId));
|
||||
|
||||
gSprites[gUnknown_03005D7C[bank]].data[1] = gBattlerSpriteIds[bank];
|
||||
gSprites[gUnknown_03005D7C[bank]].data[2] = bank;
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId];
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId;
|
||||
|
||||
gSprites[gBattlerSpriteIds[bank]].data[0] = bank;
|
||||
gSprites[gBattlerSpriteIds[bank]].data[2] = species;
|
||||
gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].data[2] = species;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId;
|
||||
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]);
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]);
|
||||
|
||||
gSprites[gBattlerSpriteIds[bank]].invisible = TRUE;
|
||||
gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy;
|
||||
|
||||
gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
|
||||
}
|
||||
|
||||
static void PlayerHandleReturnMonToBall(void)
|
||||
@@ -2484,7 +2474,7 @@ static void PlayerHandleMoveAnimation(void)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
gBattlerControllerFuncs[gActiveBattler] = PlayerDoMoveAnimation;
|
||||
sub_817E0FC(move, gWeatherMoveAnim, gAnimDisableStructPtr);
|
||||
BattleTv_SetDataBasedOnMove(move, gWeatherMoveAnim, gAnimDisableStructPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2548,7 +2538,7 @@ static void PlayerHandlePrintString(void)
|
||||
BufferStringBattle(*stringId);
|
||||
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
|
||||
gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter2;
|
||||
sub_817C95C(*stringId);
|
||||
BattleTv_SetDataBasedOnString(*stringId);
|
||||
sub_81A57E4(gActiveBattler, *stringId);
|
||||
}
|
||||
|
||||
@@ -2575,7 +2565,7 @@ static void PlayerHandleChooseAction(void)
|
||||
s32 i;
|
||||
|
||||
gBattlerControllerFuncs[gActiveBattler] = HandleChooseActionAfterDma3;
|
||||
sub_817F2A8();
|
||||
BattleTv_ClearExplosionFaintCause();
|
||||
BattleHandleAddTextPrinter(gText_BattleMenu, 2);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
@@ -2751,11 +2741,11 @@ static void PlayerHandleStatusIconUpdate(void)
|
||||
{
|
||||
if (!mplay_80342A4(gActiveBattler))
|
||||
{
|
||||
u8 bank;
|
||||
u8 battlerId;
|
||||
|
||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON);
|
||||
bank = gActiveBattler;
|
||||
gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0;
|
||||
battlerId = gActiveBattler;
|
||||
gBattleSpritesDataPtr->healthBoxesData[battlerId].statusAnimActive = 0;
|
||||
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation;
|
||||
}
|
||||
}
|
||||
@@ -2964,13 +2954,13 @@ static void PlayerHandleIntroTrainerBallThrow(void)
|
||||
|
||||
void sub_805CC00(struct Sprite *sprite)
|
||||
{
|
||||
u8 bank = sprite->data[5];
|
||||
u8 battlerId = sprite->data[5];
|
||||
|
||||
FreeSpriteOamMatrix(sprite);
|
||||
FreeSpritePaletteByTag(GetSpritePaletteTagByPaletteNum(sprite->oam.paletteNum));
|
||||
DestroySprite(sprite);
|
||||
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[bank]], bank);
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], 0);
|
||||
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], 0);
|
||||
}
|
||||
|
||||
static void task05_08033660(u8 taskId)
|
||||
@@ -3069,7 +3059,7 @@ static void PlayerHandleBattleAnimation(void)
|
||||
else
|
||||
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation;
|
||||
|
||||
sub_817E32C(animationId);
|
||||
BattleTv_SetDataBasedOnAnimation(animationId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,10 +31,9 @@ extern struct UnusedControllerStruct gUnknown_02022D0C;
|
||||
|
||||
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
|
||||
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
|
||||
extern const struct BattleMove gBattleMoves[];
|
||||
|
||||
extern void sub_81358F4(void);
|
||||
extern void sub_8172EF0(u8 bank, struct Pokemon *mon);
|
||||
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
|
||||
extern void sub_806A068(u16, u8);
|
||||
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
|
||||
|
||||
@@ -108,7 +107,7 @@ static void sub_81BB688(u8 taskId);
|
||||
static void sub_81BB9A0(void);
|
||||
static u32 CopyPlayerPartnerMonData(u8 monId, u8 *dst);
|
||||
static void SetPlayerPartnerMonData(u8 monId);
|
||||
static void sub_81BD0E4(u8 bank, bool8 dontClearSubstituteBit);
|
||||
static void sub_81BD0E4(u8 battlerId, bool8 dontClearSubstituteBit);
|
||||
static void DoSwitchOutAnimation(void);
|
||||
static void PlayerPartnerDoMoveAnimation(void);
|
||||
static void sub_81BE2C8(u8 taskId);
|
||||
@@ -325,10 +324,10 @@ static void CompleteOnInactiveTextPrinter(void)
|
||||
static void Task_GiveExpToMon(u8 taskId)
|
||||
{
|
||||
u32 monId = (u8)(gTasks[taskId].tExpTask_monId);
|
||||
u8 bank = gTasks[taskId].tExpTask_bank;
|
||||
u8 battlerId = gTasks[taskId].tExpTask_bank;
|
||||
s16 gainedExp = gTasks[taskId].tExpTask_gainedExp;
|
||||
|
||||
if (IsDoubleBattle() == TRUE || monId != gBattlerPartyIndexes[bank]) // give exp without the expbar
|
||||
if (IsDoubleBattle() == TRUE || monId != gBattlerPartyIndexes[battlerId]) // give exp without the expbar
|
||||
{
|
||||
struct Pokemon *mon = &gPlayerParty[monId];
|
||||
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||
@@ -344,12 +343,12 @@ static void Task_GiveExpToMon(u8 taskId)
|
||||
CalculateMonStats(mon);
|
||||
gainedExp -= nextLvlExp - currExp;
|
||||
savedActiveBank = gActiveBattler;
|
||||
gActiveBattler = bank;
|
||||
gActiveBattler = battlerId;
|
||||
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp);
|
||||
gActiveBattler = savedActiveBank;
|
||||
|
||||
if (IsDoubleBattle() == TRUE
|
||||
&& ((u16)(monId) == gBattlerPartyIndexes[bank] || (u16)(monId) == gBattlerPartyIndexes[bank ^ BIT_FLANK]))
|
||||
&& ((u16)(monId) == gBattlerPartyIndexes[battlerId] || (u16)(monId) == gBattlerPartyIndexes[battlerId ^ BIT_FLANK]))
|
||||
gTasks[taskId].func = sub_81BB628;
|
||||
else
|
||||
gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter;
|
||||
@@ -358,7 +357,7 @@ static void Task_GiveExpToMon(u8 taskId)
|
||||
{
|
||||
currExp += gainedExp;
|
||||
SetMonData(mon, MON_DATA_EXP, &currExp);
|
||||
gBattlerControllerFuncs[bank] = CompleteOnInactiveTextPrinter;
|
||||
gBattlerControllerFuncs[battlerId] = CompleteOnInactiveTextPrinter;
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
@@ -372,7 +371,7 @@ static void Task_PrepareToGiveExpWithExpBar(u8 taskId)
|
||||
{
|
||||
u8 monIndex = gTasks[taskId].tExpTask_monId;
|
||||
s32 gainedExp = gTasks[taskId].tExpTask_gainedExp;
|
||||
u8 bank = gTasks[taskId].tExpTask_bank;
|
||||
u8 battlerId = gTasks[taskId].tExpTask_bank;
|
||||
struct Pokemon *mon = &gPlayerParty[monIndex];
|
||||
u8 level = GetMonData(mon, MON_DATA_LEVEL);
|
||||
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||
@@ -382,7 +381,7 @@ static void Task_PrepareToGiveExpWithExpBar(u8 taskId)
|
||||
|
||||
exp -= currLvlExp;
|
||||
expToNextLvl = gExperienceTables[gBaseStats[species].growthRate][level + 1] - currLvlExp;
|
||||
SetBattleBarStruct(bank, gHealthboxSpriteIds[bank], expToNextLvl, exp, -gainedExp);
|
||||
SetBattleBarStruct(battlerId, gHealthboxSpriteIds[battlerId], expToNextLvl, exp, -gainedExp);
|
||||
PlaySE(SE_EXP);
|
||||
gTasks[taskId].func = sub_81BB4E4;
|
||||
}
|
||||
@@ -397,11 +396,11 @@ static void sub_81BB4E4(u8 taskId)
|
||||
{
|
||||
u8 monId = gTasks[taskId].tExpTask_monId;
|
||||
s16 gainedExp = gTasks[taskId].tExpTask_gainedExp;
|
||||
u8 bank = gTasks[taskId].tExpTask_bank;
|
||||
u8 battlerId = gTasks[taskId].tExpTask_bank;
|
||||
s16 r4;
|
||||
|
||||
r4 = sub_8074AA0(bank, gHealthboxSpriteIds[bank], EXP_BAR, 0);
|
||||
SetHealthboxSpriteVisible(gHealthboxSpriteIds[bank]);
|
||||
r4 = sub_8074AA0(battlerId, gHealthboxSpriteIds[battlerId], EXP_BAR, 0);
|
||||
SetHealthboxSpriteVisible(gHealthboxSpriteIds[battlerId]);
|
||||
if (r4 == -1)
|
||||
{
|
||||
u8 level;
|
||||
@@ -423,7 +422,7 @@ static void sub_81BB4E4(u8 taskId)
|
||||
CalculateMonStats(&gPlayerParty[monId]);
|
||||
gainedExp -= expOnNextLvl - currExp;
|
||||
savedActiveBank = gActiveBattler;
|
||||
gActiveBattler = bank;
|
||||
gActiveBattler = battlerId;
|
||||
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp);
|
||||
gActiveBattler = savedActiveBank;
|
||||
gTasks[taskId].func = sub_81BB628;
|
||||
@@ -432,7 +431,7 @@ static void sub_81BB4E4(u8 taskId)
|
||||
{
|
||||
currExp += gainedExp;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &currExp);
|
||||
gBattlerControllerFuncs[bank] = CompleteOnInactiveTextPrinter;
|
||||
gBattlerControllerFuncs[battlerId] = CompleteOnInactiveTextPrinter;
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
@@ -441,30 +440,30 @@ static void sub_81BB4E4(u8 taskId)
|
||||
|
||||
static void sub_81BB628(u8 taskId)
|
||||
{
|
||||
u8 bank = gTasks[taskId].tExpTask_bank;
|
||||
u8 battlerId = gTasks[taskId].tExpTask_bank;
|
||||
u8 monIndex = gTasks[taskId].tExpTask_monId;
|
||||
|
||||
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[bank ^ BIT_FLANK])
|
||||
bank ^= BIT_FLANK;
|
||||
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[battlerId ^ BIT_FLANK])
|
||||
battlerId ^= BIT_FLANK;
|
||||
|
||||
InitAndLaunchSpecialAnimation(bank, bank, bank, B_ANIM_LVL_UP);
|
||||
InitAndLaunchSpecialAnimation(battlerId, battlerId, battlerId, B_ANIM_LVL_UP);
|
||||
gTasks[taskId].func = sub_81BB688;
|
||||
}
|
||||
|
||||
static void sub_81BB688(u8 taskId)
|
||||
{
|
||||
u8 bank = gTasks[taskId].tExpTask_bank;
|
||||
u8 battlerId = gTasks[taskId].tExpTask_bank;
|
||||
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[bank].specialAnimActive)
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[battlerId].specialAnimActive)
|
||||
{
|
||||
u8 monIndex = gTasks[taskId].tExpTask_monId;
|
||||
|
||||
GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value
|
||||
|
||||
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[bank ^ BIT_FLANK])
|
||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[bank ^ BIT_FLANK], &gPlayerParty[monIndex], HEALTHBOX_ALL);
|
||||
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[battlerId ^ BIT_FLANK])
|
||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId ^ BIT_FLANK], &gPlayerParty[monIndex], HEALTHBOX_ALL);
|
||||
else
|
||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[bank], &gPlayerParty[monIndex], HEALTHBOX_ALL);
|
||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId], &gPlayerParty[monIndex], HEALTHBOX_ALL);
|
||||
|
||||
gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter;
|
||||
}
|
||||
@@ -473,12 +472,12 @@ static void sub_81BB688(u8 taskId)
|
||||
static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId)
|
||||
{
|
||||
u8 monIndex;
|
||||
u8 bank;
|
||||
u8 battlerId;
|
||||
|
||||
monIndex = gTasks[taskId].tExpTask_monId;
|
||||
GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value
|
||||
bank = gTasks[taskId].tExpTask_bank;
|
||||
gBattlerControllerFuncs[bank] = CompleteOnInactiveTextPrinter;
|
||||
battlerId = gTasks[taskId].tExpTask_bank;
|
||||
gBattlerControllerFuncs[battlerId] = CompleteOnInactiveTextPrinter;
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
@@ -1233,35 +1232,35 @@ static void PlayerPartnerHandleSwitchInAnim(void)
|
||||
gBattlerControllerFuncs[gActiveBattler] = sub_81BBAE8;
|
||||
}
|
||||
|
||||
static void sub_81BD0E4(u8 bank, bool8 dontClearSubstituteBit)
|
||||
static void sub_81BD0E4(u8 battlerId, bool8 dontClearSubstituteBit)
|
||||
{
|
||||
u16 species;
|
||||
|
||||
ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit);
|
||||
gBattlerPartyIndexes[bank] = gBattleBufferA[bank][1];
|
||||
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES);
|
||||
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||
sub_806A068(species, GetBattlerPosition(bank));
|
||||
ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit);
|
||||
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
|
||||
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
|
||||
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||
sub_806A068(species, GetBattlerPosition(battlerId));
|
||||
|
||||
gBattlerSpriteIds[bank] = CreateSprite(
|
||||
gBattlerSpriteIds[battlerId] = CreateSprite(
|
||||
&gUnknown_0202499C,
|
||||
GetBattlerSpriteCoord(bank, 2),
|
||||
GetBattlerSpriteDefault_Y(bank),
|
||||
sub_80A82E4(bank));
|
||||
GetBattlerSpriteCoord(battlerId, 2),
|
||||
GetBattlerSpriteDefault_Y(battlerId),
|
||||
sub_80A82E4(battlerId));
|
||||
|
||||
gSprites[gUnknown_03005D7C[bank]].data[1] = gBattlerSpriteIds[bank];
|
||||
gSprites[gUnknown_03005D7C[bank]].data[2] = bank;
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId];
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId;
|
||||
|
||||
gSprites[gBattlerSpriteIds[bank]].data[0] = bank;
|
||||
gSprites[gBattlerSpriteIds[bank]].data[2] = species;
|
||||
gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].data[2] = species;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId;
|
||||
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]);
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]);
|
||||
|
||||
gSprites[gBattlerSpriteIds[bank]].invisible = TRUE;
|
||||
gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy;
|
||||
|
||||
gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
|
||||
}
|
||||
|
||||
static void PlayerPartnerHandleReturnMonToBall(void)
|
||||
@@ -1521,7 +1520,7 @@ static void PlayerPartnerHandleChooseMove(void)
|
||||
BattleAI_SetupAIData(0xF);
|
||||
chosenMoveId = BattleAI_ChooseMoveOrAction();
|
||||
|
||||
if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & (MOVE_TARGET_x10 | MOVE_TARGET_USER))
|
||||
if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & (MOVE_TARGET_USER | MOVE_TARGET_USER_OR_SELECTED))
|
||||
gBattlerTarget = gActiveBattler;
|
||||
if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & MOVE_TARGET_BOTH)
|
||||
{
|
||||
@@ -1626,11 +1625,11 @@ static void PlayerPartnerHandleStatusIconUpdate(void)
|
||||
{
|
||||
if (!mplay_80342A4(gActiveBattler))
|
||||
{
|
||||
u8 bank;
|
||||
u8 battlerId;
|
||||
|
||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON);
|
||||
bank = gActiveBattler;
|
||||
gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0;
|
||||
battlerId = gActiveBattler;
|
||||
gBattleSpritesDataPtr->healthBoxesData[battlerId].statusAnimActive = 0;
|
||||
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "battle_anim.h"
|
||||
#include "constants/battle_anim.h"
|
||||
#include "battle_ai_script_commands.h"
|
||||
#include "battle_link_817C95C.h"
|
||||
#include "battle_tv.h"
|
||||
#include "recorded_battle.h"
|
||||
#include "pokemon.h"
|
||||
#include "link.h"
|
||||
@@ -35,7 +35,7 @@ extern u8 gUnknown_0203C7B4;
|
||||
|
||||
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
|
||||
|
||||
extern void sub_8172EF0(u8 bank, struct Pokemon *mon);
|
||||
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
|
||||
extern void sub_806A068(u16, u8);
|
||||
extern u16 sub_8068B48(void);
|
||||
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
|
||||
@@ -104,7 +104,7 @@ static void RecordedOpponentBufferExecCompleted(void);
|
||||
static void sub_8186F14(void);
|
||||
static u32 CopyRecordedOpponentMonData(u8 monId, u8 *dst);
|
||||
static void SetRecordedOpponentMonData(u8 monId);
|
||||
static void sub_81885D8(u8 bank, bool8 dontClearSubstituteBit);
|
||||
static void sub_81885D8(u8 battlerId, bool8 dontClearSubstituteBit);
|
||||
static void DoSwitchOutAnimation(void);
|
||||
static void RecordedOpponentDoMoveAnimation(void);
|
||||
static void sub_8189548(u8 taskId);
|
||||
@@ -1144,35 +1144,35 @@ static void RecordedOpponentHandleSwitchInAnim(void)
|
||||
gBattlerControllerFuncs[gActiveBattler] = sub_8187084;
|
||||
}
|
||||
|
||||
static void sub_81885D8(u8 bank, bool8 dontClearSubstituteBit)
|
||||
static void sub_81885D8(u8 battlerId, bool8 dontClearSubstituteBit)
|
||||
{
|
||||
u16 species;
|
||||
|
||||
ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit);
|
||||
gBattlerPartyIndexes[bank] = gBattleBufferA[bank][1];
|
||||
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES);
|
||||
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[bank]], bank);
|
||||
sub_806A068(species, GetBattlerPosition(bank));
|
||||
ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit);
|
||||
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
|
||||
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
|
||||
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||
sub_806A068(species, GetBattlerPosition(battlerId));
|
||||
|
||||
gBattlerSpriteIds[bank] = CreateSprite(&gUnknown_0202499C,
|
||||
GetBattlerSpriteCoord(bank, 2),
|
||||
GetBattlerSpriteDefault_Y(bank),
|
||||
sub_80A82E4(bank));
|
||||
gBattlerSpriteIds[battlerId] = CreateSprite(&gUnknown_0202499C,
|
||||
GetBattlerSpriteCoord(battlerId, 2),
|
||||
GetBattlerSpriteDefault_Y(battlerId),
|
||||
sub_80A82E4(battlerId));
|
||||
|
||||
gSprites[gUnknown_03005D7C[bank]].data[1] = gBattlerSpriteIds[bank];
|
||||
gSprites[gUnknown_03005D7C[bank]].data[2] = bank;
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId];
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId;
|
||||
|
||||
gSprites[gBattlerSpriteIds[bank]].data[0] = bank;
|
||||
gSprites[gBattlerSpriteIds[bank]].data[2] = species;
|
||||
gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].data[2] = species;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId;
|
||||
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]);
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]);
|
||||
|
||||
gSprites[gBattlerSpriteIds[bank]].invisible = TRUE;
|
||||
gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy;
|
||||
|
||||
gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT);
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT);
|
||||
}
|
||||
|
||||
static void RecordedOpponentHandleReturnMonToBall(void)
|
||||
@@ -1490,11 +1490,11 @@ static void RecordedOpponentHandleStatusIconUpdate(void)
|
||||
{
|
||||
if (!mplay_80342A4(gActiveBattler))
|
||||
{
|
||||
u8 bank;
|
||||
u8 battlerId;
|
||||
|
||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON);
|
||||
bank = gActiveBattler;
|
||||
gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0;
|
||||
battlerId = gActiveBattler;
|
||||
gBattleSpritesDataPtr->healthBoxesData[battlerId].statusAnimActive = 0;
|
||||
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,9 +34,8 @@ extern struct UnusedControllerStruct gUnknown_02022D0C;
|
||||
|
||||
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
|
||||
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
|
||||
extern const struct BattleMove gBattleMoves[];
|
||||
|
||||
extern void sub_8172EF0(u8 bank, struct Pokemon *mon);
|
||||
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
|
||||
extern void sub_806A068(u16, u8);
|
||||
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
|
||||
|
||||
@@ -104,7 +103,7 @@ static void RecordedPlayerBufferExecCompleted(void);
|
||||
static void sub_818A328(void);
|
||||
static u32 CopyRecordedPlayerMonData(u8 monId, u8 *dst);
|
||||
static void SetRecordedPlayerMonData(u8 monId);
|
||||
static void sub_818BA6C(u8 bank, bool8 dontClearSubstituteBit);
|
||||
static void sub_818BA6C(u8 battlerId, bool8 dontClearSubstituteBit);
|
||||
static void DoSwitchOutAnimation(void);
|
||||
static void RecordedPlayerDoMoveAnimation(void);
|
||||
static void sub_818CC24(u8 taskId);
|
||||
@@ -1130,35 +1129,35 @@ static void RecordedPlayerHandleSwitchInAnim(void)
|
||||
gBattlerControllerFuncs[gActiveBattler] = sub_818A470;
|
||||
}
|
||||
|
||||
static void sub_818BA6C(u8 bank, bool8 dontClearSubstituteBit)
|
||||
static void sub_818BA6C(u8 battlerId, bool8 dontClearSubstituteBit)
|
||||
{
|
||||
u16 species;
|
||||
|
||||
ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit);
|
||||
gBattlerPartyIndexes[bank] = gBattleBufferA[bank][1];
|
||||
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES);
|
||||
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||
sub_806A068(species, GetBattlerPosition(bank));
|
||||
ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit);
|
||||
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
|
||||
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
|
||||
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||
sub_806A068(species, GetBattlerPosition(battlerId));
|
||||
|
||||
gBattlerSpriteIds[bank] = CreateSprite(
|
||||
gBattlerSpriteIds[battlerId] = CreateSprite(
|
||||
&gUnknown_0202499C,
|
||||
GetBattlerSpriteCoord(bank, 2),
|
||||
GetBattlerSpriteDefault_Y(bank),
|
||||
sub_80A82E4(bank));
|
||||
GetBattlerSpriteCoord(battlerId, 2),
|
||||
GetBattlerSpriteDefault_Y(battlerId),
|
||||
sub_80A82E4(battlerId));
|
||||
|
||||
gSprites[gUnknown_03005D7C[bank]].data[1] = gBattlerSpriteIds[bank];
|
||||
gSprites[gUnknown_03005D7C[bank]].data[2] = bank;
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId];
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId;
|
||||
|
||||
gSprites[gBattlerSpriteIds[bank]].data[0] = bank;
|
||||
gSprites[gBattlerSpriteIds[bank]].data[2] = species;
|
||||
gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].data[2] = species;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId;
|
||||
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]);
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]);
|
||||
|
||||
gSprites[gBattlerSpriteIds[bank]].invisible = TRUE;
|
||||
gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy;
|
||||
|
||||
gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
|
||||
}
|
||||
|
||||
static void RecordedPlayerHandleReturnMonToBall(void)
|
||||
@@ -1513,11 +1512,11 @@ static void RecordedPlayerHandleStatusIconUpdate(void)
|
||||
{
|
||||
if (!mplay_80342A4(gActiveBattler))
|
||||
{
|
||||
u8 bank;
|
||||
u8 battlerId;
|
||||
|
||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON);
|
||||
bank = gActiveBattler;
|
||||
gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0;
|
||||
battlerId = gActiveBattler;
|
||||
gBattleSpritesDataPtr->healthBoxesData[battlerId].statusAnimActive = 0;
|
||||
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,15 +23,11 @@
|
||||
#include "pokeblock.h"
|
||||
#include "item_use.h"
|
||||
|
||||
extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT];
|
||||
extern u16 gBattle_BG0_X;
|
||||
extern u16 gBattle_BG0_Y;
|
||||
|
||||
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
|
||||
|
||||
extern const u8 gText_SafariZoneMenu[];
|
||||
extern const u8 gText_WhatWillPkmnDo2[];
|
||||
|
||||
extern void sub_81358F4(void);
|
||||
|
||||
// this file's functions
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "battle_interface.h"
|
||||
#include "battle_anim.h"
|
||||
#include "constants/battle_anim.h"
|
||||
#include "battle_link_817C95C.h"
|
||||
#include "battle_tv.h"
|
||||
#include "pokemon.h"
|
||||
#include "link.h"
|
||||
#include "util.h"
|
||||
@@ -37,10 +37,7 @@ extern struct UnusedControllerStruct gUnknown_02022D0C;
|
||||
|
||||
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
|
||||
|
||||
extern const u8 gText_WhatWillWallyDo[];
|
||||
extern const u8 gText_BattleMenu[];
|
||||
|
||||
extern void sub_8172EF0(u8 bank, struct Pokemon *mon);
|
||||
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
|
||||
extern void sub_806A068(u16, u8);
|
||||
|
||||
// this file's functions
|
||||
@@ -1460,31 +1457,31 @@ static void WallyHandleIntroTrainerBallThrow(void)
|
||||
gBattlerControllerFuncs[gActiveBattler] = nullsub_21;
|
||||
}
|
||||
|
||||
static void sub_816AA80(u8 bank)
|
||||
static void sub_816AA80(u8 battlerId)
|
||||
{
|
||||
u16 species;
|
||||
|
||||
gBattleSpritesDataPtr->battlerData[bank].transformSpecies = 0;
|
||||
gBattlerPartyIndexes[bank] = gBattleBufferA[bank][1];
|
||||
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES);
|
||||
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||
sub_806A068(species, GetBattlerPosition(bank));
|
||||
gBattlerSpriteIds[bank] = CreateSprite(&gUnknown_0202499C,
|
||||
GetBattlerSpriteCoord(bank, 2),
|
||||
GetBattlerSpriteDefault_Y(bank),
|
||||
sub_80A82E4(bank));
|
||||
gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies = 0;
|
||||
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
|
||||
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
|
||||
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||
sub_806A068(species, GetBattlerPosition(battlerId));
|
||||
gBattlerSpriteIds[battlerId] = CreateSprite(&gUnknown_0202499C,
|
||||
GetBattlerSpriteCoord(battlerId, 2),
|
||||
GetBattlerSpriteDefault_Y(battlerId),
|
||||
sub_80A82E4(battlerId));
|
||||
|
||||
gSprites[gUnknown_03005D7C[bank]].data[1] = gBattlerSpriteIds[bank];
|
||||
gSprites[gUnknown_03005D7C[bank]].data[2] = bank;
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId];
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId;
|
||||
|
||||
gSprites[gBattlerSpriteIds[bank]].data[0] = bank;
|
||||
gSprites[gBattlerSpriteIds[bank]].data[2] = species;
|
||||
gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].data[2] = species;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId;
|
||||
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]);
|
||||
gSprites[gBattlerSpriteIds[bank]].invisible = TRUE;
|
||||
gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy;
|
||||
gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]);
|
||||
gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy;
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
|
||||
}
|
||||
|
||||
static void sub_816AC04(u8 taskId)
|
||||
|
||||
+12
-33
@@ -12,34 +12,14 @@
|
||||
#include "constants/abilities.h"
|
||||
#include "battle_message.h"
|
||||
|
||||
extern u32 gBattleExecBuffer;
|
||||
extern void (*gBattleBankFunc[4])(void);
|
||||
extern u8 gBanksByIdentity[4];
|
||||
extern u8 gActionSelectionCursor[4];
|
||||
extern u8 gMoveSelectionCursor[4];
|
||||
extern u8 gNoOfAllBanks;
|
||||
extern u8 gActiveBank;
|
||||
extern u16 gBattlePartyID[4];
|
||||
extern u8 gBattleBufferA[4][0x200];
|
||||
extern u8 gBattleBufferB[4][0x200];
|
||||
extern u8 gUnknown_02022D08;
|
||||
extern u8 gUnknown_02022D09;
|
||||
extern u8 gUnknown_02022D0A;
|
||||
extern u8 gBankAttacker;
|
||||
extern u8 gBankTarget;
|
||||
extern u8 gAbsentBankFlags;
|
||||
extern u8 gEffectBank;
|
||||
extern struct BattlePokemon gBattleMons[4];
|
||||
extern u16 gLastUsedMove;
|
||||
extern u8 gStringBank;
|
||||
extern u8 gBattleBuffersTransferData[0x100];
|
||||
|
||||
static EWRAM_DATA u8 sBattleBuffersTransferData[0x100] = {};
|
||||
|
||||
extern const struct BattleMove gBattleMoves[];
|
||||
|
||||
extern void task00_08081A90(u8 taskId); // cable_club
|
||||
extern void sub_81B8D64(u8 bank, u8 arg1); // party_menu
|
||||
extern void sub_81B8D64(u8 battlerId, u8 arg1); // party_menu
|
||||
|
||||
// this file's funcionts
|
||||
static void CreateTasksForSendRecvLinkBuffers(void);
|
||||
@@ -97,7 +77,6 @@ void SetUpBattleVarsAndBirchZigzagoon(void)
|
||||
void sub_8032768(void)
|
||||
{
|
||||
s32 i;
|
||||
u8 *data;
|
||||
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED))
|
||||
sub_8184DA4(1);
|
||||
@@ -120,11 +99,11 @@ void sub_8032768(void)
|
||||
sub_81B8D64(i, 0);
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(gBattleStruct->field_1A4); i++)
|
||||
*(gBattleStruct->field_1A4 + i) = 0;
|
||||
for (i = 0; i < sizeof(gBattleStruct->tvMovePoints); i++)
|
||||
*((u8*)(&gBattleStruct->tvMovePoints) + i) = 0;
|
||||
|
||||
for (i = 0; i < sizeof(gBattleStruct->field_204); i++)
|
||||
*(gBattleStruct->field_204 + i) = 0;
|
||||
for (i = 0; i < sizeof(gBattleStruct->tv); i++)
|
||||
*((u8*)(&gBattleStruct->tv) + i) = 0;
|
||||
}
|
||||
|
||||
static void InitSinglePlayerBtlControllers(void)
|
||||
@@ -887,7 +866,7 @@ void sub_8033648(void)
|
||||
static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId)
|
||||
{
|
||||
u16 blockSize;
|
||||
u8 bank;
|
||||
u8 battlerId;
|
||||
u8 var;
|
||||
|
||||
if (gTasks[taskId].data[15] != gTasks[taskId].data[14])
|
||||
@@ -898,17 +877,17 @@ static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId)
|
||||
gTasks[taskId].data[12] = 0;
|
||||
gTasks[taskId].data[15] = 0;
|
||||
}
|
||||
bank = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_ACTIVE_BANK];
|
||||
battlerId = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_ACTIVE_BANK];
|
||||
blockSize = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_SIZE_LO] | (gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_SIZE_HI] << 8);
|
||||
|
||||
switch (gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 0])
|
||||
{
|
||||
case 0:
|
||||
if (gBattleControllerExecFlags & gBitTable[bank])
|
||||
if (gBattleControllerExecFlags & gBitTable[battlerId])
|
||||
return;
|
||||
|
||||
memcpy(gBattleBufferA[bank], &gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 8], blockSize);
|
||||
sub_803F850(bank);
|
||||
memcpy(gBattleBufferA[battlerId], &gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 8], blockSize);
|
||||
sub_803F850(battlerId);
|
||||
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_WILD))
|
||||
{
|
||||
@@ -919,11 +898,11 @@ static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
memcpy(gBattleBufferB[bank], &gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 8], blockSize);
|
||||
memcpy(gBattleBufferB[battlerId], &gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 8], blockSize);
|
||||
break;
|
||||
case 2:
|
||||
var = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_DATA];
|
||||
gBattleControllerExecFlags &= ~(gBitTable[bank] << (var * 4));
|
||||
gBattleControllerExecFlags &= ~(gBitTable[battlerId] << (var * 4));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ extern struct MusicPlayerInfo gMPlayInfo_SE1;
|
||||
extern struct MusicPlayerInfo gMPlayInfo_SE2;
|
||||
extern struct MusicPlayerInfo gMPlayInfo_BGM;
|
||||
|
||||
extern const struct BattleMove gBattleMoves[];
|
||||
extern const u8 gUnknown_0831C604[];
|
||||
extern const u8 * const gBattleAnims_VariousTable[];
|
||||
extern const u8 * const gBattleAnims_Special[];
|
||||
@@ -237,7 +236,7 @@ u16 ChooseMoveAndTargetInBattlePalace(void)
|
||||
if (moveInfo->moves[chosenMoveId] == MOVE_CURSE)
|
||||
{
|
||||
if (moveInfo->monType1 != TYPE_GHOST && moveInfo->monType2 != TYPE_GHOST)
|
||||
var1 = MOVE_TARGET_x10;
|
||||
var1 = MOVE_TARGET_USER;
|
||||
else
|
||||
var1 = MOVE_TARGET_SELECTED;
|
||||
}
|
||||
@@ -246,7 +245,7 @@ u16 ChooseMoveAndTargetInBattlePalace(void)
|
||||
var1 = gBattleMoves[moveInfo->moves[chosenMoveId]].target;
|
||||
}
|
||||
|
||||
if (var1 & MOVE_TARGET_x10)
|
||||
if (var1 & MOVE_TARGET_USER)
|
||||
chosenMoveId |= (gActiveBattler << 8);
|
||||
else if (var1 == MOVE_TARGET_SELECTED)
|
||||
chosenMoveId |= (BattlePalaceGetTargetRetValue());
|
||||
@@ -261,7 +260,7 @@ static u8 sub_805D4A8(u16 move)
|
||||
switch (gBattleMoves[move].target)
|
||||
{
|
||||
case MOVE_TARGET_SELECTED:
|
||||
case MOVE_TARGET_USER:
|
||||
case MOVE_TARGET_USER_OR_SELECTED:
|
||||
case MOVE_TARGET_RANDOM:
|
||||
case MOVE_TARGET_BOTH:
|
||||
case MOVE_TARGET_FOES_AND_ALLY:
|
||||
@@ -273,7 +272,7 @@ static u8 sub_805D4A8(u16 move)
|
||||
case MOVE_TARGET_DEPENDS:
|
||||
case MOVE_TARGET_OPPONENTS_FIELD:
|
||||
return 2;
|
||||
case MOVE_TARGET_x10:
|
||||
case MOVE_TARGET_USER:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
|
||||
+96
-98
@@ -21,6 +21,7 @@
|
||||
#include "safari_zone.h"
|
||||
#include "battle_anim.h"
|
||||
#include "constants/rgb.h"
|
||||
#include "data2.h"
|
||||
|
||||
struct TestingBar
|
||||
{
|
||||
@@ -154,7 +155,6 @@ enum
|
||||
};
|
||||
|
||||
extern const u8 * const gNatureNamePointers[];
|
||||
extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1];
|
||||
|
||||
// strings
|
||||
extern const u8 gText_Slash[];
|
||||
@@ -162,8 +162,6 @@ extern const u8 gText_HighlightDarkGrey[];
|
||||
extern const u8 gText_DynColor2[];
|
||||
extern const u8 gText_DynColor2Male[];
|
||||
extern const u8 gText_DynColor1Female[];
|
||||
extern const u8 gText_SafariBalls[];
|
||||
extern const u8 gText_SafariBallLeft[];
|
||||
|
||||
// graphics
|
||||
extern const u8 gBattleInterface_BallStatusBarGfx[];
|
||||
@@ -198,10 +196,10 @@ static void SpriteCB_StatusSummaryBar(struct Sprite *sprite);
|
||||
static void SpriteCB_StatusSummaryBallsOnBattleStart(struct Sprite *sprite);
|
||||
static void SpriteCB_StatusSummaryBallsOnSwitchout(struct Sprite *sprite);
|
||||
|
||||
static u8 GetStatusIconForBankId(u8 statusElementId, u8 bank);
|
||||
static u8 GetStatusIconForBankId(u8 statusElementId, u8 battlerId);
|
||||
static s32 sub_8074DB8(s32 maxValue, s32 currValue, s32 receivedValue, s32 *arg3, u8 arg4, u16 arg5);
|
||||
static u8 GetScaledExpFraction(s32 currValue, s32 receivedValue, s32 maxValue, u8 scale);
|
||||
static void sub_8074B9C(u8 bank, u8 whichBar);
|
||||
static void sub_8074B9C(u8 battlerId, u8 whichBar);
|
||||
static u8 sub_8074E8C(s32 maxValue, s32 currValue, s32 receivedValue, s32 *arg3, u8 *arg4, u8 arg5);
|
||||
static void sub_8074F88(struct TestingBar *barInfo, s32 *arg1, u16 *arg2);
|
||||
|
||||
@@ -1034,13 +1032,13 @@ static void sub_8072924(struct Sprite *sprite)
|
||||
sprite->pos2.y = gSprites[otherSpriteId].pos2.y;
|
||||
}
|
||||
|
||||
void SetBattleBarStruct(u8 bank, u8 healthboxSpriteId, s32 maxVal, s32 currVal, s32 receivedValue)
|
||||
void SetBattleBarStruct(u8 battlerId, u8 healthboxSpriteId, s32 maxVal, s32 currVal, s32 receivedValue)
|
||||
{
|
||||
gBattleSpritesDataPtr->battleBars[bank].healthboxSpriteId = healthboxSpriteId;
|
||||
gBattleSpritesDataPtr->battleBars[bank].maxValue = maxVal;
|
||||
gBattleSpritesDataPtr->battleBars[bank].currentValue = currVal;
|
||||
gBattleSpritesDataPtr->battleBars[bank].receivedValue = receivedValue;
|
||||
gBattleSpritesDataPtr->battleBars[bank].field_10 = -32768;
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].healthboxSpriteId = healthboxSpriteId;
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].maxValue = maxVal;
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].currentValue = currVal;
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].receivedValue = receivedValue;
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].field_10 = -32768;
|
||||
}
|
||||
|
||||
void SetHealthboxSpriteInvisible(u8 healthboxSpriteId)
|
||||
@@ -1281,12 +1279,12 @@ static void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8
|
||||
}
|
||||
else
|
||||
{
|
||||
u8 bank;
|
||||
u8 battlerId;
|
||||
|
||||
memcpy(text, sUnknown_0832C3D8, sizeof(sUnknown_0832C3D8));
|
||||
bank = gSprites[healthboxSpriteId].data[6];
|
||||
battlerId = gSprites[healthboxSpriteId].data[6];
|
||||
|
||||
if (gBattleSpritesDataPtr->battlerData[bank].hpNumbersNoBars) // don't print text if only bars are visible
|
||||
if (gBattleSpritesDataPtr->battlerData[battlerId].hpNumbersNoBars) // don't print text if only bars are visible
|
||||
{
|
||||
u8 var = 4;
|
||||
u8 r7;
|
||||
@@ -1327,7 +1325,7 @@ static void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetBattlerSide(bank) == B_SIDE_PLAYER) // impossible to reach part, because the bank is from the opponent's side
|
||||
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) // impossible to reach part, because the battlerId is from the opponent's side
|
||||
{
|
||||
CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_116),
|
||||
(void*)(OBJ_VRAM0) + ((gSprites[healthboxSpriteId].oam.tileNum + 52) * 32),
|
||||
@@ -1469,7 +1467,7 @@ void SwapHpBarsWithHpText(void)
|
||||
}
|
||||
}
|
||||
|
||||
u8 CreatePartyStatusSummarySprites(u8 bank, struct HpAndStatus *partyInfo, u8 arg2, bool8 isBattleStart)
|
||||
u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo, u8 arg2, bool8 isBattleStart)
|
||||
{
|
||||
bool8 isOpponent;
|
||||
s16 bar_X, bar_Y, bar_pos2_X, bar_data0;
|
||||
@@ -1478,9 +1476,9 @@ u8 CreatePartyStatusSummarySprites(u8 bank, struct HpAndStatus *partyInfo, u8 ar
|
||||
u8 ballIconSpritesIds[6];
|
||||
u8 taskId;
|
||||
|
||||
if (!arg2 || GetBattlerPosition(bank) != B_POSITION_OPPONENT_RIGHT)
|
||||
if (!arg2 || GetBattlerPosition(battlerId) != B_POSITION_OPPONENT_RIGHT)
|
||||
{
|
||||
if (GetBattlerSide(bank) == B_SIDE_PLAYER)
|
||||
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
|
||||
{
|
||||
isOpponent = FALSE;
|
||||
bar_X = 136, bar_Y = 96;
|
||||
@@ -1559,7 +1557,7 @@ u8 CreatePartyStatusSummarySprites(u8 bank, struct HpAndStatus *partyInfo, u8 ar
|
||||
gSprites[ballIconSpritesIds[i]].data[2] = isOpponent;
|
||||
}
|
||||
|
||||
if (GetBattlerSide(bank) == B_SIDE_PLAYER)
|
||||
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
|
||||
{
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
|
||||
{
|
||||
@@ -1658,7 +1656,7 @@ u8 CreatePartyStatusSummarySprites(u8 bank, struct HpAndStatus *partyInfo, u8 ar
|
||||
}
|
||||
|
||||
taskId = CreateTask(TaskDummy, 5);
|
||||
gTasks[taskId].data[0] = bank;
|
||||
gTasks[taskId].data[0] = battlerId;
|
||||
gTasks[taskId].data[1] = barSpriteId;
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
@@ -1680,12 +1678,12 @@ void sub_8073C30(u8 taskId)
|
||||
u8 sp[6];
|
||||
u8 r7;
|
||||
u8 r10;
|
||||
u8 bank;
|
||||
u8 battlerId;
|
||||
s32 i;
|
||||
|
||||
r7 = gTasks[taskId].data[10];
|
||||
r10 = gTasks[taskId].data[1];
|
||||
bank = gTasks[taskId].data[0];
|
||||
battlerId = gTasks[taskId].data[0];
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
sp[i] = gTasks[taskId].data[3 + i];
|
||||
@@ -1704,7 +1702,7 @@ void sub_8073C30(u8 taskId)
|
||||
{
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
if (GetBattlerSide(bank) != B_SIDE_PLAYER)
|
||||
if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
|
||||
{
|
||||
gSprites[sp[5 - i]].data[1] = 7 * i;
|
||||
gSprites[sp[5 - i]].data[3] = 0;
|
||||
@@ -1752,7 +1750,7 @@ static void sub_8073E64(u8 taskId)
|
||||
u8 sp[6];
|
||||
s32 i;
|
||||
|
||||
u8 bank = gTasks[taskId].data[0];
|
||||
u8 battlerId = gTasks[taskId].data[0];
|
||||
gTasks[taskId].data[15]--;
|
||||
if (gTasks[taskId].data[15] == -1)
|
||||
{
|
||||
@@ -1780,7 +1778,7 @@ static void sub_8073E64(u8 taskId)
|
||||
}
|
||||
else if (gTasks[taskId].data[15] == -3)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[bank].flag_x1 = 0;
|
||||
gBattleSpritesDataPtr->healthBoxesData[battlerId].flag_x1 = 0;
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
||||
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
|
||||
DestroyTask(taskId);
|
||||
@@ -1792,7 +1790,7 @@ static void sub_8073F98(u8 taskId)
|
||||
u8 sp[6];
|
||||
s32 i;
|
||||
|
||||
u8 bank = gTasks[taskId].data[0];
|
||||
u8 battlerId = gTasks[taskId].data[0];
|
||||
gTasks[taskId].data[15]--;
|
||||
if (gTasks[taskId].data[15] >= 0)
|
||||
{
|
||||
@@ -1813,7 +1811,7 @@ static void sub_8073F98(u8 taskId)
|
||||
}
|
||||
else if (gTasks[taskId].data[15] == -3)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[bank].flag_x1 = 0;
|
||||
gBattleSpritesDataPtr->healthBoxesData[battlerId].flag_x1 = 0;
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
||||
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
|
||||
DestroyTask(taskId);
|
||||
@@ -1976,17 +1974,17 @@ static void UpdateNickInHealthbox(u8 healthboxSpriteId, struct Pokemon *mon)
|
||||
|
||||
static void TryAddPokeballIconToHealthbox(u8 healthboxSpriteId, bool8 noStatus)
|
||||
{
|
||||
u8 bank, healthboxSpriteId_2;
|
||||
u8 battlerId, healthboxSpriteId_2;
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL)
|
||||
return;
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER)
|
||||
return;
|
||||
|
||||
bank = gSprites[healthboxSpriteId].data[6];
|
||||
if (GetBattlerSide(bank) == B_SIDE_PLAYER)
|
||||
battlerId = gSprites[healthboxSpriteId].data[6];
|
||||
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
|
||||
return;
|
||||
if (!GetSetPokedexFlag(SpeciesToNationalPokedexNum(GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES)), FLAG_GET_CAUGHT))
|
||||
if (!GetSetPokedexFlag(SpeciesToNationalPokedexNum(GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES)), FLAG_GET_CAUGHT))
|
||||
return;
|
||||
|
||||
healthboxSpriteId_2 = gSprites[healthboxSpriteId].data[5];
|
||||
@@ -2000,17 +1998,17 @@ static void TryAddPokeballIconToHealthbox(u8 healthboxSpriteId, bool8 noStatus)
|
||||
static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId)
|
||||
{
|
||||
s32 i;
|
||||
u8 bank, healthboxSpriteId_2;
|
||||
u8 battlerId, healthboxSpriteId_2;
|
||||
u32 status, pltAdder;
|
||||
const u8 *statusGfxPtr;
|
||||
s16 tileNumAdder;
|
||||
u8 statusPalId;
|
||||
|
||||
bank = gSprites[healthboxSpriteId].data[6];
|
||||
battlerId = gSprites[healthboxSpriteId].data[6];
|
||||
healthboxSpriteId_2 = gSprites[healthboxSpriteId].data[5];
|
||||
if (GetBattlerSide(bank) == B_SIDE_PLAYER)
|
||||
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
|
||||
{
|
||||
status = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_STATUS);
|
||||
status = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_STATUS);
|
||||
if (!IsDoubleBattle())
|
||||
tileNumAdder = 0x1A;
|
||||
else
|
||||
@@ -2018,33 +2016,33 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId)
|
||||
}
|
||||
else
|
||||
{
|
||||
status = GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_STATUS);
|
||||
status = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_STATUS);
|
||||
tileNumAdder = 0x11;
|
||||
}
|
||||
|
||||
if (status & STATUS1_SLEEP)
|
||||
{
|
||||
statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBankId(HEALTHBOX_GFX_STATUS_SLP_BANK0, bank));
|
||||
statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBankId(HEALTHBOX_GFX_STATUS_SLP_BANK0, battlerId));
|
||||
statusPalId = PAL_STATUS_SLP;
|
||||
}
|
||||
else if (status & STATUS1_PSN_ANY)
|
||||
{
|
||||
statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBankId(HEALTHBOX_GFX_STATUS_PSN_BANK0, bank));
|
||||
statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBankId(HEALTHBOX_GFX_STATUS_PSN_BANK0, battlerId));
|
||||
statusPalId = PAL_STATUS_PSN;
|
||||
}
|
||||
else if (status & STATUS1_BURN)
|
||||
{
|
||||
statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBankId(HEALTHBOX_GFX_STATUS_BRN_BANK0, bank));
|
||||
statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBankId(HEALTHBOX_GFX_STATUS_BRN_BANK0, battlerId));
|
||||
statusPalId = PAL_STATUS_BRN;
|
||||
}
|
||||
else if (status & STATUS1_FREEZE)
|
||||
{
|
||||
statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBankId(HEALTHBOX_GFX_STATUS_FRZ_BANK0, bank));
|
||||
statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBankId(HEALTHBOX_GFX_STATUS_FRZ_BANK0, battlerId));
|
||||
statusPalId = PAL_STATUS_FRZ;
|
||||
}
|
||||
else if (status & STATUS1_PARALYSIS)
|
||||
{
|
||||
statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBankId(HEALTHBOX_GFX_STATUS_PRZ_BANK0, bank));
|
||||
statusGfxPtr = GetHealthboxElementGfxPtr(GetStatusIconForBankId(HEALTHBOX_GFX_STATUS_PRZ_BANK0, battlerId));
|
||||
statusPalId = PAL_STATUS_PAR;
|
||||
}
|
||||
else
|
||||
@@ -2054,7 +2052,7 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId)
|
||||
for (i = 0; i < 3; i++)
|
||||
CpuCopy32(statusGfxPtr, (void*)(OBJ_VRAM0 + (gSprites[healthboxSpriteId].oam.tileNum + tileNumAdder + i) * 32), 32);
|
||||
|
||||
if (!gBattleSpritesDataPtr->battlerData[bank].hpNumbersNoBars)
|
||||
if (!gBattleSpritesDataPtr->battlerData[battlerId].hpNumbersNoBars)
|
||||
CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_1), (void *)(OBJ_VRAM0 + gSprites[healthboxSpriteId_2].oam.tileNum * 32), 64);
|
||||
|
||||
TryAddPokeballIconToHealthbox(healthboxSpriteId, TRUE);
|
||||
@@ -2062,14 +2060,14 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId)
|
||||
}
|
||||
|
||||
pltAdder = gSprites[healthboxSpriteId].oam.paletteNum * 16;
|
||||
pltAdder += bank + 12;
|
||||
pltAdder += battlerId + 12;
|
||||
|
||||
FillPalette(sStatusIconColors[statusPalId], pltAdder + 0x100, 2);
|
||||
CpuCopy16(gPlttBufferUnfaded + 0x100 + pltAdder, (void*)(OBJ_PLTT + pltAdder * 2), 2);
|
||||
CpuCopy32(statusGfxPtr, (void*)(OBJ_VRAM0 + (gSprites[healthboxSpriteId].oam.tileNum + tileNumAdder) * 32), 96);
|
||||
if (IsDoubleBattle() == TRUE || GetBattlerSide(bank) == B_SIDE_OPPONENT)
|
||||
if (IsDoubleBattle() == TRUE || GetBattlerSide(battlerId) == B_SIDE_OPPONENT)
|
||||
{
|
||||
if (!gBattleSpritesDataPtr->battlerData[bank].hpNumbersNoBars)
|
||||
if (!gBattleSpritesDataPtr->battlerData[battlerId].hpNumbersNoBars)
|
||||
{
|
||||
CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_0), (void*)(OBJ_VRAM0 + gSprites[healthboxSpriteId_2].oam.tileNum * 32), 32);
|
||||
CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_65), (void*)(OBJ_VRAM0 + (gSprites[healthboxSpriteId_2].oam.tileNum + 1) * 32), 32);
|
||||
@@ -2078,58 +2076,58 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId)
|
||||
TryAddPokeballIconToHealthbox(healthboxSpriteId, FALSE);
|
||||
}
|
||||
|
||||
static u8 GetStatusIconForBankId(u8 statusElementId, u8 bank)
|
||||
static u8 GetStatusIconForBankId(u8 statusElementId, u8 battlerId)
|
||||
{
|
||||
u8 ret = statusElementId;
|
||||
|
||||
switch (statusElementId)
|
||||
{
|
||||
case HEALTHBOX_GFX_STATUS_PSN_BANK0:
|
||||
if (bank == 0)
|
||||
if (battlerId == 0)
|
||||
ret = HEALTHBOX_GFX_STATUS_PSN_BANK0;
|
||||
else if (bank == 1)
|
||||
else if (battlerId == 1)
|
||||
ret = HEALTHBOX_GFX_STATUS_PSN_BANK1;
|
||||
else if (bank == 2)
|
||||
else if (battlerId == 2)
|
||||
ret = HEALTHBOX_GFX_STATUS_PSN_BANK2;
|
||||
else
|
||||
ret = HEALTHBOX_GFX_STATUS_PSN_BANK3;
|
||||
break;
|
||||
case HEALTHBOX_GFX_STATUS_PRZ_BANK0:
|
||||
if (bank == 0)
|
||||
if (battlerId == 0)
|
||||
ret = HEALTHBOX_GFX_STATUS_PRZ_BANK0;
|
||||
else if (bank == 1)
|
||||
else if (battlerId == 1)
|
||||
ret = HEALTHBOX_GFX_STATUS_PRZ_BANK1;
|
||||
else if (bank == 2)
|
||||
else if (battlerId == 2)
|
||||
ret = HEALTHBOX_GFX_STATUS_PRZ_BANK2;
|
||||
else
|
||||
ret = HEALTHBOX_GFX_STATUS_PRZ_BANK3;
|
||||
break;
|
||||
case HEALTHBOX_GFX_STATUS_SLP_BANK0:
|
||||
if (bank == 0)
|
||||
if (battlerId == 0)
|
||||
ret = HEALTHBOX_GFX_STATUS_SLP_BANK0;
|
||||
else if (bank == 1)
|
||||
else if (battlerId == 1)
|
||||
ret = HEALTHBOX_GFX_STATUS_SLP_BANK1;
|
||||
else if (bank == 2)
|
||||
else if (battlerId == 2)
|
||||
ret = HEALTHBOX_GFX_STATUS_SLP_BANK2;
|
||||
else
|
||||
ret = HEALTHBOX_GFX_STATUS_SLP_BANK3;
|
||||
break;
|
||||
case HEALTHBOX_GFX_STATUS_FRZ_BANK0:
|
||||
if (bank == 0)
|
||||
if (battlerId == 0)
|
||||
ret = HEALTHBOX_GFX_STATUS_FRZ_BANK0;
|
||||
else if (bank == 1)
|
||||
else if (battlerId == 1)
|
||||
ret = HEALTHBOX_GFX_STATUS_FRZ_BANK1;
|
||||
else if (bank == 2)
|
||||
else if (battlerId == 2)
|
||||
ret = HEALTHBOX_GFX_STATUS_FRZ_BANK2;
|
||||
else
|
||||
ret = HEALTHBOX_GFX_STATUS_FRZ_BANK3;
|
||||
break;
|
||||
case HEALTHBOX_GFX_STATUS_BRN_BANK0:
|
||||
if (bank == 0)
|
||||
if (battlerId == 0)
|
||||
ret = HEALTHBOX_GFX_STATUS_BRN_BANK0;
|
||||
else if (bank == 1)
|
||||
else if (battlerId == 1)
|
||||
ret = HEALTHBOX_GFX_STATUS_BRN_BANK1;
|
||||
else if (bank == 2)
|
||||
else if (battlerId == 2)
|
||||
ret = HEALTHBOX_GFX_STATUS_BRN_BANK2;
|
||||
else
|
||||
ret = HEALTHBOX_GFX_STATUS_BRN_BANK3;
|
||||
@@ -2170,10 +2168,10 @@ static void UpdateLeftNoOfBallsTextOnHealthbox(u8 healthboxSpriteId)
|
||||
void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elementId)
|
||||
{
|
||||
s32 maxHp, currHp;
|
||||
u8 bank = gSprites[healthboxSpriteId].data[6];
|
||||
u8 battlerId = gSprites[healthboxSpriteId].data[6];
|
||||
|
||||
if (elementId == HEALTHBOX_ALL && !IsDoubleBattle())
|
||||
GetBattlerSide(bank); // pointless function call
|
||||
GetBattlerSide(battlerId); // pointless function call
|
||||
|
||||
if (GetBattlerSide(gSprites[healthboxSpriteId].data[6]) == B_SIDE_PLAYER)
|
||||
{
|
||||
@@ -2190,8 +2188,8 @@ void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elem
|
||||
LoadBattleBarGfx(0);
|
||||
maxHp = GetMonData(mon, MON_DATA_MAX_HP);
|
||||
currHp = GetMonData(mon, MON_DATA_HP);
|
||||
SetBattleBarStruct(bank, healthboxSpriteId, maxHp, currHp, 0);
|
||||
sub_8074AA0(bank, healthboxSpriteId, HEALTH_BAR, 0);
|
||||
SetBattleBarStruct(battlerId, healthboxSpriteId, maxHp, currHp, 0);
|
||||
sub_8074AA0(battlerId, healthboxSpriteId, HEALTH_BAR, 0);
|
||||
}
|
||||
isDoubles = IsDoubleBattle();
|
||||
if (!isDoubles && (elementId == HEALTHBOX_EXP_BAR || elementId == HEALTHBOX_ALL))
|
||||
@@ -2208,8 +2206,8 @@ void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elem
|
||||
currLevelExp = gExperienceTables[gBaseStats[species].growthRate][level];
|
||||
currExpBarValue = exp - currLevelExp;
|
||||
maxExpBarValue = gExperienceTables[gBaseStats[species].growthRate][level + 1] - currLevelExp;
|
||||
SetBattleBarStruct(bank, healthboxSpriteId, maxExpBarValue, currExpBarValue, isDoubles);
|
||||
sub_8074AA0(bank, healthboxSpriteId, EXP_BAR, 0);
|
||||
SetBattleBarStruct(battlerId, healthboxSpriteId, maxExpBarValue, currExpBarValue, isDoubles);
|
||||
sub_8074AA0(battlerId, healthboxSpriteId, EXP_BAR, 0);
|
||||
}
|
||||
if (elementId == HEALTHBOX_NICK || elementId == HEALTHBOX_ALL)
|
||||
UpdateNickInHealthbox(healthboxSpriteId, mon);
|
||||
@@ -2229,8 +2227,8 @@ void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elem
|
||||
LoadBattleBarGfx(0);
|
||||
maxHp = GetMonData(mon, MON_DATA_MAX_HP);
|
||||
currHp = GetMonData(mon, MON_DATA_HP);
|
||||
SetBattleBarStruct(bank, healthboxSpriteId, maxHp, currHp, 0);
|
||||
sub_8074AA0(bank, healthboxSpriteId, HEALTH_BAR, 0);
|
||||
SetBattleBarStruct(battlerId, healthboxSpriteId, maxHp, currHp, 0);
|
||||
sub_8074AA0(battlerId, healthboxSpriteId, HEALTH_BAR, 0);
|
||||
}
|
||||
if (elementId == HEALTHBOX_NICK || elementId == HEALTHBOX_ALL)
|
||||
UpdateNickInHealthbox(healthboxSpriteId, mon);
|
||||
@@ -2239,44 +2237,44 @@ void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elem
|
||||
}
|
||||
}
|
||||
|
||||
s32 sub_8074AA0(u8 bank, u8 healthboxSpriteId, u8 whichBar, u8 arg3)
|
||||
s32 sub_8074AA0(u8 battlerId, u8 healthboxSpriteId, u8 whichBar, u8 arg3)
|
||||
{
|
||||
s32 var;
|
||||
|
||||
if (whichBar == HEALTH_BAR) // health bar
|
||||
{
|
||||
var = sub_8074DB8(gBattleSpritesDataPtr->battleBars[bank].maxValue,
|
||||
gBattleSpritesDataPtr->battleBars[bank].currentValue,
|
||||
gBattleSpritesDataPtr->battleBars[bank].receivedValue,
|
||||
&gBattleSpritesDataPtr->battleBars[bank].field_10,
|
||||
var = sub_8074DB8(gBattleSpritesDataPtr->battleBars[battlerId].maxValue,
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].currentValue,
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].receivedValue,
|
||||
&gBattleSpritesDataPtr->battleBars[battlerId].field_10,
|
||||
6, 1);
|
||||
}
|
||||
else // exp bar
|
||||
{
|
||||
u16 expFraction = GetScaledExpFraction(gBattleSpritesDataPtr->battleBars[bank].currentValue,
|
||||
gBattleSpritesDataPtr->battleBars[bank].receivedValue,
|
||||
gBattleSpritesDataPtr->battleBars[bank].maxValue, 8);
|
||||
u16 expFraction = GetScaledExpFraction(gBattleSpritesDataPtr->battleBars[battlerId].currentValue,
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].receivedValue,
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].maxValue, 8);
|
||||
if (expFraction == 0)
|
||||
expFraction = 1;
|
||||
expFraction = abs(gBattleSpritesDataPtr->battleBars[bank].receivedValue / expFraction);
|
||||
expFraction = abs(gBattleSpritesDataPtr->battleBars[battlerId].receivedValue / expFraction);
|
||||
|
||||
var = sub_8074DB8(gBattleSpritesDataPtr->battleBars[bank].maxValue,
|
||||
gBattleSpritesDataPtr->battleBars[bank].currentValue,
|
||||
gBattleSpritesDataPtr->battleBars[bank].receivedValue,
|
||||
&gBattleSpritesDataPtr->battleBars[bank].field_10,
|
||||
var = sub_8074DB8(gBattleSpritesDataPtr->battleBars[battlerId].maxValue,
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].currentValue,
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].receivedValue,
|
||||
&gBattleSpritesDataPtr->battleBars[battlerId].field_10,
|
||||
8, expFraction);
|
||||
}
|
||||
|
||||
if (whichBar == EXP_BAR || (whichBar == HEALTH_BAR && !gBattleSpritesDataPtr->battlerData[bank].hpNumbersNoBars))
|
||||
sub_8074B9C(bank, whichBar);
|
||||
if (whichBar == EXP_BAR || (whichBar == HEALTH_BAR && !gBattleSpritesDataPtr->battlerData[battlerId].hpNumbersNoBars))
|
||||
sub_8074B9C(battlerId, whichBar);
|
||||
|
||||
if (var == -1)
|
||||
gBattleSpritesDataPtr->battleBars[bank].field_10 = 0;
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].field_10 = 0;
|
||||
|
||||
return var;
|
||||
}
|
||||
|
||||
static void sub_8074B9C(u8 bank, u8 whichBar)
|
||||
static void sub_8074B9C(u8 battlerId, u8 whichBar)
|
||||
{
|
||||
u8 array[8];
|
||||
u8 subRet, level;
|
||||
@@ -2286,10 +2284,10 @@ static void sub_8074B9C(u8 bank, u8 whichBar)
|
||||
switch (whichBar)
|
||||
{
|
||||
case HEALTH_BAR:
|
||||
subRet = sub_8074E8C(gBattleSpritesDataPtr->battleBars[bank].maxValue,
|
||||
gBattleSpritesDataPtr->battleBars[bank].currentValue,
|
||||
gBattleSpritesDataPtr->battleBars[bank].receivedValue,
|
||||
&gBattleSpritesDataPtr->battleBars[bank].field_10,
|
||||
subRet = sub_8074E8C(gBattleSpritesDataPtr->battleBars[battlerId].maxValue,
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].currentValue,
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].receivedValue,
|
||||
&gBattleSpritesDataPtr->battleBars[battlerId].field_10,
|
||||
array, 6);
|
||||
barElementId = 3;
|
||||
if (subRet <= 0x18)
|
||||
@@ -2300,7 +2298,7 @@ static void sub_8074B9C(u8 bank, u8 whichBar)
|
||||
}
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
u8 healthboxSpriteId_2 = gSprites[gBattleSpritesDataPtr->battleBars[bank].healthboxSpriteId].data[5];
|
||||
u8 healthboxSpriteId_2 = gSprites[gBattleSpritesDataPtr->battleBars[battlerId].healthboxSpriteId].data[5];
|
||||
if (i < 2)
|
||||
CpuCopy32(GetHealthboxElementGfxPtr(barElementId) + array[i] * 32,
|
||||
(void*)(OBJ_VRAM0 + (gSprites[healthboxSpriteId_2].oam.tileNum + 2 + i) * 32), 32);
|
||||
@@ -2310,12 +2308,12 @@ static void sub_8074B9C(u8 bank, u8 whichBar)
|
||||
}
|
||||
break;
|
||||
case EXP_BAR:
|
||||
sub_8074E8C(gBattleSpritesDataPtr->battleBars[bank].maxValue,
|
||||
gBattleSpritesDataPtr->battleBars[bank].currentValue,
|
||||
gBattleSpritesDataPtr->battleBars[bank].receivedValue,
|
||||
&gBattleSpritesDataPtr->battleBars[bank].field_10,
|
||||
sub_8074E8C(gBattleSpritesDataPtr->battleBars[battlerId].maxValue,
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].currentValue,
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].receivedValue,
|
||||
&gBattleSpritesDataPtr->battleBars[battlerId].field_10,
|
||||
array, 8);
|
||||
level = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_LEVEL);
|
||||
level = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_LEVEL);
|
||||
if (level == MAX_MON_LEVEL)
|
||||
{
|
||||
for (i = 0; i < 8; i++)
|
||||
@@ -2325,10 +2323,10 @@ static void sub_8074B9C(u8 bank, u8 whichBar)
|
||||
{
|
||||
if (i < 4)
|
||||
CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_12) + array[i] * 32,
|
||||
(void*)(OBJ_VRAM0 + (gSprites[gBattleSpritesDataPtr->battleBars[bank].healthboxSpriteId].oam.tileNum + 0x24 + i) * 32), 32);
|
||||
(void*)(OBJ_VRAM0 + (gSprites[gBattleSpritesDataPtr->battleBars[battlerId].healthboxSpriteId].oam.tileNum + 0x24 + i) * 32), 32);
|
||||
else
|
||||
CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_12) + array[i] * 32,
|
||||
(void*)(OBJ_VRAM0 + 0xB80 + (i + gSprites[gBattleSpritesDataPtr->battleBars[bank].healthboxSpriteId].oam.tileNum) * 32), 32);
|
||||
(void*)(OBJ_VRAM0 + 0xB80 + (i + gSprites[gBattleSpritesDataPtr->battleBars[battlerId].healthboxSpriteId].oam.tileNum) * 32), 32);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
+213
-15
@@ -81,7 +81,6 @@ extern struct MusicPlayerInfo gMPlayInfo_SE1;
|
||||
extern struct MusicPlayerInfo gMPlayInfo_SE2;
|
||||
extern u8 gUnknown_0203CF00[];
|
||||
|
||||
extern const struct BattleMove gBattleMoves[];
|
||||
extern const u16 gBattleTextboxPalette[]; // battle textbox palette
|
||||
extern const struct BgTemplate gUnknown_0831AA08[];
|
||||
extern const struct WindowTemplate * const gUnknown_0831ABA0[];
|
||||
@@ -95,12 +94,8 @@ extern const struct ScanlineEffectParams gUnknown_0831AC70;
|
||||
|
||||
// strings
|
||||
extern const u8 gText_LinkStandby3[];
|
||||
extern const u8 gText_RecordBattleToPass[];
|
||||
extern const u8 gText_BattleYesNoChoice[];
|
||||
extern const u8 gText_BattleRecordCouldntBeSaved[];
|
||||
extern const u8 gText_BattleRecordedOnPass[];
|
||||
extern const u8 gText_ShedinjaJapaneseName[];
|
||||
extern const u8 gText_EmptyString3[];
|
||||
extern const u8 gText_Poison[];
|
||||
extern const u8 gText_Sleep[];
|
||||
extern const u8 gText_Paralysis[];
|
||||
@@ -301,6 +296,214 @@ u8 gNumberOfMovesToChoose;
|
||||
u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT];
|
||||
|
||||
// rom const data
|
||||
|
||||
// format: attacking type, defending type, damage multiplier
|
||||
// the multiplier is a (decimal) fixed-point number:
|
||||
// 20 is ×2.0 TYPE_MUL_SUPER_EFFECTIVE
|
||||
// 10 is ×1.0 TYPE_MUL_NORMAL
|
||||
// 05 is ×0.5 TYPE_MUL_NOT_EFFECTIVE
|
||||
// 00 is ×0.0 TYPE_MUL_NO_EFFECT
|
||||
const u8 gTypeEffectiveness[336] =
|
||||
{
|
||||
TYPE_NORMAL, TYPE_ROCK, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_NORMAL, TYPE_STEEL, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_FIRE, TYPE_FIRE, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_FIRE, TYPE_WATER, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_FIRE, TYPE_GRASS, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_FIRE, TYPE_ICE, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_FIRE, TYPE_BUG, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_FIRE, TYPE_ROCK, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_FIRE, TYPE_DRAGON, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_FIRE, TYPE_STEEL, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_WATER, TYPE_FIRE, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_WATER, TYPE_WATER, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_WATER, TYPE_GRASS, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_WATER, TYPE_GROUND, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_WATER, TYPE_ROCK, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_WATER, TYPE_DRAGON, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_ELECTRIC, TYPE_WATER, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_ELECTRIC, TYPE_ELECTRIC, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_ELECTRIC, TYPE_GRASS, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_ELECTRIC, TYPE_GROUND, TYPE_MUL_NO_EFFECT,
|
||||
TYPE_ELECTRIC, TYPE_FLYING, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_ELECTRIC, TYPE_DRAGON, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_GRASS, TYPE_FIRE, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_GRASS, TYPE_WATER, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_GRASS, TYPE_GRASS, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_GRASS, TYPE_POISON, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_GRASS, TYPE_GROUND, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_GRASS, TYPE_FLYING, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_GRASS, TYPE_BUG, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_GRASS, TYPE_ROCK, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_GRASS, TYPE_DRAGON, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_GRASS, TYPE_STEEL, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_ICE, TYPE_WATER, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_ICE, TYPE_GRASS, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_ICE, TYPE_ICE, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_ICE, TYPE_GROUND, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_ICE, TYPE_FLYING, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_ICE, TYPE_DRAGON, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_ICE, TYPE_STEEL, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_ICE, TYPE_FIRE, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_FIGHTING, TYPE_NORMAL, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_FIGHTING, TYPE_ICE, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_FIGHTING, TYPE_POISON, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_FIGHTING, TYPE_FLYING, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_FIGHTING, TYPE_PSYCHIC, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_FIGHTING, TYPE_BUG, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_FIGHTING, TYPE_ROCK, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_FIGHTING, TYPE_DARK, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_FIGHTING, TYPE_STEEL, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_POISON, TYPE_GRASS, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_POISON, TYPE_POISON, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_POISON, TYPE_GROUND, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_POISON, TYPE_ROCK, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_POISON, TYPE_GHOST, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_POISON, TYPE_STEEL, TYPE_MUL_NO_EFFECT,
|
||||
TYPE_GROUND, TYPE_FIRE, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_GROUND, TYPE_ELECTRIC, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_GROUND, TYPE_GRASS, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_GROUND, TYPE_POISON, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_GROUND, TYPE_FLYING, TYPE_MUL_NO_EFFECT,
|
||||
TYPE_GROUND, TYPE_BUG, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_GROUND, TYPE_ROCK, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_GROUND, TYPE_STEEL, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_FLYING, TYPE_ELECTRIC, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_FLYING, TYPE_GRASS, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_FLYING, TYPE_FIGHTING, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_FLYING, TYPE_BUG, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_FLYING, TYPE_ROCK, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_FLYING, TYPE_STEEL, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_PSYCHIC, TYPE_FIGHTING, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_PSYCHIC, TYPE_POISON, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_PSYCHIC, TYPE_PSYCHIC, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_PSYCHIC, TYPE_DARK, TYPE_MUL_NO_EFFECT,
|
||||
TYPE_PSYCHIC, TYPE_STEEL, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_BUG, TYPE_FIRE, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_BUG, TYPE_GRASS, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_BUG, TYPE_FIGHTING, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_BUG, TYPE_POISON, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_BUG, TYPE_FLYING, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_BUG, TYPE_PSYCHIC, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_BUG, TYPE_GHOST, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_BUG, TYPE_DARK, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_BUG, TYPE_STEEL, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_ROCK, TYPE_FIRE, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_ROCK, TYPE_ICE, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_ROCK, TYPE_FIGHTING, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_ROCK, TYPE_GROUND, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_ROCK, TYPE_FLYING, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_ROCK, TYPE_BUG, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_ROCK, TYPE_STEEL, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_GHOST, TYPE_NORMAL, TYPE_MUL_NO_EFFECT,
|
||||
TYPE_GHOST, TYPE_PSYCHIC, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_GHOST, TYPE_DARK, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_GHOST, TYPE_STEEL, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_GHOST, TYPE_GHOST, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_DRAGON, TYPE_DRAGON, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_DRAGON, TYPE_STEEL, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_DARK, TYPE_FIGHTING, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_DARK, TYPE_PSYCHIC, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_DARK, TYPE_GHOST, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_DARK, TYPE_DARK, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_DARK, TYPE_STEEL, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_STEEL, TYPE_FIRE, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_STEEL, TYPE_WATER, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_STEEL, TYPE_ELECTRIC, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_STEEL, TYPE_ICE, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_STEEL, TYPE_ROCK, TYPE_MUL_SUPER_EFFECTIVE,
|
||||
TYPE_STEEL, TYPE_STEEL, TYPE_MUL_NOT_EFFECTIVE,
|
||||
TYPE_FORESIGHT, TYPE_FORESIGHT, TYPE_MUL_NO_EFFECT,
|
||||
TYPE_NORMAL, TYPE_GHOST, TYPE_MUL_NO_EFFECT,
|
||||
TYPE_FIGHTING, TYPE_GHOST, TYPE_MUL_NO_EFFECT,
|
||||
TYPE_ENDTABLE, TYPE_ENDTABLE, TYPE_MUL_NO_EFFECT
|
||||
};
|
||||
|
||||
const u8 gTypeNames[][TYPE_NAME_LENGTH + 1] =
|
||||
{
|
||||
_("NORMAL"),
|
||||
_("FIGHT"),
|
||||
_("FLYING"),
|
||||
_("POISON"),
|
||||
_("GROUND"),
|
||||
_("ROCK"),
|
||||
_("BUG"),
|
||||
_("GHOST"),
|
||||
_("STEEL"),
|
||||
_("???"),
|
||||
_("FIRE"),
|
||||
_("WATER"),
|
||||
_("GRASS"),
|
||||
_("ELECTR"),
|
||||
_("PSYCHC"),
|
||||
_("ICE"),
|
||||
_("DRAGON"),
|
||||
_("DARK"),
|
||||
};
|
||||
|
||||
// This is a factor in how much money you get for beating a trainer.
|
||||
const struct TrainerMoney gTrainerMoneyTable[] =
|
||||
{
|
||||
{TRAINER_CLASS_TEAM_AQUA, 5},
|
||||
{TRAINER_CLASS_AQUA_ADMIN, 10},
|
||||
{TRAINER_CLASS_AQUA_LEADER, 20},
|
||||
{TRAINER_CLASS_AROMA_LADY, 10},
|
||||
{TRAINER_CLASS_RUIN_MANIAC, 15},
|
||||
{TRAINER_CLASS_INTERVIEWER, 12},
|
||||
{TRAINER_CLASS_TUBER_1, 1},
|
||||
{TRAINER_CLASS_TUBER_2, 1},
|
||||
{TRAINER_CLASS_SIS_AND_BRO, 3},
|
||||
{TRAINER_CLASS_COOLTRAINER_1, 12},
|
||||
{TRAINER_CLASS_HEX_MANIAC, 6},
|
||||
{TRAINER_CLASS_LADY, 50},
|
||||
{TRAINER_CLASS_BEAUTY, 20},
|
||||
{TRAINER_CLASS_RICH_BOY, 50},
|
||||
{TRAINER_CLASS_POKEMANIAC, 15},
|
||||
{TRAINER_CLASS_SWIMMER_M, 2},
|
||||
{TRAINER_CLASS_BLACK_BELT, 8},
|
||||
{TRAINER_CLASS_GUITARIST, 8},
|
||||
{TRAINER_CLASS_KINDLER, 8},
|
||||
{TRAINER_CLASS_CAMPER, 4},
|
||||
{TRAINER_CLASS_OLD_COUPLE, 10},
|
||||
{TRAINER_CLASS_BUG_MANIAC, 15},
|
||||
{TRAINER_CLASS_PSYCHIC, 6},
|
||||
{TRAINER_CLASS_GENTLEMAN, 20},
|
||||
{TRAINER_CLASS_ELITE_FOUR, 25},
|
||||
{TRAINER_CLASS_LEADER, 25},
|
||||
{TRAINER_CLASS_SCHOOL_KID, 5},
|
||||
{TRAINER_CLASS_SR_AND_JR, 4},
|
||||
{TRAINER_CLASS_POKEFAN, 20},
|
||||
{TRAINER_CLASS_EXPERT, 10},
|
||||
{TRAINER_CLASS_YOUNGSTER, 4},
|
||||
{TRAINER_CLASS_CHAMPION, 50},
|
||||
{TRAINER_CLASS_FISHERMAN, 10},
|
||||
{TRAINER_CLASS_TRIATHLETE, 10},
|
||||
{TRAINER_CLASS_DRAGON_TAMER, 12},
|
||||
{TRAINER_CLASS_BIRD_KEEPER, 8},
|
||||
{TRAINER_CLASS_NINJA_BOY, 3},
|
||||
{TRAINER_CLASS_BATTLE_GIRL, 6},
|
||||
{TRAINER_CLASS_PARASOL_LADY, 10},
|
||||
{TRAINER_CLASS_SWIMMER_F, 2},
|
||||
{TRAINER_CLASS_PICNICKER, 4},
|
||||
{TRAINER_CLASS_TWINS, 3},
|
||||
{TRAINER_CLASS_SAILOR, 8},
|
||||
{TRAINER_CLASS_COLLECTOR, 15},
|
||||
{TRAINER_CLASS_PKMN_TRAINER_3, 15},
|
||||
{TRAINER_CLASS_PKMN_BREEDER, 10},
|
||||
{TRAINER_CLASS_PKMN_RANGER, 12},
|
||||
{TRAINER_CLASS_TEAM_MAGMA, 5},
|
||||
{TRAINER_CLASS_MAGMA_ADMIN, 10},
|
||||
{TRAINER_CLASS_MAGMA_LEADER, 20},
|
||||
{TRAINER_CLASS_LASS, 4},
|
||||
{TRAINER_CLASS_BUG_CATCHER, 4},
|
||||
{TRAINER_CLASS_HIKER, 10},
|
||||
{TRAINER_CLASS_YOUNG_COUPLE, 8},
|
||||
{TRAINER_CLASS_WINSTRATE, 10},
|
||||
{0xFF, 5},
|
||||
};
|
||||
|
||||
#include "data/text/abilities.h"
|
||||
|
||||
static void (* const sTurnActionsFuncsTable[])(void) =
|
||||
{
|
||||
HandleAction_UseMove, // B_ACTION_USE_MOVE
|
||||
@@ -3387,7 +3590,6 @@ static void BattleIntroOpponent1SendsOutMonAnimation(void)
|
||||
|
||||
gBattleMainFunc = BattleIntroRecordMonsToDex;
|
||||
}
|
||||
|
||||
#else
|
||||
ASM_DIRECT
|
||||
static void BattleIntroOpponent1SendsOutMonAnimation(void)
|
||||
@@ -3474,7 +3676,6 @@ _0803B2F2:\n\
|
||||
.pool\n\
|
||||
.syntax divided");
|
||||
}
|
||||
|
||||
#endif // NONMATCHING
|
||||
|
||||
static void BattleIntroRecordMonsToDex(void)
|
||||
@@ -3835,8 +4036,7 @@ u8 IsRunningFromBattleImpossible(void)
|
||||
}
|
||||
if (side != GetBattlerSide(i)
|
||||
&& gBattleMons[gActiveBattler].ability != ABILITY_LEVITATE
|
||||
&& gBattleMons[gActiveBattler].type1 != TYPE_FLYING
|
||||
&& gBattleMons[gActiveBattler].type2 != TYPE_FLYING
|
||||
&& !IS_BATTLER_OF_TYPE(gActiveBattler, TYPE_FLYING)
|
||||
&& gBattleMons[i].ability == ABILITY_ARENA_TRAP)
|
||||
{
|
||||
gBattleScripting.battler = i;
|
||||
@@ -3846,7 +4046,7 @@ u8 IsRunningFromBattleImpossible(void)
|
||||
}
|
||||
}
|
||||
i = AbilityBattleEffects(ABILITYEFFECT_CHECK_FIELD_EXCEPT_BANK, gActiveBattler, ABILITY_MAGNET_PULL, 0, 0);
|
||||
if (i != 0 && (gBattleMons[gActiveBattler].type1 == TYPE_STEEL || gBattleMons[gActiveBattler].type2 == TYPE_STEEL))
|
||||
if (i != 0 && IS_BATTLER_OF_TYPE(gActiveBattler, TYPE_STEEL))
|
||||
{
|
||||
gBattleScripting.battler = i - 1;
|
||||
gLastUsedAbility = gBattleMons[i - 1].ability;
|
||||
@@ -4033,12 +4233,10 @@ static void HandleTurnActionSelectionState(void)
|
||||
}
|
||||
else if ((i = AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, gActiveBattler, ABILITY_SHADOW_TAG, 0, 0))
|
||||
|| ((i = AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, gActiveBattler, ABILITY_ARENA_TRAP, 0, 0))
|
||||
&& gBattleMons[gActiveBattler].type1 != TYPE_FLYING
|
||||
&& gBattleMons[gActiveBattler].type2 != TYPE_FLYING
|
||||
&& !IS_BATTLER_OF_TYPE(gActiveBattler, TYPE_FLYING)
|
||||
&& gBattleMons[gActiveBattler].ability != ABILITY_LEVITATE)
|
||||
|| ((i = AbilityBattleEffects(ABILITYEFFECT_CHECK_FIELD_EXCEPT_BANK, gActiveBattler, ABILITY_MAGNET_PULL, 0, 0))
|
||||
&& (gBattleMons[gActiveBattler].type1 == TYPE_STEEL
|
||||
|| gBattleMons[gActiveBattler].type2 == TYPE_STEEL)))
|
||||
&& IS_BATTLER_OF_TYPE(gActiveBattler, TYPE_STEEL)))
|
||||
{
|
||||
BtlController_EmitChoosePokemon(0, ((i - 1) << 4) | 4, 6, gLastUsedAbility, gBattleStruct->field_60[gActiveBattler]);
|
||||
}
|
||||
@@ -5133,7 +5331,7 @@ static void HandleAction_UseMove(void)
|
||||
else if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||
&& gSideTimers[side].followmeTimer == 0
|
||||
&& (gBattleMoves[gCurrentMove].power != 0
|
||||
|| gBattleMoves[gCurrentMove].target != MOVE_TARGET_x10)
|
||||
|| gBattleMoves[gCurrentMove].target != MOVE_TARGET_USER)
|
||||
&& gBattleMons[*(gBattleStruct->moveTarget + gBattlerAttacker)].ability != ABILITY_LIGHTNING_ROD
|
||||
&& gBattleMoves[gCurrentMove].type == TYPE_ELECTRIC)
|
||||
{
|
||||
|
||||
+972
-974
File diff suppressed because it is too large
Load Diff
+269
-716
File diff suppressed because it is too large
Load Diff
+82
-87
@@ -31,6 +31,8 @@
|
||||
#include "string_util.h"
|
||||
#include "overworld.h"
|
||||
#include "field_weather.h"
|
||||
#include "gym_leader_rematch.h"
|
||||
#include "field_map_obj_helpers.h"
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -55,19 +57,12 @@ extern bool8 InBattlePyramid(void);
|
||||
extern bool8 InBattlePike(void);
|
||||
extern bool32 InTrainerHill(void);
|
||||
extern bool32 FieldPoisonEffectIsRunning(void);
|
||||
extern void overworld_free_bg_tilemaps(void);
|
||||
extern void prev_quest_postbuffer_cursor_backup_reset(void);
|
||||
extern void ResetPoisonStepCounter(void);
|
||||
extern void sub_81BE72C(void);
|
||||
extern void FreezeMapObjects(void);
|
||||
extern void sub_808BCF4(void);
|
||||
extern void sub_80EECC8(void);
|
||||
extern void Overworld_ClearSavedMusic(void);
|
||||
extern void CB2_WhiteOut(void);
|
||||
extern void sub_80AF6F0(void);
|
||||
extern void PlayBattleBGM(void);
|
||||
extern void sub_81DA57C(void);
|
||||
extern u8 Overworld_GetFlashLevel(void);
|
||||
extern u16 sub_81A9AA8(u8 localId);
|
||||
extern u16 sub_81D6180(u8 localId);
|
||||
extern bool8 GetBattlePyramidTrainerFlag(u8 mapObjId);
|
||||
@@ -252,84 +247,84 @@ static const struct TrainerBattleParameter sTrainerBContinueScriptBattleParams[]
|
||||
|
||||
const struct RematchTrainer gRematchTable[REMATCH_TABLE_ENTRIES] =
|
||||
{
|
||||
{{0x0025, 0x0028, 0x0029, 0x002a, 0x002b}, 0x0000, 0x0021},
|
||||
{{0x02e1, 0x032c, 0x032d, 0x032e, 0x032f}, 0x0000, 0x0014},
|
||||
{{0x002c, 0x002f, 0x0030, 0x0031, 0x0032}, 0x0000, 0x001a},
|
||||
{{0x0039, 0x003c, 0x003d, 0x003e, 0x003f}, 0x0000, 0x0018},
|
||||
{{0x0040, 0x0043, 0x0044, 0x0045, 0x0046}, 0x0000, 0x0018},
|
||||
{{0x02af, 0x02b0, 0x02b1, 0x02b2, 0x02b3}, 0x0000, 0x0027},
|
||||
{{0x02ff, 0x033c, 0x033d, 0x033e, 0x033f}, 0x0000, 0x0024},
|
||||
{{0x005e, 0x0065, 0x0066, 0x0067, 0x0068}, 0x0000, 0x001a},
|
||||
{{0x004e, 0x0054, 0x0055, 0x0056, 0x0057}, 0x0000, 0x001a},
|
||||
{{0x006c, 0x006e, 0x006f, 0x0070, 0x0071}, 0x0018, 0x0014},
|
||||
{{0x0072, 0x0078, 0x0079, 0x007a, 0x007b}, 0x0000, 0x0013},
|
||||
{{0x0090, 0x034c, 0x034d, 0x034e, 0x034f}, 0x0018, 0x0038},
|
||||
{{0x007f, 0x0084, 0x0085, 0x0086, 0x0087}, 0x0000, 0x0024},
|
||||
{{0x0088, 0x008b, 0x008c, 0x008d, 0x008e}, 0x0000, 0x0013},
|
||||
{{0x008f, 0x0093, 0x0094, 0x0095, 0x0096}, 0x0000, 0x001d},
|
||||
{{0x009b, 0x00af, 0x00b0, 0x00b1, 0x00b2}, 0x0000, 0x0016},
|
||||
{{0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb}, 0x0000, 0x001e},
|
||||
{{0x02a0, 0x0338, 0x0339, 0x033a, 0x033b}, 0x0000, 0x002a},
|
||||
{{0x00c3, 0x0340, 0x0341, 0x0342, 0x0343}, 0x0000, 0x0026},
|
||||
{{0x00c4, 0x00c5, 0x00c6, 0x00c7, 0x00c8}, 0x0000, 0x0021},
|
||||
{{0x00ce, 0x00cf, 0x00d0, 0x00d1, 0x00d2}, 0x0000, 0x001d},
|
||||
{{0x00d8, 0x00db, 0x00dc, 0x00dd, 0x00de}, 0x0018, 0x000d},
|
||||
{{0x02a9, 0x02aa, 0x02ab, 0x02ac, 0x02ad}, 0x0018, 0x0001},
|
||||
{{0x00e2, 0x00e4, 0x00e5, 0x00e6, 0x00e7}, 0x0000, 0x0023},
|
||||
{{0x00ee, 0x00ef, 0x00f0, 0x00f1, 0x00f2}, 0x0000, 0x0026},
|
||||
{{0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd}, 0x0000, 0x0026},
|
||||
{{0x00fe, 0x0101, 0x0102, 0x0103, 0x0104}, 0x0000, 0x0024},
|
||||
{{0x0118, 0x011a, 0x011b, 0x011c, 0x011d}, 0x0000, 0x001f},
|
||||
{{0x0111, 0x0114, 0x0115, 0x0116, 0x0117}, 0x0000, 0x001f},
|
||||
{{0x011f, 0x0120, 0x0121, 0x0122, 0x0123}, 0x0000, 0x0020},
|
||||
{{0x012e, 0x012f, 0x0130, 0x0131, 0x0132}, 0x0000, 0x0019},
|
||||
{{0x0125, 0x0127, 0x0128, 0x0129, 0x012a}, 0x0000, 0x0012},
|
||||
{{0x0133, 0x0134, 0x0135, 0x0136, 0x0137}, 0x0000, 0x001e},
|
||||
{{0x0139, 0x013a, 0x013b, 0x013c, 0x013d}, 0x0018, 0x000c},
|
||||
{{0x013e, 0x0148, 0x0149, 0x014a, 0x014b}, 0x0000, 0x0011},
|
||||
{{0x0153, 0x015a, 0x015b, 0x015c, 0x015d}, 0x0000, 0x0015},
|
||||
{{0x0178, 0x017b, 0x017c, 0x017d, 0x017e}, 0x0000, 0x002b},
|
||||
{{0x0171, 0x0172, 0x0173, 0x0174, 0x0175}, 0x0000, 0x0020},
|
||||
{{0x0166, 0x0168, 0x0169, 0x016a, 0x016b}, 0x0000, 0x0019},
|
||||
{{0x016c, 0x016d, 0x016e, 0x016f, 0x0170}, 0x0000, 0x0020},
|
||||
{{0x0182, 0x0184, 0x0185, 0x0186, 0x0187}, 0x0000, 0x002b},
|
||||
{{0x0161, 0x0162, 0x0163, 0x0164, 0x0165}, 0x0000, 0x0019},
|
||||
{{0x0179, 0x0334, 0x0335, 0x0336, 0x0337}, 0x0000, 0x0029},
|
||||
{{0x0188, 0x0189, 0x018a, 0x018b, 0x018c}, 0x0018, 0x0001},
|
||||
{{0x0196, 0x0199, 0x019a, 0x019b, 0x019c}, 0x0000, 0x0023},
|
||||
{{0x01a3, 0x01a5, 0x01a6, 0x01a7, 0x01a8}, 0x0000, 0x001c},
|
||||
{{0x01ab, 0x01ae, 0x01af, 0x01b0, 0x01b1}, 0x0000, 0x001e},
|
||||
{{0x01b2, 0x01b5, 0x01b6, 0x01b7, 0x01b8}, 0x0000, 0x001c},
|
||||
{{0x01c1, 0x01d1, 0x01d2, 0x01d3, 0x01d4}, 0x0000, 0x0027},
|
||||
{{0x01da, 0x01dd, 0x01de, 0x01df, 0x01e0}, 0x0018, 0x000d},
|
||||
{{0x01e1, 0x01e2, 0x01e7, 0x01e8, 0x01e9}, 0x0000, 0x0012},
|
||||
{{0x01ec, 0x01f1, 0x01f2, 0x01f3, 0x01f4}, 0x0000, 0x0028},
|
||||
{{0x02e4, 0x0330, 0x0331, 0x0332, 0x0333}, 0x0000, 0x0017},
|
||||
{{0x0200, 0x0203, 0x0204, 0x0205, 0x0206}, 0x0000, 0x0019},
|
||||
{{0x0221, 0x0224, 0x0225, 0x0226, 0x0227}, 0x0000, 0x0020},
|
||||
{{0x021a, 0x021d, 0x021e, 0x021f, 0x0220}, 0x0000, 0x0020},
|
||||
{{0x0009, 0x0348, 0x0349, 0x034a, 0x034b}, 0x0018, 0x0011},
|
||||
{{0x022f, 0x0232, 0x0233, 0x0234, 0x0235}, 0x0000, 0x0022},
|
||||
{{0x0228, 0x022b, 0x022c, 0x022d, 0x022e}, 0x0000, 0x0022},
|
||||
{{0x025c, 0x025f, 0x0260, 0x0261, 0x0262}, 0x0000, 0x0013},
|
||||
{{0x026d, 0x026e, 0x026f, 0x0270, 0x0271}, 0x0018, 0x000b},
|
||||
{{0x0273, 0x027c, 0x027d, 0x027e, 0x027f}, 0x0000, 0x001b},
|
||||
{{0x0001, 0x0344, 0x0345, 0x0346, 0x0347}, 0x0018, 0x000c},
|
||||
{{0x0282, 0x0283, 0x0284, 0x0285, 0x0286}, 0x0018, 0x003e},
|
||||
{{0x0291, 0x0292, 0x0293, 0x0294, 0x0294}, 0x0018, 0x002b},
|
||||
{{0x0109, 0x0302, 0x0303, 0x0304, 0x0305}, 0x0000, 0x0003},
|
||||
{{0x010a, 0x0306, 0x0307, 0x0308, 0x0309}, 0x0000, 0x000b},
|
||||
{{0x010b, 0x030a, 0x030b, 0x030c, 0x030d}, 0x0000, 0x0002},
|
||||
{{0x010c, 0x030e, 0x030f, 0x0310, 0x0311}, 0x0000, 0x000c},
|
||||
{{0x010d, 0x0312, 0x0313, 0x0314, 0x0315}, 0x0000, 0x0000},
|
||||
{{0x010e, 0x0316, 0x0317, 0x0318, 0x0319}, 0x0000, 0x0004},
|
||||
{{0x010f, 0x031a, 0x031b, 0x031c, 0x031d}, 0x0000, 0x0006},
|
||||
{{0x0110, 0x031e, 0x031f, 0x0320, 0x0321}, 0x0000, 0x0007},
|
||||
{{0x0105, 0x0105, 0x0105, 0x0105, 0x0105}, 0x0000, 0x0008},
|
||||
{{0x0106, 0x0106, 0x0106, 0x0106, 0x0106}, 0x0000, 0x0008},
|
||||
{{0x0107, 0x0107, 0x0107, 0x0107, 0x0107}, 0x0000, 0x0008},
|
||||
{{0x0108, 0x0108, 0x0108, 0x0108, 0x0108}, 0x0000, 0x0008},
|
||||
{{0x014f, 0x014f, 0x014f, 0x014f, 0x014f}, 0x0000, 0x0008},
|
||||
{{TRAINER_ROSE_1, TRAINER_ROSE_2, TRAINER_ROSE_3, TRAINER_ROSE_4, TRAINER_ROSE_5}, 0x0, 0x21},
|
||||
{{TRAINER_ANDRES_1, TRAINER_ANDRES_2, TRAINER_ANDRES_3, TRAINER_ANDRES_4, TRAINER_ANDRES_5}, 0x0, 0x14},
|
||||
{{TRAINER_DUSTY_1, TRAINER_DUSTY_2, TRAINER_DUSTY_3, TRAINER_DUSTY_4, TRAINER_DUSTY_5}, 0x0, 0x1a},
|
||||
{{TRAINER_LOLA_1, TRAINER_LOLA_2, TRAINER_LOLA_3, TRAINER_LOLA_4, TRAINER_LOLA_5}, 0x0, 0x18},
|
||||
{{TRAINER_RICKY_1, TRAINER_RICKY_2, TRAINER_RICKY_3, TRAINER_RICKY_4, TRAINER_RICKY_5}, 0x0, 0x18},
|
||||
{{TRAINER_LILA_AND_ROY_1, TRAINER_LILA_AND_ROY_2, TRAINER_LILA_AND_ROY_3, TRAINER_LILA_AND_ROY_4, TRAINER_LILA_AND_ROY_5}, 0x0, 0x27},
|
||||
{{TRAINER_CRISTIN_1, TRAINER_CRISTIN_2, TRAINER_CRISTIN_3, TRAINER_CRISTIN_4, TRAINER_CRISTIN_5}, 0x0, 0x24},
|
||||
{{TRAINER_BROOKE_1, TRAINER_BROOKE_2, TRAINER_BROOKE_3, TRAINER_BROOKE_4, TRAINER_BROOKE_5}, 0x0, 0x1a},
|
||||
{{TRAINER_WILTON_1, TRAINER_WILTON_2, TRAINER_WILTON_3, TRAINER_WILTON_4, TRAINER_WILTON_5}, 0x0, 0x1a},
|
||||
{{TRAINER_VALERIE_1, TRAINER_VALERIE_2, TRAINER_VALERIE_3, TRAINER_VALERIE_4, TRAINER_VALERIE_5}, 0x18, 0x14},
|
||||
{{TRAINER_CINDY_1, TRAINER_CINDY_3, TRAINER_CINDY_4, TRAINER_CINDY_5, TRAINER_CINDY_6}, 0x0, 0x13},
|
||||
{{TRAINER_THALIA_1, TRAINER_THALIA_2, TRAINER_THALIA_3, TRAINER_THALIA_4, TRAINER_THALIA_5}, 0x18, 0x38},
|
||||
{{TRAINER_JESSICA_1, TRAINER_JESSICA_2, TRAINER_JESSICA_3, TRAINER_JESSICA_4, TRAINER_JESSICA_5}, 0x0, 0x24},
|
||||
{{TRAINER_WINSTON_1, TRAINER_WINSTON_2, TRAINER_WINSTON_3, TRAINER_WINSTON_4, TRAINER_WINSTON_5}, 0x0, 0x13},
|
||||
{{TRAINER_STEVE_1, TRAINER_STEVE_2, TRAINER_STEVE_3, TRAINER_STEVE_4, TRAINER_STEVE_5}, 0x0, 0x1d},
|
||||
{{TRAINER_TONY_1, TRAINER_TONY_2, TRAINER_TONY_3, TRAINER_TONY_4, TRAINER_TONY_5}, 0x0, 0x16},
|
||||
{{TRAINER_NOB_1, TRAINER_NOB_2, TRAINER_NOB_3, TRAINER_NOB_4, TRAINER_NOB_5}, 0x0, 0x1e},
|
||||
{{TRAINER_KOJI_1, TRAINER_KOJI_2, TRAINER_KOJI_3, TRAINER_KOJI_4, TRAINER_KOJI_5}, 0x0, 0x2a},
|
||||
{{TRAINER_FERNANDO_1, TRAINER_FERNANDO_2, TRAINER_FERNANDO_3, TRAINER_FERNANDO_4, TRAINER_FERNANDO_5}, 0x0, 0x26},
|
||||
{{TRAINER_DALTON_1, TRAINER_DALTON_2, TRAINER_DALTON_3, TRAINER_DALTON_4, TRAINER_DALTON_5}, 0x0, 0x21},
|
||||
{{TRAINER_BERNIE_1, TRAINER_BERNIE_2, TRAINER_BERNIE_3, TRAINER_BERNIE_4, TRAINER_BERNIE_5}, 0x0, 0x1d},
|
||||
{{TRAINER_ETHAN_1, TRAINER_ETHAN_2, TRAINER_ETHAN_3, TRAINER_ETHAN_4, TRAINER_ETHAN_5}, 0x18, 0xd},
|
||||
{{TRAINER_JOHN_AND_JAY_1, TRAINER_JOHN_AND_JAY_2, TRAINER_JOHN_AND_JAY_3, TRAINER_JOHN_AND_JAY_4, TRAINER_JOHN_AND_JAY_5}, 0x18, 0x1},
|
||||
{{TRAINER_JEFFREY_1, TRAINER_JEFFREY_2, TRAINER_JEFFREY_3, TRAINER_JEFFREY_4, TRAINER_JEFFREY_5}, 0x0, 0x23},
|
||||
{{TRAINER_CAMERON_1, TRAINER_CAMERON_2, TRAINER_CAMERON_3, TRAINER_CAMERON_4, TRAINER_CAMERON_5}, 0x0, 0x26},
|
||||
{{TRAINER_JACKI_1, TRAINER_JACKI_2, TRAINER_JACKI_3, TRAINER_JACKI_4, TRAINER_JACKI_5}, 0x0, 0x26},
|
||||
{{TRAINER_WALTER_1, TRAINER_WALTER_2, TRAINER_WALTER_3, TRAINER_WALTER_4, TRAINER_WALTER_5}, 0x0, 0x24},
|
||||
{{TRAINER_KAREN_1, TRAINER_KAREN_2, TRAINER_KAREN_3, TRAINER_KAREN_4, TRAINER_KAREN_5}, 0x0, 0x1f},
|
||||
{{TRAINER_JERRY_1, TRAINER_JERRY_2, TRAINER_JERRY_3, TRAINER_JERRY_4, TRAINER_JERRY_5}, 0x0, 0x1f},
|
||||
{{TRAINER_ANNA_AND_MEG_1, TRAINER_ANNA_AND_MEG_2, TRAINER_ANNA_AND_MEG_3, TRAINER_ANNA_AND_MEG_4, TRAINER_ANNA_AND_MEG_5}, 0x0, 0x20},
|
||||
{{TRAINER_ISABEL_1, TRAINER_ISABEL_2, TRAINER_ISABEL_3, TRAINER_ISABEL_4, TRAINER_ISABEL_5}, 0x0, 0x19},
|
||||
{{TRAINER_MIGUEL_1, TRAINER_MIGUEL_2, TRAINER_MIGUEL_3, TRAINER_MIGUEL_4, TRAINER_MIGUEL_5}, 0x0, 0x12},
|
||||
{{TRAINER_TIMOTHY_1, TRAINER_TIMOTHY_2, TRAINER_TIMOTHY_3, TRAINER_TIMOTHY_4, TRAINER_TIMOTHY_5}, 0x0, 0x1e},
|
||||
{{TRAINER_SHELBY_1, TRAINER_SHELBY_2, TRAINER_SHELBY_3, TRAINER_SHELBY_4, TRAINER_SHELBY_5}, 0x18, 0xc},
|
||||
{{TRAINER_CALVIN_1, TRAINER_CALVIN_2, TRAINER_CALVIN_3, TRAINER_CALVIN_4, TRAINER_CALVIN_5}, 0x0, 0x11},
|
||||
{{TRAINER_ELLIOT_1, TRAINER_ELLIOT_2, TRAINER_ELLIOT_3, TRAINER_ELLIOT_4, TRAINER_ELLIOT_5}, 0x0, 0x15},
|
||||
{{TRAINER_ISAIAH_1, TRAINER_ISAIAH_2, TRAINER_ISAIAH_3, TRAINER_ISAIAH_4, TRAINER_ISAIAH_5}, 0x0, 0x2b},
|
||||
{{TRAINER_MARIA_1, TRAINER_MARIA_2, TRAINER_MARIA_3, TRAINER_MARIA_4, TRAINER_MARIA_5}, 0x0, 0x20},
|
||||
{{TRAINER_ABIGAIL_1, TRAINER_ABIGAIL_2, TRAINER_ABIGAIL_3, TRAINER_ABIGAIL_4, TRAINER_ABIGAIL_5}, 0x0, 0x19},
|
||||
{{TRAINER_DYLAN_1, TRAINER_DYLAN_2, TRAINER_DYLAN_3, TRAINER_DYLAN_4, TRAINER_DYLAN_5}, 0x0, 0x20},
|
||||
{{TRAINER_KATELYN_1, TRAINER_KATELYN_2, TRAINER_KATELYN_3, TRAINER_KATELYN_4, TRAINER_KATELYN_5}, 0x0, 0x2b},
|
||||
{{TRAINER_BENJAMIN_1, TRAINER_BENJAMIN_2, TRAINER_BENJAMIN_3, TRAINER_BENJAMIN_4, TRAINER_BENJAMIN_5}, 0x0, 0x19},
|
||||
{{TRAINER_PABLO_1, TRAINER_PABLO_2, TRAINER_PABLO_3, TRAINER_PABLO_4, TRAINER_PABLO_5}, 0x0, 0x29},
|
||||
{{TRAINER_NICOLAS_1, TRAINER_NICOLAS_2, TRAINER_NICOLAS_3, TRAINER_NICOLAS_4, TRAINER_NICOLAS_5}, 0x18, 0x1},
|
||||
{{TRAINER_ROBERT_1, TRAINER_ROBERT_2, TRAINER_ROBERT_3, TRAINER_ROBERT_4, TRAINER_ROBERT_5}, 0x0, 0x23},
|
||||
{{TRAINER_LAO_1, TRAINER_LAO_2, TRAINER_LAO_3, TRAINER_LAO_4, TRAINER_LAO_5}, 0x0, 0x1c},
|
||||
{{TRAINER_CYNDY_1, TRAINER_CYNDY_2, TRAINER_CYNDY_3, TRAINER_CYNDY_4, TRAINER_CYNDY_5}, 0x0, 0x1e},
|
||||
{{TRAINER_MADELINE_1, TRAINER_MADELINE_2, TRAINER_MADELINE_3, TRAINER_MADELINE_4, TRAINER_MADELINE_5}, 0x0, 0x1c},
|
||||
{{TRAINER_JENNY_1, TRAINER_JENNY_2, TRAINER_JENNY_3, TRAINER_JENNY_4, TRAINER_JENNY_5}, 0x0, 0x27},
|
||||
{{TRAINER_DIANA_1, TRAINER_DIANA_2, TRAINER_DIANA_3, TRAINER_DIANA_4, TRAINER_DIANA_5}, 0x18, 0xd},
|
||||
{{TRAINER_AMY_AND_LIV_1, TRAINER_AMY_AND_LIV_2, TRAINER_AMY_AND_LIV_4, TRAINER_AMY_AND_LIV_5, TRAINER_AMY_AND_LIV_6}, 0x0, 0x12},
|
||||
{{TRAINER_ERNEST_1, TRAINER_ERNEST_2, TRAINER_ERNEST_3, TRAINER_ERNEST_4, TRAINER_ERNEST_5}, 0x0, 0x28},
|
||||
{{TRAINER_CORY_1, TRAINER_CORY_2, TRAINER_CORY_3, TRAINER_CORY_4, TRAINER_CORY_5}, 0x0, 0x17},
|
||||
{{TRAINER_EDWIN_1, TRAINER_EDWIN_2, TRAINER_EDWIN_3, TRAINER_EDWIN_4, TRAINER_EDWIN_5}, 0x0, 0x19},
|
||||
{{TRAINER_LYDIA_1, TRAINER_LYDIA_2, TRAINER_LYDIA_3, TRAINER_LYDIA_4, TRAINER_LYDIA_5}, 0x0, 0x20},
|
||||
{{TRAINER_ISAAC_1, TRAINER_ISAAC_2, TRAINER_ISAAC_3, TRAINER_ISAAC_4, TRAINER_ISAAC_5}, 0x0, 0x20},
|
||||
{{TRAINER_GABRIELLE_1, TRAINER_GABRIELLE_2, TRAINER_GABRIELLE_3, TRAINER_GABRIELLE_4, TRAINER_GABRIELLE_5}, 0x18, 0x11},
|
||||
{{TRAINER_CATHERINE_1, TRAINER_CATHERINE_2, TRAINER_CATHERINE_3, TRAINER_CATHERINE_4, TRAINER_CATHERINE_5}, 0x0, 0x22},
|
||||
{{TRAINER_JACKSON_1, TRAINER_JACKSON_2, TRAINER_JACKSON_3, TRAINER_JACKSON_4, TRAINER_JACKSON_5}, 0x0, 0x22},
|
||||
{{TRAINER_HALEY_1, TRAINER_HALEY_2, TRAINER_HALEY_3, TRAINER_HALEY_4, TRAINER_HALEY_5}, 0x0, 0x13},
|
||||
{{TRAINER_JAMES_1, TRAINER_JAMES_2, TRAINER_JAMES_3, TRAINER_JAMES_4, TRAINER_JAMES_5}, 0x18, 0xb},
|
||||
{{TRAINER_TRENT_1, TRAINER_TRENT_2, TRAINER_TRENT_3, TRAINER_TRENT_4, TRAINER_TRENT_5}, 0x0, 0x1b},
|
||||
{{TRAINER_SAWYER_1, TRAINER_SAWYER_2, TRAINER_SAWYER_3, TRAINER_SAWYER_4, TRAINER_SAWYER_5}, 0x18, 0xc},
|
||||
{{TRAINER_KIRA_AND_DAN_1, TRAINER_KIRA_AND_DAN_2, TRAINER_KIRA_AND_DAN_3, TRAINER_KIRA_AND_DAN_4, TRAINER_KIRA_AND_DAN_5}, 0x18, 0x3e},
|
||||
{{TRAINER_WALLY_3, 0x292, 0x293, 0x294, 0x294}, 0x18, 0x2b},
|
||||
{{TRAINER_ROXANNE_1, TRAINER_ROXANNE_2, TRAINER_ROXANNE_3, TRAINER_ROXANNE_4, TRAINER_ROXANNE_5}, 0x0, 0x3},
|
||||
{{TRAINER_BRAWLY_1, TRAINER_BRAWLY_2, TRAINER_BRAWLY_3, TRAINER_BRAWLY_4, TRAINER_BRAWLY_5}, 0x0, 0xb},
|
||||
{{TRAINER_WATTSON_1, TRAINER_WATTSON_2, TRAINER_WATTSON_3, TRAINER_WATTSON_4, TRAINER_WATTSON_5}, 0x0, 0x2},
|
||||
{{TRAINER_FLANNERY_1, TRAINER_FLANNERY_2, TRAINER_FLANNERY_3, TRAINER_FLANNERY_4, TRAINER_FLANNERY_5}, 0x0, 0xc},
|
||||
{{TRAINER_NORMAN_1, TRAINER_NORMAN_2, TRAINER_NORMAN_3, TRAINER_NORMAN_4, TRAINER_NORMAN_5}, 0x0, 0x0},
|
||||
{{TRAINER_WINONA_1, TRAINER_WINONA_2, TRAINER_WINONA_3, TRAINER_WINONA_4, TRAINER_WINONA_5}, 0x0, 0x4},
|
||||
{{TRAINER_TATE_AND_LIZA_1, TRAINER_TATE_AND_LIZA_2, TRAINER_TATE_AND_LIZA_3, TRAINER_TATE_AND_LIZA_4, TRAINER_TATE_AND_LIZA_5}, 0x0, 0x6},
|
||||
{{TRAINER_JUAN_1, TRAINER_JUAN_2, TRAINER_JUAN_3, TRAINER_JUAN_4, TRAINER_JUAN_5}, 0x0, 0x7},
|
||||
{{TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY}, 0x0, 0x8},
|
||||
{{TRAINER_PHOEBE, TRAINER_PHOEBE, TRAINER_PHOEBE, TRAINER_PHOEBE, TRAINER_PHOEBE}, 0x0, 0x8},
|
||||
{{TRAINER_GLACIA, TRAINER_GLACIA, TRAINER_GLACIA, TRAINER_GLACIA, TRAINER_GLACIA}, 0x0, 0x8},
|
||||
{{TRAINER_DRAKE, TRAINER_DRAKE, TRAINER_DRAKE, TRAINER_DRAKE, TRAINER_DRAKE}, 0x0, 0x8},
|
||||
{{TRAINER_WALLACE, TRAINER_WALLACE, TRAINER_WALLACE, TRAINER_WALLACE, TRAINER_WALLACE}, 0x0, 0x8},
|
||||
};
|
||||
|
||||
static const u16 sBadgeFlags[8] =
|
||||
@@ -945,13 +940,13 @@ static void CB2_EndFirstBattle(void)
|
||||
static void sub_80B1218(void)
|
||||
{
|
||||
if (GetGameStat(GAME_STAT_WILD_BATTLES) % 60 == 0)
|
||||
sub_81DA57C();
|
||||
UpdateGymLeaderRematch();
|
||||
}
|
||||
|
||||
static void sub_80B1234(void)
|
||||
{
|
||||
if (GetGameStat(GAME_STAT_TRAINER_BATTLES) % 20 == 0)
|
||||
sub_81DA57C();
|
||||
UpdateGymLeaderRematch();
|
||||
}
|
||||
|
||||
// why not just use the macros? maybe its because they didnt want to uncast const every time?
|
||||
|
||||
+1576
File diff suppressed because it is too large
Load Diff
+25
-34
@@ -23,8 +23,6 @@
|
||||
#include "link.h"
|
||||
#include "berry.h"
|
||||
|
||||
extern const struct BattleMove gBattleMoves[];
|
||||
|
||||
extern u8 weather_get_current(void);
|
||||
|
||||
// rom const data
|
||||
@@ -1665,36 +1663,31 @@ u8 CastformDataTypeChange(u8 battler)
|
||||
u8 formChange = 0;
|
||||
if (gBattleMons[battler].species != SPECIES_CASTFORM || gBattleMons[battler].ability != ABILITY_FORECAST || gBattleMons[battler].hp == 0)
|
||||
return CASTFORM_NO_CHANGE;
|
||||
if (!WEATHER_HAS_EFFECT && gBattleMons[battler].type1 != TYPE_NORMAL && gBattleMons[battler].type2 != TYPE_NORMAL)
|
||||
if (!WEATHER_HAS_EFFECT && !IS_BATTLER_OF_TYPE(battler, TYPE_NORMAL))
|
||||
{
|
||||
gBattleMons[battler].type1 = TYPE_NORMAL;
|
||||
gBattleMons[battler].type2 = TYPE_NORMAL;
|
||||
SET_BATTLER_TYPE(battler, TYPE_NORMAL);
|
||||
return CASTFORM_TO_NORMAL;
|
||||
}
|
||||
if (!WEATHER_HAS_EFFECT)
|
||||
return CASTFORM_NO_CHANGE;
|
||||
if (!(gBattleWeather & (WEATHER_RAIN_ANY | WEATHER_SUN_ANY | WEATHER_HAIL)) && gBattleMons[battler].type1 != TYPE_NORMAL && gBattleMons[battler].type2 != TYPE_NORMAL)
|
||||
if (!(gBattleWeather & (WEATHER_RAIN_ANY | WEATHER_SUN_ANY | WEATHER_HAIL_ANY)) && !IS_BATTLER_OF_TYPE(battler, TYPE_NORMAL))
|
||||
{
|
||||
gBattleMons[battler].type1 = TYPE_NORMAL;
|
||||
gBattleMons[battler].type2 = TYPE_NORMAL;
|
||||
SET_BATTLER_TYPE(battler, TYPE_NORMAL);
|
||||
formChange = CASTFORM_TO_NORMAL;
|
||||
}
|
||||
if (gBattleWeather & WEATHER_SUN_ANY && gBattleMons[battler].type1 != TYPE_FIRE && gBattleMons[battler].type2 != TYPE_FIRE)
|
||||
if (gBattleWeather & WEATHER_SUN_ANY && !IS_BATTLER_OF_TYPE(battler, TYPE_FIRE))
|
||||
{
|
||||
gBattleMons[battler].type1 = TYPE_FIRE;
|
||||
gBattleMons[battler].type2 = TYPE_FIRE;
|
||||
SET_BATTLER_TYPE(battler, TYPE_FIRE);
|
||||
formChange = CASTFORM_TO_FIRE;
|
||||
}
|
||||
if (gBattleWeather & WEATHER_RAIN_ANY && gBattleMons[battler].type1 != TYPE_WATER && gBattleMons[battler].type2 != TYPE_WATER)
|
||||
if (gBattleWeather & WEATHER_RAIN_ANY && !IS_BATTLER_OF_TYPE(battler, TYPE_WATER))
|
||||
{
|
||||
gBattleMons[battler].type1 = TYPE_WATER;
|
||||
gBattleMons[battler].type2 = TYPE_WATER;
|
||||
SET_BATTLER_TYPE(battler, TYPE_WATER);
|
||||
formChange = CASTFORM_TO_WATER;
|
||||
}
|
||||
if (gBattleWeather & WEATHER_HAIL && gBattleMons[battler].type1 != TYPE_ICE && gBattleMons[battler].type2 != TYPE_ICE)
|
||||
if (gBattleWeather & WEATHER_HAIL_ANY && !IS_BATTLER_OF_TYPE(battler, TYPE_ICE))
|
||||
{
|
||||
gBattleMons[battler].type1 = TYPE_ICE;
|
||||
gBattleMons[battler].type2 = TYPE_ICE;
|
||||
SET_BATTLER_TYPE(battler, TYPE_ICE);
|
||||
formChange = CASTFORM_TO_ICE;
|
||||
}
|
||||
return formChange;
|
||||
@@ -2024,14 +2017,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
&& move != MOVE_STRUGGLE
|
||||
&& gBattleMoves[move].power != 0
|
||||
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
||||
&& gBattleMons[battler].type1 != moveType
|
||||
&& gBattleMons[battler].type2 != moveType
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& !IS_BATTLER_OF_TYPE(battler, moveType)
|
||||
&& gBattleMons[battler].hp != 0)
|
||||
{
|
||||
gBattleMons[battler].type1 = moveType;
|
||||
gBattleMons[battler].type2 = moveType;
|
||||
PREPARE_TYPE_BUFFER(gBattleTextBuff1, moveType)
|
||||
SET_BATTLER_TYPE(battler, moveType);
|
||||
PREPARE_TYPE_BUFFER(gBattleTextBuff1, moveType);
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_ColorChangeActivates;
|
||||
effect++;
|
||||
@@ -2041,7 +2032,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
&& gBattleMons[gBattlerAttacker].hp != 0
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT))
|
||||
{
|
||||
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 16;
|
||||
@@ -2056,7 +2047,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
&& gBattleMons[gBattlerAttacker].hp != 0
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
||||
&& (Random() % 10) == 0)
|
||||
{
|
||||
@@ -2079,7 +2070,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
&& gBattleMons[gBattlerAttacker].hp != 0
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
||||
&& (Random() % 3) == 0)
|
||||
{
|
||||
@@ -2094,7 +2085,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
&& gBattleMons[gBattlerAttacker].hp != 0
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
||||
&& (Random() % 3) == 0)
|
||||
{
|
||||
@@ -2110,7 +2101,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
&& gBattleMons[gBattlerAttacker].hp != 0
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
||||
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& (Random() % 3) == 0)
|
||||
{
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_BURN;
|
||||
@@ -2125,7 +2116,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
&& gBattleMons[gBattlerAttacker].hp != 0
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
||||
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& gBattleMons[gBattlerTarget].hp != 0
|
||||
&& (Random() % 3) == 0
|
||||
&& gBattleMons[gBattlerAttacker].ability != ABILITY_OBLIVIOUS
|
||||
@@ -3135,7 +3126,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
{
|
||||
case HOLD_EFFECT_FLINCH:
|
||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& (Random() % 100) < atkQuality
|
||||
&& gBattleMoves[gCurrentMove].flags & FLAG_KINGSROCK_AFFECTED
|
||||
&& gBattleMons[gBattlerTarget].hp)
|
||||
@@ -3187,14 +3178,14 @@ void HandleAction_RunBattleScript(void) // identical to RunBattleScriptCommands
|
||||
gBattleScriptingCommandsTable[*gBattlescriptCurrInstr]();
|
||||
}
|
||||
|
||||
u8 GetMoveTarget(u16 move, u8 useMoveTarget)
|
||||
u8 GetMoveTarget(u16 move, u8 setTarget)
|
||||
{
|
||||
u8 targetBank = 0;
|
||||
u8 moveTarget;
|
||||
u8 side;
|
||||
|
||||
if (useMoveTarget)
|
||||
moveTarget = useMoveTarget - 1;
|
||||
if (setTarget)
|
||||
moveTarget = setTarget - 1;
|
||||
else
|
||||
moveTarget = gBattleMoves[move].target;
|
||||
|
||||
@@ -3255,8 +3246,8 @@ u8 GetMoveTarget(u16 move, u8 useMoveTarget)
|
||||
else
|
||||
targetBank = GetBattlerAtPosition((GetBattlerPosition(gBattlerAttacker) & BIT_SIDE) ^ BIT_SIDE);
|
||||
break;
|
||||
case MOVE_TARGET_USER_OR_SELECTED:
|
||||
case MOVE_TARGET_USER:
|
||||
case MOVE_TARGET_x10:
|
||||
targetBank = gBattlerAttacker;
|
||||
break;
|
||||
}
|
||||
|
||||
+9
-9
@@ -76,26 +76,26 @@ void FreeBattleResources(void)
|
||||
|
||||
void AdjustFriendshipOnBattleFaint(u8 battlerId)
|
||||
{
|
||||
u8 opposingBank;
|
||||
u8 opposingBattlerId;
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||
{
|
||||
u8 opposingBank2;
|
||||
u8 opposingBattlerId2;
|
||||
|
||||
opposingBank = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
|
||||
opposingBank2 = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
|
||||
opposingBattlerId = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
|
||||
opposingBattlerId2 = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
|
||||
|
||||
if (gBattleMons[opposingBank2].level > gBattleMons[opposingBank].level)
|
||||
opposingBank = opposingBank2;
|
||||
if (gBattleMons[opposingBattlerId2].level > gBattleMons[opposingBattlerId].level)
|
||||
opposingBattlerId = opposingBattlerId2;
|
||||
}
|
||||
else
|
||||
{
|
||||
opposingBank = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
|
||||
opposingBattlerId = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
|
||||
}
|
||||
|
||||
if (gBattleMons[opposingBank].level > gBattleMons[battlerId].level)
|
||||
if (gBattleMons[opposingBattlerId].level > gBattleMons[battlerId].level)
|
||||
{
|
||||
if (gBattleMons[opposingBank].level - gBattleMons[battlerId].level > 29)
|
||||
if (gBattleMons[opposingBattlerId].level - gBattleMons[battlerId].level > 29)
|
||||
AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[battlerId]], 8);
|
||||
else
|
||||
AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[battlerId]], 6);
|
||||
|
||||
+1
-3
@@ -29,6 +29,7 @@
|
||||
#include "pokeblock.h"
|
||||
#include "trig.h"
|
||||
#include "tv.h"
|
||||
#include "item_menu.h"
|
||||
|
||||
#define BLENDER_SCORE_BEST 0
|
||||
#define BLENDER_SCORE_GOOD 1
|
||||
@@ -128,7 +129,6 @@ struct BerryBlenderData
|
||||
|
||||
extern struct MusicPlayerInfo gMPlayInfo_SE2;
|
||||
extern struct MusicPlayerInfo gMPlayInfo_BGM;
|
||||
extern u16 gSpecialVar_ItemId;
|
||||
extern u8 gInGameOpponentsNo;
|
||||
extern u8 gUnknown_020322D5;
|
||||
extern u8 gResultsWindowId;
|
||||
@@ -155,13 +155,11 @@ extern void sub_81978B0(u16);
|
||||
extern void sub_800A418(void);
|
||||
extern u8 sub_800A9D8(void);
|
||||
extern bool8 sub_800A4D8(u8);
|
||||
extern void sub_8197DF8(u8 windowId, bool8 copyToVram);
|
||||
extern void sub_809882C(u8, u16, u8);
|
||||
extern void copy_textbox_border_tile_patterns_to_vram(u8, u16, u8);
|
||||
extern void sub_81AABF0(void (*callback)(void));
|
||||
extern void sub_800B4C0(void);
|
||||
extern void ClearLinkCallback(void);
|
||||
extern void CB2_ReturnToFieldContinueScript(void);
|
||||
extern void sub_8153430(void);
|
||||
extern bool8 sub_8153474(void);
|
||||
extern void sub_80EECEC(void);
|
||||
|
||||
@@ -515,7 +515,7 @@ static void Task_HandleInput(u8 taskId)
|
||||
static void TryChangeDisplayedBerry(u8 taskId, s8 toMove)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
s16 currPocketPosition = gUnknown_0203CE58.unk12[3] + gUnknown_0203CE58.unk8[3];
|
||||
s16 currPocketPosition = gUnknown_0203CE58.scrollPosition[3] + gUnknown_0203CE58.cursorPosition[3];
|
||||
u32 newPocketPosition = currPocketPosition + toMove;
|
||||
if (newPocketPosition < 46 && BagGetItemIdByPocketPosition(BAG_BERRIES, newPocketPosition) != 0)
|
||||
{
|
||||
@@ -533,8 +533,8 @@ static void TryChangeDisplayedBerry(u8 taskId, s8 toMove)
|
||||
|
||||
static void HandleBagCursorPositionChange(s8 toMove)
|
||||
{
|
||||
u16 *scrollPos = &gUnknown_0203CE58.unk12[3];
|
||||
u16 *cursorPos = &gUnknown_0203CE58.unk8[3];
|
||||
u16 *scrollPos = &gUnknown_0203CE58.scrollPosition[3];
|
||||
u16 *cursorPos = &gUnknown_0203CE58.cursorPosition[3];
|
||||
if (toMove > 0)
|
||||
{
|
||||
if (*cursorPos < 4 || BagGetItemIdByPocketPosition(BAG_BERRIES, *scrollPos + 8) == 0)
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
#include "constants/species.h"
|
||||
#include "strings.h"
|
||||
|
||||
extern u16 gSpecialVar_0x8004;
|
||||
extern u16 gSpecialVar_0x8005;
|
||||
extern u16 gSpecialVar_0x8006;
|
||||
|
||||
bool16 ScriptGetPokedexInfo(void)
|
||||
{
|
||||
if (gSpecialVar_0x8004 == 0) // is national dex not present?
|
||||
|
||||
+209
@@ -0,0 +1,209 @@
|
||||
#include "global.h"
|
||||
#include "blit.h"
|
||||
|
||||
void BlitBitmapRect4BitWithoutColorKey(struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height)
|
||||
{
|
||||
BlitBitmapRect4Bit(src, dst, srcX, srcY, dstX, dstY, width, height, 0xFF);
|
||||
}
|
||||
|
||||
void BlitBitmapRect4Bit(struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height, u8 colorKey)
|
||||
{
|
||||
s32 xEnd;
|
||||
s32 yEnd;
|
||||
s32 multiplierSrcY;
|
||||
s32 multiplierDstY;
|
||||
s32 loopSrcY, loopDstY;
|
||||
s32 loopSrcX, loopDstX;
|
||||
u8 *pixelsSrc;
|
||||
u8 *pixelsDst;
|
||||
s32 toOrr;
|
||||
s32 toAnd;
|
||||
s32 toShift;
|
||||
|
||||
if (dst->width - dstX < width)
|
||||
xEnd = (dst->width - dstX) + srcX;
|
||||
else
|
||||
xEnd = srcX + width;
|
||||
|
||||
if (dst->height - dstY < height)
|
||||
yEnd = (dst->height - dstY) + srcY;
|
||||
else
|
||||
yEnd = height + srcY;
|
||||
|
||||
multiplierSrcY = (src->width + (src->width & 7)) >> 3;
|
||||
multiplierDstY = (dst->width + (dst->width & 7)) >> 3;
|
||||
|
||||
if (colorKey == 0xFF)
|
||||
{
|
||||
for (loopSrcY = srcY, loopDstY = dstY; loopSrcY < yEnd; loopSrcY++, loopDstY++)
|
||||
{
|
||||
for (loopSrcX = srcX, loopDstX = dstX; loopSrcX < xEnd; loopSrcX++, loopDstX++)
|
||||
{
|
||||
pixelsSrc = src->pixels + ((loopSrcX >> 1) & 3) + ((loopSrcX >> 3) << 5) + (((loopSrcY >> 3) * multiplierSrcY) << 5) + ((u32)(loopSrcY << 0x1d) >> 0x1B);
|
||||
pixelsDst = dst->pixels + ((loopDstX >> 1) & 3) + ((loopDstX >> 3) << 5) + (((loopDstY >> 3) * multiplierDstY) << 5) + ((u32)(loopDstY << 0x1d) >> 0x1B);
|
||||
toOrr = ((*pixelsSrc >> ((loopSrcX & 1) << 2)) & 0xF);
|
||||
toShift = ((loopDstX & 1) << 2);
|
||||
toOrr <<= toShift;
|
||||
toAnd = 0xF0 >> (toShift);
|
||||
*pixelsDst = toOrr | (*pixelsDst & toAnd);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (loopSrcY = srcY, loopDstY = dstY; loopSrcY < yEnd; loopSrcY++, loopDstY++)
|
||||
{
|
||||
for (loopSrcX = srcX, loopDstX = dstX; loopSrcX < xEnd; loopSrcX++, loopDstX++)
|
||||
{
|
||||
pixelsSrc = src->pixels + ((loopSrcX >> 1) & 3) + ((loopSrcX >> 3) << 5) + (((loopSrcY >> 3) * multiplierSrcY) << 5) + ((u32)(loopSrcY << 0x1d) >> 0x1B);
|
||||
pixelsDst = dst->pixels + ((loopDstX >> 1) & 3) + ((loopDstX >> 3) << 5) + (((loopDstY >> 3) * multiplierDstY) << 5) + ((u32)(loopDstY << 0x1d) >> 0x1B);
|
||||
toOrr = ((*pixelsSrc >> ((loopSrcX & 1) << 2)) & 0xF);
|
||||
if (toOrr != colorKey)
|
||||
{
|
||||
toShift = ((loopDstX & 1) << 2);
|
||||
toOrr <<= toShift;
|
||||
toAnd = 0xF0 >> (toShift);
|
||||
*pixelsDst = toOrr | (*pixelsDst & toAnd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FillBitmapRect4Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue)
|
||||
{
|
||||
s32 xEnd;
|
||||
s32 yEnd;
|
||||
s32 multiplierY;
|
||||
s32 loopX, loopY;
|
||||
s32 toOrr1, toOrr2;
|
||||
|
||||
xEnd = x + width;
|
||||
if (xEnd > surface->width)
|
||||
xEnd = surface->width;
|
||||
|
||||
yEnd = y + height;
|
||||
if (yEnd > surface->height)
|
||||
yEnd = surface->height;
|
||||
|
||||
multiplierY = (surface->width + (surface->width & 7)) >> 3;
|
||||
toOrr1 = (u32)(fillValue << 0x1C) >> 0x18;
|
||||
toOrr2 = (fillValue & 0xF);
|
||||
|
||||
for (loopY = y; loopY < yEnd; loopY++)
|
||||
{
|
||||
for (loopX = x; loopX < xEnd; loopX++)
|
||||
{
|
||||
u8 *pixels = surface->pixels + ((loopX >> 1) & 3) + ((loopX >> 3) << 5) + (((loopY >> 3) * multiplierY) << 5) + ((u32)(loopY << 0x1d) >> 0x1B);
|
||||
if ((loopX << 0x1F) != 0)
|
||||
*pixels = toOrr1 | (*pixels & 0xF);
|
||||
else
|
||||
*pixels = toOrr2 | (*pixels & 0xF0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BlitBitmapRect4BitTo8Bit(struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height, u8 colorKey, u8 paletteOffset)
|
||||
{
|
||||
s32 palOffsetBits;
|
||||
s32 xEnd;
|
||||
s32 yEnd;
|
||||
s32 multiplierSrcY;
|
||||
s32 multiplierDstY;
|
||||
s32 loopSrcY, loopDstY;
|
||||
s32 loopSrcX, loopDstX;
|
||||
u8 *pixelsSrc;
|
||||
u8 *pixelsDst;
|
||||
s32 colorKeyBits;
|
||||
|
||||
palOffsetBits = (u32)(paletteOffset << 0x1C) >> 0x18;
|
||||
colorKeyBits = (u32)(colorKey << 0x1C) >> 0x18;
|
||||
|
||||
if (dst->width - dstX < width)
|
||||
xEnd = (dst->width - dstX) + srcX;
|
||||
else
|
||||
xEnd = width + srcX;
|
||||
|
||||
if (dst->height - dstY < height)
|
||||
yEnd = (srcY + dst->height) - dstY;
|
||||
else
|
||||
yEnd = srcY + height;
|
||||
|
||||
multiplierSrcY = (src->width + (src->width & 7)) >> 3;
|
||||
multiplierDstY = (dst->width + (dst->width & 7)) >> 3;
|
||||
|
||||
if (colorKey == 0xFF)
|
||||
{
|
||||
for (loopSrcY = srcY, loopDstY = dstY; loopSrcY < yEnd; loopSrcY++, loopDstY++)
|
||||
{
|
||||
pixelsSrc = src->pixels + ((srcX >> 1) & 3) + ((srcX >> 3) << 5) + (((loopSrcY >> 3) * multiplierSrcY) << 5) + ((u32)(loopSrcY << 0x1d) >> 0x1b);
|
||||
for (loopSrcX = srcX, loopDstX = dstX; loopSrcX < xEnd; loopSrcX++, loopDstX++)
|
||||
{
|
||||
pixelsDst = dst->pixels + (loopDstX & 7) + ((loopDstX >> 3) << 6) + (((loopDstY >> 3) * multiplierDstY) << 6) + ((u32)(loopDstY << 0x1d) >> 0x1a);
|
||||
if (loopSrcX & 1)
|
||||
{
|
||||
*pixelsDst = palOffsetBits + (*pixelsSrc >> 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
pixelsSrc = src->pixels + ((loopSrcX >> 1) & 3) + ((loopSrcX >> 3) << 5) + (((loopSrcY >> 3) * multiplierSrcY) << 5) + ((u32)(loopSrcY << 0x1d) >> 0x1b);
|
||||
*pixelsDst = palOffsetBits + (*pixelsSrc & 0xF);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (loopSrcY = srcY, loopDstY = dstY; loopSrcY < yEnd; loopSrcY++, loopDstY++)
|
||||
{
|
||||
pixelsSrc = src->pixels + ((srcX >> 1) & 3) + ((srcX >> 3) << 5) + (((loopSrcY >> 3) * multiplierSrcY) << 5) + ((u32)(loopSrcY << 0x1d) >> 0x1b);
|
||||
for (loopSrcX = srcX, loopDstX = dstX; loopSrcX < xEnd; loopSrcX++, loopDstX++)
|
||||
{
|
||||
if (loopSrcX & 1)
|
||||
{
|
||||
if ((*pixelsSrc & 0xF0) != colorKeyBits)
|
||||
{
|
||||
pixelsDst = dst->pixels + (loopDstX & 7) + ((loopDstX >> 3) << 6) + (((loopDstY >> 3) * multiplierDstY) << 6) + ((u32)(loopDstY << 0x1d) >> 0x1a);
|
||||
*pixelsDst = palOffsetBits + (*pixelsSrc >> 4);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pixelsSrc = src->pixels + ((loopSrcX >> 1) & 3) + ((loopSrcX >> 3) << 5) + (((loopSrcY >> 3) * multiplierSrcY) << 5) + ((u32)(loopSrcY << 0x1d) >> 0x1b);
|
||||
if ((*pixelsSrc & 0xF) != colorKey)
|
||||
{
|
||||
pixelsDst = dst->pixels + (loopDstX & 7) + ((loopDstX >> 3) << 6) + (((loopDstY >> 3) * multiplierDstY) << 6) + ((u32)(loopDstY << 0x1d) >> 0x1a);
|
||||
*pixelsDst = palOffsetBits + (*pixelsSrc & 0xF);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FillBitmapRect8Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue)
|
||||
{
|
||||
s32 xEnd;
|
||||
s32 yEnd;
|
||||
s32 multiplierY;
|
||||
s32 loopX, loopY;
|
||||
|
||||
xEnd = x + width;
|
||||
if (xEnd > surface->width)
|
||||
xEnd = surface->width;
|
||||
|
||||
yEnd = y + height;
|
||||
if (yEnd > surface->height)
|
||||
yEnd = surface->height;
|
||||
|
||||
multiplierY = (surface->width + (surface->width & 7)) >> 3;
|
||||
|
||||
for (loopY = y; loopY < yEnd; loopY++)
|
||||
{
|
||||
for (loopX = x; loopX < xEnd; loopX++)
|
||||
{
|
||||
u8 *pixels = surface->pixels + (loopX & 7) + ((loopX >> 3) << 6) + (((loopY >> 3) * multiplierY) << 6) + ((u32)(loopY << 0x1d) >> 0x1a);
|
||||
*pixels = fillValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
+34
-182
@@ -25,7 +25,7 @@ enum
|
||||
};
|
||||
|
||||
extern u8 gBraillePuzzleCallbackFlag;
|
||||
extern u8 gUnknown_085EFE74[][2];
|
||||
extern const u8 gUnknown_085EFE74[][2];
|
||||
|
||||
void SealedChamberShakingEffect(u8);
|
||||
void sub_8179860(void);
|
||||
@@ -375,37 +375,49 @@ bool8 FldEff_UsePuzzleEffect(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// can't get this one to match due to the weird macro-like varsets with strange bitshifting.
|
||||
// to note: 0x10000 is loaded in, and its obviously supposed to be 1, but i cant get 0x80 << 9 to be loaded in without using it directly.
|
||||
// maybe there's some way of writing it that works?
|
||||
#ifdef NONMATCHING
|
||||
// ShouldDoBrailleRegicePuzzle
|
||||
bool8 ShouldDoBrailleRegicePuzzle(void)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
if (gSaveBlock1Ptr->location.mapGroup == 0x18 && gSaveBlock1Ptr->location.mapNum == 0x43)
|
||||
if (gSaveBlock1Ptr->location.mapGroup == 0x18
|
||||
&& gSaveBlock1Ptr->location.mapNum == 0x43)
|
||||
{
|
||||
// _08179A1A
|
||||
if (FlagGet(FLAG_SYS_BRAILLE_WAIT) != FALSE)
|
||||
return FALSE;
|
||||
if (FlagGet(2) == FALSE)
|
||||
if (FlagGet(FLAG_0x002) == FALSE)
|
||||
return FALSE;
|
||||
if (FlagGet(3) == TRUE)
|
||||
if (FlagGet(FLAG_0x003) == TRUE)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < 36; i++)
|
||||
{
|
||||
if (gSaveBlock1Ptr->pos.x == gUnknown_085EFE74[i][0] && gSaveBlock1Ptr->pos.y == gUnknown_085EFE74[i][1])
|
||||
u8 xPos = gUnknown_085EFE74[i][0];
|
||||
u8 yPos = gUnknown_085EFE74[i][1];
|
||||
if (gSaveBlock1Ptr->pos.x == xPos && gSaveBlock1Ptr->pos.y == yPos)
|
||||
{
|
||||
if (i < 16)
|
||||
VarSet(0x403B, (0x10000 << i | VarGet(0x403B) << 16) >> 16); // correct
|
||||
else if (i < 32)
|
||||
VarSet(0x403C, (0x10000 << (i - 16) | VarGet(0x403C) << 16) >> 16); // hmm?
|
||||
else
|
||||
VarSet(0x403D, (0x10000 << (i - 32) | VarGet(0x403D) << 16) >> 16); // hmm?
|
||||
u16 varValue;
|
||||
|
||||
if (VarGet(0x403B) != 0xFFFF || VarGet(0x403C) != 0xFF || VarGet(0x403D) != 0xF)
|
||||
if (i < 16)
|
||||
{
|
||||
u16 val = VarGet(0x403B);
|
||||
val |= 1 << i;
|
||||
VarSet(0x403B, val);
|
||||
}
|
||||
else if (i < 32)
|
||||
{
|
||||
u16 val = VarGet(0x403C);
|
||||
val |= 1 << (i - 16);
|
||||
VarSet(0x403C, val);
|
||||
}
|
||||
else
|
||||
{
|
||||
u16 val = VarGet(0x403D);
|
||||
val |= 1 << (i - 32);
|
||||
VarSet(0x403D, val);
|
||||
}
|
||||
|
||||
varValue = VarGet(0x403B);
|
||||
if (varValue != 0xFFFF || VarGet(0x403C) != varValue || VarGet(0x403D) != 0xF)
|
||||
return FALSE;
|
||||
|
||||
if (gSaveBlock1Ptr->pos.x == 8 && gSaveBlock1Ptr->pos.y == 21)
|
||||
@@ -414,170 +426,10 @@ bool8 ShouldDoBrailleRegicePuzzle(void)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
FlagSet(FLAG_0x003);
|
||||
FlagClear(FLAG_0x002);
|
||||
}
|
||||
// TODO: Find what flags 2 and 3 are.
|
||||
FlagSet(3);
|
||||
FlagClear(2);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT
|
||||
bool8 ShouldDoBrailleRegicePuzzle(void)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
push {r4-r7,lr}\n\
|
||||
mov r7, r9\n\
|
||||
mov r6, r8\n\
|
||||
push {r6,r7}\n\
|
||||
ldr r4, =gSaveBlock1Ptr\n\
|
||||
ldr r0, [r4]\n\
|
||||
ldrh r1, [r0, 0x4]\n\
|
||||
ldr r0, =0x00004318\n\
|
||||
cmp r1, r0\n\
|
||||
beq _08179A1A\n\
|
||||
b _08179B5A\n\
|
||||
_08179A1A:\n\
|
||||
ldr r0, =0x000008b1\n\
|
||||
bl FlagGet\n\
|
||||
lsls r0, 24\n\
|
||||
cmp r0, 0\n\
|
||||
beq _08179A28\n\
|
||||
b _08179B5A\n\
|
||||
_08179A28:\n\
|
||||
movs r0, 0x2\n\
|
||||
bl FlagGet\n\
|
||||
lsls r0, 24\n\
|
||||
cmp r0, 0\n\
|
||||
bne _08179A36\n\
|
||||
b _08179B5A\n\
|
||||
_08179A36:\n\
|
||||
movs r0, 0x3\n\
|
||||
bl FlagGet\n\
|
||||
lsls r0, 24\n\
|
||||
lsrs r0, 24\n\
|
||||
cmp r0, 0x1\n\
|
||||
bne _08179A58\n\
|
||||
b _08179B5A\n\
|
||||
.pool\n\
|
||||
_08179A54:\n\
|
||||
movs r0, 0x1\n\
|
||||
b _08179B5C\n\
|
||||
_08179A58:\n\
|
||||
movs r5, 0\n\
|
||||
mov r8, r4\n\
|
||||
ldr r4, =gUnknown_085EFE74\n\
|
||||
adds r0, r4, 0x1\n\
|
||||
mov r12, r0\n\
|
||||
ldr r6, =0x0000403b\n\
|
||||
ldr r1, =0x0000403c\n\
|
||||
mov r9, r1\n\
|
||||
_08179A68:\n\
|
||||
lsls r0, r5, 1\n\
|
||||
adds r1, r0, r4\n\
|
||||
add r0, r12\n\
|
||||
ldrb r3, [r0]\n\
|
||||
mov r7, r8\n\
|
||||
ldr r2, [r7]\n\
|
||||
movs r7, 0\n\
|
||||
ldrsh r0, [r2, r7]\n\
|
||||
ldrb r1, [r1]\n\
|
||||
cmp r0, r1\n\
|
||||
bne _08179B44\n\
|
||||
movs r1, 0x2\n\
|
||||
ldrsh r0, [r2, r1]\n\
|
||||
cmp r0, r3\n\
|
||||
bne _08179B44\n\
|
||||
cmp r5, 0xF\n\
|
||||
bhi _08179AB0\n\
|
||||
adds r0, r6, 0\n\
|
||||
bl VarGet\n\
|
||||
lsls r0, 16\n\
|
||||
movs r1, 0x80\n\
|
||||
lsls r1, 9\n\
|
||||
lsls r1, r5\n\
|
||||
orrs r1, r0\n\
|
||||
lsrs r1, 16\n\
|
||||
adds r0, r6, 0\n\
|
||||
bl VarSet\n\
|
||||
b _08179AF0\n\
|
||||
.pool\n\
|
||||
_08179AB0:\n\
|
||||
cmp r5, 0x1F\n\
|
||||
bhi _08179AD2\n\
|
||||
mov r0, r9\n\
|
||||
bl VarGet\n\
|
||||
lsls r0, 16\n\
|
||||
adds r2, r5, 0\n\
|
||||
subs r2, 0x10\n\
|
||||
movs r1, 0x80\n\
|
||||
lsls r1, 9\n\
|
||||
lsls r1, r2\n\
|
||||
orrs r1, r0\n\
|
||||
lsrs r1, 16\n\
|
||||
mov r0, r9\n\
|
||||
bl VarSet\n\
|
||||
b _08179AF0\n\
|
||||
_08179AD2:\n\
|
||||
ldr r4, =0x0000403d\n\
|
||||
adds r0, r4, 0\n\
|
||||
bl VarGet\n\
|
||||
lsls r0, 16\n\
|
||||
adds r2, r5, 0\n\
|
||||
subs r2, 0x20\n\
|
||||
movs r1, 0x80\n\
|
||||
lsls r1, 9\n\
|
||||
lsls r1, r2\n\
|
||||
orrs r1, r0\n\
|
||||
lsrs r1, 16\n\
|
||||
adds r0, r4, 0\n\
|
||||
bl VarSet\n\
|
||||
_08179AF0:\n\
|
||||
ldr r0, =0x0000403b\n\
|
||||
bl VarGet\n\
|
||||
lsls r0, 16\n\
|
||||
lsrs r4, r0, 16\n\
|
||||
ldr r0, =0x0000ffff\n\
|
||||
cmp r4, r0\n\
|
||||
bne _08179B5A\n\
|
||||
ldr r0, =0x0000403c\n\
|
||||
bl VarGet\n\
|
||||
lsls r0, 16\n\
|
||||
lsrs r0, 16\n\
|
||||
cmp r0, r4\n\
|
||||
bne _08179B5A\n\
|
||||
ldr r0, =0x0000403d\n\
|
||||
bl VarGet\n\
|
||||
lsls r0, 16\n\
|
||||
lsrs r0, 16\n\
|
||||
cmp r0, 0xF\n\
|
||||
bne _08179B5A\n\
|
||||
ldr r0, =gSaveBlock1Ptr\n\
|
||||
ldr r0, [r0]\n\
|
||||
ldr r1, [r0]\n\
|
||||
ldr r0, =0x00150008\n\
|
||||
cmp r1, r0\n\
|
||||
beq _08179A54\n\
|
||||
b _08179B5A\n\
|
||||
.pool\n\
|
||||
_08179B44:\n\
|
||||
adds r0, r5, 0x1\n\
|
||||
lsls r0, 24\n\
|
||||
lsrs r5, r0, 24\n\
|
||||
cmp r5, 0x23\n\
|
||||
bls _08179A68\n\
|
||||
movs r0, 0x3\n\
|
||||
bl FlagSet\n\
|
||||
movs r0, 0x2\n\
|
||||
bl FlagClear\n\
|
||||
_08179B5A:\n\
|
||||
movs r0, 0\n\
|
||||
_08179B5C:\n\
|
||||
pop {r3,r4}\n\
|
||||
mov r8, r3\n\
|
||||
mov r9, r4\n\
|
||||
pop {r4-r7}\n\
|
||||
pop {r1}\n\
|
||||
bx r1\n\
|
||||
.syntax divided");
|
||||
}
|
||||
#endif
|
||||
|
||||
+2355
File diff suppressed because it is too large
Load Diff
+13
-14
@@ -41,11 +41,10 @@ extern const u8 gDaycareText_PlayOther[];
|
||||
extern u8 GetCursorSelectionMonId(void);
|
||||
extern u16 ItemIdToBattleMoveId(u16);
|
||||
extern s32 ListMenuHandleInputGetItemId(u8);
|
||||
extern void sub_81AE6C8(u8, u16*, u16*);
|
||||
extern void DestroyListMenuTask(u8, u16*, u16*);
|
||||
extern void sub_819746C(u8, bool8);
|
||||
extern void NewMenuHelpers_DrawStdWindowFrame(u8, bool8);
|
||||
extern void sub_81B9328(void);
|
||||
extern void sub_81AF078(u32, bool8, struct ListMenu *);
|
||||
extern void CB2_ReturnToField(void);
|
||||
|
||||
// this file's functions
|
||||
@@ -79,18 +78,18 @@ static const struct ListMenuTemplate sDaycareListMenuLevelTemplate =
|
||||
.unk_08 = DaycarePrintMonInfo,
|
||||
.totalItems = 3,
|
||||
.maxShowed = 3,
|
||||
.unk_10 = 0,
|
||||
.windowId = 0,
|
||||
.unk_11 = 0,
|
||||
.unk_12 = 8,
|
||||
.cursor_Y = 0,
|
||||
.cursor_X = 0,
|
||||
.upText_Y = 1,
|
||||
.cursorColor = 2,
|
||||
.fillColor = 1,
|
||||
.cursorShadowColor = 3,
|
||||
.unk_16_0 = TRUE,
|
||||
.spaceBetweenItems = 0,
|
||||
.unk_16_7 = FALSE,
|
||||
.unk_17_0 = 1,
|
||||
.cursorPal = 2,
|
||||
.fillValue = 1,
|
||||
.cursorShadowPal = 3,
|
||||
.lettersSpacing = 1,
|
||||
.unk_16_3 = 0,
|
||||
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
|
||||
.fontId = 1,
|
||||
.cursorKind = 0
|
||||
};
|
||||
|
||||
@@ -1271,7 +1270,7 @@ static void Task_HandleDaycareLevelMenuInput(u8 taskId)
|
||||
gSpecialVar_Result = 2;
|
||||
break;
|
||||
}
|
||||
sub_81AE6C8(gTasks[taskId].tMenuListTaskId, NULL, NULL);
|
||||
DestroyListMenuTask(gTasks[taskId].tMenuListTaskId, NULL, NULL);
|
||||
sub_819746C(gTasks[taskId].tWindowId, TRUE);
|
||||
RemoveWindow(gTasks[taskId].tWindowId);
|
||||
DestroyTask(taskId);
|
||||
@@ -1280,7 +1279,7 @@ static void Task_HandleDaycareLevelMenuInput(u8 taskId)
|
||||
else if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
gSpecialVar_Result = 2;
|
||||
sub_81AE6C8(gTasks[taskId].tMenuListTaskId, NULL, NULL);
|
||||
DestroyListMenuTask(gTasks[taskId].tMenuListTaskId, NULL, NULL);
|
||||
sub_819746C(gTasks[taskId].tWindowId, TRUE);
|
||||
RemoveWindow(gTasks[taskId].tWindowId);
|
||||
DestroyTask(taskId);
|
||||
@@ -1299,7 +1298,7 @@ void ShowDaycareLevelMenu(void)
|
||||
NewMenuHelpers_DrawStdWindowFrame(windowId, FALSE);
|
||||
|
||||
menuTemplate = sDaycareListMenuLevelTemplate;
|
||||
menuTemplate.unk_10 = windowId;
|
||||
menuTemplate.windowId = windowId;
|
||||
listMenuTaskId = ListMenuInit(&menuTemplate, 0, 0);
|
||||
|
||||
CopyWindowToVram(windowId, 3);
|
||||
|
||||
+20
-105
@@ -113,7 +113,7 @@ void sub_812719C(u8 taskId);
|
||||
void sub_81271CC(u8 taskId);
|
||||
void sub_8127268(u8 taskId);
|
||||
void sub_8127454(u8 *dest, u16 decorId);
|
||||
void sub_8127480(u32 a0, bool8 flag, struct ListMenu *menu);
|
||||
void sub_8127480(s32 a0, bool8 flag, struct ListMenu *menu);
|
||||
void sub_81274A0(u8 a0, s32 a1, u8 a2);
|
||||
void sub_8127620(u8 taskId);
|
||||
void sub_812764C(u8 taskId);
|
||||
@@ -562,7 +562,7 @@ void SecretBasePC_Cancel(u8 taskId)
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_816B060(taskId);
|
||||
ReshowPlayerPC(taskId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -801,7 +801,7 @@ void sub_8127330(u8 taskId)
|
||||
sDecorPCBuffer->items[i].name = sDecorPCBuffer->names[i];
|
||||
sDecorPCBuffer->items[i].id = -2;
|
||||
gMultiuseListMenuTemplate = gUnknown_085A6BD0;
|
||||
gMultiuseListMenuTemplate.unk_10 = sDecorMenuWindowIndices[1];
|
||||
gMultiuseListMenuTemplate.windowId = sDecorMenuWindowIndices[1];
|
||||
gMultiuseListMenuTemplate.totalItems = sDecorPCBuffer->unk_520;
|
||||
gMultiuseListMenuTemplate.items = sDecorPCBuffer->items;
|
||||
gMultiuseListMenuTemplate.maxShowed = sDecorPCBuffer->unk_521;
|
||||
@@ -813,7 +813,7 @@ void sub_8127454(u8 *dest, u16 decorId)
|
||||
StringAppend(dest, gDecorations[decorId].name);
|
||||
}
|
||||
|
||||
void sub_8127480(u32 a0, bool8 flag, struct ListMenu *menu)
|
||||
void sub_8127480(s32 a0, bool8 flag, struct ListMenu *menu)
|
||||
{
|
||||
if (flag != TRUE)
|
||||
{
|
||||
@@ -892,7 +892,7 @@ void sub_812764C(u8 taskId)
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
input = ListMenuHandleInputGetItemId(data[13]);
|
||||
sub_81AE860(data[13], &sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo);
|
||||
ListMenuGetScrollAndRow(data[13], &sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo);
|
||||
switch (input)
|
||||
{
|
||||
case -1:
|
||||
@@ -905,7 +905,7 @@ void sub_812764C(u8 taskId)
|
||||
PlaySE(SE_SELECT);
|
||||
gCurDecorationIndex = input;
|
||||
sub_8127554();
|
||||
sub_81AE6C8(data[13], &sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo);
|
||||
DestroyListMenuTask(data[13], &sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo);
|
||||
sub_8126A58(1);
|
||||
sub_81277A8();
|
||||
free(sDecorPCBuffer);
|
||||
@@ -1074,7 +1074,7 @@ void sub_8127A8C(u8 taskId)
|
||||
data = gTasks[taskId].data;
|
||||
sub_8127554();
|
||||
sub_81277A8();
|
||||
sub_81AE6C8(data[13], NULL, NULL);
|
||||
DestroyListMenuTask(data[13], NULL, NULL);
|
||||
free(sDecorPCBuffer);
|
||||
sub_8126E44(taskId);
|
||||
}
|
||||
@@ -2507,30 +2507,27 @@ void sub_812A040(u8 left, u8 top, u8 right, u8 bottom)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NONMATCHING
|
||||
void sub_812A0E8(u8 taskId)
|
||||
{
|
||||
u8 i;
|
||||
u8 xOff;
|
||||
u8 yOff;
|
||||
u8 decor;
|
||||
register u8 decor asm("r1");
|
||||
struct DecorRearrangementDataBuffer *data;
|
||||
u8 var1;
|
||||
u32 var2;
|
||||
|
||||
sCurDecorSelectedInRearrangement = 0;
|
||||
if (sub_8129FC8(taskId) != TRUE)
|
||||
{
|
||||
for (i = 0; i < gUnknown_0203A17C.size; i ++)
|
||||
for (i = 0; i < gUnknown_0203A17C.size; i++)
|
||||
{
|
||||
decor = gUnknown_0203A17C.items[i];
|
||||
if (decor != DECOR_NONE)
|
||||
var1 = gUnknown_0203A17C.items[i];
|
||||
if (var1 != DECOR_NONE)
|
||||
{
|
||||
data = &sDecorRearrangementDataBuffer[0];
|
||||
sub_8129D8C(decor, data);
|
||||
if (sub_8129E74(taskId, i, data) == TRUE)
|
||||
sub_8129D8C(var1, &sDecorRearrangementDataBuffer[0]);
|
||||
if (sub_8129E74(taskId, i, &sDecorRearrangementDataBuffer[0]) == TRUE)
|
||||
{
|
||||
data->idx = i;
|
||||
sCurDecorSelectedInRearrangement ++;
|
||||
sDecorRearrangementDataBuffer[0].idx = i;
|
||||
sCurDecorSelectedInRearrangement++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2539,95 +2536,13 @@ void sub_812A0E8(u8 taskId)
|
||||
{
|
||||
xOff = gUnknown_0203A17C.pos[sDecorRearrangementDataBuffer[0].idx] >> 4;
|
||||
yOff = gUnknown_0203A17C.pos[sDecorRearrangementDataBuffer[0].idx] & 0x0F;
|
||||
sub_812A040(xOff, yOff - sDecorRearrangementDataBuffer[0].height + 1, xOff + sDecorRearrangementDataBuffer[0].width - 1, yOff); // Arithmetic register swap at the r2 argument: `add r2, r0, r2` instead of `add r2, r2, r0`
|
||||
var1 = yOff - sDecorRearrangementDataBuffer[0].height + 1;
|
||||
var2 = sDecorRearrangementDataBuffer[0].width + xOff - 1;
|
||||
|
||||
sub_812A040(xOff, var1, var2, yOff);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT void sub_812A0E8(u8 taskId)
|
||||
{
|
||||
asm_unified("\tpush {r4-r7,lr}\n"
|
||||
"\tlsls r0, 24\n"
|
||||
"\tlsrs r6, r0, 24\n"
|
||||
"\tldr r4, =sCurDecorSelectedInRearrangement\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tstrb r0, [r4]\n"
|
||||
"\tadds r0, r6, 0\n"
|
||||
"\tbl sub_8129FC8\n"
|
||||
"\tlsls r0, 24\n"
|
||||
"\tlsrs r0, 24\n"
|
||||
"\tcmp r0, 0x1\n"
|
||||
"\tbeq _0812A18C\n"
|
||||
"\tmovs r5, 0\n"
|
||||
"\tldr r0, =gUnknown_0203A17C\n"
|
||||
"\tldrb r1, [r0, 0x8]\n"
|
||||
"\tcmp r5, r1\n"
|
||||
"\tbcs _0812A15A\n"
|
||||
"\tadds r7, r4, 0\n"
|
||||
"_0812A10E:\n"
|
||||
"\tldr r0, [r0]\n"
|
||||
"\tadds r0, r5\n"
|
||||
"\tldrb r1, [r0]\n"
|
||||
"\tcmp r1, 0\n"
|
||||
"\tbeq _0812A14C\n"
|
||||
"\tldr r4, =sDecorRearrangementDataBuffer\n"
|
||||
"\tadds r0, r1, 0\n"
|
||||
"\tadds r1, r4, 0\n"
|
||||
"\tbl sub_8129D8C\n"
|
||||
"\tadds r0, r6, 0\n"
|
||||
"\tadds r1, r5, 0\n"
|
||||
"\tadds r2, r4, 0\n"
|
||||
"\tbl sub_8129E74\n"
|
||||
"\tlsls r0, 24\n"
|
||||
"\tlsrs r0, 24\n"
|
||||
"\tcmp r0, 0x1\n"
|
||||
"\tbne _0812A14C\n"
|
||||
"\tstrb r5, [r4]\n"
|
||||
"\tldrb r0, [r7]\n"
|
||||
"\tadds r0, 0x1\n"
|
||||
"\tstrb r0, [r7]\n"
|
||||
"\tb _0812A15A\n"
|
||||
"\t.pool\n"
|
||||
"_0812A14C:\n"
|
||||
"\tadds r0, r5, 0x1\n"
|
||||
"\tlsls r0, 24\n"
|
||||
"\tlsrs r5, r0, 24\n"
|
||||
"\tldr r0, =gUnknown_0203A17C\n"
|
||||
"\tldrb r1, [r0, 0x8]\n"
|
||||
"\tcmp r5, r1\n"
|
||||
"\tbcc _0812A10E\n"
|
||||
"_0812A15A:\n"
|
||||
"\tldr r0, =sCurDecorSelectedInRearrangement\n"
|
||||
"\tldrb r0, [r0]\n"
|
||||
"\tcmp r0, 0\n"
|
||||
"\tbeq _0812A18C\n"
|
||||
"\tldr r0, =gUnknown_0203A17C\n"
|
||||
"\tldr r2, =sDecorRearrangementDataBuffer\n"
|
||||
"\tldrb r1, [r2]\n"
|
||||
"\tldr r0, [r0, 0x4]\n"
|
||||
"\tadds r0, r1\n"
|
||||
"\tldrb r1, [r0]\n"
|
||||
"\tlsrs r0, r1, 4\n"
|
||||
"\tmovs r3, 0xF\n"
|
||||
"\tands r3, r1\n"
|
||||
"\tldrb r1, [r2, 0x2]\n"
|
||||
"\tsubs r1, r3, r1\n"
|
||||
"\tadds r1, 0x1\n"
|
||||
"\tlsls r1, 24\n"
|
||||
"\tlsrs r1, 24\n"
|
||||
"\tldrb r2, [r2, 0x1]\n"
|
||||
"\tadds r2, r0\n"
|
||||
"\tsubs r2, 0x1\n"
|
||||
"\tlsls r2, 24\n"
|
||||
"\tlsrs r2, 24\n"
|
||||
"\tbl sub_812A040\n"
|
||||
"_0812A18C:\n"
|
||||
"\tpop {r4-r7}\n"
|
||||
"\tpop {r0}\n"
|
||||
"\tbx r0\n"
|
||||
"\t.pool");
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_812A1A0(u8 taskId)
|
||||
{
|
||||
|
||||
@@ -49,7 +49,6 @@ extern u16 gBattle_BG2_Y;
|
||||
extern u16 gBattle_BG3_X;
|
||||
extern u16 gBattle_BG3_Y;
|
||||
extern bool8 gAffineAnimsDisabled;
|
||||
extern u16 gMoveToLearn;
|
||||
extern const u8 gSpeciesNames[][11];
|
||||
|
||||
#define sEvoCursorPos gBattleCommunication[1] // when learning a new move
|
||||
@@ -59,11 +58,6 @@ extern const struct WindowTemplate gUnknown_0833900C;
|
||||
extern const struct CompressedSpriteSheet gMonFrontPicTable[];
|
||||
|
||||
// strings
|
||||
extern const u8 gText_PkmnIsEvolving[];
|
||||
extern const u8 gText_CongratsPkmnEvolved[];
|
||||
extern const u8 gText_BattleYesNoChoice[];
|
||||
extern const u8 gText_PkmnStoppedEvolving[];
|
||||
extern const u8 gText_EllipsisQuestionMark[];
|
||||
extern const u8 gText_CommunicationStandby5[];
|
||||
|
||||
extern void sub_80356D0(void);
|
||||
|
||||
+30
-169
@@ -529,16 +529,17 @@ void DoRippleFieldEffect(struct MapObject *mapObject, struct Sprite *sprite)
|
||||
FieldEffectStart(FLDEFF_RIPPLE);
|
||||
}
|
||||
|
||||
#ifdef NONMATCHING
|
||||
bool32 sub_8097E50(struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
u32 one;
|
||||
bool32 ableToStore = FALSE;
|
||||
if (gUnknown_020375B8 == NULL)
|
||||
{
|
||||
gUnknown_020375B8 = AllocZeroed(0x14);
|
||||
gUnknown_020375B8[0] = mapObject->localId;
|
||||
gUnknown_020375B8[16] = 1;
|
||||
ableToStore = TRUE;
|
||||
// needed to match
|
||||
gUnknown_020375B8[16] = (one = 1);
|
||||
ableToStore = one;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -561,7 +562,7 @@ bool32 sub_8097E50(struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
gUnknown_020375B8[firstFreeSlot] = mapObject->localId;
|
||||
gUnknown_020375B8[16]++;
|
||||
ableToStore = TRUE; // the nonmatching problem is that ableToStore == TRUE isnt being merged with the above ableToStore = TRUE assignment.
|
||||
ableToStore = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -574,174 +575,34 @@ bool32 sub_8097E50(struct MapObject *mapObject, struct Sprite *sprite)
|
||||
sprite->data[2] = 1;
|
||||
return TRUE;
|
||||
}
|
||||
#else
|
||||
__attribute__((naked))
|
||||
bool32 sub_8097E50(struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
push {r4-r7,lr}\n\
|
||||
mov r7, r8\n\
|
||||
push {r7}\n\
|
||||
adds r4, r0, 0\n\
|
||||
mov r8, r1\n\
|
||||
movs r0, 0\n\
|
||||
mov r12, r0\n\
|
||||
ldr r0, =gUnknown_020375B8\n\
|
||||
ldr r1, [r0]\n\
|
||||
adds r6, r0, 0\n\
|
||||
cmp r1, 0\n\
|
||||
bne _08097E80\n\
|
||||
movs r0, 0x14\n\
|
||||
bl AllocZeroed\n\
|
||||
str r0, [r6]\n\
|
||||
ldrb r1, [r4, 0x8]\n\
|
||||
strb r1, [r0]\n\
|
||||
ldr r1, [r6]\n\
|
||||
movs r0, 0x1\n\
|
||||
strb r0, [r1, 0x10]\n\
|
||||
b _08097ECC\n\
|
||||
.pool\n\
|
||||
_08097E80:\n\
|
||||
movs r2, 0x10\n\
|
||||
movs r5, 0\n\
|
||||
movs r1, 0\n\
|
||||
adds r3, r6, 0\n\
|
||||
b _08097E90\n\
|
||||
_08097E8A:\n\
|
||||
adds r0, r1, 0x1\n\
|
||||
lsls r0, 24\n\
|
||||
lsrs r1, r0, 24\n\
|
||||
_08097E90:\n\
|
||||
cmp r1, 0xF\n\
|
||||
bhi _08097EB2\n\
|
||||
cmp r2, 0x10\n\
|
||||
bne _08097EA4\n\
|
||||
ldr r0, [r3]\n\
|
||||
adds r0, r1\n\
|
||||
ldrb r0, [r0]\n\
|
||||
cmp r0, 0\n\
|
||||
bne _08097EA4\n\
|
||||
adds r2, r1, 0\n\
|
||||
_08097EA4:\n\
|
||||
ldr r0, [r3]\n\
|
||||
adds r0, r1\n\
|
||||
ldrb r0, [r0]\n\
|
||||
ldrb r7, [r4, 0x8]\n\
|
||||
cmp r0, r7\n\
|
||||
bne _08097E8A\n\
|
||||
movs r5, 0x1\n\
|
||||
_08097EB2:\n\
|
||||
cmp r5, 0\n\
|
||||
bne _08097ECE\n\
|
||||
cmp r2, 0x10\n\
|
||||
beq _08097ECE\n\
|
||||
ldr r0, [r6]\n\
|
||||
adds r0, r2\n\
|
||||
ldrb r1, [r4, 0x8]\n\
|
||||
strb r1, [r0]\n\
|
||||
ldr r1, [r6]\n\
|
||||
ldrb r0, [r1, 0x10]\n\
|
||||
adds r0, 0x1\n\
|
||||
strb r0, [r1, 0x10]\n\
|
||||
movs r0, 0x1\n\
|
||||
_08097ECC:\n\
|
||||
mov r12, r0\n\
|
||||
_08097ECE:\n\
|
||||
mov r1, r12\n\
|
||||
cmp r1, 0x1\n\
|
||||
bne _08097EE0\n\
|
||||
ldrb r0, [r4, 0x1]\n\
|
||||
movs r1, 0x10\n\
|
||||
orrs r0, r1\n\
|
||||
movs r1, 0x2\n\
|
||||
orrs r0, r1\n\
|
||||
strb r0, [r4, 0x1]\n\
|
||||
_08097EE0:\n\
|
||||
movs r0, 0x1\n\
|
||||
mov r7, r8\n\
|
||||
strh r0, [r7, 0x32]\n\
|
||||
pop {r3}\n\
|
||||
mov r8, r3\n\
|
||||
pop {r4-r7}\n\
|
||||
pop {r1}\n\
|
||||
bx r1\n\
|
||||
.syntax divided");
|
||||
}
|
||||
#endif
|
||||
|
||||
// this function is very similar to the above one and I don't want to decompile this one until the above is matching.
|
||||
__attribute__((naked))
|
||||
bool32 sub_8097EF0(struct MapObject *mapObject, struct Sprite *sprite)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
push {r4-r7,lr}\n\
|
||||
mov r7, r8\n\
|
||||
push {r7}\n\
|
||||
adds r6, r0, 0\n\
|
||||
mov r8, r1\n\
|
||||
movs r0, 0x1\n\
|
||||
strh r0, [r1, 0x32]\n\
|
||||
ldr r5, =gUnknown_020375B8\n\
|
||||
ldr r0, [r5]\n\
|
||||
cmp r0, 0\n\
|
||||
beq _08097F68\n\
|
||||
movs r7, 0\n\
|
||||
adds r0, r6, 0\n\
|
||||
bl sub_8097F78\n\
|
||||
lsls r0, 24\n\
|
||||
lsrs r1, r0, 24\n\
|
||||
cmp r1, 0x10\n\
|
||||
beq _08097F28\n\
|
||||
ldr r0, [r5]\n\
|
||||
adds r0, r1\n\
|
||||
movs r1, 0\n\
|
||||
strb r1, [r0]\n\
|
||||
ldr r1, [r5]\n\
|
||||
ldrb r0, [r1, 0x10]\n\
|
||||
subs r0, 0x1\n\
|
||||
strb r0, [r1, 0x10]\n\
|
||||
movs r7, 0x1\n\
|
||||
_08097F28:\n\
|
||||
ldr r0, [r5]\n\
|
||||
ldrb r4, [r0, 0x10]\n\
|
||||
cmp r4, 0\n\
|
||||
bne _08097F36\n\
|
||||
bl Free\n\
|
||||
str r4, [r5]\n\
|
||||
_08097F36:\n\
|
||||
cmp r7, 0x1\n\
|
||||
bne _08097F68\n\
|
||||
ldrb r0, [r6, 0x5]\n\
|
||||
bl GetFieldObjectGraphicsInfo\n\
|
||||
ldrb r1, [r0, 0xC]\n\
|
||||
lsls r1, 25\n\
|
||||
lsrs r1, 31\n\
|
||||
lsls r1, 4\n\
|
||||
ldrb r2, [r6, 0x1]\n\
|
||||
movs r0, 0x11\n\
|
||||
negs r0, r0\n\
|
||||
ands r0, r2\n\
|
||||
orrs r0, r1\n\
|
||||
movs r1, 0x3\n\
|
||||
negs r1, r1\n\
|
||||
ands r0, r1\n\
|
||||
strb r0, [r6, 0x1]\n\
|
||||
mov r2, r8\n\
|
||||
adds r2, 0x2C\n\
|
||||
ldrb r1, [r2]\n\
|
||||
movs r0, 0x41\n\
|
||||
negs r0, r0\n\
|
||||
ands r0, r1\n\
|
||||
strb r0, [r2]\n\
|
||||
_08097F68:\n\
|
||||
movs r0, 0x1\n\
|
||||
pop {r3}\n\
|
||||
mov r8, r3\n\
|
||||
pop {r4-r7}\n\
|
||||
pop {r1}\n\
|
||||
bx r1\n\
|
||||
.pool\n\
|
||||
.syntax divided");
|
||||
bool32 ableToStore;
|
||||
u8 id;
|
||||
|
||||
sprite->data[2] = 1;
|
||||
if (gUnknown_020375B8 != NULL)
|
||||
{
|
||||
ableToStore = FALSE;
|
||||
id = sub_8097F78(mapObject);
|
||||
if (id != 16)
|
||||
{
|
||||
gUnknown_020375B8[id] = 0;
|
||||
gUnknown_020375B8[16]--;
|
||||
ableToStore = TRUE;
|
||||
}
|
||||
if (gUnknown_020375B8[16] == 0)
|
||||
FREE_AND_SET_NULL(gUnknown_020375B8);
|
||||
if (ableToStore == TRUE)
|
||||
{
|
||||
mapObject->mapobj_bit_12 = GetFieldObjectGraphicsInfo(mapObject->graphicsId)->inanimate;
|
||||
mapObject->mapobj_bit_9 = 0;
|
||||
sprite->animPaused = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
u8 sub_8097F78(struct MapObject *mapObject)
|
||||
|
||||
@@ -0,0 +1,367 @@
|
||||
#include "global.h"
|
||||
#include "constants/songs.h"
|
||||
#include "braille_puzzles.h"
|
||||
#include "event_data.h"
|
||||
#include "event_scripts.h"
|
||||
#include "field_effect.h"
|
||||
#include "gpu_regs.h"
|
||||
#include "gba/io_reg.h"
|
||||
#include "main.h"
|
||||
#include "palette.h"
|
||||
#include "party_menu.h"
|
||||
#include "overworld.h"
|
||||
#include "rom6.h"
|
||||
#include "script.h"
|
||||
#include "sound.h"
|
||||
#include "sprite.h"
|
||||
#include "task.h"
|
||||
|
||||
// structures
|
||||
struct FlashStruct
|
||||
{
|
||||
u8 unk0;
|
||||
u8 unk1;
|
||||
bool8 unk2;
|
||||
bool8 unk3;
|
||||
void (*func)(void);
|
||||
};
|
||||
|
||||
// static functions
|
||||
static void hm2_flash(void);
|
||||
static void sub_81371B4(void);
|
||||
static bool8 sub_8137304(void);
|
||||
static void sub_81373F0(void);
|
||||
static void sub_8137404(u8 taskId);
|
||||
static void sub_8137420(u8 taskId);
|
||||
static void sub_81374C4(u8 taskId);
|
||||
static void sub_813750C(u8 taskId);
|
||||
static void sub_8137574(u8 taskId);
|
||||
static void sub_81375A8(void);
|
||||
static void sub_81375BC(u8 taskId);
|
||||
static void sub_81375D8(u8 taskId);
|
||||
static void sub_8137678(u8 taskId);
|
||||
static void sub_81376DC(u8 taskId);
|
||||
|
||||
// rodata
|
||||
static const struct FlashStruct gUnknown_085B27C8[] =
|
||||
{
|
||||
{1, 4, 1, 0, sub_81375A8},
|
||||
{2, 4, 1, 0, sub_81375A8},
|
||||
{3, 4, 1, 0, sub_81375A8},
|
||||
{5, 4, 1, 0, sub_81375A8},
|
||||
{6, 4, 1, 0, sub_81375A8},
|
||||
{7, 4, 1, 0, sub_81375A8},
|
||||
{8, 4, 1, 0, sub_81375A8},
|
||||
{9, 4, 1, 0, sub_81375A8},
|
||||
{4, 1, 0, 1, sub_81373F0},
|
||||
{4, 2, 0, 1, sub_81373F0},
|
||||
{4, 3, 0, 1, sub_81373F0},
|
||||
{4, 5, 0, 1, sub_81373F0},
|
||||
{4, 6, 0, 1, sub_81373F0},
|
||||
{4, 7, 0, 1, sub_81373F0},
|
||||
{4, 8, 0, 1, sub_81373F0},
|
||||
{4, 9, 0, 1, sub_81373F0},
|
||||
{0, 0, 0, 0, NULL},
|
||||
};
|
||||
|
||||
static const u16 gCaveTransitionPalette_White[] = INCBIN_U16("graphics/misc/cave_transition_white.gbapal");
|
||||
static const u16 gCaveTransitionPalette_Black[] = INCBIN_U16("graphics/misc/cave_transition_black.gbapal");
|
||||
|
||||
static const u16 gUnknown_085B2890[] = INCBIN_U16("graphics/misc/85B2890.gbapal");
|
||||
static const u16 gUnknown_085B28A0[] = INCBIN_U16("graphics/misc/85B28A0.gbapal");
|
||||
static const u16 gCaveTransitionTilemap[] = INCBIN_U16("graphics/misc/cave_transition_map.bin.lz");
|
||||
static const u8 gCaveTransitionTiles[] = INCBIN_U8("graphics/misc/cave_transition.4bpp.lz");
|
||||
|
||||
// text
|
||||
bool8 SetUpFieldMove_Flash(void)
|
||||
{
|
||||
if (ShouldDoBrailleFlyEffect())
|
||||
{
|
||||
gSpecialVar_Result = GetCursorSelectionMonId();
|
||||
gUnknown_03005DB0 = FieldCallback_Teleport;
|
||||
gUnknown_0203CEEC = sub_8179918;
|
||||
return TRUE;
|
||||
}
|
||||
else if (gMapHeader.cave == TRUE && !FlagGet(FLAG_SYS_USE_FLASH))
|
||||
{
|
||||
gUnknown_03005DB0 = FieldCallback_Teleport;
|
||||
gUnknown_0203CEEC = hm2_flash;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void hm2_flash(void)
|
||||
{
|
||||
u8 taskId = oei_task_add();
|
||||
gFieldEffectArguments[0] = GetCursorSelectionMonId();
|
||||
gTasks[taskId].data[8] = (uintptr_t)sub_81371B4 >> 16;
|
||||
gTasks[taskId].data[9] = (uintptr_t)sub_81371B4;
|
||||
}
|
||||
|
||||
static void sub_81371B4(void)
|
||||
{
|
||||
PlaySE(SE_W115);
|
||||
FlagSet(FLAG_SYS_USE_FLASH);
|
||||
ScriptContext1_SetupScript(EventScript_2926F8);
|
||||
}
|
||||
|
||||
static void sub_81371D4(void)
|
||||
{
|
||||
RunTasks();
|
||||
AnimateSprites();
|
||||
BuildOamBuffer();
|
||||
UpdatePaletteFade();
|
||||
}
|
||||
|
||||
static void sub_81371EC(void)
|
||||
{
|
||||
LoadOam();
|
||||
ProcessSpriteCopyRequests();
|
||||
TransferPlttBuffer();
|
||||
}
|
||||
|
||||
void c2_change_map(void)
|
||||
{
|
||||
u16 ime;
|
||||
|
||||
SetVBlankCallback(NULL);
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, 0);
|
||||
SetGpuReg(REG_OFFSET_BG2CNT, 0);
|
||||
SetGpuReg(REG_OFFSET_BG1CNT, 0);
|
||||
SetGpuReg(REG_OFFSET_BG0CNT, 0);
|
||||
SetGpuReg(REG_OFFSET_BG2HOFS, 0);
|
||||
SetGpuReg(REG_OFFSET_BG2VOFS, 0);
|
||||
SetGpuReg(REG_OFFSET_BG1HOFS, 0);
|
||||
SetGpuReg(REG_OFFSET_BG1VOFS, 0);
|
||||
SetGpuReg(REG_OFFSET_BG0HOFS, 0);
|
||||
SetGpuReg(REG_OFFSET_BG0VOFS, 0);
|
||||
DmaFill16(3, 0, (void *)VRAM, VRAM_SIZE);
|
||||
DmaFill32(3, 0, (void *)OAM, OAM_SIZE);
|
||||
DmaFill16(3, 0, (void *)(PLTT + 2), PLTT_SIZE - 2);
|
||||
ResetPaletteFade();
|
||||
ResetTasks();
|
||||
ResetSpriteData();
|
||||
ime = REG_IME;
|
||||
REG_IME = 0;
|
||||
REG_IE |= INTR_FLAG_VBLANK;
|
||||
REG_IME = ime;
|
||||
SetVBlankCallback(sub_81371EC);
|
||||
SetMainCallback2(sub_81371D4);
|
||||
if (!sub_8137304())
|
||||
SetMainCallback2(gMain.savedCallback);
|
||||
}
|
||||
|
||||
static bool8 sub_8137304(void)
|
||||
{
|
||||
u8 i;
|
||||
u8 v0 = get_map_light_from_warp0();
|
||||
u8 v1 = Overworld_GetMapTypeOfSaveblockLocation();
|
||||
|
||||
for (i = 0; gUnknown_085B27C8[i].unk0; i++)
|
||||
{
|
||||
if (gUnknown_085B27C8[i].unk0 == v0 && gUnknown_085B27C8[i].unk1 == v1)
|
||||
{
|
||||
gUnknown_085B27C8[i].func();
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 sub_8137360(u8 a1, u8 a2)
|
||||
{
|
||||
u8 i;
|
||||
u8 v0 = a1;
|
||||
u8 v1 = a2;
|
||||
|
||||
for (i = 0; gUnknown_085B27C8[i].unk0; i++)
|
||||
{
|
||||
if (gUnknown_085B27C8[i].unk0 == v0 && gUnknown_085B27C8[i].unk1 == v1)
|
||||
{
|
||||
return gUnknown_085B27C8[i].unk2;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 fade_type_for_given_maplight_pair(u8 a1, u8 a2)
|
||||
{
|
||||
u8 i;
|
||||
u8 v0 = a1;
|
||||
u8 v1 = a2;
|
||||
|
||||
for (i = 0; gUnknown_085B27C8[i].unk0; i++)
|
||||
{
|
||||
if (gUnknown_085B27C8[i].unk0 == v0 && gUnknown_085B27C8[i].unk1 == v1)
|
||||
{
|
||||
return gUnknown_085B27C8[i].unk3;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void sub_81373F0(void)
|
||||
{
|
||||
CreateTask(sub_8137404, 0);
|
||||
}
|
||||
|
||||
static void sub_8137404(u8 taskId)
|
||||
{
|
||||
gTasks[taskId].func = sub_8137420;
|
||||
}
|
||||
|
||||
static void sub_8137420(u8 taskId)
|
||||
{
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, 0);
|
||||
LZ77UnCompVram(gCaveTransitionTiles, (void *)0x600C000);
|
||||
LZ77UnCompVram(gCaveTransitionTilemap, (void *)0x600F800);
|
||||
LoadPalette(gCaveTransitionPalette_White, 0xE0, 0x20);
|
||||
LoadPalette(gUnknown_085B28A0, 0xE0, 0x10);
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0
|
||||
| BLDCNT_EFFECT_BLEND
|
||||
| BLDCNT_TGT2_BG1
|
||||
| BLDCNT_TGT2_BG2
|
||||
| BLDCNT_TGT2_BG3
|
||||
| BLDCNT_TGT2_OBJ
|
||||
| BLDCNT_TGT2_BD);
|
||||
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
|
||||
SetGpuReg(REG_OFFSET_BLDY, 0);
|
||||
SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0)
|
||||
| BGCNT_CHARBASE(3)
|
||||
| BGCNT_SCREENBASE(31)
|
||||
| BGCNT_16COLOR
|
||||
| BGCNT_TXT256x256);
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0
|
||||
| DISPCNT_OBJ_1D_MAP
|
||||
| DISPCNT_BG0_ON
|
||||
| DISPCNT_OBJ_ON);
|
||||
gTasks[taskId].func = sub_81374C4;
|
||||
gTasks[taskId].data[0] = 16;
|
||||
gTasks[taskId].data[1] = 0;
|
||||
}
|
||||
|
||||
static void sub_81374C4(u8 taskId)
|
||||
{
|
||||
u16 count = gTasks[taskId].data[1];
|
||||
u16 blend = count + 0x1000;
|
||||
|
||||
SetGpuReg(REG_OFFSET_BLDALPHA, blend);
|
||||
if (count <= 0x10)
|
||||
{
|
||||
gTasks[taskId].data[1]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
gTasks[taskId].data[2] = 0;
|
||||
gTasks[taskId].func = sub_813750C;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_813750C(u8 taskId)
|
||||
{
|
||||
u16 count;
|
||||
|
||||
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 16));
|
||||
count = gTasks[taskId].data[2];
|
||||
|
||||
if (count < 8)
|
||||
{
|
||||
gTasks[taskId].data[2]++;
|
||||
LoadPalette(&gUnknown_085B28A0[count], 0xE0, 16 - 2 * count);
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadPalette(gCaveTransitionPalette_White, 0, 0x20);
|
||||
gTasks[taskId].func = sub_8137574;
|
||||
gTasks[taskId].data[2] = 8;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_8137574(u8 taskId)
|
||||
{
|
||||
if (gTasks[taskId].data[2])
|
||||
gTasks[taskId].data[2]--;
|
||||
else
|
||||
SetMainCallback2(gMain.savedCallback);
|
||||
}
|
||||
|
||||
static void sub_81375A8(void)
|
||||
{
|
||||
CreateTask(sub_81375BC, 0);
|
||||
}
|
||||
|
||||
static void sub_81375BC(u8 taskId)
|
||||
{
|
||||
gTasks[taskId].func = sub_81375D8;
|
||||
}
|
||||
|
||||
static void sub_81375D8(u8 taskId)
|
||||
{
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, 0);
|
||||
LZ77UnCompVram(gCaveTransitionTiles, (void *)0x600C000);
|
||||
LZ77UnCompVram(gCaveTransitionTilemap, (void *)0x600F800);
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
||||
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
|
||||
SetGpuReg(REG_OFFSET_BLDY, 0);
|
||||
SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0)
|
||||
| BGCNT_CHARBASE(3)
|
||||
| BGCNT_SCREENBASE(31)
|
||||
| BGCNT_16COLOR
|
||||
| BGCNT_TXT256x256);
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0
|
||||
| DISPCNT_OBJ_1D_MAP
|
||||
| DISPCNT_BG0_ON
|
||||
| DISPCNT_OBJ_ON);
|
||||
LoadPalette(gCaveTransitionPalette_White, 0xE0, 0x20);
|
||||
LoadPalette(gCaveTransitionPalette_Black, 0, 0x20);
|
||||
gTasks[taskId].func = sub_8137678;
|
||||
gTasks[taskId].data[0] = 16;
|
||||
gTasks[taskId].data[1] = 0;
|
||||
gTasks[taskId].data[2] = 0;
|
||||
}
|
||||
|
||||
static void sub_8137678(u8 taskId)
|
||||
{
|
||||
u16 count = gTasks[taskId].data[2];
|
||||
|
||||
if (count < 16)
|
||||
{
|
||||
gTasks[taskId].data[2]++;
|
||||
gTasks[taskId].data[2]++;
|
||||
LoadPalette(&gUnknown_085B2890[15 - count], 0xE0, 2 * (count + 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 16));
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0
|
||||
| BLDCNT_EFFECT_BLEND
|
||||
| BLDCNT_TGT2_BG1
|
||||
| BLDCNT_TGT2_BG2
|
||||
| BLDCNT_TGT2_BG3
|
||||
| BLDCNT_TGT2_OBJ
|
||||
| BLDCNT_TGT2_BD);
|
||||
gTasks[taskId].func = sub_81376DC;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_81376DC(u8 taskId)
|
||||
{
|
||||
u16 count = 16 - gTasks[taskId].data[1];
|
||||
u16 blend = count + 0x1000;
|
||||
|
||||
SetGpuReg(REG_OFFSET_BLDALPHA, blend);
|
||||
if (count)
|
||||
{
|
||||
gTasks[taskId].data[1]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadPalette(gCaveTransitionPalette_Black, 0, 0x20);
|
||||
SetMainCallback2(gMain.savedCallback);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,299 @@
|
||||
#include "global.h"
|
||||
#include "global.fieldmap.h"
|
||||
#include "constants/flags.h"
|
||||
#include "constants/songs.h"
|
||||
#include "event_data.h"
|
||||
#include "field_camera.h"
|
||||
#include "field_map_obj.h"
|
||||
#include "malloc.h"
|
||||
#include "random.h"
|
||||
#include "roulette_util.h"
|
||||
#include "script.h"
|
||||
#include "sound.h"
|
||||
#include "sprite.h"
|
||||
#include "task.h"
|
||||
|
||||
// structures
|
||||
struct Struct203CF18 {
|
||||
u8 taskId;
|
||||
struct InnerStruct203CF18 unk4;
|
||||
}; //size = 0xC8
|
||||
|
||||
// extern data
|
||||
extern const struct SpriteSheet gUnknown_08617D94[];
|
||||
extern const s16 gUnknown_08617D64[][3];
|
||||
|
||||
// static functions
|
||||
static void sub_81BE808(u8 taskId);
|
||||
static void sub_81BE900(u8 taskId);
|
||||
static void sub_81BE968(void);
|
||||
static void sub_81BE9C0(u8 taskId);
|
||||
static void sub_81BEA00(u8 taskId);
|
||||
static void sub_81BEA20(void);
|
||||
static void sub_81BEAD8(struct Sprite* sprite);
|
||||
|
||||
// rodata
|
||||
static const u8 gUnknown_08617E18[] = {0x3b, 0x43, 0x61, 0x00, 0x0f, 0x05, 0xff, 0x9b};
|
||||
|
||||
static const union AnimCmd gSpriteAnim_8617E20[] =
|
||||
{
|
||||
ANIMCMD_FRAME(0, 12),
|
||||
ANIMCMD_JUMP(0),
|
||||
};
|
||||
|
||||
static const union AnimCmd *const gSpriteAnimTable_8617E28[] =
|
||||
{
|
||||
gSpriteAnim_8617E20,
|
||||
};
|
||||
|
||||
static const struct OamData gUnknown_08617E2C =
|
||||
{
|
||||
.y = 0,
|
||||
.affineMode = 0,
|
||||
.objMode = 0,
|
||||
.mosaic = 0,
|
||||
.bpp = 0,
|
||||
.shape = 0,
|
||||
.x = 0,
|
||||
.matrixNum = 0,
|
||||
.size = 0,
|
||||
.tileNum = 0,
|
||||
.priority = 0,
|
||||
.paletteNum = 0,
|
||||
.affineParam = 0,
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate gUnknown_08617E34 = {
|
||||
0x0FA0, 0xFFFF, &gUnknown_08617E2C, gSpriteAnimTable_8617E28, NULL, gDummySpriteAffineAnimTable, sub_81BEAD8
|
||||
};
|
||||
|
||||
static const union AnimCmd gSpriteAnim_8617E4C[] =
|
||||
{
|
||||
ANIMCMD_FRAME(0, 12),
|
||||
ANIMCMD_JUMP(0),
|
||||
};
|
||||
|
||||
static const union AnimCmd *const gSpriteAnim_8617E54[] =
|
||||
{
|
||||
gSpriteAnim_8617E4C,
|
||||
};
|
||||
|
||||
static const struct OamData gSpriteAnim_8617E58 =
|
||||
{
|
||||
.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 struct SpriteTemplate gUnknown_08617E60 = {
|
||||
0x0FA0, 0xFFFF, &gSpriteAnim_8617E58, gSpriteAnim_8617E54, NULL, gDummySpriteAffineAnimTable, sub_81BEAD8
|
||||
};
|
||||
|
||||
// ewram
|
||||
EWRAM_DATA struct Struct203CF18 *gUnknown_0203CF18 = NULL;
|
||||
|
||||
// text
|
||||
bool8 sub_81BE66C(void)
|
||||
{
|
||||
if (!(gSaveBlock1Ptr->location.mapGroup == 0x0 && gSaveBlock1Ptr->location.mapNum == 0x1A))
|
||||
return 0;
|
||||
return FlagGet(FLAG_0x14E);
|
||||
}
|
||||
|
||||
void sub_81BE698(u8 taskId)
|
||||
{
|
||||
sub_8151E50(&(gUnknown_0203CF18->unk4));
|
||||
}
|
||||
|
||||
void sub_81BE6AC(void)
|
||||
{
|
||||
gUnknown_0203CF18 = NULL;
|
||||
}
|
||||
|
||||
void sub_81BE6B8(void)
|
||||
{
|
||||
if(gUnknown_0203CF18 != NULL)
|
||||
{
|
||||
gUnknown_0203CF18 = NULL;
|
||||
return;
|
||||
}
|
||||
if(!(gSaveBlock1Ptr->location.mapGroup == 0x0 && gSaveBlock1Ptr->location.mapNum == 0x1A) || !FlagGet(FLAG_0x14E))
|
||||
return;
|
||||
|
||||
gUnknown_0203CF18 = (struct Struct203CF18 *)AllocZeroed(sizeof(struct Struct203CF18));
|
||||
sub_8151B3C(&(gUnknown_0203CF18->unk4));
|
||||
sub_8151B68(&(gUnknown_0203CF18->unk4), gUnknown_08617E18);
|
||||
sub_8151CA8(&(gUnknown_0203CF18->unk4), 1, 1);
|
||||
gUnknown_0203CF18->taskId = CreateTask(sub_81BE698, 0xFF);
|
||||
}
|
||||
|
||||
void sub_81BE72C(void)
|
||||
{
|
||||
if(!(gSaveBlock1Ptr->location.mapGroup == 0x0 && gSaveBlock1Ptr->location.mapNum == 0x1A) || !FlagGet(FLAG_0x14E) || gUnknown_0203CF18 == NULL)
|
||||
return;
|
||||
if(FuncIsActiveTask(sub_81BE698))
|
||||
DestroyTask(gUnknown_0203CF18->taskId);
|
||||
sub_8151D28(&(gUnknown_0203CF18->unk4), 1, 1);
|
||||
sub_8151C50(&(gUnknown_0203CF18->unk4), 1, 1);
|
||||
Free(gUnknown_0203CF18);
|
||||
gUnknown_0203CF18 = NULL;
|
||||
}
|
||||
|
||||
void sub_81BE79C(void)
|
||||
{
|
||||
u16 rand;
|
||||
bool8 chance;
|
||||
|
||||
if(VarGet(VAR_0x40CB) != 0)
|
||||
{
|
||||
FlagClear(FLAG_0x14E);
|
||||
return;
|
||||
}
|
||||
rand = Random();
|
||||
chance = rand & 1;
|
||||
if(FlagGet(FLAG_0x09D) == TRUE)
|
||||
chance = TRUE;
|
||||
if(chance)
|
||||
{
|
||||
FlagSet(FLAG_0x14E);
|
||||
sub_81BE6B8();
|
||||
return;
|
||||
}
|
||||
FlagClear(FLAG_0x14E);
|
||||
}
|
||||
|
||||
void sub_81BE7F4(void)
|
||||
{
|
||||
CreateTask(sub_81BE808, 0x8);
|
||||
}
|
||||
|
||||
static void sub_81BE808(u8 taskId)
|
||||
{
|
||||
u8 mapObjectIdBuffer;
|
||||
struct MapObject *fieldMapObject;
|
||||
struct MapObject *playerAvatarMapObject;
|
||||
|
||||
TryGetFieldObjectIdByLocalIdAndMap(0x2D, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &mapObjectIdBuffer);
|
||||
fieldMapObject = &(gMapObjects[mapObjectIdBuffer]);
|
||||
gSprites[fieldMapObject->spriteId].pos2.y += 4;
|
||||
playerAvatarMapObject = &(gMapObjects[gPlayerAvatar.mapObjectId]);
|
||||
|
||||
if((gSprites[fieldMapObject->spriteId].pos1.y + gSprites[fieldMapObject->spriteId].pos2.y) >=
|
||||
(gSprites[playerAvatarMapObject->spriteId].pos1.y + gSprites[playerAvatarMapObject->spriteId].pos2.y))
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
}
|
||||
}
|
||||
|
||||
static void sp136_strengh_sound(u8 a, u8 b, u8 c, u8 d)
|
||||
{
|
||||
u8 taskId;
|
||||
|
||||
taskId = CreateTask(sub_81BE900, 0x9);
|
||||
gTasks[taskId].data[0] = b;
|
||||
gTasks[taskId].data[1] = 0;
|
||||
gTasks[taskId].data[2] = c;
|
||||
gTasks[taskId].data[3] = d;
|
||||
gTasks[taskId].data[4] = a;
|
||||
SetCameraPanningCallback(NULL);
|
||||
PlaySE(SE_W070);
|
||||
}
|
||||
|
||||
static void sub_81BE900(u8 taskId)
|
||||
{
|
||||
s16 *data;
|
||||
|
||||
data = gTasks[taskId].data;
|
||||
data[1]++;
|
||||
if((data[1] % data[3]) == 0)
|
||||
{
|
||||
data[1] = 0;
|
||||
data[2]--;
|
||||
data[0] = -data[0];
|
||||
data[4] = -data[4];
|
||||
SetCameraPanning(data[0], data[4]);
|
||||
if(!data[2])
|
||||
{
|
||||
sub_81BE968();
|
||||
DestroyTask(taskId);
|
||||
InstallCameraPanAheadCallback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_81BE968(void)
|
||||
{
|
||||
u8 taskId;
|
||||
|
||||
taskId = FindTaskIdByFunc(sub_81BE9C0);
|
||||
if(taskId != 0xFF)
|
||||
gTasks[taskId].data[0]++;
|
||||
}
|
||||
|
||||
void sub_81BE994(void)
|
||||
{
|
||||
LoadSpriteSheets(gUnknown_08617D94);
|
||||
sub_81BEA20();
|
||||
CreateTask(sub_81BE9C0, 0x8);
|
||||
sp136_strengh_sound(2, 1, 16, 3);
|
||||
}
|
||||
|
||||
static void sub_81BE9C0(u8 taskId)
|
||||
{
|
||||
u16 *data;
|
||||
|
||||
data = gTasks[taskId].data;
|
||||
data[1]++;
|
||||
if(data[1] == 1000 || data[0] == 17)
|
||||
gTasks[taskId].func = sub_81BEA00;
|
||||
}
|
||||
|
||||
static void sub_81BEA00(u8 taskId)
|
||||
{
|
||||
FreeSpriteTilesByTag(4000);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
}
|
||||
|
||||
static void sub_81BEA20(void)
|
||||
{
|
||||
u8 i;
|
||||
u8 spriteId;
|
||||
|
||||
for(i = 0; i < 8; i++)
|
||||
{
|
||||
spriteId = CreateSprite(&gUnknown_08617E60, gUnknown_08617D64[i][0] + 120, gUnknown_08617D64[i][1], 8);
|
||||
gSprites[spriteId].oam.priority = 0;
|
||||
gSprites[spriteId].oam.paletteNum = 0;
|
||||
gSprites[spriteId].data[0] = i;
|
||||
}
|
||||
for(i = 0; i < 8; i++)
|
||||
{
|
||||
spriteId = CreateSprite(&gUnknown_08617E34, gUnknown_08617D64[i][0] + 115, gUnknown_08617D64[i][1] - 3, 8);
|
||||
gSprites[spriteId].oam.priority = 0;
|
||||
gSprites[spriteId].oam.paletteNum = 0;
|
||||
gSprites[spriteId].data[0] = i;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_81BEAD8(struct Sprite* sprite)
|
||||
{
|
||||
sprite->data[1] += 2;
|
||||
sprite->pos2.y = (sprite->data[1] / 2);
|
||||
if(((sprite->pos1.y) + (sprite->pos2.y)) > gUnknown_08617D64[sprite->data[0]][2])
|
||||
{
|
||||
DestroySprite(sprite);
|
||||
sub_81BE968();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
#include "global.h"
|
||||
#include "menu.h"
|
||||
#include "party_menu.h"
|
||||
#include "pokemon.h"
|
||||
#include "constants/songs.h"
|
||||
#include "sound.h"
|
||||
#include "sprite.h"
|
||||
#include "string_util.h"
|
||||
#include "strings.h"
|
||||
#include "task.h"
|
||||
|
||||
static void sub_816166C(u8 taskId);
|
||||
static void sub_81616C0(u8 taskId);
|
||||
static void sub_8161724(u8 taskId);
|
||||
static void sub_81617B8(u8 taskId);
|
||||
|
||||
bool8 SetUpFieldMove_SoftBoiled(void)
|
||||
{
|
||||
u16 maxHp;
|
||||
u16 hp;
|
||||
u16 minHp;
|
||||
|
||||
maxHp = GetMonData(&gPlayerParty[GetCursorSelectionMonId()], MON_DATA_MAX_HP);
|
||||
hp = GetMonData(&gPlayerParty[GetCursorSelectionMonId()], MON_DATA_HP);
|
||||
|
||||
minHp = (maxHp / 5);
|
||||
if (hp > minHp)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void sub_8161560(u8 taskId)
|
||||
{
|
||||
gUnknown_0203CEC8.unkB = 0xA;
|
||||
gUnknown_0203CEC8.unkA = gUnknown_0203CEC8.unk9;
|
||||
sub_81B0FCC(GetCursorSelectionMonId(), 0x1);
|
||||
display_pokemon_menu_message(0x5);
|
||||
gTasks[taskId].func = sub_81B1370;
|
||||
}
|
||||
|
||||
void sub_81615A8(u8 taskId)
|
||||
{
|
||||
u16 hp;
|
||||
|
||||
u8 unk9 = gUnknown_0203CEC8.unk9;
|
||||
u8 pokemonIndex = gUnknown_0203CEC8.unkA;
|
||||
if(pokemonIndex > 6)
|
||||
{
|
||||
gUnknown_0203CEC8.unkB = 0;
|
||||
display_pokemon_menu_message(0x0);
|
||||
gTasks[taskId].func = sub_81B1370;
|
||||
return;
|
||||
}
|
||||
|
||||
hp = GetMonData(&gPlayerParty[pokemonIndex], MON_DATA_HP);
|
||||
if(hp == 0 || unk9 == pokemonIndex || GetMonData(&gPlayerParty[pokemonIndex], MON_DATA_MAX_HP) == hp)
|
||||
{
|
||||
sub_81617B8(taskId);
|
||||
return;
|
||||
}
|
||||
|
||||
PlaySE(SE_KAIFUKU);
|
||||
sub_81B1F18(taskId, unk9, -1, GetMonData(&gPlayerParty[unk9], MON_DATA_MAX_HP)/5, sub_816166C);
|
||||
}
|
||||
|
||||
static void sub_816166C(u8 taskId)
|
||||
{
|
||||
PlaySE(SE_KAIFUKU);
|
||||
sub_81B1F18(taskId, gUnknown_0203CEC8.unkA, 1, GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_MAX_HP)/5, sub_81616C0);
|
||||
}
|
||||
|
||||
static void sub_81616C0(u8 taskId)
|
||||
{
|
||||
GetMonNickname(&gPlayerParty[gUnknown_0203CEC8.unkA], gStringVar1);
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnHPRestoredByVar2);
|
||||
sub_81B1B5C(gStringVar4, 0);
|
||||
schedule_bg_copy_tilemap_to_vram(2);
|
||||
gTasks[taskId].func = sub_8161724;
|
||||
}
|
||||
|
||||
static void sub_8161724(u8 taskId)
|
||||
{
|
||||
if(sub_81B1BD4() == 1)
|
||||
return;
|
||||
gUnknown_0203CEC8.unkB = 0x0;
|
||||
sub_81B0FCC(gUnknown_0203CEC8.unk9, 0);
|
||||
gUnknown_0203CEC8.unk9 = gUnknown_0203CEC8.unkA;
|
||||
sub_81B0FCC(gUnknown_0203CEC8.unkA, 1);
|
||||
sub_8198070(0x6, FALSE);
|
||||
ClearWindowTilemap(0x6);
|
||||
display_pokemon_menu_message(0);
|
||||
gTasks[taskId].func = sub_81B1370;
|
||||
}
|
||||
|
||||
static void sub_8161784(u8 taskId)
|
||||
{
|
||||
if(sub_81B1BD4() == 1)
|
||||
return;
|
||||
display_pokemon_menu_message(0x5);
|
||||
gTasks[taskId].func = sub_81B1370;
|
||||
}
|
||||
|
||||
static void sub_81617B8(u8 taskId)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
sub_81B1B5C(&gText_CantBeUsedOnPkmn, 0);
|
||||
schedule_bg_copy_tilemap_to_vram(2);
|
||||
gTasks[taskId].func = sub_8161784;
|
||||
}
|
||||
@@ -7,9 +7,11 @@
|
||||
#include "script.h"
|
||||
#include "task.h"
|
||||
|
||||
void FldEff_UseStrength(void);
|
||||
void sub_8145E74(void);
|
||||
// static functions
|
||||
static void FldEff_UseStrength(void);
|
||||
static void sub_8145E74(void);
|
||||
|
||||
// text
|
||||
bool8 SetUpFieldMove_Strength(void)
|
||||
{
|
||||
if (npc_before_player_of_type(87) == TRUE)
|
||||
@@ -22,7 +24,7 @@ bool8 SetUpFieldMove_Strength(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void FldEff_UseStrength(void)
|
||||
static void FldEff_UseStrength(void)
|
||||
{
|
||||
gFieldEffectArguments[0] = GetCursorSelectionMonId();
|
||||
ScriptContext1_SetupScript(FieryPath_EventScript_2908FD);
|
||||
@@ -37,7 +39,7 @@ bool8 sub_8145E2C(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void sub_8145E74(void)
|
||||
static void sub_8145E74(void)
|
||||
{
|
||||
FieldEffectActiveListRemove(FLDEFF_USE_STRENGTH);
|
||||
EnableBothScriptContexts();
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "field_effect.h"
|
||||
#include "field_player_avatar.h"
|
||||
#include "field_screen.h"
|
||||
#include "fldeff_groundshake.h"
|
||||
#include "palette.h"
|
||||
#include "party_menu.h"
|
||||
#include "rom6.h"
|
||||
@@ -20,6 +19,8 @@ void hm2_sweet_scent(void);
|
||||
void sub_8159F5C(void);
|
||||
void sub_8159FEC(u8 taskId);
|
||||
void sub_815A090(u8 taskId);
|
||||
void sub_81BE6B8(void);
|
||||
void sub_81BE72C(void);
|
||||
|
||||
bool8 SetUpFieldMove_SweetScent(void)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,770 @@
|
||||
#include "global.h"
|
||||
#include "constants/flags.h"
|
||||
#include "constants/songs.h"
|
||||
#include "bg.h"
|
||||
#include "event_data.h"
|
||||
#include "field_camera.h"
|
||||
#include "field_map_obj.h"
|
||||
#include "fieldmap.h"
|
||||
#include "global.fieldmap.h"
|
||||
#include "gpu_regs.h"
|
||||
#include "malloc.h"
|
||||
#include "menu.h"
|
||||
#include "random.h"
|
||||
#include "script.h"
|
||||
#include "sound.h"
|
||||
#include "sprite.h"
|
||||
#include "task.h"
|
||||
#include "window.h"
|
||||
|
||||
#define MIRAGE_TOWER_GFX_LENGTH (sizeof(gUnknown_08617274) + sizeof(gMirageTower_Gfx))
|
||||
#define MIRAGE_TOWER_PALETTE_LENGTH 0x800
|
||||
#define ROOT_FOSSIL_GFX_LENGTH sizeof(gRootFossil_Gfx)
|
||||
#define ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH 0x100
|
||||
|
||||
//struct
|
||||
struct Struct8617DA4 {
|
||||
u8 x;
|
||||
u8 y;
|
||||
u16 tileId;
|
||||
};
|
||||
|
||||
struct Struct203CF10 {
|
||||
u8 *buffer;
|
||||
u8 curr_buffer_index;
|
||||
};
|
||||
|
||||
struct DynamicSpriteFrameImage{
|
||||
u8 *data;
|
||||
u16 size;
|
||||
};
|
||||
|
||||
struct Struct203CF0C {
|
||||
u8 *frameImageTiles;
|
||||
struct DynamicSpriteFrameImage *frameImage;
|
||||
u8 spriteId;
|
||||
u16 *unkC;
|
||||
u16 unk10;
|
||||
};
|
||||
|
||||
// static functions
|
||||
static void sub_81BED50(u8 taskId);
|
||||
static void sub_81BEBF4(u8 taskId);
|
||||
static void sub_81BF028(u8 taskId);
|
||||
static void sub_81BF248(struct Sprite *);
|
||||
/*static*/ void sub_81BF2B8(u8* a, u16 b, u8 c, u8 d, u8 e);
|
||||
|
||||
// .rodata
|
||||
static const u8 gUnknown_08617274[] = {00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00};
|
||||
static const u8 gMirageTower_Gfx[] = INCBIN_U8("graphics/misc/mirage_tower.4bpp");
|
||||
static const u16 gUnknown_08617B94[] = INCBIN_U16("graphics/misc/mirage_tower.bin");
|
||||
static const u16 gRootFossil_Pal[] = INCBIN_U16("graphics/misc/fossil.gbapal");
|
||||
static const u8 gRootFossil_Gfx[] = INCBIN_U8("graphics/misc/fossil.4bpp");
|
||||
static const u8 gMirageTowerCrumbles_Gfx[] = INCBIN_U8("graphics/misc/mirage_tower_crumbles.4bpp");
|
||||
static const u16 gMirageTowerCrumbles_Palette[] = INCBIN_U16("graphics/misc/mirage_tower_crumbles.gbapal");
|
||||
|
||||
const s16 gUnknown_08617D64[][3] =
|
||||
{
|
||||
{ 0, 10, 65},
|
||||
{ 17, 3, 50},
|
||||
{-12, 0, 75},
|
||||
{ 10, 15, 90},
|
||||
{ 7, 8, 65},
|
||||
{-18, 5, 75},
|
||||
{ 22, -10, 55},
|
||||
{-24, -4, 65},
|
||||
};
|
||||
|
||||
const struct SpriteSheet gUnknown_08617D94[] =
|
||||
{
|
||||
{gMirageTowerCrumbles_Gfx, 0x0080, 0x0fa0},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
static const struct Struct8617DA4 gUnknown_08617DA4[] =
|
||||
{
|
||||
{0x12, 0x35, 0x251},
|
||||
{0x13, 0x35, 0x251},
|
||||
{0x14, 0x35, 0x251},
|
||||
{0x12, 0x36, 0x251},
|
||||
{0x13, 0x36, 0x251},
|
||||
{0x14, 0x36, 0x251},
|
||||
{0x12, 0x37, 0x251},
|
||||
{0x13, 0x37, 0x251},
|
||||
{0x14, 0x37, 0x251},
|
||||
{0x12, 0x38, 0x251},
|
||||
{0x13, 0x38, 0x251},
|
||||
{0x14, 0x38, 0x251},
|
||||
{0x12, 0x39, 0x259},
|
||||
{0x13, 0x39, 0x259},
|
||||
{0x14, 0x39, 0x259},
|
||||
{0x12, 0x3A, 0x121},
|
||||
{0x13, 0x3A, 0x121},
|
||||
{0x14, 0x3A, 0x121},
|
||||
};
|
||||
|
||||
static const union AnimCmd gSpriteAnim_8617DEC[] =
|
||||
{
|
||||
ANIMCMD_FRAME(0, 1),
|
||||
ANIMCMD_END,
|
||||
};
|
||||
|
||||
static const struct OamData gOamData_8617DF4 =
|
||||
{
|
||||
.y = 0,
|
||||
.affineMode = 0,
|
||||
.objMode = 0,
|
||||
.mosaic = 0,
|
||||
.bpp = 0,
|
||||
.shape = 0,
|
||||
.x = 0,
|
||||
.matrixNum = 0,
|
||||
.size = 1,
|
||||
.tileNum = 0,
|
||||
.priority = 0,
|
||||
.paletteNum = 3,
|
||||
.affineParam = 0,
|
||||
};
|
||||
|
||||
static const union AnimCmd *const gSpriteAnimTable_8617DFC[] =
|
||||
{
|
||||
gSpriteAnim_8617DEC,
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate gUnknown_08617E00 = {
|
||||
0xFFFF, 0xFFFF, &gOamData_8617DF4, gSpriteAnimTable_8617DFC, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
|
||||
};
|
||||
|
||||
// ewram
|
||||
EWRAM_DATA u8* gUnknown_0203CF04 = NULL;
|
||||
EWRAM_DATA u8* gUnknown_0203CF08 = NULL;
|
||||
EWRAM_DATA struct Struct203CF0C *gUnknown_0203CF0C = NULL;
|
||||
EWRAM_DATA struct Struct203CF10 *gUnknown_0203CF10 = NULL;
|
||||
EWRAM_DATA u16 *gUnknown_0203CF14 = NULL;
|
||||
|
||||
// iwram
|
||||
IWRAM_DATA u16 gUnknown_030012A8[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
// text
|
||||
void sub_81BEB24(void)
|
||||
{
|
||||
u8 i;
|
||||
for(i = 0; i < (sizeof(gUnknown_08617DA4)/sizeof(gUnknown_08617DA4[0])); i++)
|
||||
MapGridSetMetatileIdAt(gUnknown_08617DA4[i].x + 7, gUnknown_08617DA4[i].y + 7, gUnknown_08617DA4[i].tileId);
|
||||
DrawWholeMapView();
|
||||
}
|
||||
|
||||
void sub_81BEB54(void)
|
||||
{
|
||||
CreateTask(sub_81BED50, 0x9);
|
||||
}
|
||||
|
||||
void sub_81BEB68(void)
|
||||
{
|
||||
CreateTask(sub_81BEBF4, 0x9);
|
||||
}
|
||||
|
||||
void sub_81BEB7C(void)
|
||||
{
|
||||
CreateTask(sub_81BF028, 0x9);
|
||||
}
|
||||
|
||||
void sub_81BEB90(void)
|
||||
{
|
||||
SetGpuReg(REG_OFFSET_BG0HOFS, gUnknown_0203CF14[0]);
|
||||
SetGpuReg(REG_OFFSET_BG0VOFS, gUnknown_0203CF14[1]);
|
||||
}
|
||||
|
||||
void sub_81BEBB4(u8 taskId)
|
||||
{
|
||||
if(!(gTasks[taskId].data[0]))
|
||||
{
|
||||
gUnknown_0203CF14[0] = -gUnknown_0203CF14[0];
|
||||
gTasks[taskId].data[0] = 2;
|
||||
sub_81BEB90();
|
||||
}
|
||||
else
|
||||
gTasks[taskId].data[0]--;
|
||||
}
|
||||
|
||||
static void sub_81BEBF4(u8 taskId)
|
||||
{
|
||||
u8 zero;
|
||||
|
||||
switch(gTasks[taskId].data[0])
|
||||
{
|
||||
case 0:
|
||||
FreeAllWindowBuffers();
|
||||
SetBgAttribute(0, BG_CTRL_ATTR_MOSAIC, 2);
|
||||
gTasks[taskId].data[0]++;
|
||||
break;
|
||||
case 1:
|
||||
gUnknown_0203CF04 = (u8 *)AllocZeroed(MIRAGE_TOWER_GFX_LENGTH);
|
||||
gUnknown_0203CF08 = (u8 *)AllocZeroed(MIRAGE_TOWER_PALETTE_LENGTH);
|
||||
ChangeBgX(0, 0, 0);
|
||||
ChangeBgY(0, 0, 0);
|
||||
gTasks[taskId].data[0]++;
|
||||
break;
|
||||
case 2:
|
||||
CpuSet(gUnknown_08617274, gUnknown_0203CF04, MIRAGE_TOWER_GFX_LENGTH / 2);
|
||||
LoadBgTiles(0, gUnknown_0203CF04, MIRAGE_TOWER_GFX_LENGTH, 0);
|
||||
gTasks[taskId].data[0]++;
|
||||
break;
|
||||
case 3:
|
||||
SetBgTilemapBuffer(0, gUnknown_0203CF08);
|
||||
CopyToBgTilemapBufferRect_ChangePalette(0, &gUnknown_08617B94, 12, 29, 6, 12, 17);
|
||||
CopyBgTilemapBufferToVram(0);
|
||||
gTasks[taskId].data[0]++;
|
||||
break;
|
||||
case 4:
|
||||
ShowBg(0);
|
||||
gTasks[taskId].data[0]++;
|
||||
break;
|
||||
case 5:
|
||||
sub_81BEB24();
|
||||
gTasks[taskId].data[0]++;
|
||||
break;
|
||||
case 6:
|
||||
gUnknown_0203CF14 = (u16 *)Alloc(4);
|
||||
zero = 0;
|
||||
gUnknown_0203CF14[0] = 2;
|
||||
gUnknown_0203CF14[1] = zero;
|
||||
CreateTask(sub_81BEBB4, 0xA);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NONMATCHING
|
||||
#define OUTER_BUFFER_LENGTH 0x60
|
||||
#define INNER_BUFFER_LENGTH 0x30
|
||||
static void sub_81BED50(u8 taskId)
|
||||
{
|
||||
u8 anotherTaskId, j;
|
||||
|
||||
|
||||
switch(gTasks[taskId].data[0])
|
||||
{
|
||||
case 1:
|
||||
gUnknown_0203CF10 = (struct Struct203CF10 *)AllocZeroed(OUTER_BUFFER_LENGTH * sizeof(struct Struct203CF10));
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
u16 i;
|
||||
u16 left;
|
||||
u32 index, next;
|
||||
|
||||
index = (u16)gTasks[taskId].data[3];
|
||||
if(gTasks[taskId].data[3] <= (OUTER_BUFFER_LENGTH - 1))
|
||||
{
|
||||
if(gTasks[taskId].data[1] > 1)
|
||||
{
|
||||
index = (u8)index;
|
||||
gUnknown_0203CF10[index].buffer = (u8 *)Alloc(INNER_BUFFER_LENGTH);
|
||||
for(i = 0; i <= (INNER_BUFFER_LENGTH - 1); i++)
|
||||
gUnknown_0203CF10[index].buffer[i] = i;
|
||||
for(i = 0; i <= (INNER_BUFFER_LENGTH - 1); i++)
|
||||
{
|
||||
u16 rand1, rand2, temp;
|
||||
|
||||
rand1 = Random() % 0x30;
|
||||
rand2 = Random() % 0x30;
|
||||
temp = gUnknown_0203CF10[index].buffer[rand2];
|
||||
gUnknown_0203CF10[index].buffer[rand2] = gUnknown_0203CF10[index].buffer[rand1];
|
||||
gUnknown_0203CF10[index].buffer[rand1] = temp;
|
||||
}
|
||||
if(gTasks[taskId].data[3] <= (OUTER_BUFFER_LENGTH - 1))
|
||||
gTasks[taskId].data[3]++;
|
||||
gTasks[taskId].data[1] = 0;
|
||||
}
|
||||
gTasks[taskId].data[1]++;
|
||||
}
|
||||
index = (u8)gTasks[taskId].data[3];
|
||||
for(left = (u8)gTasks[taskId].data[2]; left < (u16)index; left = next)
|
||||
{
|
||||
j = 0;
|
||||
next = left + 1;
|
||||
while(!j)
|
||||
{
|
||||
sub_81BF2B8(gUnknown_0203CF04, ((((OUTER_BUFFER_LENGTH - 1) - left) * INNER_BUFFER_LENGTH) + gUnknown_0203CF10[left].buffer[(gUnknown_0203CF10[left].curr_buffer_index)++]), 0, INNER_BUFFER_LENGTH, 1);
|
||||
j++;
|
||||
}
|
||||
if(gUnknown_0203CF10[left].curr_buffer_index > (INNER_BUFFER_LENGTH - 1))
|
||||
{
|
||||
FREE_AND_SET_NULL(gUnknown_0203CF10[left].buffer);
|
||||
gTasks[taskId].data[2]++;
|
||||
if((left % 2) == 1)
|
||||
gUnknown_0203CF14[1]--;
|
||||
}
|
||||
}
|
||||
LoadBgTiles(0, gUnknown_0203CF04, MIRAGE_TOWER_GFX_LENGTH, 0);
|
||||
if(gUnknown_0203CF10[OUTER_BUFFER_LENGTH - 1].curr_buffer_index > (INNER_BUFFER_LENGTH - 1))
|
||||
break;
|
||||
return;
|
||||
}
|
||||
case 4:
|
||||
UnsetBgTilemapBuffer(0);
|
||||
anotherTaskId = FindTaskIdByFunc(sub_81BEBB4);
|
||||
if(anotherTaskId != 0xFF)
|
||||
DestroyTask(anotherTaskId);
|
||||
gUnknown_0203CF14[1] = gUnknown_0203CF14[0] = 0;
|
||||
sub_81BEB90();
|
||||
break;
|
||||
case 5:
|
||||
FREE_AND_SET_NULL(gUnknown_0203CF14);
|
||||
FREE_AND_SET_NULL(gUnknown_0203CF10);
|
||||
FREE_AND_SET_NULL(gUnknown_0203CF04);
|
||||
FREE_AND_SET_NULL(gUnknown_0203CF08);
|
||||
break;
|
||||
case 6:
|
||||
SetGpuRegBits(REG_OFFSET_BG2CNT, 0x2);
|
||||
SetGpuRegBits(REG_OFFSET_BG0CNT, 0x0);
|
||||
SetBgAttribute(0, BG_CTRL_ATTR_MOSAIC, 0);
|
||||
sub_81971D0();
|
||||
break;
|
||||
case 7:
|
||||
ShowBg(0);
|
||||
break;
|
||||
case 8:
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
break;
|
||||
}
|
||||
gTasks[taskId].data[0]++;
|
||||
}
|
||||
|
||||
#else
|
||||
ASM_DIRECT
|
||||
static void sub_81BED50(u8 taskId)
|
||||
{
|
||||
asm("\n\
|
||||
.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, 0x10\n\
|
||||
lsls r0, 24\n\
|
||||
lsrs r0, 24\n\
|
||||
mov r10, r0\n\
|
||||
ldr r1, =gTasks\n\
|
||||
lsls r0, 2\n\
|
||||
add r0, r10\n\
|
||||
lsls r0, 3\n\
|
||||
adds r0, r1\n\
|
||||
ldrh r0, [r0, 0x8]\n\
|
||||
subs r0, 0x1\n\
|
||||
lsls r0, 16\n\
|
||||
asrs r0, 16\n\
|
||||
adds r6, r1, 0\n\
|
||||
cmp r0, 0x7\n\
|
||||
bls _081BED7C\n\
|
||||
b _081BF002\n\
|
||||
_081BED7C:\n\
|
||||
lsls r0, 2\n\
|
||||
ldr r1, =_081BED90\n\
|
||||
adds r0, r1\n\
|
||||
ldr r0, [r0]\n\
|
||||
mov pc, r0\n\
|
||||
.pool\n\
|
||||
.align 2, 0\n\
|
||||
_081BED90:\n\
|
||||
.4byte _081BEDB0\n\
|
||||
.4byte _081BF002\n\
|
||||
.4byte _081BEDC4\n\
|
||||
.4byte _081BEF64\n\
|
||||
.4byte _081BEF94\n\
|
||||
.4byte _081BEFD0\n\
|
||||
.4byte _081BEFF0\n\
|
||||
.4byte _081BEFF8\n\
|
||||
_081BEDB0:\n\
|
||||
ldr r4, =gUnknown_0203CF10\n\
|
||||
movs r0, 0xC0\n\
|
||||
lsls r0, 2\n\
|
||||
bl AllocZeroed\n\
|
||||
str r0, [r4]\n\
|
||||
b _081BF002\n\
|
||||
.pool\n\
|
||||
_081BEDC4:\n\
|
||||
mov r1, r10\n\
|
||||
lsls r0, r1, 2\n\
|
||||
adds r1, r0, r1\n\
|
||||
lsls r1, 3\n\
|
||||
adds r2, r1, r6\n\
|
||||
ldrh r3, [r2, 0xE]\n\
|
||||
movs r4, 0xE\n\
|
||||
ldrsh r1, [r2, r4]\n\
|
||||
str r0, [sp, 0x8]\n\
|
||||
cmp r1, 0x5F\n\
|
||||
bgt _081BEE8A\n\
|
||||
movs r1, 0xA\n\
|
||||
ldrsh r0, [r2, r1]\n\
|
||||
cmp r0, 0x1\n\
|
||||
ble _081BEE7C\n\
|
||||
lsls r0, r3, 24\n\
|
||||
lsrs r4, r0, 24\n\
|
||||
movs r0, 0x30\n\
|
||||
bl Alloc\n\
|
||||
ldr r3, =gUnknown_0203CF10\n\
|
||||
ldr r1, [r3]\n\
|
||||
lsls r2, r4, 3\n\
|
||||
adds r1, r2, r1\n\
|
||||
str r0, [r1]\n\
|
||||
movs r5, 0\n\
|
||||
adds r4, r2, 0\n\
|
||||
_081BEDFA:\n\
|
||||
ldr r0, [r3]\n\
|
||||
adds r0, r4, r0\n\
|
||||
ldr r0, [r0]\n\
|
||||
adds r0, r5\n\
|
||||
strb r5, [r0]\n\
|
||||
adds r0, r5, 0x1\n\
|
||||
lsls r0, 16\n\
|
||||
lsrs r5, r0, 16\n\
|
||||
cmp r5, 0x2F\n\
|
||||
bls _081BEDFA\n\
|
||||
movs r5, 0\n\
|
||||
ldr r7, =gUnknown_0203CF10\n\
|
||||
adds r6, r2, 0\n\
|
||||
_081BEE14:\n\
|
||||
bl Random\n\
|
||||
lsls r0, 16\n\
|
||||
lsrs r0, 16\n\
|
||||
movs r1, 0x30\n\
|
||||
bl __umodsi3\n\
|
||||
adds r4, r0, 0\n\
|
||||
lsls r4, 16\n\
|
||||
lsrs r4, 16\n\
|
||||
bl Random\n\
|
||||
lsls r0, 16\n\
|
||||
lsrs r0, 16\n\
|
||||
movs r1, 0x30\n\
|
||||
bl __umodsi3\n\
|
||||
lsls r0, 16\n\
|
||||
lsrs r0, 16\n\
|
||||
ldr r1, [r7]\n\
|
||||
adds r1, r6, r1\n\
|
||||
ldr r1, [r1]\n\
|
||||
adds r0, r1, r0\n\
|
||||
ldrb r2, [r0]\n\
|
||||
adds r1, r4 \n\
|
||||
ldrb r1, [r1]\n\
|
||||
strb r1, [r0]\n\
|
||||
ldr r0, [r7]\n\
|
||||
adds r0, r6, r0\n\
|
||||
ldr r0, [r0]\n\
|
||||
adds r0, r4\n\
|
||||
strb r2, [r0]\n\
|
||||
adds r0, r5, 0x1\n\
|
||||
lsls r0, 16\n\
|
||||
lsrs r5, r0, 16\n\
|
||||
cmp r5, 0x2F\n\
|
||||
bls _081BEE14\n\
|
||||
ldr r0, =gTasks\n\
|
||||
ldr r1, [sp, 0x8]\n\
|
||||
add r1, r10\n\
|
||||
lsls r1, 3\n\
|
||||
adds r2, r1, r0\n\
|
||||
ldrh r3, [r2, 0xE]\n\
|
||||
movs r4, 0xE\n\
|
||||
ldrsh r1, [r2, r4]\n\
|
||||
adds r6, r0, 0\n\
|
||||
cmp r1, 0x5F\n\
|
||||
bgt _081BEE78\n\
|
||||
adds r0, r3, 0x1\n\
|
||||
strh r0, [r2, 0xE]\n\
|
||||
_081BEE78:\n\
|
||||
movs r0, 0\n\
|
||||
strh r0, [r2, 0xA]\n\
|
||||
_081BEE7C:\n\
|
||||
ldr r1, [sp, 0x8]\n\
|
||||
add r1, r10\n\
|
||||
lsls r1, 3\n\
|
||||
adds r1, r6\n\
|
||||
ldrh r0, [r1, 0xA]\n\
|
||||
adds r0, 0x1\n\
|
||||
strh r0, [r1, 0xA]\n\
|
||||
_081BEE8A:\n\
|
||||
ldr r0, [sp, 0x8]\n\
|
||||
add r0, r10\n\
|
||||
lsls r0, 3\n\
|
||||
adds r0, r6\n\
|
||||
ldrb r4, [r0, 0xE]\n\
|
||||
ldrb r5, [r0, 0xC]\n\
|
||||
lsls r0, r4, 16\n\
|
||||
cmp r5, r4\n\
|
||||
bcs _081BEF32\n\
|
||||
str r0, [sp, 0xC]\n\
|
||||
_081BEE9E:\n\
|
||||
movs r6, 0\n\
|
||||
adds r0, r5, 0x1\n\
|
||||
str r0, [sp, 0x4]\n\
|
||||
lsls r4, r5, 3\n\
|
||||
movs r2, 0x5F\n\
|
||||
subs r1, r2, r5\n\
|
||||
lsls r0, r1, 1\n\
|
||||
adds r0, r1\n\
|
||||
lsls r0, 4\n\
|
||||
mov r9, r0\n\
|
||||
_081BEEB2:\n\
|
||||
ldr r0, =gUnknown_0203CF04\n\
|
||||
ldr r0, [r0]\n\
|
||||
ldr r7, =gUnknown_0203CF10\n\
|
||||
ldr r3, [r7]\n\
|
||||
adds r3, r4, r3\n\
|
||||
ldrb r2, [r3, 0x4]\n\
|
||||
adds r1, r2, 0x1\n\
|
||||
strb r1, [r3, 0x4]\n\
|
||||
lsls r2, 24\n\
|
||||
lsrs r2, 24\n\
|
||||
ldr r1, [r3]\n\
|
||||
adds r1, r2\n\
|
||||
ldrb r1, [r1]\n\
|
||||
add r1, r9\n\
|
||||
lsls r1, 16\n\
|
||||
lsrs r1, 16\n\
|
||||
movs r2, 0x1\n\
|
||||
mov r8, r2\n\
|
||||
str r2, [sp]\n\
|
||||
movs r2, 0\n\
|
||||
movs r3, 0x30\n\
|
||||
bl sub_81BF2B8\n\
|
||||
adds r0, r6, 0x1\n\
|
||||
lsls r0, 24\n\
|
||||
lsrs r6, r0, 24\n\
|
||||
cmp r6, 0\n\
|
||||
beq _081BEEB2\n\
|
||||
ldr r0, [r7]\n\
|
||||
adds r1, r4, r0\n\
|
||||
ldrb r0, [r1, 0x4]\n\
|
||||
cmp r0, 0x2F\n\
|
||||
bls _081BEF24\n\
|
||||
ldr r0, [r1]\n\
|
||||
bl Free\n\
|
||||
ldr r0, [r7]\n\
|
||||
adds r0, r4, r0\n\
|
||||
movs r1, 0\n\
|
||||
str r1, [r0]\n\
|
||||
ldr r1, [sp, 0x8]\n\
|
||||
add r1, r10\n\
|
||||
lsls r1, 3\n\
|
||||
ldr r4, =gTasks\n\
|
||||
adds r1, r4\n\
|
||||
ldrh r0, [r1, 0xC]\n\
|
||||
adds r0, 0x1\n\
|
||||
strh r0, [r1, 0xC]\n\
|
||||
mov r0, r8\n\
|
||||
ands r5, r0\n\
|
||||
cmp r5, 0x1\n\
|
||||
bne _081BEF24\n\
|
||||
ldr r0, =gUnknown_0203CF14\n\
|
||||
ldr r1, [r0]\n\
|
||||
ldrh r0, [r1, 0x2]\n\
|
||||
subs r0, 0x1\n\
|
||||
strh r0, [r1, 0x2]\n\
|
||||
_081BEF24:\n\
|
||||
ldr r1, [sp, 0x4]\n\
|
||||
lsls r0, r1, 16\n\
|
||||
lsrs r5, r0, 16\n\
|
||||
ldr r2, [sp, 0xC]\n\
|
||||
lsrs r0, r2, 16\n\
|
||||
cmp r5, r0\n\
|
||||
bcc _081BEE9E\n\
|
||||
_081BEF32:\n\
|
||||
ldr r0, =gUnknown_0203CF04\n\
|
||||
ldr r1, [r0]\n\
|
||||
movs r2, 0x92\n\
|
||||
lsls r2, 4\n\
|
||||
movs r0, 0\n\
|
||||
movs r3, 0\n\
|
||||
bl LoadBgTiles\n\
|
||||
ldr r0, =gUnknown_0203CF10\n\
|
||||
ldr r0, [r0]\n\
|
||||
movs r4, 0xBE\n\
|
||||
lsls r4, 2\n\
|
||||
adds r0, r4\n\
|
||||
ldrb r0, [r0, 0x4]\n\
|
||||
cmp r0, 0x2F\n\
|
||||
bhi _081BF002\n\
|
||||
b _081BF014\n\
|
||||
.pool\n\
|
||||
_081BEF64:\n\
|
||||
movs r0, 0\n\
|
||||
bl UnsetBgTilemapBuffer\n\
|
||||
ldr r0, =sub_81BEBB4\n\
|
||||
bl FindTaskIdByFunc\n\
|
||||
lsls r0, 24\n\
|
||||
lsrs r0, 24\n\
|
||||
cmp r0, 0xFF\n\
|
||||
beq _081BEF7C\n\
|
||||
bl DestroyTask\n\
|
||||
_081BEF7C:\n\
|
||||
ldr r0, =gUnknown_0203CF14\n\
|
||||
ldr r1, [r0]\n\
|
||||
movs r0, 0\n\
|
||||
strh r0, [r1]\n\
|
||||
strh r0, [r1, 0x2]\n\
|
||||
bl sub_81BEB90\n\
|
||||
b _081BF002\n\
|
||||
.pool\n\
|
||||
_081BEF94:\n\
|
||||
ldr r4, =gUnknown_0203CF14\n\
|
||||
ldr r0, [r4]\n\
|
||||
bl Free\n\
|
||||
movs r5, 0\n\
|
||||
str r5, [r4]\n\
|
||||
ldr r4, =gUnknown_0203CF10\n\
|
||||
ldr r0, [r4]\n\
|
||||
bl Free\n\
|
||||
str r5, [r4]\n\
|
||||
ldr r4, =gUnknown_0203CF04\n\
|
||||
ldr r0, [r4]\n\
|
||||
bl Free\n\
|
||||
str r5, [r4]\n\
|
||||
ldr r4, =gUnknown_0203CF08\n\
|
||||
ldr r0, [r4]\n\
|
||||
bl Free\n\
|
||||
str r5, [r4]\n\
|
||||
b _081BF002\n\
|
||||
.pool\n\
|
||||
_081BEFD0:\n\
|
||||
movs r0, 0xC\n\
|
||||
movs r1, 0x2\n\
|
||||
bl SetGpuRegBits\n\
|
||||
movs r0, 0x8\n\
|
||||
movs r1, 0\n\
|
||||
bl SetGpuRegBits\n\
|
||||
movs r0, 0\n\
|
||||
movs r1, 0x7\n\
|
||||
movs r2, 0\n\
|
||||
bl SetBgAttribute\n\
|
||||
bl sub_81971D0\n\
|
||||
b _081BF002\n\
|
||||
_081BEFF0:\n\
|
||||
movs r0, 0\n\
|
||||
bl ShowBg\n\
|
||||
b _081BF002\n\
|
||||
_081BEFF8:\n\
|
||||
mov r0, r10\n\
|
||||
bl DestroyTask\n\
|
||||
bl EnableBothScriptContexts\n\
|
||||
_081BF002:\n\
|
||||
ldr r0, =gTasks\n\
|
||||
mov r2, r10\n\
|
||||
lsls r1, r2, 2\n\
|
||||
add r1, r10\n\
|
||||
lsls r1, 3\n\
|
||||
adds r1, r0\n\
|
||||
ldrh r0, [r1, 0x8]\n\
|
||||
adds r0, 0x1\n\
|
||||
strh r0, [r1, 0x8]\n\
|
||||
_081BF014:\n\
|
||||
add sp, 0x10\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
|
||||
|
||||
static void sub_81BF028(u8 taskId)
|
||||
{
|
||||
u16 i;
|
||||
|
||||
switch(gTasks[taskId].data[0])
|
||||
{
|
||||
case 1:
|
||||
gUnknown_0203CF0C = (struct Struct203CF0C *)AllocZeroed(sizeof(struct Struct203CF0C));
|
||||
gUnknown_0203CF0C->frameImageTiles = (u8 *)AllocZeroed(ROOT_FOSSIL_GFX_LENGTH);
|
||||
gUnknown_0203CF0C->frameImage = (struct DynamicSpriteFrameImage *) AllocZeroed(sizeof(struct DynamicSpriteFrameImage));
|
||||
gUnknown_0203CF0C->unkC = (u16 *)AllocZeroed(ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH * sizeof(u16));
|
||||
gUnknown_0203CF0C->unk10 = 0;
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
u8 *buffer;
|
||||
buffer = gUnknown_0203CF0C->frameImageTiles;
|
||||
for(i = 0; i < ROOT_FOSSIL_GFX_LENGTH; i++, buffer++)
|
||||
*buffer = gRootFossil_Gfx[i];
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
gUnknown_0203CF0C->frameImage->data = gUnknown_0203CF0C->frameImageTiles;
|
||||
gUnknown_0203CF0C->frameImage->size = ROOT_FOSSIL_GFX_LENGTH;
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
u8 spriteId, zero;
|
||||
struct SpriteTemplate fossilTemplate;
|
||||
|
||||
fossilTemplate = gUnknown_08617E00;
|
||||
fossilTemplate.images = (struct SpriteFrameImage *)(gUnknown_0203CF0C->frameImage);
|
||||
spriteId = CreateSprite(&fossilTemplate, 128, -16, 1);
|
||||
gUnknown_0203CF0C->spriteId = spriteId;
|
||||
zero = 0;
|
||||
gSprites[gUnknown_0203CF0C->spriteId].centerToCornerVecX = zero;
|
||||
gSprites[gUnknown_0203CF0C->spriteId].data[0] = gSprites[gUnknown_0203CF0C->spriteId].pos1.x;
|
||||
gSprites[gUnknown_0203CF0C->spriteId].data[1] = 1;
|
||||
}
|
||||
case 5:
|
||||
for(i = 0; i < ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH; i++)
|
||||
gUnknown_0203CF0C->unkC[i] = i;
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
u16 rand1, rand2, temp, j;
|
||||
j = (ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH * sizeof(u16)) - 1;
|
||||
for(i = 0; i <= j; i++)
|
||||
{
|
||||
rand1 = Random() % 0x100;
|
||||
rand2 = Random() % 0x100;
|
||||
j = (ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH * sizeof(u16)) - 1;
|
||||
temp = gUnknown_0203CF0C->unkC[rand2];
|
||||
gUnknown_0203CF0C->unkC[rand2] = gUnknown_0203CF0C->unkC[rand1];
|
||||
gUnknown_0203CF0C->unkC[rand1] = temp;
|
||||
}
|
||||
gSprites[gUnknown_0203CF0C->spriteId].callback = sub_81BF248;
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
if(gSprites[gUnknown_0203CF0C->spriteId].callback != SpriteCallbackDummy)
|
||||
return;
|
||||
DestroySprite(&gSprites[gUnknown_0203CF0C->spriteId]);
|
||||
FREE_AND_SET_NULL(gUnknown_0203CF0C->unkC);;
|
||||
FREE_AND_SET_NULL(gUnknown_0203CF0C->frameImage);
|
||||
FREE_AND_SET_NULL(gUnknown_0203CF0C->frameImageTiles);
|
||||
FREE_AND_SET_NULL(gUnknown_0203CF0C);
|
||||
break;
|
||||
case 8:
|
||||
EnableBothScriptContexts();
|
||||
}
|
||||
++gTasks[taskId].data[0];
|
||||
}
|
||||
|
||||
static void sub_81BF248(struct Sprite *sprite)
|
||||
{
|
||||
if (gUnknown_0203CF0C->unk10 >= (ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH))
|
||||
{
|
||||
sprite->callback = SpriteCallbackDummy;
|
||||
}
|
||||
else if (sprite->pos1.y >= 0x60)
|
||||
{
|
||||
u8 i;
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
sub_81BF2B8(gUnknown_0203CF0C->frameImageTiles, gUnknown_0203CF0C->unkC[gUnknown_0203CF0C->unk10++], 0, 16, 0);
|
||||
}
|
||||
StartSpriteAnim(sprite, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite->pos1.y++;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
#include "global.h"
|
||||
#include "constants/flags.h"
|
||||
#include "random.h"
|
||||
#include "event_data.h"
|
||||
#include "battle_setup.h"
|
||||
#include "gym_leader_rematch.h"
|
||||
|
||||
static void UpdateGymLeaderRematchFromArray(const u16 *data, size_t size, u32 maxRematch);
|
||||
static s32 GetRematchIndex(u32 trainerIdx);
|
||||
|
||||
static const u16 GymLeaderRematches_AfterNewMauville[] = {
|
||||
REMATCH_ROXANNE,
|
||||
REMATCH_BRAWLY,
|
||||
REMATCH_WATTSON,
|
||||
REMATCH_FLANNERY,
|
||||
REMATCH_NORMAN,
|
||||
REMATCH_WINONA,
|
||||
REMATCH_TATE_AND_LIZA,
|
||||
REMATCH_JUAN
|
||||
};
|
||||
|
||||
static const u16 GymLeaderRematches_BeforeNewMauville[] = {
|
||||
REMATCH_ROXANNE,
|
||||
REMATCH_BRAWLY,
|
||||
// Wattson isn't available at this time
|
||||
REMATCH_FLANNERY,
|
||||
REMATCH_NORMAN,
|
||||
REMATCH_WINONA,
|
||||
REMATCH_TATE_AND_LIZA,
|
||||
REMATCH_JUAN
|
||||
};
|
||||
|
||||
void UpdateGymLeaderRematch(void)
|
||||
{
|
||||
if (FlagGet(FLAG_SYS_GAME_CLEAR) && (Random() % 100) <= 30)
|
||||
{
|
||||
if (FlagGet(FLAG_WATTSON_REMATCH_AVAILABLE))
|
||||
UpdateGymLeaderRematchFromArray(GymLeaderRematches_AfterNewMauville, ARRAY_COUNT(GymLeaderRematches_AfterNewMauville), 5);
|
||||
else
|
||||
UpdateGymLeaderRematchFromArray(GymLeaderRematches_BeforeNewMauville, ARRAY_COUNT(GymLeaderRematches_BeforeNewMauville), 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void UpdateGymLeaderRematchFromArray(const u16 *data, size_t size, u32 maxRematch)
|
||||
{
|
||||
s32 whichLeader = 0;
|
||||
s32 lowestRematchIndex = 5;
|
||||
u32 i;
|
||||
s32 rematchIndex;
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
if (!gSaveBlock1Ptr->trainerRematches[data[i]])
|
||||
{
|
||||
rematchIndex = GetRematchIndex(data[i]);
|
||||
if (lowestRematchIndex > rematchIndex)
|
||||
lowestRematchIndex = rematchIndex;
|
||||
whichLeader++;
|
||||
}
|
||||
}
|
||||
if (whichLeader != 0 && lowestRematchIndex <= maxRematch)
|
||||
{
|
||||
whichLeader = 0;
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
if (!gSaveBlock1Ptr->trainerRematches[data[i]])
|
||||
{
|
||||
rematchIndex = GetRematchIndex(data[i]);
|
||||
if (rematchIndex == lowestRematchIndex)
|
||||
whichLeader++;
|
||||
}
|
||||
}
|
||||
if (whichLeader != 0)
|
||||
{
|
||||
whichLeader = Random() % whichLeader;
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
if (!gSaveBlock1Ptr->trainerRematches[data[i]])
|
||||
{
|
||||
rematchIndex = GetRematchIndex(data[i]);
|
||||
if (rematchIndex == lowestRematchIndex)
|
||||
{
|
||||
if (whichLeader == 0)
|
||||
{
|
||||
gSaveBlock1Ptr->trainerRematches[data[i]] = lowestRematchIndex;
|
||||
break;
|
||||
}
|
||||
whichLeader--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static s32 GetRematchIndex(u32 trainerIdx)
|
||||
{
|
||||
s32 i;
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
if (!HasTrainerBeenFought(gRematchTable[trainerIdx].trainerIds[i]))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 5;
|
||||
}
|
||||
+3
-3
@@ -369,7 +369,7 @@ static const struct HallofFameMon sDummyFameMon =
|
||||
0x3EA03EA, 0, 0, 0, {0}
|
||||
};
|
||||
|
||||
static const u8 sUnused2[6] = {2, 1, 3, 6, 4, 5};
|
||||
static const u8 sUnused2[] = {2, 1, 3, 6, 4, 5, 0, 0};
|
||||
|
||||
// code
|
||||
static void VBlankCB_HallOfFame(void)
|
||||
@@ -516,7 +516,7 @@ static void Task_Hof_InitTeamSaveData(u8 taskId)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sub_81534D0(3) != TRUE)
|
||||
if (Save_LoadGameData(3) != TRUE)
|
||||
memset(gDecompressionBuffer, 0, 0x2000);
|
||||
}
|
||||
|
||||
@@ -885,7 +885,7 @@ void CB2_DoHallOfFamePC(void)
|
||||
static void Task_HofPC_CopySaveData(u8 taskId)
|
||||
{
|
||||
sub_81980F0(0, 0x1E, 0, 0xC, 0x226);
|
||||
if (sub_81534D0(3) != 1)
|
||||
if (Save_LoadGameData(3) != 1)
|
||||
{
|
||||
gTasks[taskId].func = Task_HofPC_PrintDataIsCorrupted;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ s32 GetMaxWidthInMenuTable(const struct MenuAction *str, s32 arg1)
|
||||
return convert_pixel_width_to_tile_width(var);
|
||||
}
|
||||
|
||||
s32 sub_81DB3D8(const struct MenuAction *str, u8* arg1, s32 arg2)
|
||||
s32 sub_81DB3D8(const struct MenuAction *str, const u8* arg1, s32 arg2)
|
||||
{
|
||||
s32 i, var;
|
||||
|
||||
|
||||
+3020
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,740 @@
|
||||
#include "global.h"
|
||||
#include "intro_credits_graphics.h"
|
||||
#include "palette.h"
|
||||
#include "decompress.h"
|
||||
#include "gpu_regs.h"
|
||||
#include "task.h"
|
||||
#include "main.h"
|
||||
#include "graphics.h"
|
||||
|
||||
struct IntroCreditsSpriteMetadata
|
||||
{
|
||||
u8 animNum:4;
|
||||
u8 shape:2;
|
||||
u8 size:2;
|
||||
u8 x;
|
||||
u8 y;
|
||||
u8 subpriority;
|
||||
u16 xOff;
|
||||
};
|
||||
|
||||
static const u16 gUnknown_085F06E0[] = INCBIN_U16("graphics/intro/intro2_grass.gbapal");
|
||||
static const u16 gUnknown_085F0700[] = INCBIN_U16("graphics/intro/intro2_grass_afternoon.gbapal");
|
||||
static const u16 gUnknown_085F0720[] = INCBIN_U16("graphics/intro/intro2_grass_night.gbapal");
|
||||
static const u8 gUnknown_085F0740[] = INCBIN_U8("graphics/intro/intro2_grass.4bpp.lz");
|
||||
static const u8 gUnknown_085F0BC0[] = INCBIN_U8("graphics/intro/intro2_grass_map.bin.lz");
|
||||
static const u16 gUnknown_085F0CFC[] = INCBIN_U16("graphics/intro/85F0CFC.gbapal");
|
||||
static const u16 gUnknown_085F0D5C[] = INCBIN_U16("graphics/intro/85F0D5C.gbapal");
|
||||
static const u8 gUnknown_085F0DBC[] = INCBIN_U8("graphics/intro/intro2_bgclouds.4bpp.lz");
|
||||
static const u8 gUnknown_085F1398[] = INCBIN_U8("graphics/intro/intro2_bgclouds_map.bin.lz");
|
||||
static const u16 gUnknown_085F1668[] = INCBIN_U16("graphics/intro/intro2_bgclouds.gbapal");
|
||||
static const u16 gUnknown_085F1688[] = INCBIN_U16("graphics/intro/intro2_bgclouds_afternoon.gbapal");
|
||||
static const u8 gUnknown_085F16A8[] = INCBIN_U8("graphics/intro/intro2_bgclouds2.4bpp.lz");
|
||||
static const u16 gUnknown_085F17E4[] = INCBIN_U16("graphics/intro/intro2_bgtrees2.gbapal");
|
||||
static const u16 gUnknown_085F1804[] = INCBIN_U16("graphics/intro/intro2_bgtrees2_afternoon.gbapal");
|
||||
static const u8 gUnknown_085F1824[] = INCBIN_U8("graphics/intro/intro2_bgtrees.4bpp.lz");
|
||||
static const u8 gUnknown_085F1EAC[] = INCBIN_U8("graphics/intro/intro2_bgtrees_map.bin.lz");
|
||||
static const u16 gUnknown_085F21B0[] = INCBIN_U16("graphics/intro/intro2_bgtrees.gbapal");
|
||||
static const u8 gIntro2TreeTiles[] = INCBIN_U8("graphics/intro/intro2_bgtreessmall.4bpp.lz");
|
||||
static const u16 gUnknown_085F231C[] = INCBIN_U16("graphics/intro/85F231C.gbapal");
|
||||
static const u8 gUnknown_085F235C[] = INCBIN_U8("graphics/intro/intro2_bgnight.4bpp.lz");
|
||||
static const u16 gUnknown_085F2548[] = INCBIN_U16("graphics/intro/intro2_bgnight.gbapal");
|
||||
static const u8 gUnknown_085F2568[] = INCBIN_U8("graphics/intro/intro2_bgnight_map.bin.lz");
|
||||
static const u8 gIntro2NightTiles[] = INCBIN_U8("graphics/intro/intro2_night.4bpp.lz");
|
||||
static const u16 gIntro2BrendanPalette[] = INCBIN_U16("graphics/intro/intro2_brendan.gbapal");
|
||||
static const u8 gIntro2BrendanTiles[] = INCBIN_U8("graphics/intro/intro2_brendan.4bpp.lz");
|
||||
static const u16 gIntro2MayPalette[] = INCBIN_U16("graphics/intro/intro2_may.gbapal");
|
||||
static const u16 gUnknown_085F3490[0xF0] = {0};
|
||||
static const u8 gIntro2MayTiles[] = INCBIN_U8("graphics/intro/intro2_may.4bpp.lz");
|
||||
static const u8 gIntro2BicycleTiles[] = INCBIN_U8("graphics/intro/intro2_bicycle.4bpp.lz");
|
||||
static const u16 gIntro2LatiosPalette[] = INCBIN_U16("graphics/intro/intro2_latios.gbapal");
|
||||
static const u8 gIntro2LatiosTiles[] = INCBIN_U8("graphics/intro/intro2_latios.4bpp.lz");
|
||||
static const u16 gIntro2LatiasPalette[] = INCBIN_U16("graphics/intro/intro2_latias.gbapal");
|
||||
static const u8 gIntro2LatiasTiles[] = INCBIN_U8("graphics/intro/intro2_latias.4bpp.lz");
|
||||
|
||||
static void sub_817B62C(struct Sprite *sprite);
|
||||
static void nullsub_65(struct Sprite *sprite);
|
||||
static void sub_817B7C4(struct Sprite *sprite);
|
||||
static void nullsub_66(struct Sprite *sprite);
|
||||
|
||||
static const struct SpriteTemplate gUnknown_085F504C = {
|
||||
2000, 0xFFFF, &gDummyOamData, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_817B62C
|
||||
};
|
||||
|
||||
static const struct CompressedSpriteSheet gUnknown_085F5064[] = {
|
||||
{ gUnknown_085F16A8, 0x400, 2000 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static const union AnimCmd gUnknown_085F5074[] = {
|
||||
ANIMCMD_FRAME( 0, 30),
|
||||
ANIMCMD_END
|
||||
};
|
||||
|
||||
static const union AnimCmd gUnknown_085F507C[] = {
|
||||
ANIMCMD_FRAME(16, 30),
|
||||
ANIMCMD_END
|
||||
};
|
||||
|
||||
static const union AnimCmd gUnknown_085F5084[] = {
|
||||
ANIMCMD_FRAME(20, 30),
|
||||
ANIMCMD_END
|
||||
};
|
||||
|
||||
static const union AnimCmd gUnknown_085F508C[] = {
|
||||
ANIMCMD_FRAME(22, 30),
|
||||
ANIMCMD_END
|
||||
};
|
||||
|
||||
static const union AnimCmd *const gUnknown_085F5094[] = {
|
||||
gUnknown_085F5074,
|
||||
gUnknown_085F507C,
|
||||
gUnknown_085F5084,
|
||||
gUnknown_085F508C
|
||||
};
|
||||
|
||||
static const struct IntroCreditsSpriteMetadata gUnknown_085F50A4[] = {
|
||||
{ 0, ST_OAM_SQUARE, 2, 72, 32, 100, 0xc00 },
|
||||
{ 0, ST_OAM_SQUARE, 2, 158, 32, 100, 0xc00 },
|
||||
{ 1, ST_OAM_SQUARE, 1, 192, 40, 101, 0x800 },
|
||||
{ 1, ST_OAM_SQUARE, 1, 56, 40, 101, 0x800 },
|
||||
{ 2, ST_OAM_H_RECTANGLE, 0, 100, 44, 102, 0x400 },
|
||||
{ 2, ST_OAM_H_RECTANGLE, 0, 152, 44, 102, 0x400 },
|
||||
{ 3, ST_OAM_H_RECTANGLE, 0, 8, 46, 103, 0x100 },
|
||||
{ 3, ST_OAM_H_RECTANGLE, 0, 56, 46, 103, 0x100 },
|
||||
{ 3, ST_OAM_H_RECTANGLE, 0, 240, 46, 103, 0x100 },
|
||||
};
|
||||
|
||||
static const struct CompressedSpriteSheet gUnknown_085F50EC[] = {
|
||||
{ gIntro2TreeTiles, 0x400, 2000 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static const union AnimCmd gUnknown_085F50FC[] = {
|
||||
ANIMCMD_FRAME( 0, 30),
|
||||
ANIMCMD_END
|
||||
};
|
||||
|
||||
static const union AnimCmd gUnknown_085F5104[] = {
|
||||
ANIMCMD_FRAME(16, 30),
|
||||
ANIMCMD_END
|
||||
};
|
||||
|
||||
static const union AnimCmd gUnknown_085F510C[] = {
|
||||
ANIMCMD_FRAME(24, 30),
|
||||
ANIMCMD_END
|
||||
};
|
||||
|
||||
static const union AnimCmd *const gUnknown_085F5114[] = {
|
||||
gUnknown_085F50FC,
|
||||
gUnknown_085F5104,
|
||||
gUnknown_085F510C
|
||||
};
|
||||
|
||||
static const struct IntroCreditsSpriteMetadata gUnknown_085F5120[] = {
|
||||
{ 0, ST_OAM_SQUARE, 2, 16, 88, 100, 0x2000 },
|
||||
{ 0, ST_OAM_SQUARE, 2, 80, 88, 100, 0x2000 },
|
||||
{ 0, ST_OAM_SQUARE, 2, 144, 88, 100, 0x2000 },
|
||||
{ 0, ST_OAM_SQUARE, 2, 208, 88, 100, 0x2000 },
|
||||
{ 1, ST_OAM_V_RECTANGLE, 2, 40, 88, 101, 0x1000 },
|
||||
{ 1, ST_OAM_V_RECTANGLE, 2, 104, 88, 101, 0x1000 },
|
||||
{ 1, ST_OAM_V_RECTANGLE, 2, 168, 88, 101, 0x1000 },
|
||||
{ 1, ST_OAM_V_RECTANGLE, 2, 232, 88, 101, 0x1000 },
|
||||
{ 2, ST_OAM_V_RECTANGLE, 2, 56, 88, 102, 0x800 },
|
||||
{ 2, ST_OAM_V_RECTANGLE, 2, 120, 88, 102, 0x800 },
|
||||
{ 2, ST_OAM_V_RECTANGLE, 2, 184, 88, 102, 0x800 },
|
||||
{ 2, ST_OAM_V_RECTANGLE, 2, 248, 88, 102, 0x800 },
|
||||
};
|
||||
|
||||
static const struct CompressedSpriteSheet gUnknown_085F5180[] = {
|
||||
{ gIntro2NightTiles, 0x400, 2000 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static const union AnimCmd gUnknown_085F5190[] = {
|
||||
ANIMCMD_FRAME(0, 30),
|
||||
ANIMCMD_END
|
||||
};
|
||||
|
||||
static const union AnimCmd *const gUnknown_085F5198[] = {
|
||||
gUnknown_085F5190
|
||||
};
|
||||
|
||||
static const struct IntroCreditsSpriteMetadata gUnknown_085F519C[] = {
|
||||
{ 0, ST_OAM_SQUARE, 2, 24, 88, 100, 0x1000 },
|
||||
{ 0, ST_OAM_SQUARE, 2, 64, 88, 100, 0x1000 },
|
||||
{ 0, ST_OAM_SQUARE, 2, 104, 88, 100, 0x1000 },
|
||||
{ 0, ST_OAM_SQUARE, 2, 144, 88, 100, 0x1000 },
|
||||
{ 0, ST_OAM_SQUARE, 2, 184, 88, 100, 0x1000 },
|
||||
{ 0, ST_OAM_SQUARE, 2, 224, 88, 100, 0x1000 },
|
||||
};
|
||||
|
||||
static const struct OamData gOamData_85F51CC = {
|
||||
.y = 160, .shape = ST_OAM_SQUARE, .size = 3, .priority = 1
|
||||
};
|
||||
|
||||
static const union AnimCmd gUnknown_085F51D4[] = {
|
||||
ANIMCMD_FRAME( 0, 8),
|
||||
ANIMCMD_FRAME( 64, 8),
|
||||
ANIMCMD_FRAME(128, 8),
|
||||
ANIMCMD_FRAME(192, 8),
|
||||
ANIMCMD_JUMP(0)
|
||||
};
|
||||
|
||||
static const union AnimCmd *const gUnknown_085F51E8[] = {
|
||||
gUnknown_085F51D4
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate gUnknown_085F51EC = {
|
||||
1002, 1002, &gOamData_85F51CC, gUnknown_085F51E8, NULL, gDummySpriteAffineAnimTable, nullsub_65
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate gUnknown_085F5204 = {
|
||||
1003, 1003, &gOamData_85F51CC, gUnknown_085F51E8, NULL, gDummySpriteAffineAnimTable, nullsub_65
|
||||
};
|
||||
|
||||
static const struct OamData gUnknown_085F521C = {
|
||||
.y = 160, .shape = ST_OAM_H_RECTANGLE, .size = 3, .priority = 1
|
||||
};
|
||||
|
||||
static const union AnimCmd gUnknown_085F5224[] = {
|
||||
ANIMCMD_FRAME( 0, 8),
|
||||
ANIMCMD_FRAME( 32, 8),
|
||||
ANIMCMD_FRAME( 64, 8),
|
||||
ANIMCMD_FRAME( 96, 8),
|
||||
ANIMCMD_JUMP(0)
|
||||
};
|
||||
|
||||
static const union AnimCmd *const gUnknown_085F5238[] = {
|
||||
gUnknown_085F5224
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate gUnknown_085F523C = {
|
||||
1001, 1002, &gUnknown_085F521C, gUnknown_085F5238, NULL, gDummySpriteAffineAnimTable, sub_817B7C4
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate gUnknown_085F5254 = {
|
||||
1001, 1003, &gUnknown_085F521C, gUnknown_085F5238, NULL, gDummySpriteAffineAnimTable, sub_817B7C4
|
||||
};
|
||||
|
||||
static const struct OamData gUnknown_085F526C = {
|
||||
.y = 160, .shape = ST_OAM_SQUARE, .size = 3, .priority = 1
|
||||
};
|
||||
|
||||
static const union AnimCmd gUnknown_085F5274[] = {
|
||||
ANIMCMD_FRAME( 0, 16),
|
||||
ANIMCMD_END
|
||||
};
|
||||
|
||||
static const union AnimCmd gUnknown_085F527C[] = {
|
||||
ANIMCMD_FRAME( 64, 16),
|
||||
ANIMCMD_END
|
||||
};
|
||||
|
||||
static const union AnimCmd *const gUnknown_085F5284[] = {
|
||||
gUnknown_085F5274,
|
||||
gUnknown_085F527C
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate gUnknown_085F528C = {
|
||||
1004, 1004, &gUnknown_085F526C, gUnknown_085F5284, NULL, gDummySpriteAffineAnimTable, nullsub_66
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate gUnknown_085F52A4 = {
|
||||
1005, 1005, &gUnknown_085F526C, gUnknown_085F5284, NULL, gDummySpriteAffineAnimTable, nullsub_66
|
||||
};
|
||||
|
||||
const struct CompressedSpriteSheet gIntro2BrendanSpriteSheet[] = {
|
||||
{ gIntro2BrendanNoTurnGfx, 0x2000, 1002 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
const struct CompressedSpriteSheet gIntro2MaySpriteSheet[] = {
|
||||
{ gIntro2MayNoTurnGfx, 0x2000, 1003 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
const struct CompressedSpriteSheet gIntro2BicycleSpriteSheet[] = {
|
||||
{ gIntro2BicycleTiles, 0x1000, 1001 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static const struct CompressedSpriteSheet gUnknown_085F52EC[] = {
|
||||
{ gIntro2FlygonGfx, 0x1000, 1004 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
const struct CompressedSpriteSheet gIntro2FlygonSpriteSheet[] = {
|
||||
{ gIntro2FlygonGfx, 0x1000, 1005 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
const struct SpritePalette gUnknown_085F530C[] = {
|
||||
{ gIntro2BrendanNoTurnPal, 1002 },
|
||||
{ gIntro2BrendanNoTurnPal, 1003 },
|
||||
{ gIntro2FlygonPal, 1004 },
|
||||
{ gIntro2FlygonPal, 1005 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
const struct CompressedSpriteSheet gUnknown_085F5334[] = {
|
||||
{ gIntro2BrendanTiles, 0x3800, 1002 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
const struct CompressedSpriteSheet gUnknown_085F5344[] = {
|
||||
{ gIntro2MayTiles, 0x3800, 1003 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
const struct CompressedSpriteSheet gUnknown_085F5354[] = {
|
||||
{ gIntro2BicycleTiles, 0x1000, 1001 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static const struct CompressedSpriteSheet gUnknown_085F5364[] = {
|
||||
{ gIntro2LatiosTiles, 0x1000, 1004 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static const struct CompressedSpriteSheet gUnknown_085F5374[] = {
|
||||
{ gIntro2LatiasTiles, 0x1000, 1005 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
const struct SpritePalette gUnknown_085F5384[] = {
|
||||
{ gIntro2BrendanPalette, 1002 },
|
||||
{ gIntro2MayPalette, 1003 },
|
||||
{ gIntro2LatiosPalette, 1004 },
|
||||
{ gIntro2LatiasPalette, 1005 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
const struct CompressedSpriteSheet gUnknown_085F53AC[] = {
|
||||
{ gIntro2BrendanTiles, 0x2000, 1002},
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
const struct CompressedSpriteSheet gUnknown_085F53BC[] = {
|
||||
{ gIntro2MayTiles, 0x2000, 1003},
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
EWRAM_DATA u16 gUnknown_0203BD24 = 0;
|
||||
EWRAM_DATA s16 gUnknown_0203BD26 = 0;
|
||||
EWRAM_DATA s16 gUnknown_0203BD28 = 0;
|
||||
|
||||
static void sub_817B76C(void);
|
||||
static void sub_817B788(void);
|
||||
static void sub_817B7A4(void);
|
||||
static void sub_817B458(u8);
|
||||
|
||||
void load_intro_part2_graphics(u8 a)
|
||||
{
|
||||
LZ77UnCompVram(&gUnknown_085F0740, (void *)(VRAM + 0x4000));
|
||||
LZ77UnCompVram(&gUnknown_085F0BC0, (void *)(VRAM + 0x7800));
|
||||
LoadPalette(&gUnknown_085F06E0, 240, 32);
|
||||
switch (a)
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
LZ77UnCompVram(&gUnknown_085F0DBC, (void *)(VRAM));
|
||||
LZ77UnCompVram(&gUnknown_085F1398, (void *)(VRAM + 0x3000));
|
||||
LoadPalette(&gUnknown_085F0CFC, 0, 96);
|
||||
LoadCompressedObjectPic(gUnknown_085F5064);
|
||||
LoadPalette(&gUnknown_085F1668, 256, 32);
|
||||
sub_817B76C();
|
||||
break;
|
||||
case 1:
|
||||
LZ77UnCompVram(&gUnknown_085F1824, (void *)(VRAM));
|
||||
LZ77UnCompVram(&gUnknown_085F1EAC, (void *)(VRAM + 0x3000));
|
||||
LoadPalette(&gUnknown_085F17E4, 0, 32);
|
||||
LoadCompressedObjectPic(gUnknown_085F50EC);
|
||||
LoadPalette(&gUnknown_085F21B0, 256, 32);
|
||||
sub_817B788();
|
||||
break;
|
||||
}
|
||||
gUnknown_0203BD28 = 0;
|
||||
gReservedSpritePaletteCount = 8;
|
||||
}
|
||||
|
||||
void sub_817B150(u8 a)
|
||||
{
|
||||
switch (a)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
SetGpuReg(REG_OFFSET_BG3CNT, BGCNT_PRIORITY(3)
|
||||
| BGCNT_CHARBASE(0)
|
||||
| BGCNT_16COLOR
|
||||
| BGCNT_SCREENBASE(6)
|
||||
| BGCNT_TXT256x256);
|
||||
SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(2)
|
||||
| BGCNT_CHARBASE(0)
|
||||
| BGCNT_16COLOR
|
||||
| BGCNT_SCREENBASE(7)
|
||||
| BGCNT_TXT256x256);
|
||||
SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(1)
|
||||
| BGCNT_CHARBASE(1)
|
||||
| BGCNT_16COLOR
|
||||
| BGCNT_SCREENBASE(15)
|
||||
| BGCNT_TXT256x256);
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0
|
||||
| DISPCNT_OBJ_1D_MAP
|
||||
| DISPCNT_BG1_ON
|
||||
| DISPCNT_BG2_ON
|
||||
| DISPCNT_BG3_ON
|
||||
| DISPCNT_OBJ_ON);
|
||||
break;
|
||||
case 1:
|
||||
SetGpuReg(REG_OFFSET_BG3CNT, BGCNT_PRIORITY(3)
|
||||
| BGCNT_CHARBASE(0)
|
||||
| BGCNT_16COLOR
|
||||
| BGCNT_SCREENBASE(6)
|
||||
| BGCNT_TXT256x256);
|
||||
SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(2)
|
||||
| BGCNT_CHARBASE(0)
|
||||
| BGCNT_16COLOR
|
||||
| BGCNT_SCREENBASE(7)
|
||||
| BGCNT_TXT256x256);
|
||||
SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(1)
|
||||
| BGCNT_CHARBASE(1)
|
||||
| BGCNT_16COLOR
|
||||
| BGCNT_SCREENBASE(15)
|
||||
| BGCNT_TXT256x256);
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0
|
||||
| DISPCNT_OBJ_1D_MAP
|
||||
| DISPCNT_BG1_ON
|
||||
| DISPCNT_BG2_ON
|
||||
| DISPCNT_BG3_ON
|
||||
| DISPCNT_OBJ_ON);
|
||||
break;
|
||||
case 2:
|
||||
SetGpuReg(REG_OFFSET_BG3CNT, BGCNT_PRIORITY(3)
|
||||
| BGCNT_CHARBASE(0)
|
||||
| BGCNT_16COLOR
|
||||
| BGCNT_SCREENBASE(6)
|
||||
| BGCNT_TXT256x256);
|
||||
SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(2)
|
||||
| BGCNT_CHARBASE(0)
|
||||
| BGCNT_16COLOR
|
||||
| BGCNT_SCREENBASE(7)
|
||||
| BGCNT_TXT256x256);
|
||||
SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(1)
|
||||
| BGCNT_CHARBASE(1)
|
||||
| BGCNT_16COLOR
|
||||
| BGCNT_SCREENBASE(15)
|
||||
| BGCNT_TXT256x256);
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0
|
||||
| DISPCNT_OBJ_1D_MAP
|
||||
| DISPCNT_BG1_ON
|
||||
| DISPCNT_BG2_ON
|
||||
| DISPCNT_BG3_ON
|
||||
| DISPCNT_OBJ_ON);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_817B1C8(u8 a)
|
||||
{
|
||||
LZ77UnCompVram(&gUnknown_085F0740, (void *)(VRAM + 0x4000));
|
||||
LZ77UnCompVram(&gUnknown_085F0BC0, (void *)(VRAM + 0x7800));
|
||||
switch (a)
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
LoadPalette(&gUnknown_085F06E0, 240, 32);
|
||||
LZ77UnCompVram(&gUnknown_085F0DBC, (void *)(VRAM));
|
||||
LZ77UnCompVram(&gUnknown_085F1398, (void *)(VRAM + 0x3000));
|
||||
LoadPalette(&gUnknown_085F0CFC, 0, 96);
|
||||
LoadCompressedObjectPic(gUnknown_085F5064);
|
||||
LZ77UnCompVram(&gUnknown_085F16A8, (void *)(VRAM + 0x10000));
|
||||
LoadPalette(&gUnknown_085F1668, 256, 32);
|
||||
sub_817B76C();
|
||||
break;
|
||||
case 1:
|
||||
LoadPalette(&gUnknown_085F0700, 240, 32);
|
||||
LZ77UnCompVram(&gUnknown_085F0DBC, (void *)(VRAM));
|
||||
LZ77UnCompVram(&gUnknown_085F1398, (void *)(VRAM + 0x3000));
|
||||
LoadPalette(&gUnknown_085F0D5C, 0, 96);
|
||||
LoadCompressedObjectPic(gUnknown_085F5064);
|
||||
LZ77UnCompVram(&gUnknown_085F16A8, (void *)(VRAM + 0x10000));
|
||||
LoadPalette(&gUnknown_085F1688, 256, 32);
|
||||
sub_817B76C();
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
LoadPalette(&gUnknown_085F0700, 240, 32);
|
||||
LZ77UnCompVram(&gUnknown_085F1824, (void *)(VRAM));
|
||||
LZ77UnCompVram(&gUnknown_085F1EAC, (void *)(VRAM + 0x3000));
|
||||
LoadPalette(&gUnknown_085F1804, 0, 32);
|
||||
LoadCompressedObjectPic(gUnknown_085F50EC);
|
||||
LoadPalette(&gUnknown_085F1804, 256, 32);
|
||||
sub_817B788();
|
||||
break;
|
||||
case 4:
|
||||
LoadPalette(&gUnknown_085F0720, 240, 32);
|
||||
LZ77UnCompVram(&gUnknown_085F235C, (void *)(VRAM));
|
||||
LZ77UnCompVram(&gUnknown_085F2568, (void *)(VRAM + 0x3000));
|
||||
LoadPalette(&gUnknown_085F231C, 0, 64);
|
||||
LoadCompressedObjectPic(gUnknown_085F5180);
|
||||
LoadPalette(&gUnknown_085F2548, 256, 32);
|
||||
sub_817B7A4();
|
||||
break;
|
||||
}
|
||||
gReservedSpritePaletteCount = 8;
|
||||
gUnknown_0203BD28 = 0;
|
||||
}
|
||||
|
||||
void sub_817B3A8(u8 a)
|
||||
{
|
||||
SetGpuReg(REG_OFFSET_BG3CNT, BGCNT_PRIORITY(3)
|
||||
| BGCNT_CHARBASE(0)
|
||||
| BGCNT_16COLOR
|
||||
| BGCNT_SCREENBASE(6)
|
||||
| BGCNT_TXT256x256);
|
||||
SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(2)
|
||||
| BGCNT_CHARBASE(0)
|
||||
| BGCNT_16COLOR
|
||||
| BGCNT_SCREENBASE(7)
|
||||
| BGCNT_TXT256x256);
|
||||
SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(1)
|
||||
| BGCNT_CHARBASE(1)
|
||||
| BGCNT_16COLOR
|
||||
| BGCNT_SCREENBASE(15)
|
||||
| BGCNT_TXT256x256);
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0
|
||||
| DISPCNT_OBJ_1D_MAP
|
||||
| DISPCNT_BG_ALL_ON
|
||||
| DISPCNT_OBJ_ON);
|
||||
}
|
||||
|
||||
u8 sub_817B3DC(u8 a, u16 b, u16 c, u16 d)
|
||||
{
|
||||
u8 taskId = CreateTask(&sub_817B458, 0);
|
||||
|
||||
gTasks[taskId].data[0] = a;
|
||||
gTasks[taskId].data[1] = b;
|
||||
gTasks[taskId].data[2] = 0;
|
||||
gTasks[taskId].data[3] = 0;
|
||||
gTasks[taskId].data[4] = c;
|
||||
gTasks[taskId].data[5] = 0;
|
||||
gTasks[taskId].data[6] = 0;
|
||||
gTasks[taskId].data[7] = d;
|
||||
gTasks[taskId].data[8] = 8;
|
||||
gTasks[taskId].data[9] = 0;
|
||||
sub_817B458(taskId);
|
||||
return taskId;
|
||||
}
|
||||
|
||||
static void sub_817B458(u8 taskId)
|
||||
{
|
||||
s16 data1;
|
||||
s16 data4;
|
||||
s16 data7;
|
||||
s32 r2;
|
||||
|
||||
data1 = gTasks[taskId].data[1];
|
||||
if (data1 != 0)
|
||||
{
|
||||
r2 = (gTasks[taskId].data[2] << 16) + (u16)gTasks[taskId].data[3];
|
||||
r2 -= (u16)data1 << 4;
|
||||
gTasks[taskId].data[2] = r2 >> 16;
|
||||
gTasks[taskId].data[3] = r2;
|
||||
SetGpuReg(REG_OFFSET_BG1HOFS, gTasks[taskId].data[2]);
|
||||
SetGpuReg(REG_OFFSET_BG1VOFS, gUnknown_0203BD24 + gUnknown_0203BD26);
|
||||
}
|
||||
|
||||
data4 = gTasks[taskId].data[4];
|
||||
if (data4 != 0)
|
||||
{
|
||||
r2 = (gTasks[taskId].data[5] << 16) + (u16)gTasks[taskId].data[6];
|
||||
r2 -= (u16)data4 << 4;
|
||||
gTasks[taskId].data[5] = r2 >> 16;
|
||||
gTasks[taskId].data[6] = r2;
|
||||
SetGpuReg(REG_OFFSET_BG2HOFS, gTasks[taskId].data[5]);
|
||||
if (gTasks[taskId].data[0] != 0)
|
||||
SetGpuReg(REG_OFFSET_BG2VOFS, gUnknown_0203BD24 + gUnknown_0203BD26);
|
||||
else
|
||||
SetGpuReg(REG_OFFSET_BG2VOFS, gUnknown_0203BD24);
|
||||
}
|
||||
|
||||
data7 = gTasks[taskId].data[7];
|
||||
if (data7 != 0)
|
||||
{
|
||||
r2 = (gTasks[taskId].data[8] << 16) + (u16)gTasks[taskId].data[9];
|
||||
r2 -= (u16)data7 << 4;
|
||||
gTasks[taskId].data[8] = r2 >> 16;
|
||||
gTasks[taskId].data[9] = r2;
|
||||
SetGpuReg(REG_OFFSET_BG3HOFS, gTasks[taskId].data[8]);
|
||||
SetGpuReg(REG_OFFSET_BG3VOFS, gUnknown_0203BD24);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_817B540(u8 mode)
|
||||
{
|
||||
u16 x;
|
||||
u16 y;
|
||||
switch (mode)
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
/* stuff */
|
||||
if (gMain.vblankCounter1 & 3 || gPaletteFade.active)
|
||||
break;
|
||||
if (gMain.vblankCounter1 & 4)
|
||||
{
|
||||
x = gPlttBufferUnfaded[9];
|
||||
y = gPlttBufferUnfaded[10];
|
||||
}
|
||||
else
|
||||
{
|
||||
x = gPlttBufferUnfaded[10];
|
||||
y = gPlttBufferUnfaded[9];
|
||||
}
|
||||
LoadPalette(&x, 9, 2);
|
||||
LoadPalette(&y, 10, 2);
|
||||
break;
|
||||
case 2:
|
||||
if (gMain.vblankCounter1 & 3 || gPaletteFade.active)
|
||||
break;
|
||||
if (gMain.vblankCounter1 & 4)
|
||||
{
|
||||
x = 0x3D27;
|
||||
y = 0x295;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 0x31C;
|
||||
y = 0x3D27;
|
||||
}
|
||||
LoadPalette(&x, 12, 2);
|
||||
LoadPalette(&y, 13, 2);
|
||||
break;
|
||||
case 1:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_817B62C(struct Sprite *sprite)
|
||||
{
|
||||
s32 var;
|
||||
s16 var2 = gUnknown_0203BD28;
|
||||
|
||||
if (var2 != 2)
|
||||
{
|
||||
switch (var2)
|
||||
{
|
||||
default:
|
||||
DestroySprite(sprite);
|
||||
break;
|
||||
case 0:
|
||||
var = ((sprite->pos1.x << 16) | (u16)sprite->data[2]) + (u16)sprite->data[1];
|
||||
sprite->pos1.x = var >> 16;
|
||||
sprite->data[2] = var;
|
||||
if (sprite->pos1.x > 0xFF)
|
||||
sprite->pos1.x = -0x20;
|
||||
if (sprite->data[0])
|
||||
sprite->pos2.y = -(gUnknown_0203BD24 + gUnknown_0203BD26);
|
||||
else
|
||||
sprite->pos2.y = -gUnknown_0203BD24;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_817B698(u8 a, const struct IntroCreditsSpriteMetadata *b, const union AnimCmd *const *c, u8 d)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
for(i = 0; i < d; i++)
|
||||
{
|
||||
u8 sprite = CreateSprite(&gUnknown_085F504C, b[i].x, b[i].y, b[i].subpriority);
|
||||
CalcCenterToCornerVec(&gSprites[sprite], b[i].shape, b[i].size, 0);
|
||||
gSprites[sprite].oam.priority = 3;
|
||||
gSprites[sprite].oam.shape = b[i].shape;
|
||||
gSprites[sprite].oam.size = b[i].size;
|
||||
gSprites[sprite].oam.paletteNum = 0;
|
||||
gSprites[sprite].anims = c;
|
||||
StartSpriteAnim(&gSprites[sprite], b[i].animNum);
|
||||
gSprites[sprite].data[0] = a;
|
||||
gSprites[sprite].data[1] = b[i].xOff;
|
||||
gSprites[sprite].data[2] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_817B76C(void)
|
||||
{
|
||||
sub_817B698(0, gUnknown_085F50A4, gUnknown_085F5094, 9);
|
||||
}
|
||||
|
||||
static void sub_817B788(void)
|
||||
{
|
||||
sub_817B698(1, gUnknown_085F5120, gUnknown_085F5114, 12);
|
||||
}
|
||||
|
||||
static void sub_817B7A4(void)
|
||||
{
|
||||
sub_817B698(1, gUnknown_085F519C, gUnknown_085F5198, 6);
|
||||
}
|
||||
|
||||
static void nullsub_65(struct Sprite *sprite)
|
||||
{
|
||||
}
|
||||
|
||||
static void sub_817B7C4(struct Sprite* sprite)
|
||||
{
|
||||
sprite->invisible = gSprites[sprite->data[0]].invisible;
|
||||
sprite->pos1.x = gSprites[sprite->data[0]].pos1.x;
|
||||
sprite->pos1.y = gSprites[sprite->data[0]].pos1.y + 8;
|
||||
sprite->pos2.x = gSprites[sprite->data[0]].pos2.x;
|
||||
sprite->pos2.y = gSprites[sprite->data[0]].pos2.y;
|
||||
}
|
||||
|
||||
u8 intro_create_brendan_sprite(s16 a, s16 b)
|
||||
{
|
||||
u8 sprite = CreateSprite(&gUnknown_085F51EC, a, b, 2);
|
||||
u8 brendan = CreateSprite(&gUnknown_085F523C, a, b + 8, 3);
|
||||
gSprites[brendan].data[0] = sprite;
|
||||
return sprite;
|
||||
}
|
||||
|
||||
u8 intro_create_may_sprite(s16 a, s16 b)
|
||||
{
|
||||
u8 sprite = CreateSprite(&gUnknown_085F5204, a, b, 2);
|
||||
u8 may = CreateSprite(&gUnknown_085F5254, a, b + 8, 3);
|
||||
gSprites[may].data[0] = sprite;
|
||||
return sprite;
|
||||
}
|
||||
|
||||
static void nullsub_66(struct Sprite *sprite)
|
||||
{
|
||||
}
|
||||
|
||||
static void sub_817B8E8(struct Sprite* sprite)
|
||||
{
|
||||
sprite->invisible = gSprites[sprite->data[0]].invisible;
|
||||
sprite->pos1.y = gSprites[sprite->data[0]].pos1.y;
|
||||
sprite->pos2.x = gSprites[sprite->data[0]].pos2.x;
|
||||
sprite->pos2.y = gSprites[sprite->data[0]].pos2.y;
|
||||
}
|
||||
|
||||
static u8 sub_817B948(s16 a, s16 b)
|
||||
{
|
||||
u8 sprite = CreateSprite(&gUnknown_085F528C, a - 32, b, 5);
|
||||
u8 latios = CreateSprite(&gUnknown_085F528C, a + 32, b, 6);
|
||||
gSprites[latios].data[0] = sprite;
|
||||
StartSpriteAnim(&gSprites[latios], 1);
|
||||
gSprites[latios].callback = &sub_817B8E8;
|
||||
return sprite;
|
||||
}
|
||||
|
||||
u8 intro_create_flygon_sprite(s16 a, s16 b)
|
||||
{
|
||||
u8 sprite = CreateSprite(&gUnknown_085F52A4, a - 32, b, 5);
|
||||
u8 flygon = CreateSprite(&gUnknown_085F52A4, a + 32, b, 6);
|
||||
gSprites[flygon].data[0] = sprite;
|
||||
StartSpriteAnim(&gSprites[flygon], 1);
|
||||
gSprites[flygon].callback = &sub_817B8E8;
|
||||
return sprite;
|
||||
}
|
||||
+27
-228
@@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "item_menu.h"
|
||||
#include "battle.h"
|
||||
#include "battle_controllers.h"
|
||||
#include "battle_frontier_2.h"
|
||||
@@ -58,7 +59,6 @@ void load_bag_item_list_buffers(u8);
|
||||
void bag_menu_print_pocket_names(u8*, u8*);
|
||||
void bag_menu_copy_pocket_name_to_window(u32);
|
||||
void bag_menu_draw_pocket_indicator_square(u8, u8);
|
||||
void AddBagVisualObject(u8);
|
||||
void bag_menu_add_pocket_scroll_arrow_indicators_maybe(void);
|
||||
void bag_menu_add_list_scroll_arrow_indicators_maybe(void);
|
||||
void bag_menu_prepare_tmhm_move_window(void);
|
||||
@@ -67,9 +67,8 @@ void Task_WallyTutorialBagMenu(u8);
|
||||
void Task_BagMenu(u8);
|
||||
void get_name(s8*, u16);
|
||||
u16 ItemIdToBattleMoveId(u16);
|
||||
void ShakeBagVisual(void);
|
||||
u16 BagGetItemIdByPocketPosition(u8, u16);
|
||||
void AddBagItemIconObject(u16, u8);
|
||||
void AddBagItemIconSprite(u16, u8);
|
||||
void bag_menu_print_description_box_text(int);
|
||||
void bag_menu_print_cursor(u8, u8);
|
||||
void bag_menu_print(u8, u8, const u8*, u8, u8, u8, u8, u8, u8);
|
||||
@@ -86,9 +85,6 @@ u8 GetSwitchBagPocketDirection(void);
|
||||
void SwitchBagPocket(u8, s16, u16);
|
||||
bool8 sub_81AC2C0(void);
|
||||
void bag_menu_swap_items(u8);
|
||||
void SetBagVisualPocketId(u8, u8);
|
||||
void RemoveBagObject(u8);
|
||||
void AddSwitchPocketRotatingBallObject(s16);
|
||||
void sub_81AC10C(u8);
|
||||
void sub_81AC3C0(u8);
|
||||
void sub_81AC498(u8);
|
||||
@@ -128,7 +124,7 @@ void sub_81ABAC4(void);
|
||||
void sub_81ABAE0(void);
|
||||
u8 sub_81AB1F0(u8);
|
||||
void sub_81AC23C(u8);
|
||||
void bag_menu_change_item_callback(u32 a, bool8 b, struct ListMenu*);
|
||||
void bag_menu_change_item_callback(s32 a, bool8 b, struct ListMenu*);
|
||||
void sub_81AB520(u8 rboxId, int item_index_in_pocket, u8 a);
|
||||
void ItemMenu_UseOutOfBattle(u8 taskId);
|
||||
void ItemMenu_Toss(u8 taskId);
|
||||
@@ -251,46 +247,6 @@ const struct WindowTemplate gUnknown_086141AC[] = {
|
||||
|
||||
// .text
|
||||
|
||||
struct BagStruct {
|
||||
void (*bagCallback)(void);
|
||||
u8 location;
|
||||
u8 pocket;
|
||||
u8 unk6[2];
|
||||
u16 cursorPosition[5];
|
||||
u16 scrollPosition[5];
|
||||
};
|
||||
|
||||
struct UnkBagStruct {
|
||||
MainCallback unk0;
|
||||
u8 unk4[0x800];
|
||||
u8 unk804;
|
||||
u8 unk805;
|
||||
u8 unk806[10];
|
||||
u8 unk810[7];
|
||||
u8 unk817;
|
||||
u8 unk818;
|
||||
u8 unk819;
|
||||
u8 unk81A;
|
||||
u8 unk81B:4;
|
||||
u8 unk81B_1:2;
|
||||
u8 unk81B_3:1;
|
||||
u8 unk81B_2:1;
|
||||
u8 filler3[2];
|
||||
u8 unk81E;
|
||||
u8 unk81F;
|
||||
const u8* unk820;
|
||||
u8 unk824;
|
||||
u8 unk825;
|
||||
u8 filler[2];
|
||||
u8 unk828;
|
||||
u8 unk829[5];
|
||||
u8 unk82E[6];
|
||||
s16 unk834;
|
||||
u8 filler4[0xE];
|
||||
u8 unk844[32][32];
|
||||
u8 filler2[4];
|
||||
};
|
||||
|
||||
struct ListBuffer1 {
|
||||
struct ListMenuItem subBuffers[65];
|
||||
};
|
||||
@@ -319,16 +275,12 @@ void (*gFieldCallback)(void);
|
||||
|
||||
extern u8 *gPocketNamesStringsTable[];
|
||||
extern u8 gUnknown_08D9A88C[];
|
||||
extern struct CompressedSpriteSheet gUnknown_0857FB34;
|
||||
extern struct CompressedSpriteSheet gUnknown_0857FB3C;
|
||||
extern struct CompressedSpritePalette gUnknown_0857FB44;
|
||||
extern struct ListMenuTemplate gUnknown_08613F9C;
|
||||
extern u8 gMoveNames[][0xD];
|
||||
extern const u8 gMoveNames[][0xD];
|
||||
extern u8* gReturnToXStringsTable[];
|
||||
extern u32 gUnknown_0203CE5E[];
|
||||
extern u8 EventScript_2736B3[];
|
||||
extern const u8 EventScript_2736B3[];
|
||||
extern const u16 gUnknown_0860F074[];
|
||||
extern struct BattleMove gBattleMoves[];
|
||||
|
||||
void ResetBagScrollPositions(void)
|
||||
{
|
||||
@@ -412,7 +364,7 @@ void GoToBagMenu(u8 bagMenuType, u8 pocketId, void ( *postExitMenuMainCallback2)
|
||||
gUnknown_0203CE54->unk81A = 0xFF;
|
||||
gUnknown_0203CE54->unk81E = -1;
|
||||
gUnknown_0203CE54->unk81F = -1;
|
||||
memset(&gUnknown_0203CE54->unk804, 0xFF, 12);
|
||||
memset(gUnknown_0203CE54->unk804, 0xFF, sizeof(gUnknown_0203CE54->unk804));
|
||||
memset(gUnknown_0203CE54->unk810, 0xFF, 10);
|
||||
SetMainCallback2(CB2_Bag);
|
||||
}
|
||||
@@ -518,7 +470,7 @@ bool8 setup_bag_menu(void)
|
||||
gMain.state++;
|
||||
break;
|
||||
case 15:
|
||||
AddBagVisualObject(gUnknown_0203CE58.pocket);
|
||||
AddBagVisualSprite(gUnknown_0203CE58.pocket);
|
||||
gMain.state++;
|
||||
break;
|
||||
case 16:
|
||||
@@ -689,7 +641,7 @@ void get_name(s8 *dest, u16 itemId)
|
||||
}
|
||||
}
|
||||
|
||||
void bag_menu_change_item_callback(u32 a, bool8 b, struct ListMenu *unused)
|
||||
void bag_menu_change_item_callback(s32 a, bool8 b, struct ListMenu *unused)
|
||||
{
|
||||
if (b != 1)
|
||||
{
|
||||
@@ -698,11 +650,11 @@ void bag_menu_change_item_callback(u32 a, bool8 b, struct ListMenu *unused)
|
||||
}
|
||||
if (gUnknown_0203CE54->unk81A == 0xFF)
|
||||
{
|
||||
RemoveBagItemIconObject(1 ^ gUnknown_0203CE54->unk81B_1);
|
||||
RemoveBagItemIconSprite(1 ^ gUnknown_0203CE54->unk81B_1);
|
||||
if (a != -2)
|
||||
AddBagItemIconObject(BagGetItemIdByPocketPosition(gUnknown_0203CE58.pocket + 1, a), gUnknown_0203CE54->unk81B_1);
|
||||
AddBagItemIconSprite(BagGetItemIdByPocketPosition(gUnknown_0203CE58.pocket + 1, a), gUnknown_0203CE54->unk81B_1);
|
||||
else
|
||||
AddBagItemIconObject(-1, gUnknown_0203CE54->unk81B_1);
|
||||
AddBagItemIconSprite(-1, gUnknown_0203CE54->unk81B_1);
|
||||
gUnknown_0203CE54->unk81B_1 ^= 1;
|
||||
if (!gUnknown_0203CE54->unk81B_3)
|
||||
bag_menu_print_description_box_text(a);
|
||||
@@ -831,7 +783,7 @@ void task_close_bag_menu_2(u8 taskId)
|
||||
s16* data = gTasks[taskId].data;
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
sub_81AE6C8(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]);
|
||||
DestroyListMenuTask(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]);
|
||||
if (gUnknown_0203CE54->unk0 != 0)
|
||||
SetMainCallback2(gUnknown_0203CE54->unk0);
|
||||
else
|
||||
@@ -916,7 +868,7 @@ void bag_menu_inits_lists_menu(u8 taskId)
|
||||
u16* scrollPos = &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket];
|
||||
u16* cursorPos = &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket];
|
||||
bag_menu_RemoveBagItem_message_window(4);
|
||||
sub_81AE6C8(data[0], scrollPos, cursorPos);
|
||||
DestroyListMenuTask(data[0], scrollPos, cursorPos);
|
||||
sub_81AB9A8(gUnknown_0203CE58.pocket);
|
||||
sub_81ABA88(gUnknown_0203CE58.pocket);
|
||||
load_bag_item_list_buffers(gUnknown_0203CE58.pocket);
|
||||
@@ -968,7 +920,7 @@ void Task_BagMenu(u8 taskId)
|
||||
{
|
||||
if (sub_81AC2C0() == 1)
|
||||
{
|
||||
sub_81AE860(data[0], scrollPos, cursorPos);
|
||||
ListMenuGetScrollAndRow(data[0], scrollPos, cursorPos);
|
||||
if ((*scrollPos + *cursorPos) != gUnknown_0203CE54->unk829[gUnknown_0203CE58.pocket] - 1)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
@@ -980,7 +932,7 @@ void Task_BagMenu(u8 taskId)
|
||||
else
|
||||
{
|
||||
int r4 = ListMenuHandleInputGetItemId(data[0]);
|
||||
sub_81AE860(data[0], scrollPos, cursorPos);
|
||||
ListMenuGetScrollAndRow(data[0], scrollPos, cursorPos);
|
||||
switch (r4)
|
||||
{
|
||||
case -1:
|
||||
@@ -1039,7 +991,6 @@ u8 GetSwitchBagPocketDirection(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void ChangeBagPocketId(u8 *bagPocketId, s8 deltaBagPocketId)
|
||||
{
|
||||
if (deltaBagPocketId == 1 && *bagPocketId == 4)
|
||||
@@ -1050,13 +1001,11 @@ void ChangeBagPocketId(u8 *bagPocketId, s8 deltaBagPocketId)
|
||||
*bagPocketId += deltaBagPocketId;
|
||||
}
|
||||
|
||||
#ifdef NONMATCHING
|
||||
void SwitchBagPocket(u8 taskId, s16 deltaBagPocketId, u16 a3)
|
||||
{
|
||||
s16* data = gTasks[taskId].data;
|
||||
u8 pocketId;
|
||||
|
||||
|
||||
data[13] = 0;
|
||||
data[12] = 0;
|
||||
data[11] = deltaBagPocketId;
|
||||
@@ -1064,9 +1013,9 @@ void SwitchBagPocket(u8 taskId, s16 deltaBagPocketId, u16 a3)
|
||||
{
|
||||
ClearWindowTilemap(0);
|
||||
ClearWindowTilemap(1);
|
||||
sub_81AE6C8(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]);
|
||||
DestroyListMenuTask(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]);
|
||||
schedule_bg_copy_tilemap_to_vram(0);
|
||||
gSprites[gUnknown_0203CE54->unk806[gUnknown_0203CE54->unk81B_1 ^ 1]].invisible = 1;
|
||||
gSprites[gUnknown_0203CE54->unk804[2 + (gUnknown_0203CE54->unk81B_1 ^ 1)]].invisible = 1;
|
||||
sub_81AB824();
|
||||
}
|
||||
pocketId = gUnknown_0203CE58.pocket;
|
||||
@@ -1086,160 +1035,10 @@ void SwitchBagPocket(u8 taskId, s16 deltaBagPocketId, u16 a3)
|
||||
FillBgTilemapBufferRect_Palette0(2, 11, 14, 2, 15, 16);
|
||||
schedule_bg_copy_tilemap_to_vram(2);
|
||||
SetBagVisualPocketId(pocketId, 1);
|
||||
RemoveBagObject(1);
|
||||
AddSwitchPocketRotatingBallObject(deltaBagPocketId);
|
||||
RemoveBagSprite(1);
|
||||
AddSwitchPocketRotatingBallSprite(deltaBagPocketId);
|
||||
SetTaskFuncWithFollowupFunc(taskId, sub_81AC10C, gTasks[taskId].func);
|
||||
}
|
||||
#else
|
||||
__attribute__((naked))
|
||||
void SwitchBagPocket(u8 taskId, s16 deltaBagPocketId, u16 a3)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
push {r4-r6,lr}\n\
|
||||
sub sp, 0xC\n\
|
||||
lsls r0, 24\n\
|
||||
lsrs r6, r0, 24\n\
|
||||
lsls r1, 16\n\
|
||||
lsrs r5, r1, 16\n\
|
||||
lsls r2, 16\n\
|
||||
lsls r0, r6, 2\n\
|
||||
adds r0, r6\n\
|
||||
lsls r0, 3\n\
|
||||
ldr r1, =gTasks + 0x8\n\
|
||||
adds r4, r0, r1\n\
|
||||
movs r0, 0\n\
|
||||
strh r0, [r4, 0x1A]\n\
|
||||
strh r0, [r4, 0x18]\n\
|
||||
strh r5, [r4, 0x16]\n\
|
||||
cmp r2, 0\n\
|
||||
bne _081AC026\n\
|
||||
movs r0, 0\n\
|
||||
bl ClearWindowTilemap\n\
|
||||
movs r0, 0x1\n\
|
||||
bl ClearWindowTilemap\n\
|
||||
ldrb r0, [r4]\n\
|
||||
ldr r3, =gUnknown_0203CE58\n\
|
||||
ldrb r2, [r3, 0x5]\n\
|
||||
lsls r2, 1\n\
|
||||
adds r1, r3, 0\n\
|
||||
adds r1, 0x12\n\
|
||||
adds r1, r2, r1\n\
|
||||
adds r3, 0x8\n\
|
||||
adds r2, r3\n\
|
||||
bl sub_81AE6C8\n\
|
||||
movs r0, 0\n\
|
||||
bl schedule_bg_copy_tilemap_to_vram\n\
|
||||
ldr r3, =gSprites\n\
|
||||
ldr r0, =gUnknown_0203CE54\n\
|
||||
ldr r2, [r0]\n\
|
||||
ldr r1, =0x0000081b\n\
|
||||
adds r0, r2, r1\n\
|
||||
ldrb r1, [r0]\n\
|
||||
lsls r1, 26\n\
|
||||
lsrs r1, 30\n\
|
||||
movs r0, 0x1\n\
|
||||
eors r0, r1\n\
|
||||
adds r2, r0\n\
|
||||
ldr r0, =0x00000806\n\
|
||||
adds r2, r0\n\
|
||||
ldrb r1, [r2]\n\
|
||||
lsls r0, r1, 4\n\
|
||||
adds r0, r1\n\
|
||||
lsls r0, 2\n\
|
||||
adds r0, r3\n\
|
||||
adds r0, 0x3E\n\
|
||||
ldrb r1, [r0]\n\
|
||||
movs r2, 0x4\n\
|
||||
orrs r1, r2\n\
|
||||
strb r1, [r0]\n\
|
||||
bl sub_81AB824\n\
|
||||
_081AC026:\n\
|
||||
ldr r4, =gUnknown_0203CE58\n\
|
||||
ldrb r1, [r4, 0x5]\n\
|
||||
add r0, sp, 0x8\n\
|
||||
strb r1, [r0]\n\
|
||||
lsls r1, r5, 24\n\
|
||||
asrs r1, 24\n\
|
||||
bl ChangeBagPocketId\n\
|
||||
lsls r0, r5, 16\n\
|
||||
asrs r1, r0, 16\n\
|
||||
adds r5, r0, 0\n\
|
||||
cmp r1, 0x1\n\
|
||||
bne _081AC07C\n\
|
||||
ldr r2, =gPocketNamesStringsTable\n\
|
||||
ldrb r0, [r4, 0x5]\n\
|
||||
lsls r0, 2\n\
|
||||
adds r0, r2\n\
|
||||
ldr r0, [r0]\n\
|
||||
add r1, sp, 0x8\n\
|
||||
ldrb r1, [r1]\n\
|
||||
lsls r1, 2\n\
|
||||
adds r1, r2\n\
|
||||
ldr r1, [r1]\n\
|
||||
bl bag_menu_print_pocket_names\n\
|
||||
movs r0, 0\n\
|
||||
bl bag_menu_copy_pocket_name_to_window\n\
|
||||
b _081AC09A\n\
|
||||
.pool\n\
|
||||
_081AC07C:\n\
|
||||
ldr r2, =gPocketNamesStringsTable\n\
|
||||
add r0, sp, 0x8\n\
|
||||
ldrb r0, [r0]\n\
|
||||
lsls r0, 2\n\
|
||||
adds r0, r2\n\
|
||||
ldr r0, [r0]\n\
|
||||
ldrb r1, [r4, 0x5]\n\
|
||||
lsls r1, 2\n\
|
||||
adds r1, r2\n\
|
||||
ldr r1, [r1]\n\
|
||||
bl bag_menu_print_pocket_names\n\
|
||||
movs r0, 0x8\n\
|
||||
bl bag_menu_copy_pocket_name_to_window\n\
|
||||
_081AC09A:\n\
|
||||
ldr r0, =gUnknown_0203CE58\n\
|
||||
ldrb r0, [r0, 0x5]\n\
|
||||
movs r1, 0\n\
|
||||
bl bag_menu_draw_pocket_indicator_square\n\
|
||||
add r0, sp, 0x8\n\
|
||||
ldrb r0, [r0]\n\
|
||||
movs r1, 0x1\n\
|
||||
bl bag_menu_draw_pocket_indicator_square\n\
|
||||
movs r0, 0xF\n\
|
||||
str r0, [sp]\n\
|
||||
movs r0, 0x10\n\
|
||||
str r0, [sp, 0x4]\n\
|
||||
movs r0, 0x2\n\
|
||||
movs r1, 0xB\n\
|
||||
movs r2, 0xE\n\
|
||||
movs r3, 0x2\n\
|
||||
bl FillBgTilemapBufferRect_Palette0\n\
|
||||
movs r0, 0x2\n\
|
||||
bl schedule_bg_copy_tilemap_to_vram\n\
|
||||
add r0, sp, 0x8\n\
|
||||
ldrb r0, [r0]\n\
|
||||
movs r1, 0x1\n\
|
||||
bl SetBagVisualPocketId\n\
|
||||
movs r0, 0x1\n\
|
||||
bl RemoveBagObject\n\
|
||||
asrs r0, r5, 16\n\
|
||||
bl AddSwitchPocketRotatingBallObject\n\
|
||||
ldr r1, =sub_81AC10C\n\
|
||||
ldr r2, =gTasks\n\
|
||||
lsls r0, r6, 2\n\
|
||||
adds r0, r6\n\
|
||||
lsls r0, 3\n\
|
||||
adds r0, r2\n\
|
||||
ldr r2, [r0]\n\
|
||||
adds r0, r6, 0\n\
|
||||
bl SetTaskFuncWithFollowupFunc\n\
|
||||
add sp, 0xC\n\
|
||||
pop {r4-r6}\n\
|
||||
pop {r0}\n\
|
||||
bx r0\n\
|
||||
.pool\n\
|
||||
.syntax divided\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_81AC10C(u8 taskId)
|
||||
{
|
||||
@@ -1341,13 +1140,13 @@ void sub_81AC3C0(u8 taskId)
|
||||
if (gMain.newKeys & SELECT_BUTTON)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
sub_81AE860(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]);
|
||||
ListMenuGetScrollAndRow(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]);
|
||||
sub_81AC498(taskId);
|
||||
}
|
||||
else
|
||||
{
|
||||
r7 = ListMenuHandleInputGetItemId(data[0]);
|
||||
sub_81AE860(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]);
|
||||
ListMenuGetScrollAndRow(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]);
|
||||
sub_80D4FC8(0);
|
||||
sub_80D4FEC(gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]);
|
||||
switch (r7)
|
||||
@@ -1382,7 +1181,7 @@ void sub_81AC498(u8 taskId)
|
||||
{
|
||||
sub_80D702C(gBagPockets[gUnknown_0203CE58.pocket].itemSlots, data[1], realPos);
|
||||
gUnknown_0203CE54->unk81A = -1;
|
||||
sub_81AE6C8(data[0], scrollPos, cursorPos);
|
||||
DestroyListMenuTask(data[0], scrollPos, cursorPos);
|
||||
if (data[1] < realPos)
|
||||
gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]--;
|
||||
load_bag_item_list_buffers(gUnknown_0203CE58.pocket);
|
||||
@@ -1400,7 +1199,7 @@ void sub_81AC590(u8 taskId)
|
||||
u16* cursorPos = &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket];
|
||||
|
||||
gUnknown_0203CE54->unk81A = -1;
|
||||
sub_81AE6C8(data[0], scrollPos, cursorPos);
|
||||
DestroyListMenuTask(data[0], scrollPos, cursorPos);
|
||||
if (data[1] < (*scrollPos + *cursorPos))
|
||||
gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]--;
|
||||
load_bag_item_list_buffers(gUnknown_0203CE58.pocket);
|
||||
@@ -1772,7 +1571,7 @@ void Task_ActuallyToss(u8 taskId)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
RemoveBagItem(gSpecialVar_ItemId, data[8]);
|
||||
sub_81AE6C8(data[0], scrollPos, cursorPos);
|
||||
DestroyListMenuTask(data[0], scrollPos, cursorPos);
|
||||
sub_81AB9A8(gUnknown_0203CE58.pocket);
|
||||
sub_81ABA88(gUnknown_0203CE58.pocket);
|
||||
load_bag_item_list_buffers(gUnknown_0203CE58.pocket);
|
||||
@@ -1792,7 +1591,7 @@ void ItemMenu_Register(u8 taskId)
|
||||
gSaveBlock1Ptr->registeredItem = 0;
|
||||
else
|
||||
gSaveBlock1Ptr->registeredItem = gSpecialVar_ItemId;
|
||||
sub_81AE6C8(data[0], scrollPos, cursorPos);
|
||||
DestroyListMenuTask(data[0], scrollPos, cursorPos);
|
||||
load_bag_item_list_buffers(gUnknown_0203CE58.pocket);
|
||||
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos);
|
||||
schedule_bg_copy_tilemap_to_vram(0);
|
||||
@@ -2040,7 +1839,7 @@ void sub_81AD8C8(u8 taskId)
|
||||
PlaySE(SE_REGI);
|
||||
RemoveBagItem(gSpecialVar_ItemId, data[8]);
|
||||
AddMoney(&gSaveBlock1Ptr->money, (itemid_get_market_price(gSpecialVar_ItemId) / 2) * data[8]);
|
||||
sub_81AE6C8(data[0], scrollPos, cursorPos);
|
||||
DestroyListMenuTask(data[0], scrollPos, cursorPos);
|
||||
sub_81AB9A8(gUnknown_0203CE58.pocket);
|
||||
sub_81ABA88(gUnknown_0203CE58.pocket);
|
||||
load_bag_item_list_buffers(gUnknown_0203CE58.pocket);
|
||||
@@ -2213,7 +2012,7 @@ void Task_WallyTutorialBagMenu(u8 taskId)
|
||||
case 0x132:
|
||||
PlaySE(SE_SELECT);
|
||||
bag_menu_remove_some_window();
|
||||
sub_81AE6C8(data[0], 0, 0);
|
||||
DestroyListMenuTask(data[0], 0, 0);
|
||||
RestoreBagAfterWallyTutorial();
|
||||
unknown_ItemMenu_Confirm(taskId);
|
||||
break;
|
||||
|
||||
@@ -0,0 +1,678 @@
|
||||
#include "global.h"
|
||||
#include "sprite.h"
|
||||
#include "decompress.h"
|
||||
#include "item_menu.h"
|
||||
#include "item_icon.h"
|
||||
#include "item_menu_icons.h"
|
||||
#include "window.h"
|
||||
#include "menu_helpers.h"
|
||||
#include "berry.h"
|
||||
#include "graphics.h"
|
||||
#include "constants/items.h"
|
||||
|
||||
struct CompressedTilesPal
|
||||
{
|
||||
const u8 *tiles;
|
||||
const u8 *pal;
|
||||
};
|
||||
|
||||
extern void sub_80D5860(struct Sprite *sprite);
|
||||
extern void sub_80D58F8(struct Sprite *sprite);
|
||||
extern void sub_80D5968(struct Sprite *sprite);
|
||||
extern void sub_80D5A94(struct Sprite *sprite);
|
||||
extern void sub_80D5B48(struct Sprite *sprite);
|
||||
|
||||
// this file's functions
|
||||
static void SpriteCB_BagVisualSwitchingPockets(struct Sprite *sprite);
|
||||
static void SpriteCB_ShakeBagVisual(struct Sprite *sprite);
|
||||
static void SpriteCB_SwitchPocketRotatingBallInit(struct Sprite *sprite);
|
||||
static void SpriteCB_SwitchPocketRotatingBallContinue(struct Sprite *sprite);
|
||||
|
||||
// static const rom data
|
||||
static const u16 gUnknown_0857F564[] = INCBIN_U16("graphics/interface/bag_spinner.gbapal");
|
||||
static const u8 gUnknown_0857F584[] = INCBIN_U8("graphics/interface/bag_spinner.4bpp");
|
||||
static const u8 gUnknown_0857F604[] = INCBIN_U8("graphics/unused/cherry.4bpp");
|
||||
static const u16 gUnknown_0857FA84[] = INCBIN_U16("graphics/unused/cherry.gbapal");
|
||||
|
||||
static const struct OamData sOamData_857FAA4 =
|
||||
{
|
||||
.y = 0,
|
||||
.affineMode = 1,
|
||||
.objMode = 0,
|
||||
.mosaic = 0,
|
||||
.bpp = 0,
|
||||
.shape = 0,
|
||||
.x = 0,
|
||||
.matrixNum = 0,
|
||||
.size = 3,
|
||||
.tileNum = 0,
|
||||
.priority = 1,
|
||||
.paletteNum = 0,
|
||||
.affineParam = 0
|
||||
};
|
||||
|
||||
static const union AnimCmd sSpriteAnim_857FAAC[] =
|
||||
{
|
||||
ANIMCMD_FRAME(0, 4),
|
||||
ANIMCMD_END
|
||||
};
|
||||
|
||||
static const union AnimCmd sSpriteAnim_857FAB4[] =
|
||||
{
|
||||
ANIMCMD_FRAME(64, 4),
|
||||
ANIMCMD_END
|
||||
};
|
||||
|
||||
static const union AnimCmd sSpriteAnim_857FABC[] =
|
||||
{
|
||||
ANIMCMD_FRAME(128, 4),
|
||||
ANIMCMD_END
|
||||
};
|
||||
|
||||
static const union AnimCmd sSpriteAnim_857FAC4[] =
|
||||
{
|
||||
ANIMCMD_FRAME(192, 4),
|
||||
ANIMCMD_END
|
||||
};
|
||||
|
||||
static const union AnimCmd sSpriteAnim_857FACC[] =
|
||||
{
|
||||
ANIMCMD_FRAME(256, 4),
|
||||
ANIMCMD_END
|
||||
};
|
||||
|
||||
static const union AnimCmd sSpriteAnim_857FAD4[] =
|
||||
{
|
||||
ANIMCMD_FRAME(320, 4),
|
||||
ANIMCMD_END
|
||||
};
|
||||
|
||||
static const union AnimCmd *const sSpriteAnimTable_857FADC[] =
|
||||
{
|
||||
sSpriteAnim_857FAAC,
|
||||
sSpriteAnim_857FAB4,
|
||||
sSpriteAnim_857FAC4,
|
||||
sSpriteAnim_857FACC,
|
||||
sSpriteAnim_857FAD4,
|
||||
sSpriteAnim_857FABC
|
||||
};
|
||||
|
||||
static const union AffineAnimCmd sSpriteAffineAnim_857FAF4[] =
|
||||
{
|
||||
AFFINEANIMCMD_FRAME(256, 256, 0, 0),
|
||||
AFFINEANIMCMD_END
|
||||
};
|
||||
|
||||
static const union AffineAnimCmd sSpriteAffineAnim_857FB04[] =
|
||||
{
|
||||
AFFINEANIMCMD_FRAME(0, 0, 254, 2),
|
||||
AFFINEANIMCMD_FRAME(0, 0, 2, 4),
|
||||
AFFINEANIMCMD_FRAME(0, 0, 254, 4),
|
||||
AFFINEANIMCMD_FRAME(0, 0, 2, 2),
|
||||
AFFINEANIMCMD_END
|
||||
};
|
||||
|
||||
static const union AffineAnimCmd *const sSpriteAffineAnimTable_857FB2C[] =
|
||||
{
|
||||
sSpriteAffineAnim_857FAF4,
|
||||
sSpriteAffineAnim_857FB04
|
||||
};
|
||||
|
||||
const struct CompressedSpriteSheet gUnknown_0857FB34 =
|
||||
{
|
||||
gBagMaleTiles, 0x3000, 100
|
||||
};
|
||||
|
||||
const struct CompressedSpriteSheet gUnknown_0857FB3C =
|
||||
{
|
||||
gBagFemaleTiles, 0x3000, 100
|
||||
};
|
||||
|
||||
const struct CompressedSpritePalette gUnknown_0857FB44 =
|
||||
{
|
||||
gBagPalette, 100
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate gUnknown_0857FB4C =
|
||||
{
|
||||
.tileTag = 100,
|
||||
.paletteTag = 100,
|
||||
.oam = &sOamData_857FAA4,
|
||||
.anims = sSpriteAnimTable_857FADC,
|
||||
.images = NULL,
|
||||
.affineAnims = sSpriteAffineAnimTable_857FB2C,
|
||||
.callback = SpriteCallbackDummy,
|
||||
};
|
||||
|
||||
static const struct OamData sOamData_857FB64 =
|
||||
{
|
||||
.y = 0,
|
||||
.affineMode = 0,
|
||||
.objMode = 0,
|
||||
.mosaic = 0,
|
||||
.bpp = 0,
|
||||
.shape = 0,
|
||||
.x = 0,
|
||||
.matrixNum = 4,
|
||||
.size = 1,
|
||||
.tileNum = 0,
|
||||
.priority = 2,
|
||||
.paletteNum = 0,
|
||||
.affineParam = 0
|
||||
};
|
||||
|
||||
static const union AnimCmd sSpriteAnim_857FB6C[] =
|
||||
{
|
||||
ANIMCMD_FRAME(0, 0),
|
||||
ANIMCMD_END
|
||||
};
|
||||
|
||||
static const union AnimCmd *const sSpriteAnimTable_857FB74[] =
|
||||
{
|
||||
sSpriteAnim_857FB6C
|
||||
};
|
||||
|
||||
static const union AffineAnimCmd sSpriteAffineAnim_857FB78[] =
|
||||
{
|
||||
AFFINEANIMCMD_FRAME(0, 0, 8, 16),
|
||||
AFFINEANIMCMD_END
|
||||
};
|
||||
|
||||
static const union AffineAnimCmd sSpriteAffineAnim_857FB88[] =
|
||||
{
|
||||
AFFINEANIMCMD_FRAME(0, 0, 248, 16),
|
||||
AFFINEANIMCMD_END
|
||||
};
|
||||
|
||||
static const union AffineAnimCmd *const sSpriteAffineAnimTable_857FB98[] =
|
||||
{
|
||||
sSpriteAffineAnim_857FB78,
|
||||
};
|
||||
|
||||
static const union AffineAnimCmd *const sSpriteAffineAnimTable_857FB9C[] =
|
||||
{
|
||||
sSpriteAffineAnim_857FB88,
|
||||
};
|
||||
|
||||
static const struct SpriteSheet gUnknown_0857FBA0 =
|
||||
{
|
||||
gUnknown_0857F584, 0x80, 101
|
||||
};
|
||||
|
||||
static const struct SpritePalette gUnknown_0857FBA8 =
|
||||
{
|
||||
gUnknown_0857F564, 101
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate gUnknown_0857FBB0 =
|
||||
{
|
||||
.tileTag = 101,
|
||||
.paletteTag = 101,
|
||||
.oam = &sOamData_857FB64,
|
||||
.anims = sSpriteAnimTable_857FB74,
|
||||
.images = NULL,
|
||||
.affineAnims = sSpriteAffineAnimTable_857FB98,
|
||||
.callback = SpriteCB_SwitchPocketRotatingBallInit,
|
||||
};
|
||||
|
||||
static const struct OamData sOamData_857FBC8 =
|
||||
{
|
||||
.y = 0,
|
||||
.affineMode = 0,
|
||||
.objMode = 0,
|
||||
.mosaic = 0,
|
||||
.bpp = 0,
|
||||
.shape = 0,
|
||||
.x = 0,
|
||||
.matrixNum = 0,
|
||||
.size = 3,
|
||||
.tileNum = 0,
|
||||
.priority = 1,
|
||||
.paletteNum = 7,
|
||||
.affineParam = 0
|
||||
};
|
||||
|
||||
static const struct OamData sOamData_857FBD0 =
|
||||
{
|
||||
.y = 0,
|
||||
.affineMode = 3,
|
||||
.objMode = 0,
|
||||
.mosaic = 0,
|
||||
.bpp = 0,
|
||||
.shape = 0,
|
||||
.x = 0,
|
||||
.matrixNum = 0,
|
||||
.size = 3,
|
||||
.tileNum = 0,
|
||||
.priority = 0,
|
||||
.paletteNum = 7,
|
||||
.affineParam = 0
|
||||
};
|
||||
|
||||
static const union AnimCmd sSpriteAnim_857FBD8[] =
|
||||
{
|
||||
ANIMCMD_FRAME(0, 0),
|
||||
ANIMCMD_END
|
||||
};
|
||||
|
||||
static const union AnimCmd *const sSpriteAnimTable_857FBE0[] =
|
||||
{
|
||||
sSpriteAnim_857FBD8
|
||||
};
|
||||
|
||||
static const struct SpriteFrameImage sSpriteImageTable_857FBE4[] =
|
||||
{
|
||||
{&gDecompressionBuffer[0], 0x800},
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate gUnknown_0857FBEC =
|
||||
{
|
||||
.tileTag = 65535,
|
||||
.paletteTag = 30020,
|
||||
.oam = &sOamData_857FBC8,
|
||||
.anims = sSpriteAnimTable_857FBE0,
|
||||
.images = sSpriteImageTable_857FBE4,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = SpriteCallbackDummy,
|
||||
};
|
||||
|
||||
static const union AffineAnimCmd sSpriteAffineAnim_857FC04[] =
|
||||
{
|
||||
AFFINEANIMCMD_FRAME(-1, -1, 253, 96),
|
||||
AFFINEANIMCMD_FRAME(0, 0, 0, 16),
|
||||
AFFINEANIMCMD_FRAME(-2, -2, 255, 64),
|
||||
AFFINEANIMCMD_FRAME(-8, 0, 0, 16),
|
||||
AFFINEANIMCMD_FRAME(0, -8, 0, 16),
|
||||
AFFINEANIMCMD_FRAME(256, 256, 0, 0),
|
||||
AFFINEANIMCMD_JUMP(0)
|
||||
};
|
||||
|
||||
static const union AffineAnimCmd sSpriteAffineAnim_857FC3C[] =
|
||||
{
|
||||
AFFINEANIMCMD_FRAME(-1, -1, 3, 96),
|
||||
AFFINEANIMCMD_FRAME(0, 0, 0, 16),
|
||||
AFFINEANIMCMD_FRAME(-2, -2, 1, 64),
|
||||
AFFINEANIMCMD_FRAME(-8, 0, 0, 16),
|
||||
AFFINEANIMCMD_FRAME(0, -8, 0, 16),
|
||||
AFFINEANIMCMD_FRAME(256, 256, 0, 0),
|
||||
AFFINEANIMCMD_JUMP(0)
|
||||
};
|
||||
|
||||
static const union AffineAnimCmd *const sSpriteAffineAnimTable_857FC74[] =
|
||||
{
|
||||
sSpriteAffineAnim_857FC04,
|
||||
sSpriteAffineAnim_857FC3C
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate gUnknown_0857FC7C =
|
||||
{
|
||||
.tileTag = 0xFFFF,
|
||||
.paletteTag = 0x7544,
|
||||
.oam = &sOamData_857FBD0,
|
||||
.anims = sSpriteAnimTable_857FBE0,
|
||||
.images = sSpriteImageTable_857FBE4,
|
||||
.affineAnims = sSpriteAffineAnimTable_857FC74,
|
||||
.callback = SpriteCallbackDummy,
|
||||
};
|
||||
|
||||
static const struct CompressedTilesPal gBerryPicTable[] =
|
||||
{
|
||||
{gBerryPic_Cheri, gBerryPalette_Cheri},
|
||||
{gBerryPic_Chesto, gBerryPalette_Chesto},
|
||||
{gBerryPic_Pecha, gBerryPalette_Pecha},
|
||||
{gBerryPic_Rawst, gBerryPalette_Rawst},
|
||||
{gBerryPic_Aspear, gBerryPalette_Aspear},
|
||||
{gBerryPic_Leppa, gBerryPalette_Leppa},
|
||||
{gBerryPic_Oran, gBerryPalette_Oran},
|
||||
{gBerryPic_Persim, gBerryPalette_Persim},
|
||||
{gBerryPic_Lum, gBerryPalette_Lum},
|
||||
{gBerryPic_Sitrus, gBerryPalette_Sitrus},
|
||||
{gBerryPic_Figy, gBerryPalette_Figy},
|
||||
{gBerryPic_Wiki, gBerryPalette_Wiki},
|
||||
{gBerryPic_Mago, gBerryPalette_Mago},
|
||||
{gBerryPic_Aguav, gBerryPalette_Aguav},
|
||||
{gBerryPic_Iapapa, gBerryPalette_Iapapa},
|
||||
{gBerryPic_Razz, gBerryPalette_Razz},
|
||||
{gBerryPic_Bluk, gBerryPalette_Bluk},
|
||||
{gBerryPic_Nanab, gBerryPalette_Nanab},
|
||||
{gBerryPic_Wepear, gBerryPalette_Wepear},
|
||||
{gBerryPic_Pinap, gBerryPalette_Pinap},
|
||||
{gBerryPic_Pomeg, gBerryPalette_Pomeg},
|
||||
{gBerryPic_Kelpsy, gBerryPalette_Kelpsy},
|
||||
{gBerryPic_Qualot, gBerryPalette_Qualot},
|
||||
{gBerryPic_Hondew, gBerryPalette_Hondew},
|
||||
{gBerryPic_Grepa, gBerryPalette_Grepa},
|
||||
{gBerryPic_Tamato, gBerryPalette_Tamato},
|
||||
{gBerryPic_Cornn, gBerryPalette_Cornn},
|
||||
{gBerryPic_Magost, gBerryPalette_Magost},
|
||||
{gBerryPic_Rabuta, gBerryPalette_Rabuta},
|
||||
{gBerryPic_Nomel, gBerryPalette_Nomel},
|
||||
{gBerryPic_Spelon, gBerryPalette_Spelon},
|
||||
{gBerryPic_Pamtre, gBerryPalette_Pamtre},
|
||||
{gBerryPic_Watmel, gBerryPalette_Watmel},
|
||||
{gBerryPic_Durin, gBerryPalette_Durin},
|
||||
{gBerryPic_Belue, gBerryPalette_Belue},
|
||||
{gBerryPic_Liechi, gBerryPalette_Liechi},
|
||||
{gBerryPic_Ganlon, gBerryPalette_Ganlon},
|
||||
{gBerryPic_Salac, gBerryPalette_Salac},
|
||||
{gBerryPic_Petaya, gBerryPalette_Petaya},
|
||||
{gBerryPic_Apicot, gBerryPalette_Apicot},
|
||||
{gBerryPic_Lansat, gBerryPalette_Lansat},
|
||||
{gBerryPic_Starf, gBerryPalette_Starf},
|
||||
{gBerryPic_Enigma, gBerryPalette_Enigma},
|
||||
};
|
||||
|
||||
const struct CompressedSpriteSheet gUnknown_0857FDEC =
|
||||
{
|
||||
gBerryCheckCircle_Gfx, 0x800, 10000
|
||||
};
|
||||
|
||||
const struct CompressedSpritePalette gUnknown_0857FDF4 =
|
||||
{
|
||||
gUnknown_08D9BEF0, 10000
|
||||
};
|
||||
|
||||
static const struct OamData sOamData_857FDFC =
|
||||
{
|
||||
.y = 0,
|
||||
.affineMode = 0,
|
||||
.objMode = 0,
|
||||
.mosaic = 0,
|
||||
.bpp = 0,
|
||||
.shape = 0,
|
||||
.x = 0,
|
||||
.matrixNum = 0,
|
||||
.size = 3,
|
||||
.tileNum = 0,
|
||||
.priority = 1,
|
||||
.paletteNum = 0,
|
||||
.affineParam = 0
|
||||
};
|
||||
|
||||
static const union AnimCmd sSpriteAnim_857FE04[] =
|
||||
{
|
||||
ANIMCMD_FRAME(0, 0),
|
||||
ANIMCMD_END
|
||||
};
|
||||
|
||||
static const union AnimCmd *const sSpriteAnimTable_857FE0C[] =
|
||||
{
|
||||
sSpriteAnim_857FE04
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate gUnknown_0857FE10 =
|
||||
{
|
||||
.tileTag = 10000,
|
||||
.paletteTag = 10000,
|
||||
.oam = &sOamData_857FDFC,
|
||||
.anims = sSpriteAnimTable_857FE0C,
|
||||
.images = NULL,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = SpriteCallbackDummy,
|
||||
};
|
||||
|
||||
const struct SpriteTemplate gUnknown_0857FE28 =
|
||||
{
|
||||
.tileTag = 0,
|
||||
.paletteTag = 0,
|
||||
.oam = &gDummyOamData,
|
||||
.anims = gDummySpriteAnimTable,
|
||||
.images = NULL,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = sub_80D5860,
|
||||
};
|
||||
|
||||
const struct SpriteTemplate gUnknown_0857FE40 =
|
||||
{
|
||||
.tileTag = 0,
|
||||
.paletteTag = 0,
|
||||
.oam = &gDummyOamData,
|
||||
.anims = gDummySpriteAnimTable,
|
||||
.images = NULL,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = sub_80D58F8,
|
||||
};
|
||||
|
||||
const struct SpriteTemplate gUnknown_0857FE58 =
|
||||
{
|
||||
.tileTag = 0,
|
||||
.paletteTag = 0,
|
||||
.oam = &gDummyOamData,
|
||||
.anims = gDummySpriteAnimTable,
|
||||
.images = NULL,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = sub_80D5968,
|
||||
};
|
||||
|
||||
const struct SpriteTemplate gUnknown_0857FE70 =
|
||||
{
|
||||
.tileTag = 0,
|
||||
.paletteTag = 0,
|
||||
.oam = &gDummyOamData,
|
||||
.anims = gDummySpriteAnimTable,
|
||||
.images = NULL,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = sub_80D5A94,
|
||||
};
|
||||
|
||||
const struct SpriteTemplate gUnknown_0857FE88 =
|
||||
{
|
||||
.tileTag = 0,
|
||||
.paletteTag = 0,
|
||||
.oam = &gDummyOamData,
|
||||
.anims = gDummySpriteAnimTable,
|
||||
.images = NULL,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = sub_80D5B48,
|
||||
};
|
||||
|
||||
// code
|
||||
void RemoveBagSprite(u8 id)
|
||||
{
|
||||
u8 *spriteId = &gUnknown_0203CE54->unk804[id];
|
||||
if (*spriteId != 0xFF)
|
||||
{
|
||||
FreeSpriteTilesByTag(id + 100);
|
||||
FreeSpritePaletteByTag(id + 100);
|
||||
FreeSpriteOamMatrix(&gSprites[*spriteId]);
|
||||
DestroySprite(&gSprites[*spriteId]);
|
||||
*spriteId = 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
void AddBagVisualSprite(u8 bagPocketId)
|
||||
{
|
||||
u8 *spriteId = &gUnknown_0203CE54->unk804[0];
|
||||
*spriteId = CreateSprite(&gUnknown_0857FB4C, 68, 66, 0);
|
||||
SetBagVisualPocketId(bagPocketId, FALSE);
|
||||
}
|
||||
|
||||
void SetBagVisualPocketId(u8 bagPocketId, bool8 isSwitchingPockets)
|
||||
{
|
||||
struct Sprite *sprite = &gSprites[gUnknown_0203CE54->unk804[0]];
|
||||
if (isSwitchingPockets)
|
||||
{
|
||||
sprite->pos2.y = -5;
|
||||
sprite->callback = SpriteCB_BagVisualSwitchingPockets;
|
||||
sprite->data[0] = bagPocketId + 1;
|
||||
StartSpriteAnim(sprite, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
StartSpriteAnim(sprite, bagPocketId + 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void SpriteCB_BagVisualSwitchingPockets(struct Sprite *sprite)
|
||||
{
|
||||
if (sprite->pos2.y != 0)
|
||||
{
|
||||
sprite->pos2.y++;
|
||||
}
|
||||
else
|
||||
{
|
||||
StartSpriteAnim(sprite, sprite->data[0]);
|
||||
sprite->callback = SpriteCallbackDummy;
|
||||
}
|
||||
}
|
||||
|
||||
void ShakeBagVisual(void)
|
||||
{
|
||||
struct Sprite *sprite = &gSprites[gUnknown_0203CE54->unk804[0]];
|
||||
if (sprite->affineAnimEnded)
|
||||
{
|
||||
StartSpriteAffineAnim(sprite, 1);
|
||||
sprite->callback = SpriteCB_ShakeBagVisual;
|
||||
}
|
||||
}
|
||||
|
||||
static void SpriteCB_ShakeBagVisual(struct Sprite *sprite)
|
||||
{
|
||||
if (sprite->affineAnimEnded)
|
||||
{
|
||||
StartSpriteAffineAnim(sprite, 0);
|
||||
sprite->callback = SpriteCallbackDummy;
|
||||
}
|
||||
}
|
||||
|
||||
void AddSwitchPocketRotatingBallSprite(s16 rotationDirection)
|
||||
{
|
||||
u8 *spriteId = &gUnknown_0203CE54->unk804[1];
|
||||
LoadSpriteSheet(&gUnknown_0857FBA0);
|
||||
LoadSpritePalette(&gUnknown_0857FBA8);
|
||||
*spriteId = CreateSprite(&gUnknown_0857FBB0, 16, 16, 0);
|
||||
gSprites[*spriteId].data[0] = rotationDirection;
|
||||
}
|
||||
|
||||
static void update_switch_pocket_rotating_ball_coords(struct Sprite *sprite)
|
||||
{
|
||||
sprite->centerToCornerVecX = sprite->data[1] - ((sprite->data[3] + 1) & 1);
|
||||
sprite->centerToCornerVecY = sprite->data[1] - ((sprite->data[3] + 1) & 1);
|
||||
}
|
||||
|
||||
static void SpriteCB_SwitchPocketRotatingBallInit(struct Sprite *sprite)
|
||||
{
|
||||
sprite->oam.affineMode = 1;
|
||||
if (sprite->data[0] == -1)
|
||||
sprite->affineAnims = sSpriteAffineAnimTable_857FB98;
|
||||
else
|
||||
sprite->affineAnims = sSpriteAffineAnimTable_857FB9C;
|
||||
|
||||
InitSpriteAffineAnim(sprite);
|
||||
sprite->data[1] = sprite->centerToCornerVecX;
|
||||
sprite->data[1] = sprite->centerToCornerVecY;
|
||||
update_switch_pocket_rotating_ball_coords(sprite);
|
||||
sprite->callback = SpriteCB_SwitchPocketRotatingBallContinue;
|
||||
}
|
||||
|
||||
static void SpriteCB_SwitchPocketRotatingBallContinue(struct Sprite *sprite)
|
||||
{
|
||||
sprite->data[3]++;
|
||||
update_switch_pocket_rotating_ball_coords(sprite);
|
||||
if (sprite->data[3] == 16)
|
||||
RemoveBagSprite(1);
|
||||
}
|
||||
|
||||
void AddBagItemIconSprite(u16 itemId, u8 id)
|
||||
{
|
||||
u8 *spriteId = &gUnknown_0203CE54->unk804[id + 2];
|
||||
if (*spriteId == 0xFF)
|
||||
{
|
||||
u8 iconSpriteId;
|
||||
|
||||
FreeSpriteTilesByTag(id + 102);
|
||||
FreeSpritePaletteByTag(id + 102);
|
||||
iconSpriteId = AddItemIconSprite(id + 102, id + 102, itemId);
|
||||
if (iconSpriteId != MAX_SPRITES)
|
||||
{
|
||||
*spriteId = iconSpriteId;
|
||||
gSprites[iconSpriteId].pos2.x = 24;
|
||||
gSprites[iconSpriteId].pos2.y = 88;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveBagItemIconSprite(u8 id)
|
||||
{
|
||||
RemoveBagSprite(id + 2);
|
||||
}
|
||||
|
||||
void sub_80D4FAC(void)
|
||||
{
|
||||
sub_8122344(&gUnknown_0203CE54->unk804[4], 8);
|
||||
}
|
||||
|
||||
void sub_80D4FC8(u8 arg0)
|
||||
{
|
||||
sub_81223FC(&gUnknown_0203CE54->unk804[4], 8, arg0);
|
||||
}
|
||||
|
||||
void sub_80D4FEC(u8 arg0)
|
||||
{
|
||||
sub_8122448(&gUnknown_0203CE54->unk804[4], 136, 120, (arg0 + 1) * 16);
|
||||
}
|
||||
|
||||
static void sub_80D5018(void *mem0, void *mem1)
|
||||
{
|
||||
u8 i, j;
|
||||
|
||||
memset(mem1, 0, 0x800);
|
||||
mem1 += 0x100;
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
mem1 += 0x20;
|
||||
for (j = 0; j < 6; j++)
|
||||
{
|
||||
memcpy(mem1, mem0, 0x20);
|
||||
mem1 += 0x20;
|
||||
mem0 += 0x20;
|
||||
}
|
||||
if (i != 5)
|
||||
mem1 += 0x20;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_80D5070(u8 berryId)
|
||||
{
|
||||
struct CompressedSpritePalette pal;
|
||||
|
||||
if (berryId == ITEM_TO_BERRY(ITEM_ENIGMA_BERRY) - 1 && IsEnigmaBerryValid())
|
||||
{
|
||||
// unknown empty if statement
|
||||
}
|
||||
|
||||
pal.data = gBerryPicTable[berryId].pal;
|
||||
pal.tag = 0x7544;
|
||||
LoadCompressedObjectPalette(&pal);
|
||||
LZDecompressWram(gBerryPicTable[berryId].tiles, &gDecompressionBuffer[0x1000]);
|
||||
sub_80D5018(&gDecompressionBuffer[0x1000], &gDecompressionBuffer[0]);
|
||||
}
|
||||
|
||||
u8 CreateBerryTagSprite(u8 id, s16 x, s16 y)
|
||||
{
|
||||
sub_80D5070(id);
|
||||
return CreateSprite(&gUnknown_0857FBEC, x, y, 0);
|
||||
}
|
||||
|
||||
void FreeBerryTagSpritePalette(void)
|
||||
{
|
||||
FreeSpritePaletteByTag(0x7544);
|
||||
}
|
||||
|
||||
u8 sub_80D511C(u8 berryId, u8 x, u8 y, bool8 startAffine)
|
||||
{
|
||||
u8 spriteId;
|
||||
|
||||
FreeSpritePaletteByTag(0x7544);
|
||||
sub_80D5070(berryId);
|
||||
spriteId = CreateSprite(&gUnknown_0857FC7C, x, y, 0);
|
||||
if (startAffine == TRUE)
|
||||
StartSpriteAffineAnim(&gSprites[spriteId], 1);
|
||||
|
||||
return spriteId;
|
||||
}
|
||||
|
||||
u8 CreateBerryFlavorCircleSprite(s16 x)
|
||||
{
|
||||
return CreateSprite(&gUnknown_0857FE10, x, 116, 0);
|
||||
}
|
||||
+3
-81
@@ -606,7 +606,6 @@ u8 sub_818E06C(void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NONMATCHING
|
||||
static u8 sub_818E13C(void)
|
||||
{
|
||||
u8 retval;
|
||||
@@ -627,9 +626,11 @@ static u8 sub_818E13C(void)
|
||||
len = sub_818E258(gUnknown_0203CD68->playerName);
|
||||
if (len == sub_818E258(gSaveBlock2Ptr->playerName))
|
||||
{
|
||||
u8 *name = gUnknown_0203CD68->playerName;
|
||||
for (i = 0; i < len; i ++)
|
||||
{
|
||||
if (gUnknown_0203CD68->playerName[i] != gSaveBlock2Ptr->playerName[i])
|
||||
name = gUnknown_0203CD68->playerName;
|
||||
if (name[i] != gSaveBlock2Ptr->playerName[i])
|
||||
{
|
||||
retval = 2;
|
||||
break;
|
||||
@@ -640,85 +641,6 @@ static u8 sub_818E13C(void)
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
#else
|
||||
ASM_DIRECT static u8 sub_818E13C(void)
|
||||
{
|
||||
asm_unified("\tpush {r4-r7,lr}\n"
|
||||
"\tmovs r7, 0x1\n"
|
||||
"\tldr r5, =gUnknown_0203CD68\n"
|
||||
"\tldr r0, =gSaveBlock1Ptr\n"
|
||||
"\tldr r1, [r0]\n"
|
||||
"\tldr r2, =0x00003b58\n"
|
||||
"\tadds r0, r1, r2\n"
|
||||
"\tstr r0, [r5]\n"
|
||||
"\tldrb r0, [r0, 0x18]\n"
|
||||
"\tcmp r0, 0xFF\n"
|
||||
"\tbne _0818E174\n"
|
||||
"\tldr r0, =gStringVar1\n"
|
||||
"\tldr r1, =gText_Lady2\n"
|
||||
"\tbl StringCopy7\n"
|
||||
"\tmovs r7, 0\n"
|
||||
"\tb _0818E1DC\n"
|
||||
"\t.pool\n"
|
||||
"_0818E174:\n"
|
||||
"\tldr r4, =gStringVar1\n"
|
||||
"\tldr r0, =0x00003b70\n"
|
||||
"\tadds r1, r0\n"
|
||||
"\tadds r0, r4, 0\n"
|
||||
"\tbl StringCopy7\n"
|
||||
"\tldr r0, [r5]\n"
|
||||
"\tadds r0, 0x2D\n"
|
||||
"\tldrb r1, [r0]\n"
|
||||
"\tadds r0, r4, 0\n"
|
||||
"\tbl ConvertInternationalString\n"
|
||||
"\tldr r0, [r5]\n"
|
||||
"\tadds r0, 0x18\n"
|
||||
"\tbl sub_818E258\n"
|
||||
"\tlsls r0, 24\n"
|
||||
"\tlsrs r4, r0, 24\n"
|
||||
"\tldr r6, =gSaveBlock2Ptr\n"
|
||||
"\tldr r0, [r6]\n"
|
||||
"\tbl sub_818E258\n"
|
||||
"\tlsls r0, 24\n"
|
||||
"\tlsrs r0, 24\n"
|
||||
"\tcmp r4, r0\n"
|
||||
"\tbne _0818E1DC\n"
|
||||
"\tldr r0, [r5]\n"
|
||||
"\tmovs r2, 0\n"
|
||||
"\tcmp r2, r4\n"
|
||||
"\tbcs _0818E1DC\n"
|
||||
"\tldr r1, [r6]\n"
|
||||
"\tldrb r0, [r0, 0x18]\n"
|
||||
"\tldrb r1, [r1]\n"
|
||||
"\tcmp r0, r1\n"
|
||||
"\tbne _0818E1DA\n"
|
||||
"_0818E1BA:\n"
|
||||
"\tadds r0, r2, 0x1\n"
|
||||
"\tlsls r0, 24\n"
|
||||
"\tlsrs r2, r0, 24\n"
|
||||
"\tcmp r2, r4\n"
|
||||
"\tbcs _0818E1DC\n"
|
||||
"\tldr r0, =gUnknown_0203CD68\n"
|
||||
"\tldr r1, [r0]\n"
|
||||
"\tadds r1, 0x18\n"
|
||||
"\tadds r1, r2\n"
|
||||
"\tldr r0, =gSaveBlock2Ptr\n"
|
||||
"\tldr r0, [r0]\n"
|
||||
"\tadds r0, r2\n"
|
||||
"\tldrb r1, [r1]\n"
|
||||
"\tldrb r0, [r0]\n"
|
||||
"\tcmp r1, r0\n"
|
||||
"\tbeq _0818E1BA\n"
|
||||
"_0818E1DA:\n"
|
||||
"\tmovs r7, 0x2\n"
|
||||
"_0818E1DC:\n"
|
||||
"\tadds r0, r7, 0\n"
|
||||
"\tpop {r4-r7}\n"
|
||||
"\tpop {r1}\n"
|
||||
"\tbx r1\n"
|
||||
"\t.pool");
|
||||
}
|
||||
#endif
|
||||
|
||||
static u8 sub_818E1F4(void)
|
||||
{
|
||||
|
||||
+633
@@ -0,0 +1,633 @@
|
||||
#include "global.h"
|
||||
#include "menu.h"
|
||||
#include "list_menu.h"
|
||||
#include "window.h"
|
||||
#include "text_window.h"
|
||||
#include "main.h"
|
||||
#include "task.h"
|
||||
#include "menu_indicators.h"
|
||||
#include "strings.h"
|
||||
#include "sound.h"
|
||||
#include "constants/songs.h"
|
||||
|
||||
struct UnknownMysteryGiftLinkMenuStruct
|
||||
{
|
||||
s32 field_0;
|
||||
u8 field_4;
|
||||
u8 field_5;
|
||||
u8 field_6;
|
||||
};
|
||||
|
||||
struct UnknownListMenuPals
|
||||
{
|
||||
u8 cursorPal:4;
|
||||
u8 fillValue:4;
|
||||
u8 cursorShadowPal:4;
|
||||
u8 lettersSpacing:6;
|
||||
u8 field_2_2:6; // unused
|
||||
u8 fontId:7;
|
||||
u8 field_3_7:1;
|
||||
};
|
||||
|
||||
extern struct UnknownMysteryGiftLinkMenuStruct gUnknown_0203CE84;
|
||||
|
||||
// this file's functions
|
||||
static u8 ListMenuInitInternal(struct ListMenuTemplate *listMenuTemplate, u16 scrollOffset, u16 selectedRow);
|
||||
static bool8 ListMenuChangeSelection(struct ListMenu *list, bool8 updateCursorAndCallCallback, u8 count, bool8 movingDown);
|
||||
static void ListMenuPrintEntries(struct ListMenu *list, u16 startIndex, u16 yOffset, u16 count);
|
||||
static void ListMenuDrawCursor(struct ListMenu *list);
|
||||
static void ListMenuCallSelectionChangedCallback(struct ListMenu *list, u8 a2);
|
||||
static u8 ListMenuAddCursorObject(struct ListMenu *list, u32 cursorKind);
|
||||
|
||||
// IWRAM common
|
||||
struct UnknownListMenuPals gUnknown_03006300;
|
||||
struct ListMenuTemplate gMultiuseListMenuTemplate;
|
||||
|
||||
// code
|
||||
static void ListMenuDummyTask(u8 taskId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
s32 DoMysteryGiftListMenu(struct WindowTemplate *windowTemplate, struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum)
|
||||
{
|
||||
switch (gUnknown_0203CE84.field_4)
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
gUnknown_0203CE84.field_5 = AddWindow(windowTemplate);
|
||||
switch (arg2)
|
||||
{
|
||||
case 2:
|
||||
sub_809882C(gUnknown_0203CE84.field_5, tileNum, palNum);
|
||||
case 1:
|
||||
sub_8098858(gUnknown_0203CE84.field_5, tileNum, palNum / 16);
|
||||
break;
|
||||
}
|
||||
gMultiuseListMenuTemplate = *listMenuTemplate;
|
||||
gMultiuseListMenuTemplate.windowId = gUnknown_0203CE84.field_5;
|
||||
gUnknown_0203CE84.field_6 = ListMenuInit(&gMultiuseListMenuTemplate, 0, 0);
|
||||
CopyWindowToVram(gUnknown_0203CE84.field_5, 1);
|
||||
gUnknown_0203CE84.field_4 = 1;
|
||||
break;
|
||||
case 1:
|
||||
gUnknown_0203CE84.field_0 = ListMenuHandleInputGetItemId(gUnknown_0203CE84.field_6);
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
gUnknown_0203CE84.field_4 = 2;
|
||||
}
|
||||
if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
gUnknown_0203CE84.field_0 = LIST_B_PRESSED;
|
||||
gUnknown_0203CE84.field_4 = 2;
|
||||
}
|
||||
if (gUnknown_0203CE84.field_4 == 2)
|
||||
{
|
||||
if (arg2 == 0)
|
||||
{
|
||||
ClearWindowTilemap(gUnknown_0203CE84.field_5);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (arg2)
|
||||
{
|
||||
case 0: // can never be reached, because of the if statement above
|
||||
sub_819746C(gUnknown_0203CE84.field_5, FALSE);
|
||||
break;
|
||||
case 2:
|
||||
case 1:
|
||||
sub_819746C(gUnknown_0203CE84.field_5, FALSE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CopyWindowToVram(gUnknown_0203CE84.field_5, 1);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
DestroyListMenuTask(gUnknown_0203CE84.field_6, NULL, NULL);
|
||||
RemoveWindow(gUnknown_0203CE84.field_5);
|
||||
gUnknown_0203CE84.field_4 = 0;
|
||||
return gUnknown_0203CE84.field_0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
u8 ListMenuInit(struct ListMenuTemplate *listMenuTemplate, u16 scrollOffset, u16 selectedRow)
|
||||
{
|
||||
u8 taskId = ListMenuInitInternal(listMenuTemplate, scrollOffset, selectedRow);
|
||||
PutWindowTilemap(listMenuTemplate->windowId);
|
||||
CopyWindowToVram(listMenuTemplate->windowId, 2);
|
||||
|
||||
return taskId;
|
||||
}
|
||||
|
||||
// unused
|
||||
u8 ListMenuInitWithWindows(struct ListMenuTemplate *listMenuTemplate, struct UnknownListMenuWindowStruct *arg1, u16 scrollOffset, u16 selectedRow)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
u8 taskId = ListMenuInitInternal(listMenuTemplate, scrollOffset, selectedRow);
|
||||
for (i = 0; arg1[i].palNum != 0xFF; i++)
|
||||
{
|
||||
PutWindowRectTilemapOverridePalette(listMenuTemplate->windowId,
|
||||
arg1[i].x,
|
||||
arg1[i].y,
|
||||
arg1[i].width,
|
||||
arg1[i].height,
|
||||
arg1[i].palNum);
|
||||
}
|
||||
CopyWindowToVram(listMenuTemplate->windowId, 2);
|
||||
|
||||
return taskId;
|
||||
}
|
||||
|
||||
s32 ListMenuHandleInputGetItemId(u8 listTaskId)
|
||||
{
|
||||
struct ListMenu *list = (void*) gTasks[listTaskId].data;
|
||||
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
return list->template.items[list->scrollOffset + list->selectedRow].id;
|
||||
}
|
||||
else if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
return LIST_B_PRESSED;
|
||||
}
|
||||
else if (gMain.newAndRepeatedKeys & DPAD_UP)
|
||||
{
|
||||
ListMenuChangeSelection(list, TRUE, 1, FALSE);
|
||||
return LIST_NOTHING_CHOSEN;
|
||||
}
|
||||
else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
|
||||
{
|
||||
ListMenuChangeSelection(list, TRUE, 1, TRUE);
|
||||
return LIST_NOTHING_CHOSEN;
|
||||
}
|
||||
else // try to move by one window scroll
|
||||
{
|
||||
bool16 rightButton, leftButton;
|
||||
switch (list->template.scrollMultiple)
|
||||
{
|
||||
case LIST_NO_MULTIPLE_SCROLL:
|
||||
default:
|
||||
leftButton = FALSE;
|
||||
rightButton = FALSE;
|
||||
break;
|
||||
case LIST_MULTIPLE_SCROLL_DPAD:
|
||||
leftButton = gMain.newAndRepeatedKeys & DPAD_LEFT;
|
||||
rightButton = gMain.newAndRepeatedKeys & DPAD_RIGHT;
|
||||
break;
|
||||
case LIST_MULTIPLE_SCROLL_L_R:
|
||||
leftButton = gMain.newAndRepeatedKeys & L_BUTTON;
|
||||
rightButton = gMain.newAndRepeatedKeys & R_BUTTON;
|
||||
break;
|
||||
}
|
||||
|
||||
if (leftButton)
|
||||
{
|
||||
ListMenuChangeSelection(list, TRUE, list->template.maxShowed, FALSE);
|
||||
return LIST_NOTHING_CHOSEN;
|
||||
}
|
||||
else if (rightButton)
|
||||
{
|
||||
ListMenuChangeSelection(list, TRUE, list->template.maxShowed, TRUE);
|
||||
return LIST_NOTHING_CHOSEN;
|
||||
}
|
||||
else
|
||||
{
|
||||
return LIST_NOTHING_CHOSEN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DestroyListMenuTask(u8 listTaskId, u16 *scrollOffset, u16 *selectedRow)
|
||||
{
|
||||
struct ListMenu *list = (void*) gTasks[listTaskId].data;
|
||||
|
||||
if (scrollOffset != NULL)
|
||||
*scrollOffset = list->scrollOffset;
|
||||
if (selectedRow != NULL)
|
||||
*selectedRow = list->selectedRow;
|
||||
|
||||
if (list->unk_1E != 0xFF)
|
||||
ListMenuRemoveCursorObject(list->unk_1E, list->template.cursorKind - 2);
|
||||
|
||||
DestroyTask(listTaskId);
|
||||
}
|
||||
|
||||
void sub_81AE70C(u8 listTaskId)
|
||||
{
|
||||
struct ListMenu *list = (void*) gTasks[listTaskId].data;
|
||||
|
||||
FillWindowPixelBuffer(list->template.windowId, (list->template.fillValue << 4) | (list->template.fillValue));
|
||||
ListMenuPrintEntries(list, list->scrollOffset, 0, list->template.maxShowed);
|
||||
ListMenuDrawCursor(list);
|
||||
CopyWindowToVram(list->template.windowId, 2);
|
||||
}
|
||||
|
||||
// unused
|
||||
void ChangeListMenuPals(u8 listTaskId, u8 cursorPal, u8 fillValue, u8 cursorShadowPal)
|
||||
{
|
||||
struct ListMenu *list = (void*) gTasks[listTaskId].data;
|
||||
|
||||
list->template.cursorPal = cursorPal;
|
||||
list->template.fillValue = fillValue;
|
||||
list->template.cursorShadowPal = cursorShadowPal;
|
||||
}
|
||||
|
||||
// unused
|
||||
void ChangeListMenuCoords(u8 listTaskId, u8 x, u8 y)
|
||||
{
|
||||
struct ListMenu *list = (void*) gTasks[listTaskId].data;
|
||||
|
||||
SetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_LEFT, x);
|
||||
SetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_TOP, y);
|
||||
}
|
||||
|
||||
// unused
|
||||
s32 ListMenuTestInput(struct ListMenuTemplate *template, u32 scrollOffset, u32 selectedRow, u16 keys, u16 *newScrollOffset, u16 *newSelectedRow)
|
||||
{
|
||||
struct ListMenu list;
|
||||
|
||||
list.template = *template;
|
||||
list.scrollOffset = scrollOffset;
|
||||
list.selectedRow = selectedRow;
|
||||
list.unk_1C = 0;
|
||||
list.unk_1D = 0;
|
||||
|
||||
if (keys == DPAD_UP)
|
||||
ListMenuChangeSelection(&list, FALSE, 1, FALSE);
|
||||
if (keys == DPAD_DOWN)
|
||||
ListMenuChangeSelection(&list, FALSE, 1, TRUE);
|
||||
|
||||
if (newScrollOffset != NULL)
|
||||
*newScrollOffset = list.scrollOffset;
|
||||
if (newSelectedRow != NULL)
|
||||
*newSelectedRow = list.selectedRow;
|
||||
|
||||
return LIST_NOTHING_CHOSEN;
|
||||
}
|
||||
|
||||
void ListMenuGetCurrentItemArrayId(u8 listTaskId, u16 *arrayId)
|
||||
{
|
||||
struct ListMenu *list = (void*) gTasks[listTaskId].data;
|
||||
|
||||
if (arrayId != NULL)
|
||||
*arrayId = list->scrollOffset + list->selectedRow;
|
||||
}
|
||||
|
||||
void ListMenuGetScrollAndRow(u8 listTaskId, u16 *scrollOffset, u16 *selectedRow)
|
||||
{
|
||||
struct ListMenu *list = (void*) gTasks[listTaskId].data;
|
||||
|
||||
if (scrollOffset != NULL)
|
||||
*scrollOffset = list->scrollOffset;
|
||||
if (selectedRow != NULL)
|
||||
*selectedRow = list->selectedRow;
|
||||
}
|
||||
|
||||
u16 ListMenuGetYCoordForPrintingArrowCursor(u8 listTaskId)
|
||||
{
|
||||
struct ListMenu *list = (void*) gTasks[listTaskId].data;
|
||||
u8 yMultiplier = GetFontAttribute(list->template.fontId, 1) + list->template.unk_16_3;
|
||||
|
||||
return list->selectedRow * yMultiplier + list->template.upText_Y;
|
||||
}
|
||||
|
||||
static u8 ListMenuInitInternal(struct ListMenuTemplate *listMenuTemplate, u16 scrollOffset, u16 selectedRow)
|
||||
{
|
||||
u8 listTaskId = CreateTask(ListMenuDummyTask, 0);
|
||||
struct ListMenu *list = (void*) gTasks[listTaskId].data;
|
||||
|
||||
list->template = *listMenuTemplate;
|
||||
list->scrollOffset = scrollOffset;
|
||||
list->selectedRow = selectedRow;
|
||||
list->unk_1C = 0;
|
||||
list->unk_1D = 0;
|
||||
list->unk_1E = 0xFF;
|
||||
list->unk_1F = 0;
|
||||
|
||||
gUnknown_03006300.cursorPal = list->template.cursorPal;
|
||||
gUnknown_03006300.fillValue = list->template.fillValue;
|
||||
gUnknown_03006300.cursorShadowPal = list->template.cursorShadowPal;
|
||||
gUnknown_03006300.lettersSpacing = list->template.lettersSpacing;
|
||||
gUnknown_03006300.fontId = list->template.fontId;
|
||||
gUnknown_03006300.field_3_7 = 0;
|
||||
|
||||
if (list->template.totalItems < list->template.maxShowed)
|
||||
list->template.maxShowed = list->template.totalItems;
|
||||
|
||||
FillWindowPixelBuffer(list->template.windowId, (list->template.fillValue << 4) | (list->template.fillValue));
|
||||
ListMenuPrintEntries(list, list->scrollOffset, 0, list->template.maxShowed);
|
||||
ListMenuDrawCursor(list);
|
||||
ListMenuCallSelectionChangedCallback(list, 1);
|
||||
|
||||
return listTaskId;
|
||||
}
|
||||
|
||||
static void ListMenuPrint(struct ListMenu *list, const u8 *str, u8 x, u8 y)
|
||||
{
|
||||
u8 colors[3];
|
||||
if (gUnknown_03006300.field_3_7)
|
||||
{
|
||||
colors[0] = gUnknown_03006300.fillValue;
|
||||
colors[1] = gUnknown_03006300.cursorPal;
|
||||
colors[2] = gUnknown_03006300.cursorShadowPal;
|
||||
AddTextPrinterParameterized2(list->template.windowId,
|
||||
gUnknown_03006300.fontId,
|
||||
x, y,
|
||||
gUnknown_03006300.lettersSpacing,
|
||||
0, colors, TEXT_SPEED_FF, str);
|
||||
|
||||
gUnknown_03006300.field_3_7 = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
colors[0] = list->template.fillValue;
|
||||
colors[1] = list->template.cursorPal;
|
||||
colors[2] = list->template.cursorShadowPal;
|
||||
AddTextPrinterParameterized2(list->template.windowId,
|
||||
list->template.fontId,
|
||||
x, y,
|
||||
list->template.lettersSpacing,
|
||||
0, colors, TEXT_SPEED_FF, str);
|
||||
}
|
||||
}
|
||||
|
||||
static void ListMenuPrintEntries(struct ListMenu *list, u16 startIndex, u16 yOffset, u16 count)
|
||||
{
|
||||
s32 i;
|
||||
u8 x, y;
|
||||
u8 yMultiplier = GetFontAttribute(list->template.fontId, 1) + list->template.unk_16_3;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (list->template.items[startIndex].id != -3)
|
||||
x = list->template.unk_12;
|
||||
else
|
||||
x = list->template.unk_11;
|
||||
|
||||
y = (yOffset + i) * yMultiplier + list->template.upText_Y;
|
||||
if (list->template.unk_08 != NULL)
|
||||
list->template.unk_08(list->template.windowId, list->template.items[startIndex].id, y);
|
||||
|
||||
ListMenuPrint(list, list->template.items[startIndex].name, x, y);
|
||||
startIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
static void ListMenuDrawCursor(struct ListMenu *list)
|
||||
{
|
||||
u8 yMultiplier = GetFontAttribute(list->template.fontId, 1) + list->template.unk_16_3;
|
||||
u8 x = list->template.cursor_X;
|
||||
u8 y = list->selectedRow * yMultiplier + list->template.upText_Y;
|
||||
switch (list->template.cursorKind)
|
||||
{
|
||||
case 0:
|
||||
ListMenuPrint(list, gText_SelectorArrow2, x, y);
|
||||
break;
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
if (list->unk_1E == 0xFF)
|
||||
list->unk_1E = ListMenuAddCursorObject(list, 0);
|
||||
ListMenuUpdateCursorObject(list->unk_1E,
|
||||
GetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_LEFT) * 8 - 1,
|
||||
GetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_TOP) * 8 + y - 1, 0);
|
||||
break;
|
||||
case 3:
|
||||
if (list->unk_1E == 0xFF)
|
||||
list->unk_1E = ListMenuAddCursorObject(list, 1);
|
||||
ListMenuUpdateCursorObject(list->unk_1E,
|
||||
GetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_LEFT) * 8 + x,
|
||||
GetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_TOP) * 8 + y, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static u8 ListMenuAddCursorObject(struct ListMenu *list, u32 cursorKind)
|
||||
{
|
||||
struct CursorStruct cursor;
|
||||
|
||||
cursor.unk0 = 0;
|
||||
cursor.unk1 = 0xA0;
|
||||
cursor.unk2 = GetWindowAttribute(list->template.windowId, WINDOW_WIDTH) * 8 + 2;
|
||||
cursor.unk4 = GetFontAttribute(list->template.fontId, 1) + 2;
|
||||
cursor.unk6 = 0x4000;
|
||||
cursor.unk8 = 0xFFFF;
|
||||
cursor.unkA = 0xF;
|
||||
|
||||
return ListMenuAddCursorObjectInternal(&cursor, cursorKind);
|
||||
}
|
||||
|
||||
static void ListMenuErasePrintedCursor(struct ListMenu *list, u16 selectedRow)
|
||||
{
|
||||
u8 cursorKind = list->template.cursorKind;
|
||||
if (cursorKind == 0)
|
||||
{
|
||||
u8 yMultiplier = GetFontAttribute(list->template.fontId, 1) + list->template.unk_16_3;
|
||||
u8 width = GetMenuCursorDimensionByFont(list->template.fontId, 0);
|
||||
u8 height = GetMenuCursorDimensionByFont(list->template.fontId, 1);
|
||||
FillWindowPixelRect(list->template.windowId,
|
||||
(list->template.fillValue << 4) | (list->template.fillValue),
|
||||
list->template.cursor_X,
|
||||
selectedRow * yMultiplier + list->template.upText_Y,
|
||||
width,
|
||||
height);
|
||||
}
|
||||
}
|
||||
|
||||
static u8 ListMenuUpdateSelectedRowIndexAndScrollOffset(struct ListMenu *list, bool8 movingDown)
|
||||
{
|
||||
u16 selectedRow = list->selectedRow;
|
||||
u16 scrollOffset = list->scrollOffset;
|
||||
u16 newRow;
|
||||
u32 newScroll;
|
||||
|
||||
if (!movingDown)
|
||||
{
|
||||
if (list->template.maxShowed == 1)
|
||||
newRow = 0;
|
||||
else
|
||||
newRow = list->template.maxShowed - ((list->template.maxShowed / 2) + (list->template.maxShowed % 2)) - 1;
|
||||
|
||||
if (scrollOffset == 0)
|
||||
{
|
||||
while (selectedRow != 0)
|
||||
{
|
||||
selectedRow--;
|
||||
if (list->template.items[scrollOffset + selectedRow].id != -3)
|
||||
{
|
||||
list->selectedRow = selectedRow;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (selectedRow > newRow)
|
||||
{
|
||||
selectedRow--;
|
||||
if (list->template.items[scrollOffset + selectedRow].id != -3)
|
||||
{
|
||||
list->selectedRow = selectedRow;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
newScroll = scrollOffset - 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (list->template.maxShowed == 1)
|
||||
newRow = 0;
|
||||
else
|
||||
newRow = ((list->template.maxShowed / 2) + (list->template.maxShowed % 2));
|
||||
|
||||
if (scrollOffset == list->template.totalItems - list->template.maxShowed)
|
||||
{
|
||||
while (selectedRow < list->template.maxShowed - 1)
|
||||
{
|
||||
selectedRow++;
|
||||
if (list->template.items[scrollOffset + selectedRow].id != -3)
|
||||
{
|
||||
list->selectedRow = selectedRow;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (selectedRow < newRow)
|
||||
{
|
||||
selectedRow++;
|
||||
if (list->template.items[scrollOffset + selectedRow].id != -3)
|
||||
{
|
||||
list->selectedRow = selectedRow;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
newScroll = scrollOffset + 1;
|
||||
}
|
||||
}
|
||||
|
||||
list->selectedRow = newRow;
|
||||
list->scrollOffset = newScroll;
|
||||
return 2;
|
||||
}
|
||||
|
||||
static void ListMenuScroll(struct ListMenu *list, u8 count, bool8 movingDown)
|
||||
{
|
||||
if (count >= list->template.maxShowed)
|
||||
{
|
||||
FillWindowPixelBuffer(list->template.windowId, (list->template.fillValue << 4) | (list->template.fillValue));
|
||||
ListMenuPrintEntries(list, list->scrollOffset, 0, list->template.maxShowed);
|
||||
}
|
||||
else
|
||||
{
|
||||
u8 yMultiplier = GetFontAttribute(list->template.fontId, 1) + list->template.unk_16_3;
|
||||
|
||||
if (!movingDown)
|
||||
{
|
||||
u16 y, width, height;
|
||||
|
||||
ScrollWindow(list->template.windowId, 1, count * yMultiplier, (list->template.fillValue << 4) | (list->template.fillValue));
|
||||
ListMenuPrintEntries(list, list->scrollOffset, 0, count);
|
||||
|
||||
y = (list->template.maxShowed * yMultiplier) + list->template.upText_Y;
|
||||
width = GetWindowAttribute(list->template.windowId, WINDOW_WIDTH) * 8;
|
||||
height = (GetWindowAttribute(list->template.windowId, WINDOW_HEIGHT) * 8) - y;
|
||||
FillWindowPixelRect(list->template.windowId,
|
||||
(list->template.fillValue << 4) | (list->template.fillValue),
|
||||
0, y, width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
u16 width;
|
||||
|
||||
ScrollWindow(list->template.windowId, 0, count * yMultiplier, (list->template.fillValue << 4) | (list->template.fillValue));
|
||||
ListMenuPrintEntries(list, list->scrollOffset + (list->template.maxShowed - count), list->template.maxShowed - count, count);
|
||||
|
||||
width = GetWindowAttribute(list->template.windowId, WINDOW_WIDTH) * 8;
|
||||
FillWindowPixelRect(list->template.windowId,
|
||||
(list->template.fillValue << 4) | (list->template.fillValue),
|
||||
0, 0, width, list->template.upText_Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool8 ListMenuChangeSelection(struct ListMenu *list, bool8 updateCursorAndCallCallback, u8 count, bool8 movingDown)
|
||||
{
|
||||
u16 oldSelectedRow;
|
||||
u8 selectionChange, i, cursorCount;
|
||||
|
||||
oldSelectedRow = list->selectedRow;
|
||||
cursorCount = 0;
|
||||
selectionChange = 0;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
do
|
||||
{
|
||||
u8 ret = ListMenuUpdateSelectedRowIndexAndScrollOffset(list, movingDown);
|
||||
selectionChange |= ret;
|
||||
if (ret != 2)
|
||||
break;
|
||||
cursorCount++;
|
||||
} while (list->template.items[list->scrollOffset + list->selectedRow].id == -3);
|
||||
}
|
||||
|
||||
if (updateCursorAndCallCallback)
|
||||
{
|
||||
switch (selectionChange)
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
return TRUE;
|
||||
case 1:
|
||||
ListMenuErasePrintedCursor(list, oldSelectedRow);
|
||||
ListMenuDrawCursor(list);
|
||||
ListMenuCallSelectionChangedCallback(list, 0);
|
||||
CopyWindowToVram(list->template.windowId, 2);
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
ListMenuErasePrintedCursor(list, oldSelectedRow);
|
||||
ListMenuScroll(list, cursorCount, movingDown);
|
||||
ListMenuDrawCursor(list);
|
||||
ListMenuCallSelectionChangedCallback(list, 0);
|
||||
CopyWindowToVram(list->template.windowId, 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void ListMenuCallSelectionChangedCallback(struct ListMenu *list, u8 a2)
|
||||
{
|
||||
if (list->template.moveCursorFunc != NULL)
|
||||
list->template.moveCursorFunc(list->template.items[list->scrollOffset + list->selectedRow].id, a2, list);
|
||||
}
|
||||
|
||||
// unused
|
||||
void sub_81AF028(u8 cursorPal, u8 fillValue, u8 cursorShadowPal)
|
||||
{
|
||||
gUnknown_03006300.cursorPal = cursorPal;
|
||||
gUnknown_03006300.fillValue = fillValue;
|
||||
gUnknown_03006300.cursorShadowPal = cursorShadowPal;
|
||||
gUnknown_03006300.field_3_7 = 1;
|
||||
}
|
||||
|
||||
void sub_81AF078(s32 arg0, u8 arg1, struct ListMenu *list)
|
||||
{
|
||||
if (!arg1)
|
||||
PlaySE(SE_SELECT);
|
||||
}
|
||||
+1
-1
@@ -166,7 +166,7 @@ static void InitMainCallbacks(void)
|
||||
gUnknown_0203CF5C = NULL;
|
||||
gMain.vblankCounter2 = 0;
|
||||
gMain.callback1 = NULL;
|
||||
SetMainCallback2(c2_copyright_1);
|
||||
SetMainCallback2(CB2_InitCopyrightScreenAfterBootup);
|
||||
gSaveBlock2Ptr = &gSaveblock2;
|
||||
gPokemonStoragePtr = &gPokemonStorage;
|
||||
}
|
||||
|
||||
+1275
File diff suppressed because it is too large
Load Diff
+51
-49
@@ -25,11 +25,11 @@
|
||||
#define STD_WINDOW_PALETTE_NUM 14
|
||||
#define STD_WINDOW_BASE_TILE_NUM 0x214
|
||||
|
||||
struct SomeUnkStruct_60F0D4
|
||||
struct MoveMenuInfoIcon
|
||||
{
|
||||
u8 unk1;
|
||||
u8 unk2;
|
||||
u16 unk3;
|
||||
u8 width;
|
||||
u8 height;
|
||||
u16 offset;
|
||||
};
|
||||
|
||||
struct Menu
|
||||
@@ -48,7 +48,7 @@ struct Menu
|
||||
bool8 APressMuted;
|
||||
};
|
||||
|
||||
static EWRAM_DATA u8 gUnknown_0203CD8C = 0;
|
||||
static EWRAM_DATA u8 gStartMenuWindowId = 0;
|
||||
static EWRAM_DATA u8 gUnknown_0203CD8D = 0;
|
||||
static EWRAM_DATA struct Menu gUnknown_0203CD90 = {0};
|
||||
static EWRAM_DATA u16 gUnknown_0203CD9C = 0;
|
||||
@@ -76,34 +76,36 @@ static const struct WindowTemplate gUnknown_0860F0A8 =
|
||||
|
||||
const u16 gUnknown_0860F0B0[] = INCBIN_U16("graphics/interface/860F0B0.gbapal");
|
||||
const u8 gUnknown_0860F0D0[] = { 15, 1, 2 };
|
||||
const struct SomeUnkStruct_60F0D4 gUnknown_0860F0D4[] =
|
||||
{
|
||||
{ 12, 12, 0x00 },
|
||||
{ 32, 12, 0x20 },
|
||||
{ 32, 12, 0x64 },
|
||||
{ 32, 12, 0x60 },
|
||||
{ 32, 12, 0x80 },
|
||||
{ 32, 12, 0x48 },
|
||||
{ 32, 12, 0x44 },
|
||||
{ 32, 12, 0x6C },
|
||||
{ 32, 12, 0x68 },
|
||||
{ 32, 12, 0x88 },
|
||||
{ 32, 12, 0xA4 },
|
||||
{ 32, 12, 0x24 },
|
||||
{ 32, 12, 0x28 },
|
||||
{ 32, 12, 0x2C },
|
||||
{ 32, 12, 0x40 },
|
||||
{ 32, 12, 0x84 },
|
||||
{ 32, 12, 0x4C },
|
||||
{ 32, 12, 0xA0 },
|
||||
{ 32, 12, 0x8C },
|
||||
{ 42, 12, 0xA8 },
|
||||
{ 42, 12, 0xC0 },
|
||||
{ 42, 12, 0xC8 },
|
||||
{ 42, 12, 0xE0 },
|
||||
{ 42, 12, 0xE8 },
|
||||
{ 8, 8, 0xAE },
|
||||
{ 8, 8, 0xAF },
|
||||
|
||||
// Table of move info icon offsets in graphics/interface_fr/menu.png
|
||||
const struct MoveMenuInfoIcon gMoveMenuInfoIcons[] =
|
||||
{ // { width, height, offset }
|
||||
{ 12, 12, 0x00 }, // Unused
|
||||
{ 32, 12, 0x20 }, // Normal icon
|
||||
{ 32, 12, 0x64 }, // Fight icon
|
||||
{ 32, 12, 0x60 }, // Flying icon
|
||||
{ 32, 12, 0x80 }, // Poison icon
|
||||
{ 32, 12, 0x48 }, // Ground icon
|
||||
{ 32, 12, 0x44 }, // Rock icon
|
||||
{ 32, 12, 0x6C }, // Bug icon
|
||||
{ 32, 12, 0x68 }, // Ghost icon
|
||||
{ 32, 12, 0x88 }, // Steel icon
|
||||
{ 32, 12, 0xA4 }, // ??? (Mystery) icon
|
||||
{ 32, 12, 0x24 }, // Fire icon
|
||||
{ 32, 12, 0x28 }, // Water icon
|
||||
{ 32, 12, 0x2C }, // Grass icon
|
||||
{ 32, 12, 0x40 }, // Electric icon
|
||||
{ 32, 12, 0x84 }, // Psychic icon
|
||||
{ 32, 12, 0x4C }, // Ice icon
|
||||
{ 32, 12, 0xA0 }, // Dragon icon
|
||||
{ 32, 12, 0x8C }, // Dark icon
|
||||
{ 42, 12, 0xA8 }, // -Type- icon
|
||||
{ 42, 12, 0xC0 }, // -Power- icon
|
||||
{ 42, 12, 0xC8 }, // -Accuracy- icon
|
||||
{ 42, 12, 0xE0 }, // -PP- icon
|
||||
{ 42, 12, 0xE8 }, // -Effect- icon
|
||||
{ 8, 8, 0xAE }, // Unused (Small white pokeball)
|
||||
{ 8, 8, 0xAF }, // Unused (Small dark pokeball)
|
||||
};
|
||||
|
||||
// Forward declarations
|
||||
@@ -125,7 +127,7 @@ extern void task_free_buf_after_copying_tile_data_to_vram(u8 taskId);
|
||||
void sub_81971D0(void)
|
||||
{
|
||||
InitWindows(gUnknown_0860F098);
|
||||
gUnknown_0203CD8C = 0xFF;
|
||||
gStartMenuWindowId = 0xFF;
|
||||
gUnknown_0203CD8D = 0xFF;
|
||||
}
|
||||
|
||||
@@ -471,22 +473,22 @@ u8 GetPlayerTextSpeed(void)
|
||||
|
||||
u8 sub_81979C4(u8 a1)
|
||||
{
|
||||
if (gUnknown_0203CD8C == 0xFF)
|
||||
gUnknown_0203CD8C = sub_8198AA4(0, 0x16, 1, 7, (a1 * 2) + 2, 0xF, 0x139);
|
||||
return gUnknown_0203CD8C;
|
||||
if (gStartMenuWindowId == 0xFF)
|
||||
gStartMenuWindowId = sub_8198AA4(0, 0x16, 1, 7, (a1 * 2) + 2, 0xF, 0x139);
|
||||
return gStartMenuWindowId;
|
||||
}
|
||||
|
||||
u8 GetStartMenuWindowId(void)
|
||||
{
|
||||
return gUnknown_0203CD8C;
|
||||
return gStartMenuWindowId;
|
||||
}
|
||||
|
||||
void remove_start_menu_window_maybe(void)
|
||||
void RemoveStartMenuWindow(void)
|
||||
{
|
||||
if (gUnknown_0203CD8C != 0xFF)
|
||||
if (gStartMenuWindowId != 0xFF)
|
||||
{
|
||||
RemoveWindow(gUnknown_0203CD8C);
|
||||
gUnknown_0203CD8C = 0xFF;
|
||||
RemoveWindow(gStartMenuWindowId);
|
||||
gStartMenuWindowId = 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1988,7 +1990,7 @@ void sub_8199F74(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 spee
|
||||
AddTextPrinter(&printer, speed, callback);
|
||||
}
|
||||
|
||||
void sub_819A024(u8 windowId, const u8 *src, u16 a2, u16 a3)
|
||||
void PrintPlayerNameOnWindow(u8 windowId, const u8 *src, u16 x, u16 y)
|
||||
{
|
||||
int count = 0;
|
||||
while (gSaveBlock2Ptr->playerName[count] != EOS)
|
||||
@@ -1996,7 +1998,7 @@ void sub_819A024(u8 windowId, const u8 *src, u16 a2, u16 a3)
|
||||
|
||||
StringExpandPlaceholders(gStringVar4, src);
|
||||
|
||||
PrintTextOnWindow(windowId, 1, gStringVar4, a2, a3, 0xFF, 0);
|
||||
PrintTextOnWindow(windowId, 1, gStringVar4, x, y, 0xFF, 0);
|
||||
}
|
||||
|
||||
//Screw this function, it's long and unreferenced and ugh
|
||||
@@ -2364,22 +2366,22 @@ void sub_819A2BC(u8 palOffset, u8 palId)
|
||||
|
||||
void blit_move_info_icon(u8 windowId, u8 iconId, u16 x, u16 y)
|
||||
{
|
||||
BlitBitmapRectToWindow(windowId, gFireRedMenuElements_Gfx + gUnknown_0860F0D4[iconId].unk3 * 32, 0, 0, 128, 128, x, y, gUnknown_0860F0D4[iconId].unk1, gUnknown_0860F0D4[iconId].unk2);
|
||||
BlitBitmapRectToWindow(windowId, gFireRedMenuElements_Gfx + gMoveMenuInfoIcons[iconId].offset * 32, 0, 0, 128, 128, x, y, gMoveMenuInfoIcons[iconId].width, gMoveMenuInfoIcons[iconId].height);
|
||||
}
|
||||
|
||||
void sub_819A344(u8 a0, u8 *a1, u8 a2)
|
||||
void sub_819A344(u8 a0, u8 *dest, u8 color)
|
||||
{
|
||||
s32 curFlag;
|
||||
s32 flagCount;
|
||||
u8 *endOfString;
|
||||
u8 *string = a1;
|
||||
u8 *string = dest;
|
||||
|
||||
*(string++) = EXT_CTRL_CODE_BEGIN;
|
||||
*(string++) = EXT_CTRL_CODE_COLOR;
|
||||
*(string++) = a2;
|
||||
*(string++) = color;
|
||||
*(string++) = EXT_CTRL_CODE_BEGIN;
|
||||
*(string++) = EXT_CTRL_CODE_SHADOW;
|
||||
*(string++) = a2 + 1;
|
||||
*(string++) = color + 1;
|
||||
|
||||
switch (a0)
|
||||
{
|
||||
|
||||
@@ -241,7 +241,7 @@ static void CB2_MysteryEventMenu(void)
|
||||
u16 unkVal = RunMysteryEventScript(gDecompressionBuffer);
|
||||
CpuFill32(0, gDecompressionBuffer, 0x7D4);
|
||||
if (!GetEventLoadMessage(gStringVar4, unkVal))
|
||||
TrySavingData(NORMAL_SAVE);
|
||||
TrySavingData(SAVE_NORMAL);
|
||||
gMain.state++;
|
||||
}
|
||||
break;
|
||||
|
||||
+2
-2
@@ -161,7 +161,7 @@ extern void FieldEffectActiveListClear(void);
|
||||
extern void SetUpFieldTasks(void);
|
||||
extern void sub_81BE6B8(void);
|
||||
extern void sub_80AAFA4(void);
|
||||
extern void sub_809FA9C(void);
|
||||
extern void ShowStartMenu(void);
|
||||
extern void sub_80AEE84(void);
|
||||
extern void mapldr_default(void);
|
||||
extern void npc_paltag_set_load(u8);
|
||||
@@ -2795,7 +2795,7 @@ static void sub_8087510(void)
|
||||
static void sub_808751C(void)
|
||||
{
|
||||
PlaySE(SE_WIN_OPEN);
|
||||
sub_809FA9C();
|
||||
ShowStartMenu();
|
||||
ScriptContext2_Enable();
|
||||
}
|
||||
|
||||
|
||||
+1364
File diff suppressed because it is too large
Load Diff
+95
-95
@@ -43,7 +43,7 @@ static void sub_80768F0(struct Sprite *sprite);
|
||||
static void sub_80769A8(struct Sprite *sprite);
|
||||
static void sub_80769CC(struct Sprite *sprite);
|
||||
static void SpriteCB_HitAnimHealthoxEffect(struct Sprite *sprite);
|
||||
static u16 GetBankPokeballItemId(u8 bank);
|
||||
static u16 GetBattlerPokeballItemId(u8 battlerId);
|
||||
|
||||
// rom const data
|
||||
|
||||
@@ -317,11 +317,11 @@ const struct SpriteTemplate gBallSpriteTemplates[POKEBALL_COUNT] =
|
||||
},
|
||||
};
|
||||
|
||||
#define tFrames data[0]
|
||||
#define tPan data[1]
|
||||
#define tThrowId data[2]
|
||||
#define tBank data[3]
|
||||
#define tOpponentBank data[4]
|
||||
#define tFrames data[0]
|
||||
#define tPan data[1]
|
||||
#define tThrowId data[2]
|
||||
#define tBattler data[3]
|
||||
#define tOpponentBattler data[4]
|
||||
|
||||
u8 DoPokeballSendOutAnimation(s16 pan, u8 kindOfThrow)
|
||||
{
|
||||
@@ -333,17 +333,17 @@ u8 DoPokeballSendOutAnimation(s16 pan, u8 kindOfThrow)
|
||||
taskId = CreateTask(Task_DoPokeballSendOutAnim, 5);
|
||||
gTasks[taskId].tPan = pan;
|
||||
gTasks[taskId].tThrowId = kindOfThrow;
|
||||
gTasks[taskId].tBank = gActiveBattler;
|
||||
gTasks[taskId].tBattler = gActiveBattler;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define sBank data[6]
|
||||
#define sBattler data[6]
|
||||
|
||||
static void Task_DoPokeballSendOutAnim(u8 taskId)
|
||||
{
|
||||
u16 throwCaseId;
|
||||
u8 bank;
|
||||
u8 battlerId;
|
||||
u16 itemId, ballId;
|
||||
u8 ballSpriteId;
|
||||
bool8 notSendOut = FALSE;
|
||||
@@ -355,12 +355,12 @@ static void Task_DoPokeballSendOutAnim(u8 taskId)
|
||||
}
|
||||
|
||||
throwCaseId = gTasks[taskId].tThrowId;
|
||||
bank = gTasks[taskId].tBank;
|
||||
battlerId = gTasks[taskId].tBattler;
|
||||
|
||||
if (GetBattlerSide(bank) != B_SIDE_PLAYER)
|
||||
itemId = GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_POKEBALL);
|
||||
if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
|
||||
itemId = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_POKEBALL);
|
||||
else
|
||||
itemId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_POKEBALL);
|
||||
itemId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_POKEBALL);
|
||||
|
||||
ballId = ItemIdToBallId(itemId);
|
||||
LoadBallGfx(ballId);
|
||||
@@ -372,15 +372,15 @@ static void Task_DoPokeballSendOutAnim(u8 taskId)
|
||||
switch (throwCaseId)
|
||||
{
|
||||
case POKEBALL_PLAYER_SENDOUT:
|
||||
gBattlerTarget = bank;
|
||||
gBattlerTarget = battlerId;
|
||||
gSprites[ballSpriteId].pos1.x = 24;
|
||||
gSprites[ballSpriteId].pos1.y = 68;
|
||||
gSprites[ballSpriteId].callback = SpriteCB_PlayerMonSendOut_1;
|
||||
break;
|
||||
case POKEBALL_OPPONENT_SENDOUT:
|
||||
gSprites[ballSpriteId].pos1.x = GetBattlerSpriteCoord(bank, BANK_X_POS);
|
||||
gSprites[ballSpriteId].pos1.y = GetBattlerSpriteCoord(bank, BANK_Y_POS) + 24;
|
||||
gBattlerTarget = bank;
|
||||
gSprites[ballSpriteId].pos1.x = GetBattlerSpriteCoord(battlerId, BANK_X_POS);
|
||||
gSprites[ballSpriteId].pos1.y = GetBattlerSpriteCoord(battlerId, BANK_Y_POS) + 24;
|
||||
gBattlerTarget = battlerId;
|
||||
gSprites[ballSpriteId].data[0] = 0;
|
||||
gSprites[ballSpriteId].callback = SpriteCB_OpponentMonSendOut;
|
||||
break;
|
||||
@@ -390,7 +390,7 @@ static void Task_DoPokeballSendOutAnim(u8 taskId)
|
||||
break;
|
||||
}
|
||||
|
||||
gSprites[ballSpriteId].sBank = gBattlerTarget;
|
||||
gSprites[ballSpriteId].sBattler = gBattlerTarget;
|
||||
if (!notSendOut)
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
@@ -404,7 +404,7 @@ static void Task_DoPokeballSendOutAnim(u8 taskId)
|
||||
gSprites[ballSpriteId].data[5] = -40;
|
||||
sub_80A68D4(&gSprites[ballSpriteId]);
|
||||
gSprites[ballSpriteId].oam.affineParam = taskId;
|
||||
gTasks[taskId].tOpponentBank = gBattlerTarget;
|
||||
gTasks[taskId].tOpponentBattler = gBattlerTarget;
|
||||
gTasks[taskId].func = TaskDummy;
|
||||
PlaySE(SE_NAGERU);
|
||||
}
|
||||
@@ -415,7 +415,7 @@ static void SpriteCB_TestBallThrow(struct Sprite *sprite)
|
||||
{
|
||||
u16 ballId;
|
||||
u8 taskId = sprite->oam.affineParam;
|
||||
u8 opponentBank = gTasks[taskId].tOpponentBank;
|
||||
u8 opponentBattler = gTasks[taskId].tOpponentBattler;
|
||||
u8 noOfShakes = gTasks[taskId].tThrowId;
|
||||
|
||||
StartSpriteAnim(sprite, 1);
|
||||
@@ -425,10 +425,10 @@ static void SpriteCB_TestBallThrow(struct Sprite *sprite)
|
||||
sprite->pos2.x = 0;
|
||||
sprite->pos2.y = 0;
|
||||
sprite->data[5] = 0;
|
||||
ballId = ItemIdToBallId(GetBankPokeballItemId(opponentBank));
|
||||
ballId = ItemIdToBallId(GetBattlerPokeballItemId(opponentBattler));
|
||||
LaunchBallStarsTask(sprite->pos1.x, sprite->pos1.y - 5, 1, 0x1C, ballId);
|
||||
sprite->data[0] = LaunchBallFadeMonTask(FALSE, opponentBank, 14, ballId);
|
||||
sprite->sBank = opponentBank;
|
||||
sprite->data[0] = LaunchBallFadeMonTask(FALSE, opponentBattler, 14, ballId);
|
||||
sprite->sBattler = opponentBattler;
|
||||
sprite->data[7] = noOfShakes;
|
||||
DestroyTask(taskId);
|
||||
sprite->callback = sub_80756D4;
|
||||
@@ -438,8 +438,8 @@ static void SpriteCB_TestBallThrow(struct Sprite *sprite)
|
||||
#undef tFrames
|
||||
#undef tPan
|
||||
#undef tThrowId
|
||||
#undef tBank
|
||||
#undef tOpponentBank
|
||||
#undef tBattler
|
||||
#undef tOpponentBattler
|
||||
|
||||
static void sub_80756D4(struct Sprite *sprite)
|
||||
{
|
||||
@@ -452,9 +452,9 @@ static void sub_80756E0(struct Sprite *sprite)
|
||||
{
|
||||
sprite->data[5] = 0;
|
||||
sprite->callback = sub_807574C;
|
||||
StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[sprite->sBank]], 2);
|
||||
AnimateSprite(&gSprites[gBattlerSpriteIds[sprite->sBank]]);
|
||||
gSprites[gBattlerSpriteIds[sprite->sBank]].data[1] = 0;
|
||||
StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[sprite->sBattler]], 2);
|
||||
AnimateSprite(&gSprites[gBattlerSpriteIds[sprite->sBattler]]);
|
||||
gSprites[gBattlerSpriteIds[sprite->sBattler]].data[1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -463,17 +463,17 @@ static void sub_807574C(struct Sprite *sprite)
|
||||
sprite->data[5]++;
|
||||
if (sprite->data[5] == 11)
|
||||
PlaySE(SE_SUIKOMU);
|
||||
if (gSprites[gBattlerSpriteIds[sprite->sBank]].affineAnimEnded)
|
||||
if (gSprites[gBattlerSpriteIds[sprite->sBattler]].affineAnimEnded)
|
||||
{
|
||||
StartSpriteAnim(sprite, 2);
|
||||
gSprites[gBattlerSpriteIds[sprite->sBank]].invisible = TRUE;
|
||||
gSprites[gBattlerSpriteIds[sprite->sBattler]].invisible = TRUE;
|
||||
sprite->data[5] = 0;
|
||||
sprite->callback = sub_80757E4;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSprites[gBattlerSpriteIds[sprite->sBank]].data[1] += 0x60;
|
||||
gSprites[gBattlerSpriteIds[sprite->sBank]].pos2.y = -gSprites[gBattlerSpriteIds[sprite->sBank]].data[1] >> 8;
|
||||
gSprites[gBattlerSpriteIds[sprite->sBattler]].data[1] += 0x60;
|
||||
gSprites[gBattlerSpriteIds[sprite->sBattler]].pos2.y = -gSprites[gBattlerSpriteIds[sprite->sBattler]].data[1] >> 8;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -641,7 +641,7 @@ static void sub_8075970(struct Sprite *sprite)
|
||||
#define tCryTaskSpecies data[0]
|
||||
#define tCryTaskPan data[1]
|
||||
#define tCryTaskWantedCry data[2]
|
||||
#define tCryTaskBank data[3]
|
||||
#define tCryTaskBattler data[3]
|
||||
#define tCryTaskMonSpriteId data[4]
|
||||
#define tCryTaskMonPtr1 data[5]
|
||||
#define tCryTaskMonPtr2 data[6]
|
||||
@@ -653,7 +653,7 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId)
|
||||
u8 wantedCry = gTasks[taskId].tCryTaskWantedCry;
|
||||
s8 pan = gTasks[taskId].tCryTaskPan;
|
||||
u16 species = gTasks[taskId].tCryTaskSpecies;
|
||||
u8 bank = gTasks[taskId].tCryTaskBank;
|
||||
u8 battlerId = gTasks[taskId].tCryTaskBattler;
|
||||
u8 monSpriteId = gTasks[taskId].tCryTaskMonSpriteId;
|
||||
struct Pokemon *mon = (void*)(u32)((gTasks[taskId].tCryTaskMonPtr1 << 0x10) | (u16)(gTasks[taskId].tCryTaskMonPtr2));
|
||||
|
||||
@@ -669,7 +669,7 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId)
|
||||
PlayCry3(species, pan, 0);
|
||||
else
|
||||
PlayCry3(species, pan, 11);
|
||||
gBattleSpritesDataPtr->healthBoxesData[bank].field_1_x40 = 0;
|
||||
gBattleSpritesDataPtr->healthBoxesData[battlerId].field_1_x40 = 0;
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
case 2:
|
||||
@@ -685,7 +685,7 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId)
|
||||
else
|
||||
PlayCry4(species, pan, 12);
|
||||
|
||||
gBattleSpritesDataPtr->healthBoxesData[bank].field_1_x40 = 0;
|
||||
gBattleSpritesDataPtr->healthBoxesData[battlerId].field_1_x40 = 0;
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
else
|
||||
@@ -724,7 +724,7 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId)
|
||||
else
|
||||
PlayCry4(species, pan, 11);
|
||||
|
||||
gBattleSpritesDataPtr->healthBoxesData[bank].field_1_x40 = 0;
|
||||
gBattleSpritesDataPtr->healthBoxesData[battlerId].field_1_x40 = 0;
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
}
|
||||
@@ -732,13 +732,13 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId)
|
||||
|
||||
static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite)
|
||||
{
|
||||
u8 bank = sprite->sBank;
|
||||
u8 battlerId = sprite->sBattler;
|
||||
u32 ballId;
|
||||
|
||||
StartSpriteAnim(sprite, 1);
|
||||
ballId = ItemIdToBallId(GetBankPokeballItemId(bank));
|
||||
ballId = ItemIdToBallId(GetBattlerPokeballItemId(battlerId));
|
||||
LaunchBallStarsTask(sprite->pos1.x, sprite->pos1.y - 5, 1, 0x1C, ballId);
|
||||
sprite->data[0] = LaunchBallFadeMonTask(1, sprite->sBank, 14, ballId);
|
||||
sprite->data[0] = LaunchBallFadeMonTask(1, sprite->sBattler, 14, ballId);
|
||||
sprite->callback = HandleBallAnimEnd;
|
||||
|
||||
if (gMain.inBattle)
|
||||
@@ -749,19 +749,19 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite)
|
||||
u16 wantedCryCase;
|
||||
u8 taskId;
|
||||
|
||||
if (GetBattlerSide(bank) != B_SIDE_PLAYER)
|
||||
if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
|
||||
{
|
||||
mon = &gEnemyParty[gBattlerPartyIndexes[bank]];
|
||||
mon = &gEnemyParty[gBattlerPartyIndexes[battlerId]];
|
||||
pan = 25;
|
||||
}
|
||||
else
|
||||
{
|
||||
mon = &gPlayerParty[gBattlerPartyIndexes[bank]];
|
||||
mon = &gPlayerParty[gBattlerPartyIndexes[battlerId]];
|
||||
pan = -25;
|
||||
}
|
||||
|
||||
species = GetMonData(mon, MON_DATA_SPECIES);
|
||||
if ((bank == GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) || bank == GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT))
|
||||
if ((battlerId == GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) || battlerId == GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT))
|
||||
&& IsDoubleBattle() && gBattleSpritesDataPtr->animationData->field_9_x1)
|
||||
{
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK)
|
||||
@@ -777,39 +777,39 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite)
|
||||
|
||||
if (!IsDoubleBattle() || !gBattleSpritesDataPtr->animationData->field_9_x1)
|
||||
wantedCryCase = 0;
|
||||
else if (bank == GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) || bank == GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT))
|
||||
else if (battlerId == GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) || battlerId == GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT))
|
||||
wantedCryCase = 1;
|
||||
else
|
||||
wantedCryCase = 2;
|
||||
|
||||
gBattleSpritesDataPtr->healthBoxesData[bank].field_1_x40 = 1;
|
||||
gBattleSpritesDataPtr->healthBoxesData[battlerId].field_1_x40 = 1;
|
||||
|
||||
taskId = CreateTask(Task_PlayCryWhenReleasedFromBall, 3);
|
||||
gTasks[taskId].tCryTaskSpecies = species;
|
||||
gTasks[taskId].tCryTaskPan = pan;
|
||||
gTasks[taskId].tCryTaskWantedCry = wantedCryCase;
|
||||
gTasks[taskId].tCryTaskBank = bank;
|
||||
gTasks[taskId].tCryTaskMonSpriteId = gBattlerSpriteIds[sprite->sBank];
|
||||
gTasks[taskId].tCryTaskBattler = battlerId;
|
||||
gTasks[taskId].tCryTaskMonSpriteId = gBattlerSpriteIds[sprite->sBattler];
|
||||
gTasks[taskId].tCryTaskMonPtr1 = (u32)(mon) >> 0x10;
|
||||
gTasks[taskId].tCryTaskMonPtr2 = (u32)(mon);
|
||||
gTasks[taskId].tCryTaskState = 0;
|
||||
}
|
||||
|
||||
StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[sprite->sBank]], 1);
|
||||
StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[sprite->sBattler]], 1);
|
||||
|
||||
if (GetBattlerSide(sprite->sBank) == B_SIDE_OPPONENT)
|
||||
gSprites[gBattlerSpriteIds[sprite->sBank]].callback = sub_8039B58;
|
||||
if (GetBattlerSide(sprite->sBattler) == B_SIDE_OPPONENT)
|
||||
gSprites[gBattlerSpriteIds[sprite->sBattler]].callback = sub_8039B58;
|
||||
else
|
||||
gSprites[gBattlerSpriteIds[sprite->sBank]].callback = sub_8039E44;
|
||||
gSprites[gBattlerSpriteIds[sprite->sBattler]].callback = sub_8039E44;
|
||||
|
||||
AnimateSprite(&gSprites[gBattlerSpriteIds[sprite->sBank]]);
|
||||
gSprites[gBattlerSpriteIds[sprite->sBank]].data[1] = 0x1000;
|
||||
AnimateSprite(&gSprites[gBattlerSpriteIds[sprite->sBattler]]);
|
||||
gSprites[gBattlerSpriteIds[sprite->sBattler]].data[1] = 0x1000;
|
||||
}
|
||||
|
||||
#undef tCryTaskSpecies
|
||||
#undef tCryTaskPan
|
||||
#undef tCryTaskWantedCry
|
||||
#undef tCryTaskBank
|
||||
#undef tCryTaskBattler
|
||||
#undef tCryTaskMonSpriteId
|
||||
#undef tCryTaskMonPtr1
|
||||
#undef tCryTaskMonPtr2
|
||||
@@ -828,37 +828,37 @@ static void sub_8075FB4(struct Sprite *sprite)
|
||||
static void HandleBallAnimEnd(struct Sprite *sprite)
|
||||
{
|
||||
bool8 affineAnimEnded = FALSE;
|
||||
u8 bank = sprite->sBank;
|
||||
u8 battlerId = sprite->sBattler;
|
||||
|
||||
gSprites[gBattlerSpriteIds[bank]].invisible = FALSE;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].invisible = FALSE;
|
||||
if (sprite->animEnded)
|
||||
sprite->invisible = TRUE;
|
||||
if (gSprites[gBattlerSpriteIds[bank]].affineAnimEnded)
|
||||
if (gSprites[gBattlerSpriteIds[battlerId]].affineAnimEnded)
|
||||
{
|
||||
StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[bank]], 0);
|
||||
StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[battlerId]], 0);
|
||||
affineAnimEnded = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSprites[gBattlerSpriteIds[bank]].data[1] -= 288;
|
||||
gSprites[gBattlerSpriteIds[bank]].pos2.y = gSprites[gBattlerSpriteIds[bank]].data[1] >> 8;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].data[1] -= 288;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].pos2.y = gSprites[gBattlerSpriteIds[battlerId]].data[1] >> 8;
|
||||
}
|
||||
if (sprite->animEnded && affineAnimEnded)
|
||||
{
|
||||
s32 i, doneBanks;
|
||||
s32 i, doneBattlers;
|
||||
|
||||
gSprites[gBattlerSpriteIds[bank]].pos2.y = 0;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].pos2.y = 0;
|
||||
gDoingBattleAnim = FALSE;
|
||||
gBattleSpritesDataPtr->healthBoxesData[bank].ballAnimActive = 0;
|
||||
gBattleSpritesDataPtr->healthBoxesData[battlerId].ballAnimActive = 0;
|
||||
FreeSpriteOamMatrix(sprite);
|
||||
DestroySprite(sprite);
|
||||
|
||||
for (doneBanks = 0, i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||
for (doneBattlers = 0, i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||
{
|
||||
if (gBattleSpritesDataPtr->healthBoxesData[i].ballAnimActive == 0)
|
||||
doneBanks++;
|
||||
doneBattlers++;
|
||||
}
|
||||
if (doneBanks == MAX_BATTLERS_COUNT)
|
||||
if (doneBattlers == MAX_BATTLERS_COUNT)
|
||||
{
|
||||
for (i = 0; i < POKEBALL_COUNT; i++)
|
||||
FreeBallGfx(i);
|
||||
@@ -868,7 +868,7 @@ static void HandleBallAnimEnd(struct Sprite *sprite)
|
||||
|
||||
static void sub_80760F8(struct Sprite *sprite)
|
||||
{
|
||||
u8 bank = sprite->sBank;
|
||||
u8 battlerId = sprite->sBattler;
|
||||
|
||||
sprite->data[4]++;
|
||||
if (sprite->data[4] == 40)
|
||||
@@ -883,21 +883,21 @@ static void sub_80760F8(struct Sprite *sprite)
|
||||
}
|
||||
else if (sprite->data[4] == 315)
|
||||
{
|
||||
FreeOamMatrix(gSprites[gBattlerSpriteIds[sprite->sBank]].oam.matrixNum);
|
||||
DestroySprite(&gSprites[gBattlerSpriteIds[sprite->sBank]]);
|
||||
FreeOamMatrix(gSprites[gBattlerSpriteIds[sprite->sBattler]].oam.matrixNum);
|
||||
DestroySprite(&gSprites[gBattlerSpriteIds[sprite->sBattler]]);
|
||||
DestroySpriteAndFreeResources(sprite);
|
||||
if (gMain.inBattle)
|
||||
gBattleSpritesDataPtr->healthBoxesData[bank].ballAnimActive = 0;
|
||||
gBattleSpritesDataPtr->healthBoxesData[battlerId].ballAnimActive = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void SpriteCB_PlayerMonSendOut_1(struct Sprite *sprite)
|
||||
{
|
||||
sprite->data[0] = 25;
|
||||
sprite->data[2] = GetBattlerSpriteCoord(sprite->sBank, 2);
|
||||
sprite->data[4] = GetBattlerSpriteCoord(sprite->sBank, 3) + 24;
|
||||
sprite->data[2] = GetBattlerSpriteCoord(sprite->sBattler, 2);
|
||||
sprite->data[4] = GetBattlerSpriteCoord(sprite->sBattler, 3) + 24;
|
||||
sprite->data[5] = -30;
|
||||
sprite->oam.affineParam = sprite->sBank;
|
||||
sprite->oam.affineParam = sprite->sBattler;
|
||||
sub_80A68D4(sprite);
|
||||
sprite->callback = SpriteCB_PlayerMonSendOut_2;
|
||||
}
|
||||
@@ -923,7 +923,7 @@ static void SpriteCB_PlayerMonSendOut_2(struct Sprite *sprite)
|
||||
}
|
||||
r4 = sprite->data[0];
|
||||
sub_80A6F3C(sprite);
|
||||
sprite->data[7] += sprite->sBank / 3;
|
||||
sprite->data[7] += sprite->sBattler / 3;
|
||||
sprite->pos2.y += Sin(HIBYTE(sprite->data[7]), sprite->data[5]);
|
||||
sprite->oam.affineParam += 0x100;
|
||||
if ((sprite->oam.affineParam >> 8) % 3 != 0)
|
||||
@@ -946,11 +946,11 @@ static void SpriteCB_PlayerMonSendOut_2(struct Sprite *sprite)
|
||||
sprite->pos1.y += sprite->pos2.y;
|
||||
sprite->pos2.y = 0;
|
||||
sprite->pos2.x = 0;
|
||||
sprite->sBank = sprite->oam.affineParam & 0xFF;
|
||||
sprite->sBattler = sprite->oam.affineParam & 0xFF;
|
||||
sprite->data[0] = 0;
|
||||
|
||||
if (IsDoubleBattle() && gBattleSpritesDataPtr->animationData->field_9_x1
|
||||
&& sprite->sBank == GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT))
|
||||
&& sprite->sBattler == GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT))
|
||||
sprite->callback = SpriteCB_ReleaseMon2FromBall;
|
||||
else
|
||||
sprite->callback = SpriteCB_ReleaseMonFromBall;
|
||||
@@ -976,26 +976,26 @@ static void SpriteCB_OpponentMonSendOut(struct Sprite *sprite)
|
||||
{
|
||||
sprite->data[0] = 0;
|
||||
if (IsDoubleBattle() && gBattleSpritesDataPtr->animationData->field_9_x1
|
||||
&& sprite->sBank == GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT))
|
||||
&& sprite->sBattler == GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT))
|
||||
sprite->callback = SpriteCB_ReleaseMon2FromBall;
|
||||
else
|
||||
sprite->callback = SpriteCB_ReleaseMonFromBall;
|
||||
}
|
||||
}
|
||||
|
||||
#undef sBank
|
||||
#undef sBattler
|
||||
|
||||
static u8 LaunchBallStarsTaskForPokeball(u8 x, u8 y, u8 kindOfStars, u8 d)
|
||||
{
|
||||
return LaunchBallStarsTask(x, y, kindOfStars, d, BALL_POKE);
|
||||
}
|
||||
|
||||
static u8 LaunchBallFadeMonTaskForPokeball(bool8 unFadeLater, u8 bank, u32 arg2)
|
||||
static u8 LaunchBallFadeMonTaskForPokeball(bool8 unFadeLater, u8 battlerId, u32 arg2)
|
||||
{
|
||||
return LaunchBallFadeMonTask(unFadeLater, bank, arg2, BALL_POKE);
|
||||
return LaunchBallFadeMonTask(unFadeLater, battlerId, arg2, BALL_POKE);
|
||||
}
|
||||
|
||||
void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 bank, u8 x, u8 y, u8 oamPriority, u8 subpriortiy, u8 g, u32 h, u16 species)
|
||||
void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 battlerId, u8 x, u8 y, u8 oamPriority, u8 subpriortiy, u8 g, u32 h, u16 species)
|
||||
{
|
||||
u8 spriteId;
|
||||
|
||||
@@ -1012,7 +1012,7 @@ void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 bank, u8 x, u8 y, u8 oa
|
||||
gSprites[monSpriteId].data[7] = species;
|
||||
|
||||
gSprites[spriteId].data[1] = g;
|
||||
gSprites[spriteId].data[2] = bank;
|
||||
gSprites[spriteId].data[2] = battlerId;
|
||||
gSprites[spriteId].data[3] = h;
|
||||
gSprites[spriteId].data[4] = h >> 0x10;
|
||||
gSprites[spriteId].oam.priority = oamPriority;
|
||||
@@ -1027,7 +1027,7 @@ static void sub_8076524(struct Sprite *sprite)
|
||||
{
|
||||
u8 r5;
|
||||
u8 r7 = sprite->data[0];
|
||||
u8 bank = sprite->data[2];
|
||||
u8 battlerId = sprite->data[2];
|
||||
u32 r4 = (u16)sprite->data[3] | ((u16)sprite->data[4] << 16);
|
||||
|
||||
if (sprite->subpriority != 0)
|
||||
@@ -1037,7 +1037,7 @@ static void sub_8076524(struct Sprite *sprite)
|
||||
|
||||
StartSpriteAnim(sprite, 1);
|
||||
LaunchBallStarsTaskForPokeball(sprite->pos1.x, sprite->pos1.y - 5, sprite->oam.priority, r5);
|
||||
sprite->data[1] = LaunchBallFadeMonTaskForPokeball(1, bank, r4);
|
||||
sprite->data[1] = LaunchBallFadeMonTaskForPokeball(1, battlerId, r4);
|
||||
sprite->callback = sub_80765E0;
|
||||
gSprites[r7].invisible = FALSE;
|
||||
StartSpriteAffineAnim(&gSprites[r7], 1);
|
||||
@@ -1175,16 +1175,16 @@ static void DestroySpriteAndFreeResources_(struct Sprite *sprite)
|
||||
DestroySpriteAndFreeResources(sprite);
|
||||
}
|
||||
|
||||
void sub_8076918(u8 bank)
|
||||
void sub_8076918(u8 battlerId)
|
||||
{
|
||||
struct Sprite *healthboxSprite = &gSprites[gHealthboxSpriteIds[bank]];
|
||||
struct Sprite *healthboxSprite = &gSprites[gHealthboxSpriteIds[battlerId]];
|
||||
|
||||
healthboxSprite->data[0] = 5;
|
||||
healthboxSprite->data[1] = 0;
|
||||
healthboxSprite->pos2.x = 0x73;
|
||||
healthboxSprite->pos2.y = 0;
|
||||
healthboxSprite->callback = sub_80769CC;
|
||||
if (GetBattlerSide(bank) != B_SIDE_PLAYER)
|
||||
if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
|
||||
{
|
||||
healthboxSprite->data[0] = -healthboxSprite->data[0];
|
||||
healthboxSprite->data[1] = -healthboxSprite->data[1];
|
||||
@@ -1192,7 +1192,7 @@ void sub_8076918(u8 bank)
|
||||
healthboxSprite->pos2.y = -healthboxSprite->pos2.y;
|
||||
}
|
||||
gSprites[healthboxSprite->data[5]].callback(&gSprites[healthboxSprite->data[5]]);
|
||||
if (GetBattlerPosition(bank) == B_POSITION_PLAYER_RIGHT)
|
||||
if (GetBattlerPosition(battlerId) == B_POSITION_PLAYER_RIGHT)
|
||||
healthboxSprite->callback = sub_80769A8;
|
||||
}
|
||||
|
||||
@@ -1214,13 +1214,13 @@ static void sub_80769CC(struct Sprite *sprite)
|
||||
sprite->callback = SpriteCallbackDummy;
|
||||
}
|
||||
|
||||
void DoHitAnimHealthboxEffect(u8 bank)
|
||||
void DoHitAnimHealthboxEffect(u8 battlerId)
|
||||
{
|
||||
u8 spriteId;
|
||||
|
||||
spriteId = CreateInvisibleSpriteWithCallback(SpriteCB_HitAnimHealthoxEffect);
|
||||
gSprites[spriteId].data[0] = 1;
|
||||
gSprites[spriteId].data[1] = gHealthboxSpriteIds[bank];
|
||||
gSprites[spriteId].data[1] = gHealthboxSpriteIds[battlerId];
|
||||
gSprites[spriteId].callback = SpriteCB_HitAnimHealthoxEffect;
|
||||
}
|
||||
|
||||
@@ -1267,10 +1267,10 @@ void FreeBallGfx(u8 ballId)
|
||||
FreeSpritePaletteByTag(gBallSpritePalettes[ballId].tag);
|
||||
}
|
||||
|
||||
static u16 GetBankPokeballItemId(u8 bank)
|
||||
static u16 GetBattlerPokeballItemId(u8 battlerId)
|
||||
{
|
||||
if (GetBattlerSide(bank) == B_SIDE_PLAYER)
|
||||
return GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_POKEBALL);
|
||||
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
|
||||
return GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_POKEBALL);
|
||||
else
|
||||
return GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_POKEBALL);
|
||||
return GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_POKEBALL);
|
||||
}
|
||||
|
||||
+20
-20
@@ -91,7 +91,7 @@ static void sub_81362E0(void);
|
||||
static void sub_8136344(void);
|
||||
static void HandlePokeblockListMenuItems(void);
|
||||
static void sub_81363BC(void);
|
||||
static void MovePokeblockMenuCursor(u32 pkblId, bool8 arg1, struct ListMenu *arg2);
|
||||
static void MovePokeblockMenuCursor(s32 pkblId, bool8 arg1, struct ListMenu *arg2);
|
||||
static void PutPokeblockInfoText(void);
|
||||
static void HandlePokeblockMenuCursor(u16 cursorPos, u16 arg1);
|
||||
static void PutPokeblockListMenuString(u8 *dst, u16 pkblId);
|
||||
@@ -319,18 +319,18 @@ static const struct ListMenuTemplate sPokeblockListMenuTemplate =
|
||||
.unk_08 = NULL,
|
||||
.totalItems = 0,
|
||||
.maxShowed = 0,
|
||||
.unk_10 = 1,
|
||||
.windowId = 1,
|
||||
.unk_11 = 0,
|
||||
.unk_12 = 1,
|
||||
.cursor_Y = 0,
|
||||
.cursor_X = 0,
|
||||
.upText_Y = 1,
|
||||
.cursorColor = 2,
|
||||
.fillColor = 0,
|
||||
.cursorShadowColor = 3,
|
||||
.unk_16_0 = FALSE,
|
||||
.spaceBetweenItems = 32,
|
||||
.unk_16_7 = FALSE,
|
||||
.unk_17_0 = 1,
|
||||
.cursorPal = 2,
|
||||
.fillValue = 0,
|
||||
.cursorShadowPal = 3,
|
||||
.lettersSpacing = 0,
|
||||
.unk_16_3 = 0,
|
||||
.scrollMultiple = LIST_MULTIPLE_SCROLL_DPAD,
|
||||
.fontId = 1,
|
||||
.cursorKind = 1
|
||||
};
|
||||
|
||||
@@ -460,7 +460,7 @@ static bool8 InitPokeblockMenu(void)
|
||||
gMain.state++;
|
||||
break;
|
||||
case 10:
|
||||
sub_8122344(&sPokeblockMenu->field_E75, FIELD_E75_COUNT);
|
||||
sub_8122344(sPokeblockMenu->field_E75, FIELD_E75_COUNT);
|
||||
gMain.state++;
|
||||
break;
|
||||
case 11:
|
||||
@@ -620,7 +620,7 @@ static void HandlePokeblockListMenuItems(void)
|
||||
sPokeblockMenu->items[i].id = LIST_B_PRESSED;
|
||||
|
||||
gMultiuseListMenuTemplate = sPokeblockListMenuTemplate;
|
||||
gMultiuseListMenuTemplate.unk_17_0 = 7;
|
||||
gMultiuseListMenuTemplate.fontId = 7;
|
||||
gMultiuseListMenuTemplate.totalItems = sPokeblockMenu->itemsNo;
|
||||
gMultiuseListMenuTemplate.items = sPokeblockMenu->items;
|
||||
gMultiuseListMenuTemplate.maxShowed = sPokeblockMenu->maxShowed;
|
||||
@@ -639,7 +639,7 @@ static void PutPokeblockListMenuString(u8 *dst, u16 pkblId)
|
||||
StringExpandPlaceholders(txtPtr, gText_LvVar1);
|
||||
}
|
||||
|
||||
static void MovePokeblockMenuCursor(u32 pkblId, bool8 arg1, struct ListMenu *arg2)
|
||||
static void MovePokeblockMenuCursor(s32 pkblId, bool8 arg1, struct ListMenu *arg2)
|
||||
{
|
||||
if (arg1 != TRUE)
|
||||
{
|
||||
@@ -869,7 +869,7 @@ static void Task_FreeDataAndExitPokeblockCase(u8 taskId)
|
||||
if (sPokeblockMenu->caseId == PBLOCK_CASE_FEEDER || sPokeblockMenu->caseId == PBLOCK_CASE_GIVE)
|
||||
gFieldCallback = sub_80AF168;
|
||||
|
||||
sub_81AE6C8(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
|
||||
DestroyListMenuTask(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
|
||||
sub_8136418();
|
||||
ResetSpriteData();
|
||||
FreeAllSpritePalettes();
|
||||
@@ -893,7 +893,7 @@ static void Task_HandlePokeblockMenuInput(u8 taskId)
|
||||
{
|
||||
if (gMain.newKeys & SELECT_BUTTON)
|
||||
{
|
||||
sub_81AE860(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
|
||||
ListMenuGetScrollAndRow(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
|
||||
if (sSavedPokeblockData.lastItemPage + sSavedPokeblockData.lastItemPos != sPokeblockMenu->itemsNo - 1)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
@@ -908,7 +908,7 @@ static void Task_HandlePokeblockMenuInput(u8 taskId)
|
||||
u16 oldPosition = sSavedPokeblockData.lastItemPos;
|
||||
s32 itemId = ListMenuHandleInputGetItemId(data[0]);
|
||||
|
||||
sub_81AE860(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
|
||||
ListMenuGetScrollAndRow(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
|
||||
if (oldPosition != sSavedPokeblockData.lastItemPos)
|
||||
{
|
||||
HandlePokeblockMenuCursor(oldPosition, 5);
|
||||
@@ -945,7 +945,7 @@ static void Task_HandlePokeblocksSwapInput(u8 taskId)
|
||||
if (gMain.newKeys & SELECT_BUTTON)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
sub_81AE860(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
|
||||
ListMenuGetScrollAndRow(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
|
||||
HandlePokeblocksSwap(taskId, FALSE);
|
||||
}
|
||||
else
|
||||
@@ -954,7 +954,7 @@ static void Task_HandlePokeblocksSwapInput(u8 taskId)
|
||||
u16 var = sSavedPokeblockData.lastItemPos;
|
||||
s32 itemId = ListMenuHandleInputGetItemId(data[0]);
|
||||
|
||||
sub_81AE860(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
|
||||
ListMenuGetScrollAndRow(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
|
||||
if (i != sSavedPokeblockData.lastItemPage || var != sSavedPokeblockData.lastItemPos)
|
||||
{
|
||||
for (i = 0; i < 9; i++)
|
||||
@@ -996,7 +996,7 @@ static void HandlePokeblocksSwap(u8 taskId, bool8 noSwap)
|
||||
u16 swappedFromId = sSavedPokeblockData.lastItemPage + sSavedPokeblockData.lastItemPos;
|
||||
|
||||
sPokeblockMenu->isSwapping = FALSE;
|
||||
sub_81AE6C8(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
|
||||
DestroyListMenuTask(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
|
||||
|
||||
if (!noSwap && data[2] != swappedFromId && data[2] != swappedFromId - 1)
|
||||
{
|
||||
@@ -1112,7 +1112,7 @@ static void HandleErasePokeblock(u8 taskId)
|
||||
lastPos = &sSavedPokeblockData.lastItemPos;
|
||||
data = gTasks[taskId].data;
|
||||
|
||||
sub_81AE6C8(data[0], lastPage, lastPos);
|
||||
DestroyListMenuTask(data[0], lastPage, lastPos);
|
||||
HandlePokeblockMenuCursor(*lastPos, 5);
|
||||
SetMenuItemsCountAndMaxShowed();
|
||||
sub_81362E0();
|
||||
|
||||
+13
-11
@@ -67,7 +67,6 @@ extern const union AnimCmd *gUnknown_082FF70C[];
|
||||
extern const union AnimCmd *const *const gMonAnimationsSpriteAnimsPtrTable[];
|
||||
extern const union AnimCmd *const *const gUnknown_08305D0C[];
|
||||
extern const union AnimCmd *const *const gUnknown_0830536C[];
|
||||
extern const struct BattleMove gBattleMoves[];
|
||||
extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1];
|
||||
extern const struct UnknownPokemonStruct3 gUnknown_08610970[];
|
||||
extern const struct CompressedSpritePalette gMonPaletteTable[];
|
||||
@@ -110,6 +109,9 @@ EWRAM_DATA struct SpriteTemplate gUnknown_0202499C = {0};
|
||||
EWRAM_DATA struct Unknown_806F160_Struct *gUnknown_020249B4[2] = {NULL};
|
||||
|
||||
// const rom data
|
||||
#include "data/battle_moves.h"
|
||||
static const u8 sUnreferencedData[] = {0x34, 0x00, 0x10, 0x00, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00};
|
||||
|
||||
const u16 gSpeciesToHoennPokedexNum[] = {203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 156, 157, 112, 113, 227, 228, 229, 230, 231, 232, 233, 234, 153, 154, 138, 139, 63, 64, 88, 89, 90, 235, 236, 237, 238, 239, 240, 241, 242, 158, 159, 243, 244, 245, 246, 247, 248, 249, 39, 40, 41, 73, 74, 75, 250, 251, 252, 66, 67, 57, 58, 59, 253, 254, 255, 256, 82, 83, 257, 92, 93, 258, 259, 106, 107, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 84, 85, 270, 271, 272, 273, 274, 275, 276, 108, 109, 169, 170, 277, 278, 279, 184, 185, 50, 51, 143, 144, 280, 281, 282, 283, 284, 167, 285, 52, 53, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 65, 181, 182, 155, 324, 137, 325, 326, 162, 163, 327, 328, 329, 91, 55, 56, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 161, 164, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 168, 357, 358, 359, 103, 104, 360, 361, 180, 362, 363, 364, 365, 115, 366, 367, 186, 165, 166, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 42, 43, 44, 25, 26, 34, 35, 114, 27, 28, 32, 33, 99, 100, 61, 62, 145, 131, 132, 60, 105, 68, 127, 128, 183, 129, 130, 140, 141, 97, 98, 116, 117, 118, 48, 49, 78, 79, 101, 102, 173, 174, 175, 119, 120, 171, 172, 125, 126, 54, 110, 111, 80, 81, 69, 76, 77, 121, 122, 160, 148, 149, 94, 36, 37, 38, 95, 96, 150, 45, 46, 47, 176, 177, 178, 152, 146, 147, 124, 123, 179, 70, 71, 72, 142, 86, 87, 133, 134, 135, 136, 29, 30, 31, 187, 188, 189, 190, 191, 192, 193, 194, 195, 198, 199, 200, 196, 197, 201, 202, 151};
|
||||
const u16 gSpeciesToNationalPokedexNum[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 290, 291, 292, 276, 277, 285, 286, 327, 278, 279, 283, 284, 320, 321, 300, 301, 352, 343, 344, 299, 324, 302, 339, 340, 370, 341, 342, 349, 350, 318, 319, 328, 329, 330, 296, 297, 309, 310, 322, 323, 363, 364, 365, 331, 332, 361, 362, 337, 338, 298, 325, 326, 311, 312, 303, 307, 308, 333, 334, 360, 355, 356, 315, 287, 288, 289, 316, 317, 357, 293, 294, 295, 366, 367, 368, 359, 353, 354, 336, 335, 369, 304, 305, 306, 351, 313, 314, 345, 346, 347, 348, 280, 281, 282, 371, 372, 373, 374, 375, 376, 377, 378, 379, 382, 383, 384, 380, 381, 385, 386, 358};
|
||||
const u16 gHoennToNationalOrder[] = {252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 63, 64, 65, 290, 291, 292, 293, 294, 295, 296, 297, 118, 119, 129, 130, 298, 183, 184, 74, 75, 76, 299, 300, 301, 41, 42, 169, 72, 73, 302, 303, 304, 305, 306, 66, 67, 68, 307, 308, 309, 310, 311, 312, 81, 82, 100, 101, 313, 314, 43, 44, 45, 182, 84, 85, 315, 316, 317, 318, 319, 320, 321, 322, 323, 218, 219, 324, 88, 89, 109, 110, 325, 326, 27, 28, 327, 227, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 174, 39, 40, 349, 350, 351, 120, 121, 352, 353, 354, 355, 356, 357, 358, 359, 37, 38, 172, 25, 26, 54, 55, 360, 202, 177, 178, 203, 231, 232, 127, 214, 111, 112, 361, 362, 363, 364, 365, 366, 367, 368, 369, 222, 170, 171, 370, 116, 117, 230, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 29, 30, 31, 32, 33, 34, 35, 36, 46, 47, 48, 49, 50, 51, 52, 53, 56, 57, 58, 59, 60, 61, 62, 69, 70, 71, 77, 78, 79, 80, 83, 86, 87, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 102, 103, 104, 105, 106, 107, 108, 113, 114, 115, 122, 123, 124, 125, 126, 128, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 173, 175, 176, 179, 180, 181, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 215, 216, 217, 220, 221, 223, 224, 225, 226, 228, 229, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411};
|
||||
@@ -2196,7 +2198,7 @@ void DeleteFirstMoveAndGiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move)
|
||||
(var) /= (gStatStageRatios)[(mon)->statStages[(statIndex)]][1]; \
|
||||
}
|
||||
|
||||
s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *defender, u32 move, u16 sideStatus, u16 powerOverride, u8 typeOverride, u8 bankAtk, u8 bankDef)
|
||||
s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *defender, u32 move, u16 sideStatus, u16 powerOverride, u8 typeOverride, u8 battlerIdAtk, u8 battlerIdDef)
|
||||
{
|
||||
u32 i;
|
||||
s32 damage = 0;
|
||||
@@ -2226,8 +2228,8 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
|
||||
if (attacker->item == ITEM_ENIGMA_BERRY)
|
||||
{
|
||||
attackerHoldEffect = gEnigmaBerries[bankAtk].holdEffect;
|
||||
attackerHoldEffectParam = gEnigmaBerries[bankAtk].holdEffectParam;
|
||||
attackerHoldEffect = gEnigmaBerries[battlerIdAtk].holdEffect;
|
||||
attackerHoldEffectParam = gEnigmaBerries[battlerIdAtk].holdEffectParam;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2237,8 +2239,8 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
|
||||
if (defender->item == ITEM_ENIGMA_BERRY)
|
||||
{
|
||||
defenderHoldEffect = gEnigmaBerries[bankDef].holdEffect;
|
||||
defenderHoldEffectParam = gEnigmaBerries[bankDef].holdEffectParam;
|
||||
defenderHoldEffect = gEnigmaBerries[battlerIdDef].holdEffect;
|
||||
defenderHoldEffectParam = gEnigmaBerries[battlerIdDef].holdEffectParam;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2249,13 +2251,13 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
if (attacker->ability == ABILITY_HUGE_POWER || attacker->ability == ABILITY_PURE_POWER)
|
||||
attack *= 2;
|
||||
|
||||
if (ShouldGetStatBadgeBoost(FLAG_BADGE01_GET, bankAtk))
|
||||
if (ShouldGetStatBadgeBoost(FLAG_BADGE01_GET, battlerIdAtk))
|
||||
attack = (110 * attack) / 100;
|
||||
if (ShouldGetStatBadgeBoost(FLAG_BADGE05_GET, bankDef))
|
||||
if (ShouldGetStatBadgeBoost(FLAG_BADGE05_GET, battlerIdDef))
|
||||
defense = (110 * defense) / 100;
|
||||
if (ShouldGetStatBadgeBoost(FLAG_BADGE07_GET, bankAtk))
|
||||
if (ShouldGetStatBadgeBoost(FLAG_BADGE07_GET, battlerIdAtk))
|
||||
spAttack = (110 * spAttack) / 100;
|
||||
if (ShouldGetStatBadgeBoost(FLAG_BADGE07_GET, bankDef))
|
||||
if (ShouldGetStatBadgeBoost(FLAG_BADGE07_GET, battlerIdDef))
|
||||
spDefense = (110 * spDefense) / 100;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sHoldEffectToType); i++)
|
||||
@@ -2440,7 +2442,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
}
|
||||
|
||||
// flash fire triggered
|
||||
if ((gBattleResources->flags->flags[bankAtk] & UNKNOWN_FLAG_FLASH_FIRE) && type == TYPE_FIRE)
|
||||
if ((gBattleResources->flags->flags[battlerIdAtk] & UNKNOWN_FLAG_FLASH_FIRE) && type == TYPE_FIRE)
|
||||
damage = (15 * damage) / 10;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "international_string_util.h"
|
||||
#include "scanline_effect.h"
|
||||
#include "menu_helpers.h"
|
||||
#include "daycare.h"
|
||||
|
||||
struct ContestMove
|
||||
{
|
||||
@@ -115,8 +116,6 @@ extern u8 gText_Appeal[];
|
||||
extern u8 gText_Jam[];
|
||||
extern u8 gText_OTSlash[];
|
||||
extern u8 gText_UnkCtrlF907F908[];
|
||||
extern u8 gAbilityNames[][13];
|
||||
extern u8 *gAbilityDescriptionPointers[];
|
||||
extern u8 gText_XNature[];
|
||||
extern u8 gText_XNatureHatchedAtYZ[];
|
||||
extern u8 gText_XNatureHatchedSomewhereAt[];
|
||||
@@ -146,7 +145,6 @@ extern u8 gText_OneDash[];
|
||||
extern u8 gText_TwoDashes[];
|
||||
extern u8 gText_ThreeDashes[];
|
||||
extern u8 gUnknown_0861CE97[];
|
||||
extern struct BattleMove gBattleMoves[];
|
||||
|
||||
extern void sub_8199C30(u8 a, u8 b, u8 c, u8 d, u8 e, u8 f);
|
||||
extern bool8 sub_81A6BF4();
|
||||
@@ -2539,7 +2537,7 @@ void sub_81C2554()
|
||||
gUnknown_0203CF1C->unk40CB[i] |= 0xFF;
|
||||
}
|
||||
|
||||
void sub_81C25A4(u8 a, u8 *b, u8 c, u8 d, u8 e, u8 f)
|
||||
void sub_81C25A4(u8 a, const u8 *b, u8 c, u8 d, u8 e, u8 f)
|
||||
{
|
||||
AddTextPrinterParameterized2(a, 1, c, d, 0, e, gUnknown_0861CD2C[f], 0, b);
|
||||
}
|
||||
@@ -3027,7 +3025,7 @@ void sub_81C31F0(u8 *a)
|
||||
{
|
||||
u8 level = gUnknown_0203CF1C->summary.metLevel;
|
||||
if (level == 0)
|
||||
level = 5;
|
||||
level = EGG_HATCH_LEVEL;
|
||||
ConvertIntToDecimalStringN(a, level, 0, 3);
|
||||
UnkTextUtil_SetPtrI(3, a);
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ void sub_81700F8(void)
|
||||
gMain.inBattle = FALSE;
|
||||
SetSaveBlocksPointers(sub_815355C());
|
||||
sub_808447C();
|
||||
ResetSaveCounters();
|
||||
sub_81534D0(0);
|
||||
Save_ResetSaveCounters();
|
||||
Save_LoadGameData(0);
|
||||
if (gSaveFileStatus == 0 || gSaveFileStatus == 2)
|
||||
Sav2_ClearSetDefault();
|
||||
SetPokemonCryStereo(gSaveBlock2Ptr->optionsSound);
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "constants/species.h"
|
||||
#include "battle_interface.h"
|
||||
#include "battle_anim.h"
|
||||
#include "data2.h"
|
||||
|
||||
extern u16 gBattle_BG0_X;
|
||||
extern u16 gBattle_BG0_Y;
|
||||
@@ -25,14 +26,14 @@ extern u16 gBattle_BG3_Y;
|
||||
|
||||
extern const union AnimCmd * const * const gMonAnimationsSpriteAnimsPtrTable[];
|
||||
|
||||
extern void sub_806A068(u16 species, u8 bankIdentity);
|
||||
extern void sub_806A12C(u16 backPicId, u8 bankIdentity);
|
||||
extern void sub_806A068(u16 species, u8 battlerPosition);
|
||||
extern void sub_806A12C(u16 backPicId, u8 battlerPosition);
|
||||
|
||||
// this file's functions
|
||||
static void CB2_ReshowBattleScreenAfterMenu(void);
|
||||
static bool8 LoadBattlerSpriteGfx(u8 bank);
|
||||
static void CreateBattlerSprite(u8 bank);
|
||||
static void CreateHealthboxSprite(u8 bank);
|
||||
static bool8 LoadBattlerSpriteGfx(u8 battlerId);
|
||||
static void CreateBattlerSprite(u8 battlerId);
|
||||
static void CreateHealthboxSprite(u8 battlerId);
|
||||
static void sub_80A95F4(void);
|
||||
|
||||
void nullsub_35(void)
|
||||
@@ -217,16 +218,6 @@ static bool8 LoadBattlerSpriteGfx(u8 battler)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// todo: get rid of it once the struct is declared in a header
|
||||
struct MonCoords
|
||||
{
|
||||
// This would use a bitfield, but sub_8079F44
|
||||
// uses it as a u8 and casting won't match.
|
||||
u8 coords; // u8 x:4, y:4;
|
||||
u8 y_offset;
|
||||
};
|
||||
extern const struct MonCoords gTrainerBackPicCoords[];
|
||||
|
||||
static void CreateBattlerSprite(u8 battler)
|
||||
{
|
||||
if (battler < gBattlersCount)
|
||||
|
||||
+10
-9
@@ -3,6 +3,7 @@
|
||||
#include "save.h"
|
||||
#include "constants/game_stat.h"
|
||||
#include "task.h"
|
||||
#include "decompress.h"
|
||||
|
||||
// for the chunk declarations
|
||||
extern struct SaveBlock2 gSaveblock2;
|
||||
@@ -96,7 +97,7 @@ void ClearSaveData(void)
|
||||
}
|
||||
}
|
||||
|
||||
void ResetSaveCounters(void)
|
||||
void Save_ResetSaveCounters(void)
|
||||
{
|
||||
gSaveCounter = 0;
|
||||
gLastWrittenSector = 0;
|
||||
@@ -670,25 +671,25 @@ u8 HandleSavingData(u8 saveType)
|
||||
UpdateSaveAddresses();
|
||||
switch (saveType)
|
||||
{
|
||||
case HOF_DELETE_SAVE: // deletes HOF before overwriting HOF completely. unused
|
||||
case SAVE_HALL_OF_FAME_ERASE_BEFORE: // deletes HOF before overwriting HOF completely. unused
|
||||
for (i = 0xE * 2 + 0; i < 32; i++)
|
||||
EraseFlashSector(i);
|
||||
case HOF_SAVE: // hall of fame.
|
||||
case SAVE_HALL_OF_FAME: // hall of fame.
|
||||
if (GetGameStat(GAME_STAT_ENTERED_HOF) < 999)
|
||||
IncrementGameStat(GAME_STAT_ENTERED_HOF);
|
||||
SaveSerializedGame();
|
||||
save_write_to_flash(0xFFFF, gRamSaveSectionLocations);
|
||||
tempAddr = (u8 *)0x201C000; // FIXME: make this a label.
|
||||
tempAddr = gDecompressionBuffer;
|
||||
HandleWriteSectorNBytes(0x1C, tempAddr, 0xF80);
|
||||
HandleWriteSectorNBytes(0x1D, tempAddr + 0xF80, 0xF80);
|
||||
break;
|
||||
case NORMAL_SAVE: // normal save. also called by overwriting your own save.
|
||||
case SAVE_NORMAL: // normal save. also called by overwriting your own save.
|
||||
default:
|
||||
SaveSerializedGame();
|
||||
save_write_to_flash(0xFFFF, gRamSaveSectionLocations);
|
||||
break;
|
||||
case LINK_SAVE: // _081532C4
|
||||
case LINK2_SAVE:
|
||||
case SAVE_LINK: // _081532C4
|
||||
case SAVE_LINK2:
|
||||
SaveSerializedGame();
|
||||
for(i = 0; i < 5; i++)
|
||||
ClearSaveData_2(i, gRamSaveSectionLocations);
|
||||
@@ -702,7 +703,7 @@ u8 HandleSavingData(u8 saveType)
|
||||
save_write_to_flash(0, gRamSaveSectionLocations);
|
||||
break;
|
||||
*/
|
||||
case DIFFERENT_FILE_SAVE:
|
||||
case SAVE_OVERWRITE_DIFFERENT_FILE:
|
||||
for (i = (0xE * 2 + 0); i < 32; i++)
|
||||
EraseFlashSector(i); // erase HOF.
|
||||
SaveSerializedGame();
|
||||
@@ -799,7 +800,7 @@ bool8 sub_8153474(void)
|
||||
return retVal;
|
||||
}
|
||||
|
||||
u8 sub_81534D0(u8 a1)
|
||||
u8 Save_LoadGameData(u8 a1)
|
||||
{
|
||||
u8 result;
|
||||
|
||||
|
||||
+22
-166
@@ -1476,20 +1476,14 @@ bool8 ScrCmd_showcontestwinner(struct ScriptContext *ctx)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Lots of math, can't figure it out.
|
||||
/*
|
||||
bool8 ScrCmd_braillemessage(struct ScriptContext *ctx)
|
||||
{
|
||||
u8 *ptr = (u8 *)ScriptReadWord(ctx);
|
||||
struct WindowTemplate template1;
|
||||
struct WindowTemplate template2;
|
||||
int i;
|
||||
u8 width;
|
||||
u8 height;
|
||||
int temp1;
|
||||
int temp2;
|
||||
u8 x;
|
||||
u8 y;
|
||||
struct WindowTemplate winTemplate;
|
||||
s32 i;
|
||||
u8 width, height;
|
||||
u8 xWindow, yWindow, xText, yText;
|
||||
u8 temp;
|
||||
|
||||
StringExpandPlaceholders(gStringVar4, ptr + 6);
|
||||
|
||||
@@ -1507,168 +1501,30 @@ bool8 ScrCmd_braillemessage(struct ScriptContext *ctx)
|
||||
if (height > 0x12)
|
||||
height = 0x12;
|
||||
|
||||
x = width + 2;
|
||||
temp1 = (0x1E - x) / 2;
|
||||
x = temp1 + 1;
|
||||
temp1 = ((x - temp1 - 1) * 8 + 3);
|
||||
temp = width + 2;
|
||||
xWindow = (0x1E - temp) / 2;
|
||||
|
||||
y = height + 2;
|
||||
temp2 = (0x14 - y) / 2;
|
||||
y = temp2 + 2;
|
||||
temp2 = ((y - temp2 - 1) * 8);
|
||||
temp = height + 2;
|
||||
yText = (0x14 - temp) / 2;
|
||||
|
||||
sub_8198A50(&template1, 0, x, y, width, height, 0xF, 0x1);
|
||||
template2 = template1;
|
||||
gUnknown_03000F30 = AddWindow(&template2);
|
||||
xText = xWindow;
|
||||
xWindow += 1;
|
||||
|
||||
yWindow = yText;
|
||||
yText += 2;
|
||||
|
||||
xText = (xWindow - xText - 1) * 8 + 3;
|
||||
yText = (yText - yWindow - 1) * 8;
|
||||
|
||||
winTemplate = sub_8198A50(0, xWindow, yWindow + 1, width, height, 0xF, 0x1);
|
||||
gUnknown_03000F30 = AddWindow(&winTemplate);
|
||||
sub_809882C(gUnknown_03000F30, 0x214, 0xE0);
|
||||
NewMenuHelpers_DrawStdWindowFrame(gUnknown_03000F30, 0);
|
||||
PutWindowTilemap(gUnknown_03000F30);
|
||||
FillWindowPixelBuffer(gUnknown_03000F30, 0x11);
|
||||
PrintTextOnWindow(gUnknown_03000F30, 6, gStringVar4, temp1, temp2, 0xFF, 0x0);
|
||||
PrintTextOnWindow(gUnknown_03000F30, 6, gStringVar4, xText, yText, 0xFF, 0x0);
|
||||
CopyWindowToVram(gUnknown_03000F30, 3);
|
||||
return FALSE;
|
||||
}*/
|
||||
ASM_DIRECT
|
||||
bool8 ScrCmd_braillemessage(struct ScriptContext *ctx)
|
||||
{
|
||||
asm("push {r4-r7,lr}\n\
|
||||
mov r7, r8\n\
|
||||
push {r7}\n\
|
||||
sub sp, #0x20\n\
|
||||
bl ScriptReadWord\n\
|
||||
add r1, r0, #0\n\
|
||||
ldr r4, =gStringVar4\n\
|
||||
add r1, #0x6\n\
|
||||
add r0, r4, #0\n\
|
||||
bl StringExpandPlaceholders\n\
|
||||
mov r2, #0x1\n\
|
||||
neg r2, r2\n\
|
||||
mov r0, #0x6\n\
|
||||
add r1, r4, #0\n\
|
||||
bl GetStringWidth\n\
|
||||
lsr r0, #3\n\
|
||||
lsl r0, #24\n\
|
||||
lsr r7, r0, #24\n\
|
||||
cmp r7, #0x1C\n\
|
||||
bls _0809AE9C\n\
|
||||
mov r7, #0x1C\n\
|
||||
_0809AE9C:\n\
|
||||
mov r5, #0x4\n\
|
||||
ldrb r0, [r4]\n\
|
||||
add r2, r7, #0x2\n\
|
||||
add r1, sp, #0x18\n\
|
||||
mov r8, r1\n\
|
||||
cmp r0, #0xFF\n\
|
||||
beq _0809AEC0\n\
|
||||
add r1, r4, #0\n\
|
||||
_0809AEAC:\n\
|
||||
ldrb r0, [r1]\n\
|
||||
add r1, #0x1\n\
|
||||
cmp r0, #0xFE\n\
|
||||
bne _0809AEBA\n\
|
||||
add r0, r5, #0x3\n\
|
||||
lsl r0, #24\n\
|
||||
lsr r5, r0, #24\n\
|
||||
_0809AEBA:\n\
|
||||
ldrb r0, [r1]\n\
|
||||
cmp r0, #0xFF\n\
|
||||
bne _0809AEAC\n\
|
||||
_0809AEC0:\n\
|
||||
cmp r5, #0x12\n\
|
||||
bls _0809AEC6\n\
|
||||
mov r5, #0x12\n\
|
||||
_0809AEC6:\n\
|
||||
lsl r0, r2, #24\n\
|
||||
lsr r0, #24\n\
|
||||
mov r2, #0x1E\n\
|
||||
sub r2, r0\n\
|
||||
lsr r0, r2, #31\n\
|
||||
add r2, r0\n\
|
||||
asr r2, #1\n\
|
||||
lsl r2, #24\n\
|
||||
add r0, r5, #0x2\n\
|
||||
lsl r0, #24\n\
|
||||
lsr r0, #24\n\
|
||||
mov r4, #0x14\n\
|
||||
sub r4, r0\n\
|
||||
lsr r0, r4, #31\n\
|
||||
add r4, r0\n\
|
||||
asr r4, #1\n\
|
||||
lsl r4, #24\n\
|
||||
lsr r6, r2, #24\n\
|
||||
mov r0, #0x80\n\
|
||||
lsl r0, #17\n\
|
||||
add r2, r0\n\
|
||||
lsr r2, #24\n\
|
||||
lsr r3, r4, #24\n\
|
||||
mov r1, #0x80\n\
|
||||
lsl r1, #18\n\
|
||||
add r4, r1\n\
|
||||
lsr r4, #24\n\
|
||||
sub r6, r2, r6\n\
|
||||
sub r6, #0x1\n\
|
||||
lsl r6, #3\n\
|
||||
add r6, #0x3\n\
|
||||
lsl r6, #24\n\
|
||||
lsr r6, #24\n\
|
||||
sub r4, r3\n\
|
||||
sub r4, #0x1\n\
|
||||
lsl r4, #27\n\
|
||||
lsr r4, #24\n\
|
||||
add r3, #0x1\n\
|
||||
lsl r3, #24\n\
|
||||
lsr r3, #24\n\
|
||||
str r7, [sp]\n\
|
||||
str r5, [sp, #0x4]\n\
|
||||
mov r0, #0xF\n\
|
||||
str r0, [sp, #0x8]\n\
|
||||
mov r0, #0x1\n\
|
||||
str r0, [sp, #0xC]\n\
|
||||
add r0, sp, #0x10\n\
|
||||
mov r1, #0\n\
|
||||
bl sub_8198A50\n\
|
||||
ldr r0, [sp, #0x10]\n\
|
||||
ldr r1, [sp, #0x14]\n\
|
||||
str r0, [sp, #0x18]\n\
|
||||
str r1, [sp, #0x1C]\n\
|
||||
ldr r5, =gUnknown_03000F30\n\
|
||||
mov r0, r8\n\
|
||||
bl AddWindow\n\
|
||||
strb r0, [r5]\n\
|
||||
ldrb r0, [r5]\n\
|
||||
mov r1, #0x85\n\
|
||||
lsl r1, #2\n\
|
||||
mov r2, #0xE0\n\
|
||||
bl sub_809882C\n\
|
||||
ldrb r0, [r5]\n\
|
||||
mov r1, #0\n\
|
||||
bl NewMenuHelpers_DrawStdWindowFrame\n\
|
||||
ldrb r0, [r5]\n\
|
||||
bl PutWindowTilemap\n\
|
||||
ldrb r0, [r5]\n\
|
||||
mov r1, #0x11\n\
|
||||
bl FillWindowPixelBuffer\n\
|
||||
ldrb r0, [r5]\n\
|
||||
ldr r2, =gStringVar4\n\
|
||||
str r4, [sp]\n\
|
||||
mov r1, #0xFF\n\
|
||||
str r1, [sp, #0x4]\n\
|
||||
mov r1, #0\n\
|
||||
str r1, [sp, #0x8]\n\
|
||||
mov r1, #0x6\n\
|
||||
add r3, r6, #0\n\
|
||||
bl PrintTextOnWindow\n\
|
||||
ldrb r0, [r5]\n\
|
||||
mov r1, #0x3\n\
|
||||
bl CopyWindowToVram\n\
|
||||
mov r0, #0\n\
|
||||
add sp, #0x20\n\
|
||||
pop {r3}\n\
|
||||
mov r8, r3\n\
|
||||
pop {r4-r7}\n\
|
||||
pop {r1}\n\
|
||||
bx r1\n\
|
||||
.pool");
|
||||
}
|
||||
|
||||
bool8 ScrCmd_cmdDA(struct ScriptContext *ctx)
|
||||
@@ -1756,7 +1612,7 @@ bool8 ScrCmd_buffernumberstring(struct ScriptContext *ctx)
|
||||
{
|
||||
u8 stringVarIndex = ScriptReadByte(ctx);
|
||||
u16 v1 = VarGet(ScriptReadHalfword(ctx));
|
||||
u8 v2 = sub_80EF370(v1);
|
||||
u8 v2 = CountDigits(v1);
|
||||
|
||||
ConvertIntToDecimalStringN(sScriptStringVars[stringVarIndex], v1, 0, v2);
|
||||
return FALSE;
|
||||
|
||||
+8
-8
@@ -6,8 +6,8 @@
|
||||
#include "main.h"
|
||||
#include "task.h"
|
||||
#include "palette.h"
|
||||
#include "list_menu.h"
|
||||
#include "window.h"
|
||||
#include "list_menu.h"
|
||||
#include "menu.h"
|
||||
#include "menu_helpers.h"
|
||||
#include "menu_indicators.h"
|
||||
@@ -66,7 +66,7 @@ EWRAM_DATA struct SecretBaseListMenuBuffer *gUnknown_0203A020 = NULL;
|
||||
|
||||
void sub_80E9C9C(u8 taskId);
|
||||
void game_continue(u8 taskId);
|
||||
void sub_80E9DEC(u32 a0, bool8 flag, struct ListMenu *menu);
|
||||
void sub_80E9DEC(s32 a0, bool8 flag, struct ListMenu *menu);
|
||||
void sub_80E9E00(u8 taskId);
|
||||
void sub_80E9E44(u8 taskId);
|
||||
void sub_80E9E90(u8 taskId);
|
||||
@@ -913,13 +913,13 @@ void game_continue(u8 taskId)
|
||||
data[3] = 8;
|
||||
}
|
||||
gMultiuseListMenuTemplate = gUnknown_0858D07C;
|
||||
gMultiuseListMenuTemplate.unk_10 = data[6];
|
||||
gMultiuseListMenuTemplate.windowId = data[6];
|
||||
gMultiuseListMenuTemplate.totalItems = data[0];
|
||||
gMultiuseListMenuTemplate.items = gUnknown_0203A020->items;
|
||||
gMultiuseListMenuTemplate.maxShowed = data[3];
|
||||
}
|
||||
|
||||
void sub_80E9DEC(u32 a0, bool8 flag, struct ListMenu *menu)
|
||||
void sub_80E9DEC(s32 a0, bool8 flag, struct ListMenu *menu)
|
||||
{
|
||||
if (flag != TRUE)
|
||||
{
|
||||
@@ -953,14 +953,14 @@ void sub_80E9E90(u8 taskId)
|
||||
|
||||
data = gTasks[taskId].data;
|
||||
input = ListMenuHandleInputGetItemId(data[5]);
|
||||
sub_81AE860(data[5], &data[2], &data[1]);
|
||||
ListMenuGetScrollAndRow(data[5], &data[2], &data[1]);
|
||||
switch (input)
|
||||
{
|
||||
case -1:
|
||||
break;
|
||||
case -2:
|
||||
PlaySE(SE_SELECT);
|
||||
sub_81AE6C8(data[5], NULL, NULL);
|
||||
DestroyListMenuTask(data[5], NULL, NULL);
|
||||
RemoveScrollIndicatorArrowPair(data[8]);
|
||||
sub_819746C(data[6], 0);
|
||||
ClearWindowTilemap(data[6]);
|
||||
@@ -1042,7 +1042,7 @@ void sub_80EA08C(u8 taskId)
|
||||
|
||||
data = gTasks[taskId].data;
|
||||
sub_8197434(0, 0);
|
||||
sub_81AE6C8(data[5], &data[2], &data[1]);
|
||||
DestroyListMenuTask(data[5], &data[2], &data[1]);
|
||||
gSaveBlock1Ptr->secretBases[data[4]].sbr_field_1_6 = 0;
|
||||
game_continue(taskId);
|
||||
sub_812225C(&data[2], &data[1], data[3], data[0]);
|
||||
@@ -1061,7 +1061,7 @@ void sub_80EA13C(u8 taskId)
|
||||
|
||||
data = gTasks[taskId].data;
|
||||
sub_8197434(0, 0);
|
||||
sub_81AE6C8(data[5], &data[2], &data[1]);
|
||||
DestroyListMenuTask(data[5], &data[2], &data[1]);
|
||||
sub_80E9E00(taskId);
|
||||
gTasks[taskId].func = sub_80E9E90;
|
||||
}
|
||||
|
||||
+1225
-104
File diff suppressed because it is too large
Load Diff
@@ -25,12 +25,6 @@
|
||||
#define STARTER_PKMN_POS_X 120
|
||||
#define STARTER_PKMN_POS_Y 64
|
||||
|
||||
// graphics
|
||||
extern const u32 gBirchHelpGfx[];
|
||||
extern const u32 gBirchBagTilemap[];
|
||||
extern const u32 gBirchGrassTilemap[];
|
||||
extern const u16 gBirchBagGrassPal[];
|
||||
|
||||
// text
|
||||
extern const u8 gText_BirchInTrouble[];
|
||||
extern const u8 gText_ConfirmStarterChoice[];
|
||||
|
||||
+4
-8
@@ -4,18 +4,15 @@
|
||||
#include "m4a.h"
|
||||
#include "palette.h"
|
||||
#include "sound.h"
|
||||
#include "constants/songs.h"
|
||||
#include "string_util.h"
|
||||
#include "window.h"
|
||||
#include "text.h"
|
||||
#include "blit.h"
|
||||
|
||||
extern void FillBitmapRect4Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue);
|
||||
extern void FillWindowPixelRect(u8 windowId, u8 fillValue, u16 x, u16 y, u16 width, u16 height);
|
||||
extern void BlitBitmapRectToWindow(u8 windowId, const u8 *pixels, u16 srcX, u16 srcY, u16 srcWidth, int srcHeight, u16 destX, u16 destY, u16 rectWidth, u16 rectHeight);
|
||||
extern u8 GetKeypadIconWidth(u8 keypadIconId);
|
||||
extern void CopyWindowToVram(u8 windowId, u8 mode);
|
||||
extern u16 Font6Func(struct TextPrinter *textPrinter);
|
||||
extern u32 GetGlyphWidthFont6(u16 glyphId, bool32 isJapanese);
|
||||
extern void PlaySE(u16 songNum);
|
||||
extern u8* UnkTextUtil_GetPtrI(u8 a1);
|
||||
extern int sub_8197964();
|
||||
|
||||
@@ -27,7 +24,6 @@ static u16 gLastTextBgColor;
|
||||
static u16 gLastTextFgColor;
|
||||
static u16 gLastTextShadowColor;
|
||||
|
||||
extern struct Main gMain;
|
||||
extern struct MusicPlayerInfo gMPlayInfo_BGM;
|
||||
|
||||
const struct FontInfo *gFonts;
|
||||
@@ -1986,7 +1982,7 @@ bool16 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter)
|
||||
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||
{
|
||||
result = TRUE;
|
||||
PlaySE(5);
|
||||
PlaySE(SE_SELECT);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -2004,7 +2000,7 @@ bool16 TextPrinterWait(struct TextPrinter *textPrinter)
|
||||
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||
{
|
||||
result = TRUE;
|
||||
PlaySE(5);
|
||||
PlaySE(SE_SELECT);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
+6
-17
@@ -1,6 +1,8 @@
|
||||
#include "global.h"
|
||||
#include "window.h"
|
||||
#include "malloc.h"
|
||||
#include "bg.h"
|
||||
#include "blit.h"
|
||||
|
||||
u32 filler_03002F58;
|
||||
u32 filler_03002F5C;
|
||||
@@ -15,19 +17,6 @@ EWRAM_DATA struct Window gWindows[WINDOWS_MAX] = {0};
|
||||
EWRAM_DATA static struct Window* sWindowPtr = NULL;
|
||||
EWRAM_DATA static u16 sWindowSize = 0;
|
||||
|
||||
extern void* GetBgTilemapBuffer(u8 bg);
|
||||
extern int DummiedOutFireRedLeafGreenTileAllocFunc(int, int, int, int);
|
||||
extern u16 GetBgAttribute(u8 bg, u8 attributeId);
|
||||
extern void SetBgTilemapBuffer(u8 bg, void *tilemap);
|
||||
extern void CopyBgTilemapBufferToVram(u8 bg);
|
||||
extern u8 LoadBgTiles(u8 bg, void *src, u16 size, u16 destOffset);
|
||||
extern void WriteSequenceToBgTilemapBuffer(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 width, u8 height, u8 paletteSlot, u16 tileNumDelta);
|
||||
extern void FillBgTilemapBufferRect(u8 bg, u16 tileNum, u8 x, u8 y, u8 width, u8 height, u8 palette);
|
||||
extern void BlitBitmapRect4Bit(struct Bitmap *src, struct Bitmap *dest, u16 srcX, u16 srcY, u16 destX, u16 destY, u16 width, u16 height, u8 colorKey);
|
||||
extern void BlitBitmapRect4BitTo8Bit(struct Bitmap *src, struct Bitmap *dest, u16 srcX, u16 srcY, u16 destX, u16 destY, u16 width, u16 height, u8 colorKey, u8 paletteNum);
|
||||
extern void FillBitmapRect4Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue);
|
||||
extern void FillBitmapRect8Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue);
|
||||
|
||||
static u8 GetNumActiveWindowsOnBg(u8 bgId);
|
||||
static u8 GetNumActiveWindowsOnBg8Bit(u8 bgId);
|
||||
|
||||
@@ -130,13 +119,13 @@ u16 AddWindow(const struct WindowTemplate *template)
|
||||
u8 *allocatedTilemapBuffer;
|
||||
int i;
|
||||
|
||||
for (win = 0; win < 0x20; ++win)
|
||||
for (win = 0; win < WINDOWS_MAX; ++win)
|
||||
{
|
||||
if ((bgLayer = gWindows[win].window.priority) == 0xFF)
|
||||
break;
|
||||
}
|
||||
|
||||
if (win == 0x20)
|
||||
if (win == WINDOWS_MAX)
|
||||
return 0xFF;
|
||||
|
||||
bgLayer = template->priority;
|
||||
@@ -199,13 +188,13 @@ int AddWindowWithoutTileMap(const struct WindowTemplate *template)
|
||||
u8 bgLayer;
|
||||
int allocatedBaseBlock;
|
||||
|
||||
for (win = 0; win < 0x20; ++win)
|
||||
for (win = 0; win < WINDOWS_MAX; ++win)
|
||||
{
|
||||
if (gWindows[win].window.priority == 0xFF)
|
||||
break;
|
||||
}
|
||||
|
||||
if (win == 0x20)
|
||||
if (win == WINDOWS_MAX)
|
||||
return 0xFF;
|
||||
|
||||
bgLayer = template->priority;
|
||||
|
||||
Reference in New Issue
Block a user