2020-05-27 09:21:20 +02:00
|
|
|
#include "framework.h"
|
2020-08-09 22:09:14 -03:00
|
|
|
#include "lara_swim.h"
|
2021-09-19 23:41:26 +03:00
|
|
|
#include "control/control.h"
|
2019-11-21 07:43:34 +01:00
|
|
|
#include "camera.h"
|
|
|
|
#include "items.h"
|
|
|
|
#include "Lara.h"
|
2021-09-16 05:06:03 +03:00
|
|
|
#include "animation.h"
|
2020-05-27 09:21:20 +02:00
|
|
|
#include "level.h"
|
|
|
|
#include "input.h"
|
2021-09-25 16:00:30 +03:00
|
|
|
#include "Sound/sound.h"
|
2020-05-30 17:58:09 +02:00
|
|
|
#include "GameFlowScript.h"
|
2021-11-10 01:32:54 +11:00
|
|
|
#include "lara_collide.h"
|
2021-09-25 11:27:47 +02:00
|
|
|
|
2021-07-18 15:22:15 +01:00
|
|
|
struct SUBSUIT_INFO
|
2020-09-26 05:06:08 +10:00
|
|
|
{
|
|
|
|
short XRot;
|
|
|
|
short dXRot;
|
|
|
|
short XRotVel;
|
|
|
|
short Vel[2];
|
|
|
|
short YVel;
|
|
|
|
};
|
|
|
|
SUBSUIT_INFO Subsuit;
|
2019-12-01 08:13:19 +01:00
|
|
|
byte SubHitCount = 0;
|
2019-11-21 07:43:34 +01:00
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void lara_col_waterroll(ITEM_INFO* item, COLL_INFO* coll)
|
2020-09-26 05:06:08 +10:00
|
|
|
{
|
|
|
|
LaraSwimCollision(item, coll);
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void lara_col_uwdeath(ITEM_INFO* item, COLL_INFO* coll)
|
2020-09-26 05:06:08 +10:00
|
|
|
{
|
|
|
|
item->hitPoints = -1;
|
|
|
|
Lara.air = -1;
|
|
|
|
Lara.gunStatus = LG_HANDS_BUSY;
|
2021-11-10 01:06:40 +11:00
|
|
|
|
|
|
|
auto waterHeight = GetWaterHeight(item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber);
|
|
|
|
if (waterHeight < (item->pos.yPos - (STEP_SIZE / 5 * 2) - 2) &&
|
|
|
|
waterHeight != NO_HEIGHT)
|
2020-09-26 05:06:08 +10:00
|
|
|
{
|
2021-11-10 01:06:40 +11:00
|
|
|
item->pos.yPos -= 5;
|
2020-09-26 05:06:08 +10:00
|
|
|
}
|
2021-11-10 01:06:40 +11:00
|
|
|
|
2020-09-26 05:06:08 +10:00
|
|
|
LaraSwimCollision(item, coll);
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void lara_col_dive(ITEM_INFO* item, COLL_INFO* coll)
|
2020-09-26 05:06:08 +10:00
|
|
|
{
|
|
|
|
LaraSwimCollision(item, coll);
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void lara_col_tread(ITEM_INFO* item, COLL_INFO* coll)
|
2020-09-26 05:06:08 +10:00
|
|
|
{
|
|
|
|
LaraSwimCollision(item, coll);
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void lara_col_glide(ITEM_INFO* item, COLL_INFO* coll)
|
2020-09-26 05:06:08 +10:00
|
|
|
{
|
|
|
|
LaraSwimCollision(item, coll);
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void lara_col_swim(ITEM_INFO* item, COLL_INFO* coll)
|
2020-09-26 05:06:08 +10:00
|
|
|
{
|
|
|
|
LaraSwimCollision(item, coll);
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void lara_as_waterroll(ITEM_INFO* item, COLL_INFO* coll)
|
2020-09-26 05:06:08 +10:00
|
|
|
{
|
|
|
|
item->fallspeed = 0;
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void lara_as_uwdeath(ITEM_INFO* item, COLL_INFO* coll)
|
2020-09-26 05:06:08 +10:00
|
|
|
{
|
|
|
|
Lara.look = 0;
|
|
|
|
|
|
|
|
item->fallspeed -= 8;
|
|
|
|
if (item->fallspeed <= 0)
|
|
|
|
item->fallspeed = 0;
|
|
|
|
|
2021-11-10 01:06:40 +11:00
|
|
|
if (item->pos.xRot < -ANGLE(2.0f) ||
|
|
|
|
item->pos.xRot > ANGLE(2.0f))
|
2020-09-26 05:06:08 +10:00
|
|
|
{
|
|
|
|
if (item->pos.xRot >= 0)
|
2021-11-10 01:06:40 +11:00
|
|
|
item->pos.xRot -= ANGLE(2.0f);
|
2020-09-26 05:06:08 +10:00
|
|
|
else
|
2021-11-10 01:06:40 +11:00
|
|
|
item->pos.xRot += ANGLE(2.0f);
|
2020-09-26 05:06:08 +10:00
|
|
|
}
|
|
|
|
else
|
|
|
|
item->pos.xRot = 0;
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void lara_as_dive(ITEM_INFO* item, COLL_INFO* coll)
|
2020-09-26 05:06:08 +10:00
|
|
|
{
|
|
|
|
if (TrInput & IN_FORWARD)
|
2021-11-10 01:06:40 +11:00
|
|
|
item->pos.xRot -= ANGLE(1.0f);
|
2020-09-26 05:06:08 +10:00
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void lara_as_tread(ITEM_INFO* item, COLL_INFO* coll)
|
2020-09-26 05:06:08 +10:00
|
|
|
{
|
|
|
|
if (item->hitPoints <= 0)
|
|
|
|
{
|
|
|
|
item->goalAnimState = LS_WATER_DEATH;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-11-11 01:16:27 +03:00
|
|
|
auto level = g_GameFlow->GetLevel(CurrentLevel);
|
|
|
|
|
|
|
|
if (TrInput & IN_ROLL && level->LaraType != LaraType::Divesuit)
|
2020-09-26 05:06:08 +10:00
|
|
|
{
|
2021-11-10 11:59:54 +03:00
|
|
|
SetAnimation(item, LA_UNDERWATER_ROLL_180_START);
|
2021-11-10 02:41:59 +03:00
|
|
|
return;
|
2020-09-26 05:06:08 +10:00
|
|
|
}
|
|
|
|
|
2021-11-10 02:41:59 +03:00
|
|
|
if (TrInput & IN_LOOK)
|
|
|
|
LookUpDown();
|
|
|
|
|
2021-11-11 01:16:27 +03:00
|
|
|
if (level->LaraType == LaraType::Divesuit)
|
2021-11-10 02:41:59 +03:00
|
|
|
SwimTurnSubsuit(item);
|
|
|
|
else
|
|
|
|
SwimTurn(item);
|
2020-09-26 05:06:08 +10:00
|
|
|
|
2021-11-10 02:41:59 +03:00
|
|
|
if (TrInput & IN_JUMP)
|
|
|
|
item->goalAnimState = LS_UNDERWATER_FORWARD;
|
2020-09-26 05:06:08 +10:00
|
|
|
|
2021-11-10 02:41:59 +03:00
|
|
|
item->fallspeed -= 6;
|
2020-09-26 05:06:08 +10:00
|
|
|
|
2021-11-10 02:41:59 +03:00
|
|
|
if (item->fallspeed < 0)
|
|
|
|
item->fallspeed = 0;
|
2020-09-26 05:06:08 +10:00
|
|
|
|
2021-11-10 02:41:59 +03:00
|
|
|
if (Lara.gunStatus == LG_HANDS_BUSY)
|
|
|
|
Lara.gunStatus = LG_NO_ARMS;
|
2020-09-26 05:06:08 +10:00
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void lara_as_glide(ITEM_INFO* item, COLL_INFO* coll)
|
2020-09-26 05:06:08 +10:00
|
|
|
{
|
|
|
|
if (item->hitPoints <= 0)
|
|
|
|
{
|
|
|
|
item->goalAnimState = LS_WATER_DEATH;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-11-11 01:16:27 +03:00
|
|
|
auto level = g_GameFlow->GetLevel(CurrentLevel);
|
|
|
|
|
|
|
|
if (TrInput & IN_ROLL && level->LaraType != LaraType::Divesuit)
|
2020-09-26 05:06:08 +10:00
|
|
|
{
|
2021-11-10 11:59:54 +03:00
|
|
|
SetAnimation(item, LA_UNDERWATER_ROLL_180_START);
|
2021-11-10 02:41:59 +03:00
|
|
|
return;
|
2020-09-26 05:06:08 +10:00
|
|
|
}
|
2021-11-10 02:41:59 +03:00
|
|
|
|
2021-11-11 01:16:27 +03:00
|
|
|
if (level->LaraType != LaraType::Divesuit)
|
2020-09-26 05:06:08 +10:00
|
|
|
SwimTurn(item);
|
|
|
|
else
|
|
|
|
SwimTurnSubsuit(item);
|
|
|
|
|
|
|
|
if (TrInput & IN_JUMP)
|
|
|
|
item->goalAnimState = LS_UNDERWATER_FORWARD;
|
|
|
|
|
|
|
|
item->fallspeed -= 6;
|
|
|
|
if (item->fallspeed < 0)
|
|
|
|
item->fallspeed = 0;
|
|
|
|
|
|
|
|
if (item->fallspeed <= 133)
|
|
|
|
item->goalAnimState = LS_UNDERWATER_STOP;
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void lara_as_swim(ITEM_INFO* item, COLL_INFO* coll)
|
2020-09-26 05:06:08 +10:00
|
|
|
{
|
|
|
|
if (item->hitPoints <= 0)
|
|
|
|
{
|
|
|
|
item->goalAnimState = LS_WATER_DEATH;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-11-11 01:16:27 +03:00
|
|
|
auto level = g_GameFlow->GetLevel(CurrentLevel);
|
|
|
|
|
|
|
|
if (TrInput & IN_ROLL && level->LaraType != LaraType::Divesuit)
|
2020-09-26 05:06:08 +10:00
|
|
|
{
|
2021-11-10 11:59:54 +03:00
|
|
|
SetAnimation(item, LA_UNDERWATER_ROLL_180_START);
|
2021-11-10 02:41:59 +03:00
|
|
|
return;
|
2020-09-26 05:06:08 +10:00
|
|
|
}
|
2021-11-10 02:41:59 +03:00
|
|
|
|
2021-11-11 01:16:27 +03:00
|
|
|
if (level->LaraType != LaraType::Divesuit)
|
2020-09-26 05:06:08 +10:00
|
|
|
SwimTurn(item);
|
|
|
|
else
|
|
|
|
SwimTurnSubsuit(item);
|
|
|
|
|
|
|
|
item->fallspeed += 8;
|
|
|
|
|
|
|
|
if (item->fallspeed > 200)
|
|
|
|
item->fallspeed = 200;
|
|
|
|
|
|
|
|
if (!(TrInput & IN_JUMP))
|
|
|
|
item->goalAnimState = LS_UNDERWATER_INERTIA;
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void UpdateSubsuitAngles()
|
2019-11-21 07:43:34 +01:00
|
|
|
{
|
2019-12-01 08:13:19 +01:00
|
|
|
if (Subsuit.YVel != 0)
|
2019-11-21 07:43:34 +01:00
|
|
|
{
|
2019-12-01 08:13:19 +01:00
|
|
|
LaraItem->pos.yPos += Subsuit.YVel / 4;
|
|
|
|
Subsuit.YVel = ceil(0.9375 * Subsuit.YVel - 1); // YVel * (15/16)
|
2019-11-21 07:43:34 +01:00
|
|
|
}
|
|
|
|
|
2019-12-01 08:13:19 +01:00
|
|
|
Subsuit.Vel[0] = Subsuit.Vel[1] = -4 * LaraItem->fallspeed;
|
2019-11-21 07:43:34 +01:00
|
|
|
|
2019-12-01 08:13:19 +01:00
|
|
|
if (Subsuit.XRot >= Subsuit.dXRot)
|
2019-11-21 07:43:34 +01:00
|
|
|
{
|
2019-12-01 08:13:19 +01:00
|
|
|
if (Subsuit.XRot > Subsuit.dXRot)
|
2019-11-21 07:43:34 +01:00
|
|
|
{
|
2019-12-01 08:13:19 +01:00
|
|
|
if (Subsuit.XRot > 0 && Subsuit.dXRot < 0)
|
|
|
|
Subsuit.XRot = ceil(0.75 * Subsuit.XRot);
|
2019-11-21 07:43:34 +01:00
|
|
|
|
2021-11-10 01:06:40 +11:00
|
|
|
Subsuit.XRot -= ANGLE(2.0f);
|
2019-11-21 07:43:34 +01:00
|
|
|
|
2019-12-01 08:13:19 +01:00
|
|
|
if (Subsuit.XRot < Subsuit.dXRot)
|
|
|
|
Subsuit.XRot = Subsuit.dXRot;
|
2019-11-21 07:43:34 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-12-01 08:13:19 +01:00
|
|
|
if (Subsuit.XRot < 0 && Subsuit.dXRot > 0)
|
|
|
|
Subsuit.XRot = ceil(0.75 * Subsuit.XRot);
|
2019-11-21 07:43:34 +01:00
|
|
|
|
2021-11-10 01:06:40 +11:00
|
|
|
Subsuit.XRot += ANGLE(2.0f);
|
2019-11-21 07:43:34 +01:00
|
|
|
|
2019-12-01 08:13:19 +01:00
|
|
|
if (Subsuit.XRot > Subsuit.dXRot)
|
|
|
|
Subsuit.XRot = Subsuit.dXRot;
|
2019-11-21 07:43:34 +01:00
|
|
|
}
|
|
|
|
|
2019-12-01 08:13:19 +01:00
|
|
|
if (Subsuit.dXRot != 0)
|
2019-11-21 07:43:34 +01:00
|
|
|
{
|
2021-08-30 15:13:18 -05:00
|
|
|
short rot = Subsuit.dXRot >> 3;
|
2021-11-10 01:06:40 +11:00
|
|
|
if (rot < -ANGLE(2.0f))
|
|
|
|
rot = -ANGLE(2.0f);
|
|
|
|
else if (rot > ANGLE(2.0f))
|
|
|
|
rot = ANGLE(2.0f);
|
|
|
|
|
2019-12-01 08:13:19 +01:00
|
|
|
LaraItem->pos.xRot += rot;
|
2019-11-21 07:43:34 +01:00
|
|
|
}
|
|
|
|
|
2021-08-30 15:13:18 -05:00
|
|
|
Subsuit.Vel[0] += abs(Subsuit.XRot >> 3);
|
|
|
|
Subsuit.Vel[1] += abs(Subsuit.XRot >> 3);
|
2019-11-21 07:43:34 +01:00
|
|
|
|
|
|
|
if (Lara.turnRate > 0)
|
|
|
|
{
|
2019-12-01 08:13:19 +01:00
|
|
|
Subsuit.Vel[0] += 2 * abs(Lara.turnRate);
|
2019-11-21 07:43:34 +01:00
|
|
|
}
|
|
|
|
else if (Lara.turnRate < 0)
|
|
|
|
{
|
2019-12-01 08:13:19 +01:00
|
|
|
Subsuit.Vel[1] += 2 * abs(Lara.turnRate);
|
2019-11-21 07:43:34 +01:00
|
|
|
}
|
|
|
|
|
2019-12-01 08:13:19 +01:00
|
|
|
if (Subsuit.Vel[0] > 1536)
|
|
|
|
Subsuit.Vel[0] = 1536;
|
2019-11-21 07:43:34 +01:00
|
|
|
|
2019-12-01 08:13:19 +01:00
|
|
|
if (Subsuit.Vel[1] > 1536)
|
|
|
|
Subsuit.Vel[1] = 1536;
|
2019-11-21 07:43:34 +01:00
|
|
|
|
2019-12-01 08:13:19 +01:00
|
|
|
if (Subsuit.Vel[0] != 0 || Subsuit.Vel[1] != 0)
|
2019-11-21 07:43:34 +01:00
|
|
|
{
|
2021-05-26 06:04:32 +02:00
|
|
|
SoundEffect(SFX_TR5_LARA_UNDERWATER_ENGINE, &LaraItem->pos, (((Subsuit.Vel[0] + Subsuit.Vel[1]) * 4) & 0x1F00) + 10);
|
2019-11-21 07:43:34 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void SwimTurnSubsuit(ITEM_INFO* item)
|
2019-11-21 07:43:34 +01:00
|
|
|
{
|
|
|
|
if (item->pos.yPos < 14080)
|
2021-08-30 15:13:18 -05:00
|
|
|
Subsuit.YVel += (14080 - item->pos.yPos) >> 4;
|
2019-11-21 07:43:34 +01:00
|
|
|
|
2021-11-10 01:06:40 +11:00
|
|
|
if (TrInput & IN_FORWARD && item->pos.xRot > -ANGLE(85.0f))
|
|
|
|
Subsuit.dXRot = -ANGLE(45.0f);
|
|
|
|
else if (TrInput & IN_BACK && item->pos.xRot < ANGLE(85.0f))
|
|
|
|
Subsuit.dXRot = ANGLE(45.0f);
|
2019-11-21 07:43:34 +01:00
|
|
|
else
|
2019-12-01 08:13:19 +01:00
|
|
|
Subsuit.dXRot = 0;
|
2019-11-21 07:43:34 +01:00
|
|
|
|
|
|
|
if (TrInput & IN_LEFT)
|
|
|
|
{
|
2021-11-10 01:06:40 +11:00
|
|
|
Lara.turnRate -= SUB_SUIT_TURN_RATE;
|
|
|
|
if (Lara.turnRate < -LARA_MED_TURN)
|
|
|
|
Lara.turnRate = -LARA_MED_TURN;
|
2019-11-21 07:43:34 +01:00
|
|
|
|
2021-11-10 01:06:40 +11:00
|
|
|
item->pos.zRot -= LARA_LEAN_RATE * 2;
|
2019-11-21 07:43:34 +01:00
|
|
|
}
|
|
|
|
else if (TrInput & IN_RIGHT)
|
|
|
|
{
|
2021-11-10 01:06:40 +11:00
|
|
|
Lara.turnRate += SUB_SUIT_TURN_RATE;
|
|
|
|
if (Lara.turnRate > LARA_MED_TURN)
|
|
|
|
Lara.turnRate = LARA_MED_TURN;
|
2019-11-21 07:43:34 +01:00
|
|
|
|
2021-11-10 01:06:40 +11:00
|
|
|
item->pos.zRot += LARA_LEAN_RATE * 2;
|
2019-11-21 07:43:34 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void SwimTurn(ITEM_INFO* item)
|
2019-11-21 07:43:34 +01:00
|
|
|
{
|
|
|
|
if (TrInput & IN_FORWARD)
|
2021-11-10 01:06:40 +11:00
|
|
|
item->pos.xRot -= ANGLE(2.0f);
|
2019-11-21 07:43:34 +01:00
|
|
|
else if (TrInput & IN_BACK)
|
2021-11-10 01:06:40 +11:00
|
|
|
item->pos.xRot += ANGLE(2.0f);
|
2019-11-21 07:43:34 +01:00
|
|
|
|
|
|
|
if (TrInput & IN_LEFT)
|
|
|
|
{
|
2021-11-10 01:06:40 +11:00
|
|
|
Lara.turnRate -= LARA_TURN_RATE;
|
|
|
|
if (Lara.turnRate < -LARA_MED_TURN)
|
|
|
|
Lara.turnRate = -LARA_MED_TURN;
|
|
|
|
|
|
|
|
item->pos.zRot -= LARA_LEAN_RATE * 2;
|
2019-11-21 07:43:34 +01:00
|
|
|
}
|
|
|
|
else if (TrInput & IN_RIGHT)
|
|
|
|
{
|
2021-11-10 01:06:40 +11:00
|
|
|
Lara.turnRate += LARA_TURN_RATE;
|
|
|
|
if (Lara.turnRate > LARA_MED_TURN)
|
|
|
|
Lara.turnRate = LARA_MED_TURN;
|
|
|
|
|
|
|
|
item->pos.zRot += LARA_LEAN_RATE * 2;
|
2019-11-21 07:43:34 +01:00
|
|
|
}
|
|
|
|
}
|
2021-11-10 11:59:54 +03:00
|
|
|
|
|
|
|
void SwimDive(ITEM_INFO* item)
|
|
|
|
{
|
|
|
|
|
|
|
|
SetAnimation(item, LA_ONWATER_DIVE);
|
|
|
|
item->goalAnimState = LS_UNDERWATER_FORWARD;
|
|
|
|
item->pos.xRot = ANGLE(-45.0f);
|
|
|
|
item->fallspeed = 80;
|
|
|
|
Lara.waterStatus = LW_UNDERWATER;
|
|
|
|
}
|
2021-11-10 12:02:44 +03:00
|
|
|
|
2021-11-10 16:11:36 +11:00
|
|
|
void LaraWaterCurrent(COLL_INFO* coll)
|
|
|
|
{
|
|
|
|
if (Lara.currentActive)
|
|
|
|
{
|
|
|
|
SINK_INFO* sink = &g_Level.Sinks[Lara.currentActive - 1];
|
|
|
|
|
|
|
|
short angle = mGetAngle(sink->x, sink->z, LaraItem->pos.xPos, LaraItem->pos.zPos);
|
|
|
|
Lara.currentXvel += (sink->strength * 1024 * phd_sin(angle - ANGLE(90.0f)) - Lara.currentXvel) / 16;
|
|
|
|
Lara.currentZvel += (sink->strength * 1024 * phd_cos(angle - ANGLE(90.0f)) - Lara.currentZvel) / 16;
|
|
|
|
|
|
|
|
LaraItem->pos.yPos += (sink->y - LaraItem->pos.yPos) >> 4;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int shift = 0;
|
|
|
|
|
|
|
|
if (abs(Lara.currentXvel) <= 16)
|
|
|
|
shift = (abs(Lara.currentXvel) > 8) + 2;
|
|
|
|
else
|
|
|
|
shift = 4;
|
|
|
|
Lara.currentXvel -= Lara.currentXvel >> shift;
|
|
|
|
|
|
|
|
if (abs(Lara.currentXvel) < 4)
|
|
|
|
Lara.currentXvel = 0;
|
|
|
|
|
|
|
|
if (abs(Lara.currentZvel) <= 16)
|
|
|
|
shift = (abs(Lara.currentZvel) > 8) + 2;
|
|
|
|
else
|
|
|
|
shift = 4;
|
|
|
|
Lara.currentZvel -= Lara.currentZvel >> shift;
|
|
|
|
|
|
|
|
if (abs(Lara.currentZvel) < 4)
|
|
|
|
Lara.currentZvel = 0;
|
|
|
|
|
|
|
|
if (!Lara.currentXvel && !Lara.currentZvel)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
LaraItem->pos.xPos += Lara.currentXvel >> 8;
|
|
|
|
LaraItem->pos.zPos += Lara.currentZvel >> 8;
|
|
|
|
Lara.currentActive = 0;
|
|
|
|
|
|
|
|
coll->Setup.ForwardAngle = phd_atan(LaraItem->pos.zPos - coll->Setup.OldPosition.z, LaraItem->pos.xPos - coll->Setup.OldPosition.x);
|
|
|
|
coll->Setup.Height = LARA_HEIGHT_CRAWL;
|
|
|
|
|
|
|
|
GetCollisionInfo(coll, LaraItem, PHD_VECTOR(0, 200, 0));
|
|
|
|
|
|
|
|
if (coll->CollisionType == CT_FRONT)
|
|
|
|
{
|
|
|
|
if (LaraItem->pos.xRot > ANGLE(35.0f))
|
|
|
|
LaraItem->pos.xRot += ANGLE(1.0f);
|
|
|
|
else if (LaraItem->pos.xRot < -ANGLE(35.0f))
|
|
|
|
LaraItem->pos.xRot -= ANGLE(1.0f);
|
|
|
|
else
|
|
|
|
LaraItem->fallspeed = 0;
|
|
|
|
}
|
|
|
|
else if (coll->CollisionType == CT_TOP)
|
|
|
|
LaraItem->pos.xRot -= ANGLE(1.0f);
|
|
|
|
else if (coll->CollisionType == CT_TOP_FRONT)
|
|
|
|
LaraItem->fallspeed = 0;
|
|
|
|
else if (coll->CollisionType == CT_LEFT)
|
|
|
|
LaraItem->pos.yRot += ANGLE(5.0f);
|
|
|
|
else if (coll->CollisionType == CT_RIGHT)
|
|
|
|
LaraItem->pos.yRot -= ANGLE(5.0f);
|
|
|
|
|
|
|
|
if (coll->Middle.Floor < 0 && coll->Middle.Floor != NO_HEIGHT)
|
|
|
|
LaraItem->pos.yPos += coll->Middle.Floor;
|
|
|
|
|
|
|
|
ShiftItem(LaraItem, coll);
|
|
|
|
|
|
|
|
coll->Setup.OldPosition.x = LaraItem->pos.xPos;
|
|
|
|
coll->Setup.OldPosition.y = LaraItem->pos.yPos;
|
|
|
|
coll->Setup.OldPosition.z = LaraItem->pos.zPos;
|
|
|
|
}
|