mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-28 15:57:59 +03:00
Adngel fix death camera (#1449)
* Update function * Adding comments. * Function renamed Function renamed and conditionals separated for clarity. * Extracted Camera data modifications Extracted commands that changes camera data, from the camera code, and moved them into the objects coded to follow similar logic with other cases (like enemies that change these values from their control code). Leaving a simplified CalculateDeathCamera() function. * Update tr5_rollingball.cpp Not really needed, so I removed it to keep consistency with the other calls. Also edited values adding the .0f for same reasons.
This commit is contained in:
parent
4aac07c0c4
commit
a962a17f66
4 changed files with 39 additions and 2 deletions
|
@ -1289,6 +1289,9 @@ void CalculateCamera(const CollisionInfo& coll)
|
|||
Camera.DisableInterpolation = (Camera.DisableInterpolation || Camera.lastType != Camera.type);
|
||||
Camera.lastType = Camera.type;
|
||||
|
||||
if (CalculateDeathCamera())
|
||||
return;
|
||||
|
||||
if (Camera.type != CameraType::Heavy || Camera.timer == -1)
|
||||
{
|
||||
Camera.type = CameraType::Chase;
|
||||
|
@ -1304,6 +1307,27 @@ void CalculateCamera(const CollisionInfo& coll)
|
|||
}
|
||||
}
|
||||
|
||||
bool CalculateDeathCamera()
|
||||
{
|
||||
// If player is alive, it's not a death camera.
|
||||
if (LaraItem->HitPoints > 0)
|
||||
return false;
|
||||
|
||||
// If Lara is in a special death animation (from extra_anims) triggered by enemies.
|
||||
if (LaraItem->Animation.AnimObjectID == ID_LARA_EXTRA_ANIMS)
|
||||
return true;
|
||||
|
||||
// Special death animations
|
||||
if (LaraItem->Animation.AnimNumber == LA_SPIKE_DEATH ||
|
||||
LaraItem->Animation.AnimNumber == LA_BOULDER_DEATH ||
|
||||
LaraItem->Animation.AnimNumber == LA_TRAIN_OVERBOARD_DEATH)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TestBoundsCollideCamera(const GameBoundingBox& bounds, const Pose& pose, short radius)
|
||||
{
|
||||
auto sphere = BoundingSphere(Camera.pos.ToVector3(), radius);
|
||||
|
|
|
@ -105,6 +105,7 @@ void BinocularCamera(ItemInfo* item);
|
|||
void ConfirmCameraTargetPos();
|
||||
void CalculateCamera(const CollisionInfo& coll);
|
||||
void RumbleScreen();
|
||||
bool CalculateDeathCamera();
|
||||
bool TestBoundsCollideCamera(const GameBoundingBox& bounds, const Pose& pose, short radius);
|
||||
void ItemPushCamera(GameBoundingBox* bounds, Pose* pos, short radius);
|
||||
void ItemsCollideCamera();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "framework.h"
|
||||
#include "Objects/TR4/Trap/tr4_teethspike.h"
|
||||
|
||||
#include "Game/camera.h"
|
||||
#include "Game/collision/collide_item.h"
|
||||
#include "Game/collision/collide_room.h"
|
||||
#include "Game/collision/Point.h"
|
||||
|
@ -161,6 +162,11 @@ namespace TEN::Entities::Traps
|
|||
{
|
||||
SetAnimation(LaraItem, LA_SPIKE_DEATH);
|
||||
LaraItem->Animation.IsAirborne = false;
|
||||
|
||||
Camera.flags = CF_FOLLOW_CENTER;
|
||||
Camera.targetAngle = ANGLE(-150.0f);
|
||||
Camera.targetElevation = ANGLE(-25.0f);
|
||||
Camera.targetDistance = BLOCK(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,6 +41,11 @@ void RollingBallCollision(short itemNumber, ItemInfo* laraItem, CollisionInfo* c
|
|||
!TestEnvironment(RoomEnvFlags::ENV_FLAG_WATER, laraItem))
|
||||
{
|
||||
SetAnimation(laraItem, LA_BOULDER_DEATH);
|
||||
|
||||
Camera.flags = CF_FOLLOW_CENTER;
|
||||
Camera.targetAngle = ANGLE(170.0f);
|
||||
Camera.targetElevation = ANGLE(-25.0f);
|
||||
Camera.targetDistance = BLOCK(2);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -364,8 +369,9 @@ void ClassicRollingBallCollision(short itemNum, ItemInfo* lara, CollisionInfo* c
|
|||
SetAnimation(lara, LA_BOULDER_DEATH);
|
||||
|
||||
Camera.flags = CF_FOLLOW_CENTER;
|
||||
Camera.targetAngle = ANGLE(170);
|
||||
Camera.targetElevation = -ANGLE(25);
|
||||
Camera.targetAngle = ANGLE(170.0f);
|
||||
Camera.targetElevation = -ANGLE(-25.0f);
|
||||
Camera.targetDistance = BLOCK(2);
|
||||
|
||||
for (int i = 0; i < 15; i++)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue