mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-12 21:47:03 +03:00
Vehicles cleanup before impacts were broken (#575)
* Enhance big gun rotation; vehicle cleanup * Determine defaults for vehicle info members; keep camera elevation aligned with line of sight on big gun * Organise constants * Fix jeep/bike floor tilts * Unify vehicle height calcs, fix bridges for vehicles * Fix water vehicles * Fix typo * Introduce unified vehicle mounting mechanism and use it for the skidoo * Ensure vehicle mounting occurs from correct side; modify skidoo and speedboat control inputs * Update VehicleHelpers.cpp * Fix kayak * Standardise vehicle inputs * Update vehicle acceleration input * Make vehicle inputs constants * Rename Airborne to IsAirborne * Move generic vehicle functions to VehicleHelpers.cpp * Also move constants * Remove inaccurate vehicle mount condition * Move vehicle constants to header; redo quad bike input replacement (further adjustment required) * Establish vehicle mount constants for later; convert vehicle macros to constants * Add condition to level start mount * Organise and demagic some vehicle constants * More cleanup and demagicking of vehicle constants * Demagic and simplify UPV garbage * Organise UPV angle macros and constants to make sense * Organise a little more * Final cleanup of UPV constants * Add temporary vehicle velocity scale constant for easier removal later; demagic rubber boat velocity and turn rate values * Cleanup, demagicking * Cleanup * Organisation * Prototype vehicle turn rate modulation with skidoo and UPV * Tentatively simplify UPV turn rate deceleration * Fix UPV turning * Tweak UPV turn rate macros * Tweak UPV turn rate macros * Complete vehicle mount function * Use new vehicle mount function with quad bike * Use new vehicle mount function with motorbike * Add oneshot check to GetVehicleMountType() * Prepare mechanism to allow starting a level already mounted on any vehicle * Fix typo * Cleanup and organisation * Remove use of Lara global * Use new vehicle mount function with minecart * Fix spike deaths on vehicles * Use new vehicle mount function with jeep * Assess 2D distance for vehicle mounts instead of 3D for better fidelity around steps * Cleanup * Use new vehicle mount function with speedboat * Fix mounts on boats * Use new vehicle mount function with rubber boat * Use new vehicle mount function with kayak * Cleanup * Use new mount function with UPV * Fix motorbike nitro and remove useless flag checks * Fix bike nitro, rotate wheels for vehicles * Fix ItemPushStatic not to corrupt non-Lara items room number * Remove unneeded clamps * Fix typo * Jeep: comply to tomb4 decompilation order * Uncomment drift code for jeep, rename unknown2 to Gear * Fix flag meanings * Further backport of jeep from tomb4 project * Use JeepBrakeLightJoints * Update jeep.cpp * Fix vehicle static collisions * Add disabled option to insert nitro into motorbike * Simplify UPV collision check * Update comment * Make vehicle function parameter ordering consistent * Rotate UPV rudders when turning the vehicle * Lean UPV when turning * Simplify condition * Simplify skidoo turn rate modulation * Fix UPV turbine rotation * Fix merge error * Tentatively invert turning when moving in reverse on skidoo * Add function to discard flares on vehicles to avoid copy-paste * Add big reminder comment for savegames * Fix another "epic" typo by me, convert enum hex values to shifts * lara_struct.h cleanup * UPV cleanup * #include cleanup in vehicle headers * Also brake quadbike with brake button Co-authored-by: Sezz <seb.zych@outlook.com>
This commit is contained in:
parent
deaae5093f
commit
aded24fa10
126 changed files with 5292 additions and 5558 deletions
|
@ -10,7 +10,7 @@
|
|||
#include "Game/collision/sphere.h"
|
||||
#include "Flow/ScriptInterfaceFlowHandler.h"
|
||||
#include "Renderer\RenderView\RenderView.h"
|
||||
#include "Objects/TR3/Vehicles/quad.h"
|
||||
#include "Objects/TR3/Vehicles/quad_bike.h"
|
||||
#include "Objects/TR3/Vehicles/rubber_boat.h"
|
||||
#include "Objects/TR3/Vehicles/upv.h"
|
||||
#include "Objects/TR3/Vehicles/big_gun.h"
|
||||
|
@ -18,7 +18,7 @@
|
|||
#include "Objects/TR4/Vehicles/motorbike.h"
|
||||
#include <algorithm>
|
||||
#include "Game/itemdata/creature_info.h"
|
||||
#include "Objects/TR3/Vehicles/quad_info.h"
|
||||
#include "Objects/TR3/Vehicles/quad_bike_info.h"
|
||||
#include "Objects/TR4/Vehicles/jeep_info.h"
|
||||
#include "Objects/TR4/Vehicles/motorbike_info.h"
|
||||
#include "Objects/TR3/Vehicles/rubber_boat_info.h"
|
||||
|
@ -207,92 +207,116 @@ namespace TEN::Renderer
|
|||
currentBone->ExtraRotation = Vector3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
nativeItem->Data.apply(
|
||||
[&j, ¤tBone](QuadInfo& quad)
|
||||
{
|
||||
if (j == 3 || j == 4)
|
||||
currentBone->ExtraRotation.x = TO_RAD(quad.RearRot);
|
||||
else if (j == 6 || j == 7)
|
||||
currentBone->ExtraRotation.x = TO_RAD(quad.FrontRot);
|
||||
},
|
||||
[&j, ¤tBone](JeepInfo& jeep)
|
||||
{
|
||||
switch(j)
|
||||
[&j, ¤tBone](QuadBikeInfo& quadBike)
|
||||
{
|
||||
case 9:
|
||||
currentBone->ExtraRotation.x = TO_RAD(jeep.rot1);
|
||||
break;
|
||||
case 10:
|
||||
currentBone->ExtraRotation.x = TO_RAD(jeep.rot2);
|
||||
break;
|
||||
case 12:
|
||||
currentBone->ExtraRotation.x = TO_RAD(jeep.rot3);
|
||||
break;
|
||||
case 13:
|
||||
currentBone->ExtraRotation.x = TO_RAD(jeep.rot4);
|
||||
break;
|
||||
}
|
||||
},
|
||||
[&j, ¤tBone](MotorbikeInfo& bike)
|
||||
{
|
||||
switch (j)
|
||||
if (j == 3 || j == 4)
|
||||
currentBone->ExtraRotation.x = TO_RAD(quadBike.RearRot);
|
||||
else if (j == 6 || j == 7)
|
||||
{
|
||||
currentBone->ExtraRotation.x = TO_RAD(quadBike.FrontRot);
|
||||
currentBone->ExtraRotation.y = TO_RAD(quadBike.TurnRate * 2);
|
||||
}
|
||||
},
|
||||
[&j, ¤tBone](JeepInfo& jeep)
|
||||
{
|
||||
case 2:
|
||||
case 4:
|
||||
currentBone->ExtraRotation.x = TO_RAD(bike.RightWheelsRotation);
|
||||
break;
|
||||
case 8:
|
||||
currentBone->ExtraRotation.x = TO_RAD(bike.LeftWheelRotation);
|
||||
break;
|
||||
}
|
||||
},
|
||||
[&j, ¤tBone, &oldRotation](MinecartInfo& cart)
|
||||
{
|
||||
switch (j)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
currentBone->ExtraRotation.z = TO_RAD((short)std::clamp(cart.Velocity, 0, (int)ANGLE(25.0f)) + FROM_RAD(oldRotation.z));
|
||||
break;
|
||||
}
|
||||
},
|
||||
[&j, ¤tBone](RubberBoatInfo& boat)
|
||||
{
|
||||
if (j == 2)
|
||||
currentBone->ExtraRotation.z = TO_RAD(boat.PropellerRotation);
|
||||
},
|
||||
[&j, ¤tBone](UPVInfo& upv)
|
||||
{
|
||||
if (j == 3)
|
||||
currentBone->ExtraRotation.z = TO_RAD(upv.FanRot);
|
||||
},
|
||||
[&j, ¤tBone](BigGunInfo& big_gun)
|
||||
{
|
||||
if (j == 2)
|
||||
currentBone->ExtraRotation.z = big_gun.BarrelZRotation;
|
||||
},
|
||||
[&j, ¤tBone, &lastJoint](CreatureInfo& creature)
|
||||
{
|
||||
if (currentBone->ExtraRotationFlags & ROT_Y)
|
||||
{
|
||||
currentBone->ExtraRotation.y = TO_RAD(creature.JointRotation[lastJoint]);
|
||||
lastJoint++;
|
||||
}
|
||||
switch(j)
|
||||
{
|
||||
case 9:
|
||||
currentBone->ExtraRotation.x = TO_RAD(jeep.FrontRightWheelRotation);
|
||||
currentBone->ExtraRotation.y = TO_RAD(jeep.TurnRate * 4);
|
||||
break;
|
||||
|
||||
if (currentBone->ExtraRotationFlags & ROT_X)
|
||||
{
|
||||
currentBone->ExtraRotation.x = TO_RAD(creature.JointRotation[lastJoint]);
|
||||
lastJoint++;
|
||||
}
|
||||
case 10:
|
||||
currentBone->ExtraRotation.x = TO_RAD(jeep.FrontLeftWheelRotation);
|
||||
currentBone->ExtraRotation.y = TO_RAD(jeep.TurnRate * 4);
|
||||
break;
|
||||
|
||||
if (currentBone->ExtraRotationFlags & ROT_Z)
|
||||
{
|
||||
currentBone->ExtraRotation.z = TO_RAD(creature.JointRotation[lastJoint]);
|
||||
lastJoint++;
|
||||
}
|
||||
}
|
||||
);
|
||||
case 12:
|
||||
currentBone->ExtraRotation.x = TO_RAD(jeep.BackRightWheelRotation);
|
||||
break;
|
||||
|
||||
case 13:
|
||||
currentBone->ExtraRotation.x = TO_RAD(jeep.BackLeftWheelRotation);
|
||||
break;
|
||||
}
|
||||
},
|
||||
[&j, ¤tBone](MotorbikeInfo& bike)
|
||||
{
|
||||
switch (j)
|
||||
{
|
||||
case 2:
|
||||
currentBone->ExtraRotation.x = TO_RAD(bike.RightWheelsRotation);
|
||||
currentBone->ExtraRotation.y = TO_RAD(bike.TurnRate * 8);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
currentBone->ExtraRotation.x = TO_RAD(bike.RightWheelsRotation);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
currentBone->ExtraRotation.x = TO_RAD(bike.LeftWheelRotation);
|
||||
break;
|
||||
}
|
||||
},
|
||||
[&j, ¤tBone, &oldRotation](MinecartInfo& cart)
|
||||
{
|
||||
switch (j)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
currentBone->ExtraRotation.z = TO_RAD((short)std::clamp(cart.Velocity, 0, (int)ANGLE(25.0f)) + FROM_RAD(oldRotation.z));
|
||||
break;
|
||||
}
|
||||
},
|
||||
[&j, ¤tBone](RubberBoatInfo& boat)
|
||||
{
|
||||
if (j == 2)
|
||||
currentBone->ExtraRotation.z = TO_RAD(boat.PropellerRotation);
|
||||
},
|
||||
[&j, ¤tBone](UPVInfo& upv)
|
||||
{
|
||||
switch (j)
|
||||
{
|
||||
case 1:
|
||||
currentBone->ExtraRotation.x = TO_RAD(upv.LeftRudderRotation);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
currentBone->ExtraRotation.x = TO_RAD(upv.RightRudderRotation);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
currentBone->ExtraRotation.z = TO_RAD(upv.TurbineRotation);
|
||||
break;
|
||||
}
|
||||
},
|
||||
[&j, ¤tBone](BigGunInfo& big_gun)
|
||||
{
|
||||
if (j == 2)
|
||||
currentBone->ExtraRotation.z = big_gun.BarrelRotation;
|
||||
},
|
||||
[&j, ¤tBone, &lastJoint](CreatureInfo& creature)
|
||||
{
|
||||
if (currentBone->ExtraRotationFlags & ROT_Y)
|
||||
{
|
||||
currentBone->ExtraRotation.y = TO_RAD(creature.JointRotation[lastJoint]);
|
||||
lastJoint++;
|
||||
}
|
||||
|
||||
if (currentBone->ExtraRotationFlags & ROT_X)
|
||||
{
|
||||
currentBone->ExtraRotation.x = TO_RAD(creature.JointRotation[lastJoint]);
|
||||
lastJoint++;
|
||||
}
|
||||
|
||||
if (currentBone->ExtraRotationFlags & ROT_Z)
|
||||
{
|
||||
currentBone->ExtraRotation.z = TO_RAD(creature.JointRotation[lastJoint]);
|
||||
lastJoint++;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ANIM_FRAME* framePtr[2];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue