mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-27 22:03:53 +01:00
Some more trade nonsense
This commit is contained in:
parent
a5c09bfec6
commit
3f08e0c76c
1073
asm/trade.s
1073
asm/trade.s
File diff suppressed because it is too large
Load Diff
@ -17,5 +17,6 @@ u8 UpdateMonIconFrame(struct Sprite *sprite);
|
||||
void LoadMonIconPalette(u16 species);
|
||||
void sub_80D328C(struct Sprite *sprite);
|
||||
void sub_80D3014(struct Sprite *sprite);
|
||||
void sub_80D32C8(struct Sprite *sprite, u8 animNum);
|
||||
|
||||
#endif // GUARD_POKEMON_ICON_H
|
||||
|
646
src/trade.c
646
src/trade.c
@ -1,6 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "alloc.h"
|
||||
#include "battle_anim.h"
|
||||
#include "battle_interface.h"
|
||||
#include "bg.h"
|
||||
#include "cable_club.h"
|
||||
#include "data2.h"
|
||||
@ -36,8 +37,7 @@ extern struct {
|
||||
u8 unk_0;
|
||||
u8 unk_1;
|
||||
u8 filler_2[0x28 - 2];
|
||||
u8 unk_28[PARTY_SIZE];
|
||||
u8 unk_2E[PARTY_SIZE];
|
||||
u8 unk_28[2][PARTY_SIZE];
|
||||
u8 unk_34;
|
||||
u8 unk_35;
|
||||
u8 unk_36[2];
|
||||
@ -45,7 +45,8 @@ extern struct {
|
||||
u8 unk_44;
|
||||
u8 unk_45[12];
|
||||
u8 unk_51[2][PARTY_SIZE];
|
||||
u8 filler_5D[0x69 - 0x5D];
|
||||
u8 unk_5D[PARTY_SIZE];
|
||||
u8 unk_63[PARTY_SIZE];
|
||||
u8 unk_69;
|
||||
u8 filler_6A[0x6F - 0x6A];
|
||||
u8 unk_6F;
|
||||
@ -65,7 +66,12 @@ extern struct {
|
||||
u8 filler_84[0xA8 - 0x84];
|
||||
u8 unk_A8;
|
||||
u8 unk_A9[11];
|
||||
u8 filler_B4[0x8F0-0xB4];
|
||||
u8 filler_B4[0x8D0-0xB4];
|
||||
struct {
|
||||
bool8 unk_0;
|
||||
u16 unk_2;
|
||||
u8 unk_4;
|
||||
} unk_8D0[4];
|
||||
u16 tilemapBuffer[0x400]; // 8F0
|
||||
} *gUnknown_0203229C;
|
||||
extern u8 *gUnknown_02032184;
|
||||
@ -97,6 +103,10 @@ extern const u8 gText_NewLine3[];
|
||||
extern const u8 gText_FourQuestionMarks[];
|
||||
extern const u8 gUnknown_0832DE3E[][6][2];
|
||||
extern const u8 gUnknown_0832DE56[][6][2];
|
||||
extern const u8 *gUnknown_0832DEBC[];
|
||||
extern const struct SpritePalette gSpritePalette_TradeScreenText;
|
||||
extern const struct SpritePalette gUnknown_0832DC44;
|
||||
extern const struct SpriteSheet gUnknown_0832DC3C;
|
||||
|
||||
bool32 sub_8077260(void);
|
||||
void sub_80773D0(void);
|
||||
@ -121,7 +131,7 @@ void sub_8079E44(u8);
|
||||
void sub_807967C(u8);
|
||||
void sub_807A048(u16, u8);
|
||||
void sub_8079F74(void);
|
||||
u32 sub_807A5F4(struct Pokemon *, u8, u8);
|
||||
u32 sub_807A5F4(struct Pokemon *, int, int);
|
||||
void sub_8079F88(u8);
|
||||
u32 sub_807A09C(void);
|
||||
u8 sub_8079A3C(u8 *, bool8, u8);
|
||||
@ -392,7 +402,7 @@ void sub_80773D0(void)
|
||||
for (i = 0; i < gUnknown_0203229C->unk_36[0]; i++)
|
||||
{
|
||||
struct Pokemon *mon = &gPlayerParty[i];
|
||||
gUnknown_0203229C->unk_28[i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2),
|
||||
gUnknown_0203229C->unk_28[0][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2),
|
||||
sub_80D3014,
|
||||
(gUnknown_0832DE24[i][0] * 8) + 14,
|
||||
(gUnknown_0832DE24[i][1] * 8) - 12,
|
||||
@ -404,7 +414,7 @@ void sub_80773D0(void)
|
||||
for (i = 0; i < gUnknown_0203229C->unk_36[1]; i++)
|
||||
{
|
||||
struct Pokemon *mon = &gEnemyParty[i];
|
||||
gUnknown_0203229C->unk_2E[i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2, NULL),
|
||||
gUnknown_0203229C->unk_28[1][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2, NULL),
|
||||
sub_80D3014,
|
||||
(gUnknown_0832DE24[i + PARTY_SIZE][0] * 8) + 14,
|
||||
(gUnknown_0832DE24[i + PARTY_SIZE][1] * 8) - 12,
|
||||
@ -416,11 +426,11 @@ void sub_80773D0(void)
|
||||
break;
|
||||
case 8:
|
||||
sub_81B5D30();
|
||||
sub_81B5D4C(&gUnknown_0203229C->unk_36[0], gUnknown_0203229C->unk_28, 0);
|
||||
sub_81B5D4C(&gUnknown_0203229C->unk_36[0], gUnknown_0203229C->unk_28[0], 0);
|
||||
gMain.state++;
|
||||
break;
|
||||
case 9:
|
||||
sub_81B5D4C(&gUnknown_0203229C->unk_36[0], gUnknown_0203229C->unk_28, 1);
|
||||
sub_81B5D4C(&gUnknown_0203229C->unk_36[0], gUnknown_0203229C->unk_28[0], 1);
|
||||
gMain.state++;
|
||||
break;
|
||||
case 10:
|
||||
@ -578,7 +588,7 @@ void sub_8077B74(void)
|
||||
for (i = 0; i < gUnknown_0203229C->unk_36[0]; i++)
|
||||
{
|
||||
struct Pokemon *mon = &gPlayerParty[i];
|
||||
gUnknown_0203229C->unk_28[i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2, NULL),
|
||||
gUnknown_0203229C->unk_28[0][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2, NULL),
|
||||
sub_80D3014,
|
||||
(gUnknown_0832DE24[i][0] * 8) + 14,
|
||||
(gUnknown_0832DE24[i][1] * 8) - 12,
|
||||
@ -590,7 +600,7 @@ void sub_8077B74(void)
|
||||
for (i = 0; i < gUnknown_0203229C->unk_36[1]; i++)
|
||||
{
|
||||
struct Pokemon *mon = &gEnemyParty[i];
|
||||
gUnknown_0203229C->unk_2E[i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2, NULL),
|
||||
gUnknown_0203229C->unk_28[1][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2, NULL),
|
||||
sub_80D3014,
|
||||
(gUnknown_0832DE24[i + PARTY_SIZE][0] * 8) + 14,
|
||||
(gUnknown_0832DE24[i + PARTY_SIZE][1] * 8) - 12,
|
||||
@ -602,11 +612,11 @@ void sub_8077B74(void)
|
||||
break;
|
||||
case 8:
|
||||
sub_81B5D30();
|
||||
sub_81B5D4C(&gUnknown_0203229C->unk_36[0], gUnknown_0203229C->unk_28, 0);
|
||||
sub_81B5D4C(&gUnknown_0203229C->unk_36[0], gUnknown_0203229C->unk_28[0], 0);
|
||||
gMain.state++;
|
||||
break;
|
||||
case 9:
|
||||
sub_81B5D4C(&gUnknown_0203229C->unk_36[0], gUnknown_0203229C->unk_28, 1);
|
||||
sub_81B5D4C(&gUnknown_0203229C->unk_36[0], gUnknown_0203229C->unk_28[0], 1);
|
||||
gMain.state++;
|
||||
break;
|
||||
case 10:
|
||||
@ -832,7 +842,7 @@ void sub_8078388(void)
|
||||
{
|
||||
if (i < gUnknown_0203229C->unk_36[0])
|
||||
{
|
||||
gSprites[gUnknown_0203229C->unk_28[i]].invisible = FALSE;
|
||||
gSprites[gUnknown_0203229C->unk_28[0][i]].invisible = FALSE;
|
||||
gUnknown_0203229C->unk_38[i] = TRUE;
|
||||
}
|
||||
else
|
||||
@ -842,7 +852,7 @@ void sub_8078388(void)
|
||||
|
||||
if (i < gUnknown_0203229C->unk_36[1])
|
||||
{
|
||||
gSprites[gUnknown_0203229C->unk_2E[i]].invisible = FALSE;
|
||||
gSprites[gUnknown_0203229C->unk_28[1][i]].invisible = FALSE;
|
||||
gUnknown_0203229C->unk_38[i + PARTY_SIZE] = TRUE;
|
||||
}
|
||||
else
|
||||
@ -1966,7 +1976,7 @@ void sub_80796B4(u8 a0)
|
||||
case 1:
|
||||
for (i = 0; i < gUnknown_0203229C->unk_36[a0]; i++)
|
||||
{
|
||||
gSprites[gUnknown_0203229C->unk_28[i + (sp60 * 6)]].invisible = TRUE;
|
||||
gSprites[gUnknown_0203229C->unk_28[0][i + (sp60 * 6)]].invisible = TRUE;
|
||||
}
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
@ -1974,13 +1984,13 @@ void sub_80796B4(u8 a0)
|
||||
ClearWindowTilemap(i + (a0 * 6 + 2));
|
||||
}
|
||||
|
||||
gSprites[gUnknown_0203229C->unk_28[r10 + (sp60 * 6)]].invisible = FALSE;
|
||||
gSprites[gUnknown_0203229C->unk_28[r10 + (sp60 * 6)]].data[0] = 20;
|
||||
gSprites[gUnknown_0203229C->unk_28[r10 + (sp60 * 6)]].data[2] = (gUnknown_0832DE24[sp60 * 6][0] + gUnknown_0832DE24[sp60 * 6 + 1][0]) / 2 * 8 + 14;
|
||||
gSprites[gUnknown_0203229C->unk_28[r10 + (sp60 * 6)]].data[4] = (gUnknown_0832DE24[sp60 * 6][1] * 8) - 12;
|
||||
StoreSpriteCallbackInData6(&gSprites[gUnknown_0203229C->unk_28[r10 + (sp60 * 6)]], sub_80D3014);
|
||||
gSprites[gUnknown_0203229C->unk_28[0][r10 + (sp60 * 6)]].invisible = FALSE;
|
||||
gSprites[gUnknown_0203229C->unk_28[0][r10 + (sp60 * 6)]].data[0] = 20;
|
||||
gSprites[gUnknown_0203229C->unk_28[0][r10 + (sp60 * 6)]].data[2] = (gUnknown_0832DE24[sp60 * 6][0] + gUnknown_0832DE24[sp60 * 6 + 1][0]) / 2 * 8 + 14;
|
||||
gSprites[gUnknown_0203229C->unk_28[0][r10 + (sp60 * 6)]].data[4] = (gUnknown_0832DE24[sp60 * 6][1] * 8) - 12;
|
||||
StoreSpriteCallbackInData6(&gSprites[gUnknown_0203229C->unk_28[0][r10 + (sp60 * 6)]], sub_80D3014);
|
||||
gUnknown_0203229C->unk_74[a0]++;
|
||||
sub_80A6DEC(&gSprites[gUnknown_0203229C->unk_28[r10 + (sp60 * 6)]]);
|
||||
sub_80A6DEC(&gSprites[gUnknown_0203229C->unk_28[0][r10 + (sp60 * 6)]]);
|
||||
CopyToBgTilemapBufferRect_ChangePalette(1, gTradePartyBoxTilemap, a0 * 15, 0, 15, 17, 0);
|
||||
CopyBgTilemapBufferToVram(1);
|
||||
CopyBgTilemapBufferToVram(0);
|
||||
@ -1991,7 +2001,7 @@ void sub_80796B4(u8 a0)
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (gSprites[gUnknown_0203229C->unk_28[r10 + (sp60 * 6)]].callback == sub_80D3014)
|
||||
if (gSprites[gUnknown_0203229C->unk_28[0][r10 + (sp60 * 6)]].callback == sub_80D3014)
|
||||
{
|
||||
gUnknown_0203229C->unk_74[a0] = 3;
|
||||
}
|
||||
@ -1999,10 +2009,10 @@ void sub_80796B4(u8 a0)
|
||||
case 3:
|
||||
CopyToBgTilemapBufferRect_ChangePalette(1, gTradeMovesBoxTilemap, sp60 * 15, 0, 15, 17, 0);
|
||||
CopyBgTilemapBufferToVram(1);
|
||||
gSprites[gUnknown_0203229C->unk_28[r10 + (sp60 * 6)]].pos1.x = (gUnknown_0832DE24[sp60 * 6][0] + gUnknown_0832DE24[sp60 * 6 + 1][0]) / 2 * 8 + 14;
|
||||
gSprites[gUnknown_0203229C->unk_28[r10 + (sp60 * 6)]].pos1.y = (gUnknown_0832DE24[sp60 * 6][1] * 8) - 12;
|
||||
gSprites[gUnknown_0203229C->unk_28[r10 + (sp60 * 6)]].pos2.x = 0;
|
||||
gSprites[gUnknown_0203229C->unk_28[r10 + (sp60 * 6)]].pos2.y = 0;
|
||||
gSprites[gUnknown_0203229C->unk_28[0][r10 + (sp60 * 6)]].pos1.x = (gUnknown_0832DE24[sp60 * 6][0] + gUnknown_0832DE24[sp60 * 6 + 1][0]) / 2 * 8 + 14;
|
||||
gSprites[gUnknown_0203229C->unk_28[0][r10 + (sp60 * 6)]].pos1.y = (gUnknown_0832DE24[sp60 * 6][1] * 8) - 12;
|
||||
gSprites[gUnknown_0203229C->unk_28[0][r10 + (sp60 * 6)]].pos2.x = 0;
|
||||
gSprites[gUnknown_0203229C->unk_28[0][r10 + (sp60 * 6)]].pos2.y = 0;
|
||||
test = sub_8079A3C(sp14, sp60, r10);
|
||||
AddTextPrinterParameterized3((a0 * 2) + 14, 0, (80 - test) / 2, 4, gUnknown_0832DEE0, 0, sp14);
|
||||
sub_8079AA4(sp28, sp60, r10);
|
||||
@ -2594,6 +2604,8 @@ void sub_8079C4C(u8 a0, u8 a1, u8 a2, u8 a3, u8 a4, u8 a5)
|
||||
gUnknown_0203229C->tilemapBuffer[(a3 - 1) * 32 + a2 + 1] = r2;
|
||||
}
|
||||
|
||||
// Very close but loop preamble not working.
|
||||
#ifdef NONMATCHING
|
||||
void sub_8079E44(u8 a0)
|
||||
{
|
||||
int i;
|
||||
@ -2603,3 +2615,583 @@ void sub_8079E44(u8 a0)
|
||||
sub_8079C4C(a0, i, gUnknown_0832DE3E[a0][i][0], gUnknown_0832DE3E[a0][i][1], gUnknown_0832DE56[a0][i][0], gUnknown_0832DE56[a0][i][1]);
|
||||
}
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_8079E44(u8 a0)
|
||||
{
|
||||
asm_unified("push {r4-r7,lr}\n\
|
||||
sub sp, 0x8\n\
|
||||
lsls r0, 24\n\
|
||||
lsrs r6, r0, 24\n\
|
||||
movs r7, 0\n\
|
||||
ldr r0, =gUnknown_0203229C\n\
|
||||
ldr r0, [r0]\n\
|
||||
adds r0, 0x36\n\
|
||||
adds r0, r6\n\
|
||||
ldrb r0, [r0]\n\
|
||||
cmp r7, r0\n\
|
||||
bge _08079E94\n\
|
||||
lsls r0, r6, 1\n\
|
||||
adds r0, r6\n\
|
||||
ldr r1, =gUnknown_0832DE3E\n\
|
||||
lsls r0, 2\n\
|
||||
adds r5, r0, r1\n\
|
||||
ldr r1, =gUnknown_0832DE56\n\
|
||||
adds r4, r0, r1\n\
|
||||
_08079E6A:\n\
|
||||
lsls r1, r7, 24\n\
|
||||
lsrs r1, 24\n\
|
||||
ldrb r2, [r5]\n\
|
||||
ldrb r3, [r5, 0x1]\n\
|
||||
ldrb r0, [r4]\n\
|
||||
str r0, [sp]\n\
|
||||
ldrb r0, [r4, 0x1]\n\
|
||||
str r0, [sp, 0x4]\n\
|
||||
adds r0, r6, 0\n\
|
||||
bl sub_8079C4C\n\
|
||||
adds r5, 0x2\n\
|
||||
adds r4, 0x2\n\
|
||||
adds r7, 0x1\n\
|
||||
ldr r0, =gUnknown_0203229C\n\
|
||||
ldr r0, [r0]\n\
|
||||
adds r0, 0x36\n\
|
||||
adds r0, r6\n\
|
||||
ldrb r0, [r0]\n\
|
||||
cmp r7, r0\n\
|
||||
blt _08079E6A\n\
|
||||
_08079E94:\n\
|
||||
add sp, 0x8\n\
|
||||
pop {r4-r7}\n\
|
||||
pop {r0}\n\
|
||||
bx r0\n\
|
||||
.pool");
|
||||
}
|
||||
#endif // NONMATCHING
|
||||
|
||||
void sub_8079EA8(u8 a0)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < gUnknown_0203229C->unk_36[a0]; i++)
|
||||
{
|
||||
gSprites[gUnknown_0203229C->unk_28[a0][i]].invisible = FALSE;
|
||||
gSprites[gUnknown_0203229C->unk_28[a0][i]].pos1.x = gUnknown_0832DE24[(a0 * 6) + i][0] * 8 + 14;
|
||||
gSprites[gUnknown_0203229C->unk_28[a0][i]].pos1.y = gUnknown_0832DE24[(a0 * 6) + i][1] * 8 - 12;
|
||||
gSprites[gUnknown_0203229C->unk_28[a0][i]].pos2.x = 0;
|
||||
gSprites[gUnknown_0203229C->unk_28[a0][i]].pos2.y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_8079F74(void)
|
||||
{
|
||||
rbox_fill_rectangle(1);
|
||||
sub_8079BE0(1);
|
||||
}
|
||||
|
||||
void sub_8079F88(u8 a0)
|
||||
{
|
||||
CopyToBgTilemapBufferRect_ChangePalette(1, gTradePartyBoxTilemap, a0 * 15, 0, 15, 17, 0);
|
||||
CopyBgTilemapBufferToVram(1);
|
||||
sub_8079E44(a0);
|
||||
sub_8079BE0(a0);
|
||||
sub_8079EA8(a0);
|
||||
sub_807A308(gUnknown_0832DE94[1], (void *)(OBJ_VRAM0 + (gUnknown_0203229C->unk_72 * 32)), 24);
|
||||
gUnknown_0203229C->unk_74[a0] = 0;
|
||||
}
|
||||
|
||||
void sub_807A000(void)
|
||||
{
|
||||
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20);
|
||||
CopyBgTilemapBufferToVram(0);
|
||||
}
|
||||
|
||||
void sub_807A024(void)
|
||||
{
|
||||
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20);
|
||||
CopyBgTilemapBufferToVram(0);
|
||||
}
|
||||
|
||||
void sub_807A048(u16 a0, u8 a1)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (!gUnknown_0203229C->unk_8D0[i].unk_0)
|
||||
{
|
||||
gUnknown_0203229C->unk_8D0[i].unk_2 = a0;
|
||||
gUnknown_0203229C->unk_8D0[i].unk_4 = a1;
|
||||
gUnknown_0203229C->unk_8D0[i].unk_0 = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_807A09C(void)
|
||||
{
|
||||
u32 acc = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
acc += gUnknown_0203229C->unk_8D0[i].unk_0;
|
||||
}
|
||||
|
||||
return acc;
|
||||
}
|
||||
|
||||
void sub_807A0C4(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (gUnknown_0203229C->unk_8D0[i].unk_0)
|
||||
{
|
||||
if (gUnknown_0203229C->unk_8D0[i].unk_2)
|
||||
{
|
||||
gUnknown_0203229C->unk_8D0[i].unk_2--;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (gUnknown_0203229C->unk_8D0[i].unk_4)
|
||||
{
|
||||
case 0:
|
||||
sub_8077170(gUnknown_0203229C->unk_80, 20);
|
||||
break;
|
||||
case 1:
|
||||
sub_807A19C(0);
|
||||
break;
|
||||
case 2:
|
||||
sub_807A19C(2);
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
sub_807A19C(3);
|
||||
break;
|
||||
case 6:
|
||||
sub_807A19C(6);
|
||||
break;
|
||||
case 7:
|
||||
sub_807A19C(7);
|
||||
break;
|
||||
case 8:
|
||||
sub_807A19C(8);
|
||||
break;
|
||||
}
|
||||
gUnknown_0203229C->unk_8D0[i].unk_0 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_807A19C(u8 a0)
|
||||
{
|
||||
FillWindowPixelBuffer(0, 0x11);
|
||||
AddTextPrinterParameterized(0, 1, gUnknown_0832DEBC[a0], 0, 1, TEXT_SPEED_FF, NULL);
|
||||
sub_8098858(0, 20, 12);
|
||||
PutWindowTilemap(0);
|
||||
CopyWindowToVram(0, 3);
|
||||
}
|
||||
|
||||
bool8 sub_807A1F0(void)
|
||||
{
|
||||
struct SpriteSheet sheet;
|
||||
|
||||
if (gUnknown_0203229C->unk_A8 < 14)
|
||||
{
|
||||
sheet.data = gUnknown_02032188[gUnknown_0203229C->unk_A8];
|
||||
sheet.size = 0x100;
|
||||
sheet.tag = 200 + gUnknown_0203229C->unk_A8;
|
||||
}
|
||||
|
||||
switch (gUnknown_0203229C->unk_A8)
|
||||
{
|
||||
case 0 ... 7:
|
||||
LoadSpriteSheet(&sheet);
|
||||
gUnknown_0203229C->unk_A8++;
|
||||
break;
|
||||
case 8:
|
||||
gUnknown_0203229C->unk_72 = LoadSpriteSheet(&sheet);
|
||||
gUnknown_0203229C->unk_A8++;
|
||||
break;
|
||||
case 9 ... 13:
|
||||
LoadSpriteSheet(&sheet);
|
||||
gUnknown_0203229C->unk_A8++;
|
||||
break;
|
||||
case 14:
|
||||
LoadSpritePalette(&gSpritePalette_TradeScreenText);
|
||||
gUnknown_0203229C->unk_A8++;
|
||||
break;
|
||||
case 15:
|
||||
LoadSpritePalette(&gUnknown_0832DC44);
|
||||
gUnknown_0203229C->unk_A8++;
|
||||
break;
|
||||
case 16:
|
||||
LoadSpriteSheet(&gUnknown_0832DC3C);
|
||||
gUnknown_0203229C->unk_A8++;
|
||||
break;
|
||||
case 17:
|
||||
gUnknown_0203229C->unk_A8 = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void sub_807A308(const u8 *a0, u8 *a1, u8 unused)
|
||||
{
|
||||
sub_80C6D80(a0, a1, 0, 0, 6);
|
||||
}
|
||||
|
||||
#ifdef NONMATCHING
|
||||
void sub_807A320(u8 a0)
|
||||
{
|
||||
int i;
|
||||
|
||||
switch (a0)
|
||||
{
|
||||
case 0:
|
||||
for (i = 0; i < gUnknown_0203229C->unk_36[a0]; i++)
|
||||
{
|
||||
if (GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG) == TRUE)
|
||||
{
|
||||
gUnknown_0203229C->unk_45[i] = 0;
|
||||
gUnknown_0203229C->unk_51[0][i] = 1;
|
||||
}
|
||||
else if (GetMonData(&gPlayerParty[i], MON_DATA_HP) == 0)
|
||||
{
|
||||
gUnknown_0203229C->unk_45[i] = 0;
|
||||
gUnknown_0203229C->unk_51[0][i] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
gUnknown_0203229C->unk_45[i] = 1;
|
||||
gUnknown_0203229C->unk_51[0][i] = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
for (i = 0; i < gUnknown_0203229C->unk_36[a0]; i++)
|
||||
{
|
||||
if (GetMonData(&gEnemyParty[i], MON_DATA_IS_EGG) == TRUE)
|
||||
{
|
||||
gUnknown_0203229C->unk_45[i + 6] = 0;
|
||||
gUnknown_0203229C->unk_51[1][i] = 1;
|
||||
}
|
||||
else if (GetMonData(&gEnemyParty[i], MON_DATA_HP) == 0)
|
||||
{
|
||||
gUnknown_0203229C->unk_45[i + 6] = 0;
|
||||
gUnknown_0203229C->unk_51[1][i] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
gUnknown_0203229C->unk_45[i + 6] = 1;
|
||||
gUnknown_0203229C->unk_51[1][i] = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_807A320(u8 a0)
|
||||
{
|
||||
asm_unified("push {r4-r7,lr}\n\
|
||||
mov r7, r9\n\
|
||||
mov r6, r8\n\
|
||||
push {r6,r7}\n\
|
||||
lsls r0, 24\n\
|
||||
lsrs r0, 24\n\
|
||||
mov r8, r0\n\
|
||||
cmp r0, 0\n\
|
||||
beq _0807A338\n\
|
||||
cmp r0, 0x1\n\
|
||||
beq _0807A3CC\n\
|
||||
b _0807A458\n\
|
||||
_0807A338:\n\
|
||||
movs r7, 0\n\
|
||||
ldr r1, =gUnknown_0203229C\n\
|
||||
ldr r0, [r1]\n\
|
||||
adds r0, 0x36\n\
|
||||
ldrb r0, [r0]\n\
|
||||
cmp r7, r0\n\
|
||||
blt _0807A348\n\
|
||||
b _0807A458\n\
|
||||
_0807A348:\n\
|
||||
adds r6, r1, 0\n\
|
||||
movs r5, 0\n\
|
||||
mov r9, r5\n\
|
||||
_0807A34E:\n\
|
||||
movs r0, 0x64\n\
|
||||
adds r1, r7, 0\n\
|
||||
muls r1, r0\n\
|
||||
ldr r0, =gPlayerParty\n\
|
||||
adds r4, r1, r0\n\
|
||||
adds r0, r4, 0\n\
|
||||
movs r1, 0x2D\n\
|
||||
bl GetMonData\n\
|
||||
adds r1, r0, 0\n\
|
||||
cmp r1, 0x1\n\
|
||||
bne _0807A380\n\
|
||||
ldr r0, [r6]\n\
|
||||
adds r0, 0x45\n\
|
||||
adds r0, r5\n\
|
||||
mov r2, r9\n\
|
||||
strb r2, [r0]\n\
|
||||
ldr r0, [r6]\n\
|
||||
adds r0, 0x51\n\
|
||||
adds r0, r5\n\
|
||||
b _0807A3B0\n\
|
||||
.pool\n\
|
||||
_0807A380:\n\
|
||||
adds r0, r4, 0\n\
|
||||
movs r1, 0x39\n\
|
||||
bl GetMonData\n\
|
||||
adds r1, r0, 0\n\
|
||||
cmp r1, 0\n\
|
||||
bne _0807A39E\n\
|
||||
ldr r0, [r6]\n\
|
||||
adds r0, 0x45\n\
|
||||
adds r0, r5\n\
|
||||
strb r1, [r0]\n\
|
||||
ldr r0, [r6]\n\
|
||||
adds r0, 0x51\n\
|
||||
adds r0, r5\n\
|
||||
b _0807A3B0\n\
|
||||
_0807A39E:\n\
|
||||
ldr r0, [r6]\n\
|
||||
adds r0, 0x45\n\
|
||||
adds r0, r5\n\
|
||||
movs r1, 0x1\n\
|
||||
strb r1, [r0]\n\
|
||||
ldr r0, [r6]\n\
|
||||
adds r0, 0x51\n\
|
||||
adds r0, r5\n\
|
||||
mov r1, r9\n\
|
||||
_0807A3B0:\n\
|
||||
strb r1, [r0]\n\
|
||||
ldr r0, =gUnknown_0203229C\n\
|
||||
adds r5, 0x1\n\
|
||||
adds r7, 0x1\n\
|
||||
ldr r0, [r0]\n\
|
||||
adds r0, 0x36\n\
|
||||
add r0, r8\n\
|
||||
ldrb r0, [r0]\n\
|
||||
cmp r7, r0\n\
|
||||
blt _0807A34E\n\
|
||||
b _0807A458\n\
|
||||
.pool\n\
|
||||
_0807A3CC:\n\
|
||||
movs r7, 0\n\
|
||||
ldr r1, =gUnknown_0203229C\n\
|
||||
ldr r0, [r1]\n\
|
||||
adds r0, 0x37\n\
|
||||
ldrb r0, [r0]\n\
|
||||
cmp r7, r0\n\
|
||||
bge _0807A458\n\
|
||||
adds r6, r1, 0\n\
|
||||
movs r5, 0x6\n\
|
||||
movs r2, 0\n\
|
||||
mov r9, r2\n\
|
||||
_0807A3E2:\n\
|
||||
movs r0, 0x64\n\
|
||||
adds r1, r7, 0\n\
|
||||
muls r1, r0\n\
|
||||
ldr r0, =gEnemyParty\n\
|
||||
adds r4, r1, r0\n\
|
||||
adds r0, r4, 0\n\
|
||||
movs r1, 0x2D\n\
|
||||
bl GetMonData\n\
|
||||
adds r1, r0, 0\n\
|
||||
cmp r1, 0x1\n\
|
||||
bne _0807A414\n\
|
||||
ldr r0, [r6]\n\
|
||||
adds r0, 0x45\n\
|
||||
adds r0, r5\n\
|
||||
mov r2, r9\n\
|
||||
strb r2, [r0]\n\
|
||||
ldr r0, [r6]\n\
|
||||
adds r0, 0x51\n\
|
||||
adds r0, r5\n\
|
||||
b _0807A444\n\
|
||||
.pool\n\
|
||||
_0807A414:\n\
|
||||
adds r0, r4, 0\n\
|
||||
movs r1, 0x39\n\
|
||||
bl GetMonData\n\
|
||||
adds r1, r0, 0\n\
|
||||
cmp r1, 0\n\
|
||||
bne _0807A432\n\
|
||||
ldr r0, [r6]\n\
|
||||
adds r0, 0x45\n\
|
||||
adds r0, r5\n\
|
||||
strb r1, [r0]\n\
|
||||
ldr r0, [r6]\n\
|
||||
adds r0, 0x51\n\
|
||||
adds r0, r5\n\
|
||||
b _0807A444\n\
|
||||
_0807A432:\n\
|
||||
ldr r0, [r6]\n\
|
||||
adds r0, 0x45\n\
|
||||
adds r0, r5\n\
|
||||
movs r1, 0x1\n\
|
||||
strb r1, [r0]\n\
|
||||
ldr r0, [r6]\n\
|
||||
adds r0, 0x51\n\
|
||||
adds r0, r5\n\
|
||||
mov r1, r9\n\
|
||||
_0807A444:\n\
|
||||
strb r1, [r0]\n\
|
||||
ldr r0, =gUnknown_0203229C\n\
|
||||
adds r5, 0x1\n\
|
||||
adds r7, 0x1\n\
|
||||
ldr r0, [r0]\n\
|
||||
adds r0, 0x36\n\
|
||||
add r0, r8\n\
|
||||
ldrb r0, [r0]\n\
|
||||
cmp r7, r0\n\
|
||||
blt _0807A3E2\n\
|
||||
_0807A458:\n\
|
||||
pop {r3,r4}\n\
|
||||
mov r8, r3\n\
|
||||
mov r9, r4\n\
|
||||
pop {r4-r7}\n\
|
||||
pop {r0}\n\
|
||||
bx r0\n\
|
||||
.pool");
|
||||
}
|
||||
#endif // NONMATCHING
|
||||
|
||||
void sub_807A468(u8 a0)
|
||||
{
|
||||
u16 i, hp, maxHp;
|
||||
|
||||
switch (a0)
|
||||
{
|
||||
case 0:
|
||||
for (i = 0; i < gUnknown_0203229C->unk_36[0]; i++)
|
||||
{
|
||||
hp = GetMonData(&gPlayerParty[i], MON_DATA_HP);
|
||||
maxHp = GetMonData(&gPlayerParty[i], MON_DATA_MAX_HP);
|
||||
gUnknown_0203229C->unk_5D[i] = GetHPBarLevel(hp, maxHp);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
for (i = 0; i < gUnknown_0203229C->unk_36[1]; i++)
|
||||
{
|
||||
hp = GetMonData(&gEnemyParty[i], MON_DATA_HP);
|
||||
maxHp = GetMonData(&gEnemyParty[i], MON_DATA_MAX_HP);
|
||||
gUnknown_0203229C->unk_63[i] = GetHPBarLevel(hp, maxHp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_807A53C(void)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
for (j = 0; j < gUnknown_0203229C->unk_36[i]; j++)
|
||||
{
|
||||
sub_80D32C8(&gSprites[gUnknown_0203229C->unk_28[i][j]], 4 - gUnknown_0203229C->unk_5D[i * 6 + j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_807A5B0(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 11; i++)
|
||||
{
|
||||
if (gSaveBlock1Ptr->giftRibbons[i] == 0 && gUnknown_0203229C->unk_A9[i] != 0)
|
||||
{
|
||||
if (gUnknown_0203229C->unk_A9[i] < 64)
|
||||
{
|
||||
gSaveBlock1Ptr->giftRibbons[i] = gUnknown_0203229C->unk_A9[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_807A5F4(struct Pokemon *a0, int a1, int a2)
|
||||
{
|
||||
int i, sum;
|
||||
struct LinkPlayer *player;
|
||||
u32 species[6];
|
||||
u32 species2[6];
|
||||
|
||||
for (i = 0; i < a1; i++)
|
||||
{
|
||||
species2[i] = GetMonData(&a0[i], MON_DATA_SPECIES2);
|
||||
species[i] = GetMonData(&a0[i], MON_DATA_SPECIES);
|
||||
}
|
||||
|
||||
if (!IsNationalPokedexEnabled())
|
||||
{
|
||||
if (species2[a2] == SPECIES_EGG)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
if (!IsSpeciesInHoennDex(species2[a2]))
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
player = &gLinkPlayers[GetMultiplayerId() ^ 1];
|
||||
if ((player->version & 0xFF) != VERSION_RUBY &&
|
||||
(player->version & 0xFF) != VERSION_SAPPHIRE)
|
||||
{
|
||||
if ((player->name[10] & 0xF) == 0)
|
||||
{
|
||||
if (species2[a2] == SPECIES_EGG)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
if (!IsSpeciesInHoennDex(species2[a2]))
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (species[a2] == SPECIES_DEOXYS || species[a2] == SPECIES_MEW)
|
||||
{
|
||||
if (!GetMonData(&a0[a2], MON_DATA_OBEDIENCE))
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < a1; i++)
|
||||
{
|
||||
if (species2[i] == SPECIES_EGG)
|
||||
{
|
||||
species2[i] = SPECIES_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
for (sum = 0, i = 0; i < a1; i++)
|
||||
{
|
||||
if (i != a2)
|
||||
{
|
||||
sum += species2[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (sum != 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user