Fix #2700. Friction sound no longer goes very quite at high speeds.

Also labelled friction_sound_id and small refactor
This commit is contained in:
duncanspumpkin 2016-01-12 17:55:19 +00:00
parent 75ed781a5c
commit d8d706cc58
3 changed files with 7 additions and 7 deletions

View File

@ -1290,7 +1290,7 @@ const rct_ride_type_vehicle CableLiftVehicle = {
.no_seating_rows = 0,
.spinning_inertia = 0,
.spinning_friction = 255,
.var_57 = 0,
.friction_sound_id = 0,
.var_58 = 0,
.sound_range = 0,
.var_5A = 0,

View File

@ -4256,8 +4256,8 @@ static void vehicle_update_sound(rct_vehicle *vehicle)
{
rct_ride *ride;
rct_ride_type *rideEntry;
// bl should be set before hand
uint8 bl = 255, dl = 255;
// frictionVolume (bl) should be set before hand
uint8 frictionVolume = 255, frictionId = 255;
// bh screamVolume should be set before hand
uint8 screamId, screamVolume = 255;
uint16 soundIdVolume;
@ -4269,9 +4269,9 @@ static void vehicle_update_sound(rct_vehicle *vehicle)
int ecx = abs(vehicle->velocity) - 0x10000;
if (ecx >= 0) {
dl = vehicleEntry->var_57;
frictionId = vehicleEntry->friction_sound_id;
ecx >>= 15;
bl = min(208 + ecx & 0xFF, 255);
frictionVolume = min(208 + (ecx & 0xFF), 255);
}
switch (vehicleEntry->sound_range) {
@ -4328,7 +4328,7 @@ static void vehicle_update_sound(rct_vehicle *vehicle)
}
// Friction sound
soundIdVolume = sub_6D7AC0(vehicle->sound1_id, vehicle->sound1_volume, dl, bl);
soundIdVolume = sub_6D7AC0(vehicle->sound1_id, vehicle->sound1_volume, frictionId, frictionVolume);
vehicle->sound1_id = soundIdVolume & 0xFF;
vehicle->sound1_volume = (soundIdVolume >> 8) & 0xFF;

View File

@ -67,7 +67,7 @@ typedef struct {
uint8 no_seating_rows; // 0x54 , 0x6E
uint8 spinning_inertia; // 0x55 , 0x6F
uint8 spinning_friction; // 0x56 , 0x70
uint8 var_57; // 0x57 , 0x71
uint8 friction_sound_id; // 0x57 , 0x71
uint8 var_58; // 0x58 , 0x72
uint8 sound_range; // 0x59 , 0x73
uint8 var_5A; // 0x5A , 0x74