diff --git a/asm/non_matchings/update_objects/func_80082F1C.s b/asm/non_matchings/update_objects/func_80082F1C.s index c1ca1f90e..bc5df84bf 100644 --- a/asm/non_matchings/update_objects/func_80082F1C.s +++ b/asm/non_matchings/update_objects/func_80082F1C.s @@ -25,7 +25,7 @@ glabel func_80082F1C /* 083B5C 80082F5C AFB00018 */ sw $s0, 0x18($sp) /* 083B60 80082F60 00808025 */ move $s0, $a0 /* 083B64 80082F64 AFA5002C */ sw $a1, 0x2c($sp) -/* 083B68 80082F68 0C01C922 */ jal func_80072488 +/* 083B68 80082F68 0C01C922 */ jal object_next_state /* 083B6C 80082F6C E4440000 */ swc1 $f4, ($v0) /* 083B70 80082F70 8FA9002C */ lw $t1, 0x2c($sp) /* 083B74 80082F74 3C0B800E */ lui $t3, %hi(D_800E5DF4) # $t3, 0x800e diff --git a/include/objects.h b/include/objects.h index f0bffd20a..7e8320224 100644 --- a/include/objects.h +++ b/include/objects.h @@ -18,7 +18,7 @@ typedef struct { /* 0x44 */ f32 surfaceHeight; /* 0x48 */ s32 unk_048; /* 0x4C */ s32 unk_04C; - /* 0x50 */ s32 unk_050; + /* 0x50 */ s32 timer; /* 0x54 */ s32 status; /* 0x58 */ s32 unk_058; /* 0x5C */ s32 unk_05C; @@ -37,7 +37,7 @@ typedef struct { /* 0x7C */ SplineControlPoint* controlPoints; /* 0x80 */ SplineData* spline; /* 0x84 */ s16 unk_084[0xA]; - /* 0x98 */ u16 timer; + /* 0x98 */ u16 animationTimer; /* 0x9A */ u16 unk_09A; /* 0x9C */ s16 unk_09C; /* 0x9E */ s16 unk_09E; @@ -57,14 +57,14 @@ typedef struct { /* 0xC6 */ u16 unk_0C6; /* 0xC8 */ u16 boundingBoxSize; /* 0xCA */ s8 unk_0CA; - /* 0xCB */ s8 unk_0CB; + /* 0xCB */ bool8 isTimerActive; /* 0xCC */ s8 unk_0CC; /* 0xCD */ s8 unk_0CD; /* 0xCE */ s8 unk_0CE; /* 0xCF */ s8 unk_0CF; /* 0xD0 */ s8 unk_0D0; /* 0xD1 */ s8 unk_0D1; - /* 0xD2 */ s8 itemDisplay; + /* 0xD2 */ s8 textureListIndex; /* 0xD3 */ s8 unk_0D3; /* 0xD4 */ s8 unk_0D4; /* 0xD5 */ u8 unk_0D5; @@ -93,7 +93,7 @@ typedef struct { /* 0x44 */ f32 unk_044; /* 0x48 */ s32 unk_048; /* 0x4C */ s32 unk_04C; - /* 0x50 */ s32 unk_050; + /* 0x50 */ s32 timer; /* 0x54 */ s32 status; /* 0x58 */ s32 unk_058; /* 0x5C */ s32 unk_05C; @@ -132,14 +132,14 @@ typedef struct { /* 0xC6 */ u16 unk_0C6; /* 0xC8 */ u16 unk_0C8; /* 0xCA */ s8 unk_0CA; - /* 0xCB */ s8 unk_0CB; + /* 0xCB */ s8 isTimerActive; /* 0xCC */ s8 unk_0CC; /* 0xCD */ s8 unk_0CD; /* 0xCE */ s8 unk_0CE; /* 0xCF */ s8 unk_0CF; /* 0xD0 */ s8 unk_0D0; /* 0xD1 */ s8 unk_0D1; - /* 0xD2 */ s8 itemDisplay; + /* 0xD2 */ s8 textureListIndex; /* 0xD3 */ s8 unk_0D3; /* 0xD4 */ s8 unk_0D4; /* 0xD5 */ u8 unk_0D5; diff --git a/src/code_8006E9C0.c b/src/code_8006E9C0.c index 70662260a..c2c830217 100644 --- a/src/code_8006E9C0.c +++ b/src/code_8006E9C0.c @@ -136,7 +136,7 @@ void init_item_window(s32 objectIndex) { temp_v0 = (ItemWindowObjects*) &gObjectList[objectIndex]; temp_v0->currentItem = ITEM_NONE; - temp_v0->itemDisplay = temp_v0->currentItem; + temp_v0->textureListIndex = temp_v0->currentItem; temp_v0->tlutList = (u8*) common_tlut_item_window_none; temp_v0->activeTLUT = (u8*) common_tlut_item_window_none; temp_v0->textureList = common_texture_item_window_none; diff --git a/src/code_80086E70.c b/src/code_80086E70.c index 973c78e6b..4d831df64 100644 --- a/src/code_80086E70.c +++ b/src/code_80086E70.c @@ -1497,7 +1497,7 @@ void func_8008A9B8(s32 objectIndex) { object = &gObjectList[objectIndex]; object->controlPoints++; object->unk_09A = (s16) (10000 / (s16) (object->controlPoints[0].velocity)); - object->timer = 0; + object->animationTimer = 0; func_8008A920(objectIndex); } @@ -1506,7 +1506,7 @@ void func_8008AA3C(s32 objectIndex) { object = &gObjectList[objectIndex]; object->controlPoints = object->spline->controlPoints; object->unk_084[9] = 0; - object->timer = 0; + object->animationTimer = 0; /* This is INCREDIBLY stupid. This should really be temp_v0->unk_084[8] = temp_v0->spline->numControlPoints; @@ -1529,8 +1529,8 @@ void func_8008AB10(s32 objectIndex) { object->offset[0] += object->velocity[0]; object->offset[1] += object->velocity[1]; object->offset[2] += object->velocity[2]; - object->timer += (u16) object->unk_09A; - if (object->timer >= 0x2710) { + object->animationTimer += (u16) object->unk_09A; + if (object->animationTimer >= 0x2710) { object->unk_084[9] = (u16) object->unk_084[9] + 1; if (((u16) object->unk_084[9] + 1) == (u16) object->unk_084[8]) { object->unk_0AE += 1; @@ -1724,7 +1724,7 @@ void func_8008B3E4(s32 objectIndex) { if (is_obj_index_flag_status_inactive(objectIndex, 8) != 0) { object = &gObjectList[objectIndex]; object->unk_084[9] = 0; - object->timer = 0; + object->animationTimer = 0; object->controlPoints = object->spline->controlPoints; /* This is INCREDIBLY stupid. This should really be @@ -1738,7 +1738,7 @@ void func_8008B3E4(s32 objectIndex) { } void func_8008B44C(s32 objectIndex) { - gObjectList[objectIndex].timer = 0; + gObjectList[objectIndex].animationTimer = 0; gObjectList[objectIndex].controlPoints++; } @@ -1758,7 +1758,7 @@ void func_8008B478(s32 objectIndex, s32 arg1) { // I think the game treats each spline as being having a lenght of 10000 // This is getting the percent along the spline we want to reach, // which is then treated as the `t` value given to the curve calculations - sp34 = ((f32) gObjectList[objectIndex].timer / 10000.0); + sp34 = ((f32) gObjectList[objectIndex].animationTimer / 10000.0); // Calculate the curve at `t` func_8008B17C(objectIndex, sp34); if (is_obj_flag_status_active(objectIndex, 0x800) != 0) { @@ -1771,7 +1771,7 @@ void func_8008B478(s32 objectIndex, s32 arg1) { temp = gObjectList[objectIndex].controlPoints[1].velocity; gObjectList[objectIndex].unk_09A = 10000.0 / (((temp - var_f6) * sp34) + var_f6); - gObjectList[objectIndex].timer += gObjectList[objectIndex].unk_09A; + gObjectList[objectIndex].animationTimer += gObjectList[objectIndex].unk_09A; } void func_8008B620(s32 objectIndex) { @@ -1780,7 +1780,7 @@ void func_8008B620(s32 objectIndex) { func_8008B478(objectIndex, 0); object = &gObjectList[objectIndex]; - if (object->timer >= 0x2710) { + if (object->animationTimer >= 0x2710) { // Have to do it this way due to the u16 cast object->unk_084[9] = (u16) object->unk_084[9] + 1; if (((u16) object->unk_084[9] + 3) == (u16) object->unk_084[8]) { @@ -1796,7 +1796,7 @@ void func_8008B6A4(s32 objectIndex) { func_8008B478(objectIndex, 1); object = &gObjectList[objectIndex]; - if (object->timer >= 0x2710) { + if (object->animationTimer >= 0x2710) { // Have to do it this way due to the u16 cast object->unk_084[9] = (u16) object->unk_084[9] + 1; if ((u16) object->unk_084[9] == (u16) object->unk_084[8]) { diff --git a/src/render_objects.c b/src/render_objects.c index 047ac27f6..4a8769fa1 100644 --- a/src/render_objects.c +++ b/src/render_objects.c @@ -4215,7 +4215,7 @@ void func_800557B4(s32 objectIndex, u32 arg1, u32 arg2) { object->sizeScaling); gSPDisplayList(gDisplayListHead++, D_0D0077D0); render_animated_model((Armature*) object->model, (Animation**) object->vertex, - (s16) object->unk_0D8, (s16) object->itemDisplay); + (s16) object->unk_0D8, (s16) object->textureListIndex); } } else if (arg1 < 0x15F91U) { func_8004A7AC(objectIndex, 1.5f); @@ -4224,7 +4224,7 @@ void func_800557B4(s32 objectIndex, u32 arg1, u32 arg2) { rsp_set_matrix_transformation(object->pos, object->orientation, object->sizeScaling); gSPDisplayList(gDisplayListHead++, D_0D0077D0); render_animated_model((Armature*) object->model, (Animation**) object->vertex, (s16) object->unk_0D8, - (s16) object->itemDisplay); + (s16) object->textureListIndex); } } @@ -4293,7 +4293,7 @@ void func_80055AB8(s32 objectIndex, s32 cameraId) { gSPDisplayList(gDisplayListHead++, D_0D0077D0); render_animated_model((Armature*) gObjectList[objectIndex].model, (Animation**) gObjectList[objectIndex].vertex, 0, - (s16) gObjectList[objectIndex].itemDisplay); + (s16) gObjectList[objectIndex].textureListIndex); } } } diff --git a/src/update_objects.c b/src/update_objects.c index da9c7ae53..687d01e7d 100644 --- a/src/update_objects.c +++ b/src/update_objects.c @@ -267,8 +267,8 @@ bool func_80072354(s32 objectIndex, s32 arg1) { return b; } -void set_object_unk_0CB(s32 objectIndex, s32 arg1) { - gObjectList[objectIndex].unk_0CB = arg1; +void set_object_timer_state(s32 objectIndex, s32 arg1) { + gObjectList[objectIndex].isTimerActive = arg1; } void init_object(s32 objectIndex, s32 arg1) { @@ -277,27 +277,27 @@ void init_object(s32 objectIndex, s32 arg1) { gObjectList[objectIndex].unk_05C = 0; gObjectList[objectIndex].unk_0CD = 0; gObjectList[objectIndex].unk_0CF = 0; - set_object_unk_0CB(objectIndex, 0); + set_object_timer_state(objectIndex, 0); gObjectList[objectIndex].unk_0D8 = arg1; gObjectList[objectIndex].state = 1; } UNUSED void func_80072408(s32 objectIndex) { - set_object_unk_0CB(objectIndex, 0); + set_object_timer_state(objectIndex, 0); } void func_80072428(s32 objectIndex) { gObjectList[objectIndex].state = 0; gObjectList[objectIndex].unk_0D8 = 0; - set_object_unk_0CB(objectIndex, 0); + set_object_timer_state(objectIndex, 0); gObjectList[objectIndex].status = 0; gObjectList[objectIndex].unk_058 = 0; gObjectList[objectIndex].unk_05C = 0; func_80086F60(objectIndex); } -void func_80072488(s32 objectIndex) { - set_object_unk_0CB(objectIndex, 0); +void object_next_state(s32 objectIndex) { + set_object_timer_state(objectIndex, 0); set_object_flag_status_false(objectIndex, 0x2000); gObjectList[objectIndex].state++; } @@ -317,16 +317,16 @@ s16 func_80072530(s32 objectIndex) { } void func_80072568(s32 objectIndex, s32 arg1) { - set_object_unk_0CB(objectIndex, 0); + set_object_timer_state(objectIndex, 0); set_object_flag_status_false(objectIndex, 0x2000); set_object_flag_status_false(objectIndex, 8); - func_80072488(objectIndex); + object_next_state(objectIndex); func_800724F8(objectIndex, gObjectList[objectIndex].state); gObjectList[objectIndex].state = arg1; } void func_800725E8(s32 objectIndex, s32 arg1, s32 arg2) { - set_object_unk_0CB(objectIndex, 0); + set_object_timer_state(objectIndex, 0); set_object_flag_status_false(objectIndex, 0x2000); set_object_flag_status_false(objectIndex, 8); gObjectList[objectIndex].state = arg2; @@ -337,44 +337,47 @@ void func_800725E8(s32 objectIndex, s32 arg1, s32 arg2) { s16 func_80072530(s32); // extern void func_8007266C(s32 objectIndex) { - set_object_unk_0CB(objectIndex, 0); + set_object_timer_state(objectIndex, 0); set_object_flag_status_false(objectIndex, 0x2000); set_object_flag_status_false(objectIndex, 8); gObjectList[objectIndex].state = func_80072530(objectIndex); } void func_800726CC(s32 objectIndex, s32 arg1) { - set_object_unk_0CB(objectIndex, 0); + set_object_timer_state(objectIndex, 0); set_object_flag_status_false(objectIndex, 0x2000); gObjectList[objectIndex].state = arg1; } UNUSED void func_8007271C(s32 objectIndex, s32 arg1) { - if (gObjectList[objectIndex].unk_0CB == 0) { + if (gObjectList[objectIndex].isTimerActive == 0) { gObjectList[objectIndex].state = arg1; } } UNUSED void func_8007274C(s32 objectIndex) { - if (gObjectList[objectIndex].unk_0CB == 0) { - func_80072488(objectIndex); + if (gObjectList[objectIndex].isTimerActive == 0) { + object_next_state(objectIndex); } } -s32 func_8007278C(s32 objectIndex, s32 arg1) { - s32 phi_v1; +/** + * @brief will return true if the timer is done + */ +bool set_and_run_timer_object(s32 objectIndex, s32 timer) { + bool phi_v1; - phi_v1 = 0; - if (gObjectList[objectIndex].unk_0CB == 0) { - set_object_unk_0CB(objectIndex, 1); - gObjectList[objectIndex].unk_050 = arg1; + phi_v1 = false; + if (gObjectList[objectIndex].isTimerActive == false) { + set_object_timer_state(objectIndex, true); + gObjectList[objectIndex].timer = timer; } - gObjectList[objectIndex].unk_050--; - if (gObjectList[objectIndex].unk_050 < 0) { - set_object_unk_0CB(objectIndex, 0); - func_80072488(objectIndex); - phi_v1 = 1; + gObjectList[objectIndex].timer--; + if (gObjectList[objectIndex].timer < 0) { + set_object_timer_state(objectIndex, false); + object_next_state(objectIndex); + phi_v1 = true; } return phi_v1; @@ -384,15 +387,15 @@ UNUSED s32 func_8007281C(s32 objectIndex, s32 arg1) { s32 phi_a2; phi_a2 = 0; - if (gObjectList[objectIndex].unk_0CB == 0) { - set_object_unk_0CB(objectIndex, 1); - gObjectList[objectIndex].unk_050 = random_int((u16) arg1); + if (gObjectList[objectIndex].isTimerActive == 0) { + set_object_timer_state(objectIndex, 1); + gObjectList[objectIndex].timer = random_int((u16) arg1); } - gObjectList[objectIndex].unk_050--; - if (gObjectList[objectIndex].unk_050 < 0) { - set_object_unk_0CB(objectIndex, 0); - func_80072488(objectIndex); + gObjectList[objectIndex].timer--; + if (gObjectList[objectIndex].timer < 0) { + set_object_timer_state(objectIndex, 0); + object_next_state(objectIndex); phi_a2 = 1; } @@ -403,15 +406,15 @@ UNUSED s32 func_800728B0(s32 objectIndex, s32 arg1, s32 arg2) { s32 phi_a3; phi_a3 = 0; - if (gObjectList[objectIndex].unk_0CB == 0) { - set_object_unk_0CB(objectIndex, 1); - gObjectList[objectIndex].unk_050 = random_int((u16) arg2) + arg1; + if (gObjectList[objectIndex].isTimerActive == 0) { + set_object_timer_state(objectIndex, 1); + gObjectList[objectIndex].timer = random_int((u16) arg2) + arg1; } - gObjectList[objectIndex].unk_050--; - if (gObjectList[objectIndex].unk_050 < 0) { - set_object_unk_0CB(objectIndex, 0); - func_80072488(objectIndex); + gObjectList[objectIndex].timer--; + if (gObjectList[objectIndex].timer < 0) { + set_object_timer_state(objectIndex, 0); + object_next_state(objectIndex); phi_a3 = 1; } @@ -447,7 +450,7 @@ void func_800729EC(s32 objectIndex) { s32 i; start_race(); - func_80072488(objectIndex); + object_next_state(objectIndex); D_8018D2BC = 1; D_8018D2A4 = 1; @@ -460,25 +463,25 @@ void func_800729EC(s32 objectIndex) { } UNUSED void func_80072A78(s32 objectIndex, s32 arg1) { - gObjectList[objectIndex].itemDisplay = arg1; - func_80072488(objectIndex); + gObjectList[objectIndex].textureListIndex = arg1; + object_next_state(objectIndex); } s32 func_80072AAC(s32 objectIndex, s32 arg1, s32 arg2) { s32 phi_v1; phi_v1 = 0; - if (gObjectList[objectIndex].unk_0CB == 0) { + if (gObjectList[objectIndex].isTimerActive == 0) { - set_object_unk_0CB(objectIndex, 1); - gObjectList[objectIndex].itemDisplay = arg1; - gObjectList[objectIndex].unk_050 = arg2; + set_object_timer_state(objectIndex, 1); + gObjectList[objectIndex].textureListIndex = arg1; + gObjectList[objectIndex].timer = arg2; } - gObjectList[objectIndex].unk_050--; - if (gObjectList[objectIndex].unk_050 < 0) { - set_object_unk_0CB(objectIndex, 0); - func_80072488(objectIndex); + gObjectList[objectIndex].timer--; + if (gObjectList[objectIndex].timer < 0) { + set_object_timer_state(objectIndex, 0); + object_next_state(objectIndex); phi_v1 = 1; } @@ -489,18 +492,18 @@ s32 func_80072B48(s32 objectIndex, s32 arg1) { s32 phi_v1; phi_v1 = 0; - if (gObjectList[objectIndex].unk_0CB == 0) { - set_object_unk_0CB(objectIndex, 1); + if (gObjectList[objectIndex].isTimerActive == 0) { + set_object_timer_state(objectIndex, 1); set_object_flag_status_true(objectIndex, 0x80000); - gObjectList[objectIndex].itemDisplay = D_8018D140; - gObjectList[objectIndex].unk_050 = arg1; + gObjectList[objectIndex].textureListIndex = D_8018D140; + gObjectList[objectIndex].timer = arg1; } - gObjectList[objectIndex].unk_050--; - if (gObjectList[objectIndex].unk_050 < 0) { + gObjectList[objectIndex].timer--; + if (gObjectList[objectIndex].timer < 0) { set_object_flag_status_false(objectIndex, 0x80000); - set_object_unk_0CB(objectIndex, 0); - func_80072488(objectIndex); + set_object_timer_state(objectIndex, 0); + object_next_state(objectIndex); phi_v1 = 1; } @@ -509,15 +512,15 @@ s32 func_80072B48(s32 objectIndex, s32 arg1) { void func_80072C00(s32 objectIndex, s32 arg1, s32 arg2, s32 arg3) { if (is_obj_index_flag_status_inactive(objectIndex, 0x2000) != 0) { - gObjectList[objectIndex].unk_050 = arg2; - gObjectList[objectIndex].itemDisplay = arg1; + gObjectList[objectIndex].timer = arg2; + gObjectList[objectIndex].textureListIndex = arg1; gObjectList[objectIndex].unk_0D4 = 1; gObjectList[objectIndex].unk_0CC = arg3; set_object_flag_status_true(objectIndex, 0x2000); } else { - gObjectList[objectIndex].unk_050--; - if (gObjectList[objectIndex].unk_050 < 0) { - gObjectList[objectIndex].unk_050 = arg2; + gObjectList[objectIndex].timer--; + if (gObjectList[objectIndex].timer < 0) { + gObjectList[objectIndex].timer = arg2; gObjectList[objectIndex].unk_0D4--; if ((gObjectList[objectIndex].unk_0D4 & 1) != 0) { set_object_flag_status_false(objectIndex, 0x80000); @@ -534,7 +537,7 @@ void func_80072C00(s32 objectIndex, s32 arg1, s32 arg2, s32 arg3) { if (gObjectList[objectIndex].unk_0CC == 0) { set_object_flag_status_false(objectIndex, 0x2000); - func_80072488(objectIndex); + object_next_state(objectIndex); } } } @@ -543,22 +546,22 @@ void func_80072C00(s32 objectIndex, s32 arg1, s32 arg2, s32 arg3) { void func_80072D3C(s32 objectIndex, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { if (is_obj_index_flag_status_inactive(objectIndex, 0x2000) != 0) { - gObjectList[objectIndex].unk_050 = arg3; - gObjectList[objectIndex].itemDisplay = arg1; + gObjectList[objectIndex].timer = arg3; + gObjectList[objectIndex].textureListIndex = arg1; gObjectList[objectIndex].unk_0D4 = 1; gObjectList[objectIndex].unk_0CC = arg4; set_object_flag_status_true(objectIndex, 0x2000); return; } - gObjectList[objectIndex].unk_050--; - if (gObjectList[objectIndex].unk_050 < 0) { - gObjectList[objectIndex].unk_050 = arg3; + gObjectList[objectIndex].timer--; + if (gObjectList[objectIndex].timer < 0) { + gObjectList[objectIndex].timer = arg3; gObjectList[objectIndex].unk_0D4--; if ((gObjectList[objectIndex].unk_0D4 & 1) != 0) { - gObjectList[objectIndex].itemDisplay = arg1; + gObjectList[objectIndex].textureListIndex = arg1; } else { - gObjectList[objectIndex].itemDisplay = arg2; + gObjectList[objectIndex].textureListIndex = arg2; } if (gObjectList[objectIndex].unk_0D4 < 0) { @@ -569,7 +572,7 @@ void func_80072D3C(s32 objectIndex, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { if (gObjectList[objectIndex].unk_0CC == 0) { set_object_flag_status_false(objectIndex, 0x2000); - func_80072488(objectIndex); + object_next_state(objectIndex); } } } @@ -580,29 +583,29 @@ s32 func_80072E54(s32 objectIndex, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 a sp24 = 0; if (is_obj_index_flag_status_inactive(objectIndex, 0x2000) != 0) { - gObjectList[objectIndex].itemDisplay = arg1; - gObjectList[objectIndex].unk_050 = arg4; + gObjectList[objectIndex].textureListIndex = arg1; + gObjectList[objectIndex].timer = arg4; gObjectList[objectIndex].unk_0CC = arg5; - set_object_unk_0CB(objectIndex, 1); + set_object_timer_state(objectIndex, 1); set_object_flag_status_true(objectIndex, 0x2000); } else { - gObjectList[objectIndex].unk_050--; - if (gObjectList[objectIndex].unk_050 <= 0) { - gObjectList[objectIndex].unk_050 = arg4; - gObjectList[objectIndex].itemDisplay += arg3; - if (arg2 < gObjectList[objectIndex].itemDisplay) { + gObjectList[objectIndex].timer--; + if (gObjectList[objectIndex].timer <= 0) { + gObjectList[objectIndex].timer = arg4; + gObjectList[objectIndex].textureListIndex += arg3; + if (arg2 < gObjectList[objectIndex].textureListIndex) { if (gObjectList[objectIndex].unk_0CC > 0) { gObjectList[objectIndex].unk_0CC--; } if (gObjectList[objectIndex].unk_0CC == 0) { - gObjectList[objectIndex].itemDisplay = arg2; + gObjectList[objectIndex].textureListIndex = arg2; set_object_flag_status_false(objectIndex, 0x2000); - set_object_unk_0CB(objectIndex, 0); - func_80072488(objectIndex); + set_object_timer_state(objectIndex, 0); + object_next_state(objectIndex); sp24 = 1; } else { - gObjectList[objectIndex].itemDisplay = arg1; + gObjectList[objectIndex].textureListIndex = arg1; } } } @@ -615,28 +618,28 @@ bool func_80072F88(s32 objectIndex, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 sp24 = false; if (is_obj_index_flag_status_inactive(objectIndex, 0x2000) != 0) { - gObjectList[objectIndex].itemDisplay = arg1; - gObjectList[objectIndex].unk_050 = arg4; + gObjectList[objectIndex].textureListIndex = arg1; + gObjectList[objectIndex].timer = arg4; gObjectList[objectIndex].unk_0CC = arg5; - set_object_unk_0CB(objectIndex, 1); + set_object_timer_state(objectIndex, 1); set_object_flag_status_true(objectIndex, 0x2000); } else { - gObjectList[objectIndex].unk_050--; - if (gObjectList[objectIndex].unk_050 <= 0) { - gObjectList[objectIndex].unk_050 = arg4; - gObjectList[objectIndex].itemDisplay -= arg3; - if (gObjectList[objectIndex].itemDisplay < arg2) { + gObjectList[objectIndex].timer--; + if (gObjectList[objectIndex].timer <= 0) { + gObjectList[objectIndex].timer = arg4; + gObjectList[objectIndex].textureListIndex -= arg3; + if (gObjectList[objectIndex].textureListIndex < arg2) { if (gObjectList[objectIndex].unk_0CC > 0) { gObjectList[objectIndex].unk_0CC--; } if (gObjectList[objectIndex].unk_0CC == 0) { - gObjectList[objectIndex].itemDisplay = arg2; + gObjectList[objectIndex].textureListIndex = arg2; set_object_flag_status_false(objectIndex, 0x2000); - set_object_unk_0CB(objectIndex, 0); - func_80072488(objectIndex); + set_object_timer_state(objectIndex, 0); + object_next_state(objectIndex); sp24 = true; } else { - gObjectList[objectIndex].itemDisplay = arg1; + gObjectList[objectIndex].textureListIndex = arg1; } } } @@ -649,26 +652,26 @@ bool func_800730BC(s32 objectIndex, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 sp24 = false; if (is_obj_index_flag_status_inactive(objectIndex, 0x2000) != 0) { - gObjectList[objectIndex].itemDisplay = arg1; - gObjectList[objectIndex].unk_050 = arg4; + gObjectList[objectIndex].textureListIndex = arg1; + gObjectList[objectIndex].timer = arg4; gObjectList[objectIndex].unk_0CC = arg5; - set_object_unk_0CB(objectIndex, 1); + set_object_timer_state(objectIndex, 1); set_object_flag_status_true(objectIndex, 0x2000); set_object_flag_status_false(objectIndex, 0x4000); } else { - gObjectList[objectIndex].unk_050--; - if (gObjectList[objectIndex].unk_050 <= 0) { - gObjectList[objectIndex].unk_050 = arg4; + gObjectList[objectIndex].timer--; + if (gObjectList[objectIndex].timer <= 0) { + gObjectList[objectIndex].timer = arg4; if (is_obj_index_flag_status_inactive(objectIndex, 0x4000) != 0) { - gObjectList[objectIndex].itemDisplay += arg3; - if (gObjectList[objectIndex].itemDisplay >= arg2) { - gObjectList[objectIndex].itemDisplay = arg2; + gObjectList[objectIndex].textureListIndex += arg3; + if (gObjectList[objectIndex].textureListIndex >= arg2) { + gObjectList[objectIndex].textureListIndex = arg2; set_object_flag_status_true(objectIndex, 0x4000); } } else { - gObjectList[objectIndex].itemDisplay -= arg3; - if (arg1 >= gObjectList[objectIndex].itemDisplay) { - gObjectList[objectIndex].itemDisplay = arg1; + gObjectList[objectIndex].textureListIndex -= arg3; + if (arg1 >= gObjectList[objectIndex].textureListIndex) { + gObjectList[objectIndex].textureListIndex = arg1; if (gObjectList[objectIndex].unk_0CC > 0) { gObjectList[objectIndex].unk_0CC--; } @@ -676,8 +679,8 @@ bool func_800730BC(s32 objectIndex, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 if (gObjectList[objectIndex].unk_0CC == 0) { set_object_flag_status_false(objectIndex, 0x80); set_object_flag_status_false(objectIndex, 0x2000); - set_object_unk_0CB(objectIndex, 0); - func_80072488(objectIndex); + set_object_timer_state(objectIndex, 0); + object_next_state(objectIndex); sp24 = true; } else { set_object_flag_status_false(objectIndex, 0x4000); @@ -695,33 +698,33 @@ s32 func_8007326C(s32 objectIndex, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 a sp24 = 0; if (is_obj_index_flag_status_inactive(objectIndex, 0x2000) != 0) { - gObjectList[objectIndex].itemDisplay = arg1; - gObjectList[objectIndex].unk_050 = arg4; + gObjectList[objectIndex].textureListIndex = arg1; + gObjectList[objectIndex].timer = arg4; gObjectList[objectIndex].unk_0CC = arg5; - set_object_unk_0CB(objectIndex, 1); + set_object_timer_state(objectIndex, 1); set_object_flag_status_true(objectIndex, 0x2000); set_object_flag_status_false(objectIndex, 0x4000); } else { - gObjectList[objectIndex].unk_050--; - if (gObjectList[objectIndex].unk_050 <= 0) { - gObjectList[objectIndex].unk_050 = arg4; + gObjectList[objectIndex].timer--; + if (gObjectList[objectIndex].timer <= 0) { + gObjectList[objectIndex].timer = arg4; if (is_obj_index_flag_status_inactive(objectIndex, 0x4000) != 0) { - gObjectList[objectIndex].itemDisplay -= arg3; - if (arg2 >= gObjectList[objectIndex].itemDisplay) { - gObjectList[objectIndex].itemDisplay = arg2; + gObjectList[objectIndex].textureListIndex -= arg3; + if (arg2 >= gObjectList[objectIndex].textureListIndex) { + gObjectList[objectIndex].textureListIndex = arg2; set_object_flag_status_true(objectIndex, 0x4000); } } else { - gObjectList[objectIndex].itemDisplay += arg3; - if (gObjectList[objectIndex].itemDisplay >= arg1) { - gObjectList[objectIndex].itemDisplay = arg1; + gObjectList[objectIndex].textureListIndex += arg3; + if (gObjectList[objectIndex].textureListIndex >= arg1) { + gObjectList[objectIndex].textureListIndex = arg1; if (gObjectList[objectIndex].unk_0CC > 0) { gObjectList[objectIndex].unk_0CC--; } if (gObjectList[objectIndex].unk_0CC == 0) { set_object_flag_status_false(objectIndex, 0x2000); - set_object_unk_0CB(objectIndex, 0); - func_80072488(objectIndex); + set_object_timer_state(objectIndex, 0); + object_next_state(objectIndex); sp24 = 1; } else { set_object_flag_status_false(objectIndex, 0x4000); @@ -737,7 +740,7 @@ void func_80073404(s32 objectIndex, u8 arg1, u8 arg2, Vtx* arg3) { gObjectList[objectIndex].vertex = arg3; gObjectList[objectIndex].textureWidth = arg1; gObjectList[objectIndex].textureHeight = arg2; - gObjectList[objectIndex].itemDisplay = 0; + gObjectList[objectIndex].textureListIndex = 0; gObjectList[objectIndex].unk_0D3 = -1; gObjectList[objectIndex].status = 0; } @@ -747,7 +750,7 @@ void init_texture_object(s32 objectIndex, u8* texture, u8* arg2, u8 arg3, u16 ar gObjectList[objectIndex].textureList = arg2; gObjectList[objectIndex].textureWidth = arg3; gObjectList[objectIndex].textureHeight = arg4; - gObjectList[objectIndex].itemDisplay = 0; + gObjectList[objectIndex].textureListIndex = 0; gObjectList[objectIndex].unk_0D3 = -1; gObjectList[objectIndex].status = 0; } @@ -758,7 +761,7 @@ UNUSED void func_8007348C(s32 objectIndex, u8* arg1, u8 arg2, u8 arg3, Vtx* arg4 gObjectList[objectIndex].textureWidth = arg2; gObjectList[objectIndex].textureHeight = arg3; gObjectList[objectIndex].vertex = arg4; - gObjectList[objectIndex].itemDisplay = 0; + gObjectList[objectIndex].textureListIndex = 0; gObjectList[objectIndex].unk_0D3 = -1; gObjectList[objectIndex].status = 0; } @@ -769,7 +772,7 @@ UNUSED void func_800734D4() { void update_neon_texture(s32 objectIndex) { // I have no idea why this typecast works gObjectList[objectIndex].activeTLUT = - (u8*) ((u32*) gObjectList[objectIndex].tlutList + (gObjectList[objectIndex].itemDisplay * 128)); + (u8*) ((u32*) gObjectList[objectIndex].tlutList + (gObjectList[objectIndex].textureListIndex * 128)); gObjectList[objectIndex].activeTexture = gObjectList[objectIndex].textureList; } @@ -778,7 +781,7 @@ void func_80073514(s32 objectIndex) { gObjectList[objectIndex].activeTexture = gObjectList[objectIndex].textureList + (gObjectList[objectIndex].textureWidth * gObjectList[objectIndex].textureHeight * - gObjectList[objectIndex].itemDisplay); + gObjectList[objectIndex].textureListIndex); } UNUSED void func_80073568() { @@ -798,11 +801,11 @@ void func_800735BC(s32 objectIndex, Gfx* arg1, f32 arg2) { gObjectList[objectIndex].status = 0; gObjectList[objectIndex].model = arg1; gObjectList[objectIndex].sizeScaling = arg2; - func_80072488(objectIndex); + object_next_state(objectIndex); } void func_80073600(s32 objectIndex) { - set_object_unk_0CB(objectIndex, 0); + set_object_timer_state(objectIndex, 0); gObjectList[objectIndex].unk_0D6 = 0; gObjectList[objectIndex].unk_04C = -1; set_object_flag_status_false(objectIndex, 0x8000); @@ -1293,13 +1296,13 @@ u8* func_80074790(s32 objectIndex, u8* arg1) { void func_800747F0(s32 objectIndex, u8* arg1) { u8* sp24; - if (gObjectList[objectIndex].itemDisplay != gObjectList[objectIndex].unk_0D3) { + if (gObjectList[objectIndex].textureListIndex != gObjectList[objectIndex].unk_0D3) { sp24 = gObjectList[objectIndex].textureList + (gObjectList[objectIndex].textureWidth * gObjectList[objectIndex].textureHeight * - gObjectList[objectIndex].itemDisplay); + gObjectList[objectIndex].textureListIndex); func_80074574(sp24, (void*) func_80074790(objectIndex, arg1), gObjectList[objectIndex].textureWidth, gObjectList[objectIndex].textureHeight); - gObjectList[objectIndex].unk_0D3 = gObjectList[objectIndex].itemDisplay; + gObjectList[objectIndex].unk_0D3 = gObjectList[objectIndex].textureListIndex; func_80074478(objectIndex); } } @@ -1380,7 +1383,7 @@ void func_80074924(s32 objectIndex) { object->unk_084[7] = -0x100 - (sp20 / 32); } object->primAlpha = 0x00E6; - func_80072488(objectIndex); + object_next_state(objectIndex); } void func_80074D94(s32 objectIndex) { @@ -1400,7 +1403,7 @@ void func_80074E28(s32 objectIndex) { func_80074924(objectIndex); break; case 2: - if (func_8007278C(objectIndex, 1) != 0) { + if (set_and_run_timer_object(objectIndex, 1) != false) { func_80086E70(objectIndex); break; } @@ -1449,7 +1452,7 @@ void func_80074FD8(s32 objectIndex) { if (func_80087E08(objectIndex, gObjectList[objectIndex].velocity[1], 0.12f, gObjectList[objectIndex].unk_034, gObjectList[objectIndex].direction_angle[1], 0x00000064) != 0) { - func_80072488(objectIndex); + object_next_state(objectIndex); } object_calculate_new_pos_offset(objectIndex); gObjectList[objectIndex].orientation[0] += D_8016582C[0]; @@ -1585,7 +1588,7 @@ void func_80075698(s32 objectIndex) { gObjectList[objectIndex].offset[1] = 0.0f; gObjectList[objectIndex].offset[2] = 0.0f; gObjectList[objectIndex].sizeScaling = 0.5f; - func_80072488(objectIndex); + object_next_state(objectIndex); } void func_80075714(s32 objectIndex) { @@ -1598,7 +1601,7 @@ void func_80075714(s32 objectIndex) { f32_step_up_towards(&gObjectList[objectIndex].offset[1], 100.0f, gObjectList[objectIndex].velocity[1]); func_8007415C(objectIndex, &gObjectList[objectIndex].sizeScaling, 0.55f, 1.0f, 0.1f, 1, 0); if (func_80073B00(objectIndex, &gObjectList[objectIndex].primAlpha, 0xFF, 0x1E, 7, 0, 0) != 0) { - func_80072488(objectIndex); + object_next_state(objectIndex); } break; case 3: @@ -1706,7 +1709,7 @@ void func_80075B08(s32 objectIndex) { gObjectList[objectIndex].offset[1] = 0.0f; gObjectList[objectIndex].offset[2] = 0.0f; gObjectList[objectIndex].sizeScaling = 0.5f; - func_80072488(objectIndex); + object_next_state(objectIndex); } void func_80075B84(s32 objectIndex) { @@ -1719,7 +1722,7 @@ void func_80075B84(s32 objectIndex) { f32_step_up_towards(&gObjectList[objectIndex].offset[1], 100.0f, gObjectList[objectIndex].velocity[1]); func_8007415C(objectIndex, &gObjectList[objectIndex].sizeScaling, 0.55f, 1.0f, 0.1f, 1, 0); if (func_80073B00(objectIndex, &gObjectList[objectIndex].primAlpha, 0xFF, 0x1E, 7, 0, 0) != 0) { - func_80072488(objectIndex); + object_next_state(objectIndex); } break; case 3: @@ -1920,7 +1923,7 @@ void func_8007634C(s32 objectIndex) { object->primAlpha = 0x00FF; set_obj_orientation(objectIndex, 0U, 0U, 0U); set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f); - func_80072488(objectIndex); + object_next_state(objectIndex); } void func_800763CC(s32 objectIndex) { @@ -1933,7 +1936,7 @@ void func_800763CC(s32 objectIndex) { func_8007634C(objectIndex); break; case 2: - if (func_8007278C(objectIndex, object->unk_048) != 0) { + if (set_and_run_timer_object(objectIndex, object->unk_048) != 0) { func_80086E70(objectIndex); } break; @@ -1949,7 +1952,7 @@ void func_800763CC(s32 objectIndex) { } if ((object->unk_0AE >= 2) && (func_80073B00(objectIndex, &object->primAlpha, 0x000000FF, 0x00000050, 0x00000020, 0, 0) != 0)) { - func_80072488(objectIndex); + object_next_state(objectIndex); } break; case 4: @@ -2087,7 +2090,7 @@ void func_80076958(s32 objectIndex) { object->primAlpha = 0x00FF; set_obj_orientation(objectIndex, 0U, 0U, 0U); set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f); - func_80072488(objectIndex); + object_next_state(objectIndex); } void func_800769D8(s32 objectIndex) { @@ -2101,7 +2104,7 @@ void func_800769D8(s32 objectIndex) { func_80076958(objectIndex); break; case 2: - if (func_8007278C(objectIndex, object->unk_048) != 0) { + if (set_and_run_timer_object(objectIndex, object->unk_048) != 0) { func_80086E70(objectIndex); } break; @@ -2110,7 +2113,7 @@ void func_800769D8(s32 objectIndex) { s16_step_towards(&object->type, 0, 0x0018); if ((object->unk_0AE >= 2) && (func_80073B00(objectIndex, &object->primAlpha, 0x000000FF, 0x00000050, 0x00000020, 0, 0) != 0)) { - func_80072488(objectIndex); + object_next_state(objectIndex); } break; case 4: @@ -2195,7 +2198,7 @@ void init_smoke_particle(Vec3f arg0, UNUSED f32 arg1, s16 arg2) { } void func_80076DC4(s32 objectIndex) { - func_80072488(objectIndex); + object_next_state(objectIndex); if (gObjectList[objectIndex].unk_0D5 != 0x0B) { func_80086E70(objectIndex); } @@ -2210,7 +2213,7 @@ void func_80076E14(s32 objectIndex) { if ((gObjectList[objectIndex].unk_0AE >= 2) && (func_80073B00(objectIndex, &gObjectList[objectIndex].primAlpha, 0x000000FF, 0x00000050, 0x00000020, 0, 0) != 0)) { - func_80072488(objectIndex); + object_next_state(objectIndex); } break; case 0: @@ -2335,7 +2338,7 @@ void func_800773D8(f32* arg0, s32 arg1) { } void func_80077428(s32 arg0) { - func_80072488(arg0); + object_next_state(arg0); func_80086E70(arg0); } @@ -2470,7 +2473,7 @@ void spawn_leaf(Vec3f arg0, UNUSED s32 arg1) { } void func_80077B14(s32 arg0) { - func_80072488(arg0); + object_next_state(arg0); func_80086E70(arg0); } @@ -2486,7 +2489,7 @@ void func_80077B3C(s32 objectIndex) { break; case 2: if (object->unk_0AE == 0) { - func_80072488(objectIndex); + object_next_state(objectIndex); } break; case 3: @@ -2567,7 +2570,7 @@ void func_80077E20(s32 objectIndex) { object->primAlpha = 0x00FF; object->unk_0D5 = 0; object->type = 0; - func_80072488(objectIndex); + object_next_state(objectIndex); } void func_80077EB8(s32 objectIndex, u16 arg1, Camera* camera) { @@ -2622,7 +2625,7 @@ void func_800780CC(s32 objectIndex, Camera* camera) { case 2: func_80077F64(objectIndex, camera); if (gObjectList[objectIndex].unk_0AE == 0) { - func_80072488(objectIndex); + object_next_state(objectIndex); return; } case 0: @@ -2655,7 +2658,7 @@ void func_80078220(s32 objectIndex) { object->vertex = common_vtx_rectangle; object->sizeScaling = 0.15f; func_80086EF0(objectIndex); - func_80072488(objectIndex); + object_next_state(objectIndex); } void func_80078288(s32 objectIndex) { @@ -2724,7 +2727,7 @@ void func_800786EC(s32 objectIndex) { case 2: func_80078288(objectIndex); if (gObjectList[objectIndex].unk_0AE == 0) { - func_80072488(objectIndex); + object_next_state(objectIndex); } break; case 3: @@ -3001,7 +3004,7 @@ void init_obj_lakitu_red_flag_countdown(s32 objectIndex, s32 arg1) { gObjectList[objectIndex].vertex = common_vtx_lakitu; gObjectList[objectIndex].sizeScaling = 0.15f; set_object_flag_status_false(objectIndex, 0x00000010); - func_80072488(objectIndex); + object_next_state(objectIndex); gObjectList[objectIndex].unk_048 = D_8018D180; } @@ -3014,29 +3017,29 @@ void update_object_lakitu_countdown(s32 objectIndex, s32 arg1) { init_obj_lakitu_red_flag_countdown(objectIndex, arg1); break; case 2: - func_8007278C(objectIndex, gObjectList[objectIndex].unk_048); - if ((gObjectList[objectIndex].unk_050 == 0x00000055) && (gPlayerCount == 3) && (arg1 == 0)) { + set_and_run_timer_object(objectIndex, gObjectList[objectIndex].unk_048); + if ((gObjectList[objectIndex].timer == 0x00000055) && (gPlayerCount == 3) && (arg1 == 0)) { D_8018D168 = 1; } break; case 3: set_object_flag_status_true(objectIndex, 0x00000010); - func_80086F10(objectIndex, 1, &D_800E67B8); - func_80072488(objectIndex); + func_80086F10(objectIndex, 1, &D_800E67B8); // set a spline + object_next_state(objectIndex); break; case 4: - if ((func_8007278C(objectIndex, 0x0000001E) != 0) && (gPlayerCount != 3) && (arg1 == 0)) { + if ((set_and_run_timer_object(objectIndex, 0x0000001E) != false) && (gPlayerCount != 3) && (arg1 == 0)) { D_8018D168 = 1; } break; case 5: - func_8007278C(objectIndex, 0x0000001E); + set_and_run_timer_object(objectIndex, 0x0000001E); break; case 6: func_80072E54(objectIndex, 1, 7, 1, 2, 0); break; case 7: - if (func_8007278C(objectIndex, 0x00000014) != 0) { + if (set_and_run_timer_object(objectIndex, 0x00000014) != 0) { gObjectList[objectIndex].tlutList += 0x200; if (arg1 == 0) { play_sound2(SOUND_ACTION_COUNTDOWN_LIGHT); @@ -3047,7 +3050,7 @@ void update_object_lakitu_countdown(s32 objectIndex, s32 arg1) { func_80072E54(objectIndex, 8, 0x0000000F, 1, 6, 0); break; case 9: - if ((func_8007278C(objectIndex, 8) != 0) && (arg1 == 0)) { + if ((set_and_run_timer_object(objectIndex, 8) != 0) && (arg1 == 0)) { play_sound2(SOUND_ACTION_COUNTDOWN_LIGHT); } break; @@ -3057,7 +3060,7 @@ void update_object_lakitu_countdown(s32 objectIndex, s32 arg1) { } break; case 11: - if (func_8007278C(objectIndex, 8) != 0) { + if (set_and_run_timer_object(objectIndex, 8) != 0) { gObjectList[objectIndex].tlutList += 0x200; if (arg1 == 0) { play_sound2(SOUND_ACTION_GREEN_LIGHT); @@ -3073,10 +3076,10 @@ void update_object_lakitu_countdown(s32 objectIndex, s32 arg1) { D_8018D160 = 1; break; } - func_80072488(objectIndex); + object_next_state(objectIndex); break; case 14: - func_8007278C(objectIndex, 0x00000078); + set_and_run_timer_object(objectIndex, 0x00000078); break; case 15: func_80072428(objectIndex); @@ -3099,7 +3102,7 @@ void init_obj_lakitu_red_flag(s32 objectIndex, s32 playerIndex) { object->sizeScaling = 0.15f; func_80086F10(objectIndex, 2, &D_800E6834); set_object_flag_status_false(objectIndex, 0x00000010); - func_80072488(objectIndex); + object_next_state(objectIndex); } void update_object_lakitu_red_flag(s32 objectIndex, s32 playerIndex) { @@ -3111,7 +3114,7 @@ void update_object_lakitu_red_flag(s32 objectIndex, s32 playerIndex) { break; case 2: set_object_flag_status_true(objectIndex, 0x00000010); - func_80072488(objectIndex); + object_next_state(objectIndex); break; case 3: func_80072E54(objectIndex, 0, 0x0000001F, 1, 2, -1); @@ -3168,7 +3171,7 @@ void init_obj_lakitu_red_flag_fishing(s32 objectIndex, s32 arg1) { func_80086E70(objectIndex); set_object_flag_status_false(objectIndex, 0x00000010); func_80073720(objectIndex); - func_80072488(objectIndex); + object_next_state(objectIndex); func_800C8F80((u8) arg1, 0x0100FA28); } @@ -3210,7 +3213,7 @@ void update_object_lakitu_fishing(s32 objectIndex, s32 playerId) { case 2: /* switch 1 */ set_object_flag_status_true(objectIndex, 0x00000010); func_800736E0(objectIndex); - func_80072488(objectIndex); + object_next_state(objectIndex); break; case 3: /* switch 1 */ func_800730BC(objectIndex, 0, 3, 1, 2, -1); @@ -3265,7 +3268,7 @@ void update_object_lakitu_fishing2(s32 objectIndex, s32 playerId) { set_object_flag_status_true(objectIndex, 0x00000010); func_800736E0(objectIndex); player->unk_0CA |= 0x80; - func_80072488(objectIndex); + object_next_state(objectIndex); break; case 3: /* switch 1 */ func_800730BC(objectIndex, 0, 3, 1, 2, -1); @@ -3345,7 +3348,7 @@ void func_8007A060(s32 objectIndex, s32 playerIndex) { object->sizeScaling = 0.15f; set_object_flag_status_false(objectIndex, 0x00000010); func_80086F10(objectIndex, 5, &D_800E694C); - func_80072488(objectIndex); + object_next_state(objectIndex); } void update_object_lakitu_second_lap(s32 objectIndex, s32 playerIndex) { @@ -3357,16 +3360,16 @@ void update_object_lakitu_second_lap(s32 objectIndex, s32 playerIndex) { break; case 2: set_object_flag_status_true(objectIndex, 0x00000010); - func_80072488(objectIndex); + object_next_state(objectIndex); break; case 3: - func_8007278C(objectIndex, 0x00000014); + set_and_run_timer_object(objectIndex, 0x00000014); break; case 4: func_80072E54(objectIndex, 0, 0x0000000F, 1, 2, 1); break; case 5: - func_8007278C(objectIndex, 0x0000003C); + set_and_run_timer_object(objectIndex, 0x0000003C); break; case 6: func_80072F88(objectIndex, 0x0000000F, 0, 1, 2, 1); @@ -3394,7 +3397,7 @@ void func_8007A228(s32 objectIndex, s32 playerIndex) { object->sizeScaling = 0.15f; set_object_flag_status_false(objectIndex, 0x00000010); func_80086F10(objectIndex, 5, &D_800E694C); - func_80072488(objectIndex); + object_next_state(objectIndex); } void update_object_lakitu_final_lap(s32 objectIndex, s32 playerIndex) { @@ -3406,16 +3409,16 @@ void update_object_lakitu_final_lap(s32 objectIndex, s32 playerIndex) { break; case 2: set_object_flag_status_true(objectIndex, 0x00000010); - func_80072488(objectIndex); + object_next_state(objectIndex); break; case 3: - func_8007278C(objectIndex, 0x00000014); + set_and_run_timer_object(objectIndex, 0x00000014); break; case 4: func_80072E54(objectIndex, 0, 0x0000000F, 1, 2, 1); break; case 5: - func_8007278C(objectIndex, 0x0000003C); + set_and_run_timer_object(objectIndex, 0x0000003C); break; case 6: func_80072F88(objectIndex, 0x0000000F, 0, 1, 2, 1); @@ -3442,7 +3445,7 @@ void func_8007A3F0(s32 objectIndex, s32 arg1) { set_object_flag_status_false(objectIndex, 0x00000010); func_80086F10(objectIndex, 6, &D_800E69B0); gObjectList[objectIndex].unk_0D6 = 0; - func_80072488(objectIndex); + object_next_state(objectIndex); func_800C8F80((u8) arg1, 0x0100FA28); } @@ -3458,7 +3461,7 @@ void update_object_lakitu_reverse(s32 objectIndex, s32 playerId) { case 2: set_object_flag_status_true(objectIndex, 0x00000010); gObjectList[objectIndex].unk_0D6 = 1; - func_80072488(objectIndex); + object_next_state(objectIndex); break; case 3: func_800730BC(objectIndex, 0, 0x0000000F, 1, 2, -1); @@ -3480,7 +3483,7 @@ void update_object_lakitu_reverse(s32 objectIndex, s32 playerId) { case 2: /* switch 1 */ gObjectList[objectIndex].unk_04C--; if (gObjectList[objectIndex].unk_04C == 0) { - func_80072488(objectIndex); + object_next_state(objectIndex); gObjectList[objectIndex].unk_0D6 = 0; } break; @@ -3651,13 +3654,13 @@ void consume_item(s32 playerId) { func_800722CC(objectIndex, 2); player->currentItemCopy = ITEM_NONE; itemWindow->currentItem = ITEM_NONE; - set_object_unk_0CB(objectIndex, 0); + set_object_timer_state(objectIndex, 0); func_800726CC(objectIndex, 9); } } else { player->currentItemCopy = ITEM_NONE; itemWindow->currentItem = ITEM_NONE; - set_object_unk_0CB(objectIndex, 0); + set_object_timer_state(objectIndex, 0); } } @@ -3746,7 +3749,7 @@ s32 func_8007B040(s32 objectIndex, s32 playerId) { func_800C9060(playerId, 0x1900A058U); } var_t3 = 1; - gObjectList[objectIndex].itemDisplay = gObjectList[objectIndex].unk_0A2 = var_v1; + gObjectList[objectIndex].textureListIndex = gObjectList[objectIndex].unk_0A2 = var_v1; } else { for (var_v1_2 = 0; var_v1_2 < gPlayerCountSelection1; var_v1_2++) { temp_a0 = gItemWindowObjectByPlayerId[var_v1_2]; @@ -3762,7 +3765,7 @@ s32 func_8007B040(s32 objectIndex, s32 playerId) { var_v1 = random_int(var_a3); temp_a1 = sp40[var_v1]; gObjectList[objectIndex].unk_0A2 = temp_a1; - gObjectList[objectIndex].itemDisplay = temp_a1; + gObjectList[objectIndex].textureListIndex = temp_a1; temp_v1 = sp50[var_v1]; gObjectList[objectIndex].unk_0D1 = temp_v1; temp_a0 = gItemWindowObjectByPlayerId[temp_v1]; @@ -3772,7 +3775,7 @@ s32 func_8007B040(s32 objectIndex, s32 playerId) { sp38->currentItemCopy = 0; if (func_80072320(temp_a0, 2) != 0) { func_800722CC(temp_a0, 2); - gObjectList[temp_a0].timer = 0; + gObjectList[temp_a0].animationTimer = 0; } var_t3 = 1; } @@ -3792,14 +3795,14 @@ void func_8007B254(s32 objectIndex, s32 arg1) { gObjectList[objectIndex].textureHeight = 0x20; gObjectList[objectIndex].unk_04C = 0x00000032; gObjectList[objectIndex].unk_0D6 = 1; - gObjectList[objectIndex].timer = 0; + gObjectList[objectIndex].animationTimer = 0; func_800722A4(objectIndex, 4); if (D_80165888 != 0) { func_800726CC(objectIndex, 8); gObjectList[objectIndex].unk_0D6 = 2; gObjectList[objectIndex].type = 0x000E; test = gObjectList[objectIndex].type; - gObjectList[objectIndex].itemDisplay = test; + gObjectList[objectIndex].textureListIndex = test; gObjectList[objectIndex].unk_0A2 = test; playerHUD[PLAYER_ONE].slideItemBoxY = 0; D_80165888 = 0; @@ -3834,24 +3837,24 @@ void func_8007B34C(s32 playerId) { if (gActiveScreenMode == 0) { s16_step_up_towards(&playerHUD[playerId].slideItemBoxY, 0x0040, 4); if (playerHUD[playerId].slideItemBoxY == 0x0040) { - func_80072488(temp_s0); + object_next_state(temp_s0); } } else if (gActiveScreenMode == 3) { if ((playerId == 0) || (playerId == 2)) { s16_step_up_towards(&playerHUD[playerId].slideItemBoxX, 0x0080, 8); if (playerHUD[playerId].slideItemBoxX == 0x0080) { - func_80072488(temp_s0); + object_next_state(temp_s0); } } else { s16_step_down_towards(&playerHUD[playerId].slideItemBoxX, -0x0080, 8); if (playerHUD[playerId].slideItemBoxX == -0x0080) { - func_80072488(temp_s0); + object_next_state(temp_s0); } } } else { s16_step_up_towards(&playerHUD[playerId].slideItemBoxX, 0x0080, 8); if (playerHUD[playerId].slideItemBoxX == 0x0080) { - func_80072488(temp_s0); + object_next_state(temp_s0); } } break; @@ -3865,10 +3868,10 @@ void func_8007B34C(s32 playerId) { func_80072E54(temp_s0, 1, 4, 1, 0x00000010, 1); break; case 6: - object->itemDisplay = func_8007AFB0(temp_s0, playerId); + object->textureListIndex = func_8007AFB0(temp_s0, playerId); object->unk_04C = 8; object->unk_0D6 = 2; - func_80072488(temp_s0); + object_next_state(temp_s0); func_800C9018((u8) playerId, SOUND_ARG_LOAD(0x01, 0x00, 0xFE, 0x1C)); func_800C8F80((u8) playerId, SOUND_ARG_LOAD(0x01, 0x00, 0xFE, 0x47)); break; @@ -3878,31 +3881,31 @@ void func_8007B34C(s32 playerId) { case 9: func_800722CC(temp_s0, 4); func_80073600(temp_s0); - object->itemDisplay = 0; - func_80072488(temp_s0); + object->textureListIndex = 0; + object_next_state(temp_s0); break; case 10: - func_8007278C(temp_s0, 0x00000014); + set_and_run_timer_object(temp_s0, 0x00000014); break; case 11: if (gActiveScreenMode == 0) { if (s16_step_down_towards(&playerHUD[playerId].slideItemBoxY, 0, 4) != 0) { - func_80072488(temp_s0); + object_next_state(temp_s0); } } else if (gActiveScreenMode == 3) { if ((playerId == 0) || (playerId == 2)) { s16_step_down_towards(&playerHUD[playerId].slideItemBoxX, 0, 8); if (playerHUD[playerId].slideItemBoxX == 0) { - func_80072488(temp_s0); + object_next_state(temp_s0); } } else { s16_step_up_towards(&playerHUD[playerId].slideItemBoxX, 0, 8); if (playerHUD[playerId].slideItemBoxX == 0) { - func_80072488(temp_s0); + object_next_state(temp_s0); } } } else if (s16_step_down_towards(&playerHUD[playerId].slideItemBoxX, 0, 8) != 0) { - func_80072488(temp_s0); + object_next_state(temp_s0); } break; case 12: @@ -3947,10 +3950,10 @@ void func_8007B34C(s32 playerId) { break; } if (func_80072320(temp_s0, 2) != 0) { - if (object->timer == 0) { + if (object->animationTimer == 0) { consume_item(playerId); } else { - object->timer--; + object->animationTimer--; } } if (object->unk_04C >= 0) { @@ -3996,8 +3999,8 @@ void func_8007B34C(s32 playerId) { } } } - object->activeTLUT = (u8*) gItemWindowTLUTs[object->itemDisplay]; - object->activeTexture = gItemWindowTextures[object->itemDisplay]; + object->activeTLUT = (u8*) gItemWindowTLUTs[object->textureListIndex]; + object->activeTexture = gItemWindowTextures[object->textureListIndex]; sp38->currentItemCopy = object->type; } @@ -4028,7 +4031,7 @@ void func_8007BBBC(s32 objectIndex) { var_f14 = object->velocity[2]; } object->direction_angle[0] = func_80041658(object->velocity[1], var_f14); - func_8007278C(objectIndex, 0x00000046); + set_and_run_timer_object(objectIndex, 0x00000046); break; case 3: func_80072428(objectIndex); @@ -4069,7 +4072,7 @@ void init_var_cheep_cheep(s32 objectIndex) { object->status = 0; object->model = d_course_banshee_boardwalk_dl_cheep_cheep; object->sizeScaling = 0.2f; - func_80072488(objectIndex); + object_next_state(objectIndex); set_obj_origin_pos(objectIndex, D_800E634C[0][0], D_800E634C[0][1] + 55.0, D_800E634C[0][2]); set_obj_origin_offset(objectIndex, 0.0f, 30.0f, 0.0f); set_obj_direction_angle(objectIndex, 0U, 0x3800U, 0U); @@ -4084,18 +4087,18 @@ void func_8007BEC8(s32 objectIndex) { init_var_cheep_cheep(objectIndex); break; case 2: - if (func_8007278C(objectIndex, 0x0000003C) != 0) { + if (set_and_run_timer_object(objectIndex, 0x0000003C) != 0) { set_object_flag_status_true(objectIndex, 0x00000010); func_80086E70(objectIndex); } break; case 3: if (object->unk_0AE == 0) { - func_80072488(objectIndex); + object_next_state(objectIndex); } break; case 4: - if (func_8007278C(objectIndex, 0x0000000A) != 0) { + if (set_and_run_timer_object(objectIndex, 0x0000000A) != 0) { func_8008701C(objectIndex, 2); } break; @@ -4217,10 +4220,10 @@ void func_8007C360(s32 objectIndex, Camera* camera) { if (temp < 0x13) { set_object_flag_status_false(objectIndex, 0x80); - gObjectList[objectIndex].itemDisplay = temp; + gObjectList[objectIndex].textureListIndex = temp; } else { set_object_flag_status_true(objectIndex, 0x80); - gObjectList[objectIndex].itemDisplay = 0x24 - temp; + gObjectList[objectIndex].textureListIndex = 0x24 - temp; } } @@ -4245,10 +4248,10 @@ void func_8007C4A4(s32 objectIndex) { if (var_t9 < 0x13) { set_object_flag_status_false(objectIndex, 0x80); - gObjectList[objectIndex].itemDisplay = var_t9; + gObjectList[objectIndex].textureListIndex = var_t9; } else { set_object_flag_status_true(objectIndex, 0x80); - gObjectList[objectIndex].itemDisplay = 0x24 - var_t9; + gObjectList[objectIndex].textureListIndex = 0x24 - var_t9; } } @@ -4268,7 +4271,7 @@ void func_8007C5B4(s32 objectIndex) { object->pos[1] = 0.0f; object->pos[2] = 0.0f; set_object_flag_status_true(objectIndex, 0x00000020); - func_80072488(objectIndex); + object_next_state(objectIndex); object->primAlpha = 0; func_80073844(objectIndex); object->sizeScaling = 0.15f; @@ -4464,12 +4467,12 @@ void func_8007CE0C(s32 objectIndex) { init_texture_object(objectIndex, d_course_banshee_boardwalk_boo_tlut, gTextureGhosts, 0x30U, (u16) 0x00000028); object = &gObjectList[objectIndex]; - object->itemDisplay = 0x1C; + object->textureListIndex = 0x1C; object->pos[0] = 0.0f; object->pos[1] = 0.0f; object->pos[2] = 0.0f; object->sizeScaling = 0.15f; - func_80072488(objectIndex); + object_next_state(objectIndex); object->primAlpha = 0; func_80073844(objectIndex); func_80086EF0(objectIndex); @@ -4489,10 +4492,10 @@ void func_8007CEDC(s32 objectIndex) { func_8007CE0C(objectIndex); break; case 2: /* switch 1 */ - func_8007278C(objectIndex, 0x0000001E); + set_and_run_timer_object(objectIndex, 0x0000001E); break; case 3: /* switch 1 */ - func_8007278C(objectIndex, 0x000003E8); + set_and_run_timer_object(objectIndex, 0x000003E8); break; case 4: /* switch 1 */ func_80072428(objectIndex); @@ -4665,7 +4668,7 @@ s32 func_8007D804(s32 objectIndex) { } void func_8007D8AC(s32 arg0) { - func_80072488(arg0); + object_next_state(arg0); func_80086E70(arg0); } @@ -4857,7 +4860,7 @@ void init_bb_trash_bin(s32 objectIndex) { gObjectList[objectIndex].pos[1] = 45.0f; set_obj_velocity(objectIndex, 0.0f, 0.0f, 0.0f); gObjectList[objectIndex].type = 0; - func_80072488(objectIndex); + object_next_state(objectIndex); } void func_8007E00C(s32 objectIndex) { @@ -4867,10 +4870,10 @@ void func_8007E00C(s32 objectIndex) { break; case 3: D_8018CFB0 = 1; - func_80072488(objectIndex); + object_next_state(objectIndex); break; case 4: - func_8007278C(objectIndex, 0x000000D2); + set_and_run_timer_object(objectIndex, 0x000000D2); if (D_80165594 == 0) { if (gCCSelection < CC_150) { func_8007D714(1); @@ -4895,13 +4898,13 @@ void func_8007E00C(s32 objectIndex) { case 5: gObjectList[objectIndex].orientation[2] = func_800417B4(gObjectList[objectIndex].orientation[2], 0U); if (gObjectList[objectIndex].orientation[2] == 0) { - func_80072488(objectIndex); + object_next_state(objectIndex); } break; case 6: gObjectList[objectIndex].orientation[2] = 0; gObjectList[objectIndex].unk_084[7] = 0; - func_80072488(objectIndex); + object_next_state(objectIndex); D_8018CFB0 = 0; break; case 0: @@ -4968,7 +4971,7 @@ void func_8007E358(s32 objectIndex) { gObjectList[objectIndex].type = 0; gObjectList[objectIndex].unk_04C = 0; gObjectList[objectIndex].unk_084[7] = 0; - func_80072488(objectIndex); + object_next_state(objectIndex); } void func_8007E3EC(s32 objectIndex) { @@ -4979,10 +4982,10 @@ void func_8007E3EC(s32 objectIndex) { break; case 3: D_8018CFE8 = 1; - func_80072488(objectIndex); + object_next_state(objectIndex); break; case 4: - func_8007278C(objectIndex, 0x000000D2); + set_and_run_timer_object(objectIndex, 0x000000D2); if (D_80165598 == 0) { if (gCCSelection < CC_150) { func_8007D714(2); @@ -4994,7 +4997,7 @@ void func_8007E3EC(s32 objectIndex) { break; case 5: D_8018CFE8 = 0; - func_80072488(objectIndex); + object_next_state(objectIndex); break; case 0: case 2: @@ -5051,17 +5054,17 @@ void func_8007E63C(s32 objectIndex) { set_object_flag_status_true(objectIndex, 0x00000200); func_800722A4(objectIndex, 1); func_800722CC(objectIndex, 2); - func_80072488(objectIndex); + object_next_state(objectIndex); } break; case 0x33: if (f32_step_down_towards(&gObjectList[objectIndex].offset[1], 0.0f, 2.0f) != 0) { if (gObjectList[objectIndex].offset[1] >= 16.0f) { - gObjectList[objectIndex].itemDisplay = 0; + gObjectList[objectIndex].textureListIndex = 0; } else if (gObjectList[objectIndex].offset[1] >= 8.0f) { - gObjectList[objectIndex].itemDisplay = 1; + gObjectList[objectIndex].textureListIndex = 1; } else { - gObjectList[objectIndex].itemDisplay = 2; + gObjectList[objectIndex].textureListIndex = 2; } func_800722CC(objectIndex, 1); if (is_obj_flag_status_active(objectIndex, 0x00010000) != 0) { @@ -5073,7 +5076,7 @@ void func_8007E63C(s32 objectIndex) { if (func_80072320(objectIndex, 2) != 0) { func_800726CC(objectIndex, 0x00000064); } else { - func_80072488(objectIndex); + object_next_state(objectIndex); } } break; @@ -5085,9 +5088,9 @@ void func_8007E63C(s32 objectIndex) { break; case 0x36: if (gObjectList[objectIndex].offset[1] >= 20.0f) { - gObjectList[objectIndex].itemDisplay = 0; + gObjectList[objectIndex].textureListIndex = 0; } else if (gObjectList[objectIndex].offset[1] >= 18.0f) { - gObjectList[objectIndex].itemDisplay = 1; + gObjectList[objectIndex].textureListIndex = 1; } if (f32_step_up_towards(&gObjectList[objectIndex].offset[1], gObjectList[objectIndex].unk_01C[1], 0.5f) != 0) { @@ -5099,11 +5102,11 @@ void func_8007E63C(s32 objectIndex) { func_80072E54(objectIndex, 3, 5, 1, 8, 0); break; case 0x65: - func_8007278C(objectIndex, 0x0000001E); + set_and_run_timer_object(objectIndex, 0x0000001E); break; case 0x66: if (f32_step_up_towards(&gObjectList[objectIndex].offset[1], 20.0f, 1.5f) != 0) { - func_80072488(objectIndex); + object_next_state(objectIndex); } break; case 0x67: @@ -5114,12 +5117,12 @@ void func_8007E63C(s32 objectIndex) { func_800722A4(objectIndex, 0x00000020); } } - func_80072488(objectIndex); + object_next_state(objectIndex); } break; case 0x68: if (f32_step_up_towards(&gObjectList[objectIndex].offset[1], 12.0f, 1.5f) != 0) { - func_80072488(objectIndex); + object_next_state(objectIndex); } break; case 0x69: @@ -5132,7 +5135,7 @@ void func_8007E63C(s32 objectIndex) { } func_800C98B8(gObjectList[objectIndex].pos, gObjectList[objectIndex].velocity, SOUND_ARG_LOAD(0x19, 0x01, 0x80, 0x45)); - func_80072488(objectIndex); + object_next_state(objectIndex); } break; case 0x6A: @@ -5142,33 +5145,33 @@ void func_8007E63C(s32 objectIndex) { break; case 0x6B: if (gObjectList[objectIndex].offset[1] >= 22.0f) { - gObjectList[objectIndex].itemDisplay = 0; + gObjectList[objectIndex].textureListIndex = 0; } else if (gObjectList[objectIndex].offset[1] >= 20.0f) { - gObjectList[objectIndex].itemDisplay = 1; + gObjectList[objectIndex].textureListIndex = 1; } else if (gObjectList[objectIndex].offset[1] >= 18.0f) { - gObjectList[objectIndex].itemDisplay = 2; + gObjectList[objectIndex].textureListIndex = 2; } else if (gObjectList[objectIndex].offset[1] >= 16.0f) { - gObjectList[objectIndex].itemDisplay = 3; + gObjectList[objectIndex].textureListIndex = 3; } else if (gObjectList[objectIndex].offset[1] >= 14.0f) { - gObjectList[objectIndex].itemDisplay = 4; + gObjectList[objectIndex].textureListIndex = 4; } else { func_800730BC(objectIndex, 3, 5, 1, 6, -1); } if (f32_step_up_towards(&gObjectList[objectIndex].offset[1], gObjectList[objectIndex].unk_01C[1], 0.5f) != 0) { - set_object_unk_0CB(objectIndex, 0); - func_80072488(objectIndex); + set_object_timer_state(objectIndex, 0); + object_next_state(objectIndex); } break; case 0x6C: - if (func_8007278C(objectIndex, 0x00000064) != 0) { + if (set_and_run_timer_object(objectIndex, 0x00000064) != 0) { func_800722CC(objectIndex, 2); set_object_flag_status_false(objectIndex, 0x00000200); func_8007266C(objectIndex); } break; case 0xC8: - if (func_8007278C(objectIndex, 0x0000012C) != 0) { + if (set_and_run_timer_object(objectIndex, 0x0000012C) != 0) { func_80072320(objectIndex, 0x00000080); func_80072428(objectIndex); func_800726CC(objectIndex, 1); @@ -5207,7 +5210,7 @@ void func_8007EC30(s32 objectIndex) { object->type = 0; object->unk_0DF = 6; func_800724DC(objectIndex); - func_80072488(objectIndex); + object_next_state(objectIndex); } void func_8007ED6C(s32 objectIndex) { @@ -5219,7 +5222,7 @@ void func_8007ED6C(s32 objectIndex) { func_8007EC30(objectIndex); break; case 2: - func_8007278C(objectIndex, 0x0000003C); + set_and_run_timer_object(objectIndex, 0x0000003C); break; case 3: func_80072568(objectIndex, 0x00000032); @@ -5268,7 +5271,7 @@ void func_8007EE5C(s32 objectIndex) { } else { object->unk_0DD = 2; } - func_80072488(objectIndex); + object_next_state(objectIndex); } void func_8007EFBC(s32 objectIndex) { @@ -5447,7 +5450,7 @@ void func_8007F5A8(s32 objectIndex) { break; case 4: func_80086FD4(objectIndex); - func_80072488(objectIndex); + object_next_state(objectIndex); break; } func_8007E63C(objectIndex); @@ -5566,7 +5569,7 @@ void func_8007FA08(s32 objectIndex) { object->unk_0DF = 8; object->offset[1] = 15.0f; object->unk_01C[1] = 15.0f; - func_80072488(objectIndex); + object_next_state(objectIndex); } void func_8007FB48(s32 objectIndex) { @@ -5606,7 +5609,7 @@ void func_8007FB48(s32 objectIndex) { gObjectList[objectIndex].orientation[1] = func_800417B4( gObjectList[objectIndex].orientation[1], (gObjectList[objectIndex].direction_angle[1] + 0x8000)); if (gObjectList[objectIndex].unk_0B0 == 0x0064) { - gObjectList[objectIndex].itemDisplay = 1; + gObjectList[objectIndex].textureListIndex = 1; } } var_v0 = 0; @@ -5637,7 +5640,7 @@ void func_8007FB48(s32 objectIndex) { if (gObjectList[objectIndex].orientation[1] == gObjectList[objectIndex].direction_angle[1]) { func_800722CC(objectIndex, 8); func_80086FD4(objectIndex); - gObjectList[objectIndex].itemDisplay = 0; + gObjectList[objectIndex].textureListIndex = 0; } break; case 0: @@ -5692,7 +5695,7 @@ void func_8007FFC0(s32 objectIndex) { func_80072568(objectIndex, 0x00000032); break; case 4: - func_80072488(objectIndex); + object_next_state(objectIndex); func_80086FD4(objectIndex); break; } @@ -5726,20 +5729,20 @@ void func_80080078(s32 objectIndex) { } switch (object->primAlpha) { /* irregular */ case 0: - object->unk_050 = 2; + object->timer = 2; break; case 1: - object->unk_050 = 0x0000003C; + object->timer = 0x0000003C; break; case 2: - object->unk_050 = 0x00000078; + object->timer = 0x00000078; break; case 3: - object->unk_050 = 0x000000B4; + object->timer = 0x000000B4; break; } func_800724DC(objectIndex); - func_80072488(objectIndex); + object_next_state(objectIndex); } void func_800801FC(s32 objectIndex) { @@ -5753,13 +5756,13 @@ void func_800801FC(s32 objectIndex) { func_80080078(objectIndex); break; case 2: - func_8007278C(objectIndex, object->unk_050); + set_and_run_timer_object(objectIndex, object->timer); break; case 3: func_80072568(objectIndex, 0x00000032); break; case 4: - object->unk_050 = 0x0000003C; + object->timer = 0x0000003C; func_800726CC(objectIndex, 2); break; } @@ -5776,7 +5779,7 @@ void func_800802C0(s32 objectIndex) { init_texture_object(objectIndex, d_course_bowsers_castle_thwomp_tlut, (u8*) d_course_bowsers_castle_thwomp_faces, 0x10U, (u16) 0x00000040); object->model = d_course_bowsers_castle_dl_thwomp; - object->itemDisplay = 0; + object->textureListIndex = 0; object->boundingBoxSize = 0x000C; object->sizeScaling = 1.5f; set_object_flag_status_true(objectIndex, 0x05000220); @@ -5796,7 +5799,7 @@ void func_800802C0(s32 objectIndex) { object->offset[0] = 0.0f; object->offset[2] = 0.0f; func_800724DC(objectIndex); - func_80072488(objectIndex); + object_next_state(objectIndex); } void func_80080408(s32 objectIndex) { @@ -5811,16 +5814,16 @@ void func_80080408(s32 objectIndex) { if (is_obj_flag_status_active(objectIndex, VISIBLE) != 0) { func_800C98B8(gObjectList[objectIndex].pos, gObjectList[objectIndex].velocity, SOUND_ARG_LOAD(0x19, 0x01, 0x80, 0x45)); - func_80072488(objectIndex); + object_next_state(objectIndex); } break; case 3: if (func_800730BC(objectIndex, 3, 5, 1, 6, 6) != 0) { - gObjectList[objectIndex].itemDisplay = 0; + gObjectList[objectIndex].textureListIndex = 0; } break; case 4: - if (func_8007278C(objectIndex, 0x0000012C) != 0) { + if (set_and_run_timer_object(objectIndex, 0x0000012C) != 0) { func_800726CC(objectIndex, 2); } break; @@ -5837,7 +5840,7 @@ void func_80080524(s32 objectIndex) { object = &gObjectList[objectIndex]; object->model = d_course_bowsers_castle_dl_thwomp; object->boundingBoxSize = 0x000C; - object->itemDisplay = 0; + object->textureListIndex = 0; object->sizeScaling = 1.0f; set_object_flag_status_true(objectIndex, 0x04000220); object->type = 0; @@ -5864,7 +5867,7 @@ void func_80080524(s32 objectIndex) { break; } func_800722A4(objectIndex, 0x00000080); - func_80072488(objectIndex); + object_next_state(objectIndex); } void func_800806BC(s32 objectIndex) { @@ -6081,7 +6084,7 @@ void func_80081080(s32 objectIndex) { object->offset[1] = 0.0f; object->offset[2] = 0.0f; object->sizeScaling = 0.25f; - func_80072488(objectIndex); + object_next_state(objectIndex); } void func_800810F4(s32 objectIndex) { @@ -6096,7 +6099,7 @@ void func_800810F4(s32 objectIndex) { f32_step_up_towards(&gObjectList[objectIndex].offset[1], 14.0f, 0.5f); func_8007415C(objectIndex, &gObjectList[objectIndex].sizeScaling, 0.25f, 0.75f, 0.025f, 1, 0); if (func_80073B00(objectIndex, &gObjectList[objectIndex].primAlpha, 0x000000FF, 0, 4, 0, 0) != 0) { - func_80072488(objectIndex); + object_next_state(objectIndex); } break; case 3: @@ -6237,7 +6240,7 @@ void func_80081790(s32 objectIndex) { case 1: if (func_80087E08(objectIndex, gObjectList[objectIndex].velocity[1], 0.3f, gObjectList[objectIndex].unk_034, gObjectList[objectIndex].orientation[1], 0x00000032) != 0) { - func_80072488(objectIndex); + object_next_state(objectIndex); } object_calculate_new_pos_offset(objectIndex); break; @@ -6252,14 +6255,14 @@ void func_80081848(s32 objectIndex) { init_texture_object(objectIndex, d_course_moo_moo_farm_mole_tlut, (u8*) d_course_moo_moo_farm_mole_frames, 0x20U, (u16) 0x00000040); gObjectList[objectIndex].sizeScaling = 0.15f; - gObjectList[objectIndex].itemDisplay = 0; + gObjectList[objectIndex].textureListIndex = 0; set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f); set_obj_direction_angle(objectIndex, 0U, 0U, 0U); set_obj_orientation(objectIndex, 0U, 0U, 0x8000U); gObjectList[objectIndex].boundingBoxSize = 6; gObjectList[objectIndex].velocity[1] = 4.0f; set_object_flag_status_true(objectIndex, 0x04000000); - func_80072488(objectIndex); + object_next_state(objectIndex); } void func_80081924(s32 objectIndex) { @@ -6324,7 +6327,7 @@ void func_80081AFC(s32 objectIndex, s32 arg1) { case 0x2: if (object->unk_04C == 0) { func_80086EAC(objectIndex, 2, 1); - func_80072488(objectIndex); + object_next_state(objectIndex); set_object_flag_status_true(objectIndex, 0x00000200); } else { object->unk_04C--; @@ -6334,7 +6337,7 @@ void func_80081AFC(s32 objectIndex, s32 arg1) { if (object->unk_0AE == 0) { func_80086EAC(objectIndex, 2, 4); func_8008153C(objectIndex); - func_80072488(objectIndex); + object_next_state(objectIndex); func_800C98B8(object->pos, object->velocity, SOUND_ARG_LOAD(0x19, 0x01, 0x80, 0x07)); } break; @@ -6558,7 +6561,7 @@ void func_8008241C(s32 objectIndex, s32 arg1) { func_80086EF0(objectIndex); gObjectList[objectIndex].spline = D_800E633C[arg1 % 4]; set_object_flag_status_true(objectIndex, 0x00000800); - func_80072488(objectIndex); + object_next_state(objectIndex); } void func_80082714(s32 objectIndex, s32 arg1) { @@ -6652,8 +6655,8 @@ void init_ktb_crab(s32 objectIndex) { (u8*) d_course_koopa_troopa_beach_crab_frames, 0x40U, (u16) 0x00000040); object = &gObjectList[objectIndex]; object->sizeScaling = 0.15f; - object->itemDisplay = 0; - func_80072488(objectIndex); + object->textureListIndex = 0; + object_next_state(objectIndex); object->boundingBoxSize = 1; set_object_flag_status_true(objectIndex, 0x04000420); func_80086EAC(objectIndex, 0, 1); @@ -6755,7 +6758,7 @@ void func_80082F1C(s32 objectIndex, s32 arg1) { gObjectList[objectIndex].sizeScaling = 0.027f; if (test->rot && test->rot) {} test = &D_800E5DF4[arg1]; - func_80072488(objectIndex); + 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); @@ -6802,8 +6805,8 @@ void func_8008311C(s32 objectIndex, s32 arg1) { object->activeTexture = d_course_yoshi_valley_hedgehog; object->vertex = common_vtx_hedgehog; object->sizeScaling = 0.2f; - object->itemDisplay = 0; - func_80072488(objectIndex); + 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; @@ -6857,7 +6860,7 @@ void func_800833D0(s32 objectIndex, s32 arg1) { func_80072D3C(objectIndex, 0, 1, 4, -1); break; } - if (gObjectList[objectIndex].itemDisplay == 0) { + if (gObjectList[objectIndex].textureListIndex == 0) { gObjectList[objectIndex].vertex = common_vtx_hedgehog; } else { gObjectList[objectIndex].vertex = D_0D006130; @@ -6926,7 +6929,7 @@ void func_8008379C(s32 objectIndex) { if (func_80087E08(objectIndex, gObjectList[objectIndex].velocity[1], 0.74f, gObjectList[objectIndex].unk_034, gObjectList[objectIndex].direction_angle[1], 0x00000064) != 0) { - func_80072488(objectIndex); + object_next_state(objectIndex); } break; case 2: @@ -6946,8 +6949,8 @@ void func_80083868(s32 objectIndex) { object = &gObjectList[objectIndex]; object->vertex = D_0D0061B0; object->sizeScaling = 0.1f; - object->itemDisplay = 0; - func_80072488(objectIndex); + 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; @@ -7009,8 +7012,8 @@ void func_80083B0C(s32 objectIndex) { 0x40U, (u16) 0x00000040); gObjectList[objectIndex].vertex = common_vtx_hedgehog; gObjectList[objectIndex].sizeScaling = 0.1f; - gObjectList[objectIndex].itemDisplay = 0; - func_80072488(objectIndex); + gObjectList[objectIndex].textureListIndex = 0; + object_next_state(objectIndex); set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f); gObjectList[objectIndex].orientation[0] = 0; gObjectList[objectIndex].orientation[1] = 0; @@ -7035,22 +7038,22 @@ void func_80083C04(s32 objectIndex) { func_80083B0C(objectIndex); break; case 2: - func_8007278C(objectIndex, 0x00000096); + set_and_run_timer_object(objectIndex, 0x00000096); break; case 10: - if (func_8007278C(objectIndex, 0x0000012C) != 0) { + if (set_and_run_timer_object(objectIndex, 0x0000012C) != 0) { func_800722A4(objectIndex, 2); } break; case 11: - if (func_8007278C(objectIndex, 0x0000000A) != 0) { + if (set_and_run_timer_object(objectIndex, 0x0000000A) != 0) { set_object_flag_status_true(objectIndex, 0x00000010); object->sizeScaling = 0.001f; } break; case 12: if (func_80074118(objectIndex, &object->sizeScaling, 0.001f, 0.1f, 0.0025f, 0, 0) != 0) { - func_80072488(objectIndex); + object_next_state(objectIndex); } break; case 13: @@ -7118,7 +7121,7 @@ void func_80083F18(s32 objectIndex) { if (func_80087E08(objectIndex, gObjectList[objectIndex].velocity[1], 0.12f, gObjectList[objectIndex].unk_034, gObjectList[objectIndex].direction_angle[1], 0x00000064) != 0) { - func_80072488(objectIndex); + object_next_state(objectIndex); } object_calculate_new_pos_offset(objectIndex); break; @@ -7208,7 +7211,7 @@ void func_80084430(s32 objectIndex, UNUSED s32 arg1) { object->spline = D_800E672C[0]; set_object_flag_status_true(objectIndex, 0x04000800); object->type = get_animation_length(d_course_sherbet_land_unk_data11, 0); - func_80072488(objectIndex); + object_next_state(objectIndex); } void func_8008453C(s32 objectIndex, s32 arg1) { @@ -7326,7 +7329,7 @@ void func_800845C8(s32 objectIndex, s32 arg1) { func_80086EF0(objectIndex); object->unk_034 = 0.0f; object->type = get_animation_length(d_course_sherbet_land_unk_data11, 0); - func_80072488(objectIndex); + object_next_state(objectIndex); } void func_80084B7C(s32 objectIndex, s32 arg1) { @@ -7355,7 +7358,7 @@ void func_80084B7C(s32 objectIndex, s32 arg1) { break; case 4: func_800722CC(objectIndex, 2); - func_80072488(objectIndex); + object_next_state(objectIndex); break; } if (func_80072320(objectIndex, 0x00000020) != 0) { @@ -7398,7 +7401,7 @@ void func_80084D2C(s32 objectIndex, s32 arg1) { func_800722A4(objectIndex, 2); gObjectList[objectIndex].unk_09C = 1; gObjectList[objectIndex].unk_0D8 = 1; - gObjectList[objectIndex].itemDisplay = 0; + gObjectList[objectIndex].textureListIndex = 0; gObjectList[objectIndex].type = get_animation_length(d_course_sherbet_land_unk_data11, gObjectList[objectIndex].unk_0D8); func_800726CC(objectIndex, 3); @@ -7439,7 +7442,7 @@ void func_80084D2C(s32 objectIndex, s32 arg1) { if (func_80087060(objectIndex, 0x0000000A) != 0) { func_800722A4(objectIndex, 2); gObjectList[objectIndex].unk_0D8 = 2; - gObjectList[objectIndex].itemDisplay = 0; + gObjectList[objectIndex].textureListIndex = 0; gObjectList[objectIndex].type = get_animation_length(d_course_sherbet_land_unk_data11, gObjectList[objectIndex].unk_0D8); func_800726CC(objectIndex, 3); @@ -7449,7 +7452,7 @@ void func_80084D2C(s32 objectIndex, s32 arg1) { case 6: if (func_80072354(objectIndex, 2) != 0) { gObjectList[objectIndex].unk_0D8 = 0; - gObjectList[objectIndex].itemDisplay = 0; + gObjectList[objectIndex].textureListIndex = 0; gObjectList[objectIndex].type = get_animation_length(d_course_sherbet_land_unk_data11, gObjectList[objectIndex].unk_0D8); gObjectList[objectIndex].unk_0C6 += 0x8000; @@ -7567,7 +7570,7 @@ void init_hot_air_balloon(s32 objectIndex) { func_80086EF0(objectIndex); gObjectList[objectIndex].velocity[1] = -2.0f; init_actor_hot_air_balloon_item_box(0.0f, 0.0f, 0.0f); - func_80072488(objectIndex); + object_next_state(objectIndex); } void func_80085534(s32 objectIndex) { @@ -7666,7 +7669,7 @@ void func_80085878(s32 objectIndex, s32 arg1) { set_obj_direction_angle(objectIndex, 0U, 0U, 0U); object->unk_034 = 4.0f; object->type = get_animation_length(d_rainbow_road_unk3, 0); - func_80072488(objectIndex); + object_next_state(objectIndex); } void func_800859C8(s32 objectIndex, s32 arg1) { @@ -7712,7 +7715,7 @@ void func_80085BB4(s32 objectIndex) { gObjectList[objectIndex].sizeScaling = 8.0f; set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f); set_obj_orientation(objectIndex, 0U, 0U, 0x8000U); - func_80072488(objectIndex); + object_next_state(objectIndex); } void init_obj_neon_mushroom(s32 objectIndex) { @@ -7734,13 +7737,13 @@ void func_80085CA0(s32 objectIndex) { func_80072D3C(objectIndex, 3, 4, 4, 0x0000000A); break; case 4: - func_8007278C(objectIndex, 0x00000014); + set_and_run_timer_object(objectIndex, 0x00000014); break; case 5: func_80072E54(objectIndex, 0, 4, 1, 0x0000000C, 5); break; case 6: - func_8007278C(objectIndex, 0x00000014); + set_and_run_timer_object(objectIndex, 0x00000014); break; case 7: func_80072D3C(objectIndex, 3, 4, 0, 0x00000014); @@ -7800,13 +7803,13 @@ void func_80085F74(s32 objectIndex) { func_80072E54(objectIndex, 0, 4, 1, 5, 1); break; case 3: - func_8007278C(objectIndex, 0x0000001E); + set_and_run_timer_object(objectIndex, 0x0000001E); break; case 4: func_80072C00(objectIndex, 4, 0, 7); break; case 5: - func_8007278C(objectIndex, 0x0000001E); + set_and_run_timer_object(objectIndex, 0x0000001E); break; case 6: func_80072F88(objectIndex, 3, 0, 1, 5, 1); @@ -7905,7 +7908,7 @@ void func_8008629C(s32 objectIndex, s32 arg1) { set_obj_origin_offset(objectIndex, 0.0f, -10.0f, 0.0f); set_obj_direction_angle(objectIndex, 0U, 0xF8E4U, 0U); gObjectList[objectIndex].unk_048 = 0; - func_80072488(objectIndex); + object_next_state(objectIndex); } void func_80086424(s32 objectIndex) { @@ -7937,10 +7940,10 @@ void func_80086528(s32 objectIndex, s32 arg1) { func_8008629C(objectIndex, arg1); break; case 2: - if (func_8007278C(objectIndex, gObjectList[objectIndex].unk_04C) != 0) { + if (set_and_run_timer_object(objectIndex, gObjectList[objectIndex].unk_04C) != 0) { func_80091440(arg1); func_80086E70(objectIndex); - func_80072488(objectIndex); + object_next_state(objectIndex); } break; case 0: @@ -7948,7 +7951,7 @@ void func_80086528(s32 objectIndex, s32 arg1) { case 3: if (gObjectList[objectIndex].unk_0AE == 0) { gObjectList[objectIndex].unk_048 = 1; - func_80072488(objectIndex); + object_next_state(objectIndex); } break; } @@ -8012,7 +8015,7 @@ void func_80086700(s32 objectIndex) { set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f); set_obj_direction_angle(objectIndex, 0U, 0U, 0U); gObjectList[objectIndex].unk_084[1] = 0x0200; - func_80072488(objectIndex); + object_next_state(objectIndex); func_80086E70(objectIndex); } diff --git a/src/update_objects.h b/src/update_objects.h index c13f1a316..2984b0434 100644 --- a/src/update_objects.h +++ b/src/update_objects.h @@ -26,11 +26,11 @@ void func_800722CC(s32, s32); void func_800722F8(s32, s32); bool func_80072320(s32, s32); bool func_80072354(s32, s32); -void set_object_unk_0CB(s32, s32); +void set_object_timer_state(s32, s32); void init_object(s32, s32); void func_80072408(s32); void func_80072428(s32); -void func_80072488(s32); +void object_next_state(s32); void func_800724DC(s32); void func_800724F8(s32, s32); s16 func_80072530(s32); @@ -41,7 +41,7 @@ void func_8007266C(s32); void func_800726CC(s32, s32); void func_8007271C(s32, s32); void func_8007274C(s32); -s32 func_8007278C(s32, s32); +s32 set_and_run_timer_object(s32, s32); s32 func_8007281C(s32, s32); s32 func_800728B0(s32, s32, s32); void func_80072950(s32, s32, s32, s32);