summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscnorton <scnorton@biociphers.org>2017-10-15 14:01:09 -0400
committerscnorton <scnorton@biociphers.org>2017-10-15 14:01:09 -0400
commit270ed12126feb679f5fc818d33da56f65ae9fa98 (patch)
tree05c20ea635c3b1c206db860366929fd55a670ff5
parentfaea6fd64a4dc8332f6b6171f52c6055e21c3e27 (diff)
sub_8123EB8
-rw-r--r--asm/cable_car.s78
-rw-r--r--src/scene/cable_car.c36
2 files changed, 36 insertions, 78 deletions
diff --git a/asm/cable_car.s b/asm/cable_car.s
index aed9082cf..7a6da9e00 100644
--- a/asm/cable_car.s
+++ b/asm/cable_car.s
@@ -6,84 +6,6 @@
.text
- thumb_func_start sub_8123EB8
-sub_8123EB8: @ 8123EB8
- push {lr}
- adds r2, r0, 0
- movs r1, 0x2E
- ldrsh r0, [r2, r1]
- cmp r0, 0
- bne _08123EE8
- adds r0, r2, 0
- adds r0, 0x28
- ldrb r0, [r0]
- lsls r0, 24
- asrs r0, 24
- lsls r0, 1
- ldrh r3, [r2, 0x20]
- adds r0, r3
- strh r0, [r2, 0x20]
- ldrh r1, [r2, 0x22]
- adds r1, 0x10
- adds r0, r2, 0
- adds r0, 0x29
- ldrb r0, [r0]
- lsls r0, 24
- asrs r0, 24
- adds r0, r1
- strh r0, [r2, 0x22]
-_08123EE8:
- ldrh r0, [r2, 0x2E]
- adds r0, 0x1
- strh r0, [r2, 0x2E]
- lsls r0, 16
- asrs r0, 16
- movs r3, 0x32
- ldrsh r1, [r2, r3]
- cmp r0, r1
- blt _08123F3E
- movs r0, 0x30
- ldrsh r1, [r2, r0]
- cmp r1, 0
- beq _08123F08
- cmp r1, 0x1
- beq _08123F12
- b _08123F30
-_08123F08:
- ldrh r0, [r2, 0x20]
- adds r0, 0x1
- strh r0, [r2, 0x20]
- ldrh r0, [r2, 0x2E]
- b _08123F22
-_08123F12:
- ldrh r0, [r2, 0x2E]
- ands r0, r1
- cmp r0, 0
- beq _08123F30
- ldrh r0, [r2, 0x20]
- adds r0, 0x1
- strh r0, [r2, 0x20]
- ldrh r0, [r2, 0x20]
-_08123F22:
- movs r1, 0x3
- ands r0, r1
- cmp r0, 0
- bne _08123F30
- ldrh r0, [r2, 0x22]
- adds r0, 0x1
- strh r0, [r2, 0x22]
-_08123F30:
- movs r1, 0x22
- ldrsh r0, [r2, r1]
- cmp r0, 0xA0
- ble _08123F3E
- adds r0, r2, 0
- bl DestroySprite
-_08123F3E:
- pop {r0}
- bx r0
- thumb_func_end sub_8123EB8
-
thumb_func_start sub_8123F44
sub_8123F44: @ 8123F44
push {lr}
diff --git a/src/scene/cable_car.c b/src/scene/cable_car.c
index 30002bb47..ee26d730b 100644
--- a/src/scene/cable_car.c
+++ b/src/scene/cable_car.c
@@ -513,3 +513,39 @@ void sub_8123D98(struct Sprite *sprite)
}
}
}
+
+void sub_8123EB8(struct Sprite *sprite)
+{
+ if (sprite->data0 == 0)
+ {
+ sprite->pos1.x += 2 * sprite->centerToCornerVecX;
+ sprite->pos1.y += 16 + sprite->centerToCornerVecY;
+ }
+ if (++ sprite->data0 >= sprite->data2)
+ {
+ switch (sprite->data1)
+ {
+ case 0:
+ sprite->pos1.x ++;
+ if ((sprite->data0 % 4) == 0)
+ {
+ sprite->pos1.y ++;
+ }
+ break;
+ case 1:
+ if ((sprite->data0 % 2) != 0)
+ {
+ sprite->pos1.x ++;
+ if ((sprite->pos1.x % 4) == 0)
+ {
+ sprite->pos1.y ++;
+ }
+ }
+ break;
+ }
+ if (sprite->pos1.y > 0xa0)
+ {
+ DestroySprite(sprite);
+ }
+ }
+}