diff --git a/README.md b/README.md index 018d3dd9..9c775894 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ This repo contains a work-in-progress decompilation of Diddy Kong Racing for the All versions are supported, and the US 1.0 version (SHA1 = 0cb115d8716dbbc2922fda38e533b9fe63bb9670) of the game is the default if not specified. -As of July 3, 2025, this is our current score: +As of July 4, 2025, this is our current score: -    Decomp progress: 96.43% +    Decomp progress: 96.67%     Documentation progress: 62.43% @@ -117,20 +117,20 @@ s32 is_drumstick_unlocked(void) { ``` -As of July 3, 2025, this is our current score: +As of July 4, 2025, this is our current score: ``` ====================================================================== ADVENTURE ONE (ASM -> C Decompilation) - --------------- 96.43% Complete (97.33% NON_MATCHING) ---------------- - # Decompiled functions: 1939 - # GLOBAL_ASM remaining: 13 + --------------- 96.67% Complete (97.57% NON_MATCHING) ---------------- + # Decompiled functions: 1940 + # GLOBAL_ASM remaining: 12 # NON_MATCHING functions: 5 - # NON_EQUIVALENT WIP functions: 8 + # NON_EQUIVALENT WIP functions: 7 ---------------------------- Game Status ----------------------------- Balloons: 46/47, Keys: 4/4, Trophies: 4/5 T.T. Amulets: 4/4, Wizpig Amulets: 4/4 ---------------------------------------------------------------------- - We are collecting silver coins in Star City. (5/8 silver coins) + We are collecting silver coins in Star City. (7/8 silver coins) ====================================================================== ADVENTURE TWO (Cleanup & Documentation) -------------------------- 62.43% Complete --------------------------- diff --git a/src/objects.c b/src/objects.c index 1f419450..95d55406 100644 --- a/src/objects.c +++ b/src/objects.c @@ -5851,27 +5851,26 @@ Object *find_taj_object(void) { return NULL; } -// https://decomp.me/scratch/nWMak -#ifdef NON_EQUIVALENT // Handles MidiFadePoint, MidiFade, and MidiSetChannel objects? void func_80018CE0(Object *racerObj, f32 arg1, f32 arg2, f32 arg3, s32 arg4) { f32 temp_f0; - f32 temp_f12; + s32 pad_spF8; s32 spF4; - f32 temp_f14; + s32 pad_spF0; f32 temp_f22; - f32 racerX; // f24 - f32 racerY; // f26 - f32 racerZ; // f28 + s32 pad_spE8; + s32 pad_spE4; + s32 pad_spE0; f32 temp_f2; - f32 var_f4; - f32 var_f8; + s32 pad_spD8; + f32 tempF2; s32 temp_f10; s32 temp_t3_2; s32 i; // s1 s32 var_s2; f32 spC0; Object_MidiFadePoint *midiFadePoint; // spBC + f32 tempF; u16 temp_t4; s8 var_v0_2; u8 var_v0_u; @@ -5907,8 +5906,8 @@ void func_80018CE0(Object *racerObj, f32 arg1, f32 arg2, f32 arg3, s32 arg4) { var_s2 = 0; } else { spC0 -= midiFadePoint->unk0; - var_f4 = 127.0f * (spC0); - var_s2 = var_f4 / (midiFadePoint->unk2 - midiFadePoint->unk0); + temp_f0 = (midiFadePoint->unk2 - midiFadePoint->unk0); + var_s2 = (127.0f * spC0) / temp_f0; } for (i = 0; i < 16; i++) { switch (midiFadePoint->unkC[i]) { @@ -5933,6 +5932,7 @@ void func_80018CE0(Object *racerObj, f32 arg1, f32 arg2, f32 arg3, s32 arg4) { } } else if (obj->behaviorId == BHV_MIDI_FADE) { midiFade = obj->midi_fade; + temp_f0 = (midiFade->unk8 * arg1) + (midiFade->unkC * arg2) + (midiFade->unk10 * arg3) + midiFade->unk14; temp_f2 = (midiFade->unk8 * racerObj->trans.x_position) + @@ -5946,18 +5946,20 @@ void func_80018CE0(Object *racerObj, f32 arg1, f32 arg2, f32 arg3, s32 arg4) { var_v1 = 0; } if (var_v1 != 0) { - temp_f2 = -midiFade->unk8 * arg1 - midiFade->unkC * arg2 - midiFade->unk10 * arg3 - midiFade->unk14; - temp_f0 = midiFade->unk8 * (racerObj->trans.x_position - arg1) + - midiFade->unkC * (racerObj->trans.y_position - arg2) + - midiFade->unk10 * (racerObj->trans.z_position - arg3); + temp_f0 = racerObj->trans.x_position - arg1; + temp_f2 = racerObj->trans.y_position - arg2; - temp_f22 = temp_f2 / temp_f0; - if ((midiFade->unk18 <= (temp_f22 * (racerObj->trans.x_position - arg1)) + arg1) && - ((temp_f22 * (racerObj->trans.x_position - arg1)) + arg1 <= midiFade->unk24)) { - if ((midiFade->unk1C <= (temp_f22 * (racerObj->trans.y_position - arg2)) + arg2) && - ((temp_f22 * (racerObj->trans.y_position - arg2)) + arg2 <= midiFade->unk28)) { - if ((midiFade->unk20 <= (temp_f22 * (racerObj->trans.z_position - arg3)) + arg3) && - ((temp_f22 * (racerObj->trans.z_position - arg3)) + arg3 <= midiFade->unk2C)) { + temp_f22 = + (-midiFade->unk8 * arg1 - midiFade->unkC * arg2 - midiFade->unk10 * arg3 - midiFade->unk14) / + (midiFade->unk8 * temp_f0 + midiFade->unkC * temp_f2 + + midiFade->unk10 * (racerObj->trans.z_position - arg3)); + tempF = temp_f22 * temp_f0; + if ((midiFade->unk18 <= tempF + arg1) && (tempF + arg1 <= midiFade->unk24)) { + tempF2 = racerObj->trans.z_position - arg3; + if ((midiFade->unk1C <= (temp_f22 * temp_f2) + arg2) && + ((temp_f22 * temp_f2) + arg2 <= midiFade->unk28)) { + if ((midiFade->unk20 <= (temp_f22 * (tempF2)) + arg3) && + ((temp_f22 * (tempF2)) + arg3 <= midiFade->unk2C)) { midiFade->unk0 = var_v1; midiFade->unk1 = 0; midiFade->unk4 = 0; @@ -6000,7 +6002,7 @@ void func_80018CE0(Object *racerObj, f32 arg1, f32 arg2, f32 arg3, s32 arg4) { D_8011AF60->unk1 = 0xFE; } for (i = 0; i < 16; i++) { - var_v0_2 = D_8011AF60->unk2F[i + 1]; + var_v0_2 = D_8011AF60->unk2F[i]; if (D_8011AF60->unk0 == -1) { var_v0_2 >>= 2; } @@ -6041,9 +6043,6 @@ void func_80018CE0(Object *racerObj, f32 arg1, f32 arg2, f32 arg3, s32 arg4) { D_8011AF60 = 0; } } -#else -#pragma GLOBAL_ASM("asm/nonmatchings/objects/func_80018CE0.s") -#endif // Rocket Path s32 func_8001955C(Object *obj, s32 checkpoint, u8 arg2, s32 arg3, s32 arg4, f32 checkpointDist, f32 *outX, f32 *outY, diff --git a/src/printf.c b/src/printf.c index 0e947cd8..d0a0fb0e 100644 --- a/src/printf.c +++ b/src/printf.c @@ -245,26 +245,26 @@ int vsprintf(char *s, const char *fmt, va_list args) { char *f; /* The string describing the size of groups of digits. */ - UNUSED char *grouping; - + UNUSED char *grouping; + /* Number of characters written. */ int done = 0; f = fmt; while (*f != '\0') { - /* Type modifiers. */ - char is_short, is_long, is_long_double; + /* Type modifiers. */ + char is_short, is_long, is_long_double; -#ifdef HAVE_LONGLONG +#ifdef HAVE_LONGLONG /* We use the `L' modifier for `long long int'. */ -#define is_longlong is_long_double +#define is_longlong is_long_double #else -#define is_longlong 0 +#define is_longlong 0 #endif - + /* Format spec modifiers. */ char space, showsign, left, alt; - + /* Padding character: ' ' or '0'. */ char pad; /* Width of a field. */ @@ -272,23 +272,23 @@ int vsprintf(char *s, const char *fmt, va_list args) { /* Precision of a field. */ int prec; - + /* Decimal integer is negative. */ char is_neg; - + /* Current character of the format. */ char fc; - + /* Base of a number to be written. */ int base; /* Integral values to be written. */ u64 num; s64 signed_num; - + /* String to be written. */ char *str; - + char work[BUFSIZ]; // sp17B s32 a1; @@ -299,14 +299,14 @@ int vsprintf(char *s, const char *fmt, va_list args) { s32 digit; if (*f != '%') { - /* This isn't a format spec, so write everything out until the - next one. To properly handle multibyte characters, we cannot - just search for a '%'. Since multibyte characters are hairy - (and dealt with above), if we hit any byte above 127 (only - those can start a multibyte character) we just punt back to - that code. */ + /* This isn't a format spec, so write everything out until the + next one. To properly handle multibyte characters, we cannot + just search for a '%'. Since multibyte characters are hairy + (and dealt with above), if we hit any byte above 127 (only + those can start a multibyte character) we just punt back to + that code. */ while (*f != '%' && *f != '\0') { - outchar (*f++); + outchar(*f++); } continue; } @@ -352,7 +352,7 @@ int vsprintf(char *s, const char *fmt, va_list args) { } } // end of while loop - + if (left) { pad = ' '; } @@ -388,7 +388,7 @@ int vsprintf(char *s, const char *fmt, va_list args) { prec = -1; } ++f; - } else if (isdigit (*f)) { + } else if (isdigit(*f)) { prec = 0; while (isdigit(*f)) { prec *= 10; @@ -406,13 +406,13 @@ int vsprintf(char *s, const char *fmt, va_list args) { is_short = 1; break; case 'l': -#ifdef HAVE_LONGLONG +#ifdef HAVE_LONGLONG if (is_long) { /* A double `l' is equivalent to an `L'. */ is_longlong = 1; } else { #endif - /* int's are long int's. */ + /* int's are long int's. */ is_long = 1; } break; @@ -422,11 +422,11 @@ int vsprintf(char *s, const char *fmt, va_list args) { break; case 'Z': /* int's are size_t's. */ -#ifdef HAVE_LONGLONG - //assert (sizeof(size_t) <= sizeof(unsigned long long int)); - //is_longlong = sizeof(size_t) > sizeof(unsigned long int); +#ifdef HAVE_LONGLONG + // assert (sizeof(size_t) <= sizeof(unsigned long long int)); + // is_longlong = sizeof(size_t) > sizeof(unsigned long int); #endif - is_long = TRUE; //sizeof(size_t) > sizeof(unsigned int); + is_long = TRUE; // sizeof(size_t) > sizeof(unsigned int); break; case 'q': is_longlong = 1; @@ -450,9 +450,9 @@ int vsprintf(char *s, const char *fmt, va_list args) { } else { castarg(signed_num, int, short int); } - + is_neg = signed_num < 0; - num = is_neg ? (- signed_num) : signed_num; + num = is_neg ? (-signed_num) : signed_num; goto number; case 'u': /* Decimal unsigned integer. */ @@ -477,9 +477,9 @@ int vsprintf(char *s, const char *fmt, va_list args) { } else if (is_long) { castarg(num, long int, unsigned long int); } else if (!is_short) { - castarg(num, int, unsigned int); + castarg(num, int, unsigned int); } else { - castarg(num, int, unsigned short int); + castarg(num, int, unsigned short int); } /* ANSI only specifies the `+' and ` ' flags for signed conversions. */ @@ -488,8 +488,8 @@ int vsprintf(char *s, const char *fmt, va_list args) { number: /* Number of base BASE. */ { - char *w; - char *workend = &work[sizeof(work) - 1]; // spF8 + char *w; + char *workend = &work[sizeof(work) - 1]; // spF8 if (gSprintfSpacingCode) { outchar(0x84); @@ -497,78 +497,77 @@ int vsprintf(char *s, const char *fmt, va_list args) { if (prec >= 0) { pad = ' '; } - /* Supply a default precision if none was given. */ - if (prec == -1) { - prec = 1; + /* Supply a default precision if none was given. */ + if (prec == -1) { + prec = 1; } - /* Put the number in WORK. */ - w = _itoa(num, workend + 1, base, fc == 'X') - 1; + /* Put the number in WORK. */ + w = _itoa(num, workend + 1, base, fc == 'X') - 1; v1 = workend - w; - width -= v1; - prec -= v1; + width -= v1; + prec -= v1; - if (alt && base == 8 && prec <= 0) { - *w-- = '0'; - --width; - } - - if (prec > 0) { - width -= prec; - while (prec-- > 0) { - *w-- = '0'; - } - } - - if (alt && base == 16) { - width -= 2; + if (alt && base == 8 && prec <= 0) { + *w-- = '0'; + --width; } - if (is_neg || showsign || space) { - --width; - } - - if (!left && pad == ' ') { - while (width-- > 0) { - outchar(' '); + if (prec > 0) { + width -= prec; + while (prec-- > 0) { + *w-- = '0'; } } - - if (is_neg) { - outchar('-'); + + if (alt && base == 16) { + width -= 2; + } + + if (is_neg || showsign || space) { + --width; + } + + if (!left && pad == ' ') { + while (width-- > 0) { + outchar(' '); + } + } + + if (is_neg) { + outchar('-'); } else if (showsign) { - outchar('+'); + outchar('+'); } else if (space) { - outchar(' '); + outchar(' '); } - if (alt && base == 16) { - outchar ('0'); - outchar (fc); - } + if (alt && base == 16) { + outchar('0'); + outchar(fc); + } - if (!left && pad == '0') { - while (width-- > 0) { - outchar('0'); + if (!left && pad == '0') { + while (width-- > 0) { + outchar('0'); } } - /* Write the number. */ - while (++w <= workend) { - outchar(*w); + /* Write the number. */ + while (++w <= workend) { + outchar(*w); } - if (left) { - while (width-- > 0) { - outchar(' '); + if (left) { + while (width-- > 0) { + outchar(' '); } } - } - break; + } + break; - case 'e': - case 'E': - { + case 'e': + case 'E': { s32 dash; // a1 in this scope s32 a05; f64 f02; @@ -580,7 +579,7 @@ int vsprintf(char *s, const char *fmt, va_list args) { dash = FALSE; // should probably use dash here instead if (gSprintfSpacingCode) { - outchar(0x84); + outchar(0x84); } if (prec < 0) { @@ -593,7 +592,7 @@ int vsprintf(char *s, const char *fmt, va_list args) { nextarg(spD0, f64); } - if (*((s8*)&spD0) < 0) { + if (*((s8 *) &spD0) < 0) { dash = TRUE; spD0 = -spD0; } @@ -601,7 +600,7 @@ int vsprintf(char *s, const char *fmt, va_list args) { if (spD0 == 0.0) { s4 = 0; f16 = 1.0; - } else if (spD0 < 1.0){ + } else if (spD0 < 1.0) { s4 = 0; f16 = 1.0; while (spD0 < f16) { @@ -614,7 +613,7 @@ int vsprintf(char *s, const char *fmt, va_list args) { s4 = 0; f16 = 1.0; f0 = 10.0; - + while (f0 <= spD0) { f16 = f0; f0 *= 10.0; @@ -623,7 +622,7 @@ int vsprintf(char *s, const char *fmt, va_list args) { } f02 = f16 * 0.5; - + for (i = prec; i > 0; i--) { f02 /= 10.0; } @@ -673,7 +672,7 @@ int vsprintf(char *s, const char *fmt, va_list args) { if (prec > 0) { do { - digit = '0'; + digit = '0'; while (spD0 >= f16) { spD0 -= f16; digit++; @@ -702,7 +701,7 @@ int vsprintf(char *s, const char *fmt, va_list args) { outchar(v1); outchar(a0); - + if (left) { while (width-- > a1) { outchar(' '); @@ -713,8 +712,7 @@ int vsprintf(char *s, const char *fmt, va_list args) { case 'G': case 'g': break; - case 'f': - { + case 'f': { f64 f12 = 1.0; f64 f14; f64 f2; @@ -726,16 +724,16 @@ int vsprintf(char *s, const char *fmt, va_list args) { dash = FALSE; f14 = 10.0; - + if (gSprintfSpacingCode) { - outchar(0x84); + outchar(0x84); } if (prec < 0) { prec = 6; } - + for (v010 = 0; v010 < prec; v010++) { - f12 /= 10.0; + f12 /= 10.0; } if (is_short) { @@ -762,13 +760,13 @@ int vsprintf(char *s, const char *fmt, va_list args) { } a1 = (dash || showsign || space) + (prec > 0 || alt) + v010 + prec; - + if (!left && pad == ' ') { while (width-- > a1) { outchar(pad); } } - + if (dash) { outchar('-'); } else if (showsign) { @@ -782,7 +780,7 @@ int vsprintf(char *s, const char *fmt, va_list args) { outchar(pad); } } - + do { digit = '0'; while (spD0 >= f2) { @@ -799,7 +797,7 @@ int vsprintf(char *s, const char *fmt, va_list args) { if (prec > 0) { do { - digit = '0'; + digit = '0'; while (spD0 >= f2) { spD0 -= f2; digit++; @@ -816,127 +814,125 @@ int vsprintf(char *s, const char *fmt, va_list args) { } break; } - case 'c': - /* Character. */ - nextarg(num, int); - if (!left) { - while (--width > 0) { - outchar(pad); + case 'c': + /* Character. */ + nextarg(num, int); + if (!left) { + while (--width > 0) { + outchar(pad); } } - outchar((unsigned char) num); - if (left) { - while (--width > 0) { - outchar(' '); + outchar((unsigned char) num); + if (left) { + while (--width > 0) { + outchar(' '); } } - break; + break; - case 's': - { - static char null[] = "(null)"; - s32 len; + case 's': { + static char null[] = "(null)"; + s32 len; - nextarg(str, char *); - - if (str == NULL) { - /* Write "(null)" if there's space. */ - if (prec == -1 || prec >= (int) sizeof(null) - 1) { - str = null; - a0 = sizeof(null) - 1; - } else { - str = ""; - a0 = 0; - } + nextarg(str, char *); + + if (str == NULL) { + /* Write "(null)" if there's space. */ + if (prec == -1 || prec >= (int) sizeof(null) - 1) { + str = null; + a0 = sizeof(null) - 1; + } else { + str = ""; + a0 = 0; + } } else { - a0 = strlen(str); + a0 = strlen(str); } - if (prec != -1 && prec < a0) { - a0 = prec; + if (prec != -1 && prec < a0) { + a0 = prec; } - width -= a0; + width -= a0; - if (!left) { - while (width-- > 0) { + if (!left) { + while (width-- > 0) { outchar(' '); } } while (a0-- > 0) { outchar(*str++); } - - if (left) { - while (width-- > 0) { + + if (left) { + while (width-- > 0) { outchar(' '); } } - } - break; + } break; - case 'p': - /* Generic pointer. */ - { - PTR ptr; - nextarg(ptr, PTR); - if (ptr != NULL) { - /* If the pointer is not NULL, write it as a %#x spec. */ - base = 16; - fc = 'x'; - alt = 1; - num = (u64) (unsigned long int) ptr; - is_neg = 0; - goto number; - } else { - /* Write "(nil)" for a nil pointer. */ - static char nil[] = "(nil)"; - register char *p; - - width -= sizeof (nil) - 1; - if (!left) { - while (width-- > 0) { - outchar(' '); + case 'p': + /* Generic pointer. */ + { + PTR ptr; + nextarg(ptr, PTR); + if (ptr != NULL) { + /* If the pointer is not NULL, write it as a %#x spec. */ + base = 16; + fc = 'x'; + alt = 1; + num = (u64) (unsigned long int) ptr; + is_neg = 0; + goto number; + } else { + /* Write "(nil)" for a nil pointer. */ + static char nil[] = "(nil)"; + register char *p; + + width -= sizeof(nil) - 1; + if (!left) { + while (width-- > 0) { + outchar(' '); + } + } + for (p = nil; *p != '\0';) { + outchar(*p++); + } + if (left) { + while (width-- > 0) { + outchar(' '); + } } } - for (p = nil; *p != '\0';) { - outchar(*p++); - } - if (left) { - while (width-- > 0) { - outchar(' '); - } - } - } - } - break; + } + break; - case 'n': - /* Answer the count of characters written. */ - if (is_longlong) { - s64 *p; - nextarg(p, s64 *); - *p = done; - } else if (is_long) { - long int *p; - nextarg(p, long int *); - *p = done; + case 'n': + /* Answer the count of characters written. */ + if (is_longlong) { + s64 *p; + nextarg(p, s64 *); + *p = done; + } else if (is_long) { + long int *p; + nextarg(p, long int *); + *p = done; } else if (!is_short) { - int *p; - nextarg(p, int *); - *p = done; - } else { - short int *p; - nextarg(p, short int *); - *p = done; - } - break; - default: - /* Unrecognized format specifier. */ - break; - } + int *p; + nextarg(p, int *); + *p = done; + } else { + short int *p; + nextarg(p, short int *); + *p = done; + } + break; + default: + /* Unrecognized format specifier. */ + break; + } if (gSprintfSpacingCode) { outchar(0x83); - } + } } *s = 0; return done; diff --git a/src/racer.c b/src/racer.c index 775f42ce..eee998df 100644 --- a/src/racer.c +++ b/src/racer.c @@ -2734,8 +2734,7 @@ void func_80049794(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r if ((var_v0 == PLAYER_COMPUTER) && (gCurrentPlayerIndex != PLAYER_COMPUTER)) { gCurrentRacerHandlingStat = 1.4f; } - var_f20 = sqrtf((obj->x_velocity * obj->x_velocity) + - (obj->z_velocity * obj->z_velocity) + + var_f20 = sqrtf((obj->x_velocity * obj->x_velocity) + (obj->z_velocity * obj->z_velocity) + (obj->y_velocity * obj->y_velocity)) - 2.0; if (racer->vehicleID >= VEHICLE_BOSSES) { @@ -3304,8 +3303,8 @@ void func_80049794(s32 updateRate, f32 updateRateF, Object *obj, Object_Racer *r gCurrentRacerTransform.z_position = 0.0f; gCurrentRacerTransform.scale = 1.0f; mtxf_from_inverse_transform((MtxF *) &sp60, &gCurrentRacerTransform); - mtxf_transform_point((MtxF *) &sp60, obj->x_velocity, obj->y_velocity, obj->z_velocity, - &racer->lateral_velocity, &racer->unk34, &racer->velocity); + mtxf_transform_point((MtxF *) &sp60, obj->x_velocity, obj->y_velocity, obj->z_velocity, &racer->lateral_velocity, + &racer->unk34, &racer->velocity); if (obj->attachPoints != NULL && obj->attachPoints->count >= 3) { temp_v0_obj = obj->attachPoints->obj[2]; temp_v0_obj->trans.rotation.y_rotation = 0x4000; diff --git a/src/tracks.c b/src/tracks.c index 849b313a..e55e5354 100644 --- a/src/tracks.c +++ b/src/tracks.c @@ -2557,7 +2557,7 @@ s32 func_8002B0F4(s32 levelSegmentIndex, f32 xIn, f32 zIn, WaterProperties ***ar var_s1 = 0; XInInt = xIn; ZInInt = zIn; - + temp_a2 = ((currentBoundingBox->x2 - currentBoundingBox->x1) >> 3) + 1; var_t0 = temp_a2 + currentBoundingBox->x1; var_t1 = currentBoundingBox->x1; @@ -2569,7 +2569,7 @@ s32 func_8002B0F4(s32 levelSegmentIndex, f32 xIn, f32 zIn, WaterProperties ***ar var_t1 += temp_a2; var_a1 *= 2; } - + // Same as above, but for Z temp_a2 = ((currentBoundingBox->z2 - currentBoundingBox->z1) >> 3) + 1; // @fake for s3 vs s2 @@ -2584,7 +2584,7 @@ s32 func_8002B0F4(s32 levelSegmentIndex, f32 xIn, f32 zIn, WaterProperties ***ar var_t1 += temp_a2; var_a1 *= 2; } - + for (batchNum = 0; batchNum < currentSegment->numberOfBatches; batchNum++) { currentBatch = ¤tSegment->batches[batchNum]; surface = gCurrentLevelModel->textures[currentBatch->textureIndex].surfaceType; @@ -2596,26 +2596,29 @@ s32 func_8002B0F4(s32 levelSegmentIndex, f32 xIn, f32 zIn, WaterProperties ***ar (currentBatch->flags & (RENDER_HIDDEN | RENDER_NO_COLLISION))) { currentFaceOffset = nextFaceOffset; } - + for (faceNum = currentFaceOffset; faceNum < nextFaceOffset; faceNum++) { if (var_s1 == (currentSegment->unk10[faceNum] & var_s1)) { tri = ¤tSegment->triangles[faceNum]; - + vert = ¤tSegment->vertices[tri->verticesArray[1] + currentVerticesOffset]; vert1X = vert->x; vert1Z = vert->z; - + vert = ¤tSegment->vertices[tri->verticesArray[2] + currentVerticesOffset]; vert2X = vert->x; vert2Z = vert->z; - + vert = ¤tSegment->vertices[tri->verticesArray[3] + currentVerticesOffset]; vert3X = vert->x; vert3Z = vert->z; - - temp_ra_1 = (((XInInt - vert2X) * (vert3Z - vert2Z)) - ((vert3X - vert2X) * (ZInInt - vert2Z))) >= 0; - temp_ra_2 = (((XInInt - vert1X) * (vert2Z - vert1Z)) - ((vert2X - vert1X) * (ZInInt - vert1Z))) >= 0; - temp_ra_3 = (((XInInt - vert1X) * (vert3Z - vert1Z)) - ((vert3X - vert1X) * (ZInInt - vert1Z))) >= 0; + + temp_ra_1 = + (((XInInt - vert2X) * (vert3Z - vert2Z)) - ((vert3X - vert2X) * (ZInInt - vert2Z))) >= 0; + temp_ra_2 = + (((XInInt - vert1X) * (vert2Z - vert1Z)) - ((vert2X - vert1X) * (ZInInt - vert1Z))) >= 0; + temp_ra_3 = + (((XInInt - vert1X) * (vert3Z - vert1Z)) - ((vert3X - vert1X) * (ZInInt - vert1Z))) >= 0; if (temp_ra_1 == temp_ra_2 && temp_ra_2 != temp_ra_3) { temp = currentSegment->collisionFacets[faceNum].basePlaneIndex; tempVec4f.x = currentSegment->collisionPlanes[temp * 4 + 0]; @@ -2624,7 +2627,8 @@ s32 func_8002B0F4(s32 levelSegmentIndex, f32 xIn, f32 zIn, WaterProperties ***ar tempVec4f.w = currentSegment->collisionPlanes[temp * 4 + 3]; if (tempVec4f.y != 0.0) { D_8011D128[yOutCount].type = surface; - D_8011D128[yOutCount].waveHeight = -(((tempVec4f.x * xIn) + (tempVec4f.z * zIn) + tempVec4f.w) / tempVec4f.y); + D_8011D128[yOutCount].waveHeight = + -(((tempVec4f.x * xIn) + (tempVec4f.z * zIn) + tempVec4f.w) / tempVec4f.y); D_8011D128[yOutCount].rot.x = tempVec4f.x; D_8011D128[yOutCount].rot.y = tempVec4f.y; D_8011D128[yOutCount].rot.z = tempVec4f.z; @@ -2647,7 +2651,8 @@ s32 func_8002B0F4(s32 levelSegmentIndex, f32 xIn, f32 zIn, WaterProperties ***ar currentSegment = &gCurrentLevelModel->segments[levelSegmentIndex]; D_8011D128[yOutCount].type = SURFACE_WATER_WAVY; if (currentSegment->hasWaves && gWaveBlockCount != 0) { - D_8011D128[yOutCount].waveHeight = func_800BB2F4(levelSegmentIndex, xIn, zIn, &(yOutCount + D_8011D128)->rot); + D_8011D128[yOutCount].waveHeight = + func_800BB2F4(levelSegmentIndex, xIn, zIn, &(yOutCount + D_8011D128)->rot); } else { D_8011D128[yOutCount].waveHeight = currentSegment->unk38; D_8011D128[yOutCount].rot.x = 0.0f; @@ -2661,7 +2666,7 @@ s32 func_8002B0F4(s32 levelSegmentIndex, f32 xIn, f32 zIn, WaterProperties ***ar for (var_v0 = 0; var_v0 < yOutCount; var_v0++) {\ wave = &D_8011D128[var_v0];\ gTrackWaves[var_v0] = wave;\ - }\ + } // clang-format on do {