mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
S'more trade
This commit is contained in:
parent
a39783a637
commit
a5c09bfec6
344
asm/trade.s
344
asm/trade.s
@ -6,350 +6,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_8079BE0
|
||||
sub_8079BE0: @ 8079BE0
|
||||
push {r4-r7,lr}
|
||||
sub sp, 0x34
|
||||
lsls r0, 24
|
||||
lsrs r6, r0, 24
|
||||
ldr r7, =gEnemyParty
|
||||
cmp r6, 0
|
||||
bne _08079BF0
|
||||
ldr r7, =gPlayerParty
|
||||
_08079BF0:
|
||||
movs r4, 0
|
||||
ldr r0, =gUnknown_0203229C
|
||||
ldr r0, [r0]
|
||||
adds r0, 0x36
|
||||
adds r0, r6
|
||||
ldrb r0, [r0]
|
||||
cmp r4, r0
|
||||
bcs _08079C36
|
||||
add r5, sp, 0x14
|
||||
_08079C02:
|
||||
movs r0, 0x64
|
||||
muls r0, r4
|
||||
adds r0, r7, r0
|
||||
movs r1, 0x2
|
||||
mov r2, sp
|
||||
bl GetMonData
|
||||
adds r0, r5, 0
|
||||
mov r1, sp
|
||||
bl StringCopy10
|
||||
adds r0, r6, 0
|
||||
adds r1, r4, 0
|
||||
adds r2, r5, 0
|
||||
bl sub_8079B84
|
||||
adds r0, r4, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
ldr r0, =gUnknown_0203229C
|
||||
ldr r0, [r0]
|
||||
adds r0, 0x36
|
||||
adds r0, r6
|
||||
ldrb r0, [r0]
|
||||
cmp r4, r0
|
||||
bcc _08079C02
|
||||
_08079C36:
|
||||
add sp, 0x34
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_8079BE0
|
||||
|
||||
thumb_func_start sub_8079C4C
|
||||
sub_8079C4C: @ 8079C4C
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0x1C
|
||||
ldr r4, [sp, 0x3C]
|
||||
ldr r5, [sp, 0x40]
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
mov r8, r0
|
||||
lsls r1, 24
|
||||
lsrs r7, r1, 24
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
mov r9, r2
|
||||
lsls r3, 24
|
||||
lsrs r3, 24
|
||||
mov r10, r3
|
||||
lsls r4, 24
|
||||
lsrs r4, 24
|
||||
lsls r5, 24
|
||||
lsrs r5, 24
|
||||
ldr r1, =gUnknown_08DDD704
|
||||
movs r0, 0x6
|
||||
str r0, [sp]
|
||||
movs r0, 0x3
|
||||
str r0, [sp, 0x4]
|
||||
movs r0, 0
|
||||
str r0, [sp, 0x8]
|
||||
movs r0, 0x1
|
||||
adds r2, r4, 0
|
||||
adds r3, r5, 0
|
||||
bl CopyToBgTilemapBufferRect_ChangePalette
|
||||
movs r0, 0x1
|
||||
bl CopyBgTilemapBufferToVram
|
||||
mov r0, r8
|
||||
cmp r0, 0
|
||||
bne _08079CB0
|
||||
movs r0, 0x64
|
||||
muls r0, r7
|
||||
ldr r1, =gPlayerParty
|
||||
b _08079CB6
|
||||
.pool
|
||||
_08079CB0:
|
||||
movs r0, 0x64
|
||||
muls r0, r7
|
||||
ldr r1, =gEnemyParty
|
||||
_08079CB6:
|
||||
adds r0, r1
|
||||
movs r1, 0x38
|
||||
movs r2, 0
|
||||
bl GetMonData
|
||||
lsls r0, 24
|
||||
lsrs r6, r0, 24
|
||||
ldr r4, =gUnknown_0203229C
|
||||
ldr r5, [r4]
|
||||
mov r1, r8
|
||||
lsls r2, r1, 1
|
||||
adds r1, r2, r1
|
||||
lsls r1, 1
|
||||
adds r1, r7, r1
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x51
|
||||
adds r0, r1
|
||||
ldrb r0, [r0]
|
||||
str r2, [sp, 0x18]
|
||||
cmp r0, 0
|
||||
bne _08079D34
|
||||
adds r0, r6, 0
|
||||
movs r1, 0xA
|
||||
bl __udivsi3
|
||||
lsls r0, 24
|
||||
lsrs r2, r0, 24
|
||||
mov r0, r10
|
||||
lsls r3, r0, 5
|
||||
cmp r2, 0
|
||||
beq _08079D08
|
||||
mov r1, r9
|
||||
adds r0, r1, r3
|
||||
lsls r0, 1
|
||||
movs r1, 0x8F
|
||||
lsls r1, 4
|
||||
adds r5, r1
|
||||
adds r1, r5, r0
|
||||
adds r0, r2, 0
|
||||
adds r0, 0x60
|
||||
strh r0, [r1]
|
||||
_08079D08:
|
||||
ldr r4, [r4]
|
||||
mov r1, r9
|
||||
adds r0, r1, r3
|
||||
adds r0, 0x1
|
||||
lsls r0, 1
|
||||
movs r3, 0x8F
|
||||
lsls r3, 4
|
||||
adds r4, r3
|
||||
adds r4, r0
|
||||
adds r0, r6, 0
|
||||
movs r1, 0xA
|
||||
bl __umodsi3
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
adds r0, 0x70
|
||||
strh r0, [r4]
|
||||
b _08079D72
|
||||
.pool
|
||||
_08079D34:
|
||||
mov r1, r10
|
||||
lsls r0, r1, 5
|
||||
mov r1, r9
|
||||
adds r3, r1, r0
|
||||
adds r1, r3, 0
|
||||
subs r1, 0x20
|
||||
lsls r1, 1
|
||||
movs r0, 0x8F
|
||||
lsls r0, 4
|
||||
adds r2, r5, r0
|
||||
adds r1, r2, r1
|
||||
adds r0, r3, 0
|
||||
subs r0, 0x21
|
||||
lsls r0, 1
|
||||
adds r0, r2, r0
|
||||
ldrh r0, [r0]
|
||||
strh r0, [r1]
|
||||
adds r1, r3, 0
|
||||
subs r1, 0x1F
|
||||
lsls r1, 1
|
||||
adds r1, r2, r1
|
||||
adds r0, r3, 0
|
||||
subs r0, 0x24
|
||||
lsls r0, 1
|
||||
adds r2, r0
|
||||
ldrh r2, [r2]
|
||||
movs r3, 0x80
|
||||
lsls r3, 3
|
||||
adds r0, r3, 0
|
||||
orrs r0, r2
|
||||
strh r0, [r1]
|
||||
_08079D72:
|
||||
ldr r0, =gUnknown_0203229C
|
||||
ldr r1, [r0]
|
||||
ldr r0, [sp, 0x18]
|
||||
add r0, r8
|
||||
lsls r0, 1
|
||||
adds r0, r7, r0
|
||||
adds r1, 0x51
|
||||
adds r1, r0
|
||||
ldrb r0, [r1]
|
||||
cmp r0, 0
|
||||
beq _08079D94
|
||||
movs r2, 0x90
|
||||
lsls r2, 3
|
||||
b _08079E16
|
||||
.pool
|
||||
_08079D94:
|
||||
mov r0, r8
|
||||
cmp r0, 0
|
||||
bne _08079DC0
|
||||
movs r0, 0x64
|
||||
adds r4, r7, 0
|
||||
muls r4, r0
|
||||
ldr r0, =gPlayerParty
|
||||
adds r4, r0
|
||||
adds r0, r4, 0
|
||||
bl GetMonGender
|
||||
lsls r0, 24
|
||||
lsrs r5, r0, 24
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x2
|
||||
add r2, sp, 0xC
|
||||
bl GetMonData
|
||||
b _08079DDE
|
||||
.pool
|
||||
_08079DC0:
|
||||
movs r0, 0x64
|
||||
adds r4, r7, 0
|
||||
muls r4, r0
|
||||
ldr r0, =gEnemyParty
|
||||
adds r4, r0
|
||||
adds r0, r4, 0
|
||||
bl GetMonGender
|
||||
lsls r0, 24
|
||||
lsrs r5, r0, 24
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x2
|
||||
add r2, sp, 0xC
|
||||
bl GetMonData
|
||||
_08079DDE:
|
||||
cmp r5, 0
|
||||
beq _08079DF0
|
||||
cmp r5, 0xFE
|
||||
beq _08079E04
|
||||
movs r2, 0x83
|
||||
b _08079E16
|
||||
.pool
|
||||
_08079DF0:
|
||||
add r0, sp, 0xC
|
||||
movs r1, 0
|
||||
bl NameHasGenderSymbol
|
||||
lsls r0, 24
|
||||
movs r2, 0x83
|
||||
cmp r0, 0
|
||||
bne _08079E16
|
||||
movs r2, 0x84
|
||||
b _08079E16
|
||||
_08079E04:
|
||||
add r0, sp, 0xC
|
||||
movs r1, 0xFE
|
||||
bl NameHasGenderSymbol
|
||||
lsls r0, 24
|
||||
movs r2, 0x83
|
||||
cmp r0, 0
|
||||
bne _08079E16
|
||||
movs r2, 0x85
|
||||
_08079E16:
|
||||
ldr r0, =gUnknown_0203229C
|
||||
ldr r1, [r0]
|
||||
mov r0, r10
|
||||
subs r0, 0x1
|
||||
lsls r0, 5
|
||||
add r0, r9
|
||||
adds r0, 0x1
|
||||
lsls r0, 1
|
||||
movs r3, 0x8F
|
||||
lsls r3, 4
|
||||
adds r1, r3
|
||||
adds r1, r0
|
||||
strh r2, [r1]
|
||||
add sp, 0x1C
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_8079C4C
|
||||
|
||||
thumb_func_start sub_8079E44
|
||||
sub_8079E44: @ 8079E44
|
||||
push {r4-r7,lr}
|
||||
sub sp, 0x8
|
||||
lsls r0, 24
|
||||
lsrs r6, r0, 24
|
||||
movs r7, 0
|
||||
ldr r0, =gUnknown_0203229C
|
||||
ldr r0, [r0]
|
||||
adds r0, 0x36
|
||||
adds r0, r6
|
||||
ldrb r0, [r0]
|
||||
cmp r7, r0
|
||||
bge _08079E94
|
||||
lsls r0, r6, 1
|
||||
adds r0, r6
|
||||
ldr r1, =gUnknown_0832DE3E
|
||||
lsls r0, 2
|
||||
adds r5, r0, r1
|
||||
ldr r1, =gUnknown_0832DE56
|
||||
adds r4, r0, r1
|
||||
_08079E6A:
|
||||
lsls r1, r7, 24
|
||||
lsrs r1, 24
|
||||
ldrb r2, [r5]
|
||||
ldrb r3, [r5, 0x1]
|
||||
ldrb r0, [r4]
|
||||
str r0, [sp]
|
||||
ldrb r0, [r4, 0x1]
|
||||
str r0, [sp, 0x4]
|
||||
adds r0, r6, 0
|
||||
bl sub_8079C4C
|
||||
adds r5, 0x2
|
||||
adds r4, 0x2
|
||||
adds r7, 0x1
|
||||
ldr r0, =gUnknown_0203229C
|
||||
ldr r0, [r0]
|
||||
adds r0, 0x36
|
||||
adds r0, r6
|
||||
ldrb r0, [r0]
|
||||
cmp r7, r0
|
||||
blt _08079E6A
|
||||
_08079E94:
|
||||
add sp, 0x8
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_8079E44
|
||||
|
||||
thumb_func_start sub_8079EA8
|
||||
sub_8079EA8: @ 8079EA8
|
||||
push {r4-r7,lr}
|
||||
|
@ -4775,5 +4775,6 @@ extern const u8 gUnknown_08DDB464[];
|
||||
extern const u16 gUnknown_08DDCF04[];
|
||||
extern const u16 gTradeGba2_Pal[];
|
||||
extern const u8 gTradeGba_Gfx[];
|
||||
extern const u16 gUnknown_08DDD704[];
|
||||
|
||||
#endif //GUARD_GRAPHICS_H
|
||||
|
96
src/trade.c
96
src/trade.c
@ -4,6 +4,7 @@
|
||||
#include "bg.h"
|
||||
#include "cable_club.h"
|
||||
#include "data2.h"
|
||||
#include "daycare.h"
|
||||
#include "event_data.h"
|
||||
#include "gpu_regs.h"
|
||||
#include "graphics.h"
|
||||
@ -65,7 +66,7 @@ extern struct {
|
||||
u8 unk_A8;
|
||||
u8 unk_A9[11];
|
||||
u8 filler_B4[0x8F0-0xB4];
|
||||
u8 tilemapBuffer[0x800];
|
||||
u16 tilemapBuffer[0x400]; // 8F0
|
||||
} *gUnknown_0203229C;
|
||||
extern u8 *gUnknown_02032184;
|
||||
extern u8 *gUnknown_02032188[14];
|
||||
@ -94,6 +95,8 @@ extern const u8 gUnknown_0832DF99[][2];
|
||||
extern const u8 gText_EmptyString7[];
|
||||
extern const u8 gText_NewLine3[];
|
||||
extern const u8 gText_FourQuestionMarks[];
|
||||
extern const u8 gUnknown_0832DE3E[][6][2];
|
||||
extern const u8 gUnknown_0832DE56[][6][2];
|
||||
|
||||
bool32 sub_8077260(void);
|
||||
void sub_80773D0(void);
|
||||
@ -2509,3 +2512,94 @@ void sub_8079B84(u8 a0, u8 a1, u8 *a2)
|
||||
PutWindowTilemap(a1);
|
||||
CopyWindowToVram(a1, 3);
|
||||
}
|
||||
|
||||
void sub_8079BE0(u8 a0)
|
||||
{
|
||||
u8 i;
|
||||
u8 sp[20];
|
||||
u8 sp14[32];
|
||||
struct Pokemon *mons = a0 == 0 ? gPlayerParty : gEnemyParty;
|
||||
|
||||
for (i = 0; i < gUnknown_0203229C->unk_36[a0]; i++)
|
||||
{
|
||||
GetMonData(&mons[i], MON_DATA_NICKNAME, sp);
|
||||
StringCopy10(sp14, sp);
|
||||
sub_8079B84(a0, i, sp14);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_8079C4C(u8 a0, u8 a1, u8 a2, u8 a3, u8 a4, u8 a5)
|
||||
{
|
||||
u8 r6;
|
||||
u32 r2;
|
||||
u8 gender;
|
||||
u8 name[12];
|
||||
|
||||
CopyToBgTilemapBufferRect_ChangePalette(1, gUnknown_08DDD704, a4, a5, 6, 3, 0);
|
||||
CopyBgTilemapBufferToVram(1);
|
||||
|
||||
if (a0 == 0)
|
||||
{
|
||||
r6 = GetMonData(&gPlayerParty[a1], MON_DATA_LEVEL, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
r6 = GetMonData(&gEnemyParty[a1], MON_DATA_LEVEL, NULL);
|
||||
}
|
||||
|
||||
if (gUnknown_0203229C->unk_51[a0][a1] == 0)
|
||||
{
|
||||
if (r6 / 10 != 0)
|
||||
{
|
||||
gUnknown_0203229C->tilemapBuffer[a2 + (a3 * 32)] = (r6 / 10) + 0x60;
|
||||
}
|
||||
gUnknown_0203229C->tilemapBuffer[a2 + (a3 * 32) + 1] = (r6 % 10) + 0x70;
|
||||
}
|
||||
else
|
||||
{
|
||||
gUnknown_0203229C->tilemapBuffer[a2 + (a3 * 32) - 32] = gUnknown_0203229C->tilemapBuffer[a2 + (a3 * 32) - 33];
|
||||
gUnknown_0203229C->tilemapBuffer[a2 + (a3 * 32) - 31] = gUnknown_0203229C->tilemapBuffer[a2 + (a3 * 32) - 36] | 0x400;
|
||||
}
|
||||
|
||||
if (gUnknown_0203229C->unk_51[a0][a1] != 0)
|
||||
{
|
||||
r2 = 0x480;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (a0 == 0)
|
||||
{
|
||||
gender = GetMonGender(&gPlayerParty[a1]);
|
||||
GetMonData(&gPlayerParty[a1], MON_DATA_NICKNAME, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
gender = GetMonGender(&gEnemyParty[a1]);
|
||||
GetMonData(&gEnemyParty[a1], MON_DATA_NICKNAME, name);
|
||||
}
|
||||
|
||||
switch (gender)
|
||||
{
|
||||
case MON_MALE:
|
||||
r2 = !NameHasGenderSymbol(name, MON_MALE) ? 0x84 : 0x83;
|
||||
break;
|
||||
case MON_FEMALE:
|
||||
r2 = !NameHasGenderSymbol(name, MON_FEMALE) ? 0x85 : 0x83;
|
||||
break;
|
||||
default:
|
||||
r2 = 0x83;
|
||||
break;
|
||||
}
|
||||
}
|
||||
gUnknown_0203229C->tilemapBuffer[(a3 - 1) * 32 + a2 + 1] = r2;
|
||||
}
|
||||
|
||||
void sub_8079E44(u8 a0)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < gUnknown_0203229C->unk_36[a0]; i++)
|
||||
{
|
||||
sub_8079C4C(a0, i, gUnknown_0832DE3E[a0][i][0], gUnknown_0832DE3E[a0][i][1], gUnknown_0832DE56[a0][i][0], gUnknown_0832DE56[a0][i][1]);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user