From 4f714c2d5a76f194c57e471541dd37b4c1b75b0e Mon Sep 17 00:00:00 2001 From: Nabnut Date: Thu, 19 Sep 2024 12:31:53 +0200 Subject: [PATCH] Renaming boolean values --- include/functions.h | 2 - src/BGS/ch/yumblie.c | 15 ++-- src/BGS/code_3420.c | 2 +- src/FP/ch/twinklybox.c | 2 +- src/FP/code_A1C0.c | 2 +- src/MMM/ch/napper.c | 2 +- src/MMM/code_2040.c | 2 +- src/TTC/ch/nipper.c | 4 +- src/core1/code_10A00.c | 4 +- src/core1/memory.c | 2 +- src/core2/bs/bSwim.c | 2 +- src/core2/code_33C30.c | 2 +- src/core2/code_33F90.c | 4 +- src/core2/code_4A6F0.c | 2 +- src/core2/code_4C020.c | 2 +- src/core2/code_581D0.c | 2 +- src/core2/code_5BEB0.c | 2 +- src/core2/code_7AF80.c | 6 +- src/core2/code_91E10.c | 6 +- src/core2/code_9B180.c | 5 +- src/core2/code_A4D00.c | 142 ++++++++++++++++++++--------------- src/core2/gc/pauseMenu.c | 4 +- src/core2/gc/zoombox.c | 6 +- src/core2/mapspecificflags.c | 4 +- src/core2/modelRender.c | 2 +- src/core2/particle.c | 2 +- src/lair/ch/cauldron.c | 4 +- 27 files changed, 130 insertions(+), 104 deletions(-) diff --git a/include/functions.h b/include/functions.h index d600b572..bf0a12cf 100644 --- a/include/functions.h +++ b/include/functions.h @@ -25,8 +25,6 @@ extern f32 fabsf(f32); #pragma intrinsic (fabsf) -#define AS_BOOL(expr) ((expr) ? TRUE : FALSE) - #define TUPLE_ASSIGN(out, a, b, c) {\ out[0] = a;\ out[1] = b;\ diff --git a/src/BGS/ch/yumblie.c b/src/BGS/ch/yumblie.c index 4bceaa3e..11a90129 100644 --- a/src/BGS/ch/yumblie.c +++ b/src/BGS/ch/yumblie.c @@ -41,13 +41,16 @@ bool func_8038B160(Actor *this){ local = (ActorLocal_Yumblie *)&this->local; temp_v0 = func_8038A9E0(local->game_marker); - if ((temp_v0 == 1) || (temp_v0 == 4)) - return FALSE; - - if ((temp_v0 == 2) || (temp_v0 == 5)) - return (0.7 <= randf ()) ? TRUE : FALSE; - return (randf () >= 0.5)? TRUE : FALSE; + if ((temp_v0 == 1) || (temp_v0 == 4)) { + return FALSE; + } + + if ((temp_v0 == 2) || (temp_v0 == 5)) { + return BOOL(0.7 <= randf()); + } + + return BOOL(randf() >= 0.5); } void chyumblie_set_state(Actor* this, enum chyumblie_state_e next_state){ diff --git a/src/BGS/code_3420.c b/src/BGS/code_3420.c index 7da9da10..8ac58faf 100644 --- a/src/BGS/code_3420.c +++ b/src/BGS/code_3420.c @@ -693,7 +693,7 @@ void chvilegame_update(Actor *this) { if (item_empty(ITEM_6_HOURGLASS)) { if (volatileFlag_get(VOLATILE_FLAG_2_FF_IN_MINIGAME)) { volatileFlag_set(VOLATILE_FLAG_3, 0); - volatileFlag_set(VOLATILE_FLAG_5_FF_MINIGAME_WON, ( local->vile_score < local->player_score) ? TRUE : FALSE); + volatileFlag_set(VOLATILE_FLAG_5_FF_MINIGAME_WON, BOOL(local->vile_score < local->player_score)); func_8038A068(this, 1); } else if (local->vile_score < local->player_score) { if (local->unkC == 3) { diff --git a/src/FP/ch/twinklybox.c b/src/FP/ch/twinklybox.c index 1de52093..4a97ea5f 100644 --- a/src/FP/ch/twinklybox.c +++ b/src/FP/ch/twinklybox.c @@ -279,7 +279,7 @@ void func_8038D6C8(Actor *this){ bool sp20; sp24 = time_getDelta(); - mapSpecificFlags_set(0xd, (this->state != 1 && this->state != 2) ? TRUE : FALSE); + mapSpecificFlags_set(0xd, BOOL(this->state != 1 && this->state != 2)); if(func_8038BFA0() || fileProgressFlag_get(FILEPROG_13_COMPLETED_TWINKLIES_MINIGAME)){ this->marker->propPtr->unk8_3 = FALSE; diff --git a/src/FP/code_A1C0.c b/src/FP/code_A1C0.c index 88b58803..52c42f06 100644 --- a/src/FP/code_A1C0.c +++ b/src/FP/code_A1C0.c @@ -17,5 +17,5 @@ void func_803905B0(Actor *this){ this->volatile_initialized = TRUE; actor_collisionOff(this); } - this->marker->propPtr->unk8_3 = func_8038DD14(this) ? TRUE : FALSE; + this->marker->propPtr->unk8_3 = BOOL(func_8038DD14(this)); } diff --git a/src/MMM/ch/napper.c b/src/MMM/ch/napper.c index b2357293..78afd1b3 100644 --- a/src/MMM/ch/napper.c +++ b/src/MMM/ch/napper.c @@ -80,7 +80,7 @@ Actor *chnapper_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ } else { func_8033A45C(1, FALSE); - func_8033A45C(2, (local->unk10) ? TRUE : FALSE); + func_8033A45C(2, BOOL(local->unk10)); func_8033A45C(3, (local->unk10) ? FALSE : TRUE); } diff --git a/src/MMM/code_2040.c b/src/MMM/code_2040.c index 54c5c0a2..597967a1 100644 --- a/src/MMM/code_2040.c +++ b/src/MMM/code_2040.c @@ -287,7 +287,7 @@ void func_80388BDC(Actor *this) { f64 phi_f0; func_802D3D74(this); - mapSpecificFlags_set(1, ((this->yaw > 260.0f) && (this->yaw < 330.0f)) ? TRUE : FALSE); + mapSpecificFlags_set(1, BOOL((this->yaw > 260.0f) && (this->yaw < 330.0f))); if (!this->volatile_initialized) { if (this->yaw != 0.0f) { this->lifetime_value = 0.5f; diff --git a/src/TTC/ch/nipper.c b/src/TTC/ch/nipper.c index 3dfc48e0..0a9e4679 100644 --- a/src/TTC/ch/nipper.c +++ b/src/TTC/ch/nipper.c @@ -112,11 +112,11 @@ bool func_80388088(Actor *this){ return FALSE; } - return (-35.0f < sp2C && sp2C < 35.0f) ? TRUE : FALSE; + return BOOL(-35.0f < sp2C && sp2C < 35.0f); } bool func_8038812C(Actor *this){ - return (func_80329530(this, 1300) && func_80388088(this)) ? TRUE : FALSE; + return BOOL(func_80329530(this, 1300) && func_80388088(this)); } void func_80388178(ActorMarker *this_marker, ActorMarker *other_marker) { diff --git a/src/core1/code_10A00.c b/src/core1/code_10A00.c index 9e485021..7520a9b1 100644 --- a/src/core1/code_10A00.c +++ b/src/core1/code_10A00.c @@ -314,8 +314,8 @@ void pfsManager_init(void){ osStartThread(&pfsManagerThread); } -bool pfsManager_contErr(void){ - return pfsManagerContStatus.errno ? TRUE : FALSE; +bool pfsManager_contErr(void) { + return BOOL(pfsManagerContStatus.errno); } void func_8024F150(void){ diff --git a/src/core1/memory.c b/src/core1/memory.c index 0c9916eb..56784333 100644 --- a/src/core1/memory.c +++ b/src/core1/memory.c @@ -251,7 +251,7 @@ u32 heap_get_occupied_size(void){ bool func_8025498C(s32 size){ s32 v0 = func_802549BC(size); - return v0 ? TRUE : FALSE; + return BOOL(v0); } EmptyHeapBlock *func_802549BC(s32 size){ diff --git a/src/core2/bs/bSwim.c b/src/core2/bs/bSwim.c index 804d4d19..a862f573 100644 --- a/src/core2/bs/bSwim.c +++ b/src/core2/bs/bSwim.c @@ -384,7 +384,7 @@ void func_802A7F4C(void){ } void func_802A7F6C(void) { - D_8037D394 = (bs_getPrevState() == BS_41_DIE) ? TRUE : FALSE; + D_8037D394 = BOOL(bs_getPrevState() == BS_41_DIE); if (D_8037D394 || level_get() == LEVEL_9_RUSTY_BUCKET_BAY || map_get() == MAP_46_CCW_WINTER) { D_8037D395 = 0; diff --git a/src/core2/code_33C30.c b/src/core2/code_33C30.c index b204c1e6..fb0ed47a 100644 --- a/src/core2/code_33C30.c +++ b/src/core2/code_33C30.c @@ -26,7 +26,7 @@ void func_802BAC10(void){ } bool func_802BAC1C(void) { - return (func_80320EB0(D_8037D810, 100.0f, 1) != NULL) ? TRUE : FALSE; + return BOOL(func_80320EB0(D_8037D810, 100.0f, 1) != NULL); } void func_802BAC58(void) { diff --git a/src/core2/code_33F90.c b/src/core2/code_33F90.c index daa931d8..ee9e4b59 100644 --- a/src/core2/code_33F90.c +++ b/src/core2/code_33F90.c @@ -481,8 +481,8 @@ void func_802BB22C(void){ } } -bool func_802BB270(void){ - return (!D_80364E00) ? TRUE : FALSE; +bool func_802BB270(void) { + return BOOL(!D_80364E00); } s32 func_802BB294(void){ diff --git a/src/core2/code_4A6F0.c b/src/core2/code_4A6F0.c index 611bbb03..6298ab28 100644 --- a/src/core2/code_4A6F0.c +++ b/src/core2/code_4A6F0.c @@ -105,7 +105,7 @@ bool chMumbo_withinHorzDistToPlayer(s32 x, s32 z, s32 dist) { bool chMumbo_func_802D181C(s32 arg0) { s32 search_start_cube[3] = D_80367504; - return (cubeList_findNodePropByActorId(arg0, search_start_cube))? TRUE : FALSE; + return BOOL(cubeList_findNodePropByActorId(arg0, search_start_cube)); } void chMumbo_func_802D186C(Actor *this) { diff --git a/src/core2/code_4C020.c b/src/core2/code_4C020.c index fdf48337..fdbb74d8 100644 --- a/src/core2/code_4C020.c +++ b/src/core2/code_4C020.c @@ -505,7 +505,7 @@ bool func_802D42F8(Actor *this) { void func_802D4388(Actor *this){ func_802D3CE8(this); - this->unk38_0 = ( map_get() == MAP_7A_GL_CRYPT || item_getCount(ITEM_1C_MUMBO_TOKEN) >= this->unkF4_8 || func_802D42F8(this)) ? TRUE : FALSE; + this->unk38_0 = BOOL(map_get() == MAP_7A_GL_CRYPT || item_getCount(ITEM_1C_MUMBO_TOKEN) >= this->unkF4_8 || func_802D42F8(this)); mapSpecificFlags_set(0x1F, (func_8028F20C() && func_8028FB48(0x78000000)) || func_8028ECAC() == BSGROUP_D_TRANSFORMING); switch(this->state){ case 0x12: //L802D4468 diff --git a/src/core2/code_581D0.c b/src/core2/code_581D0.c index f10f08f5..a112f62d 100644 --- a/src/core2/code_581D0.c +++ b/src/core2/code_581D0.c @@ -70,7 +70,7 @@ void func_802DF2C4(Actor *this) { for( i = 0; i < 20; i++){ prev_val = D_8037E008[i]; temp_v0 = func_8034C2C4(this->marker, i + 0x190); - D_8037E008[i] = (i == temp_fp) ? TRUE : FALSE; + D_8037E008[i] = BOOL(i == temp_fp); if (prev_val != D_8037E008[i] ) { val = D_8037E008[i]; switch(val){ diff --git a/src/core2/code_5BEB0.c b/src/core2/code_5BEB0.c index d24f6e0c..ca102b92 100644 --- a/src/core2/code_5BEB0.c +++ b/src/core2/code_5BEB0.c @@ -100,7 +100,7 @@ void mapSavestate_apply(enum map_e map_id) { func_803083B0(-1); while ( - bit_value = AS_BOOL((((u32*)D_8037E650[map_id])[iBit >> 5] & (1 << (iBit & 0x1f)))), + bit_value = BOOL(((u32*)D_8037E650[map_id])[iBit >> 5] & (1 << (iBit & 0x1f))), func_803083B0(bit_value) != -1 ) { iBit++; diff --git a/src/core2/code_7AF80.c b/src/core2/code_7AF80.c index 1b82efa4..c0f6b294 100644 --- a/src/core2/code_7AF80.c +++ b/src/core2/code_7AF80.c @@ -1384,8 +1384,8 @@ void func_80305CD8(s32 arg0, s32 arg1){ } } -bool func_80305D14(void){ - return (D_8036ABA4 != NULL) ? TRUE : FALSE; +bool func_80305D14(void) { + return BOOL(D_8036ABA4 != NULL); } void func_80305D38(void){ @@ -2435,5 +2435,5 @@ void func_80308F0C(Cube *cube) { } bool func_80308F54(s32 cube_index) { - return D_803821E0[cube_index >> 5] & (1 << (cube_index & 0x1F))? TRUE: FALSE; + return BOOL(D_803821E0[cube_index >> 5] & (1 << (cube_index & 0x1F))); } diff --git a/src/core2/code_91E10.c b/src/core2/code_91E10.c index 5685170f..43eb94a7 100644 --- a/src/core2/code_91E10.c +++ b/src/core2/code_91E10.c @@ -402,9 +402,11 @@ void func_803197AC(s32 arg0){ item_set(ITEM_6_HOURGLASS, TRUE); D_803830E0->unk15 = 0; D_803830E0->unk13 = 1U; - for(i = 1; i < 4; i++){ - func_80319758(i, (i == D_803830E0->unk13) ? TRUE : FALSE); + + for (i = 1; i < 4; i++) { + func_80319758(i, BOOL(i == D_803830E0->unk13)); } + break; case 7: //80319C0C diff --git a/src/core2/code_9B180.c b/src/core2/code_9B180.c index 8e70782c..e67f7b51 100644 --- a/src/core2/code_9B180.c +++ b/src/core2/code_9B180.c @@ -175,7 +175,6 @@ void func_803224FC(void) { } } - -void func_803225B0(s32 arg0, s32 arg1){ - D_80383330 =(arg1 == 2) ? TRUE : FALSE; +void func_803225B0(s32 arg0, s32 arg1) { + D_80383330 = BOOL(arg1 == 2); } diff --git a/src/core2/code_A4D00.c b/src/core2/code_A4D00.c index 1f4b6042..3f258024 100644 --- a/src/core2/code_A4D00.c +++ b/src/core2/code_A4D00.c @@ -3,15 +3,22 @@ #include "variables.h" #include "structs.h" -extern s32 func_80244E54(f32[3], f32[3], f32 [3], u32, f32, f32); +extern s32 func_80244E54(f32[3], f32[3], f32 [3], u32, f32, f32); + extern void func_80244F00(f32[3], f32, f32, s32, s32); -extern s32 func_80320DB0(f32[3], f32, f32[3], u32); +extern s32 func_80320DB0(f32[3], f32, f32[3], u32); + extern void func_80320ED8(ActorMarker *, f32, s32); -extern f32 func_8033229C(ActorMarker *marker); -extern f32 func_80309B24(f32 [3]); -extern f32 ml_dotProduct_vec3f(f32[3], f32[3]); -extern f32 ml_distanceSquared_vec3f(f32[3], f32[3]); + +extern f32 func_8033229C(ActorMarker *marker); + +extern f32 func_80309B24(f32 [3]); + +extern f32 ml_dotProduct_vec3f(f32[3], f32[3]); + +extern f32 ml_distanceSquared_vec3f(f32[3], f32[3]); + extern BKCollisionTri *func_80320C94(f32 arg0[3], f32 arg1[3], f32 arg2, f32 arg3[3], s32 arg4, u32 arg5); /* .h */ @@ -20,7 +27,7 @@ typedef bool (*method_core2_A4D00_0)(Actor *, f32[3], s32, s32); typedef struct { f32 unk0[3]; f32 unkC[3]; - BKCollisionTri * unk18; + BKCollisionTri *unk18; f32 unk1C[3]; f32 unk28[3]; f32 unk34[3]; @@ -28,43 +35,54 @@ typedef struct { f32 unk44[3]; u8 pad50[0x3C]; s32 unk8C; -}Struct_A4D00; +} Struct_A4D00; bool func_8032BC90(Actor *actor, f32 arg1[3], s32 arg2, s32 arg3); + bool func_8032BD88(Actor *arg0, f32 arg1[3], s32 arg2, s32 arg3); + bool func_8032C280(Actor *arg0, f32 arg1[3], s32 arg2, s32 arg3); + bool func_8032C2F0(Actor *arg0, f32 arg1[3], s32 arg2, s32 arg3); + bool func_8032C404(Actor *arg0, f32 arg1[3], s32 arg2, s32 arg3); + bool func_8032C4AC(Actor *arg0, f32 arg1[3], s32 arg2, s32 arg3); + bool func_8032C660(Actor *arg0, f32 arg1[3], s32 arg2, s32 arg3); + bool func_8032C6E0(Actor *actor, f32 arg1[3], s32 arg2, s32 arg3); + bool func_8032C79C(Actor *arg0, f32 arg1[3], s32 arg2, s32 arg3); + bool func_8032C99C(Actor *actor, f32 arg1[3], s32 arg2, s32 arg3); + bool func_8032C9C0(Actor *actor, f32 arg1[3], s32 arg2, s32 arg3); + bool func_8032CA40(Actor *actor, f32 arg1[3], s32 arg2, s32 arg3); /* .data */ method_core2_A4D00_0 D_8036E5D0[][6] = { - {func_8032C404, func_8032C4AC, NULL, func_8032C280, NULL, func_8032C79C}, - {func_8032C404, func_8032C4AC, NULL, func_8032BD88, NULL, NULL}, - {func_8032C404, func_8032C4AC, NULL, NULL, NULL, func_8032C79C}, - {func_8032C404, func_8032C4AC, NULL, NULL, NULL, NULL}, - {func_8032C404, NULL, NULL, func_8032C280, NULL, func_8032C79C}, - {func_8032C404, NULL, NULL, func_8032BD88, NULL, NULL}, - {func_8032C404, NULL, NULL, NULL, NULL, func_8032C79C}, - {func_8032C404, NULL, NULL, NULL, NULL, NULL}, - {func_8032C2F0, func_8032C660, NULL, func_8032C280, NULL, func_8032C79C}, - {func_8032C2F0, func_8032C660, NULL, func_8032BD88, NULL, NULL}, - {func_8032C2F0, func_8032C660, NULL, func_8032C280, func_8032CA40, func_8032C79C}, - {func_8032C2F0, func_8032C660, NULL, func_8032BD88, func_8032CA40, NULL}, - { NULL, NULL, NULL, func_8032BC90, NULL, NULL}, - {func_8032C2F0, func_8032C4AC, NULL, func_8032C280, NULL, func_8032C6E0}, - {func_8032C2F0, func_8032C660, NULL, NULL, NULL, func_8032C6E0}, - {func_8032C2F0, func_8032C660, NULL, func_8032BD88, NULL, func_8032C6E0}, - { NULL, NULL, NULL, func_8032BC90, NULL, func_8032C6E0}, - {func_8032C404, func_8032C4AC, func_8032C9C0, func_8032C280, NULL, func_8032C79C}, - {func_8032C404, func_8032C4AC, func_8032C99C, func_8032C280, NULL, func_8032C79C}, - {func_8032C404, NULL, NULL, NULL, NULL, func_8032C6E0} + {func_8032C404, func_8032C4AC, NULL, func_8032C280, NULL, func_8032C79C}, + {func_8032C404, func_8032C4AC, NULL, func_8032BD88, NULL, NULL}, + {func_8032C404, func_8032C4AC, NULL, NULL, NULL, func_8032C79C}, + {func_8032C404, func_8032C4AC, NULL, NULL, NULL, NULL}, + {func_8032C404, NULL, NULL, func_8032C280, NULL, func_8032C79C}, + {func_8032C404, NULL, NULL, func_8032BD88, NULL, NULL}, + {func_8032C404, NULL, NULL, NULL, NULL, func_8032C79C}, + {func_8032C404, NULL, NULL, NULL, NULL, NULL}, + {func_8032C2F0, func_8032C660, NULL, func_8032C280, NULL, func_8032C79C}, + {func_8032C2F0, func_8032C660, NULL, func_8032BD88, NULL, NULL}, + {func_8032C2F0, func_8032C660, NULL, func_8032C280, func_8032CA40, func_8032C79C}, + {func_8032C2F0, func_8032C660, NULL, func_8032BD88, func_8032CA40, NULL}, + {NULL, NULL, NULL, func_8032BC90, NULL, NULL}, + {func_8032C2F0, func_8032C4AC, NULL, func_8032C280, NULL, func_8032C6E0}, + {func_8032C2F0, func_8032C660, NULL, NULL, NULL, func_8032C6E0}, + {func_8032C2F0, func_8032C660, NULL, func_8032BD88, NULL, func_8032C6E0}, + {NULL, NULL, NULL, func_8032BC90, NULL, func_8032C6E0}, + {func_8032C404, func_8032C4AC, func_8032C9C0, func_8032C280, NULL, func_8032C79C}, + {func_8032C404, func_8032C4AC, func_8032C99C, func_8032C280, NULL, func_8032C79C}, + {func_8032C404, NULL, NULL, NULL, NULL, func_8032C6E0} }; /* .bss */ @@ -89,14 +107,14 @@ bool func_8032BC90(Actor *actor, f32 arg1[3], s32 arg2, s32 arg3) { } actor->marker->propPtr->unk8_3 = sp40; - return (phi_v0)? 1 : 0; + return (phi_v0) ? 1 : 0; } -void func_8032BD64(f32 arg0[3]){ +void func_8032BD64(f32 arg0[3]) { ml_vec3f_copy(arg0, D_803833D8); } -bool func_8032BD88(Actor *arg0, f32 arg1[3], s32 arg2, s32 arg3){ +bool func_8032BD88(Actor *arg0, f32 arg1[3], s32 arg2, s32 arg3) { s32 i; s32 temp_s7; Struct_A4D00 *var_fp; @@ -117,7 +135,7 @@ bool func_8032BD88(Actor *arg0, f32 arg1[3], s32 arg2, s32 arg3){ temp_s7 = arg0->unk154; var_f24 = func_8033229C(arg0->marker); var_fp = NULL; - sp290 = arg0->marker->propPtr->unk8_3; + sp290 = arg0->marker->propPtr->unk8_3; arg0->marker->propPtr->unk8_3 = 0; ml_vec3f_diff_copy(sp278, arg0->position, arg1); sp284[0] = arg1[0] - arg0->position[0]; @@ -127,22 +145,24 @@ bool func_8032BD88(Actor *arg0, f32 arg1[3], s32 arg2, s32 arg3){ sp29C = TRUE; var_f24 = var_f24 * 0.6; var_f22 = MAX(arg0->marker->unk38[1], var_f24 * 1.25); - } else { - if (!spBC[i].unk44){} + } + else { + if (!spBC[i].unk44) {} sp29C = FALSE; var_f24 = var_f24 * 0.5; var_f22 = arg0->marker->unk38[1]; } func_80244F00(arg1, var_f24, var_f22, sp29C, temp_s7); sp88 = ((var_f24 * 2) - 4); - sp84 = sp88* sp88; + sp84 = sp88 * sp88; - for(i = 0; i < 3; i++){ + for (i = 0; i < 3; i++) { var_s2 = (i != 0) ? &spBC[i - 1] : NULL; if (i != 0) { ml_vec3f_copy(spBC[i].unk0, var_s2->unk0); ml_vec3f_copy(spBC[i].unkC, var_s2->unkC); - } else { + } + else { ml_vec3f_copy(spBC[i].unk0, arg0->position); ml_vec3f_copy(spBC[i].unkC, arg1); } @@ -154,10 +174,11 @@ bool func_8032BD88(Actor *arg0, f32 arg1[3], s32 arg2, s32 arg3){ spBC[i].unk0[1] = temp_f20; } } - } else { + } + else { spBC[i].unk40 = 0; } - + spBC[i].unk8C = sp29C; spBC[i].unk34[0] = spBC[i].unkC[0];\ spBC[i].unk34[1] = spBC[i].unkC[1] + var_f22;\ @@ -169,7 +190,7 @@ bool func_8032BD88(Actor *arg0, f32 arg1[3], s32 arg2, s32 arg3){ spBC[i].unk18 = func_80320C94(spBC[i].unk34, spBC[i].unk28, var_f24, spBC[i].unk1C, 3, temp_s7); - if(spBC[i].unk18 == NULL) + if (spBC[i].unk18 == NULL) break; var_fp = &spBC[i]; @@ -186,7 +207,8 @@ bool func_8032BD88(Actor *arg0, f32 arg1[3], s32 arg2, s32 arg3){ if (i == 3) { ml_vec3f_copy(arg0->position, arg1); - } else if (var_fp != NULL) { + } + else if (var_fp != NULL) { temp_f20 = gu_sqrtf((sp284[0] * sp284[0]) + (sp284[1] * sp284[1]) + (sp284[2] * sp284[2])); arg0->position[0] = var_fp->unk0[0]; arg0->position[1] = var_fp->unk0[1]; @@ -199,7 +221,8 @@ bool func_8032BD88(Actor *arg0, f32 arg1[3], s32 arg2, s32 arg3){ if (var_fp != NULL) { ml_vec3f_copy(D_803833D8, var_fp->unk1C); } - return (var_fp != NULL) ? TRUE : FALSE; + + return BOOL(var_fp != NULL); } bool func_8032C280(Actor *arg0, f32 arg1[3], s32 arg2, s32 arg3) { @@ -218,9 +241,9 @@ bool func_8032C2F0(Actor *arg0, f32 arg1[3], s32 arg2, s32 arg3) { sp6C[1] = 0.0f; sp6C[2] = 0.0f; guRotateRPYF(sp20[0], arg0->roll, 90.0f - arg0->yaw, arg0->pitch); - sp60[0] = (sp20[0][0]*sp6C[0]) + (sp20[0][1]*sp6C[1]) + (sp20[0][2]*sp6C[2]); - sp60[1] = (sp20[1][0]*sp6C[0]) + (sp20[1][1]*sp6C[1]) + (sp20[1][2]*sp6C[2]); - sp60[2] = (sp20[2][0]*sp6C[0]) + (sp20[2][1]*sp6C[1]) + (sp20[2][2]*sp6C[2]); + sp60[0] = (sp20[0][0] * sp6C[0]) + (sp20[0][1] * sp6C[1]) + (sp20[0][2] * sp6C[2]); + sp60[1] = (sp20[1][0] * sp6C[0]) + (sp20[1][1] * sp6C[1]) + (sp20[1][2] * sp6C[2]); + sp60[2] = (sp20[2][0] * sp6C[0]) + (sp20[2][1] * sp6C[1]) + (sp20[2][2] * sp6C[2]); arg0->position[0] += sp60[0]; arg0->position[1] += sp60[1]; arg0->position[2] += sp60[2]; @@ -249,7 +272,7 @@ bool func_8032C4AC(Actor *arg0, f32 arg1[3], s32 arg2, s32 arg3) { if (arg0->unk138_8) { arg0->position[1] = mapModel_getFloorY(arg0->position); } - else{ + else { sp30 = func_8033229C(arg0->marker) / 3.0; sp4C[0] = arg0->position[0]; sp4C[1] = arg0->position[1]; @@ -260,13 +283,14 @@ bool func_8032C4AC(Actor *arg0, f32 arg1[3], s32 arg2, s32 arg3) { sp40[2] = arg0->position[2]; sp40[1] += arg0->unk170; arg0->unk170 = (-sp30 < time_getDelta() * (arg0->unk170 * 40.0)) ? time_getDelta() * (arg0->unk170 * 40.0) - : -sp30; + : -sp30; if (func_80309B48(sp4C, sp40, sp34, 0x5E0000)) { arg0->unk170 = -10.0f; arg0->position[0] = sp40[0]; arg0->position[1] = sp40[1]; arg0->position[2] = sp40[2]; - } else { + } + else { arg0->position[1] = MAX(-100000.0f, arg0->position[1] + arg0->unk170); } } @@ -328,7 +352,7 @@ bool func_8032C850(Actor *actor, f32 arg1[3], s32 arg2, s32 arg3, bool nonactor) actor->marker->collidable = TRUE; func_80320ED8(actor->marker, temp_f0 / 2, 2); actor->marker->collidable = stored_collidability; - for(var_v1 = func_8032F528(); var_v1 != NULL; var_v1 = func_8032F528()) { + for (var_v1 = func_8032F528(); var_v1 != NULL; var_v1 = func_8032F528()) { if (nonactor || (var_v1->markerFlag && (var_v1->actorProp.marker->id == actor->marker->id))) { D_803833D0 = var_v1; actor->position[0] = (f32) arg1[0]; @@ -341,12 +365,12 @@ bool func_8032C850(Actor *actor, f32 arg1[3], s32 arg2, s32 arg3, bool nonactor) return FALSE; } -bool func_8032C99C(Actor *actor, f32 arg1[3], s32 arg2, s32 arg3){ +bool func_8032C99C(Actor *actor, f32 arg1[3], s32 arg2, s32 arg3) { return func_8032C850(actor, arg1, arg2, arg3, 1); } -bool func_8032C9C0(Actor *actor, f32 arg1[3], s32 arg2, s32 arg3){ +bool func_8032C9C0(Actor *actor, f32 arg1[3], s32 arg2, s32 arg3) { return func_8032C850(actor, arg1, arg2, arg3, 0); } @@ -358,13 +382,13 @@ void func_8032C9E0(f32 arg0[3]) { } } -bool func_8032CA40(Actor *actor, f32 arg1[3], s32 arg2, s32 arg3){ - bool var_v1 = (arg3 & 8) ? TRUE : FALSE; - if(var_v1){ - actor->position[0] = arg1[0]; - actor->position[1] = arg1[1]; - actor->position[2] = arg1[2]; +bool func_8032CA40(Actor *actor, f32 arg1[3], s32 arg2, s32 arg3) { + bool var_v1 = BOOL(arg3 & 8); + + if (var_v1) { + TUPLE_COPY(actor->position, arg1) } + return var_v1; } @@ -378,8 +402,8 @@ s32 func_8032CA80(Actor *actor, s32 arg1) { sp40[1] = actor->position[1]; sp40[2] = actor->position[2]; var_s1 = 0; - for(var_s0 = 0; var_s0 < 6; var_s0++){ - if(D_8036E5D0[arg1][var_s0] != NULL){ + for (var_s0 = 0; var_s0 < 6; var_s0++) { + if (D_8036E5D0[arg1][var_s0] != NULL) { temp_v0_2 = D_8036E5D0[arg1][var_s0](actor, sp40, arg1, var_s1); if (temp_v0_2 != 0) { var_s1 |= temp_v0_2 << var_s0; diff --git a/src/core2/gc/pauseMenu.c b/src/core2/gc/pauseMenu.c index 570a3130..ef0914dd 100644 --- a/src/core2/gc/pauseMenu.c +++ b/src/core2/gc/pauseMenu.c @@ -726,7 +726,7 @@ s32 gcpausemenu_80312D78(struct1As *arg0, s32 arg1) { for(var_s2 = 0; var_s2 < arg1; var_s2++){ if (arg0[var_s2].delay <= D_80383010.unkC) { if (!arg0[var_s2].unkF) { - var_v0 = func_803183A4(D_80383010.zoombox[var_s2], arg0[var_s2].str) ? TRUE : FALSE; + var_v0 = BOOL(func_803183A4(D_80383010.zoombox[var_s2], arg0[var_s2].str)); arg0[var_s2].unkF = var_v0; if (arg0[var_s2].unkF) { gczoombox_open(D_80383010.zoombox[var_s2]); @@ -835,7 +835,7 @@ void gcpausemenu_updateBButtonAndJoystickSprites(void) { } D_80383010.unk20 -= var_f0; } - D_80383010.left_joystick_visible = (D_80383010.selection != 0) ? TRUE : FALSE; + D_80383010.left_joystick_visible = BOOL(D_80383010.selection != 0); D_80383010.right_joystick_visible = (gcpausemenu_getMaxPage() == D_80383010.selection) ? FALSE : TRUE; D_80383010.unk28 += time_getDelta(); diff --git a/src/core2/gc/zoombox.c b/src/core2/gc/zoombox.c index 903cd8b9..248bbc83 100644 --- a/src/core2/gc/zoombox.c +++ b/src/core2/gc/zoombox.c @@ -1567,8 +1567,8 @@ void func_803184C8(GcZoombox *this, f32 arg1, s32 arg2, s32 arg3, f32 arg4, bool if (this->anim_ctrl != NULL) { animctrl_setDuration(this->anim_ctrl, arg4); } - this->unk1A4_12 = arg5 ? TRUE : FALSE; - this->unk1A4_10 = arg6 ? TRUE : FALSE; + this->unk1A4_12 = BOOL(arg5); + this->unk1A4_10 = BOOL(arg6); } } @@ -1617,7 +1617,7 @@ void func_80318640(GcZoombox *this, s32 arg1, f32 arg2, f32 arg3, s32 arg4) { } this->unk198 = arg2; this->unk194 = arg3; - this->unk1A4_15 = (arg4) ? TRUE : FALSE; + this->unk1A4_15 = BOOL(arg4); } } diff --git a/src/core2/mapspecificflags.c b/src/core2/mapspecificflags.c index 84414271..917e7e14 100644 --- a/src/core2/mapspecificflags.c +++ b/src/core2/mapspecificflags.c @@ -92,8 +92,8 @@ void bitfield_setBit(s32 *arg0, s32 arg1, bool arg2){ } } -bool bitfield_isBitSet(s32 *arg0, s32 arg1){ - return (arg0[(arg1 >> 5) + 1] & (1 << (arg1 & 0x1F))) ? TRUE : FALSE; +bool bitfield_isBitSet(s32 *arg0, s32 arg1) { + return BOOL(arg0[(arg1 >> 5) + 1] & (1 << (arg1 & 0x1F))); } void bitfield_setAll(s32 *arg0, bool arg1) { diff --git a/src/core2/modelRender.c b/src/core2/modelRender.c index d668334f..d3ec888b 100644 --- a/src/core2/modelRender.c +++ b/src/core2/modelRender.c @@ -1403,7 +1403,7 @@ f32 func_8033A244(f32 arg0){ } void func_8033A25C(bool arg0){ - D_80383704 = arg0 ? TRUE : FALSE; + D_80383704 = BOOL(arg0); } void func_8033A280(f32 arg0){ diff --git a/src/core2/particle.c b/src/core2/particle.c index 7d24aec4..76fd44b0 100644 --- a/src/core2/particle.c +++ b/src/core2/particle.c @@ -866,7 +866,7 @@ void partEmitMgr_defrag(void){ } void func_802F0E80(void* arg0, s32 arg1){ - partEmitMgrEnable = (arg1 == 2) ? TRUE : FALSE; + partEmitMgrEnable = BOOL(arg1 == 2); } void func_802F0EAC(ParticleEmitter *this, f32 arg1){ diff --git a/src/lair/ch/cauldron.c b/src/lair/ch/cauldron.c index 73b8fd58..cd960f3a 100644 --- a/src/lair/ch/cauldron.c +++ b/src/lair/ch/cauldron.c @@ -323,7 +323,7 @@ void chWarpCauldron_update(Actor *this) { for(sp3C = 0; D_803936E4[sp3C] < temp_f0; sp3C++) ; - this->unk38_0 = (sp3C & 1) ? TRUE : FALSE; + this->unk38_0 = BOOL(sp3C & 1); if (actor_animationIsAt(this, 0.95f)) { func_8038A704(this); fileProgressFlag_set(chWarpCauldron_getFileProgressFlagIndex(this), 1); @@ -435,7 +435,7 @@ Actor *chWarpCauldron_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) this = marker_getActor(marker); if(this->modelCacheIndex == ACTOR_23B_WARP_CAULDRON) { - func_8033A45C(3, this->unk38_0 ? TRUE : FALSE); + func_8033A45C(3, BOOL(this->unk38_0)); func_8033A45C(4, this->unk38_0 ? FALSE : TRUE); } this = actor_draw(marker, gfx, mtx, vtx);