Impl Hedgehog and Flagpole

This commit is contained in:
MegaMech
2024-12-29 16:52:26 -07:00
parent 9c4b35206a
commit e4737ce2f5
20 changed files with 496 additions and 372 deletions
-207
View File
@@ -4353,213 +4353,6 @@ void func_8008153C(s32 objectIndex) {
}
}
#ifdef NON_MATCHING
// https://decomp.me/scratch/PYAg4
// Stack issue caused by the `test` variable, but removing it causes much, much larger differences
//! @todo Fix flag animations
void func_80082F1C(s32 objectIndex, s32 arg1) {
YVFlagPoleSpawn* test;
gObjectList[objectIndex].model = (Gfx*) d_course_yoshi_valley_unk5;
gObjectList[objectIndex].vertex = (Vtx*) d_course_yoshi_valley_unk4;
gObjectList[objectIndex].sizeScaling = 0.027f;
// if (test->rot && test->rot) {}
test = &D_800E5DF4[arg1];
object_next_state(objectIndex);
set_obj_origin_pos(objectIndex, test->pos[0] * xOrientation, test->pos[1], test->pos[2]);
set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f);
set_obj_direction_angle(objectIndex, 0U, test->rot, 0U);
}
#else
GLOBAL_ASM("asm/non_matchings/update_objects/func_80082F1C.s")
#endif
void func_80083018(s32 objectIndex, s32 arg1) {
switch (gObjectList[objectIndex].state) {
case 1:
func_80082F1C(objectIndex, arg1);
break;
case 0:
default:
break;
}
}
void func_80083060(s32 objectIndex) {
object_calculate_new_pos_offset(objectIndex);
}
void func_80083080(void) {
s32 objectIndex;
s32 var_s1;
for (var_s1 = 0; var_s1 < NUM_YV_FLAG_POLES; var_s1++) {
objectIndex = indexObjectList1[var_s1];
if (gObjectList[objectIndex].state != 0) {
func_80083018(objectIndex, var_s1);
func_80083060(objectIndex);
}
}
}
const char* sHedgehogTexList[] = { d_course_yoshi_valley_hedgehog };
void func_8008311C(s32 objectIndex, s32 arg1) {
Object* object;
Vtx* vtx = (Vtx*) LOAD_ASSET(common_vtx_hedgehog);
init_texture_object(objectIndex, d_course_yoshi_valley_hedgehog_tlut, sHedgehogTexList, 0x40U, (u16) 0x00000040);
object = &gObjectList[objectIndex];
object->activeTLUT = d_course_yoshi_valley_hedgehog_tlut;
object->activeTexture = d_course_yoshi_valley_hedgehog;
object->vertex = vtx;
object->sizeScaling = 0.2f;
object->textureListIndex = 0;
object_next_state(objectIndex);
set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f);
set_obj_orientation(objectIndex, 0U, 0U, 0x8000U);
object->unk_034 = ((arg1 % 6) * 0.1) + 0.5;
func_80086E70(objectIndex);
set_object_flag(objectIndex, 0x04000600);
object->boundingBoxSize = 2;
}
void func_80083248(s32 objectIndex) {
switch (gObjectList[objectIndex].unk_0AE) {
case 0:
break;
case 1:
if (func_80087A0C(objectIndex, gObjectList[objectIndex].origin_pos[0], gObjectList[objectIndex].unk_09C,
gObjectList[objectIndex].origin_pos[2], gObjectList[objectIndex].unk_09E) != 0) {
func_80086FD4(objectIndex);
}
break;
case 2:
func_800871AC(objectIndex, 0x0000003C);
break;
case 3:
if (func_80087A0C(objectIndex, gObjectList[objectIndex].unk_09C, gObjectList[objectIndex].origin_pos[0],
gObjectList[objectIndex].unk_09E, gObjectList[objectIndex].origin_pos[2]) != 0) {
func_80086FD4(objectIndex);
}
break;
case 4:
if (func_80087060(objectIndex, 0x0000003C) != 0) {
func_8008701C(objectIndex, 1);
}
break;
}
object_calculate_new_pos_offset(objectIndex);
if (is_obj_flag_status_active(objectIndex, 0x00200000) != 0) {
if (is_obj_flag_status_active(objectIndex, 0x00400000) != 0) {
func_8008861C(objectIndex);
}
gObjectList[objectIndex].pos[1] = gObjectList[objectIndex].surfaceHeight + 6.0;
}
}
void func_800833D0(s32 objectIndex, s32 arg1) {
switch (gObjectList[objectIndex].state) { /* irregular */
case 0:
break;
case 1:
func_8008311C(objectIndex, arg1);
break;
case 2:
func_80072D3C(objectIndex, 0, 1, 4, -1);
break;
}
if (gObjectList[objectIndex].textureListIndex == 0) {
Vtx* vtx = (Vtx*) LOAD_ASSET(common_vtx_hedgehog);
gObjectList[objectIndex].vertex = vtx;
} else {
Vtx* vtx = (Vtx*) LOAD_ASSET(D_0D006130);
gObjectList[objectIndex].vertex = vtx;
}
}
void func_80083474(s32 objectIndex) {
if (gObjectList[objectIndex].state >= 2) {
func_80089F24(objectIndex);
}
}
void update_hedgehogs(void) {
s32 temp_s1;
s32 var_s0;
for (var_s0 = 0; var_s0 < NUM_HEDGEHOGS; var_s0++) {
temp_s1 = indexObjectList2[var_s0];
func_800833D0(temp_s1, var_s0);
func_80083248(temp_s1);
func_80083474(temp_s1);
}
func_80072120(indexObjectList2, 0x0000000F);
}
void func_80083538(s32 objectIndex, Vec3f arg1, s32 arg2, s32 arg3) {
Object* object;
init_object(objectIndex, 0);
object = &gObjectList[objectIndex];
object->activeTexture = d_course_frappe_snowland_snow;
object->textureList = d_course_frappe_snowland_snow;
object->activeTLUT = d_course_frappe_snowland_snow_tlut;
object->tlutList = d_course_frappe_snowland_snow_tlut;
object->sizeScaling = random_int(0x0064U);
object->sizeScaling = (object->sizeScaling * 0.001) + 0.05;
object->velocity[1] = random_int(0x0014U);
object->velocity[1] = (object->velocity[1] * 0.5) + 2.6;
object->unk_034 = random_int(0x000AU);
object->unk_034 = (object->unk_034 * 0.1) + 4.5;
object->direction_angle[1] = (arg2 << 0x10) / arg3;
object->origin_pos[0] = arg1[0];
object->origin_pos[1] = arg1[1];
object->origin_pos[2] = arg1[2];
object->primAlpha = random_int(0x4000U) + 0x1000;
}
void func_8008379C(s32 objectIndex) {
switch (gObjectList[objectIndex].state) {
case 0:
break;
case 1:
if (func_80087E08(objectIndex, gObjectList[objectIndex].velocity[1], 0.74f,
gObjectList[objectIndex].unk_034, gObjectList[objectIndex].direction_angle[1],
0x00000064) != 0) {
object_next_state(objectIndex);
}
break;
case 2:
func_80086F60(objectIndex);
func_80072428(objectIndex);
break;
}
object_calculate_new_pos_offset(objectIndex);
gObjectList[objectIndex].orientation[2] += gObjectList[objectIndex].primAlpha;
}
static const char* sSnowmanHeadList[] = { d_course_frappe_snowland_snowman_head };
void func_80083868(s32 objectIndex) {
Object* object;
Vtx* vtx = (Vtx*) LOAD_ASSET(D_0D0061B0);
init_texture_object(objectIndex, d_course_frappe_snowland_snowman_tlut, sSnowmanHeadList, 0x40U, (u16) 0x00000040);
object = &gObjectList[objectIndex];
object->vertex = vtx;
object->sizeScaling = 0.1f;
object->textureListIndex = 0;
object_next_state(objectIndex);
set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f);
object->orientation[0] = 0;
object->orientation[1] = 0;
object->orientation[2] = 0x8000;
object->primAlpha = random_int(0x2000U) - 0x1000;
func_80086E70(objectIndex);
object->unk_034 = 1.5f;
set_object_flag(objectIndex, 0x00000200);
}
void func_80083F18(s32 objectIndex) {
switch (gObjectList[objectIndex].state) {
case 0: