MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / GetJeepCollisionAnimation

Function GetJeepCollisionAnimation

TombEngine/Objects/TR4/Vehicles/jeep.cpp:467–492  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

465 }
466
467 static int GetJeepCollisionAnimation(ItemInfo* jeepItem, Vector3i* pos)
468 {
469 auto* jeep = GetJeepInfo(jeepItem);
470
471 if (jeep->Gear != 0)
472 return 0;
473
474 pos->x = jeepItem->Pose.Position.x - pos->x;
475 pos->z = jeepItem->Pose.Position.z - pos->z;
476
477 if (pos->x || pos->z)
478 {
479 float sinY = phd_sin(jeepItem->Pose.Orientation.y);
480 float cosY = phd_cos(jeepItem->Pose.Orientation.y);
481
482 int front = (pos->z * cosY) + (pos->x * sinY);
483 int side = (pos->z * -sinY) + (pos->x * cosY);
484
485 if (abs(front) > abs(side))
486 return ((front > 0) + 13);
487 else
488 return ((side <= 0) + 11);
489 }
490
491 return 0;
492 }
493
494 int JeepDynamics(ItemInfo* jeepItem, ItemInfo* laraItem)
495 {

Callers 1

JeepDynamicsFunction · 0.85

Calls 3

GetJeepInfoFunction · 0.85
phd_sinFunction · 0.85
phd_cosFunction · 0.85

Tested by

no test coverage detected