mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-08 11:38:08 +03:00
Minor refactoring, cleanup
This commit is contained in:
parent
fc0d7611b4
commit
64a57cad92
8 changed files with 74 additions and 68 deletions
|
@ -36,8 +36,8 @@ void lara_as_crouch_idle(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
|
|
||||||
LaraInfo*& info = item->data;
|
LaraInfo*& info = item->data;
|
||||||
|
|
||||||
coll->Setup.EnableSpasm = false;
|
|
||||||
coll->Setup.EnableObjectPush = true;
|
coll->Setup.EnableObjectPush = true;
|
||||||
|
coll->Setup.EnableSpasm = false;
|
||||||
Camera.targetElevation = -ANGLE(24.0f);
|
Camera.targetElevation = -ANGLE(24.0f);
|
||||||
|
|
||||||
// TODO: Dispatch pickups from within states.
|
// TODO: Dispatch pickups from within states.
|
||||||
|
@ -144,8 +144,8 @@ void lara_as_crouch_roll(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
LaraInfo*& info = item->data;
|
LaraInfo*& info = item->data;
|
||||||
|
|
||||||
info->look = false;
|
info->look = false;
|
||||||
coll->Setup.EnableSpasm = false;
|
|
||||||
coll->Setup.EnableObjectPush = true;
|
coll->Setup.EnableObjectPush = true;
|
||||||
|
coll->Setup.EnableSpasm = false;
|
||||||
Camera.targetElevation = -ANGLE(24.0f);
|
Camera.targetElevation = -ANGLE(24.0f);
|
||||||
|
|
||||||
if (TrInput & IN_LEFT)
|
if (TrInput & IN_LEFT)
|
||||||
|
@ -348,8 +348,8 @@ void lara_as_crawl_idle(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
LaraInfo*& info = item->data;
|
LaraInfo*& info = item->data;
|
||||||
|
|
||||||
info->gunStatus = LG_HANDS_BUSY;
|
info->gunStatus = LG_HANDS_BUSY;
|
||||||
coll->Setup.EnableSpasm = false;
|
|
||||||
coll->Setup.EnableObjectPush = true;
|
coll->Setup.EnableObjectPush = true;
|
||||||
|
coll->Setup.EnableSpasm = false;
|
||||||
Camera.targetElevation = -ANGLE(24.0f);
|
Camera.targetElevation = -ANGLE(24.0f);
|
||||||
|
|
||||||
// TODO: Dispatch pickups from within states.
|
// TODO: Dispatch pickups from within states.
|
||||||
|
@ -487,8 +487,8 @@ void lara_as_crawl_forward(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
LaraInfo*& info = item->data;
|
LaraInfo*& info = item->data;
|
||||||
|
|
||||||
info->gunStatus = LG_HANDS_BUSY;
|
info->gunStatus = LG_HANDS_BUSY;
|
||||||
coll->Setup.EnableSpasm = false;
|
|
||||||
coll->Setup.EnableObjectPush = true;
|
coll->Setup.EnableObjectPush = true;
|
||||||
|
coll->Setup.EnableSpasm = false;
|
||||||
Camera.targetElevation = -ANGLE(24.0f);
|
Camera.targetElevation = -ANGLE(24.0f);
|
||||||
|
|
||||||
if (item->hitPoints <= 0)
|
if (item->hitPoints <= 0)
|
||||||
|
@ -592,8 +592,8 @@ void lara_as_crawl_back(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
|
|
||||||
info->look = false;
|
info->look = false;
|
||||||
info->gunStatus = LG_HANDS_BUSY;
|
info->gunStatus = LG_HANDS_BUSY;
|
||||||
coll->Setup.EnableSpasm = false;
|
|
||||||
coll->Setup.EnableObjectPush = true;
|
coll->Setup.EnableObjectPush = true;
|
||||||
|
coll->Setup.EnableSpasm = false;
|
||||||
Camera.targetElevation = -ANGLE(24.0f);
|
Camera.targetElevation = -ANGLE(24.0f);
|
||||||
|
|
||||||
if (item->hitPoints <= 0)
|
if (item->hitPoints <= 0)
|
||||||
|
@ -688,8 +688,8 @@ void lara_as_crawl_turn_left(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
LaraInfo*& info = item->data;
|
LaraInfo*& info = item->data;
|
||||||
|
|
||||||
info->gunStatus = LG_HANDS_BUSY;
|
info->gunStatus = LG_HANDS_BUSY;
|
||||||
coll->Setup.EnableSpasm = false;
|
|
||||||
coll->Setup.EnableObjectPush = true;
|
coll->Setup.EnableObjectPush = true;
|
||||||
|
coll->Setup.EnableSpasm = false;
|
||||||
Camera.targetElevation = -ANGLE(24.0f);
|
Camera.targetElevation = -ANGLE(24.0f);
|
||||||
|
|
||||||
if (item->hitPoints <= 0)
|
if (item->hitPoints <= 0)
|
||||||
|
@ -748,8 +748,8 @@ void lara_as_crawl_turn_right(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
LaraInfo*& info = item->data;
|
LaraInfo*& info = item->data;
|
||||||
|
|
||||||
info->gunStatus = LG_HANDS_BUSY;
|
info->gunStatus = LG_HANDS_BUSY;
|
||||||
coll->Setup.EnableSpasm = false;
|
|
||||||
coll->Setup.EnableObjectPush = true;
|
coll->Setup.EnableObjectPush = true;
|
||||||
|
coll->Setup.EnableSpasm = false;
|
||||||
Camera.targetElevation = -ANGLE(24.0f);
|
Camera.targetElevation = -ANGLE(24.0f);
|
||||||
|
|
||||||
if (item->hitPoints <= 0)
|
if (item->hitPoints <= 0)
|
||||||
|
@ -805,8 +805,8 @@ void lara_col_crawl_to_hang(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
{
|
{
|
||||||
LaraInfo*& info = item->data;
|
LaraInfo*& info = item->data;
|
||||||
|
|
||||||
|
coll->Setup.EnableObjectPush = true;
|
||||||
coll->Setup.EnableSpasm = false;
|
coll->Setup.EnableSpasm = false;
|
||||||
coll->Setup.EnableObjectPush = false;
|
|
||||||
Camera.targetAngle = 0;
|
Camera.targetAngle = 0;
|
||||||
Camera.targetElevation = -ANGLE(45.0f);
|
Camera.targetElevation = -ANGLE(45.0f);
|
||||||
|
|
||||||
|
|
|
@ -246,8 +246,6 @@ void SetLaraFallBackState(ITEM_INFO* item)
|
||||||
|
|
||||||
void SetLaraMonkeyFallState(ITEM_INFO* item)
|
void SetLaraMonkeyFallState(ITEM_INFO* item)
|
||||||
{
|
{
|
||||||
LaraInfo*& info = item->data;
|
|
||||||
|
|
||||||
// Hack.
|
// Hack.
|
||||||
if (item->activeState == LS_MONKEY_TURN_180)
|
if (item->activeState == LS_MONKEY_TURN_180)
|
||||||
return;
|
return;
|
||||||
|
@ -340,14 +338,9 @@ void HandleLaraMovementParameters(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
LaraInfo*& info = item->data;
|
LaraInfo*& info = item->data;
|
||||||
|
|
||||||
// Reset running jump timer.
|
// Reset running jump timer.
|
||||||
if (item->activeState != LS_RUN_FORWARD &&
|
if (!IsRunJumpCountState((LARA_STATE)item->activeState))
|
||||||
item->activeState != LS_WALK_FORWARD &&
|
|
||||||
item->activeState != LS_JUMP_FORWARD &&
|
|
||||||
item->activeState != LS_SPRINT &&
|
|
||||||
item->activeState != LS_SPRINT_DIVE)
|
|
||||||
{
|
|
||||||
info->runJumpCount = 0;
|
info->runJumpCount = 0;
|
||||||
}
|
|
||||||
|
|
||||||
// Reset running jump action queue.
|
// Reset running jump action queue.
|
||||||
if (item->activeState != LS_RUN_FORWARD)
|
if (item->activeState != LS_RUN_FORWARD)
|
||||||
|
|
|
@ -1369,6 +1369,20 @@ bool IsJumpState(LARA_STATE state)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsRunJumpCountState(LARA_STATE state)
|
||||||
|
{
|
||||||
|
if (state == LS_RUN_FORWARD ||
|
||||||
|
state == LS_WALK_FORWARD ||
|
||||||
|
state == LS_JUMP_FORWARD ||
|
||||||
|
state == LS_SPRINT ||
|
||||||
|
state == LS_SPRINT_DIVE)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool TestLaraSplat(ITEM_INFO* item, int dist, int height, int side)
|
bool TestLaraSplat(ITEM_INFO* item, int dist, int height, int side)
|
||||||
{
|
{
|
||||||
auto start = GAME_VECTOR(
|
auto start = GAME_VECTOR(
|
||||||
|
|
|
@ -51,6 +51,7 @@ void GetTighRopeFallOff(int Regularity);
|
||||||
|
|
||||||
bool IsStandingWeapon(LARA_WEAPON_TYPE gunType);
|
bool IsStandingWeapon(LARA_WEAPON_TYPE gunType);
|
||||||
bool IsJumpState(LARA_STATE state);
|
bool IsJumpState(LARA_STATE state);
|
||||||
|
bool IsRunJumpCountState(LARA_STATE state);
|
||||||
|
|
||||||
bool TestLaraSplat(ITEM_INFO* item, int dist, int height, int side = 0);
|
bool TestLaraSplat(ITEM_INFO* item, int dist, int height, int side = 0);
|
||||||
bool TestLaraPose(ITEM_INFO* item, COLL_INFO* coll);
|
bool TestLaraPose(ITEM_INFO* item, COLL_INFO* coll);
|
||||||
|
|
|
@ -121,21 +121,17 @@ void AnimateItem(ITEM_INFO* item)
|
||||||
|
|
||||||
SoundEffect(cmd[1] & 0x3FFF, &item->pos, 2);
|
SoundEffect(cmd[1] & 0x3FFF, &item->pos, 2);
|
||||||
}
|
}
|
||||||
else if (g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_WATER)
|
else if (TestEnvironment(ENV_FLAG_WATER, item))
|
||||||
{
|
{
|
||||||
if (!flags || flags == (int)SOUND_PLAYCONDITION::Water && (g_Level.Rooms[Camera.pos.roomNumber].flags & ENV_FLAG_WATER || Objects[item->objectNumber].intelligent))
|
if (!flags || flags == (int)SOUND_PLAYCONDITION::Water && (TestEnvironment(ENV_FLAG_WATER, Camera.pos.roomNumber) || Objects[item->objectNumber].intelligent))
|
||||||
{
|
|
||||||
SoundEffect(cmd[1] & 0x3FFF, &item->pos, 2);
|
SoundEffect(cmd[1] & 0x3FFF, &item->pos, 2);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (!flags || flags == (int)SOUND_PLAYCONDITION::Land && !(g_Level.Rooms[Camera.pos.roomNumber].flags & ENV_FLAG_WATER))
|
else if (!flags || flags == (int)SOUND_PLAYCONDITION::Land && !TestEnvironment(ENV_FLAG_WATER, Camera.pos.roomNumber))
|
||||||
{
|
|
||||||
SoundEffect(cmd[1] & 0x3FFF, &item->pos, 2);
|
SoundEffect(cmd[1] & 0x3FFF, &item->pos, 2);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_WATER)
|
if (TestEnvironment(ENV_FLAG_WATER, item))
|
||||||
SoundEffect(cmd[1] & 0x3FFF, &item->pos, 1);
|
SoundEffect(cmd[1] & 0x3FFF, &item->pos, 1);
|
||||||
else
|
else
|
||||||
SoundEffect(cmd[1] & 0x3FFF, &item->pos, 0);
|
SoundEffect(cmd[1] & 0x3FFF, &item->pos, 0);
|
||||||
|
|
|
@ -94,7 +94,7 @@ void LookAt(CAMERA_INFO* cam, short roll)
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlterFOV(int value)
|
void AlterFOV(int value)
|
||||||
{
|
{
|
||||||
CurrentFOV = value;
|
CurrentFOV = value;
|
||||||
PhdPerspective = g_Renderer.ScreenWidth / 2 * phd_cos(CurrentFOV / 2) / phd_sin(CurrentFOV / 2);
|
PhdPerspective = g_Renderer.ScreenWidth / 2 * phd_cos(CurrentFOV / 2) / phd_sin(CurrentFOV / 2);
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ void AlterFOV(int value)
|
||||||
void InitialiseCamera()
|
void InitialiseCamera()
|
||||||
{
|
{
|
||||||
Camera.shift = LaraItem->pos.yPos - WALL_SIZE;
|
Camera.shift = LaraItem->pos.yPos - WALL_SIZE;
|
||||||
|
|
||||||
LastTarget.x = LaraItem->pos.xPos;
|
LastTarget.x = LaraItem->pos.xPos;
|
||||||
LastTarget.y = Camera.shift;
|
LastTarget.y = Camera.shift;
|
||||||
LastTarget.z = LaraItem->pos.zPos;
|
LastTarget.z = LaraItem->pos.zPos;
|
||||||
|
@ -128,9 +128,9 @@ void InitialiseCamera()
|
||||||
Camera.bounce = 0;
|
Camera.bounce = 0;
|
||||||
Camera.number = -1;
|
Camera.number = -1;
|
||||||
Camera.fixedCamera = false;
|
Camera.fixedCamera = false;
|
||||||
|
|
||||||
AlterFOV(14560);
|
AlterFOV(14560);
|
||||||
|
|
||||||
UseForcedFixedCamera = 0;
|
UseForcedFixedCamera = 0;
|
||||||
CalculateCamera();
|
CalculateCamera();
|
||||||
}
|
}
|
||||||
|
@ -224,7 +224,7 @@ void MoveCamera(GAME_VECTOR* ideal, int speed)
|
||||||
}
|
}
|
||||||
|
|
||||||
int y = Camera.pos.y;
|
int y = Camera.pos.y;
|
||||||
if (g_Level.Rooms[Camera.pos.roomNumber].flags & ENV_FLAG_SWAMP)
|
if (TestEnvironment(ENV_FLAG_SWAMP, Camera.pos.roomNumber))
|
||||||
y = g_Level.Rooms[Camera.pos.roomNumber].y - STEP_SIZE;
|
y = g_Level.Rooms[Camera.pos.roomNumber].y - STEP_SIZE;
|
||||||
|
|
||||||
auto probe = GetCollisionResult(Camera.pos.x, y, Camera.pos.z, Camera.pos.roomNumber);
|
auto probe = GetCollisionResult(Camera.pos.x, y, Camera.pos.z, Camera.pos.roomNumber);
|
||||||
|
@ -232,7 +232,7 @@ void MoveCamera(GAME_VECTOR* ideal, int speed)
|
||||||
y > probe.Position.Floor)
|
y > probe.Position.Floor)
|
||||||
{
|
{
|
||||||
LOSAndReturnTarget(&Camera.target, &Camera.pos, 0);
|
LOSAndReturnTarget(&Camera.target, &Camera.pos, 0);
|
||||||
|
|
||||||
if (abs(Camera.pos.x - ideal->x) < (WALL_SIZE - STEP_SIZE) &&
|
if (abs(Camera.pos.x - ideal->x) < (WALL_SIZE - STEP_SIZE) &&
|
||||||
abs(Camera.pos.y - ideal->y) < (WALL_SIZE - STEP_SIZE) &&
|
abs(Camera.pos.y - ideal->y) < (WALL_SIZE - STEP_SIZE) &&
|
||||||
abs(Camera.pos.z - ideal->z) < (WALL_SIZE - STEP_SIZE))
|
abs(Camera.pos.z - ideal->z) < (WALL_SIZE - STEP_SIZE))
|
||||||
|
@ -298,7 +298,7 @@ void MoveCamera(GAME_VECTOR* ideal, int speed)
|
||||||
|
|
||||||
Camera.pos.roomNumber = GetCollisionResult(Camera.pos.x, Camera.pos.y, Camera.pos.z, Camera.pos.roomNumber).RoomNumber;
|
Camera.pos.roomNumber = GetCollisionResult(Camera.pos.x, Camera.pos.y, Camera.pos.z, Camera.pos.roomNumber).RoomNumber;
|
||||||
LookAt(&Camera, 0);
|
LookAt(&Camera, 0);
|
||||||
|
|
||||||
if (Camera.mikeAtLara)
|
if (Camera.mikeAtLara)
|
||||||
{
|
{
|
||||||
Camera.mikePos.x = LaraItem->pos.xPos;
|
Camera.mikePos.x = LaraItem->pos.xPos;
|
||||||
|
@ -323,7 +323,7 @@ void ChaseCamera(ITEM_INFO* item)
|
||||||
|
|
||||||
Camera.targetElevation += item->pos.xRot;
|
Camera.targetElevation += item->pos.xRot;
|
||||||
UpdateCameraElevation();
|
UpdateCameraElevation();
|
||||||
|
|
||||||
// Clamp x rotation.
|
// Clamp x rotation.
|
||||||
if (Camera.actualElevation > ANGLE(85.0f))
|
if (Camera.actualElevation > ANGLE(85.0f))
|
||||||
Camera.actualElevation = ANGLE(85.0f);
|
Camera.actualElevation = ANGLE(85.0f);
|
||||||
|
@ -333,8 +333,8 @@ void ChaseCamera(ITEM_INFO* item)
|
||||||
int distance = Camera.targetDistance * phd_cos(Camera.actualElevation);
|
int distance = Camera.targetDistance * phd_cos(Camera.actualElevation);
|
||||||
|
|
||||||
auto probe = GetCollisionResult(Camera.target.x, Camera.target.y + STEP_SIZE, Camera.target.z, Camera.target.roomNumber);
|
auto probe = GetCollisionResult(Camera.target.x, Camera.target.y + STEP_SIZE, Camera.target.z, Camera.target.roomNumber);
|
||||||
|
|
||||||
if (g_Level.Rooms[probe.RoomNumber].flags & ENV_FLAG_SWAMP)
|
if (TestEnvironment(ENV_FLAG_SWAMP, probe.RoomNumber))
|
||||||
Camera.target.y = g_Level.Rooms[probe.RoomNumber].y - STEP_SIZE;
|
Camera.target.y = g_Level.Rooms[probe.RoomNumber].y - STEP_SIZE;
|
||||||
|
|
||||||
int y = Camera.target.y;
|
int y = Camera.target.y;
|
||||||
|
@ -350,10 +350,10 @@ void ChaseCamera(ITEM_INFO* item)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
TargetSnaps = 0;
|
TargetSnaps = 0;
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++)
|
for (int i = 0; i < 5; i++)
|
||||||
Ideals[i].y = Camera.target.y + Camera.targetDistance * phd_sin(Camera.actualElevation);
|
Ideals[i].y = Camera.target.y + Camera.targetDistance * phd_sin(Camera.actualElevation);
|
||||||
|
|
||||||
int farthest = INT_MAX;
|
int farthest = INT_MAX;
|
||||||
int farthestnum = 0;
|
int farthestnum = 0;
|
||||||
GAME_VECTOR temp[2];
|
GAME_VECTOR temp[2];
|
||||||
|
@ -457,7 +457,7 @@ void CombatCamera(ITEM_INFO* item)
|
||||||
{
|
{
|
||||||
Camera.target.x = item->pos.xPos;
|
Camera.target.x = item->pos.xPos;
|
||||||
Camera.target.z = item->pos.zPos;
|
Camera.target.z = item->pos.zPos;
|
||||||
|
|
||||||
if (Lara.target)
|
if (Lara.target)
|
||||||
{
|
{
|
||||||
Camera.targetAngle = Lara.targetAngles[0];
|
Camera.targetAngle = Lara.targetAngles[0];
|
||||||
|
@ -470,7 +470,7 @@ void CombatCamera(ITEM_INFO* item)
|
||||||
}
|
}
|
||||||
|
|
||||||
auto probe = GetCollisionResult(Camera.target.x, Camera.target.y + STEP_SIZE, Camera.target.z, Camera.target.roomNumber);
|
auto probe = GetCollisionResult(Camera.target.x, Camera.target.y + STEP_SIZE, Camera.target.z, Camera.target.roomNumber);
|
||||||
if (g_Level.Rooms[probe.RoomNumber].flags & ENV_FLAG_SWAMP)
|
if (TestEnvironment(ENV_FLAG_SWAMP, probe.RoomNumber))
|
||||||
Camera.target.y = g_Level.Rooms[probe.RoomNumber].y - STEP_SIZE;
|
Camera.target.y = g_Level.Rooms[probe.RoomNumber].y - STEP_SIZE;
|
||||||
|
|
||||||
probe = GetCollisionResult(Camera.target.x, Camera.target.y, Camera.target.z, Camera.target.roomNumber);
|
probe = GetCollisionResult(Camera.target.x, Camera.target.y, Camera.target.z, Camera.target.roomNumber);
|
||||||
|
@ -616,7 +616,7 @@ bool CameraCollisionBounds(GAME_VECTOR* ideal, int push, int yFirst)
|
||||||
int z = ideal->z;
|
int z = ideal->z;
|
||||||
|
|
||||||
COLL_RESULT probe;
|
COLL_RESULT probe;
|
||||||
|
|
||||||
if (yFirst)
|
if (yFirst)
|
||||||
{
|
{
|
||||||
probe = GetCollisionResult(x, y, z, ideal->roomNumber);
|
probe = GetCollisionResult(x, y, z, ideal->roomNumber);
|
||||||
|
@ -755,7 +755,7 @@ void FixedCamera(ITEM_INFO* item)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LEVEL_CAMERA_INFO* camera = &g_Level.Cameras[Camera.number];
|
LEVEL_CAMERA_INFO* camera = &g_Level.Cameras[Camera.number];
|
||||||
|
|
||||||
from.x = camera->x;
|
from.x = camera->x;
|
||||||
from.y = camera->y;
|
from.y = camera->y;
|
||||||
from.z = camera->z;
|
from.z = camera->z;
|
||||||
|
@ -791,7 +791,7 @@ void LookCamera(ITEM_INFO* item)
|
||||||
info->headYrot *= 2;
|
info->headYrot *= 2;
|
||||||
|
|
||||||
// Clamp head rotation.
|
// Clamp head rotation.
|
||||||
if (info->headXrot > ANGLE(55.0f))
|
if (info->headXrot > ANGLE(55.0f))
|
||||||
info->headXrot = ANGLE(55.0f);
|
info->headXrot = ANGLE(55.0f);
|
||||||
else if (info->headXrot < -ANGLE(75.0f))
|
else if (info->headXrot < -ANGLE(75.0f))
|
||||||
info->headXrot = -ANGLE(75.0f);
|
info->headXrot = -ANGLE(75.0f);
|
||||||
|
@ -821,9 +821,9 @@ void LookCamera(ITEM_INFO* item)
|
||||||
{
|
{
|
||||||
pos = { 0, STEP_SIZE / 16 , 0 };
|
pos = { 0, STEP_SIZE / 16 , 0 };
|
||||||
GetLaraJointPosition(&pos, LM_HEAD);
|
GetLaraJointPosition(&pos, LM_HEAD);
|
||||||
|
|
||||||
probe = GetCollisionResult(pos.x, pos.y + STEP_SIZE, pos.z, item->roomNumber);
|
probe = GetCollisionResult(pos.x, pos.y + STEP_SIZE, pos.z, item->roomNumber);
|
||||||
if (g_Level.Rooms[probe.RoomNumber].flags & ENV_FLAG_SWAMP)
|
if (TestEnvironment(ENV_FLAG_SWAMP, probe.RoomNumber))
|
||||||
{
|
{
|
||||||
pos.y = g_Level.Rooms[probe.RoomNumber].y - STEP_SIZE;
|
pos.y = g_Level.Rooms[probe.RoomNumber].y - STEP_SIZE;
|
||||||
probe = GetCollisionResult(pos.x, pos.y, pos.z, probe.RoomNumber);
|
probe = GetCollisionResult(pos.x, pos.y, pos.z, probe.RoomNumber);
|
||||||
|
@ -864,7 +864,7 @@ void LookCamera(ITEM_INFO* item)
|
||||||
{
|
{
|
||||||
roomNum = probe.RoomNumber;
|
roomNum = probe.RoomNumber;
|
||||||
probe = GetCollisionResult(x, y + STEP_SIZE, z, probe.RoomNumber);
|
probe = GetCollisionResult(x, y + STEP_SIZE, z, probe.RoomNumber);
|
||||||
if (g_Level.Rooms[probe.RoomNumber].flags & ENV_FLAG_SWAMP)
|
if (TestEnvironment(ENV_FLAG_SWAMP, probe.RoomNumber))
|
||||||
{
|
{
|
||||||
y = g_Level.Rooms[probe.RoomNumber].y - STEP_SIZE;
|
y = g_Level.Rooms[probe.RoomNumber].y - STEP_SIZE;
|
||||||
break;
|
break;
|
||||||
|
@ -999,7 +999,7 @@ void LookCamera(ITEM_INFO* item)
|
||||||
|
|
||||||
y = Camera.pos.y;
|
y = Camera.pos.y;
|
||||||
probe = GetCollisionResult(Camera.pos.x, y, Camera.pos.z, Camera.pos.roomNumber);
|
probe = GetCollisionResult(Camera.pos.x, y, Camera.pos.z, Camera.pos.roomNumber);
|
||||||
if ((g_Level.Rooms[probe.RoomNumber].flags & ENV_FLAG_SWAMP))
|
if (TestEnvironment(ENV_FLAG_SWAMP, probe.RoomNumber))
|
||||||
Camera.pos.y = g_Level.Rooms[probe.RoomNumber].y - STEP_SIZE;
|
Camera.pos.y = g_Level.Rooms[probe.RoomNumber].y - STEP_SIZE;
|
||||||
else if (y < probe.Position.Ceiling ||
|
else if (y < probe.Position.Ceiling ||
|
||||||
y > probe.Position.Floor ||
|
y > probe.Position.Floor ||
|
||||||
|
@ -1017,7 +1017,7 @@ void LookCamera(ITEM_INFO* item)
|
||||||
probe.Position.Ceiling >= probe.Position.Floor ||
|
probe.Position.Ceiling >= probe.Position.Floor ||
|
||||||
probe.Position.Floor == NO_HEIGHT ||
|
probe.Position.Floor == NO_HEIGHT ||
|
||||||
probe.Position.Ceiling == NO_HEIGHT ||
|
probe.Position.Ceiling == NO_HEIGHT ||
|
||||||
g_Level.Rooms[probe.RoomNumber].flags & ENV_FLAG_SWAMP)
|
TestEnvironment(ENV_FLAG_SWAMP, probe.RoomNumber))
|
||||||
{
|
{
|
||||||
Camera.pos.x = pos.x;
|
Camera.pos.x = pos.x;
|
||||||
Camera.pos.y = pos.y;
|
Camera.pos.y = pos.y;
|
||||||
|
@ -1129,11 +1129,11 @@ void BinocularCamera(ITEM_INFO* item)
|
||||||
|
|
||||||
Camera.pos.x = x;
|
Camera.pos.x = x;
|
||||||
Camera.pos.y = y;
|
Camera.pos.y = y;
|
||||||
Camera.pos.z = z;
|
Camera.pos.z = z;
|
||||||
Camera.pos.roomNumber = probe.RoomNumber;
|
Camera.pos.roomNumber = probe.RoomNumber;
|
||||||
|
|
||||||
int l = (WALL_SIZE * 20 + CLICK(1)) * phd_cos(headXrot);
|
int l = (WALL_SIZE * 20 + CLICK(1)) * phd_cos(headXrot);
|
||||||
|
|
||||||
int tx = x + l * phd_sin(item->pos.yRot + headYrot);
|
int tx = x + l * phd_sin(item->pos.yRot + headYrot);
|
||||||
int ty = y - (WALL_SIZE * 20 + CLICK(1)) * phd_sin(headXrot);
|
int ty = y - (WALL_SIZE * 20 + CLICK(1)) * phd_sin(headXrot);
|
||||||
int tz = z + l * phd_cos(item->pos.yRot + headYrot);
|
int tz = z + l * phd_cos(item->pos.yRot + headYrot);
|
||||||
|
@ -1152,7 +1152,7 @@ void BinocularCamera(ITEM_INFO* item)
|
||||||
Camera.target.z += (tz - Camera.target.z) >> 2;
|
Camera.target.z += (tz - Camera.target.z) >> 2;
|
||||||
Camera.target.roomNumber = item->roomNumber;
|
Camera.target.roomNumber = item->roomNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Camera.bounce &&
|
if (Camera.bounce &&
|
||||||
Camera.type == Camera.oldType)
|
Camera.type == Camera.oldType)
|
||||||
{
|
{
|
||||||
|
@ -1209,7 +1209,7 @@ void BinocularCamera(ITEM_INFO* item)
|
||||||
BinocularRange -= range;
|
BinocularRange -= range;
|
||||||
if (BinocularRange < 128)
|
if (BinocularRange < 128)
|
||||||
BinocularRange = 128;
|
BinocularRange = 128;
|
||||||
else
|
else
|
||||||
SoundEffect(SFX_TR5_ZOOM_VIEW_WHIRR, 0, (flags << 8) | 6);
|
SoundEffect(SFX_TR5_ZOOM_VIEW_WHIRR, 0, (flags << 8) | 6);
|
||||||
}
|
}
|
||||||
else if (InputBusy & IN_CROUCH)
|
else if (InputBusy & IN_CROUCH)
|
||||||
|
@ -1358,7 +1358,7 @@ void BinocularCamera(ITEM_INFO* item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfirmCameraTargetPos()
|
void ConfirmCameraTargetPos()
|
||||||
{
|
{
|
||||||
PHD_VECTOR pos = { 0, 0, 0 };
|
PHD_VECTOR pos = { 0, 0, 0 };
|
||||||
GetLaraJointPosition(&pos, LM_TORSO);
|
GetLaraJointPosition(&pos, LM_TORSO);
|
||||||
|
@ -1416,8 +1416,7 @@ void CalculateCamera()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Camera is in a water room, play water sound effect.
|
// Camera is in a water room, play water sound effect.
|
||||||
|
if (TestEnvironment(ENV_FLAG_WATER, Camera.pos.roomNumber))
|
||||||
if (g_Level.Rooms[Camera.pos.roomNumber].flags & ENV_FLAG_WATER)
|
|
||||||
{
|
{
|
||||||
SoundEffect(SFX_TR4_UNDERWATER, NULL, SFX_ALWAYS);
|
SoundEffect(SFX_TR4_UNDERWATER, NULL, SFX_ALWAYS);
|
||||||
if (Camera.underwater == false)
|
if (Camera.underwater == false)
|
||||||
|
@ -1444,7 +1443,7 @@ void CalculateCamera()
|
||||||
}
|
}
|
||||||
|
|
||||||
BOUNDING_BOX* bounds = GetBoundsAccurate(item);
|
BOUNDING_BOX* bounds = GetBoundsAccurate(item);
|
||||||
|
|
||||||
int x;
|
int x;
|
||||||
int y = ((bounds->Y1 + bounds->Y2) / 2) + item->pos.yPos - STEP_SIZE;
|
int y = ((bounds->Y1 + bounds->Y2) / 2) + item->pos.yPos - STEP_SIZE;
|
||||||
int z;
|
int z;
|
||||||
|
@ -1530,7 +1529,7 @@ void CalculateCamera()
|
||||||
|
|
||||||
if (Camera.type != CAMERA_TYPE::CHASE_CAMERA &&
|
if (Camera.type != CAMERA_TYPE::CHASE_CAMERA &&
|
||||||
Camera.flags != CF_CHASE_OBJECT &&
|
Camera.flags != CF_CHASE_OBJECT &&
|
||||||
(Camera.number != -1 &&(SniperCamActive = g_Level.Cameras[Camera.number].flags & 3, g_Level.Cameras[Camera.number].flags & 2)))
|
(Camera.number != -1 && (SniperCamActive = g_Level.Cameras[Camera.number].flags & 3, g_Level.Cameras[Camera.number].flags & 2)))
|
||||||
{
|
{
|
||||||
PHD_VECTOR pos = { 0, 0, 0 };
|
PHD_VECTOR pos = { 0, 0, 0 };
|
||||||
GetLaraJointPosition(&pos, LM_TORSO);
|
GetLaraJointPosition(&pos, LM_TORSO);
|
||||||
|
@ -1715,7 +1714,7 @@ void ResetLook(ITEM_INFO* item)
|
||||||
if (info->gunStatus != LG_HANDS_BUSY &&
|
if (info->gunStatus != LG_HANDS_BUSY &&
|
||||||
!info->leftArm.lock &&
|
!info->leftArm.lock &&
|
||||||
!info->rightArm.lock &&
|
!info->rightArm.lock &&
|
||||||
info->Vehicle == NO_ITEM)
|
info->Vehicle == NO_ITEM)
|
||||||
{
|
{
|
||||||
info->torsoXrot = info->headXrot;
|
info->torsoXrot = info->headXrot;
|
||||||
info->torsoYrot = info->headYrot;
|
info->torsoYrot = info->headYrot;
|
||||||
|
@ -1791,7 +1790,7 @@ static bool CheckItemCollideCamera(ITEM_INFO* item)
|
||||||
auto dz = Camera.pos.z - item->pos.zPos;
|
auto dz = Camera.pos.z - item->pos.zPos;
|
||||||
|
|
||||||
bool closeEnough = dx > -COLL_CHECK_THRESHOLD && dx < COLL_CHECK_THRESHOLD &&
|
bool closeEnough = dx > -COLL_CHECK_THRESHOLD && dx < COLL_CHECK_THRESHOLD &&
|
||||||
dz > -COLL_CHECK_THRESHOLD && dz < COLL_CHECK_THRESHOLD &&
|
dz > -COLL_CHECK_THRESHOLD && dz < COLL_CHECK_THRESHOLD &&
|
||||||
dy > -COLL_CHECK_THRESHOLD && dy < COLL_CHECK_THRESHOLD;
|
dy > -COLL_CHECK_THRESHOLD && dy < COLL_CHECK_THRESHOLD;
|
||||||
|
|
||||||
if (!closeEnough || !item->collidable || !Objects[item->objectNumber].usingDrawAnimatingItem)
|
if (!closeEnough || !item->collidable || !Objects[item->objectNumber].usingDrawAnimatingItem)
|
||||||
|
@ -1826,7 +1825,7 @@ std::vector<short> FillCollideableItemList()
|
||||||
|
|
||||||
if (!CheckItemCollideCamera(&g_Level.Items[i]))
|
if (!CheckItemCollideCamera(&g_Level.Items[i]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
itemList.push_back(i);
|
itemList.push_back(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2052,4 +2051,4 @@ void UpdateFadeScreenAndCinematicBars()
|
||||||
ScreenFading = false;
|
ScreenFading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "Game/animation.h"
|
#include "Game/animation.h"
|
||||||
#include "Game/camera.h"
|
#include "Game/camera.h"
|
||||||
#include "Game/collision/sphere.h"
|
#include "Game/collision/sphere.h"
|
||||||
|
#include "Game/collision/collide_room.h"
|
||||||
#include "Game/control/control.h"
|
#include "Game/control/control.h"
|
||||||
#include "Game/control/lot.h"
|
#include "Game/control/lot.h"
|
||||||
#include "Game/effects/tomb4fx.h"
|
#include "Game/effects/tomb4fx.h"
|
||||||
|
@ -706,7 +707,8 @@ int CreatureAnimation(short itemNumber, short angle, short tilt)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
floor = GetFloor(item->pos.xPos, y + STEP_SIZE, item->pos.zPos, &roomNumber);
|
floor = GetFloor(item->pos.xPos, y + STEP_SIZE, item->pos.zPos, &roomNumber);
|
||||||
if (g_Level.Rooms[roomNumber].flags & (ENV_FLAG_WATER | ENV_FLAG_SWAMP))
|
if (TestEnvironment(ENV_FLAG_WATER, roomNumber) ||
|
||||||
|
TestEnvironment(ENV_FLAG_SWAMP, roomNumber))
|
||||||
{
|
{
|
||||||
dy = -LOT->fly;
|
dy = -LOT->fly;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "Game/effects/effects.h"
|
#include "Game/effects/effects.h"
|
||||||
|
|
||||||
#include "Game/animation.h"
|
#include "Game/animation.h"
|
||||||
|
#include "Game/collision/collide_room.h"
|
||||||
#include "Game/effects/lara_fx.h"
|
#include "Game/effects/lara_fx.h"
|
||||||
#include "Game/effects/drip.h"
|
#include "Game/effects/drip.h"
|
||||||
#include "Game/effects/bubble.h"
|
#include "Game/effects/bubble.h"
|
||||||
|
@ -1221,7 +1222,7 @@ void WadeSplash(ITEM_INFO* item, int wh, int wd)
|
||||||
GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber);
|
GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber);
|
||||||
|
|
||||||
ROOM_INFO* room = &g_Level.Rooms[roomNumber];
|
ROOM_INFO* room = &g_Level.Rooms[roomNumber];
|
||||||
if (!(room->flags & ENV_FLAG_WATER))
|
if (!TestEnvironment(ENV_FLAG_WATER, room))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
short roomNumber2 = item->roomNumber;
|
short roomNumber2 = item->roomNumber;
|
||||||
|
@ -1229,7 +1230,7 @@ void WadeSplash(ITEM_INFO* item, int wh, int wd)
|
||||||
|
|
||||||
ROOM_INFO* room2 = &g_Level.Rooms[roomNumber2];
|
ROOM_INFO* room2 = &g_Level.Rooms[roomNumber2];
|
||||||
|
|
||||||
if (room2->flags & ENV_FLAG_WATER)
|
if (TestEnvironment(ENV_FLAG_WATER, room2))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ANIM_FRAME* frame = GetBestFrame(item);
|
ANIM_FRAME* frame = GetBestFrame(item);
|
||||||
|
@ -1270,15 +1271,15 @@ void Splash(ITEM_INFO* item)
|
||||||
GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber);
|
GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber);
|
||||||
|
|
||||||
ROOM_INFO* room = &g_Level.Rooms[roomNumber];
|
ROOM_INFO* room = &g_Level.Rooms[roomNumber];
|
||||||
if (room->flags & ENV_FLAG_WATER)
|
if (TestEnvironment(ENV_FLAG_WATER, room))
|
||||||
{
|
{
|
||||||
int wh = GetWaterHeight(item->pos.xPos, item->pos.yPos, item->pos.zPos, roomNumber);
|
int waterHeight = GetWaterHeight(item->pos.xPos, item->pos.yPos, item->pos.zPos, roomNumber);
|
||||||
SplashSetup.y = wh - 1;
|
SplashSetup.y = waterHeight - 1;
|
||||||
SplashSetup.x = item->pos.xPos;
|
SplashSetup.x = item->pos.xPos;
|
||||||
SplashSetup.z = item->pos.zPos;
|
SplashSetup.z = item->pos.zPos;
|
||||||
SplashSetup.splashPower = item->fallspeed;
|
SplashSetup.splashPower = item->fallspeed;
|
||||||
SplashSetup.innerRadius = 64;
|
SplashSetup.innerRadius = 64;
|
||||||
SetupSplash(&SplashSetup,roomNumber);
|
SetupSplash(&SplashSetup, roomNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue