mirror of https://github.com/zeldaret/tmc.git
Decompile manager13
This commit is contained in:
parent
7a70c65680
commit
1b122a05b6
|
@ -1,89 +0,0 @@
|
|||
.syntax unified
|
||||
push {r4, r5, r6, r7, lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
adds r5, r0, #0
|
||||
ldrb r0, [r5, #0xc]
|
||||
cmp r0, #0
|
||||
bne _08059DBE
|
||||
movs r0, #1
|
||||
strb r0, [r5, #0xc]
|
||||
_08059DBE:
|
||||
ldr r1, _08059E4C @ =gRoomControls
|
||||
ldrb r0, [r1, #4]
|
||||
ldr r4, _08059E50 @ =gUnk_081084C8
|
||||
cmp r0, #0x15
|
||||
bne _08059DCA
|
||||
ldr r4, _08059E54 @ =gUnk_08108530
|
||||
_08059DCA:
|
||||
movs r7, #0
|
||||
ldrh r0, [r4]
|
||||
cmp r0, #0
|
||||
beq _08059E46
|
||||
mov r8, r1
|
||||
_08059DD4:
|
||||
movs r6, #1
|
||||
lsls r6, r7
|
||||
ldr r0, [r5, #0x20]
|
||||
ands r0, r6
|
||||
cmp r0, #0
|
||||
bne _08059E38
|
||||
ldrh r0, [r4]
|
||||
ldrh r1, [r4, #2]
|
||||
movs r2, #0x10
|
||||
movs r3, #0x10
|
||||
bl CheckRectOnScreen
|
||||
cmp r0, #0
|
||||
beq _08059E38
|
||||
ldrb r1, [r4, #4]
|
||||
movs r0, #0x1c
|
||||
adds r2, r7, #0
|
||||
bl CreateObject
|
||||
adds r2, r0, #0
|
||||
cmp r2, #0
|
||||
beq _08059E38
|
||||
ldrb r0, [r4, #5]
|
||||
strb r0, [r2, #0x1e]
|
||||
ldrh r0, [r4]
|
||||
mov r1, r8
|
||||
ldrh r1, [r1, #6]
|
||||
adds r0, r0, r1
|
||||
strh r0, [r2, #0x2e]
|
||||
ldrh r0, [r4, #2]
|
||||
mov r3, r8
|
||||
ldrh r3, [r3, #8]
|
||||
adds r0, r0, r3
|
||||
strh r0, [r2, #0x32]
|
||||
str r5, [r2, #0x50]
|
||||
ldrh r1, [r4]
|
||||
adds r0, r2, #0
|
||||
adds r0, #0x80
|
||||
strh r1, [r0]
|
||||
ldrh r0, [r4, #2]
|
||||
adds r1, r2, #0
|
||||
adds r1, #0x82
|
||||
strh r0, [r1]
|
||||
ldrb r1, [r4, #6]
|
||||
adds r0, r2, #0
|
||||
adds r0, #0x38
|
||||
strb r1, [r0]
|
||||
ldr r0, [r5, #0x20]
|
||||
orrs r0, r6
|
||||
str r0, [r5, #0x20]
|
||||
_08059E38:
|
||||
adds r4, #8
|
||||
adds r7, #1
|
||||
ldrh r0, [r4]
|
||||
cmp r0, #0
|
||||
beq _08059E46
|
||||
cmp r7, #0x1f
|
||||
bls _08059DD4
|
||||
_08059E46:
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4, r5, r6, r7, pc}
|
||||
.align 2, 0
|
||||
_08059E4C: .4byte gRoomControls
|
||||
_08059E50: .4byte gUnk_081084C8
|
||||
_08059E54: .4byte gUnk_08108530
|
||||
.syntax divided
|
|
@ -1,68 +0,0 @@
|
|||
.syntax unified
|
||||
push {r4, lr}
|
||||
adds r4, r0, #0
|
||||
ldrh r0, [r4, #0x20]
|
||||
subs r1, r0, #1
|
||||
strh r1, [r4, #0x20]
|
||||
lsls r0, r1, #0x10
|
||||
cmp r0, #0
|
||||
bne _0805DC06
|
||||
bl sub_0805DC70
|
||||
b _0805DC6C
|
||||
_0805DC06:
|
||||
lsls r0, r1, #0x10
|
||||
lsrs r1, r0, #0x10
|
||||
cmp r1, #0x78
|
||||
bne _0805DC18
|
||||
movs r0, #0x78
|
||||
movs r1, #2
|
||||
bl sub_08080964
|
||||
b _0805DC36
|
||||
_0805DC18:
|
||||
cmp r1, #0xd2
|
||||
bne _0805DC26
|
||||
movs r0, #0x5a
|
||||
movs r1, #1
|
||||
bl sub_08080964
|
||||
b _0805DC36
|
||||
_0805DC26:
|
||||
movs r0, #0x96
|
||||
lsls r0, r0, #1
|
||||
cmp r1, r0
|
||||
bne _0805DC36
|
||||
movs r0, #0x5a
|
||||
movs r1, #0
|
||||
bl sub_08080964
|
||||
_0805DC36:
|
||||
ldrh r1, [r4, #0x20]
|
||||
adds r0, r1, #0
|
||||
cmp r0, #0x77
|
||||
bhi _0805DC42
|
||||
movs r0, #0xf
|
||||
b _0805DC48
|
||||
_0805DC42:
|
||||
cmp r0, #0xd1
|
||||
bhi _0805DC58
|
||||
movs r0, #0x1f
|
||||
_0805DC48:
|
||||
ands r0, r1
|
||||
cmp r0, #0
|
||||
bne _0805DC6C
|
||||
movs r0, #0x93
|
||||
lsls r0, r0, #1
|
||||
bl SoundReq
|
||||
b _0805DC6C
|
||||
_0805DC58:
|
||||
cmp r0, #0xc7
|
||||
bhi _0805DC6C
|
||||
movs r0, #0x3f
|
||||
ands r0, r1
|
||||
cmp r0, #0
|
||||
bne _0805DC6C
|
||||
movs r0, #0x93
|
||||
lsls r0, r0, #1
|
||||
bl SoundReq
|
||||
_0805DC6C:
|
||||
pop {r4, pc}
|
||||
.align 2, 0
|
||||
.syntax divided
|
|
@ -1,3 +1,60 @@
|
|||
#include "manager.h"
|
||||
#include "room.h"
|
||||
#include "object.h"
|
||||
|
||||
ASM_FUNC("asm/non_matching/manager13/Manager13_Main.inc", void Manager13_Main())
|
||||
typedef struct{
|
||||
Manager manager;
|
||||
u32 bitfield;
|
||||
} Manager13;
|
||||
|
||||
typedef struct {
|
||||
u16 x;
|
||||
u16 y;
|
||||
u8 type;
|
||||
u8 frameIndex;
|
||||
u8 collisionLayer;
|
||||
u8 _padding;
|
||||
} SpawnData;
|
||||
|
||||
extern SpawnData gUnk_081084C8[];
|
||||
extern SpawnData gUnk_08108530[];
|
||||
|
||||
extern u32 CheckRectOnScreen(u16, u16, u32, u32);
|
||||
|
||||
/*
|
||||
Keeps track in its bitfield of whether 0x10 x 0x10 rects at certain positions are on the screen.
|
||||
Spawns OBJECT_1C objects that check this and unsets the value in the bitfield.
|
||||
*/
|
||||
void Manager13_Main(Manager13* this) {
|
||||
SpawnData* spawnData;
|
||||
u32 type2;
|
||||
|
||||
if (this->manager.action == 0) {
|
||||
this->manager.action = 1;
|
||||
}
|
||||
if (gRoomControls.areaID == 0x15) {
|
||||
spawnData = gUnk_08108530;
|
||||
} else {
|
||||
spawnData = gUnk_081084C8;
|
||||
}
|
||||
type2 = 0;
|
||||
while ((spawnData->x != 0) && (type2 < 0x20)) {
|
||||
u32 bitfieldFlag = 1 << type2;
|
||||
if ((((this->bitfield & bitfieldFlag) == 0) &&
|
||||
(CheckRectOnScreen(spawnData->x, spawnData->y, 0x10, 0x10) != 0))) {
|
||||
Entity* object = CreateObject(OBJECT_1C, spawnData->type, type2);
|
||||
if (object != NULL) {
|
||||
object->frameIndex = spawnData->frameIndex;
|
||||
object->x.HALF.HI = gRoomControls.roomOriginX + spawnData->x;
|
||||
object->y.HALF.HI = gRoomControls.roomOriginY + spawnData->y;
|
||||
object->parent = (Entity*)this;
|
||||
object->field_0x80.HWORD = spawnData->x;
|
||||
object->field_0x82.HWORD = spawnData->y;
|
||||
object->collisionLayer = spawnData->collisionLayer;
|
||||
this->bitfield |= bitfieldFlag;
|
||||
}
|
||||
}
|
||||
spawnData += 1;
|
||||
type2 += 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "manager.h"
|
||||
#include "structures.h"
|
||||
#include "functions.h"
|
||||
#include "audio.h"
|
||||
|
||||
typedef struct {
|
||||
Manager manager;
|
||||
|
@ -12,6 +13,8 @@ void sub_0805DBF0(Manager34*);
|
|||
|
||||
extern ScreenTransitionData gUnk_0813AC48;
|
||||
|
||||
void sub_0805DC70(void);
|
||||
|
||||
void Manager34_Main(Manager34* this) {
|
||||
gUnk_08108D8C[this->manager.action](this);
|
||||
sub_0805DBF0(this);
|
||||
|
@ -31,9 +34,35 @@ void sub_0805DBCC(Manager34* this) {
|
|||
void nullsub_498(Manager34* this) {
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/manager34/sub_0805DBF0.inc", void sub_0805DBF0(Manager34* this))
|
||||
void sub_0805DBF0(Manager34* this) {
|
||||
if (--this->field_0x20 == 0) {
|
||||
sub_0805DC70();
|
||||
} else {
|
||||
if (this->field_0x20 == 0x78) {
|
||||
sub_08080964(0x78, 2);
|
||||
} else if (this->field_0x20 == 0xd2) {
|
||||
sub_08080964(0x5a, 1);
|
||||
} else if (this->field_0x20 == 0x12c) {
|
||||
sub_08080964(0x5a, 0);
|
||||
}
|
||||
|
||||
void sub_0805DC70(Manager34* this) {
|
||||
if (this->field_0x20 < 0x78) {
|
||||
if ((this->field_0x20 & 0xf) == 0) {
|
||||
SoundReq(SFX_126);
|
||||
}
|
||||
} else if (0xd1 >= this->field_0x20) {
|
||||
if ((this->field_0x20 & 0x1f) == 0) {
|
||||
SoundReq(SFX_126);
|
||||
}
|
||||
} else if (this->field_0x20 <= 199) {
|
||||
if ((this->field_0x20 & 0x3f) == 0) {
|
||||
SoundReq(SFX_126);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0805DC70(void) {
|
||||
sub_0805E5A8();
|
||||
DoExitTransition(&gUnk_0813AC48);
|
||||
}
|
||||
|
|
|
@ -3,14 +3,16 @@
|
|||
|
||||
extern u32 CheckRectOnScreen(s16, s16, u32, u32);
|
||||
|
||||
/*
|
||||
This object is created by Manager13.
|
||||
It checks whether the 0x10 x 0x10 rect at field_0x80, field_0x82 is still on the screen.
|
||||
If not, then it deletes itselfs and unsets the this->type2 bit in the managers field_0x20 bitfield.
|
||||
*/
|
||||
void Object1C(Entity* this) {
|
||||
s32 iVar1;
|
||||
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
}
|
||||
iVar1 = CheckRectOnScreen(this->field_0x80.HWORD, this->field_0x82.HWORD, 0x10, 0x10);
|
||||
if (iVar1 == 0) {
|
||||
if (CheckRectOnScreen(this->field_0x80.HWORD, this->field_0x82.HWORD, 0x10, 0x10) == 0) {
|
||||
this->parent->field_0x20 &= ~(1 << this->type2);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue