mirror of https://github.com/zeldaret/tmc.git
Decompile eyeSwitch
This commit is contained in:
parent
1724325cb0
commit
e3ba675f1a
|
@ -1,209 +0,0 @@
|
||||||
.include "asm/macros.inc"
|
|
||||||
|
|
||||||
.include "constants/constants.inc"
|
|
||||||
|
|
||||||
.syntax unified
|
|
||||||
|
|
||||||
.text
|
|
||||||
|
|
||||||
|
|
||||||
thumb_func_start EyeSwitch
|
|
||||||
EyeSwitch: @ 0x0808868C
|
|
||||||
push {lr}
|
|
||||||
ldr r2, _080886A0 @ =gUnk_08120B20
|
|
||||||
ldrb r1, [r0, #0xc]
|
|
||||||
lsls r1, r1, #2
|
|
||||||
adds r1, r1, r2
|
|
||||||
ldr r1, [r1]
|
|
||||||
bl _call_via_r1
|
|
||||||
pop {pc}
|
|
||||||
.align 2, 0
|
|
||||||
_080886A0: .4byte gUnk_08120B20
|
|
||||||
|
|
||||||
thumb_func_start sub_080886A4
|
|
||||||
sub_080886A4: @ 0x080886A4
|
|
||||||
push {r4, r5, r6, lr}
|
|
||||||
adds r4, r0, #0
|
|
||||||
ldrb r1, [r4, #0xa]
|
|
||||||
movs r6, #3
|
|
||||||
adds r0, r6, #0
|
|
||||||
ands r0, r1
|
|
||||||
strb r0, [r4, #0x14]
|
|
||||||
adds r2, r4, #0
|
|
||||||
adds r2, #0x29
|
|
||||||
ldrb r1, [r2]
|
|
||||||
movs r0, #8
|
|
||||||
rsbs r0, r0, #0
|
|
||||||
ands r0, r1
|
|
||||||
movs r1, #6
|
|
||||||
orrs r0, r1
|
|
||||||
strb r0, [r2]
|
|
||||||
adds r1, r4, #0
|
|
||||||
adds r1, #0x3c
|
|
||||||
movs r0, #7
|
|
||||||
strb r0, [r1]
|
|
||||||
adds r1, #4
|
|
||||||
movs r0, #0x48
|
|
||||||
strb r0, [r1]
|
|
||||||
adds r0, r4, #0
|
|
||||||
adds r0, #0x3f
|
|
||||||
movs r5, #1
|
|
||||||
strb r5, [r0]
|
|
||||||
subs r1, #5
|
|
||||||
movs r0, #2
|
|
||||||
strb r0, [r1]
|
|
||||||
ldr r0, _08088700 @ =gHitbox_1
|
|
||||||
str r0, [r4, #0x48]
|
|
||||||
adds r0, r4, #0
|
|
||||||
adds r0, #0x84
|
|
||||||
ldrh r0, [r0]
|
|
||||||
bl CheckFlags
|
|
||||||
cmp r0, #0
|
|
||||||
beq _08088704
|
|
||||||
strb r6, [r4, #0xc]
|
|
||||||
ldrb r1, [r4, #0x14]
|
|
||||||
adds r1, #4
|
|
||||||
adds r0, r4, #0
|
|
||||||
bl InitializeAnimation
|
|
||||||
b _08088716
|
|
||||||
.align 2, 0
|
|
||||||
_08088700: .4byte gHitbox_1
|
|
||||||
_08088704:
|
|
||||||
strb r5, [r4, #0xc]
|
|
||||||
ldrb r0, [r4, #0x10]
|
|
||||||
movs r1, #0x80
|
|
||||||
orrs r0, r1
|
|
||||||
strb r0, [r4, #0x10]
|
|
||||||
ldrb r1, [r4, #0x14]
|
|
||||||
adds r0, r4, #0
|
|
||||||
bl InitializeAnimation
|
|
||||||
_08088716:
|
|
||||||
pop {r4, r5, r6, pc}
|
|
||||||
|
|
||||||
thumb_func_start sub_08088718
|
|
||||||
sub_08088718: @ 0x08088718
|
|
||||||
push {r4, lr}
|
|
||||||
adds r4, r0, #0
|
|
||||||
adds r0, #0x41
|
|
||||||
ldrb r0, [r0]
|
|
||||||
cmp r0, #0x95
|
|
||||||
beq _08088728
|
|
||||||
cmp r0, #0x8e
|
|
||||||
bne _0808875A
|
|
||||||
_08088728:
|
|
||||||
ldr r0, [r4, #0x4c]
|
|
||||||
ldrb r1, [r0, #0x15]
|
|
||||||
adds r1, #4
|
|
||||||
movs r0, #0x18
|
|
||||||
ands r1, r0
|
|
||||||
asrs r1, r1, #3
|
|
||||||
ldrb r2, [r4, #0x14]
|
|
||||||
movs r0, #3
|
|
||||||
ands r0, r2
|
|
||||||
cmp r1, r0
|
|
||||||
bne _0808875A
|
|
||||||
movs r0, #2
|
|
||||||
strb r0, [r4, #0xc]
|
|
||||||
ldrb r1, [r4, #0x10]
|
|
||||||
movs r0, #0x7f
|
|
||||||
ands r0, r1
|
|
||||||
strb r0, [r4, #0x10]
|
|
||||||
ldr r0, _0808875C @ =0x00000111
|
|
||||||
bl EnqueueSFX
|
|
||||||
adds r0, r4, #0
|
|
||||||
adds r0, #0x86
|
|
||||||
ldrh r0, [r0]
|
|
||||||
bl SetFlag
|
|
||||||
_0808875A:
|
|
||||||
pop {r4, pc}
|
|
||||||
.align 2, 0
|
|
||||||
_0808875C: .4byte 0x00000111
|
|
||||||
|
|
||||||
thumb_func_start sub_08088760
|
|
||||||
sub_08088760: @ 0x08088760
|
|
||||||
push {r4, lr}
|
|
||||||
adds r4, r0, #0
|
|
||||||
bl GetNextFrame
|
|
||||||
adds r0, r4, #0
|
|
||||||
adds r0, #0x5a
|
|
||||||
ldrb r1, [r0]
|
|
||||||
movs r0, #0x80
|
|
||||||
ands r0, r1
|
|
||||||
cmp r0, #0
|
|
||||||
beq _0808878E
|
|
||||||
movs r0, #3
|
|
||||||
strb r0, [r4, #0xc]
|
|
||||||
ldrb r0, [r4, #0xe]
|
|
||||||
lsls r0, r0, #1
|
|
||||||
adds r1, r4, #0
|
|
||||||
adds r1, #0x70
|
|
||||||
strh r0, [r1]
|
|
||||||
ldrb r1, [r4, #0x14]
|
|
||||||
adds r1, #4
|
|
||||||
adds r0, r4, #0
|
|
||||||
bl InitializeAnimation
|
|
||||||
_0808878E:
|
|
||||||
pop {r4, pc}
|
|
||||||
|
|
||||||
thumb_func_start sub_08088790
|
|
||||||
sub_08088790: @ 0x08088790
|
|
||||||
push {r4, r5, lr}
|
|
||||||
adds r4, r0, #0
|
|
||||||
ldrb r0, [r4, #0xe]
|
|
||||||
cmp r0, #0
|
|
||||||
beq _080887D6
|
|
||||||
adds r0, r4, #0
|
|
||||||
adds r0, #0x86
|
|
||||||
adds r2, r4, #0
|
|
||||||
adds r2, #0x84
|
|
||||||
ldrh r1, [r0]
|
|
||||||
adds r5, r0, #0
|
|
||||||
ldrh r0, [r2]
|
|
||||||
cmp r1, r0
|
|
||||||
beq _080887BC
|
|
||||||
ldrh r0, [r2]
|
|
||||||
bl CheckFlags
|
|
||||||
cmp r0, #0
|
|
||||||
beq _080887BC
|
|
||||||
movs r0, #0
|
|
||||||
strb r0, [r4, #0xe]
|
|
||||||
b _080887D6
|
|
||||||
_080887BC:
|
|
||||||
adds r1, r4, #0
|
|
||||||
adds r1, #0x70
|
|
||||||
ldrh r0, [r1]
|
|
||||||
subs r0, #1
|
|
||||||
strh r0, [r1]
|
|
||||||
lsls r0, r0, #0x10
|
|
||||||
cmp r0, #0
|
|
||||||
bne _080887D6
|
|
||||||
movs r0, #4
|
|
||||||
strb r0, [r4, #0xc]
|
|
||||||
ldrh r0, [r5]
|
|
||||||
bl ClearFlag
|
|
||||||
_080887D6:
|
|
||||||
pop {r4, r5, pc}
|
|
||||||
|
|
||||||
thumb_func_start sub_080887D8
|
|
||||||
sub_080887D8: @ 0x080887D8
|
|
||||||
push {r4, lr}
|
|
||||||
adds r4, r0, #0
|
|
||||||
bl GetNextFrame
|
|
||||||
adds r0, r4, #0
|
|
||||||
adds r0, #0x5a
|
|
||||||
ldrb r1, [r0]
|
|
||||||
movs r0, #0x80
|
|
||||||
ands r0, r1
|
|
||||||
cmp r0, #0
|
|
||||||
beq _08088802
|
|
||||||
movs r0, #1
|
|
||||||
strb r0, [r4, #0xc]
|
|
||||||
ldrb r1, [r4, #0x10]
|
|
||||||
movs r0, #0x80
|
|
||||||
orrs r0, r1
|
|
||||||
strb r0, [r4, #0x10]
|
|
||||||
ldrb r1, [r4, #0x14]
|
|
||||||
adds r0, r4, #0
|
|
||||||
bl InitializeAnimation
|
|
||||||
_08088802:
|
|
||||||
pop {r4, pc}
|
|
|
@ -1,12 +0,0 @@
|
||||||
.include "asm/macros.inc"
|
|
||||||
.include "constants/constants.inc"
|
|
||||||
|
|
||||||
.section .rodata
|
|
||||||
.align 2
|
|
||||||
|
|
||||||
gUnk_08120B20:: @ 08120B20
|
|
||||||
.4byte sub_080886A4
|
|
||||||
.4byte sub_08088718
|
|
||||||
.4byte sub_08088760
|
|
||||||
.4byte sub_08088790
|
|
||||||
.4byte sub_080887D8
|
|
|
@ -656,7 +656,7 @@ SECTIONS {
|
||||||
asm/object/object20.o(.text);
|
asm/object/object20.o(.text);
|
||||||
asm/object/object21.o(.text);
|
asm/object/object21.o(.text);
|
||||||
src/object/figurineDevice.o(.text);
|
src/object/figurineDevice.o(.text);
|
||||||
asm/object/eyeSwitch.o(.text);
|
src/object/eyeSwitch.o(.text);
|
||||||
src/object/pressurePlate.o(.text);
|
src/object/pressurePlate.o(.text);
|
||||||
src/object/bigBarrel.o(.text);
|
src/object/bigBarrel.o(.text);
|
||||||
src/object/barrelInside.o(.text);
|
src/object/barrelInside.o(.text);
|
||||||
|
@ -1381,7 +1381,7 @@ SECTIONS {
|
||||||
data/const/object/object21.o(.rodata);
|
data/const/object/object21.o(.rodata);
|
||||||
src/object/figurineDevice.o(.rodata);
|
src/object/figurineDevice.o(.rodata);
|
||||||
data/animations/object/figurineDevice.o(.rodata);
|
data/animations/object/figurineDevice.o(.rodata);
|
||||||
data/const/object/eyeSwitch.o(.rodata);
|
src/object/eyeSwitch.o(.rodata);
|
||||||
data/animations/object/eyeSwitch.o(.rodata);
|
data/animations/object/eyeSwitch.o(.rodata);
|
||||||
src/object/pressurePlate.o(.rodata);
|
src/object/pressurePlate.o(.rodata);
|
||||||
src/object/bigBarrel.o(.rodata);
|
src/object/bigBarrel.o(.rodata);
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
#define NENT_DEPRECATED
|
||||||
|
#include "entity.h"
|
||||||
|
#include "hitbox.h"
|
||||||
|
#include "flags.h"
|
||||||
|
#include "sound.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
Entity base;
|
||||||
|
u8 filler[0x8];
|
||||||
|
u16 unk70;
|
||||||
|
u8 filler2[0x12];
|
||||||
|
u16 eyeSwitchFlags;
|
||||||
|
u16 eyeSwitchFlags2;
|
||||||
|
} EyeSwitchEntity;
|
||||||
|
|
||||||
|
void sub_080886A4(EyeSwitchEntity* this);
|
||||||
|
void sub_08088718(EyeSwitchEntity* this);
|
||||||
|
void sub_08088760(EyeSwitchEntity* this);
|
||||||
|
void sub_08088790(EyeSwitchEntity* this);
|
||||||
|
void sub_080887D8(EyeSwitchEntity* this);
|
||||||
|
|
||||||
|
void EyeSwitch(Entity* this) {
|
||||||
|
static void (*const actionFuncs[])(EyeSwitchEntity*) = {
|
||||||
|
sub_080886A4, sub_08088718, sub_08088760, sub_08088790, sub_080887D8,
|
||||||
|
};
|
||||||
|
actionFuncs[this->action]((EyeSwitchEntity*)this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_080886A4(EyeSwitchEntity* this) {
|
||||||
|
super->animationState = super->type & 3;
|
||||||
|
super->spritePriority.b0 = 6;
|
||||||
|
super->field_0x3c = 7;
|
||||||
|
super->hurtType = 0x48;
|
||||||
|
super->hitType = 1;
|
||||||
|
super->flags2 = 2;
|
||||||
|
super->hitbox = (Hitbox*)&gHitbox_1;
|
||||||
|
if (CheckFlags(this->eyeSwitchFlags)) {
|
||||||
|
super->action = 3;
|
||||||
|
InitializeAnimation(super, super->animationState + 4);
|
||||||
|
} else {
|
||||||
|
super->action = 1;
|
||||||
|
super->flags = super->flags | 0x80;
|
||||||
|
InitializeAnimation(super, super->animationState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_08088718(EyeSwitchEntity* this) {
|
||||||
|
if ((super->bitfield == 0x95 || super->bitfield == 0x8e) &&
|
||||||
|
(DirectionRoundUp(super->field_0x4c->direction) >> 3 == (super->animationState & 3))) {
|
||||||
|
super->action = 2;
|
||||||
|
COLLISION_OFF(super);
|
||||||
|
EnqueueSFX(SFX_111);
|
||||||
|
SetFlag(this->eyeSwitchFlags2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_08088760(EyeSwitchEntity* this) {
|
||||||
|
GetNextFrame(super);
|
||||||
|
if ((super->frame & 0x80) != 0) {
|
||||||
|
super->action = 3;
|
||||||
|
this->unk70 = super->actionDelay << 1;
|
||||||
|
InitializeAnimation(super, super->animationState + 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_08088790(EyeSwitchEntity* this) {
|
||||||
|
if (super->actionDelay != 0) {
|
||||||
|
if ((this->eyeSwitchFlags2 != this->eyeSwitchFlags) && (CheckFlags(this->eyeSwitchFlags))) {
|
||||||
|
super->actionDelay = 0;
|
||||||
|
} else {
|
||||||
|
if (--this->unk70 == 0) {
|
||||||
|
super->action = 4;
|
||||||
|
ClearFlag(this->eyeSwitchFlags2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_080887D8(EyeSwitchEntity* this) {
|
||||||
|
GetNextFrame(super);
|
||||||
|
if ((super->frame & 0x80) != 0) {
|
||||||
|
super->action = 1;
|
||||||
|
COLLISION_ON(super);
|
||||||
|
InitializeAnimation(super, super->animationState);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue