summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscnorton <scnorton@biociphers.org>2017-09-03 15:02:47 -0400
committerscnorton <scnorton@biociphers.org>2017-09-03 15:02:47 -0400
commitc3c645ceac878cf7f5c1a3d47b01770bb61cfe19 (patch)
treed097a497b0fc039d549532eec04a3cbe165cb238
parentfc135f6e97ff780f1aba4c5ce8d22f450a5cf5c4 (diff)
sub_804D6BC
-rw-r--r--asm/trade.s66
-rw-r--r--src/trade.c21
2 files changed, 21 insertions, 66 deletions
diff --git a/asm/trade.s b/asm/trade.s
index 8938a8ff9..40cbc0ac6 100644
--- a/asm/trade.s
+++ b/asm/trade.s
@@ -4891,70 +4891,4 @@ _0804D6B4: .4byte 0x0000abcd
_0804D6B8: .4byte gUnknown_03004828
thumb_func_end sub_804D63C
- thumb_func_start sub_804D6BC
-sub_804D6BC: @ 804D6BC
- push {r4,r5,lr}
- adds r5, r0, 0
- movs r1, 0x2E
- ldrsh r0, [r5, r1]
- movs r1, 0xA
- bl __divsi3
- ldrh r4, [r5, 0x22]
- adds r4, r0
- strh r4, [r5, 0x22]
- ldrh r0, [r5, 0x30]
- ldrh r2, [r5, 0x38]
- adds r0, r2
- strh r0, [r5, 0x38]
- movs r1, 0x38
- ldrsh r0, [r5, r1]
- movs r1, 0xA
- bl __divsi3
- strh r0, [r5, 0x20]
- lsls r4, 16
- asrs r4, 16
- cmp r4, 0x4C
- ble _0804D70A
- movs r0, 0x4C
- strh r0, [r5, 0x22]
- movs r2, 0x2E
- ldrsh r1, [r5, r2]
- movs r2, 0x32
- ldrsh r0, [r5, r2]
- muls r0, r1
- negs r0, r0
- movs r1, 0x64
- bl __divsi3
- strh r0, [r5, 0x2E]
- ldrh r0, [r5, 0x34]
- adds r0, 0x1
- strh r0, [r5, 0x34]
-_0804D70A:
- movs r1, 0x20
- ldrsh r0, [r5, r1]
- cmp r0, 0x78
- bne _0804D716
- movs r0, 0
- strh r0, [r5, 0x30]
-_0804D716:
- ldrh r0, [r5, 0x36]
- ldrh r2, [r5, 0x2E]
- adds r0, r2
- strh r0, [r5, 0x2E]
- movs r1, 0x34
- ldrsh r0, [r5, r1]
- cmp r0, 0x4
- bne _0804D72E
- movs r0, 0x1
- strh r0, [r5, 0x3C]
- ldr r0, _0804D734 @ =SpriteCallbackDummy
- str r0, [r5, 0x1C]
-_0804D72E:
- pop {r4,r5}
- pop {r0}
- bx r0
- .align 2, 0
-_0804D734: .4byte SpriteCallbackDummy
- thumb_func_end sub_804D6BC
-
.align 2, 0 @ Don't pad with nop.
diff --git a/src/trade.c b/src/trade.c
index f48a5d902..84640fbf0 100644
--- a/src/trade.c
+++ b/src/trade.c
@@ -3172,6 +3172,27 @@ static bool8 sub_804ABF8(void)
asm(".section .text.sub_804DAD4");
+void sub_804D6BC(struct Sprite *sprite)
+{
+ sprite->pos1.y += sprite->data0 / 10;
+ sprite->data5 += sprite->data1;
+ sprite->pos1.x = sprite->data5 / 10;
+ if (sprite->pos1.y > 0x4c)
+ {
+ sprite->pos1.y = 0x4c;
+ sprite->data0 = -(sprite->data0 * sprite->data2) / 100;
+ sprite->data3 ++;
+ }
+ if (sprite->pos1.x == 0x78)
+ sprite->data1 = 0;
+ sprite->data0 += sprite->data4;
+ if (sprite->data3 == 4)
+ {
+ sprite->data7 = 1;
+ sprite->callback = SpriteCallbackDummy;
+ }
+}
+
void sub_804D738(struct Sprite *sprite)
{
sprite->pos2.y += gTradeBallVerticalVelocityTable[sprite->data0];