From 05b80acfa122b9bc400ed3f3855dcb308523e9c9 Mon Sep 17 00:00:00 2001 From: spacek531 Date: Tue, 22 Feb 2022 15:14:42 -0800 Subject: [PATCH] Rename VAR_C4 (#16217) --- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/park/ParkFile.cpp | 2 +- src/openrct2/rct1/RCT1.h | 6 +++++- src/openrct2/rct1/S4Importer.cpp | 2 +- src/openrct2/rct2/RCT2.h | 4 ++-- src/openrct2/rct2/S6Importer.cpp | 2 +- src/openrct2/ride/CableLift.cpp | 2 +- src/openrct2/ride/Ride.cpp | 2 +- src/openrct2/ride/Vehicle.cpp | 22 +++++++++++----------- src/openrct2/ride/Vehicle.h | 4 ++-- 10 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index 3a01fa645e..083f34f652 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -435,7 +435,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots COMPARE_FIELD(Vehicle, cable_lift_target); COMPARE_FIELD(Vehicle, speed); COMPARE_FIELD(Vehicle, powered_acceleration); - COMPARE_FIELD(Vehicle, var_C4); + COMPARE_FIELD(Vehicle, CollisionDetectionTimer); COMPARE_FIELD(Vehicle, animation_frame); for (int i = 0; i < 2; i++) { diff --git a/src/openrct2/park/ParkFile.cpp b/src/openrct2/park/ParkFile.cpp index 5d0ea1188a..3752e04eb2 100644 --- a/src/openrct2/park/ParkFile.cpp +++ b/src/openrct2/park/ParkFile.cpp @@ -1814,7 +1814,7 @@ namespace OpenRCT2 cs.ReadWrite(entity.time_waiting); cs.ReadWrite(entity.speed); cs.ReadWrite(entity.powered_acceleration); - cs.ReadWrite(entity.dodgems_collision_direction); + cs.ReadWrite(entity.CollisionDetectionTimer); cs.ReadWrite(entity.animation_frame); if (cs.GetMode() == OrcaStream::Mode::READING && os.GetHeader().TargetVersion <= 2) { diff --git a/src/openrct2/rct1/RCT1.h b/src/openrct2/rct1/RCT1.h index 0a357b2735..9d798d352e 100644 --- a/src/openrct2/rct1/RCT1.h +++ b/src/openrct2/rct1/RCT1.h @@ -373,7 +373,11 @@ namespace RCT1 }; uint8_t speed; // 0xC2 uint8_t powered_acceleration; // 0xC3 - uint8_t var_C4; + union + { + uint8_t DodgemsCollisionDetection; // 0xC4 + uint8_t CollisionDetectionTimer; // 0xC4 + }; uint8_t animation_frame; uint8_t pad_C6[0x2]; uint32_t animationState; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index ee1ba89554..eb6748a685 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -2747,7 +2747,7 @@ namespace RCT1 dst->sound1_id = OpenRCT2::Audio::SoundId::Null; dst->sound2_id = OpenRCT2::Audio::SoundId::Null; dst->var_C0 = src->var_C0; - dst->var_C4 = src->var_C4; + dst->CollisionDetectionTimer = src->CollisionDetectionTimer; dst->animation_frame = src->animation_frame; dst->animationState = src->animationState; dst->NumLaps = src->NumLaps; diff --git a/src/openrct2/rct2/RCT2.h b/src/openrct2/rct2/RCT2.h index 326f079aba..a82bc7556c 100644 --- a/src/openrct2/rct2/RCT2.h +++ b/src/openrct2/rct2/RCT2.h @@ -506,8 +506,8 @@ namespace RCT2 uint8_t powered_acceleration; // 0xC3 union { - uint8_t dodgems_collision_direction; // 0xC4 - uint8_t var_C4; + uint8_t DodgemsCollisionDirection; // 0xC4 + uint8_t CollisionDetectionTimer; // 0xC4 }; uint8_t animation_frame; // 0xC5 uint8_t pad_C6[0x2]; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index aba57cec6f..93db84f9aa 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1876,7 +1876,7 @@ namespace RCT2 dst->time_waiting = src->time_waiting; dst->speed = src->speed; dst->powered_acceleration = src->powered_acceleration; - dst->dodgems_collision_direction = src->dodgems_collision_direction; + dst->CollisionDetectionTimer = src->CollisionDetectionTimer; dst->animation_frame = src->animation_frame; dst->animationState = src->animationState; dst->scream_sound_id = static_cast(src->scream_sound_id); diff --git a/src/openrct2/ride/CableLift.cpp b/src/openrct2/ride/CableLift.cpp index 0adc3abe39..77225b36ae 100644 --- a/src/openrct2/ride/CableLift.cpp +++ b/src/openrct2/ride/CableLift.cpp @@ -52,7 +52,7 @@ Vehicle* cable_lift_segment_create( current->sound2_flags = 0; current->sound1_id = OpenRCT2::Audio::SoundId::Null; current->sound2_id = OpenRCT2::Audio::SoundId::Null; - current->var_C4 = 0; + current->CollisionDetectionTimer = 0; current->animation_frame = 0; current->animationState = 0; current->scream_sound_id = OpenRCT2::Audio::SoundId::Null; diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 34c2a101b5..d99fe87b3e 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -3151,7 +3151,7 @@ static Vehicle* vehicle_create_car( vehicle->sound1_id = OpenRCT2::Audio::SoundId::Null; vehicle->sound2_id = OpenRCT2::Audio::SoundId::Null; vehicle->next_vehicle_on_train = EntityId::GetNull(); - vehicle->var_C4 = 0; + vehicle->CollisionDetectionTimer = 0; vehicle->animation_frame = 0; vehicle->animationState = 0; vehicle->scream_sound_id = OpenRCT2::Audio::SoundId::Null; diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 4d810591e7..08a7067fbb 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -6263,10 +6263,10 @@ int32_t Vehicle::UpdateMotionDodgems() } auto collideSprite = EntityId::GetNull(); - if (dodgems_collision_direction != 0) + if (DodgemsCollisionDirection != 0) { - uint8_t oldCollisionDirection = dodgems_collision_direction & 0x1E; - dodgems_collision_direction = 0; + uint8_t oldCollisionDirection = DodgemsCollisionDirection & 0x1E; + DodgemsCollisionDirection = 0; CoordsXYZ location = { x, y, z }; @@ -6327,8 +6327,8 @@ int32_t Vehicle::UpdateMotionDodgems() if (oldVelocity >= 131072) { - collideVehicle->dodgems_collision_direction = direction; - dodgems_collision_direction = direction ^ (1 << 4); + collideVehicle->DodgemsCollisionDirection = direction; + DodgemsCollisionDirection = direction ^ (1 << 4); } } else @@ -6337,7 +6337,7 @@ int32_t Vehicle::UpdateMotionDodgems() if (oldVelocity >= 131072) { - dodgems_collision_direction = direction ^ (1 << 4); + DodgemsCollisionDirection = direction ^ (1 << 4); } } } @@ -7556,7 +7556,7 @@ bool Vehicle::UpdateMotionCollisionDetection(const CoordsXYZ& loc, EntityId* oth if (!(vehicleEntry->flags & VEHICLE_ENTRY_FLAG_BOAT_HIRE_COLLISION_DETECTION)) { - var_C4 = 0; + CollisionDetectionTimer = 0; // If hacking boat hire rides you can end up here if (otherVehicleIndex == nullptr) @@ -7673,12 +7673,12 @@ bool Vehicle::UpdateMotionCollisionDetection(const CoordsXYZ& loc, EntityId* oth if (!mayCollide) { - var_C4 = 0; + CollisionDetectionTimer = 0; return false; } - var_C4++; - if (var_C4 < 200) + CollisionDetectionTimer++; + if (CollisionDetectionTimer < 200) { SetUpdateFlag(VEHICLE_UPDATE_FLAG_6); if (otherVehicleIndex != nullptr) @@ -9850,7 +9850,7 @@ void Vehicle::Serialise(DataSerialiser& stream) stream << var_C0; stream << speed; stream << powered_acceleration; - stream << dodgems_collision_direction; + stream << DodgemsCollisionDirection; stream << animation_frame; stream << animationState; stream << scream_sound_id; diff --git a/src/openrct2/ride/Vehicle.h b/src/openrct2/ride/Vehicle.h index bdc81307a3..7792939d66 100644 --- a/src/openrct2/ride/Vehicle.h +++ b/src/openrct2/ride/Vehicle.h @@ -180,8 +180,8 @@ struct Vehicle : EntityBase uint8_t powered_acceleration; union { - uint8_t dodgems_collision_direction; - uint8_t var_C4; + uint8_t DodgemsCollisionDirection; + uint8_t CollisionDetectionTimer; }; uint8_t animation_frame; uint8_t pad_C6[0x2];