Rename animation vars

This commit is contained in:
spacek531 authored and GitHub committed 2021-08-21 19:23:27 +02:00
1 parent 8de2965f13
commit c49c6ca4a7
11 files changed
+62 -63

No files matched your search

+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -2715,7 +2715,7 @@ template<> void S4Importer::ImportEntity<Vehicle>(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;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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<uint8_t>(src->scream_sound_id);
dst->TrackSubposition = static_cast<uint8_t>(src->TrackSubposition);
+1 -1
View File
@@ -1663,7 +1663,7 @@ template<> void S6Importer::ImportEntity<Vehicle>(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<OpenRCT2::Audio::SoundId>(src->scream_sound_id);
dst->TrackSubposition = VehicleTrackSubposition{ src->TrackSubposition };
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
+52 -53
View File
@@ -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<uint32_t*>(&var_C8);
uint32_t* curAnimationState = reinterpret_cast<uint32_t*>(&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--;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;