Match sub_0801876C

This commit is contained in:
Tal Hayon
2022-05-09 16:42:22 +03:00
parent aad92e4341
commit dba74f4c92
8 changed files with 151 additions and 326 deletions
+142
View File
@@ -3,6 +3,148 @@
#include "subtask.h"
#include "common.h"
#include "flags.h"
#include "player.h"
extern EntityData gUnk_080FEC28[];
extern EntityData gUnk_080FEBE8[];
extern EntityData gUnk_080FECC8[];
extern EntityData gUnk_080FEE78[];
extern EntityData gUnk_080FED58[];
extern const EntityData gUnk_080FED18[];
extern const EntityData gUnk_080FEE38[];
extern const EntityData gUnk_080FEE18[];
extern const EntityData gUnk_080FEE48[];
extern const EntityData gUnk_080FEE58[];
extern const void* gUnk_080FED98[];
void sub_08018AB4(int);
void sub_08018BB4(int);
void sub_08018A58(int);
void sub_08018B50(int);
void sub_080189EC(int);
void sub_0801876C(int param_1, int param_2) {
Entity* roomEnt;
Entity* ent;
u32 uVar3;
u32 tmp;
u8* puVar4;
u32 uVar5;
struct_080FE320* ptr;
ptr = &gUnk_080FE320[param_1];
switch (ptr->evt_type) {
case 6:
if (param_2 == 0) {
sub_08018AB4((ptr->x >> 4 & 0x3f) | (ptr->y >> 4 & 0x3f) << 6);
}
break;
case 0:
break;
case 2:
if (param_2 != 0) {
sub_08018BB4(param_1);
}
break;
case 1:
if (param_2 == 0) {
return;
}
if (CheckGlobalFlag(ptr->flag)) {
return;
}
LoadRoomEntity(gUnk_080FEC28 + ptr->entity_idx);
break;
case 3:
if (param_2 == 0) {
return;
}
if (GetInventoryValue(ptr->flag)) {
return;
}
LoadRoomEntity(gUnk_080FEBE8 + ptr->entity_idx);
break;
case 4:
if (param_2 == 0) {
sub_08018A58(param_1);
}
break;
case 5:
if (param_2 != 0) {
sub_08018B50(param_1);
}
break;
case 7:
if (param_2 != 0) {
return;
}
if (ptr->entity_idx != 0x80) {
LoadRoomEntity(gUnk_080FECC8 + ptr->entity_idx);
} else {
sub_080189EC(param_1);
}
break;
case 0x19:
roomEnt = LoadRoomEntity(&gUnk_080FED18[ptr->entity_idx]);
if (roomEnt != 0) {
roomEnt->type = param_2 ? 2 : 0;
}
break;
case 8:
if (param_2 == 0) {
return;
}
SetTileType(0x168, (ptr->x >> 4 & 0x3f) | (ptr->y >> 4 & 0x3f) << 6, 1);
break;
case 0xb:
if (param_2 != 0) {
LoadRoomEntity(&gUnk_080FED58[ptr->entity_idx]);
gRoomVars.field_0x8c[ptr->entity_idx] = (void*)gUnk_080FED98[ptr->entity_idx];
}
break;
case 9:
if (param_2 == 0) {
return;
}
ent = LoadRoomEntity(&gUnk_080FEE78[ptr->entity_idx]);
if (ent != 0) {
*(u16*)&ent->collisionLayer = ptr->x + gRoomControls.origin_x;
*(u16*)&ent->gustJarState = ptr->y + gRoomControls.origin_y;
}
if (ptr->entity_idx == 0) {
SetTileType(0x8d, (ptr->x >> 4 & 0x3f) | (ptr->y >> 4 & 0x3f) << 6, 1);
} else {
uVar5 = (ptr->x >> 4 & 0x3f) | (ptr->y >> 4 & 0x3f) << 6;
SetTileType(0x8c, uVar5 - 1, 1);
uVar3 = 0x8e;
SetTileType(uVar3, uVar5, 1);
}
break;
case 0x18:
if (param_2 != 0) {
LoadRoomEntityList(gUnk_080FEE18);
}
break;
case 0xf:
if (param_2 != 0) {
LoadRoomEntity(gUnk_080FEE58);
} else {
LoadRoomEntity(gUnk_080FEE48);
}
break;
case 0x11:
if (param_2 != 0) {
SetLocalFlagByBank(FLAG_BANK_1, SOUGEN_05_BOMB_00);
LoadRoomEntityList(gUnk_080FEE38);
}
break;
case 0x1a:
case 0x1b:
case 0x1c:
break;
}
}
void sub_080189EC(int param_1) {
u32 i;
-2
View File
@@ -1,8 +1,6 @@
#include "entity.h"
#include "room.h"
extern Entity* LoadRoomEntity(EntityData*);
void sub_0805E0C0(Entity*);
void sub_0805E0F4(Entity*);
-2
View File
@@ -81,8 +81,6 @@ void ManagerB_WaitForDone(ManagerB* this) {
ManagerBHelper* CreateHelper(Manager*);
void ManagerBHelper_Monitor(ManagerBHelper*, Entity*, u32);
extern Entity* LoadRoomEntity(EntityData*);
void ManagerB_LoadFight(Manager* this) {
ManagerBHelper* monitor;
EntityData* prop;
-1
View File
@@ -5,7 +5,6 @@
#include "object.h"
extern u32 sub_080B1AE0(u16, u8);
extern Entity* LoadRoomEntity(EntityData*);
extern void (*const RemovableDust_Functions[])(Entity*);
extern const u16 gUnk_08129FD0[];
+7 -7
View File
@@ -10,7 +10,7 @@
static void sub_0804B058(EntityData* dat);
extern void sub_0801AC98(void);
extern u32 sub_08049D1C(u32);
extern Entity* LoadRoomEntity(EntityData*);
extern Entity* LoadRoomEntity(const EntityData*);
extern void* GetRoomProperty(u32, u32, u32);
extern void** gCurrentRoomProperties;
@@ -22,8 +22,8 @@ extern void sub_0804B16C(void);
extern void ClearSmallChests(void);
extern Entity* GetEmptyEntityByKind(u32 kind);
void RegisterRoomEntity(Entity*, EntityData*);
void sub_0804AF0C(Entity*, EntityData*);
void RegisterRoomEntity(Entity*, const EntityData*);
void sub_0804AF0C(Entity*, const EntityData*);
void sub_0804AFB0(void** properties);
void sub_08054524(void);
@@ -39,7 +39,7 @@ static void LoadDestructibleTile(TileEntity*);
static void LoadGrassDropTile(TileEntity*);
static void LoadLocationTile(TileEntity*);
void LoadRoomEntityList(EntityData* listPtr) {
void LoadRoomEntityList(const EntityData* listPtr) {
if (listPtr != NULL) {
while (listPtr->kind != 0xFF) {
LoadRoomEntity(listPtr++);
@@ -47,7 +47,7 @@ void LoadRoomEntityList(EntityData* listPtr) {
}
}
NONMATCH("asm/non_matching/LoadRoomEntity.inc", Entity* LoadRoomEntity(EntityData* dat)) {
NONMATCH("asm/non_matching/LoadRoomEntity.inc", Entity* LoadRoomEntity(const EntityData* dat)) {
int kind;
Entity* v4;
Entity* v5;
@@ -86,7 +86,7 @@ NONMATCH("asm/non_matching/LoadRoomEntity.inc", Entity* LoadRoomEntity(EntityDat
}
END_NONMATCH
void RegisterRoomEntity(Entity* ent, EntityData* dat) {
void RegisterRoomEntity(Entity* ent, const EntityData* dat) {
u32 list;
u32 kind;
void* offset;
@@ -108,7 +108,7 @@ void RegisterRoomEntity(Entity* ent, EntityData* dat) {
MemCopy(dat, offset, sizeof(EntityData));
}
void sub_0804AF0C(Entity* ent, EntityData* dat) {
void sub_0804AF0C(Entity* ent, const EntityData* dat) {
switch (dat->flags & 0xf0) {
case 0x0:
ent->x.HALF.HI = dat->xPos + gRoomControls.origin_x;
-1
View File
@@ -69,7 +69,6 @@ extern const EntityData gUnk_080FF264[];
extern void (*const gUnk_080FF28C[])(void);
extern Entity* LoadRoomEntity(EntityData*);
extern void sub_08054A14(u32);
extern const EntityData gUnk_080FEE48[];