From cfd251611d93870a21a16ed141d115682c179099 Mon Sep 17 00:00:00 2001 From: Fazana <52551480+FazanaJ@users.noreply.github.com> Date: Sat, 21 May 2022 22:47:43 +0100 Subject: [PATCH] did the rest of the sound IDs --- asm/non_matchings/racer/func_8004F7F4.s | 2 +- include/sound_ids.h | 95 ++++++++++++++++++++++++- include/structs.h | 2 +- src/racer.c | 66 ++++++++--------- src/racer.h | 4 +- 5 files changed, 128 insertions(+), 41 deletions(-) diff --git a/asm/non_matchings/racer/func_8004F7F4.s b/asm/non_matchings/racer/func_8004F7F4.s index 7521b62f..7a41bc89 100644 --- a/asm/non_matchings/racer/func_8004F7F4.s +++ b/asm/non_matchings/racer/func_8004F7F4.s @@ -249,7 +249,7 @@ glabel func_8004F7F4 .L8004FB3C: /* 05073C 8004FB3C 8FA600C4 */ lw $a2, 0xc4($sp) /* 050740 8004FB40 02002025 */ move $a0, $s0 -/* 050744 8004FB44 0C015E6C */ jal func_800579B0 +/* 050744 8004FB44 0C015E6C */ jal handle_base_steering /* 050748 8004FB48 00002825 */ move $a1, $zero /* 05074C 8004FB4C 02202025 */ move $a0, $s1 /* 050750 8004FB50 0C015D7B */ jal func_800575EC diff --git a/include/sound_ids.h b/include/sound_ids.h index 20cd036c..576d71db 100644 --- a/include/sound_ids.h +++ b/include/sound_ids.h @@ -557,7 +557,100 @@ enum SoundID { SOUND_VOICE_DIDDY_NEGATIVE8, SOUND_VOICE_BLUEY_REMATCH4, // "If you can beat me again..." SOUND_VOICE_BLUEY_TROPHY2, // "Goodbye kid" - + SOUND_UNK546, // I'm guessing rolling snowballs + SOUND_UNK547, // The sound of hitting something + SOUND_UNK548, // Same + SOUND_VOICE_TRICKY_OW, + SOUND_VOICE_TRICKY_OW2, + SOUND_VOICE_SMOKEY_HM, + SOUND_VOICE_SMOKEY_HM2, + SOUND_VOICE_BLUEY_AIEE, + SOUND_VOICE_BLUEY_OHNO3, + SOUND_VOICE_BOSS_LAUGH, // Don't recognise it + SOUND_VOICE_BOSS_LAUGH2, // Yeah + SOUND_VOICE_BLUEY_EH3, + SOUND_VOICE_TT_GAME_STATUS, + SOUND_VOICE_TT_OKAY, + SOUND_VOICE_TT_TIME_TRIAL_OFF, + SOUND_VOICE_TT_TIME_TRIAL_ON, + SOUND_NITRO_LEVEL3_CHARGE, + SOUND_NITRO_LEVEL3_BOOST, + SOUND_VOICE_TAJ_SELECT_VEHICLE, + SOUND_VOICE_TAJ_ABRAKADABRA, + SOUND_VOICE_TAJ_ALAKAZAM, + SOUND_VOICE_TAJ_ALAKAZOOM2, + SOUND_VOICE_TAJ_MENUBACK, // "Can I help you further?" + SOUND_VOICE_TAJ_CHALLENGE_MENU, // "Select the challenge of your choice" + SOUND_VOICE_TAJ_MENUBACK2, // "Will that be all?" + SOUND_VOICE_BRONTO_ROAR, + SOUND_WHOOSH5, + SOUND_COLLECT_BALLOON, + SOUND_RAIN, + SOUND_UNK575, // Might be thunder + SOUND_ZAP4, + SOUND_MENU_BACK3, + SOUND_VOICE_BUBBLER_OW, + SOUND_VOICE_BUBBLER_AUGH, + SOUND_VOICE_BUBBLER_HOHO, + SOUND_VOICE_BUBBLER_HOHO2, + SOUND_VOICE_BUBBLER_AW, + SOUND_VOICE_BUBBLER_OW2, + SOUND_VOICE_BUBBLER_AUGH2, + SOUND_DRAWBRIDGE_BELL, + SOUND_BUBBLE_RISE, + SOUND_VOICE_TT_BEAT_MY_TIME, // "Now try beat my time" + SOUND_VOICE_TT_WELL_THEN, + SOUND_VOICE_TT_TRY_ANOTHER_TRACK, // "Now try another track" + SOUND_VOICE_TT_BEAT_ALL_TIMES, // "You've beaten all my times" + SOUND_VOICE_TT_UNLOCKED, // "Now you can pick me" + SOUND_VOICE_TAJ_CHALLENGE_RACE, // "I challenge you to a race" + SOUND_UNK593, + SOUND_UNK594, + SOUND_UNK595, + SOUND_UNK596, + SOUND_UNK597, + SOUND_UNK598, + SOUND_UNK599, + SOUND_UNK600, + SOUND_UNK601, + SOUND_UNK602, + SOUND_UNK603, + SOUND_UNK604, + SOUND_UNK605, + SOUND_UNK606, + SOUND_UNK607, + SOUND_UNK608, + SOUND_UNK609, + SOUND_UNK610, + SOUND_UNK611, + SOUND_UNK612, + SOUND_UNK613, + SOUND_UNK614, + SOUND_UNK615, + SOUND_UNK616, + SOUND_UNK617, + SOUND_UNK618, + SOUND_UNK619, + SOUND_UNK620, + SOUND_UNK621, + SOUND_UNK622, + SOUND_UNK623, + SOUND_UNK624, + SOUND_UNK625, + SOUND_UNK626, + SOUND_UNK627, + SOUND_UNK628, + SOUND_UNK629, + SOUND_UNK630, + SOUND_UNK631, + SOUND_UNK632, + SOUND_UNK633, + SOUND_UNK634, + SOUND_UNK635, + SOUND_UNK636, + SOUND_UNK637, + SOUND_UNK638, + // Trying to play 639 onwards will incur a crash. NUM_SOUND_IDS }; diff --git a/include/structs.h b/include/structs.h index f84daf87..f3951c9d 100644 --- a/include/structs.h +++ b/include/structs.h @@ -960,7 +960,7 @@ typedef struct Object_Racer { /* 0x1DB */ s8 spinout_timer; /* 0x1DC */ u8 wheel_surfaces[4]; /* 0x1E0 */ s8 unk1E0; - /* 0x1E1 */ s8 unk1E1; + /* 0x1E1 */ s8 steerAngle; /* 0x1E2 */ s8 unk1E2; /* 0x1E3 */ s8 unk1E3; /* 0x1E4 */ s8 unk1E4; diff --git a/src/racer.c b/src/racer.c index 832c998d..8300f802 100644 --- a/src/racer.c +++ b/src/racer.c @@ -509,16 +509,16 @@ GLOBAL_ASM("asm/non_matchings/racer/func_800494E0.s") GLOBAL_ASM("asm/non_matchings/racer/func_80049794.s") // Something Plane related. -void func_8004C0A0(s32 arg0, Object *planeObj, Object_Racer *planeObj64) { +void func_8004C0A0(s32 arg0, Object *planeObj, Object_Racer *racer) { s32 temp_v1; s32 phi_v0; - if (planeObj64->unk1D7 != 10) { + if (racer->unk1D7 != 10) { //!@bug Typo. Should've been `== 0`, not `= 0`. - if ((planeObj64->unk1F2 = 0)) { + if ((racer->unk1F2 = 0)) { return; // This never gets called because of the typo. } - phi_v0 = planeObj64->unk1E1; + phi_v0 = racer->steerAngle; phi_v0 = 40 - (phi_v0 >> 1); if (phi_v0 < 0) { phi_v0 = 0; @@ -1302,7 +1302,7 @@ void handle_car_steering(Object_Racer *racer) { velScale = vel * 58.0f; } // Set the steering velocity based on the car's steering value, scaled with the temp forward velocity value. - gCurrentCarSteerVel -= (racer->unk1E1 * velScale); + gCurrentCarSteerVel -= (racer->steerAngle * velScale); // If the car is reversing, then flip the steering. if (racer->velocity > 0.0f) { gCurrentCarSteerVel = -gCurrentCarSteerVel; @@ -1351,7 +1351,7 @@ void handle_car_velocity_control(Object_Racer *racer) { GLOBAL_ASM("asm/non_matchings/racer/func_80053750.s") GLOBAL_ASM("asm/non_matchings/racer/func_80053E9C.s") -void func_80054110(Object *obj, Object_Racer *racer, s32 updateRate, f32 arg3) { +void func_80054110(Object *obj, Object_Racer *racer, s32 updateRate, f32 updateRateF) { f32 tempVel; f32 xVel; f32 zVel; @@ -1370,17 +1370,17 @@ void func_80054110(Object *obj, Object_Racer *racer, s32 updateRate, f32 arg3) { tempZ = obj->segment.trans.z_position; gCurrentCarSteerVel = 0; D_8011D558 = 0; - func_800579B0(racer, 0, arg3); + handle_base_steering(racer, 0, updateRateF); handle_car_velocity_control(racer); func_800575EC(obj, racer); func_80055EC0(obj, racer, updateRate); func_80053E9C(obj, racer, updateRate); if (racer->spinout_timer) { - func_80052B64(obj, racer, updateRate, arg3); // Sbinalla + func_80052B64(obj, racer, updateRate, updateRateF); // Sbinalla } else if (racer->unk1E2 > 0) { - func_8005492C(obj, racer, updateRate, arg3); + func_8005492C(obj, racer, updateRate, updateRateF); } else { - func_80052D7C(obj, racer, updateRate, arg3); + func_80052D7C(obj, racer, updateRate, updateRateF); } apply_vehicle_rotation_offset(racer, updateRate, 0, 0, 0); header = get_current_level_header(); @@ -1451,9 +1451,9 @@ void func_80054110(Object *obj, Object_Racer *racer, s32 updateRate, f32 arg3) { } xVel += racer->unk84; zVel += racer->unk88; - func_80011570(obj, xVel * arg3, obj->segment.y_velocity * arg3, zVel * arg3); + func_80011570(obj, xVel * updateRateF, obj->segment.y_velocity * updateRateF, zVel * updateRateF); } else { - func_80050754(obj, racer, arg3); + func_80050754(obj, racer, updateRateF); } if (D_8011D55C == -1 && !func_80023568()) { func_80055A84(obj, racer, updateRate); @@ -1465,8 +1465,8 @@ void func_80054110(Object *obj, Object_Racer *racer, s32 updateRate, f32 arg3) { } else if (racer->unk1D6 < 5) { func_800AF714(obj, updateRate); } - func_80053750(obj, racer, arg3); - tempVel = 1.0f / arg3; + func_80053750(obj, racer, updateRateF); + tempVel = 1.0f / updateRateF; xVel = (((obj->segment.trans.x_position - tempX) - D_8011D548) * tempVel) - racer->unk84; obj->segment.y_velocity = (obj->segment.trans.y_position - tempY) * tempVel; zVel = (((obj->segment.trans.z_position - tempZ) - D_8011D54C) * tempVel) - racer->unk88; @@ -1668,8 +1668,6 @@ void func_800570B8(Object *obj, s32 soundID, s32 range, s32 arg3) { } } -//s32 soundID = 545; - /** * This function dictates the base top speed of a racer. * During the race start sequence it hardsets it to 0 so you don't go anywhere. @@ -1741,15 +1739,6 @@ f32 handle_racer_top_speed(Object *obj, Object_Racer *racer) { } } } - /*render_printf("%d", soundID); - if (gActivePlayerButtonPress & L_TRIG) - { - racer_play_sound(obj, soundID); - } - if (gActivePlayerButtonPress & L_JPAD) - soundID --; - if (gActivePlayerButtonPress & R_JPAD) - soundID ++;*/ if (racer->boostTimer && !gRaceStartTimer && timer3 && racer->raceStatus == STATUS_RACING) { func_80072348(racer->playerIndex, 6); } @@ -1813,22 +1802,27 @@ void func_800575EC(Object *obj, Object_Racer *racer) { GLOBAL_ASM("asm/non_matchings/racer/func_800576E0.s") -void func_800579B0(Object_Racer *racer, UNUSED s32 arg1, f32 updateRate) { - s32 temp, temp2; +/** + * Generate the steer velocity by taking the current steer velocity and getting the difference between the stick tilt. + * Get the velocity from a fraction of the difference. + */ +void handle_base_steering(Object_Racer *racer, UNUSED s32 arg1, f32 updateRate) { + s32 steering, turnVel; - temp = gCurrentStickX - racer->unk1E1; - temp2 = (temp * updateRate) * 0.125; + steering = gCurrentStickX - racer->steerAngle; + turnVel = (steering * updateRate) * 0.125; - if (temp != 0 && temp2 == 0) { - if (temp > 0) { - temp2 = 1; + if (steering != 0 && turnVel == 0) { + if (steering > 0) { + turnVel = 1; } - if (temp < 0) { - temp2 = -1; + if (steering < 0) { + turnVel = -1; } } - racer->unk1E1 += temp2; + racer->steerAngle += turnVel; + } void func_80057A40(Object *obj, Object_Racer *racer, f32 updateRate) { @@ -1932,7 +1926,7 @@ void func_80057A40(Object *obj, Object_Racer *racer, f32 updateRate) { gCameraObject->unk3A -= delta; while (gCameraObject->unk3A < 0) { gCameraObject->unk3A += 5; - gCameraObject->unk30 = -gCameraObject->unk30 * 0.75; + gCameraObject->unk30 = -gCameraObject->unk30 * 0.75; } } diff --git a/src/racer.h b/src/racer.h index ffe17f06..10b6d8e9 100644 --- a/src/racer.h +++ b/src/racer.h @@ -204,7 +204,7 @@ void play_char_horn_sound(Object *obj, Object_Racer *racer); void racer_play_sound(Object *obj, s32 soundID); void func_800570A4(Object *obj, s32 arg1, s32 arg2); void func_800575EC(Object *obj, Object_Racer *racer); -void func_800579B0(Object_Racer *racer, s32 arg1, f32 updateRate); +void handle_base_steering(Object_Racer *racer, s32 arg1, f32 updateRate); void func_800580B4(Object *obj, Object_Racer *racer, s32 mode, f32 arg3); void get_timestamp_from_frames(s32 frameCount, s32 *minutes, s32 *seconds, s32 *hundredths); void func_800598D0(void); @@ -227,7 +227,7 @@ f32 handle_racer_top_speed(Object *obj, Object_Racer *racer); void func_800570B8(Object *obj, s32 soundID, s32 range, s32 arg3); void apply_vehicle_rotation_offset(Object_Racer *obj, s32 max, s16 yRotation, s16 xRotation, s16 zRotation); void func_80059080(Object *obj, Object_Racer *racer, f32 *velX, f32 *velY, f32 *velZ); -void func_80054110(Object *obj, Object_Racer *racer, s32 updateRate, f32 arg3); +void func_80054110(Object *obj, Object_Racer *racer, s32 updateRate, f32 updateRateF); void update_camera_hovercraft(f32 updateRate, Object *obj, Object_Racer *racer); void update_camera_plane(f32 updateRate, Object *obj, Object_Racer *racer); void update_camera_loop(f32 updateRate, Object *obj, Object_Racer *racer);