mirror of
https://github.com/zeldaret/tmc
synced 2026-08-03 00:46:50 -04:00
Decompile manager13
This commit is contained in:
+58
-1
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
+31
-2
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user