mirror of https://github.com/zeldaret/tmc.git
Decompile objectB4
This commit is contained in:
parent
6b192c31a4
commit
7ee35a0c90
|
@ -1,352 +0,0 @@
|
|||
.include "asm/macros.inc"
|
||||
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
|
||||
thumb_func_start ObjectB4
|
||||
ObjectB4: @ 0x080A0B90
|
||||
push {lr}
|
||||
ldr r2, _080A0BA4 @ =gUnk_08124B20
|
||||
ldrb r1, [r0, #0xa]
|
||||
lsls r1, r1, #2
|
||||
adds r1, r1, r2
|
||||
ldr r1, [r1]
|
||||
bl _call_via_r1
|
||||
pop {pc}
|
||||
.align 2, 0
|
||||
_080A0BA4: .4byte gUnk_08124B20
|
||||
|
||||
thumb_func_start sub_080A0BA8
|
||||
sub_080A0BA8: @ 0x080A0BA8
|
||||
push {r4, r5, lr}
|
||||
adds r5, r0, #0
|
||||
ldrb r2, [r5, #0xc]
|
||||
cmp r2, #0
|
||||
beq _080A0BB8
|
||||
cmp r2, #1
|
||||
beq _080A0C08
|
||||
b _080A0CE0
|
||||
_080A0BB8:
|
||||
movs r0, #1
|
||||
strb r0, [r5, #0xc]
|
||||
ldrb r1, [r5, #0x18]
|
||||
subs r0, #5
|
||||
ands r0, r1
|
||||
movs r1, #2
|
||||
orrs r0, r1
|
||||
strb r0, [r5, #0x18]
|
||||
movs r0, #9
|
||||
strb r0, [r5, #0x1e]
|
||||
movs r0, #8
|
||||
strb r0, [r5, #0xe]
|
||||
strb r2, [r5, #0xf]
|
||||
ldrb r1, [r5, #0x19]
|
||||
movs r2, #0x3f
|
||||
adds r0, r2, #0
|
||||
ands r0, r1
|
||||
movs r3, #0x40
|
||||
orrs r0, r3
|
||||
strb r0, [r5, #0x19]
|
||||
adds r4, r5, #0
|
||||
adds r4, #0x29
|
||||
ldrb r1, [r4]
|
||||
movs r0, #8
|
||||
rsbs r0, r0, #0
|
||||
ands r0, r1
|
||||
movs r1, #4
|
||||
orrs r0, r1
|
||||
strb r0, [r4]
|
||||
ldrb r0, [r5, #0x1b]
|
||||
ands r2, r0
|
||||
orrs r2, r3
|
||||
strb r2, [r5, #0x1b]
|
||||
adds r0, r5, #0
|
||||
movs r1, #0xbf
|
||||
movs r2, #0x48
|
||||
movs r3, #0x1e
|
||||
bl sub_0806FB00
|
||||
b _080A0CE0
|
||||
_080A0C08:
|
||||
ldrb r0, [r5, #0xf]
|
||||
cmp r0, #6
|
||||
bhi _080A0C46
|
||||
ldrb r0, [r5, #0xe]
|
||||
subs r0, #1
|
||||
strb r0, [r5, #0xe]
|
||||
lsls r0, r0, #0x18
|
||||
cmp r0, #0
|
||||
bne _080A0C46
|
||||
strb r2, [r5, #0xe]
|
||||
ldrb r2, [r5, #0xf]
|
||||
movs r0, #0xb4
|
||||
movs r1, #1
|
||||
bl CreateObject
|
||||
adds r4, r0, #0
|
||||
cmp r4, #0
|
||||
beq _080A0C40
|
||||
adds r0, r5, #0
|
||||
adds r1, r4, #0
|
||||
bl CopyPosition
|
||||
movs r0, #0x68
|
||||
strh r0, [r4, #0x32]
|
||||
adds r0, r5, #0
|
||||
adds r1, r4, #0
|
||||
bl SortEntityBelow
|
||||
_080A0C40:
|
||||
ldrb r0, [r5, #0xf]
|
||||
adds r0, #1
|
||||
strb r0, [r5, #0xf]
|
||||
_080A0C46:
|
||||
adds r0, r5, #0
|
||||
bl sub_0806FB38
|
||||
cmp r0, #0
|
||||
bne _080A0C58
|
||||
ldr r0, _080A0CE4 @ =gMenu
|
||||
ldrb r0, [r0, #5]
|
||||
cmp r0, #1
|
||||
bls _080A0CE0
|
||||
_080A0C58:
|
||||
movs r0, #0xbf
|
||||
strh r0, [r5, #0x2e]
|
||||
movs r0, #0x48
|
||||
strh r0, [r5, #0x32]
|
||||
movs r0, #0xa
|
||||
strb r0, [r5, #0x1e]
|
||||
movs r0, #2
|
||||
strb r0, [r5, #0xc]
|
||||
ldrb r0, [r5, #0xf]
|
||||
cmp r0, #6
|
||||
bhi _080A0CA0
|
||||
_080A0C6E:
|
||||
ldrb r2, [r5, #0xf]
|
||||
movs r0, #0xb4
|
||||
movs r1, #1
|
||||
bl CreateObject
|
||||
adds r4, r0, #0
|
||||
cmp r4, #0
|
||||
beq _080A0C92
|
||||
adds r0, r5, #0
|
||||
adds r1, r4, #0
|
||||
bl CopyPosition
|
||||
movs r0, #0x68
|
||||
strh r0, [r4, #0x32]
|
||||
adds r0, r5, #0
|
||||
adds r1, r4, #0
|
||||
bl SortEntityBelow
|
||||
_080A0C92:
|
||||
ldrb r0, [r5, #0xf]
|
||||
adds r0, #1
|
||||
strb r0, [r5, #0xf]
|
||||
lsls r0, r0, #0x18
|
||||
lsrs r0, r0, #0x18
|
||||
cmp r0, #6
|
||||
bls _080A0C6E
|
||||
_080A0CA0:
|
||||
movs r0, #0xb4
|
||||
movs r1, #2
|
||||
movs r2, #0
|
||||
bl CreateObject
|
||||
adds r4, r0, #0
|
||||
cmp r4, #0
|
||||
beq _080A0CC0
|
||||
movs r0, #0xc4
|
||||
strh r0, [r4, #0x2e]
|
||||
movs r0, #0x2c
|
||||
strh r0, [r4, #0x32]
|
||||
adds r0, r5, #0
|
||||
adds r1, r4, #0
|
||||
bl SortEntityAbove
|
||||
_080A0CC0:
|
||||
movs r0, #0xb4
|
||||
movs r1, #3
|
||||
movs r2, #0
|
||||
bl CreateObject
|
||||
adds r4, r0, #0
|
||||
cmp r4, #0
|
||||
beq _080A0CE0
|
||||
movs r0, #0xb4
|
||||
strh r0, [r4, #0x2e]
|
||||
movs r0, #0x19
|
||||
strh r0, [r4, #0x32]
|
||||
adds r0, r5, #0
|
||||
adds r1, r4, #0
|
||||
bl SortEntityAbove
|
||||
_080A0CE0:
|
||||
pop {r4, r5, pc}
|
||||
.align 2, 0
|
||||
_080A0CE4: .4byte gMenu
|
||||
|
||||
thumb_func_start sub_080A0CE8
|
||||
sub_080A0CE8: @ 0x080A0CE8
|
||||
push {r4, lr}
|
||||
adds r4, r0, #0
|
||||
ldrb r0, [r4, #0xc]
|
||||
cmp r0, #0
|
||||
beq _080A0CF8
|
||||
cmp r0, #1
|
||||
beq _080A0D28
|
||||
b _080A0D66
|
||||
_080A0CF8:
|
||||
movs r0, #1
|
||||
strb r0, [r4, #0xc]
|
||||
ldrb r1, [r4, #0x18]
|
||||
subs r0, #5
|
||||
ands r0, r1
|
||||
movs r1, #2
|
||||
orrs r0, r1
|
||||
strb r0, [r4, #0x18]
|
||||
ldrb r0, [r4, #0xb]
|
||||
adds r0, #2
|
||||
strb r0, [r4, #0x1e]
|
||||
ldr r1, _080A0D24 @ =gUnk_08124B10
|
||||
ldrb r0, [r4, #0xb]
|
||||
lsls r0, r0, #1
|
||||
adds r0, r0, r1
|
||||
ldrh r1, [r0]
|
||||
adds r0, r4, #0
|
||||
movs r2, #0x68
|
||||
movs r3, #0x14
|
||||
bl sub_0806FB00
|
||||
b _080A0D66
|
||||
.align 2, 0
|
||||
_080A0D24: .4byte gUnk_08124B10
|
||||
_080A0D28:
|
||||
adds r0, r4, #0
|
||||
bl sub_0806FB38
|
||||
cmp r0, #0
|
||||
bne _080A0D3A
|
||||
ldr r0, _080A0D68 @ =gMenu
|
||||
ldrb r0, [r0, #5]
|
||||
cmp r0, #1
|
||||
bls _080A0D66
|
||||
_080A0D3A:
|
||||
ldr r1, _080A0D6C @ =gUnk_08124B10
|
||||
ldrb r0, [r4, #0xb]
|
||||
lsls r0, r0, #1
|
||||
adds r0, r0, r1
|
||||
ldrh r0, [r0]
|
||||
strh r0, [r4, #0x2e]
|
||||
movs r0, #0x68
|
||||
strh r0, [r4, #0x32]
|
||||
ldrb r1, [r4, #0xb]
|
||||
movs r0, #7
|
||||
subs r1, r0, r1
|
||||
adds r3, r4, #0
|
||||
adds r3, #0x29
|
||||
ands r1, r0
|
||||
ldrb r2, [r3]
|
||||
movs r0, #8
|
||||
rsbs r0, r0, #0
|
||||
ands r0, r2
|
||||
orrs r0, r1
|
||||
strb r0, [r3]
|
||||
movs r0, #2
|
||||
strb r0, [r4, #0xc]
|
||||
_080A0D66:
|
||||
pop {r4, pc}
|
||||
.align 2, 0
|
||||
_080A0D68: .4byte gMenu
|
||||
_080A0D6C: .4byte gUnk_08124B10
|
||||
|
||||
thumb_func_start sub_080A0D70
|
||||
sub_080A0D70: @ 0x080A0D70
|
||||
push {r4, r5, r6, lr}
|
||||
adds r5, r0, #0
|
||||
ldrb r6, [r5, #0xc]
|
||||
cmp r6, #0
|
||||
bne _080A0DC4
|
||||
movs r0, #1
|
||||
strb r0, [r5, #0xc]
|
||||
ldrb r1, [r5, #0x18]
|
||||
subs r0, #5
|
||||
ands r0, r1
|
||||
movs r1, #2
|
||||
orrs r0, r1
|
||||
strb r0, [r5, #0x18]
|
||||
ldrb r2, [r5, #0x19]
|
||||
movs r4, #0x3f
|
||||
movs r1, #0x3f
|
||||
adds r0, r1, #0
|
||||
ands r0, r2
|
||||
movs r3, #0x40
|
||||
orrs r0, r3
|
||||
strb r0, [r5, #0x19]
|
||||
movs r0, #0x29
|
||||
adds r0, r0, r5
|
||||
mov ip, r0
|
||||
ldrb r2, [r0]
|
||||
movs r0, #8
|
||||
rsbs r0, r0, #0
|
||||
ands r0, r2
|
||||
mov r2, ip
|
||||
strb r0, [r2]
|
||||
ldrb r0, [r5, #0x1b]
|
||||
ands r1, r0
|
||||
orrs r1, r3
|
||||
strb r1, [r5, #0x1b]
|
||||
movs r0, #0xb
|
||||
strb r0, [r5, #0x1e]
|
||||
bl Random
|
||||
ands r0, r4
|
||||
adds r0, #0x40
|
||||
strb r0, [r5, #0xe]
|
||||
strb r6, [r5, #0xf]
|
||||
_080A0DC4:
|
||||
ldrb r0, [r5, #0xe]
|
||||
subs r0, #1
|
||||
strb r0, [r5, #0xe]
|
||||
lsls r0, r0, #0x18
|
||||
lsrs r4, r0, #0x18
|
||||
cmp r4, #0
|
||||
bne _080A0E02
|
||||
movs r0, #4
|
||||
strb r0, [r5, #0xe]
|
||||
ldr r2, _080A0E04 @ =gUnk_08124B30
|
||||
ldrb r0, [r5, #0xf]
|
||||
adds r1, r0, #1
|
||||
strb r1, [r5, #0xf]
|
||||
lsls r0, r0, #0x18
|
||||
lsrs r0, r0, #0x18
|
||||
adds r0, r0, r2
|
||||
ldrb r0, [r0]
|
||||
adds r0, #2
|
||||
strb r0, [r5, #0x1e]
|
||||
ldrb r0, [r5, #0xf]
|
||||
adds r0, r0, r2
|
||||
ldrb r0, [r0]
|
||||
cmp r0, #0xff
|
||||
bne _080A0E02
|
||||
bl Random
|
||||
movs r1, #0x3f
|
||||
ands r0, r1
|
||||
adds r0, #0x40
|
||||
strb r0, [r5, #0xe]
|
||||
strb r4, [r5, #0xf]
|
||||
_080A0E02:
|
||||
pop {r4, r5, r6, pc}
|
||||
.align 2, 0
|
||||
_080A0E04: .4byte gUnk_08124B30
|
||||
|
||||
thumb_func_start sub_080A0E08
|
||||
sub_080A0E08: @ 0x080A0E08
|
||||
push {lr}
|
||||
adds r2, r0, #0
|
||||
ldrb r0, [r2, #0xc]
|
||||
cmp r0, #0
|
||||
bne _080A0E26
|
||||
movs r0, #1
|
||||
strb r0, [r2, #0xc]
|
||||
ldrb r1, [r2, #0x18]
|
||||
subs r0, #5
|
||||
ands r0, r1
|
||||
movs r1, #2
|
||||
orrs r0, r1
|
||||
strb r0, [r2, #0x18]
|
||||
movs r0, #0xf
|
||||
strb r0, [r2, #0x1e]
|
||||
_080A0E26:
|
||||
pop {pc}
|
|
@ -45043,16 +45043,6 @@
|
|||
"size": 83,
|
||||
"type": "animation"
|
||||
},
|
||||
{
|
||||
"path": "objectB4/gUnk_08124B10.bin",
|
||||
"start": 1198864,
|
||||
"size": 16
|
||||
},
|
||||
{
|
||||
"path": "objectB4/gUnk_08124B30.bin",
|
||||
"start": 1198896,
|
||||
"size": 8
|
||||
},
|
||||
{
|
||||
"path": "objectB9/gUnk_08124C20.bin",
|
||||
"start": 1199136,
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
.include "asm/macros.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.section .rodata
|
||||
.align 2
|
||||
|
||||
gUnk_08124B10:: @ 08124B10
|
||||
.incbin "objectB4/gUnk_08124B10.bin"
|
||||
|
||||
gUnk_08124B20:: @ 08124B20
|
||||
.4byte sub_080A0BA8
|
||||
.4byte sub_080A0CE8
|
||||
.4byte sub_080A0D70
|
||||
.4byte sub_080A0E08
|
||||
|
||||
gUnk_08124B30:: @ 08124B30
|
||||
.incbin "objectB4/gUnk_08124B30.bin"
|
|
@ -805,7 +805,7 @@ SECTIONS {
|
|||
src/object/jailBars.o(.text);
|
||||
src/object/objectB2.o(.text);
|
||||
src/object/objectB3.o(.text);
|
||||
asm/object/objectB4.o(.text);
|
||||
src/object/objectB4.o(.text);
|
||||
src/object/objectB5.o(.text);
|
||||
src/object/objectB6.o(.text);
|
||||
src/object/well.o(.text);
|
||||
|
@ -1561,7 +1561,7 @@ SECTIONS {
|
|||
data/animations/object/objectB2.o(.rodata);
|
||||
src/object/objectB3.o(.rodata);
|
||||
data/animations/object/objectB3.o(.rodata);
|
||||
data/const/object/objectB4.o(.rodata);
|
||||
src/object/objectB4.o(.rodata);
|
||||
data/animations/object/objectB4.o(.rodata);
|
||||
data/const/object/well.o(.rodata);
|
||||
src/object/windTribeTeleporter.o(.rodata);
|
||||
|
|
|
@ -0,0 +1,135 @@
|
|||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "menu.h"
|
||||
#include "coord.h"
|
||||
#include "object.h"
|
||||
|
||||
extern void sub_0806FB00(Entity*, u32, u32, u32);
|
||||
extern bool32 sub_0806FB38(Entity*);
|
||||
|
||||
void ObjectB4_Type0(Entity*);
|
||||
void ObjectB4_Type1(Entity*);
|
||||
void ObjectB4_Type2(Entity*);
|
||||
void ObjectB4_Type3(Entity*);
|
||||
|
||||
const u16 gUnk_08124B10[] = { 0x40, 0x58, 0x68, 0x80, 0x94, 0xA8, 0xB0, 0x0 };
|
||||
|
||||
void ObjectB4(Entity* this) {
|
||||
static void (*const typeFuncs[])(Entity*) = {
|
||||
ObjectB4_Type0,
|
||||
ObjectB4_Type1,
|
||||
ObjectB4_Type2,
|
||||
ObjectB4_Type3,
|
||||
};
|
||||
|
||||
typeFuncs[this->type]((Entity*)this);
|
||||
}
|
||||
|
||||
void ObjectB4_Type0(Entity* this) {
|
||||
Entity* pEVar3;
|
||||
|
||||
switch (this->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 2;
|
||||
this->frameIndex = 9;
|
||||
this->actionDelay = 8;
|
||||
this->field_0xf = 0;
|
||||
this->spriteRendering.b3 = 1;
|
||||
this->spritePriority.b0 = 4;
|
||||
this->spriteOrientation.flipY = 1;
|
||||
sub_0806FB00(this, 0xbf, 0x48, 0x1e);
|
||||
break;
|
||||
case 1:
|
||||
if ((this->field_0xf < 7) && (--this->actionDelay == 0)) {
|
||||
this->actionDelay = 1;
|
||||
pEVar3 = CreateObject(OBJECT_B4, 1, this->field_0xf);
|
||||
if (pEVar3 != NULL) {
|
||||
CopyPosition(this, pEVar3);
|
||||
pEVar3->y.HALF.HI = 0x68;
|
||||
SortEntityBelow(this, pEVar3);
|
||||
}
|
||||
this->field_0xf++;
|
||||
}
|
||||
|
||||
if (sub_0806FB38(this) || (1 < gMenu.menuType)) {
|
||||
this->x.HALF.HI = 0xbf;
|
||||
this->y.HALF.HI = 0x48;
|
||||
this->frameIndex = 10;
|
||||
this->action = 2;
|
||||
while (this->field_0xf < 7) {
|
||||
pEVar3 = CreateObject(OBJECT_B4, 1, this->field_0xf);
|
||||
if (pEVar3 != NULL) {
|
||||
CopyPosition(this, pEVar3);
|
||||
pEVar3->y.HALF.HI = 0x68;
|
||||
SortEntityBelow(this, pEVar3);
|
||||
}
|
||||
this->field_0xf++;
|
||||
}
|
||||
|
||||
pEVar3 = CreateObject(OBJECT_B4, 2, 0);
|
||||
if (pEVar3 != NULL) {
|
||||
pEVar3->x.HALF.HI = 0xc4;
|
||||
pEVar3->y.HALF.HI = 0x2c;
|
||||
SortEntityAbove(this, pEVar3);
|
||||
}
|
||||
|
||||
pEVar3 = CreateObject(OBJECT_B4, 3, 0);
|
||||
if (pEVar3 != NULL) {
|
||||
pEVar3->x.HALF.HI = 0xb4;
|
||||
pEVar3->y.HALF.HI = 0x19;
|
||||
SortEntityAbove(this, pEVar3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectB4_Type1(Entity* this) {
|
||||
switch (this->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 2;
|
||||
this->frameIndex = this->type2 + 2;
|
||||
sub_0806FB00(this, gUnk_08124B10[this->type2], 0x68, 0x14);
|
||||
break;
|
||||
case 1:
|
||||
if (sub_0806FB38(this) || 1 < gMenu.menuType) {
|
||||
this->x.HALF.HI = gUnk_08124B10[this->type2];
|
||||
this->y.HALF.HI = 0x68;
|
||||
this->spritePriority.b0 = 7 - this->type2;
|
||||
this->action = 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectB4_Type2(Entity* this) {
|
||||
static const u8 gUnk_08124B30[] = { 9, 10, 11, 12, 11, 10, 9, -1 };
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 2;
|
||||
this->spriteRendering.b3 = 1;
|
||||
this->spritePriority.b0 = 0;
|
||||
this->spriteOrientation.flipY = 1;
|
||||
this->frameIndex = 11;
|
||||
this->actionDelay = (Random() & 0x3f) + 0x40;
|
||||
this->field_0xf = 0;
|
||||
}
|
||||
|
||||
if (--this->actionDelay == 0) {
|
||||
this->actionDelay = 4;
|
||||
this->frameIndex = gUnk_08124B30[this->field_0xf++] + 2;
|
||||
if (gUnk_08124B30[this->field_0xf] == 0xff) {
|
||||
this->actionDelay = (Random() & 0x3f) + 0x40;
|
||||
this->field_0xf = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectB4_Type3(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 2;
|
||||
this->frameIndex = 15;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue