Discover FreePolygons

This commit is contained in:
Luciano Ciccariello 2022-03-04 18:58:01 +00:00
parent bd3bd8f34f
commit e94facc3cb
8 changed files with 26 additions and 24 deletions

View File

@ -335,6 +335,7 @@ D_8003C79C = 0x8003C79C;
D_8003C7A0 = 0x8003C7A0;
D_8003C7A4 = 0x8003C7A4;
D_8003C7B0 = 0x8003C7B0;
g_pfnFreePolygons = 0x8003C7B4;
D_8003C7B8 = 0x8003C7B8;
g_pfnPlaySfx = 0x8003C7DC;
D_8003C7E0 = 0x8003C7E0;
@ -1119,6 +1120,7 @@ ReadPads = 0x800E8E48;
SetRoomForegroundLayer = 0x800ED774;
SetRoomBackgroundLayer = 0x800ED90C;
LoadRoomLayer = 0x800ED9F4;
FreePolygons = 0x800EDE78;
CheckCollision = 0x800EF45C;
SetNextRoomToLoad = 0x800F0BC0;
IsAlucart = 0x800F4944;

View File

@ -111,7 +111,7 @@ typedef struct
s16 unk5A;
s32 unk5C;
s32 unk60;
s32 unk64;
s32 firstPolygonIndex;
s16 unk68;
s16 unk6A;
u8 unk6C;
@ -290,7 +290,7 @@ extern void (*D_8003C744)(s32, s32);
extern void (*g_pfnUpdateStageEntities)(void);
extern RoomHeader* D_8003C784;
extern void (*g_pfnPlaySfx)(s32);
extern void (*D_8003C7B4)(s32);
extern void (*g_pfnFreePolygons)(s32);
extern Unkstruct5* D_8003C808;
extern void (*D_8003C848)(s32, s32);
extern s32 D_8003C8C4;
@ -553,7 +553,7 @@ void func_800EDA70(s32 *arg0);
void func_800EDAE4(void);
s16 func_800EDC80(u8 arg0, s32 arg1);
s32 func_800EDD9C(u8 arg0, s32 arg1);
void func_800EDE78(s32 index);
void FreePolygons(s32 index);
s32 func_800F087C(u32, u32);
bool SetNextRoomToLoad(u32 chunkX, u32 chunkY);
void func_800F1EB0(s32, s32, s32);

View File

@ -408,18 +408,18 @@ loop_1:
}
#endif
void func_800EDE78(s32 index) {
POLY_GT4* item = &D_80086FEC[index];
if (item != NULL) {
void FreePolygons(s32 polygonIndex) {
POLY_GT4* poly = &D_80086FEC[polygonIndex];
if (poly) {
do {
if (item->code == 7) {
*(*(s32**)&item->r1) = 0; // does not make any sense?!
item->code = 0U;
if (poly->code == 7) {
*(*(s32**)&poly->r1) = 0; // does not make any sense?!
poly->code = 0U;
}
else
item->code = 0U;
item = item->tag;
} while (item != NULL);
poly->code = 0U;
poly = poly->tag;
} while (poly);
}
}
@ -1655,15 +1655,15 @@ INCLUDE_ASM("asm/dra/nonmatchings/42398", func_80105408);
INCLUDE_ASM("asm/dra/nonmatchings/42398", func_80105428);
void func_80106590(Entity* item) {
void func_80106590(Entity* poly) {
int i, length;
u32* ptr;
if (item->unk34 & 0x800000) {
func_800EDE78(item->unk64);
if (poly->unk34 & 0x800000) {
FreePolygons(poly->firstPolygonIndex);
}
ptr = item;
ptr = poly;
length = sizeof(Entity) / sizeof(u32);
for (i = 0; i < length; i++)
*ptr++ = 0;

View File

@ -25,7 +25,7 @@ extern s32 D_80096ED8[];
extern s32 D_800973B4;
extern POLY_GT4 D_800973B8[];
#define D_8003C6B0 D_8003C7B4
#define D_8003C6B0 g_pfnFreePolygons
#define D_8003C6D8 g_pfnPlaySfx
#define D_8006C26C D_8006C3B8
#define D_80072E8A D_800733DA
@ -442,7 +442,7 @@ void DestroyEntity(Entity* item) {
u32* ptr;
if (item->unk34 & 0x800000) {
D_8003C6B0(item->unk64);
D_8003C6B0(item->firstPolygonIndex);
}
ptr = item;

View File

@ -221,7 +221,7 @@ void DestroyEntity(Entity* item) {
u32* ptr;
if (item->unk34 & 0x800000) {
D_8003C7B4(item->unk64);
g_pfnFreePolygons(item->firstPolygonIndex);
}
ptr = item;

View File

@ -177,7 +177,7 @@ void DestroyEntity(Entity* item) {
u32* ptr;
if (item->unk34 & 0x800000) {
D_8003C7B4(item->unk64);
g_pfnFreePolygons(item->firstPolygonIndex);
}
ptr = item;

View File

@ -422,7 +422,7 @@ void DestroyEntity(Entity* item) {
u32* ptr;
if (item->unk34 & 0x800000) {
D_8003C7B4(item->unk64);
g_pfnFreePolygons(item->firstPolygonIndex);
}
ptr = item;

View File

@ -327,7 +327,7 @@ void DestroyEntity(Entity* item) {
u32* ptr;
if (item->unk34 & 0x800000) {
D_8003C7B4(item->unk64);
g_pfnFreePolygons(item->firstPolygonIndex);
}
ptr = item;
@ -610,7 +610,7 @@ void CollectGold(u16 goldSize) {
unk = &D_80097410;
if (*unk) {
D_8003C7B4(D_80097414);
g_pfnFreePolygons(D_80097414);
*unk = 0;
}
@ -693,7 +693,7 @@ void func_8018D990(Entity *arg0, s32 renderFlags) {
s16 left, top, right, bottom;
u8 colorIntensity;
poly = &D_80086FEC[arg0->unk64];
poly = &D_80086FEC[arg0->firstPolygonIndex];
left = arg0->posX.Data.high - 7;
right = arg0->posX.Data.high + 7;