mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2024-11-23 13:09:44 +00:00
Deduplicate functions and un-fake use of some Primitive structs (#991)
This commit is contained in:
parent
5bb9e12e22
commit
a5fb6df72c
@ -50,5 +50,6 @@ segments:
|
||||
- [0x17B28, c, entity_message_box]
|
||||
- [0x18084, c]
|
||||
- [0x1B274, c]
|
||||
- [0x1BED4, c, prim_helpers]
|
||||
- [0x1C704, sbss]
|
||||
- [0x1D46C]
|
||||
|
@ -66,5 +66,7 @@ segments:
|
||||
- [0x1DB44, c, entity_heart_drop]
|
||||
- [0x1DC6C, c, entity_message_box]
|
||||
- [0x1E1C8, c]
|
||||
- [0x22018, c, prim_helpers]
|
||||
- [0x22848, c]
|
||||
- [0x23260, sbss]
|
||||
- [0x23FCC]
|
||||
|
@ -74,5 +74,6 @@ segments:
|
||||
- [0x139E0, c]
|
||||
- [0x149C0, c, entity_relic_orb]
|
||||
- [0x15520, c]
|
||||
- [0x18FA0, c, prim_helpers]
|
||||
- [0x197D8, sbss]
|
||||
- [0x19E94]
|
||||
|
@ -87,5 +87,6 @@ segments:
|
||||
- [0x48A84, c]
|
||||
- [0x56264, c]
|
||||
- [0x564B0, c]
|
||||
- [0x56880, c, prim_helpers]
|
||||
- [0x570B0, sbss]
|
||||
- [0x57E18]
|
||||
|
@ -97,5 +97,6 @@ segments:
|
||||
- [0x49F98, c] # EntityBloodyZombie
|
||||
- [0x4B018, c]
|
||||
- [0x4E69C, c]
|
||||
- [0x51F38, c, prim_helpers]
|
||||
- [0x52768, sbss]
|
||||
- [0x53434]
|
||||
|
@ -118,6 +118,7 @@ segments:
|
||||
- [0x47958, c] # EntityBloodSkeleton
|
||||
- [0x47CF0, c] # EntityMagicallySealedDoor
|
||||
- [0x48ADC, c] # EntityStageNamePopup
|
||||
- [0x49930, c]
|
||||
- [0x49930, c, prim_helpers]
|
||||
- [0x4A160, c]
|
||||
- [0x4AA10, sbss]
|
||||
- [0x4B780]
|
||||
|
@ -51,5 +51,6 @@ segments:
|
||||
- [0x10E44, c, entity_message_box]
|
||||
- [0x113A0, c]
|
||||
- [0x14590, c]
|
||||
- [0x151F0, c, prim_helpers]
|
||||
- [0x15A20, sbss]
|
||||
- [0x166E8]
|
||||
|
@ -67,5 +67,7 @@ segments:
|
||||
- [0x31B98, c, update_stage_entities]
|
||||
- [0x31CA0, c]
|
||||
- [0x36358, c]
|
||||
- [0x3D0C0, c, prim_helpers]
|
||||
- [0x3D8F0, c]
|
||||
- [0x3EB00, sbss]
|
||||
- [0x425C4]
|
||||
|
@ -89,5 +89,6 @@ segments:
|
||||
- [0xED9C, c, entity_heart_drop]
|
||||
- [0xEEC4, c, entity_message_box]
|
||||
- [0xF420, c]
|
||||
- [0x13270, c, prim_helpers]
|
||||
- [0x13AA0, sbss] # bss?
|
||||
- [0x14768]
|
||||
|
@ -69,3 +69,5 @@ g_UnkPrimHelperRot = 0x8018D8C0;
|
||||
UnkPrimHelper = 0x80198FA0;
|
||||
EntityUnkId15 = 0x80195B44;
|
||||
EntityIsNearPlayer = 0x801910A8;
|
||||
UnkPolyFunc2 = 0x801996EC;
|
||||
UnkLoopFunc = 0x8019976C;
|
||||
|
@ -133,5 +133,6 @@ EntityBat = 0x801D6264;
|
||||
EntityZombie = 0x801D64B0;
|
||||
EntityZombieSpawner = 0x801D6710;
|
||||
UnkPrimHelper = 0x801D6880;
|
||||
UnkPolyFunc2 = 0x801D6FCC;
|
||||
g_Dialogue = 0x801D7D24;
|
||||
g_ItemIconSlots = 0x801D7DD8;
|
||||
|
@ -95,6 +95,7 @@ EntityBloodSkeleton = 0x801C7958;
|
||||
EntityIsNearPlayer2 = 0x801C7CF0;
|
||||
EntityMagicallySealedDoor = 0x801C7D68;
|
||||
EntityStageNamePopup = 0x801C8CAC;
|
||||
UnkPolyFunc2 = 0x801CA07C;
|
||||
EntityLifeUpSpawn = 0x801CA160;
|
||||
g_Dialogue = 0x801CB688;
|
||||
g_ItemIconSlots = 0x801CB740;
|
||||
|
@ -7,19 +7,19 @@ extern s32 D_801379A4;
|
||||
extern s32 D_801379A8;
|
||||
|
||||
void func_801027C4(u32 arg0) {
|
||||
POLY_GT4* poly1;
|
||||
POLY_GT4* poly2;
|
||||
Primitive* prim1;
|
||||
Primitive* prim2;
|
||||
|
||||
poly1 = &g_PrimBuf[D_8013799C];
|
||||
poly2 = poly1->tag;
|
||||
prim1 = &g_PrimBuf[D_8013799C];
|
||||
prim2 = prim1->next;
|
||||
switch (arg0) {
|
||||
case 0:
|
||||
case 3:
|
||||
poly1 = (POLY_GT4*)poly1->tag;
|
||||
prim1 = prim1->next;
|
||||
do {
|
||||
poly1 = (POLY_GT4*)poly1->tag;
|
||||
poly1->x1 = 0;
|
||||
poly1->clut = 0;
|
||||
prim1 = prim1->next;
|
||||
prim1->x1 = 0;
|
||||
prim1->clut = 0;
|
||||
D_801379A8 = arg0 + 1;
|
||||
return;
|
||||
} while (0);
|
||||
@ -28,19 +28,19 @@ void func_801027C4(u32 arg0) {
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
poly1->x1 = 0;
|
||||
poly1->clut = 0;
|
||||
prim1->x1 = 0;
|
||||
prim1->clut = 0;
|
||||
D_801379A4 = 1;
|
||||
D_801379A4 = arg0 + D_801379A4;
|
||||
break;
|
||||
case 4:
|
||||
poly1->x1 = 0xFF;
|
||||
poly1->clut = 1;
|
||||
prim1->x1 = 0xFF;
|
||||
prim1->clut = 1;
|
||||
D_801379A4 = 2;
|
||||
do {
|
||||
poly1->r0 = poly1->g0 = poly1->b0 = poly2->r0 = poly2->g0 =
|
||||
poly2->b0 = poly1->x1;
|
||||
poly1->pad3 = poly2->pad3 = 0xD1;
|
||||
prim1->r0 = prim1->g0 = prim1->b0 = prim2->r0 = prim2->g0 =
|
||||
prim2->b0 = prim1->x1;
|
||||
prim1->blendMode = prim2->blendMode = 0xD1;
|
||||
} while (0);
|
||||
default:
|
||||
break;
|
||||
|
@ -273,7 +273,7 @@ void func_8010DF70(void) {
|
||||
}
|
||||
|
||||
void func_8010DFF0(s32 arg0, s32 arg1) {
|
||||
POLY_GT4* poly;
|
||||
Primitive* prim;
|
||||
s32 i;
|
||||
|
||||
if (arg0 != 0) {
|
||||
@ -281,11 +281,11 @@ void func_8010DFF0(s32 arg0, s32 arg1) {
|
||||
g_Entities[UNK_ENTITY_3].animCurFrame = 0;
|
||||
g_Entities[UNK_ENTITY_2].animCurFrame = 0;
|
||||
g_Entities[UNK_ENTITY_1].animCurFrame = 0;
|
||||
poly = &g_PrimBuf[g_Entities[UNK_ENTITY_1].primIndex];
|
||||
prim = &g_PrimBuf[g_Entities[UNK_ENTITY_1].primIndex];
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
poly->x1 = 0;
|
||||
poly = (POLY_GT4*)poly->tag;
|
||||
prim->x1 = 0;
|
||||
prim = prim->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1198,7 +1198,7 @@ INCLUDE_ASM("dra/nonmatchings/7E4BC", EntitySubwpnCrashCross);
|
||||
|
||||
// rising blue particles from cross crash
|
||||
void EntitySubwpnCrashCrossParticles(Entity* self) {
|
||||
Primitive* poly;
|
||||
Primitive* prim;
|
||||
u16 rand63;
|
||||
|
||||
if (self->step == 0) {
|
||||
@ -1223,41 +1223,41 @@ void EntitySubwpnCrashCrossParticles(Entity* self) {
|
||||
if ((self->ext.generic.unk7C.s >= 9) && !(self->ext.generic.unk7C.s & 3)) {
|
||||
// iterate through primtives until we find one where r0 == 0, and set to
|
||||
// 1
|
||||
for (poly = &g_PrimBuf[self->primIndex]; poly != NULL;
|
||||
poly = poly->next) {
|
||||
if (poly->r0 == 0) {
|
||||
poly->r0 = 1;
|
||||
poly->r1 = 0;
|
||||
for (prim = &g_PrimBuf[self->primIndex]; prim != NULL;
|
||||
prim = prim->next) {
|
||||
if (prim->r0 == 0) {
|
||||
prim->r0 = 1;
|
||||
prim->r1 = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (poly = &g_PrimBuf[self->primIndex]; poly != NULL; poly = poly->next) {
|
||||
for (prim = &g_PrimBuf[self->primIndex]; prim != NULL; prim = prim->next) {
|
||||
// for any of those prims with nonzero r0 values,
|
||||
if (poly->r0 != 0) {
|
||||
if (prim->r0 != 0) {
|
||||
// r1 acts as a flag to show whether this has happened.
|
||||
if (poly->r1 == 0) {
|
||||
if (prim->r1 == 0) {
|
||||
rand63 = rand() & 0x3F; // random integer 0-63
|
||||
poly->g0 = (rand() % 237) + 9;
|
||||
poly->g1 = -0x10 - (rand() & 0x20);
|
||||
poly->clut = 0x1B0;
|
||||
poly->tpage = 0x1A;
|
||||
poly->b0 = 0;
|
||||
poly->b1 = 0;
|
||||
poly->priority = (rand63 + PLAYER.zPriority) - 0x20;
|
||||
poly->blendMode = 0;
|
||||
poly->g3 = (rand63 >> 2) + 4; // rand15 + 4 means 4 to 19
|
||||
poly->r1++;
|
||||
prim->g0 = (rand() % 237) + 9;
|
||||
prim->g1 = -0x10 - (rand() & 0x20);
|
||||
prim->clut = 0x1B0;
|
||||
prim->tpage = 0x1A;
|
||||
prim->b0 = 0;
|
||||
prim->b1 = 0;
|
||||
prim->priority = (rand63 + PLAYER.zPriority) - 0x20;
|
||||
prim->blendMode = 0;
|
||||
prim->g3 = (rand63 >> 2) + 4; // rand15 + 4 means 4 to 19
|
||||
prim->r1++;
|
||||
} else {
|
||||
poly->g1 -= poly->g3;
|
||||
if (((u8)poly->b0 >= 6U) || ((u8)poly->g1 < 0x18U)) {
|
||||
poly->blendMode = BLEND_VISIBLE;
|
||||
poly->r0 = 0;
|
||||
prim->g1 -= prim->g3;
|
||||
if (((u8)prim->b0 >= 6U) || ((u8)prim->g1 < 0x18U)) {
|
||||
prim->blendMode = BLEND_VISIBLE;
|
||||
prim->r0 = 0;
|
||||
}
|
||||
}
|
||||
if (poly->r0 != 0) {
|
||||
func_80119E78(poly, poly->g0, poly->g1);
|
||||
if (prim->r0 != 0) {
|
||||
func_80119E78(prim, prim->g0, prim->g1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
216
src/dra/86ECC.c
216
src/dra/86ECC.c
@ -308,7 +308,7 @@ void func_80127840(Entity* entity) {
|
||||
|
||||
// circle expands out of player
|
||||
void EntityExpandingCircle(Entity* entity) {
|
||||
POLY_GT4* poly;
|
||||
Primitive* prim;
|
||||
s32 primIndex;
|
||||
|
||||
if (PLAYER.facingLeft == 0) {
|
||||
@ -325,31 +325,31 @@ void EntityExpandingCircle(Entity* entity) {
|
||||
if (primIndex != -1) {
|
||||
entity->ext.generic.unk7C.s = 22;
|
||||
entity->ext.generic.unk7E.modeU16 = 26;
|
||||
poly = &g_PrimBuf[entity->primIndex];
|
||||
poly->u2 = 64;
|
||||
poly->u3 = 127;
|
||||
poly->u1 = 127;
|
||||
poly->v1 = 192;
|
||||
poly->v0 = 192;
|
||||
poly->v3 = 255;
|
||||
poly->v2 = 255;
|
||||
poly->r3 = 128;
|
||||
poly->r2 = 128;
|
||||
poly->r1 = 128;
|
||||
poly->r0 = 128;
|
||||
poly->g3 = 128;
|
||||
poly->g2 = 128;
|
||||
poly->g1 = 128;
|
||||
poly->g0 = 128;
|
||||
poly->u0 = 64;
|
||||
poly->b3 = 64;
|
||||
poly->b2 = 64;
|
||||
poly->b1 = 64;
|
||||
poly->b0 = 64;
|
||||
poly->tpage = 0x1A;
|
||||
poly->clut = 0x15F;
|
||||
poly->pad2 = PLAYER.zPriority + 1;
|
||||
poly->pad3 = 0x35;
|
||||
prim = &g_PrimBuf[entity->primIndex];
|
||||
prim->u2 = 64;
|
||||
prim->u3 = 127;
|
||||
prim->u1 = 127;
|
||||
prim->v1 = 192;
|
||||
prim->v0 = 192;
|
||||
prim->v3 = 255;
|
||||
prim->v2 = 255;
|
||||
prim->r3 = 128;
|
||||
prim->r2 = 128;
|
||||
prim->r1 = 128;
|
||||
prim->r0 = 128;
|
||||
prim->g3 = 128;
|
||||
prim->g2 = 128;
|
||||
prim->g1 = 128;
|
||||
prim->g0 = 128;
|
||||
prim->u0 = 64;
|
||||
prim->b3 = 64;
|
||||
prim->b2 = 64;
|
||||
prim->b1 = 64;
|
||||
prim->b0 = 64;
|
||||
prim->tpage = 0x1A;
|
||||
prim->clut = 0x15F;
|
||||
prim->priority = PLAYER.zPriority + 1;
|
||||
prim->blendMode = 0x35;
|
||||
entity->flags = FLAG_UNK_40000 | FLAG_UNK_04000000 | FLAG_HAS_PRIMS;
|
||||
entity->step++;
|
||||
break;
|
||||
@ -370,28 +370,28 @@ void EntityExpandingCircle(Entity* entity) {
|
||||
break;
|
||||
}
|
||||
|
||||
poly = &g_PrimBuf[entity->primIndex];
|
||||
poly->x0 = entity->posX.i.hi - entity->ext.generic.unk7C.s;
|
||||
poly->y0 = entity->posY.i.hi - entity->ext.generic.unk7E.modeU16;
|
||||
poly->x1 = entity->posX.i.hi + entity->ext.generic.unk7C.s;
|
||||
poly->y1 = entity->posY.i.hi - entity->ext.generic.unk7E.modeU16;
|
||||
poly->x2 = entity->posX.i.hi - entity->ext.generic.unk7C.s;
|
||||
poly->y2 = entity->posY.i.hi + entity->ext.generic.unk7E.modeU16;
|
||||
poly->x3 = entity->posX.i.hi + entity->ext.generic.unk7C.s;
|
||||
poly->y3 = entity->posY.i.hi + entity->ext.generic.unk7E.modeU16;
|
||||
prim = &g_PrimBuf[entity->primIndex];
|
||||
prim->x0 = entity->posX.i.hi - entity->ext.generic.unk7C.s;
|
||||
prim->y0 = entity->posY.i.hi - entity->ext.generic.unk7E.modeU16;
|
||||
prim->x1 = entity->posX.i.hi + entity->ext.generic.unk7C.s;
|
||||
prim->y1 = entity->posY.i.hi - entity->ext.generic.unk7E.modeU16;
|
||||
prim->x2 = entity->posX.i.hi - entity->ext.generic.unk7C.s;
|
||||
prim->y2 = entity->posY.i.hi + entity->ext.generic.unk7E.modeU16;
|
||||
prim->x3 = entity->posX.i.hi + entity->ext.generic.unk7C.s;
|
||||
prim->y3 = entity->posY.i.hi + entity->ext.generic.unk7E.modeU16;
|
||||
|
||||
if (entity->ext.generic.unk7C.s >= 0x29) {
|
||||
poly->r3 += 244;
|
||||
poly->g3 += 244;
|
||||
poly->b3 += 250;
|
||||
poly->r0 = poly->r1 = poly->r2 = poly->r3;
|
||||
poly->g0 = poly->g1 = poly->g2 = poly->g3;
|
||||
poly->b0 = poly->b1 = poly->b2 = poly->b3;
|
||||
prim->r3 += 244;
|
||||
prim->g3 += 244;
|
||||
prim->b3 += 250;
|
||||
prim->r0 = prim->r1 = prim->r2 = prim->r3;
|
||||
prim->g0 = prim->g1 = prim->g2 = prim->g3;
|
||||
prim->b0 = prim->b1 = prim->b2 = prim->b3;
|
||||
}
|
||||
}
|
||||
|
||||
void func_80127CC8(Entity* entity) {
|
||||
POLY_GT4* poly;
|
||||
Primitive* prim;
|
||||
s32 ret;
|
||||
|
||||
if (PLAYER.step != 34) {
|
||||
@ -414,22 +414,22 @@ void func_80127CC8(Entity* entity) {
|
||||
|
||||
entity->flags = FLAG_UNK_20000 | FLAG_UNK_40000 | FLAG_UNK_04000000 |
|
||||
FLAG_HAS_PRIMS;
|
||||
poly = &g_PrimBuf[entity->primIndex];
|
||||
poly->r3 = 192;
|
||||
poly->r2 = 192;
|
||||
poly->r1 = 192;
|
||||
poly->r0 = 192;
|
||||
poly->g3 = 64;
|
||||
poly->g2 = 64;
|
||||
poly->g1 = 64;
|
||||
poly->g0 = 64;
|
||||
poly->b3 = 64;
|
||||
poly->b2 = 64;
|
||||
poly->b1 = 64;
|
||||
poly->b0 = 64;
|
||||
poly->pad3 = 0x315;
|
||||
prim = &g_PrimBuf[entity->primIndex];
|
||||
prim->r3 = 192;
|
||||
prim->r2 = 192;
|
||||
prim->r1 = 192;
|
||||
prim->r0 = 192;
|
||||
prim->g3 = 64;
|
||||
prim->g2 = 64;
|
||||
prim->g1 = 64;
|
||||
prim->g0 = 64;
|
||||
prim->b3 = 64;
|
||||
prim->b2 = 64;
|
||||
prim->b1 = 64;
|
||||
prim->b0 = 64;
|
||||
prim->blendMode = 0x315;
|
||||
entity->zPriority = 0x1C0;
|
||||
poly->pad2 = 0x1C0;
|
||||
prim->priority = 0x1C0;
|
||||
entity->step++;
|
||||
break;
|
||||
|
||||
@ -442,18 +442,18 @@ void func_80127CC8(Entity* entity) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
poly = &g_PrimBuf[entity->primIndex];
|
||||
poly->x0 = poly->x2 = entity->posX.i.hi - 3;
|
||||
poly->y0 = 0;
|
||||
poly->y1 = 0;
|
||||
poly->x1 = poly->x3 = entity->posX.i.hi + 3;
|
||||
poly->y3 = 240;
|
||||
poly->y2 = 240;
|
||||
prim = &g_PrimBuf[entity->primIndex];
|
||||
prim->x0 = prim->x2 = entity->posX.i.hi - 3;
|
||||
prim->y0 = 0;
|
||||
prim->y1 = 0;
|
||||
prim->x1 = prim->x3 = entity->posX.i.hi + 3;
|
||||
prim->y3 = 240;
|
||||
prim->y2 = 240;
|
||||
|
||||
if (g_GameTimer & 1) {
|
||||
poly->pad3 = poly->pad3 | 8;
|
||||
prim->blendMode = prim->blendMode | BLEND_VISIBLE;
|
||||
} else {
|
||||
poly->pad3 = poly->pad3 & 0xFFF7;
|
||||
prim->blendMode = prim->blendMode & ~BLEND_VISIBLE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -922,7 +922,7 @@ s32 func_80128BBC(Unkstruct_80128BBC* arg0, u8 value) {
|
||||
// Agunea (lightning) subweapon.
|
||||
void func_80128C2C(Entity* self) {
|
||||
Entity* ent;
|
||||
Primitive* poly;
|
||||
Primitive* prim;
|
||||
s32 heartCost;
|
||||
u16 tempY;
|
||||
u16 tempX;
|
||||
@ -950,13 +950,13 @@ void func_80128C2C(Entity* self) {
|
||||
self->posY.i.hi = self->ext.et_80128C2C.unk82 =
|
||||
PLAYER.posY.i.hi + PLAYER.hitboxOffY - 8;
|
||||
self->posX.i.hi = self->ext.et_80128C2C.unk80 = PLAYER.posX.i.hi;
|
||||
poly = &g_PrimBuf[self->primIndex];
|
||||
poly->type = 2;
|
||||
poly->priority = PLAYER.zPriority + 2;
|
||||
poly->blendMode = 0x331;
|
||||
poly->r1 = 0x60;
|
||||
poly->g1 = 0;
|
||||
poly->b1 = 0x80;
|
||||
prim = &g_PrimBuf[self->primIndex];
|
||||
prim->type = 2;
|
||||
prim->priority = PLAYER.zPriority + 2;
|
||||
prim->blendMode = 0x331;
|
||||
prim->r1 = 0x60;
|
||||
prim->g1 = 0;
|
||||
prim->b1 = 0x80;
|
||||
SetSpeedX(FIX(6));
|
||||
PlaySfx(0x60C);
|
||||
CreateEntFactoryFromEntity(self, FACTORY(0x5200, 44), 0);
|
||||
@ -1044,24 +1044,24 @@ void func_80128C2C(Entity* self) {
|
||||
self->ext.et_80128C2C.unk7C++;
|
||||
break;
|
||||
}
|
||||
poly = &g_PrimBuf[self->primIndex];
|
||||
if (poly->r1 >= 4) {
|
||||
poly->r1 -= 4;
|
||||
prim = &g_PrimBuf[self->primIndex];
|
||||
if (prim->r1 >= 4) {
|
||||
prim->r1 -= 4;
|
||||
}
|
||||
if (poly->g1 >= 4) {
|
||||
poly->g1 -= 4;
|
||||
if (prim->g1 >= 4) {
|
||||
prim->g1 -= 4;
|
||||
}
|
||||
if (poly->b1 >= 4) {
|
||||
poly->b1 -= 4;
|
||||
if (prim->b1 >= 4) {
|
||||
prim->b1 -= 4;
|
||||
}
|
||||
tempX = poly->b1;
|
||||
tempX = prim->b1;
|
||||
if (tempX < 5) {
|
||||
poly->blendMode |= BLEND_VISIBLE;
|
||||
prim->blendMode |= BLEND_VISIBLE;
|
||||
}
|
||||
poly->x0 = self->ext.et_80128C2C.unk80;
|
||||
poly->y0 = self->ext.et_80128C2C.unk82;
|
||||
poly->x1 = self->posX.i.hi;
|
||||
poly->y1 = self->posY.i.hi;
|
||||
prim->x0 = self->ext.et_80128C2C.unk80;
|
||||
prim->y0 = self->ext.et_80128C2C.unk82;
|
||||
prim->x1 = self->posX.i.hi;
|
||||
prim->y1 = self->posY.i.hi;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1148,7 +1148,7 @@ void EntityStopWatchExpandingCircle(Entity* self) {
|
||||
INCLUDE_ASM("dra/nonmatchings/86ECC", EntityStopWatch);
|
||||
|
||||
void func_8012B78C(Entity* entity) {
|
||||
POLY_GT4* poly;
|
||||
Primitive* prim;
|
||||
s32 ret;
|
||||
|
||||
switch (entity->step) {
|
||||
@ -1157,23 +1157,23 @@ void func_8012B78C(Entity* entity) {
|
||||
entity->primIndex = ret;
|
||||
if (entity->primIndex != -1) {
|
||||
entity->flags = FLAG_UNK_20000 | FLAG_UNK_04000000 | FLAG_HAS_PRIMS;
|
||||
poly = &g_PrimBuf[entity->primIndex];
|
||||
poly->tpage = 0x1C;
|
||||
poly->clut = 0x19D;
|
||||
poly->u2 = 32;
|
||||
poly->u0 = 32;
|
||||
poly->u3 = 48;
|
||||
poly->u1 = 48;
|
||||
poly->v1 = 0;
|
||||
poly->v0 = 0;
|
||||
poly->v3 = 16;
|
||||
poly->v2 = 16;
|
||||
poly->x0 = poly->x2 = entity->posX.i.hi - 8;
|
||||
poly->x1 = poly->x3 = entity->posX.i.hi + 8;
|
||||
poly->y0 = poly->y1 = entity->posY.i.hi - 8;
|
||||
poly->y2 = poly->y3 = entity->posY.i.hi + 8;
|
||||
poly->pad2 = entity->zPriority;
|
||||
poly->pad3 = 0x115;
|
||||
prim = &g_PrimBuf[entity->primIndex];
|
||||
prim->tpage = 0x1C;
|
||||
prim->clut = 0x19D;
|
||||
prim->u2 = 32;
|
||||
prim->u0 = 32;
|
||||
prim->u3 = 48;
|
||||
prim->u1 = 48;
|
||||
prim->v1 = 0;
|
||||
prim->v0 = 0;
|
||||
prim->v3 = 16;
|
||||
prim->v2 = 16;
|
||||
prim->x0 = prim->x2 = entity->posX.i.hi - 8;
|
||||
prim->x1 = prim->x3 = entity->posX.i.hi + 8;
|
||||
prim->y0 = prim->y1 = entity->posY.i.hi - 8;
|
||||
prim->y2 = prim->y3 = entity->posY.i.hi + 8;
|
||||
prim->priority = entity->zPriority;
|
||||
prim->blendMode = 0x115;
|
||||
entity->ext.generic.unk7E.modeU16 = 96;
|
||||
entity->step++;
|
||||
} else {
|
||||
@ -1196,9 +1196,9 @@ void func_8012B78C(Entity* entity) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
poly = &g_PrimBuf[entity->primIndex];
|
||||
poly->r0 = poly->r1 = poly->r2 = poly->r3 = poly->g0 = poly->g1 = poly->g2 =
|
||||
poly->g3 = poly->b0 = poly->b1 = poly->b2 = poly->b3 =
|
||||
prim = &g_PrimBuf[entity->primIndex];
|
||||
prim->r0 = prim->r1 = prim->r2 = prim->r3 = prim->g0 = prim->g1 = prim->g2 =
|
||||
prim->g3 = prim->b0 = prim->b1 = prim->b2 = prim->b3 =
|
||||
entity->ext.generic.unk7E.modeU8.unk0;
|
||||
}
|
||||
|
||||
|
@ -2142,27 +2142,27 @@ void MenuDraw(void) {
|
||||
}
|
||||
|
||||
void func_800F9690(void) {
|
||||
POLY_GT4* poly = &g_PrimBuf[D_8013783C];
|
||||
Primitive* prim = &g_PrimBuf[D_8013783C];
|
||||
|
||||
if (D_80137608 != 0) {
|
||||
poly->pad3 = 0x80;
|
||||
prim->blendMode = 0x80;
|
||||
} else {
|
||||
poly->pad3 = 0x8;
|
||||
prim->blendMode = BLEND_VISIBLE;
|
||||
}
|
||||
if (D_801376B0 != 0) {
|
||||
poly->pad3 = 0x8;
|
||||
prim->blendMode = BLEND_VISIBLE;
|
||||
}
|
||||
}
|
||||
|
||||
void func_800F96F4(void) { // !Fake:
|
||||
s32 new_var2;
|
||||
POLY_GT4* poly;
|
||||
Primitive* prim;
|
||||
s32 temp_a2;
|
||||
s32* temp;
|
||||
s32* new_var;
|
||||
|
||||
new_var = D_80137848;
|
||||
poly = &g_PrimBuf[D_80137840];
|
||||
prim = &g_PrimBuf[D_80137840];
|
||||
temp_a2 = g_MenuData.menus[MENU_DG_EQUIP_SELECTOR].unk1C == 0;
|
||||
temp = D_80137844;
|
||||
|
||||
@ -2175,26 +2175,26 @@ void func_800F96F4(void) { // !Fake:
|
||||
(&g_PrimBuf[D_80137840])->clut = 0x181;
|
||||
}
|
||||
} else {
|
||||
poly->pad3 = 0x8;
|
||||
prim->blendMode = 0x8;
|
||||
}
|
||||
|
||||
poly = (POLY_GT4*)poly->tag;
|
||||
prim = prim->next;
|
||||
temp = new_var;
|
||||
|
||||
if (((*temp) != 0) && (temp_a2 != 0)) {
|
||||
poly->pad3 = 0x80;
|
||||
prim->blendMode = 0x80;
|
||||
new_var2 = *temp;
|
||||
if (new_var2 == 1) {
|
||||
do {
|
||||
poly->clut = 0x188;
|
||||
prim->clut = 0x188;
|
||||
} while (0);
|
||||
return;
|
||||
}
|
||||
*temp -= 1;
|
||||
poly->clut = 0x181;
|
||||
prim->clut = 0x181;
|
||||
return;
|
||||
}
|
||||
poly->pad3 = 8;
|
||||
prim->blendMode = 8;
|
||||
}
|
||||
|
||||
void func_800F97DC(void) {
|
||||
|
@ -343,30 +343,30 @@ void HandlePlay(void) {
|
||||
|
||||
// Game over melting effect
|
||||
void func_800E5358(void) {
|
||||
Primitive* poly = &g_PrimBuf[D_8013640C];
|
||||
Primitive* prim = &g_PrimBuf[D_8013640C];
|
||||
s32 i;
|
||||
|
||||
for (i = -3; i < 256; i++, poly = poly->next) {
|
||||
for (i = -3; i < 256; i++, prim = prim->next) {
|
||||
if (i < 0)
|
||||
continue;
|
||||
if (poly->y0 > 256)
|
||||
if (prim->y0 > 256)
|
||||
continue;
|
||||
if (poly->p1 != 0) {
|
||||
poly->p1--;
|
||||
if (prim->p1 != 0) {
|
||||
prim->p1--;
|
||||
continue;
|
||||
}
|
||||
if (poly->p2 < 10 && (rand() & 1)) {
|
||||
poly->p2++;
|
||||
if (prim->p2 < 10 && (rand() & 1)) {
|
||||
prim->p2++;
|
||||
} else {
|
||||
if (!(rand() & 3)) {
|
||||
poly->y0++;
|
||||
poly->y1++;
|
||||
prim->y0++;
|
||||
prim->y1++;
|
||||
}
|
||||
poly->y0++;
|
||||
poly->y1++;
|
||||
prim->y0++;
|
||||
prim->y1++;
|
||||
}
|
||||
poly->y2++;
|
||||
poly->y3++;
|
||||
prim->y2++;
|
||||
prim->y3++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ void func_8015CAD4(s32 arg0, s16 arg1) {
|
||||
}
|
||||
|
||||
void func_8015CB58(s32 arg0, s32 arg1) {
|
||||
POLY_GT4* poly;
|
||||
Primitive* prim;
|
||||
|
||||
FntPrint("op disable\n");
|
||||
if (arg0 != 0) {
|
||||
@ -92,10 +92,10 @@ void func_8015CB58(s32 arg0, s32 arg1) {
|
||||
g_Entities[UNK_ENTITY_2].animCurFrame = 0;
|
||||
g_Entities[UNK_ENTITY_1].animCurFrame = 0;
|
||||
|
||||
poly = &g_PrimBuf[g_Entities[UNK_ENTITY_1].primIndex];
|
||||
while (poly != NULL) {
|
||||
poly->x1 = 0;
|
||||
poly = (POLY_GT4*)poly->tag;
|
||||
prim = &g_PrimBuf[g_Entities[UNK_ENTITY_1].primIndex];
|
||||
while (prim != NULL) {
|
||||
prim->x1 = 0;
|
||||
prim = prim->next;
|
||||
}
|
||||
}
|
||||
g_Entities[UNK_ENTITY_1].ext.generic.unk7C.S8.unk0 = 1;
|
||||
|
@ -784,7 +784,7 @@ void func_80161FF0(Entity* self) {
|
||||
}
|
||||
|
||||
void func_801623E0(Entity* entity) {
|
||||
POLY_GT4* poly;
|
||||
Primitive* prim;
|
||||
s16 primIndex;
|
||||
|
||||
entity->posX.val = g_Entities->posX.val;
|
||||
@ -799,19 +799,19 @@ void func_801623E0(Entity* entity) {
|
||||
}
|
||||
entity->ext.generic.unk7E.modeU16 = 32;
|
||||
entity->ext.generic.unk7C.s = 32;
|
||||
poly = &g_PrimBuf[entity->primIndex];
|
||||
poly->u2 = 64;
|
||||
poly->u0 = 64;
|
||||
poly->v1 = 192;
|
||||
poly->v0 = 192;
|
||||
poly->u3 = 127;
|
||||
poly->u1 = 127;
|
||||
poly->v3 = 255;
|
||||
poly->v2 = 255;
|
||||
poly->tpage = 0x1A;
|
||||
poly->clut = 0x13E;
|
||||
poly->pad2 = PLAYER.zPriority + 8;
|
||||
poly->pad3 = 0;
|
||||
prim = &g_PrimBuf[entity->primIndex];
|
||||
prim->u2 = 64;
|
||||
prim->u0 = 64;
|
||||
prim->v1 = 192;
|
||||
prim->v0 = 192;
|
||||
prim->u3 = 127;
|
||||
prim->u1 = 127;
|
||||
prim->v3 = 255;
|
||||
prim->v2 = 255;
|
||||
prim->tpage = 0x1A;
|
||||
prim->clut = 0x13E;
|
||||
prim->priority = PLAYER.zPriority + 8;
|
||||
prim->blendMode = 0;
|
||||
entity->flags = FLAG_UNK_10000 | FLAG_UNK_40000 | FLAG_UNK_04000000 |
|
||||
FLAG_HAS_PRIMS;
|
||||
entity->step++;
|
||||
@ -827,20 +827,20 @@ void func_801623E0(Entity* entity) {
|
||||
break;
|
||||
}
|
||||
|
||||
poly = &g_PrimBuf[entity->primIndex];
|
||||
poly->x0 = entity->posX.i.hi - entity->ext.generic.unk7C.s;
|
||||
poly->y0 = entity->posY.i.hi - entity->ext.generic.unk7E.modeU16;
|
||||
poly->x1 = entity->posX.i.hi + entity->ext.generic.unk7C.s;
|
||||
poly->y1 = entity->posY.i.hi - entity->ext.generic.unk7E.modeU16;
|
||||
poly->x2 = entity->posX.i.hi - entity->ext.generic.unk7C.s;
|
||||
poly->y2 = entity->posY.i.hi + entity->ext.generic.unk7E.modeU16;
|
||||
poly->x3 = entity->posX.i.hi + entity->ext.generic.unk7C.s;
|
||||
poly->y3 = entity->posY.i.hi + entity->ext.generic.unk7E.modeU16;
|
||||
poly->clut = (LOH(g_Timer) & 1) + 0x13E;
|
||||
prim = &g_PrimBuf[entity->primIndex];
|
||||
prim->x0 = entity->posX.i.hi - entity->ext.generic.unk7C.s;
|
||||
prim->y0 = entity->posY.i.hi - entity->ext.generic.unk7E.modeU16;
|
||||
prim->x1 = entity->posX.i.hi + entity->ext.generic.unk7C.s;
|
||||
prim->y1 = entity->posY.i.hi - entity->ext.generic.unk7E.modeU16;
|
||||
prim->x2 = entity->posX.i.hi - entity->ext.generic.unk7C.s;
|
||||
prim->y2 = entity->posY.i.hi + entity->ext.generic.unk7E.modeU16;
|
||||
prim->x3 = entity->posX.i.hi + entity->ext.generic.unk7C.s;
|
||||
prim->y3 = entity->posY.i.hi + entity->ext.generic.unk7E.modeU16;
|
||||
prim->clut = (LOH(g_Timer) & 1) + 0x13E;
|
||||
}
|
||||
|
||||
void func_80162604(Entity* entity) {
|
||||
POLY_GT4* poly;
|
||||
Primitive* prim;
|
||||
s16 primIndex;
|
||||
|
||||
entity->posX.val = g_Entities->posX.val;
|
||||
@ -852,19 +852,19 @@ void func_80162604(Entity* entity) {
|
||||
if (primIndex != -1) {
|
||||
entity->ext.generic.unk7E.modeU16 = 0;
|
||||
entity->ext.generic.unk7C.s = 0;
|
||||
poly = &g_PrimBuf[entity->primIndex];
|
||||
poly->v1 = 192;
|
||||
poly->v0 = 192;
|
||||
poly->u3 = 63;
|
||||
poly->u1 = 63;
|
||||
poly->v3 = 255;
|
||||
poly->v2 = 255;
|
||||
poly->tpage = 0x1A;
|
||||
poly->u2 = 0;
|
||||
poly->u0 = 0;
|
||||
poly->clut = 0x162;
|
||||
poly->pad2 = PLAYER.zPriority - 4;
|
||||
poly->pad3 = 0;
|
||||
prim = &g_PrimBuf[entity->primIndex];
|
||||
prim->v1 = 192;
|
||||
prim->v0 = 192;
|
||||
prim->u3 = 63;
|
||||
prim->u1 = 63;
|
||||
prim->v3 = 255;
|
||||
prim->v2 = 255;
|
||||
prim->tpage = 0x1A;
|
||||
prim->u2 = 0;
|
||||
prim->u0 = 0;
|
||||
prim->clut = 0x162;
|
||||
prim->priority = PLAYER.zPriority - 4;
|
||||
prim->blendMode = 0;
|
||||
entity->flags = FLAG_UNK_10000 | FLAG_UNK_40000 |
|
||||
FLAG_UNK_04000000 | FLAG_HAS_PRIMS;
|
||||
entity->step++;
|
||||
@ -898,15 +898,15 @@ void func_80162604(Entity* entity) {
|
||||
|
||||
def:
|
||||
default:
|
||||
poly = &g_PrimBuf[entity->primIndex];
|
||||
poly->x0 = entity->posX.i.hi - entity->ext.generic.unk7C.s;
|
||||
poly->y0 = entity->posY.i.hi - entity->ext.generic.unk7E.modeU16;
|
||||
poly->x1 = entity->posX.i.hi + entity->ext.generic.unk7C.s;
|
||||
poly->y1 = entity->posY.i.hi - entity->ext.generic.unk7E.modeU16;
|
||||
poly->x2 = entity->posX.i.hi - entity->ext.generic.unk7C.s;
|
||||
poly->y2 = entity->posY.i.hi + entity->ext.generic.unk7E.modeU16;
|
||||
poly->x3 = entity->posX.i.hi + entity->ext.generic.unk7C.s;
|
||||
poly->y3 = entity->posY.i.hi + entity->ext.generic.unk7E.modeU16;
|
||||
prim = &g_PrimBuf[entity->primIndex];
|
||||
prim->x0 = entity->posX.i.hi - entity->ext.generic.unk7C.s;
|
||||
prim->y0 = entity->posY.i.hi - entity->ext.generic.unk7E.modeU16;
|
||||
prim->x1 = entity->posX.i.hi + entity->ext.generic.unk7C.s;
|
||||
prim->y1 = entity->posY.i.hi - entity->ext.generic.unk7E.modeU16;
|
||||
prim->x2 = entity->posX.i.hi - entity->ext.generic.unk7C.s;
|
||||
prim->y2 = entity->posY.i.hi + entity->ext.generic.unk7E.modeU16;
|
||||
prim->x3 = entity->posX.i.hi + entity->ext.generic.unk7C.s;
|
||||
prim->y3 = entity->posY.i.hi + entity->ext.generic.unk7E.modeU16;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ bool func_80162E9C(Entity* entity) {
|
||||
INCLUDE_ASM("ric/nonmatchings/26C84", func_80162EF8);
|
||||
|
||||
void func_801641A0(Entity* entity) {
|
||||
POLY_GT4* poly;
|
||||
Primitive* prim;
|
||||
s16 primIndex;
|
||||
|
||||
entity->posX.i.hi = PLAYER.posX.i.hi;
|
||||
@ -94,18 +94,18 @@ void func_801641A0(Entity* entity) {
|
||||
if (primIndex != -1) {
|
||||
entity->ext.generic.unk7C.s = 16;
|
||||
entity->ext.generic.unk7E.modeU16 = 12;
|
||||
poly = &g_PrimBuf[entity->primIndex];
|
||||
poly->u0 = poly->u2 = 64;
|
||||
poly->v0 = poly->v1 = 192;
|
||||
poly->u1 = poly->u3 = 127;
|
||||
poly->v2 = poly->v3 = 255;
|
||||
poly->r0 = poly->g0 = poly->b0 = poly->r1 = poly->g1 = poly->b1 =
|
||||
poly->r2 = poly->g2 = poly->b2 = poly->r3 = poly->g3 =
|
||||
poly->b3 = 128;
|
||||
poly->tpage = 0x1A;
|
||||
poly->clut = 0x160;
|
||||
poly->pad2 = PLAYER.zPriority + 8;
|
||||
poly->pad3 = 0x35;
|
||||
prim = &g_PrimBuf[entity->primIndex];
|
||||
prim->u0 = prim->u2 = 64;
|
||||
prim->v0 = prim->v1 = 192;
|
||||
prim->u1 = prim->u3 = 127;
|
||||
prim->v2 = prim->v3 = 255;
|
||||
prim->r0 = prim->g0 = prim->b0 = prim->r1 = prim->g1 = prim->b1 =
|
||||
prim->r2 = prim->g2 = prim->b2 = prim->r3 = prim->g3 =
|
||||
prim->b3 = 128;
|
||||
prim->tpage = 0x1A;
|
||||
prim->clut = 0x160;
|
||||
prim->priority = PLAYER.zPriority + 8;
|
||||
prim->blendMode = 0x35;
|
||||
entity->flags = FLAG_UNK_40000 | FLAG_UNK_04000000 | FLAG_HAS_PRIMS;
|
||||
entity->step++;
|
||||
goto def;
|
||||
@ -124,20 +124,20 @@ void func_801641A0(Entity* entity) {
|
||||
|
||||
default:
|
||||
def:
|
||||
poly = &g_PrimBuf[entity->primIndex];
|
||||
poly->x0 = entity->posX.i.hi - entity->ext.generic.unk7C.s;
|
||||
poly->y0 = entity->posY.i.hi - entity->ext.generic.unk7E.modeU16;
|
||||
poly->x1 = entity->posX.i.hi + entity->ext.generic.unk7C.s;
|
||||
poly->y1 = entity->posY.i.hi - entity->ext.generic.unk7E.modeU16;
|
||||
poly->x2 = entity->posX.i.hi - entity->ext.generic.unk7C.s;
|
||||
poly->y2 = entity->posY.i.hi + entity->ext.generic.unk7E.modeU16;
|
||||
poly->x3 = entity->posX.i.hi + entity->ext.generic.unk7C.s;
|
||||
poly->y3 = entity->posY.i.hi + entity->ext.generic.unk7E.modeU16;
|
||||
if (poly->b3 >= 12) {
|
||||
poly->b3 += 244;
|
||||
prim = &g_PrimBuf[entity->primIndex];
|
||||
prim->x0 = entity->posX.i.hi - entity->ext.generic.unk7C.s;
|
||||
prim->y0 = entity->posY.i.hi - entity->ext.generic.unk7E.modeU16;
|
||||
prim->x1 = entity->posX.i.hi + entity->ext.generic.unk7C.s;
|
||||
prim->y1 = entity->posY.i.hi - entity->ext.generic.unk7E.modeU16;
|
||||
prim->x2 = entity->posX.i.hi - entity->ext.generic.unk7C.s;
|
||||
prim->y2 = entity->posY.i.hi + entity->ext.generic.unk7E.modeU16;
|
||||
prim->x3 = entity->posX.i.hi + entity->ext.generic.unk7C.s;
|
||||
prim->y3 = entity->posY.i.hi + entity->ext.generic.unk7E.modeU16;
|
||||
if (prim->b3 >= 12) {
|
||||
prim->b3 += 244;
|
||||
}
|
||||
poly->r0 = poly->g0 = poly->b0 = poly->r1 = poly->g1 = poly->b1 =
|
||||
poly->r2 = poly->g2 = poly->b2 = poly->r3 = poly->g3 = poly->b3;
|
||||
prim->r0 = prim->g0 = prim->b0 = prim->r1 = prim->g1 = prim->b1 =
|
||||
prim->r2 = prim->g2 = prim->b2 = prim->r3 = prim->g3 = prim->b3;
|
||||
}
|
||||
}
|
||||
|
||||
@ -995,7 +995,7 @@ INCLUDE_ASM("ric/nonmatchings/26C84", func_80169470);
|
||||
INCLUDE_ASM("ric/nonmatchings/26C84", func_80169704);
|
||||
|
||||
void func_80169C10(Entity* entity) {
|
||||
POLY_GT4* poly;
|
||||
Primitive* prim;
|
||||
s16 primIndex;
|
||||
s32 PosX = 8;
|
||||
s32 PosY = 4;
|
||||
@ -1011,15 +1011,15 @@ void func_80169C10(Entity* entity) {
|
||||
((u16)entity->posX.i.hi - PosX) + (rand() & 0xF);
|
||||
entity->posY.i.hi =
|
||||
((u16)entity->posY.i.hi - PosY) + (rand() & 0xF);
|
||||
poly = &g_PrimBuf[entity->primIndex];
|
||||
poly->clut = 0x1B0;
|
||||
poly->tpage = 0x1A;
|
||||
poly->b0 = 0;
|
||||
poly->b1 = 0;
|
||||
poly->pad2 = entity->zPriority;
|
||||
poly->pad2 = poly->pad2 + 4;
|
||||
poly->pad3 = 0x31;
|
||||
func_8015FDB0(poly, entity->posX.i.hi, entity->posY.i.hi);
|
||||
prim = &g_PrimBuf[entity->primIndex];
|
||||
prim->clut = 0x1B0;
|
||||
prim->tpage = 0x1A;
|
||||
prim->b0 = 0;
|
||||
prim->b1 = 0;
|
||||
prim->priority = entity->zPriority;
|
||||
prim->priority = prim->priority + 4;
|
||||
prim->blendMode = 0x31;
|
||||
func_8015FDB0(prim, entity->posX.i.hi, entity->posY.i.hi);
|
||||
entity->step++;
|
||||
} else {
|
||||
DestroyEntity(entity);
|
||||
@ -1028,8 +1028,8 @@ void func_80169C10(Entity* entity) {
|
||||
|
||||
default:
|
||||
entity->posY.val += entity->velocityY;
|
||||
poly = &g_PrimBuf[entity->primIndex];
|
||||
if (func_8015FDB0(poly, entity->posX.i.hi, entity->posY.i.hi) != 0) {
|
||||
prim = &g_PrimBuf[entity->primIndex];
|
||||
if (func_8015FDB0(prim, entity->posX.i.hi, entity->posY.i.hi) != 0) {
|
||||
DestroyEntity(entity);
|
||||
}
|
||||
break;
|
||||
|
@ -1563,7 +1563,7 @@ void func_801719A4(Entity* self) {
|
||||
}
|
||||
|
||||
void func_80172AE8(Entity* entity) {
|
||||
POLY_GT4* poly;
|
||||
Primitive* prim;
|
||||
s32 ret;
|
||||
|
||||
switch (entity->step) {
|
||||
@ -1572,23 +1572,23 @@ void func_80172AE8(Entity* entity) {
|
||||
entity->primIndex = ret;
|
||||
if (entity->primIndex != -1) {
|
||||
entity->flags = FLAG_UNK_20000 | FLAG_UNK_04000000 | FLAG_HAS_PRIMS;
|
||||
poly = &g_PrimBuf[entity->primIndex];
|
||||
poly->tpage = 0x1C;
|
||||
poly->clut = 0x19D;
|
||||
poly->u2 = 0x20;
|
||||
poly->u0 = 0x20;
|
||||
poly->u3 = 0x30;
|
||||
poly->u1 = 0x30;
|
||||
poly->v1 = 0;
|
||||
poly->v0 = 0;
|
||||
poly->v3 = 0x10;
|
||||
poly->v2 = 0x10;
|
||||
poly->x0 = poly->x2 = entity->posX.i.hi - 8;
|
||||
poly->x1 = poly->x3 = entity->posX.i.hi + 8;
|
||||
poly->y0 = poly->y1 = entity->posY.i.hi - 8;
|
||||
poly->y2 = poly->y3 = entity->posY.i.hi + 8;
|
||||
poly->pad2 = entity->zPriority;
|
||||
poly->pad3 = 0x115;
|
||||
prim = &g_PrimBuf[entity->primIndex];
|
||||
prim->tpage = 0x1C;
|
||||
prim->clut = 0x19D;
|
||||
prim->u2 = 0x20;
|
||||
prim->u0 = 0x20;
|
||||
prim->u3 = 0x30;
|
||||
prim->u1 = 0x30;
|
||||
prim->v1 = 0;
|
||||
prim->v0 = 0;
|
||||
prim->v3 = 0x10;
|
||||
prim->v2 = 0x10;
|
||||
prim->x0 = prim->x2 = entity->posX.i.hi - 8;
|
||||
prim->x1 = prim->x3 = entity->posX.i.hi + 8;
|
||||
prim->y0 = prim->y1 = entity->posY.i.hi - 8;
|
||||
prim->y2 = prim->y3 = entity->posY.i.hi + 8;
|
||||
prim->priority = entity->zPriority;
|
||||
prim->blendMode = 0x115;
|
||||
entity->ext.generic.unk7E.modeU16 = 0x60U;
|
||||
entity->step++;
|
||||
} else {
|
||||
@ -1611,9 +1611,9 @@ void func_80172AE8(Entity* entity) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
poly = &g_PrimBuf[entity->primIndex];
|
||||
poly->r0 = poly->r1 = poly->r2 = poly->r3 = poly->g0 = poly->g1 = poly->g2 =
|
||||
poly->g3 = poly->b0 = poly->b1 = poly->b2 = poly->b3 =
|
||||
prim = &g_PrimBuf[entity->primIndex];
|
||||
prim->r0 = prim->r1 = prim->r2 = prim->r3 = prim->g0 = prim->g1 = prim->g2 =
|
||||
prim->g3 = prim->b0 = prim->b1 = prim->b2 = prim->b3 =
|
||||
entity->ext.generic.unk7E.modeU8.unk0;
|
||||
}
|
||||
|
||||
|
@ -254,15 +254,15 @@ void func_8017160C(s32 amount, s32 entityId) {
|
||||
}
|
||||
|
||||
void func_8017170C(Entity* entity, s32 frameIndex) {
|
||||
POLY_GT4* poly;
|
||||
Primitive* prim;
|
||||
s32 tpage;
|
||||
s32 x;
|
||||
s32 y;
|
||||
s32 index;
|
||||
|
||||
poly = &g_PrimBuf[entity->primIndex];
|
||||
prim = &g_PrimBuf[entity->primIndex];
|
||||
if (frameIndex == 0) {
|
||||
poly->pad3 = 8;
|
||||
prim->blendMode = BLEND_VISIBLE;
|
||||
return;
|
||||
}
|
||||
index = frameIndex - 1;
|
||||
@ -273,26 +273,26 @@ void func_8017170C(Entity* entity, s32 frameIndex) {
|
||||
}
|
||||
y = entity->posY.i.hi - 16;
|
||||
|
||||
poly->x0 = poly->x2 = x - D_80170608[index].x;
|
||||
poly->y0 = poly->y1 = y - D_80170608[index].y;
|
||||
poly->x1 = poly->x3 = poly->x0 + D_80170608[index].width;
|
||||
poly->y2 = poly->y3 = poly->y0 + D_80170608[index].height;
|
||||
poly->clut = D_80170608[index].clut;
|
||||
prim->x0 = prim->x2 = x - D_80170608[index].x;
|
||||
prim->y0 = prim->y1 = y - D_80170608[index].y;
|
||||
prim->x1 = prim->x3 = prim->x0 + D_80170608[index].width;
|
||||
prim->y2 = prim->y3 = prim->y0 + D_80170608[index].height;
|
||||
prim->clut = D_80170608[index].clut;
|
||||
tpage = D_80170608[index].tpage;
|
||||
if (tpage < 0) {
|
||||
tpage += 3;
|
||||
}
|
||||
poly->tpage = tpage >> 2;
|
||||
poly->u0 = poly->u2 = D_80170608[index].texLeft;
|
||||
poly->v0 = poly->v1 = D_80170608[index].texTop;
|
||||
poly->u1 = poly->u3 = D_80170608[index].texRight;
|
||||
poly->v2 = poly->v3 = D_80170608[index].texBottom;
|
||||
poly->pad2 = entity->zPriority + 1;
|
||||
poly->pad3 = 0x102;
|
||||
prim->tpage = tpage >> 2;
|
||||
prim->u0 = prim->u2 = D_80170608[index].texLeft;
|
||||
prim->v0 = prim->v1 = D_80170608[index].texTop;
|
||||
prim->u1 = prim->u3 = D_80170608[index].texRight;
|
||||
prim->v2 = prim->v3 = D_80170608[index].texBottom;
|
||||
prim->priority = entity->zPriority + 1;
|
||||
prim->blendMode = 0x102;
|
||||
}
|
||||
|
||||
void func_801718A0(Entity* entity) {
|
||||
POLY_GT4* poly;
|
||||
Primitive* prim;
|
||||
s32 frame;
|
||||
s32 y;
|
||||
s32 x;
|
||||
@ -308,11 +308,11 @@ void func_801718A0(Entity* entity) {
|
||||
x += (rsin(entity->ext.bat.unk8C << 7) * 8) >> 12;
|
||||
y -= entity->ext.bat.unk8C / 2;
|
||||
|
||||
poly = &g_PrimBuf[entity->primIndex];
|
||||
poly->x0 = poly->x2 = x - D_80170608[frame].x;
|
||||
poly->y0 = poly->y1 = y - D_80170608[frame].y;
|
||||
poly->x1 = poly->x3 = poly->x0 + D_80170608[frame].width;
|
||||
poly->y2 = poly->y3 = poly->y0 + D_80170608[frame].height;
|
||||
prim = &g_PrimBuf[entity->primIndex];
|
||||
prim->x0 = prim->x2 = x - D_80170608[frame].x;
|
||||
prim->y0 = prim->y1 = y - D_80170608[frame].y;
|
||||
prim->x1 = prim->x3 = prim->x0 + D_80170608[frame].width;
|
||||
prim->y2 = prim->y3 = prim->y0 + D_80170608[frame].height;
|
||||
}
|
||||
|
||||
void func_801719E0(Entity* self) {
|
||||
|
28
src/st/blink_item.h
Normal file
28
src/st/blink_item.h
Normal file
@ -0,0 +1,28 @@
|
||||
#include "game.h"
|
||||
|
||||
void BlinkItem(Entity* self, s32 renderFlags) {
|
||||
Primitive* prim = &g_PrimBuf[self->primIndex];
|
||||
s16 right, left, bottom, top;
|
||||
|
||||
left = self->posX.i.hi - 7;
|
||||
right = self->posX.i.hi + 7;
|
||||
|
||||
prim->x0 = prim->x2 = left;
|
||||
prim->x1 = prim->x3 = right;
|
||||
|
||||
top = self->posY.i.hi - 7;
|
||||
bottom = self->posY.i.hi + 7;
|
||||
|
||||
prim->y0 = prim->y1 = top;
|
||||
prim->y2 = prim->y3 = bottom;
|
||||
|
||||
if (renderFlags & RENDERFLAGS_NOSHADOW) {
|
||||
prim->r0 = prim->r1 = prim->r2 = prim->r3 = prim->g0 = prim->g1 =
|
||||
prim->g2 = prim->g3 = prim->b0 = prim->b1 = prim->b2 = prim->b3 =
|
||||
255;
|
||||
} else {
|
||||
prim->r0 = prim->r1 = prim->r2 = prim->r3 = prim->g0 = prim->g1 =
|
||||
prim->g2 = prim->g3 = prim->b0 = prim->b1 = prim->b2 = prim->b3 =
|
||||
128;
|
||||
}
|
||||
}
|
@ -746,7 +746,7 @@ INCLUDE_ASM("st/cen/nonmatchings/11280", EntityPrizeDrop);
|
||||
|
||||
INCLUDE_ASM("st/cen/nonmatchings/11280", EntityExplosion);
|
||||
|
||||
INCLUDE_ASM("st/cen/nonmatchings/11280", BlinkItem);
|
||||
#include "../blink_item.h"
|
||||
|
||||
INCLUDE_ASM("st/cen/nonmatchings/11280", EntityEquipItemDrop);
|
||||
|
||||
|
@ -247,74 +247,3 @@ void BottomCornerText(u8* str, u8 lower_left) {
|
||||
#undef xpos
|
||||
g_BottomCornerTextTimer = 0x130;
|
||||
}
|
||||
|
||||
#include "../unk_prim_helper.h"
|
||||
|
||||
#include "../update_animation.h"
|
||||
|
||||
#include "../find_first_unk_prim.h"
|
||||
|
||||
Primitive* func_8019C4B8(Primitive* prim, s32 count) {
|
||||
s32 i;
|
||||
u8 p3;
|
||||
|
||||
if (prim->p3 != 0) {
|
||||
prim->p3 = 0;
|
||||
} else {
|
||||
prim->p3 = 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (prim->p3 != 0) {
|
||||
prim->blendMode &= ~8;
|
||||
p3 = 0;
|
||||
} else {
|
||||
prim->blendMode |= 8;
|
||||
p3 = 1;
|
||||
}
|
||||
|
||||
prim = prim->next;
|
||||
|
||||
if (prim == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
prim->p3 = p3;
|
||||
}
|
||||
return prim;
|
||||
}
|
||||
|
||||
void func_8019C540(POLY_GT4* poly) {
|
||||
poly->p1 = 0;
|
||||
poly->p2 = 0;
|
||||
poly->p3 = 0;
|
||||
((POLY_GT4*)poly->tag)->x1 = 0;
|
||||
((POLY_GT4*)poly->tag)->y1 = 0;
|
||||
((POLY_GT4*)poly->tag)->y0 = 0;
|
||||
((POLY_GT4*)poly->tag)->x0 = 0;
|
||||
((POLY_GT4*)poly->tag)->clut = 0;
|
||||
*(u16*)&((POLY_GT4*)poly->tag)->u0 = 0;
|
||||
*(u16*)&((POLY_GT4*)poly->tag)->b1 = 0;
|
||||
*(u16*)&((POLY_GT4*)poly->tag)->r1 = 0;
|
||||
*(u16*)&((POLY_GT4*)poly->tag)->u1 = 0;
|
||||
((POLY_GT4*)poly->tag)->tpage = 0;
|
||||
*(u16*)&((POLY_GT4*)poly->tag)->r2 = 0;
|
||||
*(u16*)&((POLY_GT4*)poly->tag)->b2 = 0;
|
||||
((POLY_GT4*)poly->tag)->u2 = 0;
|
||||
((POLY_GT4*)poly->tag)->v2 = 0;
|
||||
((POLY_GT4*)poly->tag)->r3 = 0;
|
||||
((POLY_GT4*)poly->tag)->b3 = 0;
|
||||
((POLY_GT4*)poly->tag)->x2 = 0;
|
||||
((POLY_GT4*)poly->tag)->y2 = 0;
|
||||
}
|
||||
|
||||
void func_8019C620(POLY_GT4* poly) {
|
||||
func_8019C540(poly);
|
||||
poly->p3 = 8;
|
||||
((POLY_GT4*)poly->tag)->p3 = 1;
|
||||
((POLY_GT4*)poly->tag)->code = 2;
|
||||
((POLY_GT4*)poly->tag)->pad3 = 0xA;
|
||||
}
|
||||
|
||||
#include "../unk_poly_func_0.h"
|
||||
|
||||
#include "../unk_loop_func.h"
|
||||
|
@ -154,7 +154,7 @@ void func_8018DB18(Entity* self) {
|
||||
prim = &g_PrimBuf[primIndex];
|
||||
self->primIndex = primIndex;
|
||||
self->flags |= FLAG_HAS_PRIMS;
|
||||
func_8019C620(prim, primIndex);
|
||||
UnkPolyFunc2(prim);
|
||||
prim->tpage = 0x1A;
|
||||
prim->clut = 0x159;
|
||||
prim->u0 = prim->u2 = 0x40;
|
||||
|
2
src/st/cen/prim_helpers.c
Normal file
2
src/st/cen/prim_helpers.c
Normal file
@ -0,0 +1,2 @@
|
||||
#include <game.h>
|
||||
#include "../prim_helpers.h"
|
@ -860,33 +860,4 @@ void EntityExplosion(Entity* entity) {
|
||||
}
|
||||
}
|
||||
|
||||
void BlinkItem(Entity* entity, s32 renderFlags) {
|
||||
POLY_GT4* poly;
|
||||
s16 left, top, right, bottom;
|
||||
|
||||
poly = &g_PrimBuf[entity->primIndex];
|
||||
|
||||
left = entity->posX.i.hi - 7;
|
||||
right = entity->posX.i.hi + 7;
|
||||
poly->x2 = left;
|
||||
poly->x0 = left;
|
||||
poly->x3 = right;
|
||||
poly->x1 = right;
|
||||
|
||||
top = entity->posY.i.hi - 7;
|
||||
bottom = entity->posY.i.hi + 7;
|
||||
poly->y1 = top;
|
||||
poly->y0 = top;
|
||||
poly->y3 = bottom;
|
||||
poly->y2 = bottom;
|
||||
|
||||
if (renderFlags & RENDERFLAGS_NOSHADOW) {
|
||||
poly->r0 = poly->r1 = poly->r2 = poly->r3 = poly->g0 = poly->g1 =
|
||||
poly->g2 = poly->g3 = poly->b0 = poly->b1 = poly->b2 = poly->b3 =
|
||||
255;
|
||||
} else {
|
||||
poly->r0 = poly->r1 = poly->r2 = poly->r3 = poly->g0 = poly->g1 =
|
||||
poly->g2 = poly->g3 = poly->b0 = poly->b1 = poly->b2 = poly->b3 =
|
||||
128;
|
||||
}
|
||||
}
|
||||
#include "../blink_item.h"
|
||||
|
@ -4,7 +4,7 @@ void EntityEquipItemDrop(Entity* self) {
|
||||
u16 itemId = self->params & 0x7FFF;
|
||||
s32 primIndex;
|
||||
Collider collider;
|
||||
POLY_GT4* poly;
|
||||
Primitive* prim;
|
||||
s32* itemName;
|
||||
s16 index;
|
||||
s32 vramX;
|
||||
@ -77,7 +77,7 @@ void EntityEquipItemDrop(Entity* self) {
|
||||
g_api.accessoryDefs[itemId].iconPalette, index);
|
||||
}
|
||||
|
||||
poly = &g_PrimBuf[primIndex];
|
||||
prim = &g_PrimBuf[primIndex];
|
||||
vramX = ((temp_v0_6 = index) & 7) * 0x10;
|
||||
vramY = (temp_v0_6 & 0x18) * 2;
|
||||
|
||||
@ -87,16 +87,16 @@ void EntityEquipItemDrop(Entity* self) {
|
||||
top = vramY | top;
|
||||
bottom = vramY | 0x8F;
|
||||
|
||||
poly->tpage = 0x1A;
|
||||
poly->v3 = bottom;
|
||||
poly->clut = index + 464;
|
||||
poly->u0 = poly->u2 = left;
|
||||
poly->u1 = poly->u3 = right;
|
||||
poly->v1 = top;
|
||||
poly->v2 = bottom;
|
||||
poly->v0 = top;
|
||||
poly->pad2 = 0x80;
|
||||
poly->pad3 = 6;
|
||||
prim->tpage = 0x1A;
|
||||
prim->v3 = bottom;
|
||||
prim->clut = index + 464;
|
||||
prim->u0 = prim->u2 = left;
|
||||
prim->u1 = prim->u3 = right;
|
||||
prim->v1 = top;
|
||||
prim->v2 = bottom;
|
||||
prim->v0 = top;
|
||||
prim->priority = 0x80;
|
||||
prim->blendMode = 6;
|
||||
|
||||
self->ext.generic.unk7C.s = 128;
|
||||
self->step++;
|
||||
@ -147,11 +147,11 @@ void EntityEquipItemDrop(Entity* self) {
|
||||
case 4:
|
||||
func_8019B8DC(1);
|
||||
if (self->ext.generic.unk80.modeS8.unk0 += 255) {
|
||||
poly = &g_PrimBuf[self->primIndex];
|
||||
prim = &g_PrimBuf[self->primIndex];
|
||||
if (self->ext.generic.unk80.modeS8.unk0 & 2) {
|
||||
poly->pad3 = 8;
|
||||
prim->blendMode = BLEND_VISIBLE;
|
||||
} else {
|
||||
poly->pad3 = 2;
|
||||
prim->blendMode = 2;
|
||||
}
|
||||
} else {
|
||||
DestroyEntity(self);
|
||||
|
@ -747,91 +747,3 @@ void BottomCornerText(u8* str, u8 lower_left) {
|
||||
#undef xpos
|
||||
g_BottomCornerTextTimer = 0x130;
|
||||
}
|
||||
|
||||
#include "../unk_prim_helper.h"
|
||||
|
||||
#include "../update_animation.h"
|
||||
|
||||
#include "../find_first_unk_prim.h"
|
||||
|
||||
// DECOMP_ME_WIP func_801A25FC https://decomp.me/scratch/IIvQX a0 -> v0 register
|
||||
// swap
|
||||
#ifndef NON_MATCHING
|
||||
INCLUDE_ASM("st/dre/nonmatchings/1E1C8", func_801A25FC);
|
||||
#else
|
||||
POLY_GT4* func_801A25FC(POLY_GT4* poly, s32 arg1) {
|
||||
s32 i;
|
||||
s8 var_a2;
|
||||
|
||||
if (poly->p3 != 0) {
|
||||
poly->p3 = 0;
|
||||
} else {
|
||||
poly->p3 = 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < arg1; i++) {
|
||||
if (poly->p3 != 0) {
|
||||
var_a2 = 0;
|
||||
poly->pad3 &= ~8;
|
||||
} else {
|
||||
var_a2 = 1;
|
||||
poly->pad3 |= 8;
|
||||
}
|
||||
|
||||
if (poly->tag != NULL) {
|
||||
poly->p3 = var_a2;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return poly;
|
||||
}
|
||||
#endif
|
||||
|
||||
void func_801A2684(POLY_GT4* poly) {
|
||||
poly->p1 = 0;
|
||||
poly->p2 = 0;
|
||||
poly->p3 = 0;
|
||||
((POLY_GT4*)poly->tag)->x1 = 0;
|
||||
((POLY_GT4*)poly->tag)->y1 = 0;
|
||||
((POLY_GT4*)poly->tag)->y0 = 0;
|
||||
((POLY_GT4*)poly->tag)->x0 = 0;
|
||||
((POLY_GT4*)poly->tag)->clut = 0;
|
||||
*(u16*)&((POLY_GT4*)poly->tag)->u0 = 0;
|
||||
*(u16*)&((POLY_GT4*)poly->tag)->b1 = 0;
|
||||
*(u16*)&((POLY_GT4*)poly->tag)->r1 = 0;
|
||||
*(u16*)&((POLY_GT4*)poly->tag)->u1 = 0;
|
||||
((POLY_GT4*)poly->tag)->tpage = 0;
|
||||
*(u16*)&((POLY_GT4*)poly->tag)->r2 = 0;
|
||||
*(u16*)&((POLY_GT4*)poly->tag)->b2 = 0;
|
||||
((POLY_GT4*)poly->tag)->u2 = 0;
|
||||
((POLY_GT4*)poly->tag)->v2 = 0;
|
||||
((POLY_GT4*)poly->tag)->r3 = 0;
|
||||
((POLY_GT4*)poly->tag)->b3 = 0;
|
||||
((POLY_GT4*)poly->tag)->x2 = 0;
|
||||
((POLY_GT4*)poly->tag)->y2 = 0;
|
||||
}
|
||||
|
||||
void func_801A2764(POLY_GT4* poly) {
|
||||
func_801A2684(poly);
|
||||
poly->p3 = 8;
|
||||
((POLY_GT4*)poly->tag)->p3 = 1;
|
||||
((POLY_GT4*)poly->tag)->code = 2;
|
||||
((POLY_GT4*)poly->tag)->pad3 = 0xA;
|
||||
}
|
||||
|
||||
#include "../unk_poly_func_0.h"
|
||||
|
||||
#include "../unk_loop_func.h"
|
||||
|
||||
INCLUDE_ASM("st/dre/nonmatchings/1E1C8", func_801A2848);
|
||||
|
||||
INCLUDE_ASM("st/dre/nonmatchings/1E1C8", func_801A2A58);
|
||||
|
||||
INCLUDE_ASM("st/dre/nonmatchings/1E1C8", func_801A2C9C);
|
||||
|
||||
// DECOMP_ME_WIP EntityUnkId17 https://decomp.me/scratch/nNfXk 95.28%
|
||||
INCLUDE_ASM("st/dre/nonmatchings/1E1C8", EntityUnkId17);
|
||||
|
||||
// 3D house object in background ID 0x16
|
||||
INCLUDE_ASM("st/dre/nonmatchings/1E1C8", Entity3DBackgroundHouse);
|
||||
|
13
src/st/dre/22848.c
Normal file
13
src/st/dre/22848.c
Normal file
@ -0,0 +1,13 @@
|
||||
#include "dre.h"
|
||||
|
||||
INCLUDE_ASM("st/dre/nonmatchings/22848", func_801A2848);
|
||||
|
||||
INCLUDE_ASM("st/dre/nonmatchings/22848", func_801A2A58);
|
||||
|
||||
INCLUDE_ASM("st/dre/nonmatchings/22848", func_801A2C9C);
|
||||
|
||||
// DECOMP_ME_WIP EntityUnkId17 https://decomp.me/scratch/nNfXk 95.28%
|
||||
INCLUDE_ASM("st/dre/nonmatchings/22848", EntityUnkId17);
|
||||
|
||||
// 3D house object in background ID 0x16
|
||||
INCLUDE_ASM("st/dre/nonmatchings/22848", Entity3DBackgroundHouse);
|
2
src/st/dre/prim_helpers.c
Normal file
2
src/st/dre/prim_helpers.c
Normal file
@ -0,0 +1,2 @@
|
||||
#include <game.h>
|
||||
#include "../prim_helpers.h"
|
@ -1,37 +0,0 @@
|
||||
Primitive* FindFirstUnkPrim(Primitive* poly) {
|
||||
while (poly != NULL) {
|
||||
if (poly->p3 != 0) {
|
||||
poly = poly->next;
|
||||
} else {
|
||||
return poly;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Similar to FindFirstUnkPrim, but returns the first prim with
|
||||
// p3 == 0 if there is a prim with p3 == 0 at index positions after
|
||||
Primitive* FindFirstUnkPrim2(Primitive* prim, u8 index) {
|
||||
|
||||
Primitive* ret;
|
||||
int i;
|
||||
|
||||
for (; prim; prim = prim->next) {
|
||||
if (!prim->p3) {
|
||||
ret = prim;
|
||||
for (i = 1; i < index; ++i) {
|
||||
prim = prim->next;
|
||||
if (!prim) {
|
||||
return NULL;
|
||||
}
|
||||
if (prim->p3) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == index) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
@ -561,93 +561,3 @@ void EntityRoomForeground(Entity* entity) {
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/mad/nonmatchings/15520", func_80198BC8);
|
||||
|
||||
#include "../unk_prim_helper.h"
|
||||
|
||||
#include "../update_animation.h"
|
||||
|
||||
#include "../find_first_unk_prim.h"
|
||||
|
||||
POLY_GT4* func_80199584(POLY_GT4* startPoly, s32 count) {
|
||||
POLY_GT4* poly;
|
||||
s8 unk;
|
||||
s32 i;
|
||||
|
||||
if (startPoly->p3) {
|
||||
startPoly->p3 = 0;
|
||||
} else {
|
||||
startPoly->p3 = 1;
|
||||
}
|
||||
|
||||
poly = startPoly;
|
||||
for (i = 0; i < count; i++) {
|
||||
if (poly->p3) {
|
||||
poly->pad3 &= ~8;
|
||||
unk = 0;
|
||||
} else {
|
||||
poly->pad3 |= 8;
|
||||
unk = 1;
|
||||
}
|
||||
|
||||
poly = (POLY_GT4*)poly->tag;
|
||||
if (poly == NULL)
|
||||
return NULL;
|
||||
poly->p3 = unk;
|
||||
}
|
||||
|
||||
return poly;
|
||||
}
|
||||
|
||||
void func_8019960C(POLY_GT4* arg0) {
|
||||
arg0->p1 = 0;
|
||||
arg0->p2 = 0;
|
||||
arg0->p3 = 0;
|
||||
((POLY_GT4*)arg0->tag)->x1 = 0;
|
||||
((POLY_GT4*)arg0->tag)->y1 = 0;
|
||||
((POLY_GT4*)arg0->tag)->y0 = 0;
|
||||
((POLY_GT4*)arg0->tag)->x0 = 0;
|
||||
((POLY_GT4*)arg0->tag)->clut = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->u0 = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->b1 = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->r1 = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->u1 = 0;
|
||||
((POLY_GT4*)arg0->tag)->tpage = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->r2 = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->b2 = 0;
|
||||
((POLY_GT4*)arg0->tag)->u2 = 0;
|
||||
((POLY_GT4*)arg0->tag)->v2 = 0;
|
||||
((POLY_GT4*)arg0->tag)->r3 = 0;
|
||||
((POLY_GT4*)arg0->tag)->b3 = 0;
|
||||
((POLY_GT4*)arg0->tag)->x2 = 0;
|
||||
((POLY_GT4*)arg0->tag)->y2 = 0;
|
||||
}
|
||||
|
||||
void func_801996EC(POLY_GT4* arg0) {
|
||||
func_8019960C(arg0);
|
||||
arg0->p3 = 8;
|
||||
((POLY_GT4*)arg0->tag)->p3 = 1;
|
||||
((POLY_GT4*)arg0->tag)->code = 2;
|
||||
((POLY_GT4*)arg0->tag)->pad3 = 0xA;
|
||||
}
|
||||
|
||||
#include "../unk_poly_func_0.h"
|
||||
|
||||
s32 func_8019976C(Unkstruct_80128BBC* arg0, u8 value) {
|
||||
u8 ret = 0;
|
||||
s32 i;
|
||||
s32 j;
|
||||
Unkstruct_80128BBC_Sub* temp = arg0->unk04;
|
||||
|
||||
for (i = 0; i < 4; i++, temp++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
temp->unk00[j] -= value;
|
||||
|
||||
if (temp->unk00[j] > 248) {
|
||||
temp->unk00[j] = 0;
|
||||
} else {
|
||||
ret |= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
2
src/st/mad/prim_helpers.c
Normal file
2
src/st/mad/prim_helpers.c
Normal file
@ -0,0 +1,2 @@
|
||||
#include "mad.h"
|
||||
#include "../prim_helpers.h"
|
@ -1380,7 +1380,7 @@ void EntityStairwayPiece(Entity* self, u8 arg1, u8 arg2, u8 arg3) {
|
||||
self->primIndex = primIndex;
|
||||
self->ext.prim = prim;
|
||||
self->flags |= FLAG_HAS_PRIMS;
|
||||
func_801D6FCC(prim, primIndex);
|
||||
UnkPolyFunc2(prim);
|
||||
v1 = g_Tilemap.D_80073088->gfxIndex[0x409];
|
||||
arg1 = v1;
|
||||
temp = g_Tilemap.D_80073088->gfxPage[0x409];
|
||||
|
@ -242,36 +242,7 @@ void EntityExplosion(Entity* entity) {
|
||||
}
|
||||
}
|
||||
|
||||
void BlinkItem(Entity* entity, s32 renderFlags) {
|
||||
POLY_GT4* poly;
|
||||
s16 left, top, right, bottom;
|
||||
|
||||
poly = &g_PrimBuf[entity->primIndex];
|
||||
|
||||
left = entity->posX.i.hi - 7;
|
||||
right = entity->posX.i.hi + 7;
|
||||
poly->x2 = left;
|
||||
poly->x0 = left;
|
||||
poly->x3 = right;
|
||||
poly->x1 = right;
|
||||
|
||||
top = entity->posY.i.hi - 7;
|
||||
bottom = entity->posY.i.hi + 7;
|
||||
poly->y1 = top;
|
||||
poly->y0 = top;
|
||||
poly->y3 = bottom;
|
||||
poly->y2 = bottom;
|
||||
|
||||
if (renderFlags & RENDERFLAGS_NOSHADOW) {
|
||||
poly->r0 = poly->r1 = poly->r2 = poly->r3 = poly->g0 = poly->g1 =
|
||||
poly->g2 = poly->g3 = poly->b0 = poly->b1 = poly->b2 = poly->b3 =
|
||||
255;
|
||||
} else {
|
||||
poly->r0 = poly->r1 = poly->r2 = poly->r3 = poly->g0 = poly->g1 =
|
||||
poly->g2 = poly->g3 = poly->b0 = poly->b1 = poly->b2 = poly->b3 =
|
||||
128;
|
||||
}
|
||||
}
|
||||
#include "../blink_item.h"
|
||||
|
||||
void EntityEquipItemDrop(Entity* self) {
|
||||
u16 itemId = self->params & 0x7FFF;
|
||||
|
@ -1643,7 +1643,7 @@ INCLUDE_ASM("st/no3/nonmatchings/48A84", EntityMerman3);
|
||||
|
||||
// some sort of explosion
|
||||
void EntityExplosion2(Entity* entity, s32 arg1) {
|
||||
POLY_GT4* poly;
|
||||
Primitive* prim;
|
||||
s16 primIndex;
|
||||
|
||||
if (entity->step == 0) {
|
||||
@ -1657,37 +1657,37 @@ void EntityExplosion2(Entity* entity, s32 arg1) {
|
||||
DestroyEntity(entity);
|
||||
return;
|
||||
}
|
||||
poly = &g_PrimBuf[primIndex];
|
||||
prim = &g_PrimBuf[primIndex];
|
||||
entity->primIndex = primIndex;
|
||||
*(s32*)&entity->ext.generic.unk7C.s = poly;
|
||||
*(s32*)&entity->ext.generic.unk7C.s = prim;
|
||||
entity->flags |= FLAG_HAS_PRIMS;
|
||||
func_801D6FCC(poly, primIndex);
|
||||
poly->u0 = 0;
|
||||
poly->u1 = 0x20;
|
||||
poly->tpage = 0x1A;
|
||||
poly->clut = 0x1FF;
|
||||
poly->v3 = poly->v2 = 0x20;
|
||||
poly->v1 = poly->v0 = 0;
|
||||
poly->u2 = poly->u0;
|
||||
poly->u3 = poly->u1;
|
||||
LOH(((POLY_GT4*)poly->tag)->r2) = 0x40;
|
||||
LOH(((POLY_GT4*)poly->tag)->b2) = 0x40;
|
||||
LOH(((POLY_GT4*)poly->tag)->u1) = 0;
|
||||
((POLY_GT4*)poly->tag)->b3 = 0x60;
|
||||
((POLY_GT4*)poly->tag)->x1 = (u16)entity->posX.i.hi;
|
||||
((POLY_GT4*)poly->tag)->y0 = (u16)entity->posY.i.hi;
|
||||
poly->pad2 = entity->zPriority - 4;
|
||||
poly->pad3 = 6;
|
||||
UnkPolyFunc2(prim);
|
||||
prim->u0 = 0;
|
||||
prim->u1 = 0x20;
|
||||
prim->tpage = 0x1A;
|
||||
prim->clut = 0x1FF;
|
||||
prim->v3 = prim->v2 = 0x20;
|
||||
prim->v1 = prim->v0 = 0;
|
||||
prim->u2 = prim->u0;
|
||||
prim->u3 = prim->u1;
|
||||
LOH(prim->next->r2) = 0x40;
|
||||
LOH(prim->next->b2) = 0x40;
|
||||
LOH(prim->next->u1) = 0;
|
||||
prim->next->b3 = 0x60;
|
||||
prim->next->x1 = (u16)entity->posX.i.hi;
|
||||
prim->next->y0 = (u16)entity->posY.i.hi;
|
||||
prim->priority = entity->zPriority - 4;
|
||||
prim->blendMode = 6;
|
||||
}
|
||||
}
|
||||
|
||||
if (entity->params != 0) {
|
||||
poly = *(s32*)&entity->ext.generic.unk7C.s;
|
||||
UnkPrimHelper(poly);
|
||||
((POLY_GT4*)poly->tag)->b3 += 252;
|
||||
LOH(((POLY_GT4*)poly->tag)->u1) -= 128;
|
||||
if (((POLY_GT4*)poly->tag)->b3 < 16) {
|
||||
poly->pad3 = 8;
|
||||
prim = *(s32*)&entity->ext.generic.unk7C.s;
|
||||
UnkPrimHelper(prim);
|
||||
prim->next->b3 += 252;
|
||||
LOH(prim->next->u1) -= 128;
|
||||
if (prim->next->b3 < 16) {
|
||||
prim->blendMode = 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,75 +122,3 @@ void EntityZombieSpawner(Entity* self) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "../unk_prim_helper.h"
|
||||
|
||||
#include "../update_animation.h"
|
||||
|
||||
#include "../find_first_unk_prim.h"
|
||||
|
||||
POLY_GT4* func_801D6E64(POLY_GT4* startPoly, s32 count) {
|
||||
POLY_GT4* poly;
|
||||
s8 unk;
|
||||
s32 i;
|
||||
|
||||
if (startPoly->p3) {
|
||||
startPoly->p3 = 0;
|
||||
} else {
|
||||
startPoly->p3 = 1;
|
||||
}
|
||||
|
||||
poly = startPoly;
|
||||
for (i = 0; i < count; i++) {
|
||||
if (poly->p3) {
|
||||
poly->pad3 &= ~8;
|
||||
unk = 0;
|
||||
} else {
|
||||
poly->pad3 |= 8;
|
||||
unk = 1;
|
||||
}
|
||||
|
||||
poly = (POLY_GT4*)poly->tag;
|
||||
if (poly == 0)
|
||||
return 0;
|
||||
poly->p3 = unk;
|
||||
}
|
||||
|
||||
return poly;
|
||||
}
|
||||
|
||||
void func_801D6EEC(POLY_GT4* arg0) {
|
||||
arg0->p1 = 0;
|
||||
arg0->p2 = 0;
|
||||
arg0->p3 = 0;
|
||||
((POLY_GT4*)arg0->tag)->x1 = 0;
|
||||
((POLY_GT4*)arg0->tag)->y1 = 0;
|
||||
((POLY_GT4*)arg0->tag)->y0 = 0;
|
||||
((POLY_GT4*)arg0->tag)->x0 = 0;
|
||||
((POLY_GT4*)arg0->tag)->clut = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->u0 = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->b1 = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->r1 = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->u1 = 0;
|
||||
((POLY_GT4*)arg0->tag)->tpage = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->r2 = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->b2 = 0;
|
||||
((POLY_GT4*)arg0->tag)->u2 = 0;
|
||||
((POLY_GT4*)arg0->tag)->v2 = 0;
|
||||
((POLY_GT4*)arg0->tag)->r3 = 0;
|
||||
((POLY_GT4*)arg0->tag)->b3 = 0;
|
||||
((POLY_GT4*)arg0->tag)->x2 = 0;
|
||||
((POLY_GT4*)arg0->tag)->y2 = 0;
|
||||
}
|
||||
|
||||
void func_801D6FCC(POLY_GT4* arg0) {
|
||||
func_801D6EEC(arg0);
|
||||
arg0->p3 = 8;
|
||||
((POLY_GT4*)arg0->tag)->p3 = 1;
|
||||
((POLY_GT4*)arg0->tag)->code = 2;
|
||||
((POLY_GT4*)arg0->tag)->pad3 = 0xA;
|
||||
}
|
||||
|
||||
#include "../unk_poly_func_0.h"
|
||||
|
||||
#include "../unk_loop_func.h"
|
||||
|
2
src/st/no3/prim_helpers.c
Normal file
2
src/st/no3/prim_helpers.c
Normal file
@ -0,0 +1,2 @@
|
||||
#include <game.h>
|
||||
#include "../prim_helpers.h"
|
@ -1323,7 +1323,7 @@ void EntityStairwayPiece(Entity* self, u8 arg1, u8 arg2, u8 arg3) {
|
||||
self->primIndex = primIndex;
|
||||
self->ext.prim = prim;
|
||||
self->flags |= FLAG_HAS_PRIMS;
|
||||
func_801D2684(prim, primIndex);
|
||||
UnkPolyFunc2(prim);
|
||||
v1 = g_Tilemap.D_80073088->gfxIndex[0x409];
|
||||
arg1 = v1;
|
||||
temp = g_Tilemap.D_80073088->gfxPage[0x409];
|
||||
|
@ -251,32 +251,7 @@ void EntityExplosion(Entity* entity) {
|
||||
}
|
||||
}
|
||||
|
||||
void BlinkItem(Entity* self, s32 arg1) {
|
||||
POLY_GT4* poly = &g_PrimBuf[self->primIndex];
|
||||
s16 right, left, bottom, top;
|
||||
|
||||
left = self->posX.i.hi - 7;
|
||||
right = self->posX.i.hi + 7;
|
||||
|
||||
poly->x0 = poly->x2 = left;
|
||||
poly->x1 = poly->x3 = right;
|
||||
|
||||
top = self->posY.i.hi - 7;
|
||||
bottom = self->posY.i.hi + 7;
|
||||
|
||||
poly->y0 = poly->y1 = top;
|
||||
poly->y2 = poly->y3 = bottom;
|
||||
|
||||
if (arg1 & RENDERFLAGS_NOSHADOW) {
|
||||
poly->r0 = poly->r1 = poly->r2 = poly->r3 = poly->g0 = poly->g1 =
|
||||
poly->g2 = poly->g3 = poly->b0 = poly->b1 = poly->b2 = poly->b3 =
|
||||
255;
|
||||
} else {
|
||||
poly->r0 = poly->r1 = poly->r2 = poly->r3 = poly->g0 = poly->g1 =
|
||||
poly->g2 = poly->g3 = poly->b0 = poly->b1 = poly->b2 = poly->b3 =
|
||||
128;
|
||||
}
|
||||
}
|
||||
#include "../blink_item.h"
|
||||
|
||||
void EntityEquipItemDrop(Entity* self) {
|
||||
u16 itemId = self->params & 0x7FFF;
|
||||
|
@ -1090,7 +1090,7 @@ void EntityMerman2(Entity* self) {
|
||||
self->primIndex = primIndex;
|
||||
self->ext.merman2.prim = prim;
|
||||
self->flags |= 0x800000;
|
||||
func_801D2684(prim, primIndex);
|
||||
UnkPolyFunc2(prim);
|
||||
prim->tpage = 0x12;
|
||||
prim->clut = 0x292;
|
||||
if (self->params & 1) {
|
||||
@ -1167,7 +1167,7 @@ void EntityMerman2(Entity* self) {
|
||||
|
||||
// some sort of explosion: ID 0x36
|
||||
void EntityExplosion2(Entity* entity, s32 arg1) {
|
||||
Primitive* poly;
|
||||
Primitive* prim;
|
||||
s16 primIndex;
|
||||
|
||||
if (entity->step == 0) {
|
||||
@ -1181,37 +1181,37 @@ void EntityExplosion2(Entity* entity, s32 arg1) {
|
||||
DestroyEntity(entity);
|
||||
return;
|
||||
}
|
||||
poly = &g_PrimBuf[primIndex];
|
||||
prim = &g_PrimBuf[primIndex];
|
||||
entity->primIndex = primIndex;
|
||||
*(s32*)&entity->ext.generic.unk7C.s = poly;
|
||||
*(s32*)&entity->ext.generic.unk7C.s = prim;
|
||||
entity->flags |= FLAG_HAS_PRIMS;
|
||||
func_801D2684(poly, primIndex);
|
||||
poly->u0 = 0;
|
||||
poly->u1 = 0x20;
|
||||
poly->tpage = 0x1A;
|
||||
poly->clut = 0x1FF;
|
||||
poly->v3 = poly->v2 = 0x20;
|
||||
poly->v1 = poly->v0 = 0;
|
||||
poly->u2 = poly->u0;
|
||||
poly->u3 = poly->u1;
|
||||
LOH(poly->next->r2) = 0x40;
|
||||
LOH(poly->next->b2) = 0x40;
|
||||
LOH(poly->next->u1) = 0;
|
||||
poly->next->b3 = 0x60;
|
||||
poly->next->x1 = entity->posX.i.hi;
|
||||
poly->next->y0 = entity->posY.i.hi;
|
||||
poly->priority = entity->zPriority - 4;
|
||||
poly->blendMode = 6;
|
||||
UnkPolyFunc2(prim);
|
||||
prim->u0 = 0;
|
||||
prim->u1 = 0x20;
|
||||
prim->tpage = 0x1A;
|
||||
prim->clut = 0x1FF;
|
||||
prim->v3 = prim->v2 = 0x20;
|
||||
prim->v1 = prim->v0 = 0;
|
||||
prim->u2 = prim->u0;
|
||||
prim->u3 = prim->u1;
|
||||
LOH(prim->next->r2) = 0x40;
|
||||
LOH(prim->next->b2) = 0x40;
|
||||
LOH(prim->next->u1) = 0;
|
||||
prim->next->b3 = 0x60;
|
||||
prim->next->x1 = entity->posX.i.hi;
|
||||
prim->next->y0 = entity->posY.i.hi;
|
||||
prim->priority = entity->zPriority - 4;
|
||||
prim->blendMode = 6;
|
||||
}
|
||||
}
|
||||
|
||||
if (entity->params != 0) {
|
||||
poly = *(s32*)&entity->ext.generic.unk7C.s;
|
||||
UnkPrimHelper(poly);
|
||||
((POLY_GT4*)poly->next)->b3 += 252;
|
||||
LOH(poly->next->u1) -= 128;
|
||||
if (poly->next->b3 < 16) {
|
||||
poly->blendMode = BLEND_VISIBLE;
|
||||
prim = *(s32*)&entity->ext.generic.unk7C.s;
|
||||
UnkPrimHelper(prim);
|
||||
prim->next->b3 += 252;
|
||||
LOH(prim->next->u1) -= 128;
|
||||
if (prim->next->b3 < 16) {
|
||||
prim->blendMode = BLEND_VISIBLE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ void EntityBloodSplatter(Entity* self) {
|
||||
prim = FindFirstUnkPrim2(*(s32*)&self->ext.generic.unk7C, 2);
|
||||
if (prim != NULL) {
|
||||
self->ext.generic.unk8C.primPtr = prim;
|
||||
func_801D2684(prim);
|
||||
UnkPolyFunc2(prim);
|
||||
prim->v0 = 0x30;
|
||||
prim->tpage = 0x1A;
|
||||
prim->v2 = 0x30;
|
||||
@ -76,7 +76,7 @@ void EntityBloodSplatter(Entity* self) {
|
||||
prim = FindFirstUnkPrim2(*(s32*)&self->ext.generic.unk7C, 2);
|
||||
if (prim != NULL) {
|
||||
*(s32*)&self->ext.generic.unk90 = prim;
|
||||
func_801D2684(prim);
|
||||
UnkPolyFunc2(prim);
|
||||
prim->v1 = 0x40;
|
||||
prim->tpage = 0x1A;
|
||||
prim->v3 = 0x40U;
|
||||
@ -377,7 +377,7 @@ void EntityBloodyZombie(Entity* self) {
|
||||
if (!(g_Timer & 3)) {
|
||||
prim = FindFirstUnkPrim2(*(s32*)&self->ext.generic.unk7C, 2);
|
||||
if (prim != NULL) {
|
||||
func_801D2684(prim);
|
||||
UnkPolyFunc2(prim);
|
||||
prim->next->r3 = self->ext.generic.unk84.U8.unk0;
|
||||
}
|
||||
self->ext.generic.unk84.U8.unk0 ^= 1;
|
||||
|
@ -528,75 +528,3 @@ void EntityBladeSword(Entity* self) {
|
||||
prim->blendMode = 0xA;
|
||||
}
|
||||
}
|
||||
|
||||
#include "../unk_prim_helper.h"
|
||||
|
||||
#include "../update_animation.h"
|
||||
|
||||
#include "../find_first_unk_prim.h"
|
||||
|
||||
POLY_GT4* func_801D251C(POLY_GT4* startPoly, s32 count) {
|
||||
POLY_GT4* poly;
|
||||
s8 unk;
|
||||
s32 i;
|
||||
|
||||
if (startPoly->p3) {
|
||||
startPoly->p3 = 0;
|
||||
} else {
|
||||
startPoly->p3 = 1;
|
||||
}
|
||||
|
||||
poly = startPoly;
|
||||
for (i = 0; i < count; i++) {
|
||||
if (poly->p3) {
|
||||
poly->pad3 &= ~8;
|
||||
unk = 0;
|
||||
} else {
|
||||
poly->pad3 |= 8;
|
||||
unk = 1;
|
||||
}
|
||||
|
||||
poly = (POLY_GT4*)poly->tag;
|
||||
if (poly == 0)
|
||||
return 0;
|
||||
poly->p3 = unk;
|
||||
}
|
||||
|
||||
return poly;
|
||||
}
|
||||
|
||||
void func_801D25A4(POLY_GT4* arg0) {
|
||||
arg0->p1 = 0;
|
||||
arg0->p2 = 0;
|
||||
arg0->p3 = 0;
|
||||
((POLY_GT4*)arg0->tag)->x1 = 0;
|
||||
((POLY_GT4*)arg0->tag)->y1 = 0;
|
||||
((POLY_GT4*)arg0->tag)->y0 = 0;
|
||||
((POLY_GT4*)arg0->tag)->x0 = 0;
|
||||
((POLY_GT4*)arg0->tag)->clut = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->u0 = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->b1 = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->r1 = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->u1 = 0;
|
||||
((POLY_GT4*)arg0->tag)->tpage = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->r2 = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->b2 = 0;
|
||||
((POLY_GT4*)arg0->tag)->u2 = 0;
|
||||
((POLY_GT4*)arg0->tag)->v2 = 0;
|
||||
((POLY_GT4*)arg0->tag)->r3 = 0;
|
||||
((POLY_GT4*)arg0->tag)->b3 = 0;
|
||||
((POLY_GT4*)arg0->tag)->x2 = 0;
|
||||
((POLY_GT4*)arg0->tag)->y2 = 0;
|
||||
}
|
||||
|
||||
void func_801D2684(POLY_GT4* arg0) {
|
||||
func_801D25A4(arg0);
|
||||
arg0->p3 = 8;
|
||||
((POLY_GT4*)arg0->tag)->p3 = 1;
|
||||
((POLY_GT4*)arg0->tag)->code = 2;
|
||||
((POLY_GT4*)arg0->tag)->pad3 = 0xA;
|
||||
}
|
||||
|
||||
#include "../unk_poly_func_0.h"
|
||||
|
||||
#include "../unk_loop_func.h"
|
||||
|
2
src/st/np3/prim_helpers.c
Normal file
2
src/st/np3/prim_helpers.c
Normal file
@ -0,0 +1,2 @@
|
||||
#include <game.h>
|
||||
#include "../prim_helpers.h"
|
@ -248,36 +248,7 @@ void EntityExplosion(Entity* entity) {
|
||||
}
|
||||
}
|
||||
|
||||
void BlinkItem(Entity* entity, s32 arg1) {
|
||||
POLY_GT4* poly;
|
||||
s16 left, top, right, bottom;
|
||||
|
||||
poly = &g_PrimBuf[entity->primIndex];
|
||||
|
||||
left = entity->posX.i.hi - 7;
|
||||
right = entity->posX.i.hi + 7;
|
||||
poly->x2 = left;
|
||||
poly->x0 = left;
|
||||
poly->x3 = right;
|
||||
poly->x1 = right;
|
||||
|
||||
top = entity->posY.i.hi - 7;
|
||||
bottom = entity->posY.i.hi + 7;
|
||||
poly->y1 = top;
|
||||
poly->y0 = top;
|
||||
poly->y3 = bottom;
|
||||
poly->y2 = bottom;
|
||||
|
||||
if (arg1 & RENDERFLAGS_NOSHADOW) {
|
||||
poly->r0 = poly->r1 = poly->r2 = poly->r3 = poly->g0 = poly->g1 =
|
||||
poly->g2 = poly->g3 = poly->b0 = poly->b1 = poly->b2 = poly->b3 =
|
||||
255;
|
||||
} else {
|
||||
poly->r0 = poly->r1 = poly->r2 = poly->r3 = poly->g0 = poly->g1 =
|
||||
poly->g2 = poly->g3 = poly->b0 = poly->b1 = poly->b2 = poly->b3 =
|
||||
128;
|
||||
}
|
||||
}
|
||||
#include "../blink_item.h"
|
||||
|
||||
void EntityEquipItemDrop(Entity* self) {
|
||||
u16 itemId = self->params & 0x7FFF;
|
||||
|
@ -42,7 +42,7 @@ void EntityBloodSplatter(Entity* self) {
|
||||
prim = FindFirstUnkPrim2(*(s32*)&self->ext.generic.unk7C, 2);
|
||||
if (prim != NULL) {
|
||||
self->ext.generic.unk8C.primPtr = prim;
|
||||
func_801CA07C(prim);
|
||||
UnkPolyFunc2(prim);
|
||||
prim->v0 = 0x30;
|
||||
prim->tpage = 0x1A;
|
||||
prim->v2 = 0x30;
|
||||
@ -76,7 +76,7 @@ void EntityBloodSplatter(Entity* self) {
|
||||
prim = FindFirstUnkPrim2(*(s32*)&self->ext.generic.unk7C, 2);
|
||||
if (prim != NULL) {
|
||||
*(s32*)&self->ext.generic.unk90 = prim;
|
||||
func_801CA07C(prim);
|
||||
UnkPolyFunc2(prim);
|
||||
prim->v1 = 0x40;
|
||||
prim->tpage = 0x1A;
|
||||
prim->v3 = 0x40U;
|
||||
@ -377,7 +377,7 @@ void EntityBloodyZombie(Entity* self) {
|
||||
if (!(g_Timer & 3)) {
|
||||
prim = FindFirstUnkPrim2(*(s32*)&self->ext.generic.unk7C, 2);
|
||||
if (prim != NULL) {
|
||||
func_801CA07C(prim);
|
||||
UnkPolyFunc2(prim);
|
||||
prim->next->r3 = self->ext.generic.unk84.U8.unk0;
|
||||
}
|
||||
self->ext.generic.unk84.U8.unk0 ^= 1;
|
||||
|
@ -1,78 +0,0 @@
|
||||
#include "nz0.h"
|
||||
|
||||
#include "../unk_prim_helper.h"
|
||||
|
||||
#include "../update_animation.h"
|
||||
|
||||
#include "../find_first_unk_prim.h"
|
||||
|
||||
Primitive* func_801C9F14(Primitive* startPoly, s32 count) {
|
||||
Primitive* poly;
|
||||
s8 unk;
|
||||
s32 i;
|
||||
|
||||
if (startPoly->p3) {
|
||||
startPoly->p3 = 0;
|
||||
} else {
|
||||
startPoly->p3 = 1;
|
||||
}
|
||||
poly = startPoly;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (poly->p3) {
|
||||
poly->blendMode &= ~8;
|
||||
unk = 0;
|
||||
} else {
|
||||
poly->blendMode |= 8;
|
||||
unk = 1;
|
||||
}
|
||||
|
||||
poly = poly->next;
|
||||
if (poly == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
poly->p3 = unk;
|
||||
}
|
||||
|
||||
return poly;
|
||||
}
|
||||
|
||||
void func_801C9F9C(Primitive* poly) {
|
||||
poly->p1 = 0;
|
||||
poly->p2 = 0;
|
||||
poly->p3 = 0;
|
||||
poly->next->x1 = 0;
|
||||
poly->next->y1 = 0;
|
||||
poly->next->y0 = 0;
|
||||
poly->next->x0 = 0;
|
||||
poly->next->clut = 0;
|
||||
*(u16*)&poly->next->u0 = 0;
|
||||
*(u16*)&poly->next->b1 = 0;
|
||||
*(u16*)&poly->next->r1 = 0;
|
||||
*(u16*)&poly->next->u1 = 0;
|
||||
poly->next->tpage = 0;
|
||||
*(u16*)&poly->next->r2 = 0;
|
||||
*(u16*)&poly->next->b2 = 0;
|
||||
poly->next->u2 = 0;
|
||||
poly->next->v2 = 0;
|
||||
poly->next->r3 = 0;
|
||||
poly->next->b3 = 0;
|
||||
poly->next->x2 = 0;
|
||||
poly->next->y2 = 0;
|
||||
}
|
||||
|
||||
void func_801CA07C(Primitive* poly) {
|
||||
func_801C9F9C(poly);
|
||||
poly->p3 = 8;
|
||||
poly->next->p3 = 1;
|
||||
poly->next->type = 2;
|
||||
poly->next->blendMode = 0xA;
|
||||
}
|
||||
|
||||
#include "../unk_poly_func_0.h"
|
||||
|
||||
#include "../unk_loop_func.h"
|
||||
|
||||
// particle effect that spawns life up item
|
||||
// Probably it's own file
|
||||
INCLUDE_ASM("st/nz0/nonmatchings/49930", EntityLifeUpSpawn);
|
5
src/st/nz0/4A160.c
Normal file
5
src/st/nz0/4A160.c
Normal file
@ -0,0 +1,5 @@
|
||||
#include "nz0.h"
|
||||
|
||||
// particle effect that spawns life up item
|
||||
// Probably it's own file
|
||||
INCLUDE_ASM("st/nz0/nonmatchings/4A160", EntityLifeUpSpawn);
|
2
src/st/nz0/prim_helpers.c
Normal file
2
src/st/nz0/prim_helpers.c
Normal file
@ -0,0 +1,2 @@
|
||||
#include <game.h>
|
||||
#include "../prim_helpers.h"
|
281
src/st/prim_helpers.h
Normal file
281
src/st/prim_helpers.h
Normal file
@ -0,0 +1,281 @@
|
||||
#include "game.h"
|
||||
|
||||
extern SVECTOR g_UnkPrimHelperRot;
|
||||
void UnkPrimHelper(Primitive* prim) {
|
||||
SVECTOR sp10; // FAKE, not really an svector
|
||||
SVECTOR stackpad;
|
||||
SVECTOR sp20;
|
||||
VECTOR trans1;
|
||||
SVECTOR sp38;
|
||||
SVECTOR sp40;
|
||||
SVECTOR sp48;
|
||||
SVECTOR sp50;
|
||||
MATRIX m;
|
||||
SVECTOR rot;
|
||||
u8 temp_v1_2;
|
||||
|
||||
rot = g_UnkPrimHelperRot;
|
||||
if (prim->p3 & 8) {
|
||||
// Fake logic here, sp10 is not an SVECTOR but it matches.
|
||||
// tried using an f32 but couldn't get it to work.
|
||||
sp10.vy = prim->next->x1;
|
||||
sp10.vx = prim->next->y1;
|
||||
LOW(sp10.vx) += LOW(prim->next->u0);
|
||||
prim->next->x1 = sp10.vy;
|
||||
prim->next->y1 = sp10.vx;
|
||||
LOW(prim->next->x0) += LOW(prim->next->r1);
|
||||
}
|
||||
temp_v1_2 = prim->next->b3;
|
||||
LOH(prim->r0) = LOH(prim->r1) = LOH(prim->r2) = LOH(prim->r3) =
|
||||
temp_v1_2 | (temp_v1_2 << 8);
|
||||
prim->b0 = prim->b1 = prim->b2 = prim->b3 = temp_v1_2;
|
||||
trans1.vx = 0;
|
||||
trans1.vy = 0;
|
||||
trans1.vz = 0x400 - LOH(prim->next->u1);
|
||||
RotMatrix(&rot, &m);
|
||||
if (prim->p3 & 0x20) {
|
||||
sp20.vx = prim->next->x3;
|
||||
sp20.vy = prim->next->y3;
|
||||
RotMatrixX(sp20.vx, &m);
|
||||
RotMatrixY(sp20.vy, &m);
|
||||
}
|
||||
sp20.vz = prim->next->tpage;
|
||||
RotMatrixZ(sp20.vz, &m);
|
||||
TransMatrix(&m, &trans1);
|
||||
if (prim->p3 & 0x10) {
|
||||
trans1.vx = prim->next->x2;
|
||||
trans1.vy = prim->next->y2;
|
||||
trans1.vz = 0x1000;
|
||||
ScaleMatrix(&m, &trans1);
|
||||
}
|
||||
SetRotMatrix(&m);
|
||||
SetTransMatrix(&m);
|
||||
SetGeomScreen(0x400);
|
||||
SetGeomOffset(prim->next->x1, prim->next->y0);
|
||||
sp38.vx = -LOH(prim->next->r2) / 2;
|
||||
sp38.vy = -LOH(prim->next->b2) / 2;
|
||||
sp38.vz = 0;
|
||||
sp40.vx = LOH(prim->next->r2) / 2;
|
||||
sp40.vy = -LOH(prim->next->b2) / 2;
|
||||
sp40.vz = 0;
|
||||
sp48.vx = -LOH(prim->next->r2) / 2;
|
||||
sp48.vy = LOH(prim->next->b2) / 2;
|
||||
sp48.vz = 0;
|
||||
sp50.vx = LOH(prim->next->r2) / 2;
|
||||
sp50.vy = LOH(prim->next->b2) / 2;
|
||||
sp50.vz = 0;
|
||||
gte_ldv0(&sp38);
|
||||
gte_rtps();
|
||||
gte_stsxy(&prim->x0);
|
||||
gte_ldv0(&sp40);
|
||||
gte_rtps();
|
||||
gte_stsxy(&prim->x1);
|
||||
gte_ldv0(&sp48);
|
||||
gte_rtps();
|
||||
gte_stsxy(&prim->x2);
|
||||
gte_ldv0(&sp50);
|
||||
gte_rtps();
|
||||
gte_stsxy(&prim->x3);
|
||||
}
|
||||
|
||||
s32 UpdateAnimation(u8* texAnimations, Primitive* prim) {
|
||||
s16 sp0;
|
||||
s16 tempUv;
|
||||
u8 new_var;
|
||||
u8* nextAnimation = texAnimations + ((prim->p1 * 5) & 0xFF);
|
||||
u8 new_var2;
|
||||
s32 retVal = 0;
|
||||
|
||||
if (prim->p2 == 0) {
|
||||
if (*nextAnimation) {
|
||||
if (*nextAnimation == 0xFF) {
|
||||
return 0;
|
||||
}
|
||||
retVal = 0x80;
|
||||
prim->p2 = nextAnimation[0];
|
||||
++nextAnimation;
|
||||
tempUv = nextAnimation[0] + (nextAnimation[1] << 8);
|
||||
nextAnimation += 2;
|
||||
sp0 = nextAnimation[0] + (nextAnimation[1] << 8);
|
||||
LOH(prim->u0) = tempUv;
|
||||
LOH(prim->u1) = tempUv + *((u8*)(&sp0));
|
||||
new_var = *((u8*)&sp0 + 1);
|
||||
LOH(prim->u3) = tempUv + sp0;
|
||||
LOH(prim->u2) = tempUv + (new_var << 8);
|
||||
++prim->p1;
|
||||
} else {
|
||||
prim->p1 = 0;
|
||||
prim->p2 = 0;
|
||||
prim->p2 = texAnimations[0];
|
||||
tempUv = texAnimations[1] + (texAnimations[2] << 8);
|
||||
sp0 = texAnimations[3] + (texAnimations[4] << 8);
|
||||
LOH(prim->u0) = tempUv;
|
||||
LOH(prim->u1) = tempUv + (*(u8*)&sp0);
|
||||
new_var2 = *((u8*)&sp0 + 1);
|
||||
LOH(prim->u3) = tempUv + sp0;
|
||||
LOH(prim->u2) = tempUv + (new_var2 << 8);
|
||||
++prim->p1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
retVal |= 1;
|
||||
--prim->p2;
|
||||
return (retVal | 1) & 0xFF;
|
||||
}
|
||||
|
||||
Primitive* FindFirstUnkPrim(Primitive* poly) {
|
||||
while (poly != NULL) {
|
||||
if (poly->p3 != 0) {
|
||||
poly = poly->next;
|
||||
} else {
|
||||
return poly;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Similar to FindFirstUnkPrim, but returns the first prim with
|
||||
// p3 == 0 if there is a prim with p3 == 0 at index positions after
|
||||
Primitive* FindFirstUnkPrim2(Primitive* prim, u8 index) {
|
||||
|
||||
Primitive* ret;
|
||||
int i;
|
||||
|
||||
for (; prim; prim = prim->next) {
|
||||
if (!prim->p3) {
|
||||
ret = prim;
|
||||
for (i = 1; i < index; ++i) {
|
||||
prim = prim->next;
|
||||
if (!prim) {
|
||||
return NULL;
|
||||
}
|
||||
if (prim->p3) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == index) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Primitive* PrimToggleVisibility(Primitive* firstPrim, s32 count) {
|
||||
Primitive* prim;
|
||||
s8 isVisible;
|
||||
s32 i;
|
||||
|
||||
if (firstPrim->p3) {
|
||||
firstPrim->p3 = 0;
|
||||
} else {
|
||||
firstPrim->p3 = 1;
|
||||
}
|
||||
|
||||
prim = firstPrim;
|
||||
for (i = 0; i < count; i++) {
|
||||
if (prim->p3) {
|
||||
prim->blendMode &= ~BLEND_VISIBLE;
|
||||
isVisible = false;
|
||||
} else {
|
||||
prim->blendMode |= BLEND_VISIBLE;
|
||||
isVisible = true;
|
||||
}
|
||||
|
||||
prim = prim->next;
|
||||
if (prim == NULL)
|
||||
return 0;
|
||||
prim->p3 = isVisible;
|
||||
}
|
||||
|
||||
return prim;
|
||||
}
|
||||
|
||||
void PrimResetNext(Primitive* prim) {
|
||||
prim->p1 = 0;
|
||||
prim->p2 = 0;
|
||||
prim->p3 = 0;
|
||||
prim->next->x1 = 0;
|
||||
prim->next->y1 = 0;
|
||||
prim->next->y0 = 0;
|
||||
prim->next->x0 = 0;
|
||||
prim->next->clut = 0;
|
||||
LOHU(prim->next->u0) = 0;
|
||||
LOHU(prim->next->b1) = 0;
|
||||
LOHU(prim->next->r1) = 0;
|
||||
LOHU(prim->next->u1) = 0;
|
||||
prim->next->tpage = 0;
|
||||
LOHU(prim->next->r2) = 0;
|
||||
LOHU(prim->next->b2) = 0;
|
||||
prim->next->u2 = 0;
|
||||
prim->next->v2 = 0;
|
||||
prim->next->r3 = 0;
|
||||
prim->next->b3 = 0;
|
||||
prim->next->x2 = 0;
|
||||
prim->next->y2 = 0;
|
||||
}
|
||||
|
||||
void UnkPolyFunc2(Primitive* prim) {
|
||||
PrimResetNext(prim);
|
||||
prim->p3 = 8;
|
||||
prim->next->p3 = 1;
|
||||
prim->next->type = PRIM_LINE_G2;
|
||||
prim->next->blendMode = 0xA;
|
||||
}
|
||||
|
||||
void UnkPolyFunc0(Primitive* prim) {
|
||||
prim->p3 = 0;
|
||||
prim->blendMode = BLEND_VISIBLE;
|
||||
prim->next->p3 = 0;
|
||||
prim->next->type = PRIM_GT4;
|
||||
prim->next->blendMode = BLEND_VISIBLE;
|
||||
}
|
||||
|
||||
#if !defined(VERSION_BETA)
|
||||
s32 UnkLoopFunc(s32 arg0, u8 arg1) {
|
||||
s32 var_v0;
|
||||
s32 ret = 0;
|
||||
s32 j = arg0 + 4;
|
||||
u8* var_v1;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 4; i++, j += 12) {
|
||||
var_v1 = (u8*)j;
|
||||
do {
|
||||
var_v0 = *var_v1 - arg1;
|
||||
|
||||
if (var_v0 < 0) {
|
||||
var_v0 = 0;
|
||||
} else {
|
||||
ret |= 1;
|
||||
}
|
||||
|
||||
*var_v1 = var_v0;
|
||||
var_v1++;
|
||||
} while ((s32)var_v1 < (s32)j + 3);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
s32 UnkLoopFunc(Unkstruct_80128BBC* arg0, u8 value) {
|
||||
u8 ret = 0;
|
||||
s32 i;
|
||||
s32 j;
|
||||
Unkstruct_80128BBC_Sub* temp = arg0->unk04;
|
||||
|
||||
for (i = 0; i < 4; i++, temp++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
temp->unk00[j] -= value;
|
||||
|
||||
if (temp->unk00[j] > 248) {
|
||||
temp->unk00[j] = 0;
|
||||
} else {
|
||||
ret |= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif
|
@ -111,47 +111,3 @@ void func_80194DD4(Entity* entity) {
|
||||
}
|
||||
|
||||
INCLUDE_ASM("st/rwrp/nonmatchings/14590", BottomCornerText);
|
||||
|
||||
#include "../unk_prim_helper.h"
|
||||
|
||||
#include "../update_animation.h"
|
||||
|
||||
#include "../find_first_unk_prim.h"
|
||||
|
||||
INCLUDE_ASM("st/rwrp/nonmatchings/14590", func_801957D4);
|
||||
|
||||
void func_8019585C(Primitive* prim) {
|
||||
prim->p1 = 0;
|
||||
prim->p2 = 0;
|
||||
prim->p3 = 0;
|
||||
prim->next->x1 = 0;
|
||||
prim->next->y1 = 0;
|
||||
prim->next->y0 = 0;
|
||||
prim->next->x0 = 0;
|
||||
prim->next->clut = 0;
|
||||
*(u16*)&prim->next->u0 = 0;
|
||||
*(u16*)&prim->next->b1 = 0;
|
||||
*(u16*)&prim->next->r1 = 0;
|
||||
*(u16*)&prim->next->u1 = 0;
|
||||
prim->next->tpage = 0;
|
||||
*(u16*)&prim->next->r2 = 0;
|
||||
*(u16*)&prim->next->b2 = 0;
|
||||
prim->next->u2 = 0;
|
||||
prim->next->v2 = 0;
|
||||
prim->next->r3 = 0;
|
||||
prim->next->b3 = 0;
|
||||
prim->next->x2 = 0;
|
||||
prim->next->y2 = 0;
|
||||
}
|
||||
|
||||
void func_8019593C(Primitive* prim) {
|
||||
func_8019585C(prim);
|
||||
prim->p3 = 8;
|
||||
prim->next->p3 = 1;
|
||||
prim->next->type = 2;
|
||||
prim->next->blendMode = 0xA;
|
||||
}
|
||||
|
||||
#include "../unk_poly_func_0.h"
|
||||
|
||||
#include "../unk_loop_func.h"
|
||||
|
@ -512,7 +512,7 @@ INCLUDE_ASM("st/rwrp/nonmatchings/A59C", EntityPrizeDrop);
|
||||
|
||||
INCLUDE_ASM("st/rwrp/nonmatchings/A59C", EntityExplosion);
|
||||
|
||||
INCLUDE_ASM("st/rwrp/nonmatchings/A59C", BlinkItem);
|
||||
#include "../blink_item.h"
|
||||
|
||||
INCLUDE_ASM("st/rwrp/nonmatchings/A59C", EntityEquipItemDrop);
|
||||
|
||||
|
2
src/st/rwrp/prim_helpers.c
Normal file
2
src/st/rwrp/prim_helpers.c
Normal file
@ -0,0 +1,2 @@
|
||||
#include <game.h>
|
||||
#include "../prim_helpers.h"
|
@ -488,20 +488,20 @@ s32 func_801ACDFC(void) {
|
||||
}
|
||||
|
||||
s32 func_801ACEC0(void) {
|
||||
POLY_GT4* poly = &g_PrimBuf[D_801BAFC4];
|
||||
s32 var_s0 = poly->r0;
|
||||
Primitive* prim = &g_PrimBuf[D_801BAFC4];
|
||||
s32 var_s0 = prim->r0;
|
||||
|
||||
var_s0 += 0x10;
|
||||
poly->pad3 = 0x51;
|
||||
prim->blendMode = 0x51;
|
||||
|
||||
if (var_s0 > 255) {
|
||||
var_s0 = 255;
|
||||
}
|
||||
|
||||
func_801B1CFC(poly, var_s0);
|
||||
poly = (POLY_GT4*)poly->tag;
|
||||
poly->pad3 = 0x51;
|
||||
func_801B1CFC(poly, var_s0);
|
||||
func_801B1CFC(prim, var_s0);
|
||||
prim = prim->next;
|
||||
prim->blendMode = 0x51;
|
||||
func_801B1CFC(prim, var_s0);
|
||||
|
||||
if (g_api.func_80131F68()) {
|
||||
return 0;
|
||||
|
@ -199,7 +199,7 @@ void func_801A8328(Entity* self) {
|
||||
self->primIndex = firstPrimIndex;
|
||||
LOW(self->ext.generic.unk7C.s) = prim;
|
||||
self->flags |= FLAG_HAS_PRIMS;
|
||||
func_801BD80C(prim, firstPrimIndex);
|
||||
UnkPolyFunc2(prim);
|
||||
prim->tpage = 0x16;
|
||||
prim->clut = 0x216;
|
||||
prim->u0 = prim->u2 = 0x98;
|
||||
|
@ -1053,79 +1053,3 @@ void EntityCutscenePhotographFire(Entity* entity) {
|
||||
}
|
||||
|
||||
INCLUDE_ASM("st/st0/nonmatchings/36358", func_801BC5C0);
|
||||
|
||||
#include "../unk_prim_helper.h"
|
||||
|
||||
#include "../update_animation.h"
|
||||
|
||||
#include "../find_first_unk_prim.h"
|
||||
|
||||
POLY_GT4* func_801BD6A4(POLY_GT4* startPoly, s32 count) {
|
||||
POLY_GT4* poly;
|
||||
s8 unk;
|
||||
s32 i;
|
||||
|
||||
if (startPoly->p3) {
|
||||
startPoly->p3 = 0;
|
||||
} else {
|
||||
startPoly->p3 = 1;
|
||||
}
|
||||
|
||||
poly = startPoly;
|
||||
for (i = 0; i < count; i++) {
|
||||
if (poly->p3) {
|
||||
poly->pad3 &= ~8;
|
||||
unk = 0;
|
||||
} else {
|
||||
poly->pad3 |= 8;
|
||||
unk = 1;
|
||||
}
|
||||
|
||||
poly = (POLY_GT4*)poly->tag;
|
||||
if (poly == 0)
|
||||
return 0;
|
||||
poly->p3 = unk;
|
||||
}
|
||||
|
||||
return poly;
|
||||
}
|
||||
|
||||
void func_801BD72C(POLY_GT4* arg0) {
|
||||
arg0->p1 = 0;
|
||||
arg0->p2 = 0;
|
||||
arg0->p3 = 0;
|
||||
((POLY_GT4*)arg0->tag)->x1 = 0;
|
||||
((POLY_GT4*)arg0->tag)->y1 = 0;
|
||||
((POLY_GT4*)arg0->tag)->y0 = 0;
|
||||
((POLY_GT4*)arg0->tag)->x0 = 0;
|
||||
((POLY_GT4*)arg0->tag)->clut = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->u0 = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->b1 = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->r1 = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->u1 = 0;
|
||||
((POLY_GT4*)arg0->tag)->tpage = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->r2 = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->b2 = 0;
|
||||
((POLY_GT4*)arg0->tag)->u2 = 0;
|
||||
((POLY_GT4*)arg0->tag)->v2 = 0;
|
||||
((POLY_GT4*)arg0->tag)->r3 = 0;
|
||||
((POLY_GT4*)arg0->tag)->b3 = 0;
|
||||
((POLY_GT4*)arg0->tag)->x2 = 0;
|
||||
((POLY_GT4*)arg0->tag)->y2 = 0;
|
||||
}
|
||||
|
||||
void func_801BD80C(POLY_GT4* arg0) {
|
||||
func_801BD72C(arg0);
|
||||
arg0->p3 = 8;
|
||||
((POLY_GT4*)arg0->tag)->p3 = 1;
|
||||
((POLY_GT4*)arg0->tag)->code = 2;
|
||||
((POLY_GT4*)arg0->tag)->pad3 = 0xA;
|
||||
}
|
||||
|
||||
#include "../unk_poly_func_0.h"
|
||||
|
||||
#include "../unk_loop_func.h"
|
||||
|
||||
INCLUDE_ASM("st/st0/nonmatchings/36358", func_801BD8F0);
|
||||
|
||||
INCLUDE_ASM("st/st0/nonmatchings/36358", EntityBackgroundVortex);
|
||||
|
5
src/st/st0/3D8F0.c
Normal file
5
src/st/st0/3D8F0.c
Normal file
@ -0,0 +1,5 @@
|
||||
#include "st0.h"
|
||||
|
||||
INCLUDE_ASM("st/st0/nonmatchings/3D8F0", func_801BD8F0);
|
||||
|
||||
INCLUDE_ASM("st/st0/nonmatchings/3D8F0", EntityBackgroundVortex);
|
2
src/st/st0/prim_helpers.c
Normal file
2
src/st/st0/prim_helpers.c
Normal file
@ -0,0 +1,2 @@
|
||||
#include <game.h>
|
||||
#include "../prim_helpers.h"
|
@ -1,25 +0,0 @@
|
||||
s32 UnkLoopFunc(s32 arg0, u8 arg1) {
|
||||
s32 var_v0;
|
||||
s32 ret = 0;
|
||||
s32 j = arg0 + 4;
|
||||
u8* var_v1;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 4; i++, j += 12) {
|
||||
var_v1 = (u8*)j;
|
||||
do {
|
||||
var_v0 = *var_v1 - arg1;
|
||||
|
||||
if (var_v0 < 0) {
|
||||
var_v0 = 0;
|
||||
} else {
|
||||
ret |= 1;
|
||||
}
|
||||
|
||||
*var_v1 = var_v0;
|
||||
var_v1++;
|
||||
} while ((s32)var_v1 < (s32)j + 3);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
void UnkPolyFunc0(POLY_GT4* poly) {
|
||||
poly->p3 = 0;
|
||||
poly->pad3 = 8;
|
||||
((POLY_GT4*)poly->tag)->p3 = 0;
|
||||
((POLY_GT4*)poly->tag)->code = 4;
|
||||
((POLY_GT4*)poly->tag)->pad3 = 8;
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
#include "game.h"
|
||||
|
||||
extern SVECTOR g_UnkPrimHelperRot;
|
||||
void UnkPrimHelper(Primitive* prim) {
|
||||
SVECTOR sp10; // FAKE, not really an svector
|
||||
SVECTOR stackpad;
|
||||
SVECTOR sp20;
|
||||
VECTOR trans1;
|
||||
SVECTOR sp38;
|
||||
SVECTOR sp40;
|
||||
SVECTOR sp48;
|
||||
SVECTOR sp50;
|
||||
MATRIX m;
|
||||
SVECTOR rot;
|
||||
u8 temp_v1_2;
|
||||
|
||||
rot = g_UnkPrimHelperRot;
|
||||
if (prim->p3 & 8) {
|
||||
// Fake logic here, sp10 is not an SVECTOR but it matches.
|
||||
// tried using an f32 but couldn't get it to work.
|
||||
sp10.vy = prim->next->x1;
|
||||
sp10.vx = prim->next->y1;
|
||||
LOW(sp10.vx) += LOW(prim->next->u0);
|
||||
prim->next->x1 = sp10.vy;
|
||||
prim->next->y1 = sp10.vx;
|
||||
LOW(prim->next->x0) += LOW(prim->next->r1);
|
||||
}
|
||||
temp_v1_2 = prim->next->b3;
|
||||
LOH(prim->r0) = LOH(prim->r1) = LOH(prim->r2) = LOH(prim->r3) =
|
||||
temp_v1_2 | (temp_v1_2 << 8);
|
||||
prim->b0 = prim->b1 = prim->b2 = prim->b3 = temp_v1_2;
|
||||
trans1.vx = 0;
|
||||
trans1.vy = 0;
|
||||
trans1.vz = 0x400 - LOH(prim->next->u1);
|
||||
RotMatrix(&rot, &m);
|
||||
if (prim->p3 & 0x20) {
|
||||
sp20.vx = prim->next->x3;
|
||||
sp20.vy = prim->next->y3;
|
||||
RotMatrixX(sp20.vx, &m);
|
||||
RotMatrixY(sp20.vy, &m);
|
||||
}
|
||||
sp20.vz = prim->next->tpage;
|
||||
RotMatrixZ(sp20.vz, &m);
|
||||
TransMatrix(&m, &trans1);
|
||||
if (prim->p3 & 0x10) {
|
||||
trans1.vx = prim->next->x2;
|
||||
trans1.vy = prim->next->y2;
|
||||
trans1.vz = 0x1000;
|
||||
ScaleMatrix(&m, &trans1);
|
||||
}
|
||||
SetRotMatrix(&m);
|
||||
SetTransMatrix(&m);
|
||||
SetGeomScreen(0x400);
|
||||
SetGeomOffset(prim->next->x1, prim->next->y0);
|
||||
sp38.vx = -LOH(prim->next->r2) / 2;
|
||||
sp38.vy = -LOH(prim->next->b2) / 2;
|
||||
sp38.vz = 0;
|
||||
sp40.vx = LOH(prim->next->r2) / 2;
|
||||
sp40.vy = -LOH(prim->next->b2) / 2;
|
||||
sp40.vz = 0;
|
||||
sp48.vx = -LOH(prim->next->r2) / 2;
|
||||
sp48.vy = LOH(prim->next->b2) / 2;
|
||||
sp48.vz = 0;
|
||||
sp50.vx = LOH(prim->next->r2) / 2;
|
||||
sp50.vy = LOH(prim->next->b2) / 2;
|
||||
sp50.vz = 0;
|
||||
gte_ldv0(&sp38);
|
||||
gte_rtps();
|
||||
gte_stsxy(&prim->x0);
|
||||
gte_ldv0(&sp40);
|
||||
gte_rtps();
|
||||
gte_stsxy(&prim->x1);
|
||||
gte_ldv0(&sp48);
|
||||
gte_rtps();
|
||||
gte_stsxy(&prim->x2);
|
||||
gte_ldv0(&sp50);
|
||||
gte_rtps();
|
||||
gte_stsxy(&prim->x3);
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
s32 UpdateAnimation(u8* texAnimations, Primitive* prim) {
|
||||
s16 sp0;
|
||||
s16 tempUv;
|
||||
u8 new_var;
|
||||
u8* nextAnimation = texAnimations + ((prim->p1 * 5) & 0xFF);
|
||||
u8 new_var2;
|
||||
s32 retVal = 0;
|
||||
|
||||
if (prim->p2 == 0) {
|
||||
if (*nextAnimation) {
|
||||
if (*nextAnimation == 0xFF) {
|
||||
return 0;
|
||||
}
|
||||
retVal = 0x80;
|
||||
prim->p2 = nextAnimation[0];
|
||||
++nextAnimation;
|
||||
tempUv = nextAnimation[0] + (nextAnimation[1] << 8);
|
||||
nextAnimation += 2;
|
||||
sp0 = nextAnimation[0] + (nextAnimation[1] << 8);
|
||||
LOH(prim->u0) = tempUv;
|
||||
LOH(prim->u1) = tempUv + *((u8*)(&sp0));
|
||||
new_var = *((u8*)&sp0 + 1);
|
||||
LOH(prim->u3) = tempUv + sp0;
|
||||
LOH(prim->u2) = tempUv + (new_var << 8);
|
||||
++prim->p1;
|
||||
} else {
|
||||
prim->p1 = 0;
|
||||
prim->p2 = 0;
|
||||
prim->p2 = texAnimations[0];
|
||||
tempUv = texAnimations[1] + (texAnimations[2] << 8);
|
||||
sp0 = texAnimations[3] + (texAnimations[4] << 8);
|
||||
LOH(prim->u0) = tempUv;
|
||||
LOH(prim->u1) = tempUv + (*(u8*)&sp0);
|
||||
new_var2 = *((u8*)&sp0 + 1);
|
||||
LOH(prim->u3) = tempUv + sp0;
|
||||
LOH(prim->u2) = tempUv + (new_var2 << 8);
|
||||
++prim->p1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
retVal |= 1;
|
||||
--prim->p2;
|
||||
return (retVal | 1) & 0xFF;
|
||||
}
|
@ -252,36 +252,7 @@ void EntityExplosion(Entity* entity) {
|
||||
}
|
||||
}
|
||||
|
||||
void BlinkItem(Entity* arg0, u16 renderFlags) {
|
||||
POLY_GT4* poly;
|
||||
s16 left, top, right, bottom;
|
||||
|
||||
poly = &g_PrimBuf[arg0->primIndex];
|
||||
|
||||
left = arg0->posX.i.hi - 7;
|
||||
right = arg0->posX.i.hi + 7;
|
||||
poly->x2 = left;
|
||||
poly->x0 = left;
|
||||
poly->x3 = right;
|
||||
poly->x1 = right;
|
||||
|
||||
top = arg0->posY.i.hi - 7;
|
||||
bottom = arg0->posY.i.hi + 7;
|
||||
poly->y1 = top;
|
||||
poly->y0 = top;
|
||||
poly->y3 = bottom;
|
||||
poly->y2 = bottom;
|
||||
|
||||
if (renderFlags & RENDERFLAGS_NOSHADOW) {
|
||||
poly->r0 = poly->r1 = poly->r2 = poly->r3 = poly->g0 = poly->g1 =
|
||||
poly->g2 = poly->g3 = poly->b0 = poly->b1 = poly->b2 = poly->b3 =
|
||||
255;
|
||||
} else {
|
||||
poly->r0 = poly->r1 = poly->r2 = poly->r3 = poly->g0 = poly->g1 =
|
||||
poly->g2 = poly->g3 = poly->b0 = poly->b1 = poly->b2 = poly->b3 =
|
||||
128;
|
||||
}
|
||||
}
|
||||
#include "../blink_item.h"
|
||||
|
||||
void EntityEquipItemDrop(Entity* self) {
|
||||
u16 itemId = self->params & 0x7FFF;
|
||||
|
@ -1007,75 +1007,3 @@ void BottomCornerText(u8* str, u8 lower_left) {
|
||||
#undef xpos
|
||||
g_BottomCornerTextTimer = 0x130;
|
||||
}
|
||||
|
||||
#include "../unk_prim_helper.h"
|
||||
|
||||
#include "../update_animation.h"
|
||||
|
||||
#include "../find_first_unk_prim.h"
|
||||
|
||||
POLY_GT4* func_80193854(POLY_GT4* startPoly, s32 count) {
|
||||
POLY_GT4* poly;
|
||||
s8 unk;
|
||||
s32 i;
|
||||
|
||||
if (startPoly->p3) {
|
||||
startPoly->p3 = 0;
|
||||
} else {
|
||||
startPoly->p3 = 1;
|
||||
}
|
||||
|
||||
poly = startPoly;
|
||||
for (i = 0; i < count; i++) {
|
||||
if (poly->p3) {
|
||||
poly->pad3 &= ~8;
|
||||
unk = 0;
|
||||
} else {
|
||||
poly->pad3 |= 8;
|
||||
unk = 1;
|
||||
}
|
||||
|
||||
poly = (POLY_GT4*)poly->tag;
|
||||
if (poly == 0)
|
||||
return 0;
|
||||
poly->p3 = unk;
|
||||
}
|
||||
|
||||
return poly;
|
||||
}
|
||||
|
||||
void func_801938DC(POLY_GT4* arg0) {
|
||||
arg0->p1 = 0;
|
||||
arg0->p2 = 0;
|
||||
arg0->p3 = 0;
|
||||
((POLY_GT4*)arg0->tag)->x1 = 0;
|
||||
((POLY_GT4*)arg0->tag)->y1 = 0;
|
||||
((POLY_GT4*)arg0->tag)->y0 = 0;
|
||||
((POLY_GT4*)arg0->tag)->x0 = 0;
|
||||
((POLY_GT4*)arg0->tag)->clut = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->u0 = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->b1 = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->r1 = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->u1 = 0;
|
||||
((POLY_GT4*)arg0->tag)->tpage = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->r2 = 0;
|
||||
*(u16*)&((POLY_GT4*)arg0->tag)->b2 = 0;
|
||||
((POLY_GT4*)arg0->tag)->u2 = 0;
|
||||
((POLY_GT4*)arg0->tag)->v2 = 0;
|
||||
((POLY_GT4*)arg0->tag)->r3 = 0;
|
||||
((POLY_GT4*)arg0->tag)->b3 = 0;
|
||||
((POLY_GT4*)arg0->tag)->x2 = 0;
|
||||
((POLY_GT4*)arg0->tag)->y2 = 0;
|
||||
}
|
||||
|
||||
void func_801939BC(POLY_GT4* poly) {
|
||||
func_801938DC(poly);
|
||||
poly->p3 = 8;
|
||||
((POLY_GT4*)poly->tag)->p3 = 1;
|
||||
((POLY_GT4*)poly->tag)->code = 2;
|
||||
((POLY_GT4*)poly->tag)->pad3 = 0xA;
|
||||
}
|
||||
|
||||
#include "../unk_poly_func_0.h"
|
||||
|
||||
#include "../unk_loop_func.h"
|
||||
|
2
src/st/wrp/prim_helpers.c
Normal file
2
src/st/wrp/prim_helpers.c
Normal file
@ -0,0 +1,2 @@
|
||||
#include <game.h>
|
||||
#include "../prim_helpers.h"
|
Loading…
Reference in New Issue
Block a user