Use regular GetJointPosition() for Lara

This commit is contained in:
Sezz 2022-09-18 12:55:36 +10:00
parent e50bbdd5a1
commit f51ec579b8
35 changed files with 92 additions and 115 deletions

View file

@ -812,11 +812,11 @@ void HitTarget(ItemInfo* laraItem, ItemInfo* targetEntity, GameVector* hitPos, i
}
}
FireWeaponType FireWeapon(LaraWeaponType weaponType, ItemInfo* targetEntity, ItemInfo* originEntity, EulerAngles armOrient)
FireWeaponType FireWeapon(LaraWeaponType weaponType, ItemInfo* targetEntity, ItemInfo* laraItem, EulerAngles armOrient)
{
auto* lara = GetLaraInfo(originEntity);
auto* lara = GetLaraInfo(laraItem);
auto& ammo = GetAmmo(originEntity, weaponType);
auto& ammo = GetAmmo(laraItem, weaponType);
if (ammo.getCount() == 0 && !ammo.hasInfinite())
return FireWeaponType::NoAmmo;
@ -831,8 +831,8 @@ FireWeaponType FireWeapon(LaraWeaponType weaponType, ItemInfo* targetEntity, Ite
0
);
auto muzzleOffset = GetLaraJointPosition(LM_RHAND);
auto pos = Vector3i(originEntity->Pose.Position.x, muzzleOffset.y, originEntity->Pose.Position.z);
auto muzzleOffset = GetJointPosition(laraItem, LM_RHAND);
auto pos = Vector3i(laraItem->Pose.Position.x, muzzleOffset.y, laraItem->Pose.Position.z);
// Calculate ray from wobbled orientation.
auto directionNorm = wobbledArmOrient.ToDirection();
@ -862,7 +862,7 @@ FireWeaponType FireWeapon(LaraWeaponType weaponType, ItemInfo* targetEntity, Ite
lara->Control.Weapon.Fired = true;
auto vOrigin = GameVector(pos);
short roomNumber = originEntity->RoomNumber;
short roomNumber = laraItem->RoomNumber;
GetFloor(pos.x, pos.y, pos.z, &roomNumber);
vOrigin.roomNumber = roomNumber;
@ -923,7 +923,7 @@ FireWeaponType FireWeapon(LaraWeaponType weaponType, ItemInfo* targetEntity, Ite
// it's really weird but we decided to replicate original behaviour until we'll fully understand what is happening
// with weapons
if (!GetTargetOnLOS(&vOrigin, &vTarget, false, true))
HitTarget(originEntity, targetEntity, &vTarget, weapon->Damage, false);
HitTarget(laraItem, targetEntity, &vTarget, weapon->Damage, false);
//}
return FireWeaponType::PossibleHit;
@ -965,7 +965,7 @@ void LaraTargetInfo(ItemInfo* laraItem, WeaponInfo* weaponInfo)
auto origin = GameVector(
laraItem->Pose.Position.x,
GetLaraJointPosition(LM_RHAND).y, // Muzzle offset.
GetJointPosition(laraItem, LM_RHAND).y, // Muzzle offset.
laraItem->Pose.Position.z,
laraItem->RoomNumber
);
@ -1032,7 +1032,7 @@ void LaraGetNewTarget(ItemInfo* laraItem, WeaponInfo* weaponInfo)
auto origin = GameVector(
laraItem->Pose.Position.x,
GetLaraJointPosition(LM_RHAND).y, // Muzzle offset.
GetJointPosition(laraItem, LM_RHAND).y, // Muzzle offset.
laraItem->Pose.Position.z,
laraItem->RoomNumber
);

View file

@ -56,7 +56,7 @@ void InitialiseNewWeapon(ItemInfo* laraItem);
GAME_OBJECT_ID WeaponObjectMesh(ItemInfo* laraItem, LaraWeaponType weaponType);
void AimWeapon(ItemInfo* laraItem, WeaponInfo* weaponInfo, ArmInfo* arm);
void HitTarget(ItemInfo* laraItem, ItemInfo* target, GameVector* hitPos, int damage, int flag);
FireWeaponType FireWeapon(LaraWeaponType weaponType, ItemInfo* target, ItemInfo* originEntity, EulerAngles armOrient);
FireWeaponType FireWeapon(LaraWeaponType weaponType, ItemInfo* targetEntity, ItemInfo* laraItem, EulerAngles armOrient);
GameVector FindTargetPoint(ItemInfo* laraItem);
void LaraTargetInfo(ItemInfo* laraItem, WeaponInfo* weaponInfo);
void LaraGetNewTarget(ItemInfo* laraItem, WeaponInfo* weaponInfo);

View file

@ -284,7 +284,7 @@ void SetFlareArm(ItemInfo* laraItem, int armFrame)
lara->LeftArm.FrameBase = g_Level.Anims[flareAnimNum].framePtr;
}
void CreateFlare(ItemInfo* laraItem, GAME_OBJECT_ID objectNumber, bool thrown)
void CreateFlare(ItemInfo* laraItem, GAME_OBJECT_ID objectNumber, bool isThrown)
{
auto* lara = GetLaraInfo(laraItem);
auto itemNumber = CreateItem();
@ -296,7 +296,7 @@ void CreateFlare(ItemInfo* laraItem, GAME_OBJECT_ID objectNumber, bool thrown)
flareItem->ObjectNumber = objectNumber;
flareItem->RoomNumber = laraItem->RoomNumber;
auto pos = GetLaraJointPosition(LM_LHAND, Vector3i(-16, 32, 42));
auto pos = GetJointPosition(laraItem, LM_LHAND, Vector3i(-16, 32, 42));
flareItem->Pose.Position = pos;
@ -313,7 +313,7 @@ void CreateFlare(ItemInfo* laraItem, GAME_OBJECT_ID objectNumber, bool thrown)
}
else
{
if (thrown)
if (isThrown)
flareItem->Pose.Orientation.y = laraItem->Pose.Orientation.y;
else
flareItem->Pose.Orientation.y = laraItem->Pose.Orientation.y - ANGLE(45.0f);
@ -327,7 +327,7 @@ void CreateFlare(ItemInfo* laraItem, GAME_OBJECT_ID objectNumber, bool thrown)
flareItem->Pose.Orientation.z = 0;
flareItem->Color = Vector4(0.5f, 0.5f, 0.5f, 1.0f);
if (thrown)
if (isThrown)
{
flareItem->Animation.Velocity.z = laraItem->Animation.Velocity.z + 50;
flareItem->Animation.Velocity.y = laraItem->Animation.Velocity.y - 50;
@ -367,7 +367,7 @@ void DoFlareInHand(ItemInfo* laraItem, int flareLife)
{
auto* lara = GetLaraInfo(laraItem);
auto pos = GetLaraJointPosition(LM_LHAND, Vector3i(11, 32, 41));
auto pos = GetJointPosition(laraItem, LM_LHAND, Vector3i(11, 32, 41));
if (DoFlareLight(&pos, flareLife))
TriggerChaffEffects(flareLife);

View file

@ -13,7 +13,7 @@ void DrawFlareMeshes(ItemInfo* laraItem);
void UndrawFlare(ItemInfo* laraItem);
void DrawFlare(ItemInfo* laraItem);
void SetFlareArm(ItemInfo* laraItem, int armFrame);
void CreateFlare(ItemInfo* laraItem, GAME_OBJECT_ID objectNumber, bool thrown);
void CreateFlare(ItemInfo* laraItem, GAME_OBJECT_ID objectNumber, bool isThrown);
void DrawFlareInAir(ItemInfo* flareItem);
void DoFlareInHand(ItemInfo* laraItem, int flareLife);
bool DoFlareLight(Vector3i* pos, int flareLife);

View file

@ -479,9 +479,7 @@ void lara_as_tightrope_fall(ItemInfo* item, CollisionInfo* coll)
{
if (TestLastFrame(item, item->Animation.AnimNumber))
{
Vector3i pos = { 0, 0, 0 };
GetLaraJointPosition(&pos, LM_RFOOT);
auto pos = GetJointPosition(item, LM_RFOOT);
item->Pose.Position.x = pos.x;
item->Pose.Position.y = pos.y + 75;
item->Pose.Position.z = pos.z;

View file

@ -56,7 +56,7 @@ void AnimateShotgun(ItemInfo* laraItem, LaraWeaponType weaponType)
else if (weaponType == LaraWeaponType::RocketLauncher)
pos = Vector3i(0, 84, 72);
pos = GetLaraJointPosition(LM_RHAND, pos);
pos = GetJointPosition(laraItem, LM_RHAND, pos);
if (laraItem->MeshBits)
TriggerGunSmoke(pos.x, pos.y, pos.z, 0, 0, 0, 0, weaponType, lara->LeftArm.GunSmoke);
@ -311,8 +311,8 @@ void FireShotgun(ItemInfo* laraItem)
if (hasFired)
{
auto pos = GetLaraJointPosition(LM_RHAND, Vector3i(0, 1508, 32));
auto pos2 = GetLaraJointPosition(LM_RHAND, Vector3i(0, 228, 32));
auto pos = GetJointPosition(laraItem, LM_RHAND, Vector3i(0, 1508, 32));
auto pos2 = GetJointPosition(laraItem, LM_RHAND, Vector3i(0, 228, 32));
lara->LeftArm.GunSmoke = 32;
@ -462,7 +462,7 @@ void FireHarpoon(ItemInfo* laraItem)
item->ObjectNumber = ID_HARPOON;
item->RoomNumber = laraItem->RoomNumber;
auto jointPos = GetLaraJointPosition(LM_RHAND, Vector3i(-2, 373, 77));
auto jointPos = GetJointPosition(laraItem, LM_RHAND, Vector3i(-2, 373, 77));
int floorHeight = GetCollision(jointPos.x, jointPos.y, jointPos.z, item->RoomNumber).Position.Floor;
if (floorHeight >= jointPos.y)
@ -665,7 +665,7 @@ void FireGrenade(ItemInfo* laraItem)
item->ObjectNumber = ID_GRENADE;
item->RoomNumber = laraItem->RoomNumber;
auto jointPos = GetLaraJointPosition(LM_RHAND, Vector3i(0, 276, 80));
auto jointPos = GetJointPosition(laraItem, LM_RHAND, Vector3i(0, 276, 80));
item->Pose.Position.x = x = jointPos.x;
item->Pose.Position.y = y = jointPos.y;
@ -680,7 +680,7 @@ void FireGrenade(ItemInfo* laraItem)
item->RoomNumber = laraItem->RoomNumber;
}
jointPos = GetLaraJointPosition(LM_RHAND, Vector3i(0, 1204, 5));
jointPos = GetJointPosition(laraItem, LM_RHAND, Vector3i(0, 1204, 5));
lara->LeftArm.GunSmoke = 32;
@ -1088,21 +1088,21 @@ void FireRocket(ItemInfo* laraItem)
if (!ammos.hasInfinite())
(ammos)--;
auto jointPos = GetLaraJointPosition(LM_RHAND, Vector3i(0, 180, 72));
auto jointPos = GetJointPosition(laraItem, LM_RHAND, Vector3i(0, 180, 72));
int x, y, z;
item->Pose.Position.x = x = jointPos.x;
item->Pose.Position.y = y = jointPos.y;
item->Pose.Position.z = z = jointPos.z;
jointPos = GetLaraJointPosition(LM_RHAND, Vector3i(0, 2004, 72));
jointPos = GetJointPosition(laraItem, LM_RHAND, Vector3i(0, 2004, 72));
lara->LeftArm.GunSmoke = 32;
for (int i = 0; i < 5; i++)
TriggerGunSmoke(x, y, z, jointPos.x - x, jointPos.y - y, jointPos.z - z, 1, LaraWeaponType::RocketLauncher, lara->LeftArm.GunSmoke);
jointPos = GetLaraJointPosition(LM_RHAND, Vector3i(0, -CLICK(1), 0));
jointPos = GetJointPosition(laraItem, LM_RHAND, Vector3i(0, -CLICK(1), 0));
for (int i = 0; i < 10; i++)
TriggerGunSmoke(jointPos.x, jointPos.y, jointPos.z, jointPos.x - x, jointPos.y - y, jointPos.z - z, 2, LaraWeaponType::RocketLauncher, 32);
@ -1378,7 +1378,7 @@ void FireCrossbow(ItemInfo* laraItem, PoseData* pos)
}
else
{
auto jointPos = GetLaraJointPosition(LM_RHAND, Vector3i(0, 228, 32));
auto jointPos = GetJointPosition(laraItem, LM_RHAND, Vector3i(0, 228, 32));
item->RoomNumber = laraItem->RoomNumber;
@ -1710,7 +1710,7 @@ void RifleHandler(ItemInfo* laraItem, LaraWeaponType weaponType)
{
if (weaponType == LaraWeaponType::Shotgun || weaponType == LaraWeaponType::HK)
{
auto pos = GetLaraJointPosition(LM_RHAND, Vector3i(0, -64, 0));
auto pos = GetJointPosition(laraItem, LM_RHAND, Vector3i(0, -64, 0));
TriggerDynamicLight(
pos.x, pos.y, pos.z,
12,
@ -1721,7 +1721,7 @@ void RifleHandler(ItemInfo* laraItem, LaraWeaponType weaponType)
}
else if (weaponType == LaraWeaponType::Revolver)
{
auto pos = GetLaraJointPosition(LM_RHAND, Vector3i(0, -32, 0));
auto pos = GetJointPosition(laraItem, LM_RHAND, Vector3i(0, -32, 0));
TriggerDynamicLight(pos.x, pos.y, pos.z, 12, (GetRandomControl() & 0x3F) + 192, (GetRandomControl() & 0x1F) + 128, (GetRandomControl() & 0x3F));
}
}

View file

@ -64,7 +64,7 @@ void AnimatePistols(ItemInfo* laraItem, LaraWeaponType weaponType)
break;
}
auto pos = GetLaraJointPosition(LM_LHAND, offset);
auto pos = GetJointPosition(laraItem, LM_LHAND, offset);
TriggerGunSmoke(pos.x, pos.y, pos.z, 0, 0, 0, 0, weaponType, lara->LeftArm.GunSmoke);
}
@ -86,7 +86,7 @@ void AnimatePistols(ItemInfo* laraItem, LaraWeaponType weaponType)
break;
}
auto pos = GetLaraJointPosition(LM_RHAND, offset);
auto pos = GetJointPosition(laraItem, LM_RHAND, offset);
TriggerGunSmoke(pos.x, pos.y, pos.z, 0, 0, 0, 0, weaponType, lara->RightArm.GunSmoke);
}
}
@ -314,7 +314,7 @@ void PistolHandler(ItemInfo* laraItem, LaraWeaponType weaponType)
if (lara->LeftArm.GunFlash || lara->RightArm.GunFlash)
{
auto pos = GetLaraJointPosition(
auto pos = GetJointPosition(laraItem,
(lara->LeftArm.GunFlash != 0) ? LM_LHAND : LM_RHAND,
Vector3i(
(byte)GetRandomControl() - 128,

View file

@ -325,12 +325,12 @@ void TranslateItem(ItemInfo* item, short headingAngle, float forward, float down
item->Pose.Position = Geometry::TranslatePoint(item->Pose.Position, headingAngle, forward, down, right);
}
void TranslateItem(ItemInfo* item, EulerAngles orient, float distance)
void TranslateItem(ItemInfo* item, const EulerAngles& orient, float distance)
{
item->Pose.Position = Geometry::TranslatePoint(item->Pose.Position, orient, distance);
}
void TranslateItem(ItemInfo* item, Vector3 direction, float distance)
void TranslateItem(ItemInfo* item, const Vector3& direction, float distance)
{
item->Pose.Position = Geometry::TranslatePoint(item->Pose.Position, direction, distance);
}
@ -499,17 +499,6 @@ void ClampRotation(PoseData* pose, short angle, short rotation)
pose->Orientation.y += rotation;
}
Vector3i GetLaraJointPosition(int jointIndex, const Vector3i& offset)
{
if (jointIndex >= NUM_LARA_MESHES)
jointIndex = LM_HEAD;
// Use matrices done in the renderer to transform the offset vector.
auto pos = offset.ToVector3();
g_Renderer.GetLaraAbsBonePosition(pos, jointIndex);
return Vector3i(pos);
}
Vector3i GetJointPosition(ItemInfo* item, int jointIndex, const Vector3i& offset)
{
// Get real item number.

View file

@ -79,8 +79,8 @@ bool HasStateDispatch(ItemInfo* item, int targetState = -1);
bool TestLastFrame(ItemInfo* item, int animNumber = -1);
void TranslateItem(ItemInfo* item, short headingAngle, float forward, float down = 0.0f, float right = 0.0f);
void TranslateItem(ItemInfo* item, EulerAngles orient, float distance);
void TranslateItem(ItemInfo* item, Vector3 direction, float distance);
void TranslateItem(ItemInfo* item, const EulerAngles& orient, float distance);
void TranslateItem(ItemInfo* item, const Vector3& direction, float distance);
void SetAnimation(ItemInfo* item, int animIndex, int frameToStart = 0);
int GetCurrentRelativeFrameNumber(ItemInfo* item);
@ -97,5 +97,4 @@ BOUNDING_BOX* GetBoundsAccurate(ItemInfo* item);
void ClampRotation(PoseData* pose, short angle, short rotation);
void DrawAnimatingItem(ItemInfo* item);
Vector3i GetLaraJointPosition(int jointIndex, const Vector3i& offset = Vector3i::Zero);
Vector3i GetJointPosition(ItemInfo* item, int jointIndex, const Vector3i& offset = Vector3i::Zero);

View file

@ -460,8 +460,8 @@ void UpdateCameraElevation()
if (Camera.laraNode != -1)
{
auto pos = GetLaraJointPosition(Camera.laraNode, Vector3i::Zero);
auto pos1 = GetLaraJointPosition(Camera.laraNode, Vector3i(0, -CLICK(1), SECTOR(2)));
auto pos = GetJointPosition(LaraItem, Camera.laraNode, Vector3i::Zero);
auto pos1 = GetJointPosition(LaraItem, Camera.laraNode, Vector3i(0, -CLICK(1), SECTOR(2)));
pos = pos1 - pos;
Camera.actualAngle = Camera.targetAngle + phd_atan(pos.z, pos.x);
}
@ -829,7 +829,7 @@ void LookCamera(ItemInfo* item)
else
OldCam.pos.Orientation.y = lara->ExtraHeadRot.y;
auto pos = GetLaraJointPosition(LM_HEAD, Vector3i(0, CLICK(0.25f) / 4, CLICK(0.25f)));
auto pos = GetJointPosition(item, LM_HEAD, Vector3i(0, CLICK(0.25f) / 4, CLICK(0.25f)));
auto probe = GetCollision(pos.x, pos.y, pos.z, item->RoomNumber);
if (probe.Position.Floor == NO_HEIGHT ||
@ -838,7 +838,7 @@ void LookCamera(ItemInfo* item)
pos.y > probe.Position.Floor ||
pos.y < probe.Position.Ceiling)
{
pos = GetLaraJointPosition(LM_HEAD, Vector3i(0, CLICK(0.25f) / 4, 0));
pos = GetJointPosition(item, LM_HEAD, Vector3i(0, CLICK(0.25f) / 4, 0));
probe = GetCollision(pos.x, pos.y + CLICK(1), pos.z, item->RoomNumber);
if (TestEnvironment(ENV_FLAG_SWAMP, probe.RoomNumber))
@ -855,12 +855,12 @@ void LookCamera(ItemInfo* item)
pos.y > probe.Position.Floor ||
pos.y < probe.Position.Ceiling)
{
pos = GetLaraJointPosition(LM_HEAD, Vector3i(0, CLICK(0.25f) / 4, -CLICK(0.25f)));
pos = GetJointPosition(item, LM_HEAD, Vector3i(0, CLICK(0.25f) / 4, -CLICK(0.25f)));
}
}
auto pos2 = GetLaraJointPosition(LM_HEAD, Vector3i(0, 0, -SECTOR(1)));
auto pos3 = GetLaraJointPosition(LM_HEAD, Vector3i(0, 0, CLICK(8)));
auto pos2 = GetJointPosition(item, LM_HEAD, Vector3i(0, 0, -SECTOR(1)));
auto pos3 = GetJointPosition(item, LM_HEAD, Vector3i(0, 0, CLICK(8)));
int dx = (pos2.x - pos.x) >> 3;
int dy = (pos2.y - pos.y) >> 3;
@ -1368,7 +1368,7 @@ void BinocularCamera(ItemInfo* item)
void ConfirmCameraTargetPos()
{
auto pos = GetLaraJointPosition(LM_TORSO);
auto pos = GetJointPosition(LaraItem, LM_TORSO);
if (Camera.laraNode != -1)
{

View file

@ -22,8 +22,8 @@ using namespace TEN::Math::Random;
void TriggerChaffEffects(int flareAge)
{
auto pos = GetLaraJointPosition(LM_LHAND, Vector3i(8, 36, 32));
auto vect = GetLaraJointPosition(LM_LHAND, Vector3i(8, 36, 1024 + (GetRandomDraw() & 255)));
auto pos = GetJointPosition(LaraItem, LM_LHAND, Vector3i(8, 36, 32));
auto vect = GetJointPosition(LaraItem, LM_LHAND, Vector3i(8, 36, 1024 + (GetRandomDraw() & 255)));
auto vel = vect - pos;
TriggerChaffEffects(LaraItem, &pos, &vel, LaraItem->Animation.Velocity.z, (bool)(g_Level.Rooms[LaraItem->RoomNumber].flags & ENV_FLAG_WATER), flareAge);
}

View file

@ -1046,12 +1046,13 @@ void TriggerLaraBlood()
{
if (node & LaraItem->TouchBits)
{
auto vec = GetLaraJointPosition(
auto vec = GetJointPosition(LaraItem,
i,
Vector3i(
(GetRandomControl() & 31) - 16,
(GetRandomControl() & 31) - 16,
(GetRandomControl() & 31) - 16));
(GetRandomControl() & 31) - 16
));
DoBloodSplat(vec.x, vec.y, vec.z, (GetRandomControl() & 7) + 8, 2 * GetRandomControl(), LaraItem->RoomNumber);
}

View file

@ -24,7 +24,7 @@ namespace TEN::Effects::Footprints
short roomNumber = item.RoomNumber;
auto floor = GetFloor(x, y, z, &roomNumber);
auto pos = GetLaraJointPosition(mesh, Vector3i(0, FOOT_HEIGHT_OFFSET, 0));
auto pos = GetJointPosition(LaraItem, mesh, Vector3i(0, FOOT_HEIGHT_OFFSET, 0));
int height = GetFloorHeight(floor, pos.x, pos.y - CLICK(1), pos.z);
outFootprintPosition.x = pos.x;

View file

@ -8,6 +8,7 @@
#include "Game/effects/weather.h"
#include "Game/items.h"
#include "Game/Lara/lara.h"
#include "Game/Lara/lara_helpers.h"
#include "Renderer/Renderer11.h"
#include "Flow/ScriptInterfaceFlowHandler.h"
#include "Specific/setup.h"
@ -60,7 +61,7 @@ void HairControl(ItemInfo* item, int ponytail, ANIM_FRAME* framePtr)
int spaz;
bool youngLara = g_GameFlow->GetLevel(CurrentLevel)->GetLaraType() == LaraType::Young;
LaraInfo*& lara = item->Data;
auto* lara = GetLaraInfo(item);
if (framePtr == NULL)
{
@ -107,14 +108,14 @@ void HairControl(ItemInfo* item, int ponytail, ANIM_FRAME* framePtr)
// Get Lara's spheres in absolute coordinates for head, torso, hips, and upper arms.
auto* mesh = &g_Level.Meshes[lara->MeshPtrs[LM_HIPS]];
auto pos = GetLaraJointPosition(LM_HIPS, Vector3i(mesh->sphere.Center.x, mesh->sphere.Center.y, mesh->sphere.Center.z));
auto pos = GetJointPosition(item, LM_HIPS, Vector3i(mesh->sphere.Center.x, mesh->sphere.Center.y, mesh->sphere.Center.z));
sphere[0].x = pos.x;
sphere[0].y = pos.y;
sphere[0].z = pos.z;
sphere[0].r = (int)mesh->sphere.Radius;
mesh = &g_Level.Meshes[lara->MeshPtrs[LM_TORSO]];
pos = GetLaraJointPosition(LM_TORSO, Vector3i(mesh->sphere.Center.x - 10, mesh->sphere.Center.y, mesh->sphere.Center.z + 25));
pos = GetJointPosition(item, LM_TORSO, Vector3i(mesh->sphere.Center.x - 10, mesh->sphere.Center.y, mesh->sphere.Center.z + 25));
sphere[1].x = pos.x;
sphere[1].y = pos.y;
sphere[1].z = pos.z;
@ -123,21 +124,21 @@ void HairControl(ItemInfo* item, int ponytail, ANIM_FRAME* framePtr)
sphere[1].r = sphere[1].r - ((sphere[1].r >> 2) + (sphere[1].r >> 3));
mesh = &g_Level.Meshes[lara->MeshPtrs[LM_HEAD]];
pos = GetLaraJointPosition(LM_HEAD, Vector3i(mesh->sphere.Center.x - 2, mesh->sphere.Center.y, mesh->sphere.Center.z));
pos = GetJointPosition(item, LM_HEAD, Vector3i(mesh->sphere.Center.x - 2, mesh->sphere.Center.y, mesh->sphere.Center.z));
sphere[2].x = pos.x;
sphere[2].y = pos.y;
sphere[2].z = pos.z;
sphere[2].r = (int)mesh->sphere.Radius;
mesh = &g_Level.Meshes[lara->MeshPtrs[LM_RINARM]];
pos = GetLaraJointPosition(LM_RINARM, Vector3i(mesh->sphere.Center.x, mesh->sphere.Center.y, mesh->sphere.Center.z));
pos = GetJointPosition(item, LM_RINARM, Vector3i(mesh->sphere.Center.x, mesh->sphere.Center.y, mesh->sphere.Center.z));
sphere[3].x = pos.x;
sphere[3].y = pos.y;
sphere[3].z = pos.z;
sphere[3].r = int(4.0f * mesh->sphere.Radius / 3.0f); // Resizing sphere - from tomb5
mesh = &g_Level.Meshes[lara->MeshPtrs[LM_LINARM]];
pos = GetLaraJointPosition(LM_LINARM, Vector3i(mesh->sphere.Center.x, mesh->sphere.Center.y, mesh->sphere.Center.z));
pos = GetJointPosition(item, LM_LINARM, Vector3i(mesh->sphere.Center.x, mesh->sphere.Center.y, mesh->sphere.Center.z));
sphere[4].x = pos.x;
sphere[4].y = pos.y;
sphere[4].z = pos.z;

View file

@ -87,9 +87,9 @@ namespace TEN::Effects::Lara
float z = std::sin(TO_RAD(item->Pose.Orientation.y)) * -64.0f;
float x = std::cos(TO_RAD(item->Pose.Orientation.y)) * -64.0f;
auto offset = GetLaraJointPosition(LM_HEAD, Vector3i(0, -4, 64));
auto offset = GetJointPosition(item, LM_HEAD, Vector3i(0, -4, 64));
auto seed = GetLaraJointPosition(
auto seed = GetJointPosition(item,
LM_HEAD,
Vector3i((GetRandomControl() & 7) - 4,
(GetRandomControl() & 7) - 8,

View file

@ -956,14 +956,14 @@ void TriggerGunShell(short hand, short objNum, LaraWeaponType weaponType)
break;
}
pos = GetLaraJointPosition(LM_RHAND, offset);
pos = GetJointPosition(LaraItem, LM_RHAND, offset);
}
else
{
if (weaponType == LaraWeaponType::Pistol)
pos = GetLaraJointPosition(LM_LHAND, Vector3i(-12, 48, 40));
pos = GetJointPosition(LaraItem, LM_LHAND, Vector3i(-12, 48, 40));
else if (weaponType == LaraWeaponType::Uzi)
pos = GetLaraJointPosition(LM_LHAND, Vector3i(-16, 35, 48));
pos = GetJointPosition(LaraItem, LM_LHAND, Vector3i(-16, 35, 48));
}
auto* gshell = &Gunshells[GetFreeGunshell()];
@ -1157,9 +1157,9 @@ void LaraBubbles(ItemInfo* item)
auto pos = Vector3i::Zero;
if (level->GetLaraType() == LaraType::Divesuit)
pos = GetLaraJointPosition(LM_TORSO, Vector3i(0, -192, -160));
pos = GetJointPosition(item, LM_TORSO, Vector3i(0, -192, -160));
else
GetLaraJointPosition(LM_HEAD, Vector3i(0, -4, -64));
GetJointPosition(item, LM_HEAD, Vector3i(0, -4, -64));
int numBubbles = (GetRandomControl() & 1) + 2;
for (int i = 0; i < numBubbles; i++)
@ -1258,7 +1258,7 @@ void TriggerLaraDrips(ItemInfo* item)
{
for (int i = 0; i < NUM_LARA_MESHES; i++)
{
auto pos = GetLaraJointPosition(i);
auto pos = GetJointPosition(item, i);
auto room = GetRoom(item->Location, pos.x, pos.y, pos.z).roomNumber;
if (g_Level.Rooms[room].flags & ENV_FLAG_WATER)
@ -1270,7 +1270,7 @@ void TriggerLaraDrips(ItemInfo* item)
{
auto* drip = &Drips[GetFreeDrip()];
auto pos = GetLaraJointPosition(
auto pos = GetJointPosition(item,
i,
Vector3i(
(GetRandomControl() & 0x1F) - 16,

View file

@ -90,7 +90,7 @@ short GunMiss(int x, int y, int z, short velocity, short yRot, short roomNumber)
short GunHit(int x, int y, int z, short velocity, short yRot, short roomNumber)
{
auto pos = GetLaraJointPosition((25 * GetRandomControl()) >> 15);
auto pos = GetJointPosition(LaraItem, (25 * GetRandomControl()) >> 15);
DoBloodSplat(pos.x, pos.y, pos.z, (GetRandomControl() & 3) + 3, LaraItem->Pose.Orientation.y, LaraItem->RoomNumber);
return GunShot(x, y, z, velocity, yRot, roomNumber);
}

View file

@ -274,7 +274,7 @@ namespace TEN::Entities::Effects
{
if (!(Wibble & 0xC))
{
fx->pos.Position = GetLaraJointPosition(i);
fx->pos.Position = GetJointPosition(LaraItem, i);
// TR5 code?
if (Lara.BurnCount)
@ -291,7 +291,7 @@ namespace TEN::Entities::Effects
byte r = (GetRandomControl() & 0x3F) + 192;
byte g = (GetRandomControl() & 0x1F) + 96;
auto pos = GetLaraJointPosition(LM_HIPS);
auto pos = GetJointPosition(LaraItem, LM_HIPS);
if (!Lara.BurnSmoke)
{

View file

@ -173,7 +173,7 @@ namespace TEN::Entities::Generic
if (lara->Torch.IsLit)
{
auto pos = GetLaraJointPosition(LM_LHAND, Vector3i(-32, 64, 256));
auto pos = GetJointPosition(laraItem, LM_LHAND, Vector3i(-32, 64, 256));
TriggerDynamicLight(pos.x, pos.y, pos.z, 12 - (GetRandomControl() & 1), (GetRandomControl() & 0x3F) + 192, (GetRandomControl() & 0x1F) + 96, 0);
if (!(Wibble & 7))

View file

@ -196,8 +196,8 @@ void HorizontalBarCollision(short itemNumber, ItemInfo* laraItem, CollisionInfo*
else
laraItem->Pose.Orientation.y = barItem->Pose.Orientation.y - ANGLE(180.0f);
auto pos1 = GetLaraJointPosition(LM_LHAND, Vector3i(0, -128, 512));
auto pos2 = GetLaraJointPosition(LM_RHAND, Vector3i(0, -128, 512));
auto pos1 = GetJointPosition(laraItem, LM_LHAND, Vector3i(0, -128, 512));
auto pos2 = GetJointPosition(laraItem, LM_RHAND, Vector3i(0, -128, 512));
if (laraItem->Pose.Orientation.y & 0x4000)
laraItem->Pose.Position.x += barItem->Pose.Position.x - ((pos1.x + pos2.x) >> 1);

View file

@ -1049,7 +1049,7 @@ namespace TEN::Entities::Vehicles
if (laraItem->Animation.AnimNumber == Objects[ID_KAYAK_LARA_ANIMS].animIndex + KAYAK_ANIM_DISMOUNT_LEFT &&
frame == 83)
{
auto vec = GetLaraJointPosition(LM_HIPS, Vector3i(0, 350, 500));
auto vec = GetJointPosition(laraItem, LM_HIPS, Vector3i(0, 350, 500));
SetAnimation(laraItem, LA_JUMP_FORWARD);
laraItem->Pose.Position = vec;
@ -1070,7 +1070,7 @@ namespace TEN::Entities::Vehicles
if (laraItem->Animation.AnimNumber == Objects[ID_KAYAK_LARA_ANIMS].animIndex + KAYAK_ANIM_DISMOUNT_RIGHT &&
frame == 83)
{
auto vec = GetLaraJointPosition(LM_HIPS, Vector3i(0, 350, 500));
auto vec = GetJointPosition(laraItem, LM_HIPS, Vector3i(0, 350, 500));
SetAnimation(laraItem, LA_JUMP_FORWARD);
laraItem->Pose.Position = vec;

View file

@ -757,7 +757,7 @@ namespace TEN::Entities::Vehicles
if (laraItem->Animation.AnimNumber == Objects[ID_MINECART_LARA_ANIMS].animIndex + MINECART_ANIM_DISMOUNT_LEFT &&
laraItem->Animation.FrameNumber == g_Level.Anims[laraItem->Animation.AnimNumber].frameEnd)
{
auto pos = GetLaraJointPosition(LM_HIPS, Vector3i(0, 640, 0));
auto pos = GetJointPosition(laraItem, LM_HIPS, Vector3i(0, 640, 0));
laraItem->Pose.Position = pos;
laraItem->Pose.Orientation = EulerAngles(0, minecartItem->Pose.Orientation.y + ANGLE(90.0f), 0);
@ -772,7 +772,7 @@ namespace TEN::Entities::Vehicles
if (laraItem->Animation.AnimNumber == Objects[ID_MINECART_LARA_ANIMS].animIndex + MINECART_ANIM_DISMOUNT_RIGHT &&
laraItem->Animation.FrameNumber == g_Level.Anims[laraItem->Animation.AnimNumber].frameEnd)
{
auto pos = GetLaraJointPosition(LM_HIPS, Vector3i(0, 640, 0));
auto pos = GetJointPosition(laraItem, LM_HIPS, Vector3i(0, 640, 0));
laraItem->Pose.Position = pos;
laraItem->Pose.Orientation = EulerAngles(0, minecartItem->Pose.Orientation.y - ANGLE(90.0f), 0);

View file

@ -717,7 +717,7 @@ namespace TEN::Entities::Vehicles
{
UPV->Flags &= ~UPV_FLAG_CONTROL;
auto vec = GetLaraJointPosition(LM_HIPS);
auto vec = GetJointPosition(laraItem, LM_HIPS);
auto LPos = GameVector(
vec.x,
@ -766,7 +766,7 @@ namespace TEN::Entities::Vehicles
else
heightFromWater = NO_HEIGHT;
auto vec = GetLaraJointPosition(LM_HIPS);
auto vec = GetJointPosition(laraItem, LM_HIPS);
laraItem->Pose.Position.x = vec.x;
//laraItem->Pose.Position.y += -heightFromWater + 1; // Doesn't work as intended.
@ -802,7 +802,7 @@ namespace TEN::Entities::Vehicles
if ((anim == UPV_ANIM_IDLE_DEATH || anim == UPV_ANIM_MOVING_DEATH) &&
(frame == UPV_DEATH_FRAME_1 || frame == UPV_DEATH_FRAME_2))
{
auto vec = GetLaraJointPosition(LM_HIPS);
auto vec = GetJointPosition(laraItem, LM_HIPS);
laraItem->Pose.Position = vec;
laraItem->Pose.Orientation.x = 0;
laraItem->Pose.Orientation.z = 0;

View file

@ -26,7 +26,7 @@ void ClockworkBeetleControl(short itemNumber)
if (LaraItem->Animation.FrameNumber < fb + 104)
{
auto pos = GetLaraJointPosition(LM_RHAND, Vector3i(0, 0, -32));
auto pos = GetJointPosition(LaraItem, LM_RHAND, Vector3i(0, 0, -32));
beetle->Pose.Position = pos;
beetle->Status = ITEM_ACTIVE;

View file

@ -163,7 +163,7 @@ void ScalesCollision(short itemNumber, ItemInfo* laraItem, CollisionInfo* coll)
laraItem->Animation.FrameNumber >= g_Level.Anims[LA_WATERSKIN_POUR_HIGH].frameBase + 51 &&
laraItem->Animation.FrameNumber <= g_Level.Anims[LA_WATERSKIN_POUR_HIGH].frameBase + 74)
{
auto pos = GetLaraJointPosition(LM_LHAND);
auto pos = GetJointPosition(laraItem, LM_LHAND);
auto* drip = &Drips[GetFreeDrip()];
drip->x = pos.x;

View file

@ -69,7 +69,7 @@ namespace TEN::Entities::Creatures::TR5
item->MeshBits = 1664;
auto pos1 = GameVector(GetJointPosition(item, 8, Vector3i(0, 0, -64)));
auto pos2 = GameVector(GetLaraJointPosition(LM_HIPS));
auto pos2 = GameVector(GetJointPosition(LaraItem, LM_HIPS));
pos1.roomNumber = item->RoomNumber;
@ -108,7 +108,7 @@ namespace TEN::Entities::Creatures::TR5
if (TestProbability(0.75f))
{
auto pos2 = GetLaraJointPosition(GetRandomControl() % 15);
auto pos2 = GetJointPosition(LaraItem, GetRandomControl() % 15);
DoBloodSplat(pos2.x, pos2.y, pos2.z, (GetRandomControl() & 3) + 3, 2 * GetRandomControl(), LaraItem->RoomNumber);
DoDamage(LaraItem, 20);
}

View file

@ -599,12 +599,12 @@ namespace TEN::Entities::Creatures::TR5
}
else if (item->Animation.ActiveState == 43 && !Lara.Burn)
{
auto pos = GetLaraJointPosition(LM_LFOOT);
auto pos = GetJointPosition(LaraItem, LM_LFOOT);
short roomNumberLeft = LaraItem->RoomNumber;
GetFloor(pos.x, pos.y, pos.z, &roomNumberLeft);
pos = GetLaraJointPosition(LM_RFOOT);
pos = GetJointPosition(LaraItem, LM_RFOOT);
short roomNumberRight = LaraItem->RoomNumber;
GetFloor(pos.x, pos.y, pos.z, &roomNumberRight);

View file

@ -24,7 +24,7 @@ namespace TEN::Entities::Creatures::TR5
{
SoundEffect(SFX_TR4_HELICOPTER_LOOP, &item->Pose);
auto pos = GameVector(GetLaraJointPosition(
auto pos = GameVector(GetJointPosition(LaraItem,
LM_TORSO,
Vector3i(
(GetRandomControl() & 0x1FF) - 255,

View file

@ -69,10 +69,10 @@ namespace TEN::Entities::Creatures::TR5
item->Animation.FrameNumber = g_Level.Anims[item->Animation.AnimNumber].frameBase;
}
static void ImpThrowStones(ItemInfo* item)
void ImpThrowStones(ItemInfo* item)
{
auto pos1 = GetJointPosition(item, 9);
auto pos2 = GetLaraJointPosition(LM_HEAD);
auto pos2 = GetJointPosition(LaraItem, LM_HEAD);
int dx = pos1.x - pos2.x;
int dy = pos1.y - pos2.y;

View file

@ -45,7 +45,7 @@ void GenSlot1Control(short itemNumber)
{
for (int i = 0; i < 8; i++)
{
auto pos = GetLaraJointPosition(i + 7);
auto pos = GetJointPosition(LaraItem, i + 7);
int x = pos.x + (GetRandomControl() & 0xFF) - 128;
int y = pos.y + (GetRandomControl() & 0xFF) - 128;
int z = pos.z + (GetRandomControl() & 0xFF) - 128;

View file

@ -91,7 +91,7 @@ void ExplosionControl(short itemNumber)
}
else if (flag == 2)
{
auto vec = GetLaraJointPosition(LM_HIPS);
auto vec = GetJointPosition(LaraItem, LM_HIPS);
int dx = vec.x - item->Pose.Position.x;
int dy = vec.y - item->Pose.Position.y;

View file

@ -641,7 +641,6 @@ namespace TEN::Renderer
void ResetAnimations();
void UpdateLaraAnimations(bool force);
void UpdateItemAnimations(int itemNumber, bool force);
void GetLaraAbsBonePosition(Vector3& pos, int jointIndex);
void GetItemAbsBonePosition(int itemNumber, Vector3& pos, int jointIndex);
int GetSpheres(short itemNumber, BoundingSphere* ptr, char worldSpace, Matrix local);
void GetBoneMatrix(short itemNumber, int jointIndex, Matrix* outMatrix);

View file

@ -75,7 +75,7 @@ namespace TEN::Renderer
// Push foot spheres a little lower.
if (sphereMeshes[i] == LM_LFOOT || sphereMeshes[i] == LM_RFOOT)
offset.y += 8;
auto pos = GetLaraJointPosition(sphereMeshes[i], offset);
auto pos = GetJointPosition(LaraItem, sphereMeshes[i], offset);
auto& newSphere = nearestSpheres.emplace_back();
newSphere.position = Vector3(pos.x, pos.y, pos.z);

View file

@ -250,7 +250,7 @@ namespace TEN::Renderer
if (meshIndex >= 0)
nodePos = GetJointPosition(item, meshIndex, nodePos);
else
nodePos = GetLaraJointPosition(-meshIndex, nodePos);
nodePos = GetJointPosition(LaraItem, -meshIndex, nodePos);
NodeOffsets[particle->nodeNumber].gotIt = true;

View file

@ -382,16 +382,6 @@ namespace TEN::Renderer
return m_meshes[meshIndex];
}
void Renderer11::GetLaraAbsBonePosition(Vector3& pos, int jointIndex)
{
if (jointIndex >= MAX_BONES)
jointIndex = 0;
auto world = m_moveableObjects[ID_LARA]->AnimationTransforms[jointIndex];
world = world * m_LaraWorldMatrix;
pos = Vector3::Transform(pos, world);
}
void Renderer11::GetItemAbsBonePosition(int itemNumber, Vector3& pos, int jointIndex)
{
auto* rendererItem = &m_items[itemNumber];