replace ugly else if with switch

This commit is contained in:
Fire-Head 2021-08-30 23:34:06 +03:00
parent 320624edc8
commit 4b747e567a

View file

@ -536,61 +536,56 @@ CShadows::StoreShadowForVehicle(CVehicle *pCar, VEH_SHD_TYPE type)
float size = 1.0f; float size = 1.0f;
if ( pCar->GetModelIndex() == MI_HUNTER ) switch ( pCar->GetModelIndex() )
{ {
fVehicleWidth *= 3.0f; case MI_PIZZABOY:
fVehicleHeight *= 1.4f; case MI_PCJ600:
size *= 0.5f; case MI_FAGGIO:
}
else if ( pCar->GetModelIndex() == MI_ANGEL )
{
fVehicleHeight = fVehicleHeight * 1.5f;
size = 0.03f;
}
else if ( pCar->GetModelIndex() == MI_SEASPAR )
{
fVehicleWidth *= 3.0f;
fVehicleHeight *= 1.4f;
size *= 0.5f;
}
else if ( pCar->GetModelIndex() == MI_PIZZABOY || pCar->GetModelIndex() == MI_PCJ600 || pCar->GetModelIndex() == MI_FAGGIO )
{ {
fVehicleHeight *= 1.2f; fVehicleHeight *= 1.2f;
size = 0.05f; size = 0.05f;
break;
} }
else if ( pCar->GetModelIndex() == MI_FREEWAY )
case MI_ANGEL:
case MI_FREEWAY:
case MI_SANCHEZ:
{ {
fVehicleHeight *= 1.5f; fVehicleHeight *= 1.5f;
size = 0.03f; size *= 0.03f;
break;
} }
else if ( pCar->GetModelIndex() == MI_RCRAIDER )
{ case MI_HUNTER:
fVehicleHeight *= 1.5f; case MI_SEASPAR:
fVehicleWidth *= 2.0f; case MI_SPARROW:
size = 0.2f; case MI_MAVERICK:
} case MI_VCNMAV:
else if ( pCar->GetModelIndex() == MI_SANCHEZ ) case MI_POLMAV:
{
fVehicleHeight *= 1.5f;
size = 0.03f;
}
else if ( pCar->GetModelIndex() == MI_SPARROW || pCar->GetModelIndex() == MI_MAVERICK || pCar->GetModelIndex() == MI_VCNMAV || pCar->GetModelIndex() == MI_POLMAV )
{ {
fVehicleWidth *= 3.0f; fVehicleWidth *= 3.0f;
fVehicleHeight *= 1.4f; fVehicleHeight *= 1.4f;
size *= 0.5f; size *= 0.5f;
break;
} }
else if ( pCar->GetModelIndex() == MI_RCGOBLIN )
case MI_RCGOBLIN:
case MI_RCRAIDER:
{ {
fVehicleHeight *= 1.5f; fVehicleHeight *= 1.5f;
fVehicleWidth *= 2.0f; fVehicleWidth *= 2.0f;
size = 0.2f; size *= 0.2f;
break;
} }
else if ( pCar->GetModelIndex() == MI_DODO )
case MI_DODO:
{ {
fVehicleHeight *= 0.9f; fVehicleHeight *= 0.9f;
fVehicleWidth *= 0.4f; fVehicleWidth *= 0.4f;
break;
} }
}
CarPos.x -= pCar->GetForward().x * (((fVehicleHeight/2) - pCar->GetColModel()->boundingBox.max.y)*size); CarPos.x -= pCar->GetForward().x * (((fVehicleHeight/2) - pCar->GetColModel()->boundingBox.max.y)*size);
CarPos.y -= pCar->GetForward().y * (((fVehicleHeight/2) - pCar->GetColModel()->boundingBox.max.y)*size); CarPos.y -= pCar->GetForward().y * (((fVehicleHeight/2) - pCar->GetColModel()->boundingBox.max.y)*size);