summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscnorton <scnorton@biociphers.org>2017-08-31 11:35:14 -0400
committerscnorton <scnorton@biociphers.org>2017-08-31 11:35:14 -0400
commitb636d3cafa2a1b3314fddb3c7bde2bdb94c1e2c2 (patch)
treec0558c70a0065fd68bac3c9954b6af7c9288a7e0
parent937428a19836f63897a5d8cfa283347e30f7342b (diff)
sub_8047CE8
-rw-r--r--asm/trade.s49
-rw-r--r--data/ingame_trades.inc108
-rw-r--r--data/trade.s9
-rw-r--r--ld_script.txt2
-rw-r--r--src/trade.c56
5 files changed, 49 insertions, 175 deletions
diff --git a/asm/trade.s b/asm/trade.s
index be7729c10..b5cdf211e 100644
--- a/asm/trade.s
+++ b/asm/trade.s
@@ -10,55 +10,6 @@
.set sub_804A96C_alt, sub_804A96C
.endif
- thumb_func_start sub_8047CE8
-sub_8047CE8: @ 8047CE8
- push {r4-r6,lr}
- ldr r6, _08047D44 @ =gWindowConfig_81E725C
- ldr r5, _08047D48 @ =gUnknown_020296CC
- ldr r1, [r5]
- ldr r2, _08047D4C @ =gSaveBlock2
- adds r0, r6, 0
- movs r3, 0xC
- bl sub_804AFB8
- bl GetMultiplayerId
- lsls r0, 24
- ldr r1, [r5, 0xC]
- movs r3, 0x80
- lsls r3, 17
- eors r3, r0
- lsrs r3, 24
- lsls r2, r3, 3
- subs r2, r3
- lsls r2, 2
- ldr r0, _08047D50 @ =gLinkPlayers + 0x8
- adds r2, r0
- adds r0, r6, 0
- movs r3, 0xC
- bl sub_804AFB8
- ldr r1, [r5, 0x18]
- ldr r4, _08047D54 @ =gUnknown_0820C14C
- ldr r2, [r4]
- adds r0, r6, 0
- movs r3, 0x8
- bl sub_804AFB8
- ldr r0, [r4, 0x4]
- ldr r1, [r5, 0x20]
- movs r2, 0x14
- bl sub_804ACD8
- movs r0, 0x3
- movs r1, 0
- bl nullsub_5
- pop {r4-r6}
- pop {r0}
- bx r0
- .align 2, 0
-_08047D44: .4byte gWindowConfig_81E725C
-_08047D48: .4byte gUnknown_020296CC
-_08047D4C: .4byte gSaveBlock2
-_08047D50: .4byte gLinkPlayers + 0x8
-_08047D54: .4byte gUnknown_0820C14C
- thumb_func_end sub_8047CE8
-
thumb_func_start sub_8047D58
sub_8047D58: @ 8047D58
push {r4-r7,lr}
diff --git a/data/ingame_trades.inc b/data/ingame_trades.inc
deleted file mode 100644
index f5258e26c..000000000
--- a/data/ingame_trades.inc
+++ /dev/null
@@ -1,108 +0,0 @@
- .align 2
-gIngameTrades:: @ 8215AC4
- .string "MAKIT$", 11 @ nickname
- .space 1
- .2byte SPECIES_MAKUHITA @ NPC mon species
- .byte 5 @ HP IV
- .byte 5 @ attack IV
- .byte 4 @ defense IV
- .byte 4 @ speed IV
- .byte 4 @ sp. attack IV
- .byte 4 @ sp. defense IV
- .byte TRUE @ second ability
- .space 3
- .4byte 49562 @ OT ID
- .byte 5 @ cool
- .byte 5 @ beauty
- .byte 5 @ cute
- .byte 5 @ smart
- .byte 30 @ tough
- .space 3
- .4byte 0x9C40 @ personality value
- .2byte ITEM_X_ATTACK @ held item
- .byte -1 @ mail num
- .string "ELYSSA$", 11 @ OT name
- .byte MALE @ OT gender
- .byte 10 @ sheen
- .2byte SPECIES_SLAKOTH @ player mon species
- .space 2
-
- .string "SKITIT$", 11 @ nickname
- .space 1
- .2byte SPECIES_SKITTY @ NPC mon species
- .byte 5 @ HP IV
- .byte 4 @ attack IV
- .byte 4 @ defense IV
- .byte 5 @ speed IV
- .byte 4 @ sp. attack IV
- .byte 4 @ sp. defense IV
- .byte FALSE @ second ability
- .space 3
- .4byte 2259 @ OT ID
- .byte 5 @ cool
- .byte 5 @ beauty
- .byte 30 @ cute
- .byte 5 @ smart
- .byte 5 @ tough
- .space 3
- .4byte 0x498A2E17 @ personality value
- .2byte ITEM_GLITTER_MAIL @ held item
- .byte 0 @ mail num
- .string "DARRELL$", 11 @ OT name
- .byte FEMALE @ OT gender
- .byte 10 @ sheen
- .2byte SPECIES_PIKACHU @ player mon species
- .space 2
-
- .string "COROSO$", 11 @ nickname
- .space 1
- .2byte SPECIES_CORSOLA @ NPC mon species
- .byte 4 @ HP IV
- .byte 4 @ attack IV
- .byte 5 @ defense IV
- .byte 4 @ speed IV
- .byte 4 @ sp. attack IV
- .byte 5 @ sp. defense IV
- .byte TRUE @ second ability
- .space 3
- .4byte 50183 @ OT ID
- .byte 5 @ cool
- .byte 30 @ beauty
- .byte 5 @ cute
- .byte 5 @ smart
- .byte 5 @ tough
- .space 3
- .4byte 0x4C970B7F @ personality value
- .2byte ITEM_TROPIC_MAIL @ held item
- .byte 1 @ mail num
- .string "LANE$", 11 @ OT name
- .byte FEMALE @ OT gender
- .byte 10 @ sheen
- .2byte SPECIES_BELLOSSOM @ player mon species
- .space 2
-
- .align 1
-gIngameTradeMail:: @ 8215B78
-@ 0
- ec_pokemon1 PIKACHU
- ec_word THANK_YOU
- ec_word EXCL
- ec_word MY
- ec_pokemon1 SKITTY
- ec_word EATS
- ec_word A_LOT
- ec_word NOW
- ec_word EXCL
- .2byte 0
-
-@ 1
- ec_word I
- ec_word WANT
- ec_word TO
- ec_word SEE
- ec_word A
- ec_move2 PETAL_DANCE
- ec_word IT_S
- ec_word SO
- ec_word PRETTY
- .2byte 0
diff --git a/data/trade.s b/data/trade.s
index d1b42b103..48919ca5f 100644
--- a/data/trade.s
+++ b/data/trade.s
@@ -135,14 +135,7 @@ gUnknown_0820C12C:: @ 820C12C
gSpriteTemplate_820C134:: @ 820C134
spr_template 300, 2345, gOamData_820C104, gSpriteAnimTable_820C11C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
- .align 2
-gUnknown_0820C14C:: @ 820C14C
- .4byte TradeText_Cancel
- .4byte TradeText_ChoosePoke
- .4byte TradeText_Summary1
- .4byte TradeText_Trade1
- .4byte TradeText_CancelTradePrompt
- .4byte TradeText_PressBToExit
+ .section .rodata.820C164
@ This is used to determine the next mon to select when the D-Pad is
@ pressed in a given direction.
diff --git a/ld_script.txt b/ld_script.txt
index 26fbfaef0..81f92bfaa 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -348,6 +348,8 @@ SECTIONS {
src/pokeball.o(.rodata);
data/trade.o(.rodata);
src/trade.o(.rodata);
+ data/trade.o(.rodata.820C164);
+ src/trade.o(.rodata.igt);
src/berry_blender.o(.rodata);
src/new_game.o(.rodata);
data/rom4.o(.rodata);
diff --git a/src/trade.c b/src/trade.c
index 44eb8212a..874a203ba 100644
--- a/src/trade.c
+++ b/src/trade.c
@@ -7,6 +7,8 @@
#include "items.h"
#include "moves.h"
#include "easy_chat.h"
+#include "link.h"
+#include "strings2.h"
struct InGameTrade {
/*0x00*/ u8 name[11];
@@ -39,29 +41,52 @@ struct UnkStructD {
/*0x12*/ u16 var12[1];
};
+struct UnkStructE {
+ u8 *unk00;
+ u8 fil04[8];
+ u8 *unk0C;
+ u8 fil10[8];
+ u8 *unk18;
+ u8 fil1C[4];
+ void *unk20;
+};
+
void sub_8047EC0(void);
+void sub_804AFB8(const struct WindowConfig *, u8 *, const u8 *, u8);
+void sub_804ACD8(const u8 *, u8 *, u8);
+void nullsub_5(u8, u8);
+
+extern struct UnkStructE gUnknown_020296CC;
+
+const u8 *const gUnknown_0820C14C[] = {
+ TradeText_Cancel,
+ TradeText_ChoosePoke,
+ TradeText_Summary1,
+ TradeText_Trade1,
+ TradeText_CancelTradePrompt,
+ TradeText_PressBToExit
+};
+asm(".section .rodata.igt");
const struct InGameTrade gIngameTrades[] = {
{
- _("MAKIT"),
- SPECIES_MAKUHITA,
+ _("MAKIT"), SPECIES_MAKUHITA,
5, 5, 4, 4, 4, 4,
TRUE, 49562,
5, 5, 5, 5, 30,
0x9C40,
ITEM_X_ATTACK, -1,
- _("ELYSSA"),
- MALE, 10, SPECIES_SLAKOTH
+ _("ELYSSA"), MALE, 10,
+ SPECIES_SLAKOTH
}, {
- _("SKITIT"),
- SPECIES_SKITTY,
+ _("SKITIT"), SPECIES_SKITTY,
5, 4, 4, 5, 4, 4,
FALSE, 2259,
5, 5, 30, 5, 5,
0x498A2E17,
ITEM_GLITTER_MAIL, 0,
- _("DARRELL"),
- FEMALE, 10, SPECIES_PIKACHU
+ _("DARRELL"), FEMALE, 10,
+ SPECIES_PIKACHU
}, {
_("COROSO"),
SPECIES_CORSOLA,
@@ -70,8 +95,8 @@ const struct InGameTrade gIngameTrades[] = {
5, 30, 5, 5, 5,
0x4C970B7F,
ITEM_TROPIC_MAIL, 1,
- _("LANE"),
- FEMALE, 10, SPECIES_BELLOSSOM
+ _("LANE"), FEMALE, 10,
+ SPECIES_BELLOSSOM
}
};
@@ -136,6 +161,17 @@ void sub_8047CD8(void)
SetMainCallback2(sub_8047EC0);
}
+void sub_8047CE8(void)
+{
+ u8 mpId;
+ sub_804AFB8(&gWindowConfig_81E725C, gUnknown_020296CC.unk00, gSaveBlock2.playerName, 0xC);
+ mpId = GetMultiplayerId();
+ sub_804AFB8(&gWindowConfig_81E725C, gUnknown_020296CC.unk0C, gLinkPlayers[mpId ^ 1].name, 0xC);
+ sub_804AFB8(&gWindowConfig_81E725C, gUnknown_020296CC.unk18, gUnknown_0820C14C[0], 0x8);
+ sub_804ACD8(gUnknown_0820C14C[1], gUnknown_020296CC.unk20, 0x14);
+ nullsub_5(3, 0);
+}
+
asm(".section .text.sub_804A96C");
void sub_804A96C(struct UnkStructD *arg0, u8 left, u8 top, u16 *tilemap, u8 width, u8 height, u16 sp8) {