Skip to content

Commit

Permalink
Fixed wheel visibility when using setVehicleWheelStates #1556 (#3154)
Browse files Browse the repository at this point in the history
  • Loading branch information
FileEX authored Jan 9, 2024
1 parent 519398a commit 51c9257
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
22 changes: 21 additions & 1 deletion Client/mods/deathmatch/logic/CClientVehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1464,7 +1464,7 @@ void CClientVehicle::SetWheelStatus(unsigned char ucWheel, unsigned char ucStatu
m_pVehicle->GetDamageManager()->SetWheelStatus((eWheelPosition)(ucWheel), ucGTAStatus);

// Update the wheel's visibility
m_pVehicle->SetWheelVisibility((eWheelPosition)ucWheel, (ucStatus != DT_WHEEL_MISSING));
m_pVehicle->SetWheelVisibility((eWheelPosition)ucWheel, ucStatus != DT_WHEEL_MISSING && m_ComponentData[GetComponentNameForWheel(ucWheel)].m_bVisible);
}
else if (m_eVehicleType == CLIENTVEHICLE_BIKE && ucWheel < 2)
m_pVehicle->SetBikeWheelStatus(ucWheel, ucGTAStatus);
Expand All @@ -1473,6 +1473,26 @@ void CClientVehicle::SetWheelStatus(unsigned char ucWheel, unsigned char ucStatu
}
}

//
// Returns component name for eWheelPosition enum
//
SString CClientVehicle::GetComponentNameForWheel(unsigned char ucWheel) const noexcept
{
switch (ucWheel)
{
case FRONT_LEFT_WHEEL:
return "wheel_lf_dummy";
case FRONT_RIGHT_WHEEL:
return "wheel_rf_dummy";
case REAR_LEFT_WHEEL:
return "wheel_lb_dummy";
case REAR_RIGHT_WHEEL:
return "wheel_rb_dummy";
default:
return "";
}
}

//
// Returns true if wheel should be invisible because of its state
//
Expand Down
1 change: 1 addition & 0 deletions Client/mods/deathmatch/logic/CClientVehicle.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ class CClientVehicle : public CClientStreamElement
int GetWheelFrictionState(unsigned char ucWheel);
unsigned char GetPanelStatus(unsigned char ucPanel);
unsigned char GetLightStatus(unsigned char ucLight);
SString GetComponentNameForWheel(unsigned char ucWheel) const noexcept;

bool AreLightsOn();

Expand Down

0 comments on commit 51c9257

Please sign in to comment.