diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index 5574143b7f..b372119ce4 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -424,7 +424,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots { COMPARE_FIELD(Vehicle, pad_C6[i]); } - COMPARE_FIELD(Vehicle, var_C8); + COMPARE_FIELD(Vehicle, animationState); COMPARE_FIELD(Vehicle, var_CA); COMPARE_FIELD(Vehicle, scream_sound_id); COMPARE_FIELD(Vehicle, TrackSubposition); diff --git a/src/openrct2/rct1/RCT1.h b/src/openrct2/rct1/RCT1.h index fb55d96cdf..a516081618 100644 --- a/src/openrct2/rct1/RCT1.h +++ b/src/openrct2/rct1/RCT1.h @@ -300,7 +300,7 @@ struct rct1_vehicle : RCT12SpriteBase uint8_t var_C4; uint8_t animation_frame; uint8_t pad_C6[0x2]; - uint16_t var_C8; + uint16_t animationState; uint16_t var_CA; uint8_t scream_sound_id; // 0xCC uint8_t TrackSubposition; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index c4a4a54212..22b2015af1 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -2715,7 +2715,7 @@ template<> void S4Importer::ImportEntity(const RCT12SpriteBase& srcBase dst->var_C0 = src->var_C0; dst->var_C4 = src->var_C4; dst->animation_frame = src->animation_frame; - dst->var_C8 = src->var_C8; + dst->animationState = src->animationState; dst->var_CA = src->var_CA; dst->var_CE = src->var_CE; dst->var_D3 = src->var_D3; diff --git a/src/openrct2/rct2/RCT2.h b/src/openrct2/rct2/RCT2.h index d3a95d98b7..85b4999605 100644 --- a/src/openrct2/rct2/RCT2.h +++ b/src/openrct2/rct2/RCT2.h @@ -537,7 +537,7 @@ struct RCT2SpriteVehicle : RCT12SpriteBase }; uint8_t animation_frame; // 0xC5 uint8_t pad_C6[0x2]; - uint16_t var_C8; + uint16_t animationState; uint16_t var_CA; uint8_t scream_sound_id; // 0xCC uint8_t TrackSubposition; diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 9f0d58f773..79d752261b 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1179,7 +1179,7 @@ template<> void S6Exporter::ExportEntity(RCT2SpriteVehicle* dst, const Vehicle* dst->powered_acceleration = src->powered_acceleration; dst->dodgems_collision_direction = src->dodgems_collision_direction; dst->animation_frame = src->animation_frame; - dst->var_C8 = src->var_C8; + dst->animationState = src->animationState; dst->var_CA = src->var_CA; dst->scream_sound_id = static_cast(src->scream_sound_id); dst->TrackSubposition = static_cast(src->TrackSubposition); diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index ed4a4397d9..2717601fee 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1663,7 +1663,7 @@ template<> void S6Importer::ImportEntity(const RCT12SpriteBase& baseSrc dst->powered_acceleration = src->powered_acceleration; dst->dodgems_collision_direction = src->dodgems_collision_direction; dst->animation_frame = src->animation_frame; - dst->var_C8 = src->var_C8; + dst->animationState = src->animationState; dst->var_CA = src->var_CA; dst->scream_sound_id = static_cast(src->scream_sound_id); dst->TrackSubposition = VehicleTrackSubposition{ src->TrackSubposition }; diff --git a/src/openrct2/ride/CableLift.cpp b/src/openrct2/ride/CableLift.cpp index 913f395a80..3432ed6b92 100644 --- a/src/openrct2/ride/CableLift.cpp +++ b/src/openrct2/ride/CableLift.cpp @@ -54,7 +54,7 @@ Vehicle* cable_lift_segment_create( current->sound2_id = OpenRCT2::Audio::SoundId::Null; current->var_C4 = 0; current->animation_frame = 0; - current->var_C8 = 0; + current->animationState = 0; current->var_CA = 0; current->scream_sound_id = OpenRCT2::Audio::SoundId::Null; current->Pitch = 0; diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 0cc906322d..f979b1dacf 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -3058,7 +3058,7 @@ static Vehicle* vehicle_create_car( vehicle->next_vehicle_on_train = SPRITE_INDEX_NULL; vehicle->var_C4 = 0; vehicle->animation_frame = 0; - vehicle->var_C8 = 0; + vehicle->animationState = 0; vehicle->scream_sound_id = OpenRCT2::Audio::SoundId::Null; vehicle->Pitch = 0; vehicle->bank_rotation = 0; diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 50f1c0c22d..5416990bb0 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -1522,16 +1522,16 @@ bool Vehicle::OpenRestraints() } if (vehicleEntry->animation == VEHICLE_ENTRY_ANIMATION_OBSERVATION_TOWER && vehicle->animation_frame != 0) { - if (vehicle->var_C8 + 0x3333 < 0xFFFF) + if (vehicle->animationState + 0x3333 < 0xFFFF) { - vehicle->var_C8 = vehicle->var_C8 + 0x3333 - 0xFFFF; + vehicle->animationState = vehicle->animationState + 0x3333 - 0xFFFF; vehicle->animation_frame++; vehicle->animation_frame &= 7; vehicle->Invalidate(); } else { - vehicle->var_C8 += 0x3333; + vehicle->animationState += 0x3333; } restraintsOpen = false; continue; @@ -3639,7 +3639,7 @@ void Vehicle::UpdateCollisionSetup() } train->IsCrashedVehicle = true; - train->var_C8 = scenario_rand(); + train->animationState = scenario_rand(); train->var_CA = scenario_rand(); train->animation_frame = train->var_CA & 0x7; @@ -5408,7 +5408,7 @@ void Vehicle::CrashOnLand() IsCrashedVehicle = true; animation_frame = 0; - var_C8 = 0; + animationState = 0; sprite_width = 13; sprite_height_negative = 45; sprite_height_positive = 5; @@ -5475,7 +5475,7 @@ void Vehicle::CrashOnWater() IsCrashedVehicle = true; animation_frame = 0; - var_C8 = 0; + animationState = 0; sprite_width = 13; sprite_height_negative = 45; sprite_height_positive = 5; @@ -5506,14 +5506,14 @@ void Vehicle::UpdateCrash() ExplosionCloud::Create({ curVehicle->x + xOffset, curVehicle->y + yOffset, curVehicle->z }); } } - if (curVehicle->var_C8 + 7281 > 0xFFFF) + if (curVehicle->animationState + 7281 > 0xFFFF) { curVehicle->animation_frame++; if (curVehicle->animation_frame >= 8) curVehicle->animation_frame = 0; curVehicle->Invalidate(); } - curVehicle->var_C8 += 7281; + curVehicle->animationState += 7281; continue; } @@ -7275,11 +7275,11 @@ void Vehicle::UpdateSpinningCar() */ void Vehicle::UpdateAdditionalAnimation() { - uint8_t al{}; - uint8_t ah{}; + uint8_t targetFrame{}; + uint8_t curFrame{}; uint32_t eax{}; - uint32_t* curVar_C8 = reinterpret_cast(&var_C8); + uint32_t* curAnimationState = reinterpret_cast(&animationState); auto vehicleEntry = Entry(); if (vehicleEntry == nullptr) { @@ -7288,16 +7288,15 @@ void Vehicle::UpdateAdditionalAnimation() switch (vehicleEntry->animation) { case VEHICLE_ENTRY_ANIMATION_MINITURE_RAILWAY_LOCOMOTIVE: // loc_6D652B - *curVar_C8 += _vehicleVelocityF64E08; - al = (*curVar_C8 >> 20) & 3; - if (animation_frame != al) + *curAnimationState += _vehicleVelocityF64E08; + targetFrame = (*curAnimationState >> 20) & 3; + if (animation_frame != targetFrame) { - ah = al; - al = animation_frame; - animation_frame = ah; - al &= 0x02; - ah &= 0x02; - if (al != ah) + curFrame = animation_frame; + animation_frame = targetFrame; + targetFrame &= 0x02; + curFrame &= 0x02; + if (targetFrame != curFrame) { auto curRide = GetRide(); if (curRide != nullptr) @@ -7328,74 +7327,74 @@ void Vehicle::UpdateAdditionalAnimation() } break; case VEHICLE_ENTRY_ANIMATION_SWAN: // loc_6D6424 - *curVar_C8 += _vehicleVelocityF64E08; - al = (*curVar_C8 >> 18) & 2; - if (animation_frame != al) + *curAnimationState += _vehicleVelocityF64E08; + targetFrame = (*curAnimationState >> 18) & 2; + if (animation_frame != targetFrame) { - animation_frame = al; + animation_frame = targetFrame; Invalidate(); } break; case VEHICLE_ENTRY_ANIMATION_CANOES: // loc_6D6482 - *curVar_C8 += _vehicleVelocityF64E08; - eax = ((*curVar_C8 >> 13) & 0xFF) * 6; - ah = (eax >> 8) & 0xFF; - if (animation_frame != ah) + *curAnimationState += _vehicleVelocityF64E08; + eax = ((*curAnimationState >> 13) & 0xFF) * 6; + targetFrame = (eax >> 8) & 0xFF; + if (animation_frame != targetFrame) { - animation_frame = ah; + animation_frame = targetFrame; Invalidate(); } break; case VEHICLE_ENTRY_ANIMATION_ROW_BOATS: // loc_6D64F7 - *curVar_C8 += _vehicleVelocityF64E08; - eax = ((*curVar_C8 >> 13) & 0xFF) * 7; - ah = (eax >> 8) & 0xFF; - if (animation_frame != ah) + *curAnimationState += _vehicleVelocityF64E08; + eax = ((*curAnimationState >> 13) & 0xFF) * 7; + targetFrame = (eax >> 8) & 0xFF; + if (animation_frame != targetFrame) { - animation_frame = ah; + animation_frame = targetFrame; Invalidate(); } break; case VEHICLE_ENTRY_ANIMATION_WATER_TRICYCLES: // loc_6D6453 - *curVar_C8 += _vehicleVelocityF64E08; - al = (*curVar_C8 >> 19) & 1; - if (animation_frame != al) + *curAnimationState += _vehicleVelocityF64E08; + targetFrame = (*curAnimationState >> 19) & 1; + if (animation_frame != targetFrame) { - animation_frame = al; + animation_frame = targetFrame; Invalidate(); } break; case VEHICLE_ENTRY_ANIMATION_OBSERVATION_TOWER: // loc_6D65C3 - if (var_C8 <= 0xCCCC) + if (animationState <= 0xCCCC) { - var_C8 += 0x3333; + animationState += 0x3333; } else { - var_C8 += 0x3333; + animationState += 0x3333; animation_frame += 1; animation_frame &= 7; Invalidate(); } break; case VEHICLE_ENTRY_ANIMATION_HELICARS: // loc_6D63F5 - *curVar_C8 += _vehicleVelocityF64E08; - al = (*curVar_C8 >> 18) & 3; - if (animation_frame != al) + *curAnimationState += _vehicleVelocityF64E08; + targetFrame = (*curAnimationState >> 18) & 3; + if (animation_frame != targetFrame) { - animation_frame = al; + animation_frame = targetFrame; Invalidate(); } break; case VEHICLE_ENTRY_ANIMATION_MONORAIL_CYCLES: // loc_6D64B6 if (num_peeps != 0) { - *curVar_C8 += _vehicleVelocityF64E08; - eax = ((*curVar_C8 >> 13) & 0xFF) << 2; - ah = (eax >> 8) & 0xFF; - if (animation_frame != ah) + *curAnimationState += _vehicleVelocityF64E08; + eax = ((*curAnimationState >> 13) & 0xFF) << 2; + targetFrame = (eax >> 8) & 0xFF; + if (animation_frame != targetFrame) { - animation_frame = ah; + animation_frame = targetFrame; Invalidate(); } } @@ -7403,13 +7402,13 @@ void Vehicle::UpdateAdditionalAnimation() case VEHICLE_ENTRY_ANIMATION_MULTI_DIM_COASTER: // loc_6D65E1 if (seat_rotation != target_seat_rotation) { - if (var_C8 <= 0xCCCC) + if (animationState <= 0xCCCC) { - var_C8 += 0x3333; + animationState += 0x3333; } else { - var_C8 += 0x3333; + animationState += 0x3333; if (seat_rotation >= target_seat_rotation) seat_rotation--; diff --git a/src/openrct2/ride/Vehicle.h b/src/openrct2/ride/Vehicle.h index d24d584abc..dbfbd1b297 100644 --- a/src/openrct2/ride/Vehicle.h +++ b/src/openrct2/ride/Vehicle.h @@ -180,7 +180,7 @@ struct Vehicle : SpriteBase }; uint8_t animation_frame; uint8_t pad_C6[0x2]; - uint16_t var_C8; + uint16_t animationState; uint16_t var_CA; OpenRCT2::Audio::SoundId scream_sound_id; VehicleTrackSubposition TrackSubposition; diff --git a/src/openrct2/world/Entity.cpp b/src/openrct2/world/Entity.cpp index d3591c07f2..3f35c6a50f 100644 --- a/src/openrct2/world/Entity.cpp +++ b/src/openrct2/world/Entity.cpp @@ -278,7 +278,7 @@ void Vehicle::Serialise(DataSerialiser& stream) stream << powered_acceleration; stream << dodgems_collision_direction; stream << animation_frame; - stream << var_C8; + stream << animationState; stream << var_CA; stream << scream_sound_id; stream << TrackSubposition;