summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFire-Head <Fire-Head@users.noreply.github.com>2021-08-30 23:34:06 +0300
committerFire-Head <Fire-Head@users.noreply.github.com>2021-08-30 23:34:06 +0300
commit4b747e567ae9242aea008e5749de60062a54b6fb (patch)
tree24af0ac7f402885c1adb5a3eccb5134303e37f47 /src
parent320624edc87778960906d28252752f2471f8a571 (diff)
replace ugly else if with switch
Diffstat (limited to 'src')
-rw-r--r--src/renderer/Shadows.cpp101
1 files changed, 48 insertions, 53 deletions
diff --git a/src/renderer/Shadows.cpp b/src/renderer/Shadows.cpp
index dd87bff6..5339916a 100644
--- a/src/renderer/Shadows.cpp
+++ b/src/renderer/Shadows.cpp
@@ -536,61 +536,56 @@ CShadows::StoreShadowForVehicle(CVehicle *pCar, VEH_SHD_TYPE type)
float size = 1.0f;
- if ( pCar->GetModelIndex() == MI_HUNTER )
+ switch ( pCar->GetModelIndex() )
{
- fVehicleWidth *= 3.0f;
- fVehicleHeight *= 1.4f;
- size *= 0.5f;
- }
- 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;
- size = 0.05f;
- }
- else if ( pCar->GetModelIndex() == MI_FREEWAY )
- {
- fVehicleHeight *= 1.5f;
- size = 0.03f;
- }
- else if ( pCar->GetModelIndex() == MI_RCRAIDER )
- {
- fVehicleHeight *= 1.5f;
- fVehicleWidth *= 2.0f;
- size = 0.2f;
- }
- else if ( pCar->GetModelIndex() == MI_SANCHEZ )
- {
- 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;
- fVehicleHeight *= 1.4f;
- size *= 0.5f;
- }
- else if ( pCar->GetModelIndex() == MI_RCGOBLIN )
- {
- fVehicleHeight *= 1.5f;
- fVehicleWidth *= 2.0f;
- size = 0.2f;
- }
- else if ( pCar->GetModelIndex() == MI_DODO )
- {
- fVehicleHeight *= 0.9f;
- fVehicleWidth *= 0.4f;
+ case MI_PIZZABOY:
+ case MI_PCJ600:
+ case MI_FAGGIO:
+ {
+ fVehicleHeight *= 1.2f;
+ size = 0.05f;
+ break;
+ }
+
+ case MI_ANGEL:
+ case MI_FREEWAY:
+ case MI_SANCHEZ:
+ {
+ fVehicleHeight *= 1.5f;
+ size *= 0.03f;
+ break;
+ }
+
+ case MI_HUNTER:
+ case MI_SEASPAR:
+ case MI_SPARROW:
+ case MI_MAVERICK:
+ case MI_VCNMAV:
+ case MI_POLMAV:
+ {
+ fVehicleWidth *= 3.0f;
+ fVehicleHeight *= 1.4f;
+ size *= 0.5f;
+ break;
+ }
+
+ case MI_RCGOBLIN:
+ case MI_RCRAIDER:
+ {
+ fVehicleHeight *= 1.5f;
+ fVehicleWidth *= 2.0f;
+ size *= 0.2f;
+ break;
+ }
+
+ case MI_DODO:
+ {
+ fVehicleHeight *= 0.9f;
+ fVehicleWidth *= 0.4f;
+ break;
+ }
}
+
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);