summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornotyourav <65437533+notyourav@users.noreply.github.com>2022-02-08 18:27:04 -0800
committerGitHub <noreply@github.com>2022-02-08 18:27:04 -0800
commite1fc6d628c8b780f7f19e8ce3e2153d5a35d41b7 (patch)
tree06a8943409f98b0f9fdc92092847689747f40cd2
parent358f8c87cce6e0c84e31222b737508bf2194051f (diff)
parent06d3302cc76948fbbd829555faa0cab83c892543 (diff)
Merge pull request #361 from hatal175/rocscape
-rw-r--r--asm/non_matching/itemRocsCape/ItemRocsCape.inc146
-rw-r--r--src/item/itemRocsCape.c59
2 files changed, 30 insertions, 175 deletions
diff --git a/asm/non_matching/itemRocsCape/ItemRocsCape.inc b/asm/non_matching/itemRocsCape/ItemRocsCape.inc
deleted file mode 100644
index 8de6c30b..00000000
--- a/asm/non_matching/itemRocsCape/ItemRocsCape.inc
+++ /dev/null
@@ -1,146 +0,0 @@
- .syntax unified
- push {r4, r5, lr}
- adds r3, r0, #0
- adds r4, r1, #0
- ldrb r0, [r3, #4]
- cmp r0, #0
- beq _08076654
- adds r0, r3, #0
- bl sub_08076758
- b _08076754
-_08076654:
- ldr r0, _080766BC @ =gPlayerState
- ldr r1, [r0, #0x2c]
- adds r2, r0, #0
- cmp r1, #0
- bne _0807674C
- ldrb r0, [r2, #1]
- cmp r0, #0
- beq _080766C4
- ldrb r1, [r2, #4]
- ldrb r0, [r2, #5]
- orrs r0, r1
- cmp r0, #0
- bne _0807674C
- ldrb r0, [r2, #0x12]
- cmp r0, #0x12
- beq _08076678
- cmp r0, #1
- bne _08076686
-_08076678:
- ldr r0, _080766C0 @ =gPlayerEntity
- ldr r0, [r0, #0x34]
- cmp r0, #0
- bne _08076686
- ldrb r0, [r2, #0x14]
- cmp r0, #0
- beq _0807674C
-_08076686:
- ldrb r1, [r2, #2]
- cmp r1, #0
- beq _08076694
- movs r0, #7
- ands r0, r1
- cmp r0, #3
- bne _08076710
-_08076694:
- ldr r5, _080766C0 @ =gPlayerEntity
- ldr r0, [r5, #0x34]
- cmp r0, #0
- blt _0807674C
- movs r1, #0
- strb r1, [r2, #1]
- ldrb r0, [r3, #4]
- adds r0, #1
- strb r0, [r3, #4]
- strb r1, [r2, #0xb]
- movs r0, #1
- strb r0, [r2, #2]
- movs r0, #0xff
- strb r0, [r2, #0xe]
- str r1, [r2, #0x2c]
- movs r0, #0x80
- lsls r0, r0, #0xa
- str r0, [r5, #0x20]
- b _0807673C
- .align 2, 0
-_080766BC: .4byte gPlayerState
-_080766C0: .4byte gPlayerEntity
-_080766C4:
- ldrb r0, [r2, #0x1b]
- ldrb r1, [r2, #0xa]
- orrs r0, r1
- ldrb r1, [r2, #4]
- orrs r0, r1
- ldrb r1, [r2, #5]
- orrs r0, r1
- ldrb r1, [r2, #0x1c]
- orrs r0, r1
- adds r1, r2, #0
- adds r1, #0x3d
- ldrb r1, [r1]
- orrs r0, r1
- cmp r0, #0
- bne _0807674C
- ldrb r1, [r2, #0x12]
- adds r0, r1, #0
- subs r0, #0x12
- lsls r0, r0, #0x18
- lsrs r0, r0, #0x18
- cmp r0, #1
- bls _080766F4
- cmp r1, #1
- bne _08076702
-_080766F4:
- ldr r0, _0807671C @ =gPlayerEntity
- ldr r0, [r0, #0x34]
- cmp r0, #0
- bne _08076702
- ldrb r0, [r2, #0x14]
- cmp r0, #0
- beq _0807674C
-_08076702:
- ldrb r1, [r2, #2]
- cmp r1, #0
- beq _08076720
- movs r0, #7
- ands r0, r1
- cmp r0, #3
- beq _08076720
-_08076710:
- adds r0, r3, #0
- adds r1, r4, #0
- bl sub_08076758
- b _08076754
- .align 2, 0
-_0807671C: .4byte gPlayerEntity
-_08076720:
- ldr r1, _08076748 @ =gPlayerEntity
- ldr r0, [r1, #0x34]
- cmp r0, #0
- blt _0807674C
- movs r0, #0x80
- lsls r0, r0, #0xa
- str r0, [r1, #0x20]
- movs r1, #0
- movs r0, #1
- strb r0, [r2, #2]
- str r1, [r2, #0x2c]
- ldrb r0, [r3, #4]
- adds r0, #1
- strb r0, [r3, #4]
-_0807673C:
- bl sub_08077F84
- movs r0, #0x78
- bl SoundReq
- b _08076754
- .align 2, 0
-_08076748: .4byte gPlayerEntity
-_0807674C:
- adds r0, r3, #0
- adds r1, r4, #0
- bl sub_08077E78
-_08076754:
- pop {r4, r5, pc}
- .align 2, 0
- .syntax divided
diff --git a/src/item/itemRocsCape.c b/src/item/itemRocsCape.c
index c3af396c..3c94d851 100644
--- a/src/item/itemRocsCape.c
+++ b/src/item/itemRocsCape.c
@@ -5,46 +5,49 @@
void sub_08076758(ItemBehavior*, u32);
extern void sub_08077F84(void);
-/*void ItemRocsCape(ItemBehavior* this, u32 arg1) {
+void ItemRocsCape(ItemBehavior* this, u32 arg1) {
if (this->stateID != 0) {
sub_08076758(this, arg1);
return;
}
if (gPlayerState.item == NULL) {
- if (gPlayerState.field_0x0[1] == 0) {
- if (((u8)(gPlayerState.sword_state | gPlayerState.field_0xa | gPlayerState.field_0x3[1] |
- gPlayerState.heldObject | gPlayerState.field_0x1c | gPlayerState.field_0x3c[1]) == 0) &&
- ((((1 < (u8)(gPlayerState.field_0x10[2] - 0x12) && (gPlayerState.field_0x10[2] != 1)) ||
- (gPlayerEntity.z.WORD != 0)) ||
- (gPlayerState.field_0x14 != 0)))) {
- if ((gPlayerState.jump_status != 0) && ((gPlayerState.jump_status & 7) != 3))
- goto _08076710;
- if (-1 < gPlayerEntity.z.WORD) {
- gPlayerEntity.zVelocity = 0x20000;
- gPlayerState.jump_status = 1;
- gPlayerState.item = NULL;
- this->stateID += 1;
- goto _0807673C;
+ if (gPlayerState.field_0x0[1]) {
+ if (((gPlayerState.field_0x3[1] | gPlayerState.heldObject) == 0) &&
+ (((gPlayerState.floor_type != SURFACE_DOOR && (gPlayerState.floor_type != SURFACE_PIT)) ||
+ ((gPlayerEntity.z.WORD != 0 || (gPlayerState.field_0x14 != 0)))))) {
+ if ((gPlayerState.jump_status == 0) || ((gPlayerState.jump_status & 7) == 3)) {
+ if (-1 < gPlayerEntity.z.WORD) {
+ gPlayerState.field_0x0[1] = 0;
+ this->stateID += 1;
+ gPlayerState.keepFacing = 0;
+ gPlayerState.jump_status = 1;
+ gPlayerState.field_0xe = -1;
+ gPlayerState.item = NULL;
+ gPlayerEntity.zVelocity = 0x20000;
+ sub_08077F84();
+ SoundReq(SFX_PLY_VO4);
+ return;
+ }
+ } else {
+ sub_08076758(this, arg1);
+ return;
}
}
} else {
- if (((gPlayerState.heldObject | gPlayerState.field_0x3[1]) == 0) &&
- (((gPlayerState.field_0x10[2] != 0x12 && (gPlayerState.field_0x10[2] != 1)) ||
- ((gPlayerEntity.z.WORD != 0 || (gPlayerState.field_0x14 != 0)))))) {
+ if (((u8)(gPlayerState.sword_state | gPlayerState.field_0xa | gPlayerState.field_0x3[1] |
+ gPlayerState.heldObject | gPlayerState.field_0x1c | gPlayerState.field_0x3c[1]) == 0) &&
+ ((((gPlayerState.floor_type != SURFACE_DOOR && gPlayerState.floor_type != SURFACE_DOOR_13 &&
+ gPlayerState.floor_type != SURFACE_PIT) ||
+ (gPlayerEntity.z.WORD != 0)) ||
+ (gPlayerState.field_0x14 != 0)))) {
if ((gPlayerState.jump_status != 0) && ((gPlayerState.jump_status & 7) != 3)) {
- _08076710:
sub_08076758(this, arg1);
return;
- }
- if (-1 < gPlayerEntity.z.WORD) {
- gPlayerState.field_0x0[1] = 0;
- this->stateID += 1;
- gPlayerState.keepFacing = 0;
+ } else if (-1 < gPlayerEntity.z.WORD) {
+ gPlayerEntity.zVelocity = 0x20000;
gPlayerState.jump_status = 1;
- gPlayerState.field_0xe = -1;
gPlayerState.item = NULL;
- gPlayerEntity.zVelocity = 0x20000;
- _0807673C:
+ this->stateID += 1;
sub_08077F84();
SoundReq(SFX_PLY_VO4);
return;
@@ -54,8 +57,6 @@ extern void sub_08077F84(void);
}
sub_08077E78(this, arg1);
}
-*/
-ASM_FUNC("asm/non_matching/itemRocsCape/ItemRocsCape.inc", void ItemRocsCape(ItemBehavior* this, u32 arg1))
void sub_08076758(ItemBehavior* this, u32 arg1) {
s32 iVar1;