From 44651defa7f0bf9afe0c99e62928ccfbea048bec Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sun, 17 Dec 2017 18:00:42 +0100 Subject: [PATCH] Fix #6447: Rename friction to mass --- src/openrct2/interface/console.c | 10 +++++----- src/openrct2/object/RideObject.cpp | 2 +- src/openrct2/peep/Peep.cpp | 6 +++--- src/openrct2/rct1.h | 2 +- src/openrct2/rct1/S4Importer.cpp | 2 +- src/openrct2/ride/CableLift.cpp | 8 ++++---- src/openrct2/ride/Vehicle.cpp | 18 +++++++++--------- src/openrct2/ride/Vehicle.h | 6 +++--- src/openrct2/ride/ride.c | 10 +++++----- src/openrct2/ride/ride.h | 22 +++++++++++----------- src/openrct2/ride/ride_data.c | 2 +- src/openrct2/ride/ride_data.h | 2 +- 12 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/openrct2/interface/console.c b/src/openrct2/interface/console.c index a6d13dedcb..1a7792effd 100644 --- a/src/openrct2/interface/console.c +++ b/src/openrct2/interface/console.c @@ -498,7 +498,7 @@ static sint32 cc_rides(const utf8 **argv, sint32 argc) } else { console_printf("rides set type "); console_printf("rides set mode [ ]"); - console_printf("rides set friction "); + console_printf("rides set mass "); console_printf("rides set excitement "); console_printf("rides set intensity "); console_printf("rides set nausea "); @@ -543,10 +543,10 @@ static sint32 cc_rides(const utf8 **argv, sint32 argc) } } } - else if (strcmp(argv[1], "friction") == 0) { + else if (strcmp(argv[1], "mass") == 0) { bool int_valid[2] = { 0 }; sint32 ride_index = console_parse_int(argv[2], &int_valid[0]); - sint32 friction = console_parse_int(argv[3], &int_valid[1]); + sint32 mass = console_parse_int(argv[3], &int_valid[1]); if (ride_index < 0) { console_printf("Ride index must not be negative"); @@ -556,7 +556,7 @@ static sint32 cc_rides(const utf8 **argv, sint32 argc) } else { Ride *ride = get_ride(ride_index); - if (friction <= 0) { + if (mass <= 0) { console_printf("Friction value must be strictly positive"); } else if (ride->type == RIDE_TYPE_NULL) { @@ -567,7 +567,7 @@ static sint32 cc_rides(const utf8 **argv, sint32 argc) uint16 vehicle_index = ride->vehicles[i]; while (vehicle_index != SPRITE_INDEX_NULL) { rct_vehicle *vehicle = GET_VEHICLE(vehicle_index); - vehicle->friction = friction; + vehicle->mass = mass; vehicle_index = vehicle->next_vehicle_on_train; } } diff --git a/src/openrct2/object/RideObject.cpp b/src/openrct2/object/RideObject.cpp index 7c602cd389..494e0e5d60 100644 --- a/src/openrct2/object/RideObject.cpp +++ b/src/openrct2/object/RideObject.cpp @@ -396,7 +396,7 @@ void RideObject::ReadLegacyVehicle(IReadObjectContext * context, IStream * strea vehicle->num_vertical_frames = stream->ReadValue(); vehicle->num_horizontal_frames = stream->ReadValue(); vehicle->spacing = stream->ReadValue(); - vehicle->car_friction = stream->ReadValue(); + vehicle->car_mass = stream->ReadValue(); vehicle->tab_height = stream->ReadValue(); vehicle->num_seats = stream->ReadValue(); vehicle->sprite_flags = stream->ReadValue(); diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index 84a87cb56a..c4dc61f56c 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -3361,7 +3361,7 @@ static void peep_update_ride_sub_state_5(rct_peep * peep) vehicle->num_peeps++; ride->cur_num_customers++; - vehicle->friction += seated_peep->var_41; + vehicle->mass += seated_peep->var_41; invalidate_sprite_2((rct_sprite *)seated_peep); sprite_move(LOCATION_NULL, 0, 0, (rct_sprite *)seated_peep); @@ -3376,7 +3376,7 @@ static void peep_update_ride_sub_state_5(rct_peep * peep) vehicle->num_peeps++; ride->cur_num_customers++; - vehicle->friction += peep->var_41; + vehicle->mass += peep->var_41; invalidate_sprite_2((rct_sprite *)vehicle); invalidate_sprite_2((rct_sprite *)peep); @@ -3422,7 +3422,7 @@ static void peep_update_ride_sub_state_7(rct_peep * peep) peep->action_sprite_image_offset = 0; vehicle->num_peeps--; - vehicle->friction -= peep->var_41; + vehicle->mass -= peep->var_41; invalidate_sprite_2((rct_sprite *)vehicle); if (ride_station >= MAX_STATIONS) diff --git a/src/openrct2/rct1.h b/src/openrct2/rct1.h index 6c27d44ded..0386f648a0 100644 --- a/src/openrct2/rct1.h +++ b/src/openrct2/rct1.h @@ -303,7 +303,7 @@ typedef struct rct1_vehicle { uint16 next_vehicle_on_ride; // 0x42 uint16 var_44; - uint16 friction; // 0x46 + uint16 mass; // 0x46 uint16 update_flags; // 0x48 uint8 var_4A; uint8 current_station; // 0x4B diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 67320f438a..c6164e7b42 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1122,7 +1122,7 @@ private: dst->sprite_right = src->sprite_right; dst->sprite_bottom = src->sprite_bottom; - dst->friction = src->friction; + dst->mass = src->mass; dst->num_seats = src->num_seats; dst->speed = src->speed; dst->powered_acceleration = src->powered_acceleration; diff --git a/src/openrct2/ride/CableLift.cpp b/src/openrct2/ride/CableLift.cpp index 48e3b1944c..f3cd46c79c 100644 --- a/src/openrct2/ride/CableLift.cpp +++ b/src/openrct2/ride/CableLift.cpp @@ -55,7 +55,7 @@ rct_vehicle * cable_lift_segment_create(sint32 rideIndex, current->sprite_width = 10; current->sprite_height_negative = 10; current->sprite_height_positive = 10; - current->friction = 100; + current->mass = 100; current->num_seats = 0; current->speed = 20; current->powered_acceleration = 80; @@ -503,7 +503,7 @@ sint32 cable_lift_update_track_motion(rct_vehicle * cableLift) } uint32 vehicleCount = 0; - uint16 frictionTotal = 0; + uint16 massTotal = 0; sint32 accelerationTotal = 0; for (uint16 spriteId = cableLift->sprite_index; spriteId != SPRITE_INDEX_NULL;) @@ -511,7 +511,7 @@ sint32 cable_lift_update_track_motion(rct_vehicle * cableLift) rct_vehicle * vehicle = GET_VEHICLE(spriteId); vehicleCount++; - frictionTotal += vehicle->friction; + massTotal += vehicle->mass; accelerationTotal = add_clamp_sint32(accelerationTotal, vehicle->acceleration); spriteId = vehicle->next_vehicle_on_train; @@ -527,7 +527,7 @@ sint32 cable_lift_update_track_motion(rct_vehicle * cableLift) edx = -edx; } edx >>= 4; - newAcceleration -= edx / frictionTotal; + newAcceleration -= edx / massTotal; cableLift->acceleration = newAcceleration; return _vehicleMotionTrackFlags; diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index aab5e07943..082abad25e 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -960,7 +960,7 @@ sint32 sub_6BC2F3(rct_vehicle * vehicle) rct_vehicle * vehicle_temp = vehicle; do { - result += vehicle_temp->friction; + result += vehicle_temp->mass; } while (vehicle_temp->next_vehicle_on_train != SPRITE_INDEX_NULL && (vehicle_temp = GET_VEHICLE(vehicle_temp->next_vehicle_on_train)) != NULL); sint32 v4 = vehicle->velocity; @@ -4554,14 +4554,14 @@ static void vehicle_update_motion_boat_hire(rct_vehicle * vehicle) edx >>= 5; // Hack to fix people messing with boat hire - sint32 friction = vehicle->friction == 0 ? 1 : vehicle->friction; + sint32 mass = vehicle->mass == 0 ? 1 : vehicle->mass; - sint32 eax = ((vehicle->velocity >> 1) + edx) / friction; + sint32 eax = ((vehicle->velocity >> 1) + edx) / mass; sint32 ecx = -eax; if (vehicleEntry->flags & VEHICLE_ENTRY_FLAG_POWERED) { eax = vehicle->speed << 14; - sint32 ebx = (vehicle->speed * friction) >> 2; + sint32 ebx = (vehicle->speed * mass) >> 2; if (vehicle->update_flags & VEHICLE_UPDATE_FLAG_3) { eax = -eax; @@ -6406,7 +6406,7 @@ static sint32 vehicle_update_motion_dodgems(rct_vehicle * vehicle) edx = -edx; edx >>= 5; eax += edx; - eax /= vehicle->friction; + eax /= vehicle->mass; rct_ride_entry * rideEntry = get_ride_entry(vehicle->ride_subtype); rct_ride_entry_vehicle * vehicleEntry = &rideEntry->vehicles[vehicle->vehicle_type]; @@ -6416,7 +6416,7 @@ static sint32 vehicle_update_motion_dodgems(rct_vehicle * vehicle) return _vehicleMotionTrackFlags; } - sint32 ebx = (vehicle->speed * vehicle->friction) >> 2; + sint32 ebx = (vehicle->speed * vehicle->mass) >> 2; sint32 _eax = vehicle->speed << 14; if (vehicle->update_flags & VEHICLE_UPDATE_FLAG_3) { @@ -9315,7 +9315,7 @@ loc_6DCEFF: { regs.ebx++; regs.dx |= vehicle->update_flags; - regs.bp += vehicle->friction; + regs.bp += vehicle->mass; regs.eax += vehicle->acceleration; regs.si = vehicle->next_vehicle_on_train; if ((uint16)regs.si == SPRITE_INDEX_NULL) @@ -9573,7 +9573,7 @@ sint32 vehicle_update_track_motion(rct_vehicle * vehicle, sint32 * outStation) numVehicles++; // Not used? regs.dx |= vehicle->update_flags; - totalFriction += vehicle->friction; + totalFriction += vehicle->mass; totalAcceleration += vehicle->acceleration; uint16 spriteIndex = vehicle->next_vehicle_on_train; @@ -9615,7 +9615,7 @@ sint32 vehicle_update_track_motion(rct_vehicle * vehicle, sint32 * outStation) } regs.edx >>= 4; regs.eax = regs.edx; - // OpenRCT2: vehicles from different track types can have 0 friction. + // OpenRCT2: vehicles from different track types can have 0 mass. if (totalFriction != 0) { regs.eax = regs.eax / totalFriction; diff --git a/src/openrct2/ride/Vehicle.h b/src/openrct2/ride/Vehicle.h index 1dd3e60a80..d76acc49f0 100644 --- a/src/openrct2/ride/Vehicle.h +++ b/src/openrct2/ride/Vehicle.h @@ -35,7 +35,7 @@ typedef struct rct_ride_entry_vehicle { uint8 num_vertical_frames; // 0x02 , 0x1C, Appears to be unused, except as a temporary variable in RCT2 (not needed for OpenRCT2) uint8 num_horizontal_frames; // 0x03 , 0x1D, Appears to be unused, except as a temporary variable in RCT2 (not needed for OpenRCT2) uint32 spacing; // 0x04 , 0x1E - uint16 car_friction; // 0x08 , 0x22 + uint16 car_mass; // 0x08 , 0x22 sint8 tab_height; // 0x0A , 0x24 uint8 num_seats; // 0x0B , 0x25 uint16 sprite_flags; // 0x0C , 0x26 @@ -120,7 +120,7 @@ typedef struct rct_vehicle { union { sint16 track_direction; // 0x36 (0000 0000 0000 0011) sint16 track_type; // 0x36 (0000 0011 1111 1100) - LocationXY8 boat_location; // 0x36 + LocationXY8 boat_location; // 0x36 }; uint16 track_x; // 0x38 uint16 track_y; // 0x3A @@ -134,7 +134,7 @@ typedef struct rct_vehicle { uint16 next_vehicle_on_ride; // 0x42 uint16 var_44; - uint16 friction; // 0x46 + uint16 mass; // 0x46 uint16 update_flags; // 0x48 uint8 var_4A; uint8 current_station; // 0x4B diff --git a/src/openrct2/ride/ride.c b/src/openrct2/ride/ride.c index 81706a4ebe..d6836e95b7 100644 --- a/src/openrct2/ride/ride.c +++ b/src/openrct2/ride/ride.c @@ -4581,7 +4581,7 @@ static rct_vehicle *vehicle_create_car( vehicle->sprite_width = vehicleEntry->sprite_width; vehicle->sprite_height_negative = vehicleEntry->sprite_height_negative; vehicle->sprite_height_positive = vehicleEntry->sprite_height_positive; - vehicle->friction = vehicleEntry->car_friction; + vehicle->mass = vehicleEntry->car_mass; vehicle->num_seats = vehicleEntry->num_seats; vehicle->speed = vehicleEntry->powered_max_speed; vehicle->powered_acceleration = vehicleEntry->powered_acceleration; @@ -7162,18 +7162,18 @@ void ride_update_max_vehicles(sint32 rideIndex) return; stationLength = (stationLength * 0x44180) - 0x16B2A; - sint32 maxFriction = RideData5[ride->type].max_friction << 8; + sint32 maxMass = RideData5[ride->type].max_mass << 8; sint32 maxCarsPerTrain = 1; for (sint32 numCars = rideEntry->max_cars_in_train; numCars > 0; numCars--) { trainLength = 0; - sint32 totalFriction = 0; + sint32 totalMass = 0; for (sint32 i = 0; i < numCars; i++) { vehicleEntry = &rideEntry->vehicles[ride_entry_get_vehicle_at_position(ride->subtype, numCars, i)]; trainLength += vehicleEntry->spacing; - totalFriction += vehicleEntry->car_friction; + totalMass += vehicleEntry->car_mass; } - if (trainLength <= stationLength && totalFriction <= maxFriction) { + if (trainLength <= stationLength && totalMass <= maxMass) { maxCarsPerTrain = numCars; break; } diff --git a/src/openrct2/ride/ride.h b/src/openrct2/ride/ride.h index 6ad255e959..9195b00381 100644 --- a/src/openrct2/ride/ride.h +++ b/src/openrct2/ride/ride.h @@ -117,9 +117,9 @@ typedef struct rct_ride_entry { uint8 pad_019; // 0x019 rct_ride_entry_vehicle vehicles[RCT2_MAX_VEHICLES_PER_RIDE_ENTRY]; // 0x01A vehicle_colour_preset_list *vehicle_preset_list; // 0x1AE - sint8 excitement_multiplier; // 0x1B2 - sint8 intensity_multiplier; // 0x1B3 - sint8 nausea_multiplier; // 0x1B4 + sint8 excitement_multiplier; // 0x1B2 + sint8 intensity_multiplier; // 0x1B3 + sint8 nausea_multiplier; // 0x1B4 uint8 max_height; // 0x1B5 uint64 enabledTrackPieces; // 0x1B6 uint8 category[RCT2_MAX_CATEGORIES_PER_RIDE]; // 0x1BE @@ -144,7 +144,7 @@ typedef struct Ride { uint16 pad_002; // 0x002 uint8 mode; // 0x004 uint8 colour_scheme_type; // 0x005 - rct_vehicle_colour vehicle_colours[MAX_CARS_PER_TRAIN]; // 0x006 + rct_vehicle_colour vehicle_colours[MAX_CARS_PER_TRAIN]; // 0x006 uint8 pad_046[0x03]; // 0x046, Used to be track colours in RCT1 without expansions // 0 = closed, 1 = open, 2 = test uint8 status; // 0x049 @@ -156,16 +156,16 @@ typedef struct Ride { uint16 name_arguments_number; // 0x04E }; }; - LocationXY8 overall_view; // 0x050 - LocationXY8 station_starts[MAX_STATIONS]; // 0x052 + LocationXY8 overall_view; // 0x050 + LocationXY8 station_starts[MAX_STATIONS]; // 0x052 uint8 station_heights[MAX_STATIONS]; // 0x05A uint8 station_length[MAX_STATIONS]; // 0x05E uint8 station_depart[MAX_STATIONS]; // 0x062 // ride->vehicle index for current train waiting for passengers // at station uint8 train_at_station[MAX_STATIONS]; // 0x066 - LocationXY8 entrances[MAX_STATIONS]; // 0x06A - LocationXY8 exits[MAX_STATIONS]; // 0x072 + LocationXY8 entrances[MAX_STATIONS]; // 0x06A + LocationXY8 exits[MAX_STATIONS]; // 0x072 uint16 last_peep_in_queue[MAX_STATIONS]; // 0x07A uint8 pad_082[MAX_STATIONS]; // 0x082, Used to be number of peeps in queue in RCT1, but this has moved. uint16 vehicles[MAX_VEHICLES_PER_RIDE]; // 0x086, Points to the first car in the train @@ -191,7 +191,7 @@ typedef struct Ride { }; uint8 boat_hire_return_direction; // 0x0D1 - LocationXY8 boat_hire_return_position; // 0x0D2 + LocationXY8 boat_hire_return_position; // 0x0D2 uint8 measurement_index; // 0x0D4 // bits 0 through 4 are the number of helix sections // bit 5: spinning tunnel, water splash, or rapids @@ -217,7 +217,7 @@ typedef struct Ride { uint32 testing_flags; // 0x108 // x y map location of the current track piece during a test // this is to prevent counting special tracks multiple times - LocationXY8 cur_test_track_location; // 0x10C + LocationXY8 cur_test_track_location; // 0x10C // Next 3 variables are related (XXXX XYYY ZZZa aaaa) uint16 turn_count_default; // 0x10E X = current turn count uint16 turn_count_banked; // 0x110 @@ -246,7 +246,7 @@ typedef struct Ride { // Customer count in the last 10 * 960 game ticks (sliding window) uint16 num_customers[CUSTOMER_HISTORY_SIZE]; // 0x124 money16 price; // 0x138 - LocationXY8 chairlift_bullwheel_location[2]; // 0x13A + LocationXY8 chairlift_bullwheel_location[2]; // 0x13A uint8 chairlift_bullwheel_z[2]; // 0x13E union { rating_tuple ratings; // 0x140 diff --git a/src/openrct2/ride/ride_data.c b/src/openrct2/ride/ride_data.c index d548228f6c..db509daf5e 100644 --- a/src/openrct2/ride/ride_data.c +++ b/src/openrct2/ride/ride_data.c @@ -1589,7 +1589,7 @@ const rct_ride_entry_vehicle CableLiftVehicle = { .num_vertical_frames = 0, .num_horizontal_frames = 0, .spacing = 0, - .car_friction = 0, + .car_mass = 0, .tab_height = 0, .num_seats = 0, .sprite_flags = VEHICLE_SPRITE_FLAG_FLAT | VEHICLE_SPRITE_FLAG_GENTLE_SLOPES | VEHICLE_SPRITE_FLAG_STEEP_SLOPES, diff --git a/src/openrct2/ride/ride_data.h b/src/openrct2/ride/ride_data.h index fe7347e584..fcf9d1cb38 100644 --- a/src/openrct2/ride/ride_data.h +++ b/src/openrct2/ride/ride_data.h @@ -89,7 +89,7 @@ typedef struct rct_ride_data_5 { uint8 max_height; uint8 clearance_height; sint8 z_offset; - uint8 max_friction; + uint8 max_mass; uint8 z; uint8 price; uint8 bonus_value; // Deprecated. Use rideBonusValue instead