mirror of https://github.com/zeldaret/tmc.git
Decompile code_0808C964
Consolidate objects 75 and 76 into macroMushroomStalk since they use the same action functions
This commit is contained in:
parent
de8b01c209
commit
c5c1343c7c
|
@ -1,211 +0,0 @@
|
||||||
.include "asm/macros.inc"
|
|
||||||
|
|
||||||
.include "constants/constants.inc"
|
|
||||||
|
|
||||||
.syntax unified
|
|
||||||
|
|
||||||
.text
|
|
||||||
|
|
||||||
|
|
||||||
thumb_func_start sub_0808C964
|
|
||||||
sub_0808C964: @ 0x0808C964
|
|
||||||
push {r4, lr}
|
|
||||||
adds r4, r0, #0
|
|
||||||
ldrb r1, [r4, #0xa]
|
|
||||||
strb r1, [r4, #0x1e]
|
|
||||||
ldrb r0, [r4, #9]
|
|
||||||
cmp r0, #0x76
|
|
||||||
bne _0808C982
|
|
||||||
ldr r0, _0808CA08 @ =gUI
|
|
||||||
adds r0, #0x20
|
|
||||||
ldrb r0, [r0]
|
|
||||||
cmp r0, #2
|
|
||||||
beq _0808C982
|
|
||||||
adds r0, r1, #0
|
|
||||||
subs r0, #9
|
|
||||||
strb r0, [r4, #0xa]
|
|
||||||
_0808C982:
|
|
||||||
ldrb r0, [r4, #0xa]
|
|
||||||
cmp r0, #4
|
|
||||||
bls _0808C996
|
|
||||||
ldr r0, _0808CA0C @ =gArea
|
|
||||||
ldrb r0, [r0, #0x16]
|
|
||||||
ldrb r1, [r4, #0xb]
|
|
||||||
cmp r0, r1
|
|
||||||
beq _0808C996
|
|
||||||
bl DeleteThisEntity
|
|
||||||
_0808C996:
|
|
||||||
movs r2, #1
|
|
||||||
movs r0, #1
|
|
||||||
strb r0, [r4, #0xc]
|
|
||||||
ldrb r1, [r4, #0x18]
|
|
||||||
subs r0, #5
|
|
||||||
ands r0, r1
|
|
||||||
orrs r0, r2
|
|
||||||
strb r0, [r4, #0x18]
|
|
||||||
ldrb r2, [r4, #0x1b]
|
|
||||||
movs r1, #0x3f
|
|
||||||
adds r0, r1, #0
|
|
||||||
ands r0, r2
|
|
||||||
movs r2, #0x80
|
|
||||||
orrs r0, r2
|
|
||||||
strb r0, [r4, #0x1b]
|
|
||||||
ldrb r0, [r4, #0x19]
|
|
||||||
ands r1, r0
|
|
||||||
orrs r1, r2
|
|
||||||
strb r1, [r4, #0x19]
|
|
||||||
ldrb r0, [r4, #0xb]
|
|
||||||
adds r3, r4, #0
|
|
||||||
adds r3, #0x29
|
|
||||||
movs r1, #7
|
|
||||||
ands r1, r0
|
|
||||||
ldrb r2, [r3]
|
|
||||||
movs r0, #8
|
|
||||||
rsbs r0, r0, #0
|
|
||||||
ands r0, r2
|
|
||||||
orrs r0, r1
|
|
||||||
strb r0, [r3]
|
|
||||||
ldrb r0, [r4, #9]
|
|
||||||
cmp r0, #0x75
|
|
||||||
beq _0808CA04
|
|
||||||
ldrb r2, [r4, #0xa]
|
|
||||||
subs r0, r2, #1
|
|
||||||
lsls r0, r0, #0x18
|
|
||||||
lsrs r0, r0, #0x18
|
|
||||||
cmp r0, #2
|
|
||||||
bhi _0808CA04
|
|
||||||
ldrb r0, [r4, #0x19]
|
|
||||||
movs r1, #3
|
|
||||||
orrs r0, r1
|
|
||||||
strb r0, [r4, #0x19]
|
|
||||||
lsls r0, r2, #0x18
|
|
||||||
lsrs r0, r0, #0x18
|
|
||||||
movs r2, #0x80
|
|
||||||
lsls r2, r2, #1
|
|
||||||
cmp r0, #1
|
|
||||||
bne _0808C9FA
|
|
||||||
movs r2, #0xe0
|
|
||||||
_0808C9FA:
|
|
||||||
adds r0, r4, #0
|
|
||||||
adds r1, r2, #0
|
|
||||||
movs r3, #0
|
|
||||||
bl SetAffineInfo
|
|
||||||
_0808CA04:
|
|
||||||
pop {r4, pc}
|
|
||||||
.align 2, 0
|
|
||||||
_0808CA08: .4byte gUI
|
|
||||||
_0808CA0C: .4byte gArea
|
|
||||||
|
|
||||||
thumb_func_start sub_0808CA10
|
|
||||||
sub_0808CA10: @ 0x0808CA10
|
|
||||||
push {r4, r5, r6, lr}
|
|
||||||
adds r4, r0, #0
|
|
||||||
ldrb r0, [r4, #0xa]
|
|
||||||
cmp r0, #2
|
|
||||||
beq _0808CA40
|
|
||||||
cmp r0, #2
|
|
||||||
bgt _0808CA24
|
|
||||||
cmp r0, #1
|
|
||||||
beq _0808CA2A
|
|
||||||
b _0808CA78
|
|
||||||
_0808CA24:
|
|
||||||
cmp r0, #3
|
|
||||||
beq _0808CA60
|
|
||||||
b _0808CA78
|
|
||||||
_0808CA2A:
|
|
||||||
ldr r2, _0808CA3C @ =gUnk_02018EB0
|
|
||||||
ldrb r0, [r2, #0x18]
|
|
||||||
cmp r0, #0
|
|
||||||
beq _0808CA78
|
|
||||||
movs r0, #0
|
|
||||||
movs r1, #0x20
|
|
||||||
strb r1, [r4, #0xe]
|
|
||||||
strb r0, [r2, #0x18]
|
|
||||||
b _0808CA50
|
|
||||||
.align 2, 0
|
|
||||||
_0808CA3C: .4byte gUnk_02018EB0
|
|
||||||
_0808CA40:
|
|
||||||
ldr r2, _0808CA5C @ =gUnk_02018EB0
|
|
||||||
ldrb r0, [r2, #0x19]
|
|
||||||
cmp r0, #0
|
|
||||||
beq _0808CA78
|
|
||||||
movs r0, #0
|
|
||||||
movs r1, #0x20
|
|
||||||
strb r1, [r4, #0xe]
|
|
||||||
strb r0, [r2, #0x19]
|
|
||||||
_0808CA50:
|
|
||||||
movs r0, #0x97
|
|
||||||
lsls r0, r0, #1
|
|
||||||
bl SoundReq
|
|
||||||
b _0808CA78
|
|
||||||
.align 2, 0
|
|
||||||
_0808CA5C: .4byte gUnk_02018EB0
|
|
||||||
_0808CA60:
|
|
||||||
ldr r2, _0808CABC @ =gUnk_02018EB0
|
|
||||||
ldrb r0, [r2, #0x1a]
|
|
||||||
cmp r0, #0
|
|
||||||
beq _0808CA78
|
|
||||||
movs r0, #0
|
|
||||||
movs r1, #0x20
|
|
||||||
strb r1, [r4, #0xe]
|
|
||||||
strb r0, [r2, #0x1a]
|
|
||||||
movs r0, #0x97
|
|
||||||
lsls r0, r0, #1
|
|
||||||
bl SoundReq
|
|
||||||
_0808CA78:
|
|
||||||
ldrb r0, [r4, #9]
|
|
||||||
cmp r0, #0x75
|
|
||||||
beq _0808CAE0
|
|
||||||
ldrb r1, [r4, #0xa]
|
|
||||||
subs r0, r1, #1
|
|
||||||
lsls r0, r0, #0x18
|
|
||||||
lsrs r0, r0, #0x18
|
|
||||||
adds r5, r1, #0
|
|
||||||
cmp r0, #2
|
|
||||||
bhi _0808CAE0
|
|
||||||
ldrb r1, [r4, #0xe]
|
|
||||||
cmp r1, #0
|
|
||||||
beq _0808CAE0
|
|
||||||
subs r1, #1
|
|
||||||
strb r1, [r4, #0xe]
|
|
||||||
ldrb r0, [r4, #0xf]
|
|
||||||
adds r2, r0, #1
|
|
||||||
strb r2, [r4, #0xf]
|
|
||||||
lsls r1, r1, #0x18
|
|
||||||
cmp r1, #0
|
|
||||||
beq _0808CAC4
|
|
||||||
ldr r0, _0808CAC0 @ =gUnk_08121648
|
|
||||||
movs r1, #0xe
|
|
||||||
ands r1, r2
|
|
||||||
lsls r2, r1, #1
|
|
||||||
adds r2, r2, r0
|
|
||||||
movs r6, #0
|
|
||||||
ldrsh r3, [r2, r6]
|
|
||||||
adds r1, #1
|
|
||||||
lsls r1, r1, #1
|
|
||||||
adds r1, r1, r0
|
|
||||||
movs r0, #0
|
|
||||||
ldrsh r2, [r1, r0]
|
|
||||||
b _0808CACA
|
|
||||||
.align 2, 0
|
|
||||||
_0808CABC: .4byte gUnk_02018EB0
|
|
||||||
_0808CAC0: .4byte gUnk_08121648
|
|
||||||
_0808CAC4:
|
|
||||||
movs r2, #0x80
|
|
||||||
lsls r2, r2, #1
|
|
||||||
adds r3, r2, #0
|
|
||||||
_0808CACA:
|
|
||||||
lsls r0, r5, #0x18
|
|
||||||
lsrs r0, r0, #0x18
|
|
||||||
cmp r0, #1
|
|
||||||
bne _0808CAD6
|
|
||||||
subs r3, #0x20
|
|
||||||
subs r2, #0x20
|
|
||||||
_0808CAD6:
|
|
||||||
adds r0, r4, #0
|
|
||||||
adds r1, r3, #0
|
|
||||||
movs r3, #0
|
|
||||||
bl SetAffineInfo
|
|
||||||
_0808CAE0:
|
|
||||||
pop {r4, r5, r6, pc}
|
|
||||||
.align 2, 0
|
|
|
@ -289,7 +289,7 @@ void Object37();
|
||||||
void JarPortal();
|
void JarPortal();
|
||||||
void BossDoor();
|
void BossDoor();
|
||||||
void Object3A();
|
void Object3A();
|
||||||
void MacroMushromStalks();
|
void MacroMushroomStalks();
|
||||||
void MacroPlayer();
|
void MacroPlayer();
|
||||||
void Object3D();
|
void Object3D();
|
||||||
void Object3E();
|
void Object3E();
|
||||||
|
|
|
@ -680,9 +680,6 @@ SECTIONS {
|
||||||
src/object/bossDoor.o(.text);
|
src/object/bossDoor.o(.text);
|
||||||
src/object/object3A.o(.text);
|
src/object/object3A.o(.text);
|
||||||
src/object/macroMushroomStalks.o(.text);
|
src/object/macroMushroomStalks.o(.text);
|
||||||
src/object/object75.o(.text); /* 75 and 76 are mislocated in object table */
|
|
||||||
src/object/object76.o(.text);
|
|
||||||
asm/object/code_0808C964.o(.text);
|
|
||||||
src/object/macroPlayer.o(.text);
|
src/object/macroPlayer.o(.text);
|
||||||
src/object/object3D.o(.text);
|
src/object/object3D.o(.text);
|
||||||
src/object/object3E.o(.text);
|
src/object/object3E.o(.text);
|
||||||
|
@ -1408,8 +1405,6 @@ SECTIONS {
|
||||||
data/animations/object/bossDoor.o(.rodata);
|
data/animations/object/bossDoor.o(.rodata);
|
||||||
src/object/object3A.o(.rodata);
|
src/object/object3A.o(.rodata);
|
||||||
src/object/macroMushroomStalks.o(.rodata);
|
src/object/macroMushroomStalks.o(.rodata);
|
||||||
src/object/object75.o(.rodata);
|
|
||||||
src/object/object76.o(.rodata);
|
|
||||||
src/object/macroPlayer.o(.rodata);
|
src/object/macroPlayer.o(.rodata);
|
||||||
src/object/object3D.o(.rodata);
|
src/object/object3D.o(.rodata);
|
||||||
src/object/object3E.o(.rodata);
|
src/object/object3E.o(.rodata);
|
||||||
|
|
|
@ -61,7 +61,7 @@ void (*const gObjectFunctions[])(Entity*) = {
|
||||||
[JAR_PORTAL] = JarPortal,
|
[JAR_PORTAL] = JarPortal,
|
||||||
[BOSS_DOOR] = BossDoor,
|
[BOSS_DOOR] = BossDoor,
|
||||||
[OBJECT_3A] = Object3A,
|
[OBJECT_3A] = Object3A,
|
||||||
[PORTAL_MUSHROOM_STALKS] = MacroMushromStalks,
|
[PORTAL_MUSHROOM_STALKS] = MacroMushroomStalks,
|
||||||
[PORTAL_FALLING_PLAYER] = MacroPlayer,
|
[PORTAL_FALLING_PLAYER] = MacroPlayer,
|
||||||
[OBJECT_3D] = Object3D,
|
[OBJECT_3D] = Object3D,
|
||||||
[OBJECT_3E] = Object3E,
|
[OBJECT_3E] = Object3E,
|
||||||
|
|
|
@ -1,12 +1,112 @@
|
||||||
#include "entity.h"
|
#include "entity.h"
|
||||||
|
#include "area.h"
|
||||||
|
#include "main.h"
|
||||||
|
#include "sound.h"
|
||||||
|
#include "object.h"
|
||||||
|
|
||||||
void sub_0808C964(Entity*);
|
void sub_0808C964(Entity*);
|
||||||
void sub_0808CA10(Entity*);
|
void sub_0808CA10(Entity*);
|
||||||
|
|
||||||
void MacroMushromStalks(Entity* this) {
|
static const s16 gUnk_08121648[] = { 264, 252, 256, 256, 248, 260, 240, 264, 248, 260, 256, 256, 264, 252, 272, 248 };
|
||||||
|
|
||||||
|
void MacroMushroomStalks(Entity* this) {
|
||||||
static void (*const actionFuncs[])(Entity*) = {
|
static void (*const actionFuncs[])(Entity*) = {
|
||||||
sub_0808C964,
|
sub_0808C964,
|
||||||
sub_0808CA10,
|
sub_0808CA10,
|
||||||
};
|
};
|
||||||
actionFuncs[this->action](this);
|
actionFuncs[this->action](this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Object75(Entity* this) {
|
||||||
|
static void (*const actionFuncs[])(Entity*) = {
|
||||||
|
sub_0808C964,
|
||||||
|
sub_0808CA10,
|
||||||
|
};
|
||||||
|
|
||||||
|
actionFuncs[this->action](this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Object76(Entity* this) {
|
||||||
|
static void (*const actionFuncs[])(Entity*) = {
|
||||||
|
sub_0808C964,
|
||||||
|
sub_0808CA10,
|
||||||
|
};
|
||||||
|
|
||||||
|
actionFuncs[this->action](this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_0808C964(Entity* this) {
|
||||||
|
u32 uVar1;
|
||||||
|
|
||||||
|
this->frameIndex = this->type;
|
||||||
|
if ((this->id == OBJECT_76) && (gUI.roomControls.area != AREA_HYRULE_TOWN)) {
|
||||||
|
this->type -= 9;
|
||||||
|
}
|
||||||
|
if (4 < this->type) {
|
||||||
|
if (gArea.portal_exit_dir != this->type2) {
|
||||||
|
DeleteThisEntity();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this->action = 1;
|
||||||
|
this->spriteSettings.draw = 1;
|
||||||
|
this->spriteOrientation.flipY = 2;
|
||||||
|
this->spriteRendering.b3 = 2;
|
||||||
|
;
|
||||||
|
this->spritePriority.b0 = this->type2;
|
||||||
|
if (this->id != OBJECT_75 && (u8)(this->type - 1) < 3) {
|
||||||
|
this->spriteRendering.b0 = 3;
|
||||||
|
if (this->type == 1) {
|
||||||
|
uVar1 = 0xe0;
|
||||||
|
} else {
|
||||||
|
uVar1 = 0x100;
|
||||||
|
}
|
||||||
|
SetAffineInfo(this, uVar1, uVar1, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_0808CA10(Entity* this) {
|
||||||
|
s32 sVar3;
|
||||||
|
s32 sVar5;
|
||||||
|
|
||||||
|
switch (this->type) {
|
||||||
|
case 1:
|
||||||
|
if (gUnk_02018EB0.unk_18 != 0) {
|
||||||
|
this->timer = 0x20;
|
||||||
|
gUnk_02018EB0.unk_18 = 0;
|
||||||
|
SoundReq(SFX_12E);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (gUnk_02018EB0.unk_19 != 0) {
|
||||||
|
this->timer = 0x20;
|
||||||
|
gUnk_02018EB0.unk_19 = 0;
|
||||||
|
SoundReq(SFX_12E);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if (gUnk_02018EB0.unk_1a != 0) {
|
||||||
|
this->timer = 0x20;
|
||||||
|
gUnk_02018EB0.unk_1a = 0;
|
||||||
|
SoundReq(SFX_12E);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((this->id != OBJECT_75 && ((u8)(this->type - 1) < 3)) && this->timer != 0) {
|
||||||
|
this->timer--;
|
||||||
|
this->subtimer++;
|
||||||
|
if (this->timer != 0) {
|
||||||
|
sVar5 = gUnk_08121648[this->subtimer & 0xe];
|
||||||
|
sVar3 = gUnk_08121648[(this->subtimer & 0xe) + 1];
|
||||||
|
} else {
|
||||||
|
sVar3 = 0x100;
|
||||||
|
sVar5 = sVar3;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->type == 1) {
|
||||||
|
sVar5 = sVar5 - 0x20;
|
||||||
|
sVar3 = sVar3 - 0x20;
|
||||||
|
}
|
||||||
|
SetAffineInfo(this, sVar5, sVar3, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -160,5 +160,3 @@ void sub_0808C8B8(Object3AEntity* this) {
|
||||||
DeleteThisEntity();
|
DeleteThisEntity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const u16 gUnk_08121648[] = { 264, 252, 256, 256, 248, 260, 240, 264, 248, 260, 256, 256, 264, 252, 272, 248 };
|
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
#define NENT_DEPRECATED
|
|
||||||
#include "entity.h"
|
|
||||||
|
|
||||||
extern void sub_0808C964(Entity*);
|
|
||||||
extern void sub_0808CA10(Entity*);
|
|
||||||
|
|
||||||
void Object75(Entity* this) {
|
|
||||||
static void (*const actionFuncs[])(Entity*) = {
|
|
||||||
sub_0808C964,
|
|
||||||
sub_0808CA10,
|
|
||||||
};
|
|
||||||
|
|
||||||
actionFuncs[this->action](this);
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
#define NENT_DEPRECATED
|
|
||||||
#include "entity.h"
|
|
||||||
|
|
||||||
extern void sub_0808C964(Entity*);
|
|
||||||
extern void sub_0808CA10(Entity*);
|
|
||||||
|
|
||||||
void Object76(Entity* this) {
|
|
||||||
static void (*const actionFuncs[])(Entity*) = {
|
|
||||||
sub_0808C964,
|
|
||||||
sub_0808CA10,
|
|
||||||
};
|
|
||||||
|
|
||||||
actionFuncs[this->action](this);
|
|
||||||
}
|
|
Loading…
Reference in New Issue