mirror of
https://github.com/zeldaret/tmc
synced 2026-08-19 05:52:33 -04:00
Merge branch 'upstream/master' into main
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
extern void sub_080A2CC0();
|
||||
extern void sub_0806F69C();
|
||||
extern void EnqueueSFX();
|
||||
extern Entity* GetCurrentRoomProperty();
|
||||
|
||||
void BladeTrap(Entity* ent) {
|
||||
u16 uVar1;
|
||||
|
||||
@@ -132,12 +132,6 @@ void ClearDeletedEntity(Entity* ent) {
|
||||
gEntCount--;
|
||||
}
|
||||
|
||||
typedef struct LinkedList {
|
||||
Entity* last;
|
||||
Entity* first;
|
||||
} LinkedList;
|
||||
|
||||
extern LinkedList gEntityLists[9];
|
||||
extern EntityType gUnk_03003DB8;
|
||||
|
||||
void DeleteAllEntities(void) {
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "flags.h"
|
||||
|
||||
void LoadRoomEntityList(EntityData* dat);
|
||||
extern EntityData* GetCurrentRoomProperty(u32 unk);
|
||||
extern void sub_0804B058(EntityData* dat);
|
||||
extern void LoadRoomTileEntities(EntityData* dat);
|
||||
extern void sub_0801AC98();
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
#include "global.h"
|
||||
#include "manager.h"
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "room.h"
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct {
|
||||
Manager manager;
|
||||
u8 unk_20[0x8];
|
||||
u8 unk_28;
|
||||
u8 unk_29;
|
||||
u16 unk_2a;
|
||||
} Manager26;
|
||||
|
||||
void sub_0805C6D0(Manager26*);
|
||||
void sub_0805C7A0(Manager26*);
|
||||
void sub_0805C7C4(Manager26*);
|
||||
|
||||
void (* const gUnk_08108D04[])(Manager26*) = {
|
||||
sub_0805C6D0,
|
||||
sub_0805C7A0,
|
||||
sub_0805C7C4
|
||||
};
|
||||
|
||||
void sub_0805C7CC(Manager26*);
|
||||
|
||||
void sub_0805C6B8(Manager26* this) {
|
||||
gUnk_08108D04[this->manager.action](this);
|
||||
}
|
||||
|
||||
void sub_0805C6D0(Manager26* this) {
|
||||
UnkManager26HelperStruct* tmp = GetCurrentRoomProperty(this->manager.unk_0a);
|
||||
if (!tmp) {
|
||||
DeleteManager(&this->manager);
|
||||
return;
|
||||
}
|
||||
this->unk_2a = gRoomControls.roomOriginY + this->manager.unk_0e;
|
||||
this->manager.unk_0e = 0;
|
||||
this->unk_28 = 0;
|
||||
this->unk_29 = 0;
|
||||
while (tmp->unk_00 != 0xFF && this->manager.unk_0e < 0x20) {
|
||||
Entity* obj;
|
||||
obj = CreateObject(0x4C, tmp->unk_01, tmp->unk_02);
|
||||
if (obj) {
|
||||
obj->actionDelay = tmp->unk_03;
|
||||
obj->x.HALF.HI = gRoomControls.roomOriginX + tmp->unk_04;
|
||||
obj->y.HALF.HI = gRoomControls.roomOriginY + tmp->unk_06;
|
||||
obj->parent = (Entity*) this;
|
||||
obj->collisionLayer = 1;
|
||||
obj->field_0x82.HALF.HI = this->manager.unk_0e;
|
||||
obj->field_0x82.HALF.LO = tmp->unk_00;
|
||||
this->unk_29 |= 1 << this->manager.unk_0e;
|
||||
}
|
||||
tmp++;
|
||||
this->manager.unk_0e++;
|
||||
}
|
||||
if (this->manager.unk_0b == 0xFF) {
|
||||
this->manager.action = 2;
|
||||
} else {
|
||||
if (CheckLocalFlag(this->manager.unk_0b)) {
|
||||
this->manager.action = 2;
|
||||
} else {
|
||||
this->manager.action = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0805C7A0(Manager26* this) {
|
||||
if (this->unk_28 == this->unk_29) {
|
||||
this->manager.action = 2;
|
||||
SetLocalFlag(this->manager.unk_0b);
|
||||
}
|
||||
sub_0805C7CC(this);
|
||||
}
|
||||
|
||||
void sub_0805C7C4(Manager26* this) {
|
||||
sub_0805C7CC(this);
|
||||
}
|
||||
|
||||
void sub_0805C7CC(Manager26* this) {
|
||||
if (gPlayerState.flags.all & 0x80) {
|
||||
if (gPlayerEntity.y.HALF.HI < this->unk_2a + 0x10) {
|
||||
this->manager.unk_0d = 1;
|
||||
} else {
|
||||
this->manager.unk_0d = 0;
|
||||
}
|
||||
} else {
|
||||
if (gPlayerEntity.y.HALF.HI < this->unk_2a + 0x28) {
|
||||
this->manager.unk_0d = 3;
|
||||
} else {
|
||||
this->manager.unk_0d = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
-3
@@ -5,9 +5,22 @@
|
||||
|
||||
extern u32 sub_0805C920(Entity*);
|
||||
extern void LoadPaletteGroup(u32);
|
||||
extern void (*const gUnk_08108D10[])(Entity*);
|
||||
|
||||
extern u8 gUnk_08108D20[];
|
||||
void sub_0805C874(Entity*);
|
||||
void sub_0805C894(Entity*);
|
||||
void sub_0805C8B4(Entity*);
|
||||
void sub_0805C908(Entity*);
|
||||
|
||||
void (*const gUnk_08108D10[])(Entity*) = {
|
||||
sub_0805C874,
|
||||
sub_0805C894,
|
||||
sub_0805C8B4,
|
||||
sub_0805C908
|
||||
};
|
||||
|
||||
const u8 gUnk_08108D20[] = {
|
||||
0x6F, 0x70, 0x71, 0x72, 0x71, 0x70
|
||||
};
|
||||
|
||||
void Manager27(Entity* this) {
|
||||
|
||||
@@ -33,7 +46,6 @@ void sub_0805C874(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0805C894(Entity* this) {
|
||||
|
||||
if (sub_0805C920(this)) {
|
||||
this->action = 2;
|
||||
this->actionDelay = 1;
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
#include "global.h"
|
||||
#include "manager.h"
|
||||
#include "entity.h"
|
||||
#include "room.h"
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct {
|
||||
Manager manager;
|
||||
Entity* enemies[8];
|
||||
} Manager28;
|
||||
|
||||
void Manager28_Entry(Manager28*);
|
||||
void Manager28_Init(Manager28*);
|
||||
void Manager28_Main(Manager28*);
|
||||
u32 Manager28_FindMatchingEntities(Manager28*);
|
||||
Entity* Manager28_FindMatchingEntity(EntityData*);
|
||||
void Manager28_RemoveDeletedEntities(Manager28*);
|
||||
|
||||
void (* const Manager28_ActionFuncs[])(Manager28*) = {
|
||||
Manager28_Init,
|
||||
Manager28_Main
|
||||
};
|
||||
|
||||
enum Manager28_Action {
|
||||
Init = 0,
|
||||
Main = 1
|
||||
};
|
||||
|
||||
enum Manager28_InitState {
|
||||
DoInit = 0,
|
||||
DoNotInit = 1
|
||||
};
|
||||
|
||||
void Manager28_Entry(Manager28* this) {
|
||||
Manager28_ActionFuncs[this->manager.action](this);
|
||||
}
|
||||
|
||||
NONMATCH("asm/non_matching/manager28/Manager28_Init.inc", void Manager28_Init(Manager28* this)) {
|
||||
if (this->manager.unk_0a == DoInit) {
|
||||
s32 tmp2;
|
||||
int tmp4;
|
||||
for (tmp4 = 0; tmp4 < 8; tmp4++) {
|
||||
this->enemies[tmp4] = 0;
|
||||
}
|
||||
tmp2 = Manager28_FindMatchingEntities(this);
|
||||
if (tmp2 > 1) {
|
||||
Manager28* tmp3 = (Manager28*) GetEmptyManager();
|
||||
if (tmp3) {
|
||||
tmp3->manager.type = 9;
|
||||
tmp3->manager.subtype = 0x28;
|
||||
tmp3->manager.unk_0a = DoNotInit;
|
||||
tmp3->manager.unk_0e = tmp2;
|
||||
for (tmp4 = 0; tmp4 < 8; tmp4++) {
|
||||
tmp3->enemies[tmp4] = this->enemies[tmp4];
|
||||
}
|
||||
AppendEntityToList(tmp3, 6);
|
||||
}
|
||||
}
|
||||
DeleteManager(&this->manager);
|
||||
} else {
|
||||
this->manager.action = Main;
|
||||
this->manager.unk_0f = 0;
|
||||
}
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
void Manager28_Main(Manager28* this) {
|
||||
s32 n;
|
||||
s32 i;
|
||||
s32 j;
|
||||
Entity* tmp;
|
||||
Manager28_RemoveDeletedEntities(this);
|
||||
n = this->manager.unk_0e - 1;
|
||||
if ((this->manager.unk_0f++) & 1) {
|
||||
for (i = 0; i < n; i++) {
|
||||
tmp = this->enemies[i];
|
||||
for (j = i + 1; j < this->manager.unk_0e; j++) {
|
||||
sub_08004484(tmp, this->enemies[j]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < n; i++) {
|
||||
tmp = this->enemies[i];
|
||||
for (j = i + 1; j < this->manager.unk_0e; j++) {
|
||||
sub_08004484(this->enemies[j], tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u32 Manager28_FindMatchingEntities(Manager28* this) {
|
||||
u32 re = 0;
|
||||
EntityData * tmp = GetCurrentRoomProperty(this->manager.unk_0b);
|
||||
if (!tmp) return 0;
|
||||
for (; *((u8*) tmp) != 0xFF && !(tmp->type == 9 && tmp->subtype == 0x28); tmp++) {
|
||||
Entity* tmp2;
|
||||
u32 i;
|
||||
if (tmp->type != 3) continue;
|
||||
tmp2 = Manager28_FindMatchingEntity(tmp);
|
||||
if (!tmp2) continue;
|
||||
for (i = 0; i < re; i++) {
|
||||
if (this->enemies[i] == tmp2) break;
|
||||
}
|
||||
if (i != re) continue;
|
||||
this->enemies[re++] = tmp2;
|
||||
if (re == 8) return 8;
|
||||
}
|
||||
return re;
|
||||
}
|
||||
|
||||
Entity* Manager28_FindMatchingEntity(EntityData* unk1) {
|
||||
u32 x, y;
|
||||
Entity* i;
|
||||
LinkedList* tmp;
|
||||
x = unk1->xPos + gRoomControls.roomOriginX;
|
||||
y = unk1->yPos + gRoomControls.roomOriginY;
|
||||
tmp = &gUnk_03003D90;
|
||||
for (i = tmp->first; (u32) i != (u32) tmp; i = i->next) {
|
||||
if (x == i->x.HALF.HI
|
||||
&& y == i->y.HALF.HI
|
||||
&& unk1->subtype == i->entityType.subtype
|
||||
&& 3 == i->entityType.type
|
||||
&& unk1->form == i->entityType.form) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Manager28_RemoveDeletedEntities(Manager28* this) {
|
||||
s32 i;
|
||||
for (i = 0; i < this->manager.unk_0e; i++) {
|
||||
if (this->enemies[i]->next == 0) {
|
||||
if (this->manager.unk_0e-1 == i) {
|
||||
this->enemies[i] = 0;
|
||||
} else {
|
||||
this->enemies[i] = this->enemies[this->manager.unk_0e-1];
|
||||
}
|
||||
this->manager.unk_0e--;
|
||||
}
|
||||
}
|
||||
if (this->manager.unk_0e <= 1) DeleteThisEntity();
|
||||
}
|
||||
@@ -83,7 +83,6 @@ void ManagerB_WaitForDone(ManagerB* this) {
|
||||
ManagerBHelper* CreateHelper(Manager*);
|
||||
void ManagerBHelper_Monitor(ManagerBHelper*, Entity*, u32);
|
||||
|
||||
extern EntityData* GetCurrentRoomProperty(u8);
|
||||
extern Entity* LoadRoomEntity(EntityData*);
|
||||
|
||||
void ManagerB_LoadFight(Manager* this) {
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "flags.h"
|
||||
#include "room.h"
|
||||
|
||||
extern Entity* GetCurrentRoomProperty(u8);
|
||||
extern void LoadRoomEntityList(Entity*);
|
||||
extern void DeleteThisEntity(void);
|
||||
extern void DeleteManager(Manager*);
|
||||
|
||||
@@ -26,7 +26,6 @@ static u8 sub_08086954(Entity*);
|
||||
|
||||
extern u32 sub_080562CC(u32, u32, u32, u32);
|
||||
extern void sub_08078AC0(u32, u32, u32);
|
||||
extern void* GetCurrentRoomProperty(u8);
|
||||
|
||||
extern void (*const gUnk_081206B4[])(Entity*);
|
||||
extern BoundingBox gUnk_081206AC; // TODO: should be const
|
||||
|
||||
@@ -9,7 +9,6 @@ extern void sub_0809EAD8(Entity*);
|
||||
extern void sub_0809EABC(Entity*);
|
||||
extern void EnqueueSFX(u32);
|
||||
extern void sub_080A2CC0(Entity*, Entity**, u16*);
|
||||
extern Entity* GetCurrentRoomProperty(u32);
|
||||
extern void SetTile(u32, u32, u32);
|
||||
extern void sub_0806F69C(Entity*);
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "functions.h"
|
||||
#include "player.h"
|
||||
|
||||
extern Entity* GetCurrentRoomProperty(u32);
|
||||
extern void sub_080A2CC0(Entity*, Entity**, u16*);
|
||||
|
||||
extern u16 gUnk_08123318[];
|
||||
|
||||
@@ -323,7 +323,7 @@ void sub_0808EBB8(Entity* this) {
|
||||
}
|
||||
|
||||
static Entity* sub_0808EC80(int form) {
|
||||
Entity* entityA = &gUnk_03003DA0;
|
||||
Entity* entityA = (Entity*) &gUnk_03003DA0;
|
||||
Entity* entityB = entityA->next;
|
||||
while (entityB != entityA) {
|
||||
if ((entityB->entityType.type == 0x6 && entityB->entityType.subtype == 0x48) &&
|
||||
|
||||
Reference in New Issue
Block a user