Refactor health.cpp

This commit is contained in:
Sezz 2021-11-10 16:11:36 +11:00
parent be1ee111bf
commit a3b1403433
11 changed files with 182 additions and 186 deletions

View file

@ -415,8 +415,8 @@ void LaraControl(ITEM_INFO* item, COLL_INFO* coll)
Lara.gunStatus = LG_NO_ARMS;
}
if (item->currentAnimState != LS_SPRINT && DashTimer < 120)
DashTimer++;
if (item->currentAnimState != LS_SPRINT && Lara.sprintTimer < LARA_SPRINT_MAX)
Lara.sprintTimer++;
Lara.isDucked = false;
@ -516,7 +516,7 @@ void LaraControl(ITEM_INFO* item, COLL_INFO* coll)
if (heightFromWater > SWIM_DEPTH)
{
Lara.waterStatus = LW_SURFACE;
item->pos.yPos += 1 - heightFromWater;
item->pos.yPos += 1 - heightFromWater; // BUG: Crawl exit flip results in Lara teleporting above the surface because of this. @Sezz 2021.11.10
item->animNumber = LA_ONWATER_IDLE;
item->frameNumber = GF(LA_ONWATER_IDLE, 0);
@ -725,13 +725,13 @@ void LaraControl(ITEM_INFO* item, COLL_INFO* coll)
}
}
}
else if (Lara.air < 1800 && item->hitPoints >= 0)
else if (Lara.air < LARA_AIR_MAX && item->hitPoints >= 0)
{
if (Lara.Vehicle == NO_ITEM) // only for the upv !!
{
Lara.air += 10;
if (Lara.air > 1800)
Lara.air = 1800;
if (Lara.air > LARA_AIR_MAX)
Lara.air = LARA_AIR_MAX;
}
}
@ -765,8 +765,8 @@ void LaraControl(ITEM_INFO* item, COLL_INFO* coll)
if (item->hitPoints >= 0)
{
Lara.air += 10;
if (Lara.air > 1800)
Lara.air = 1800;
if (Lara.air > LARA_AIR_MAX)
Lara.air = LARA_AIR_MAX;
}
LaraSurface(item, coll);
@ -804,8 +804,11 @@ void LaraAboveWater(ITEM_INFO* item, COLL_INFO* coll)
coll->Setup.Radius = LARA_RAD;
coll->Setup.Height = LARA_HEIGHT;
if ((TrInput & IN_LOOK) && Lara.ExtraAnim == NO_ITEM && Lara.look)
if (TrInput & IN_LOOK && Lara.look &&
Lara.ExtraAnim == NO_ITEM)
{
LookLeftRight();
}
else
ResetLook();
@ -939,62 +942,50 @@ void LaraUnderWater(ITEM_INFO* item, COLL_INFO* coll)
if (LaraDrawType == LARA_TYPE::DIVESUIT)
{
if (Lara.turnRate < -ANGLE(0.5))
{
Lara.turnRate += ANGLE(0.5);
}
else if (Lara.turnRate > ANGLE(0.5))
{
Lara.turnRate -= ANGLE(0.5);
}
if (Lara.turnRate < -ANGLE(0.5f))
Lara.turnRate += ANGLE(0.5f);
else if (Lara.turnRate > ANGLE(0.5f))
Lara.turnRate -= ANGLE(0.5f);
else
{
Lara.turnRate = 0;
}
}
else if (Lara.turnRate < -ANGLE(2))
{
Lara.turnRate += ANGLE(2);
}
else if (Lara.turnRate > ANGLE(2))
{
Lara.turnRate -= ANGLE(2);
}
else if (Lara.turnRate < -ANGLE(2.0f))
Lara.turnRate += ANGLE(2.0f);
else if (Lara.turnRate > ANGLE(2.0f))
Lara.turnRate -= ANGLE(2.0f);
else
{
Lara.turnRate = 0;
}
item->pos.yRot += Lara.turnRate;
if (LaraDrawType == LARA_TYPE::DIVESUIT)
UpdateSubsuitAngles();
if (item->pos.zRot < -ANGLE(2))
item->pos.zRot += ANGLE(2);
else if (item->pos.zRot > ANGLE(2))
item->pos.zRot -= ANGLE(2);
if (item->pos.zRot < -ANGLE(2.0f))
item->pos.zRot += ANGLE(2.0f);
else if (item->pos.zRot > ANGLE(2.0f))
item->pos.zRot -= ANGLE(2.0f);
else
item->pos.zRot = 0;
if (item->pos.xRot < -ANGLE(85))
item->pos.xRot = -ANGLE(85);
else if (item->pos.xRot > ANGLE(85))
item->pos.xRot = ANGLE(85);
if (item->pos.xRot < -ANGLE(85.0f))
item->pos.xRot = -ANGLE(85.0f);
else if (item->pos.xRot > ANGLE(85.0f))
item->pos.xRot = ANGLE(85.0f);
if (LaraDrawType == LARA_TYPE::DIVESUIT)
{
if (item->pos.zRot > ANGLE(44))
item->pos.zRot = ANGLE(44);
else if (item->pos.zRot < -ANGLE(44))
item->pos.zRot = -ANGLE(44);
if (item->pos.zRot > ANGLE(44.0f))
item->pos.zRot = ANGLE(44.0f);
else if (item->pos.zRot < -ANGLE(44.0f))
item->pos.zRot = -ANGLE(44.0f);
}
else
{
if (item->pos.zRot > ANGLE(22))
item->pos.zRot = ANGLE(22);
else if (item->pos.zRot < -ANGLE(22))
item->pos.zRot = -ANGLE(22);
if (item->pos.zRot > ANGLE(22.0f))
item->pos.zRot = ANGLE(22.0f);
else if (item->pos.zRot < -ANGLE(22.0f))
item->pos.zRot = -ANGLE(22.0f);
}
if (Lara.currentActive && Lara.waterStatus != LW_FLYCHEAT)
@ -1022,7 +1013,7 @@ void LaraUnderWater(ITEM_INFO* item, COLL_INFO* coll)
void LaraSurface(ITEM_INFO* item, COLL_INFO* coll)
{
Camera.targetElevation = -ANGLE(22);
Camera.targetElevation = -ANGLE(22.0f);
coll->Setup.BadHeightDown = 32512;
coll->Setup.BadHeightUp = -128;
@ -1051,12 +1042,12 @@ void LaraSurface(ITEM_INFO* item, COLL_INFO* coll)
lara_control_routines[item->currentAnimState](item, coll);
if (item->pos.zRot >= -ANGLE(2) && item->pos.zRot <= ANGLE(2))
if (item->pos.zRot >= -ANGLE(2) && item->pos.zRot <= ANGLE(2.0f))
item->pos.zRot = 0;
else if (item->pos.zRot < 0)
item->pos.zRot += ANGLE(2);
item->pos.zRot += ANGLE(2.0f);
else
item->pos.zRot -= ANGLE(2);
item->pos.zRot -= ANGLE(2.0f);
if (Lara.currentActive && Lara.waterStatus != LW_FLYCHEAT)
LaraWaterCurrent(coll);

View file

@ -30,6 +30,10 @@ constexpr auto LARA_RAD_DEATH = 400;
constexpr auto LARA_FREEFALL_SPEED = 131;
constexpr auto LARA_VELOCITY = 12;
constexpr auto LARA_HEALTH_MAX = 1000.0f;
constexpr auto LARA_AIR_MAX = 1800.0f;
constexpr auto LARA_SPRINT_MAX = 120.0f;
extern LaraInfo Lara;
extern ITEM_INFO* LaraItem;
extern COLL_INFO LaraCollision;

View file

@ -203,7 +203,7 @@ void lara_as_run(ITEM_INFO* item, COLL_INFO* coll)
return;
}
if (TrInput & IN_SPRINT && DashTimer)
if (TrInput & IN_SPRINT && Lara.sprintTimer)
{
item->goalAnimState = LS_SPRINT;
return;
@ -1873,13 +1873,13 @@ void lara_as_dash(ITEM_INFO* item, COLL_INFO* coll)
{
/*state 73*/
/*collision: lara_col_dash*/
if (item->hitPoints <= 0 || !DashTimer || !(TrInput & IN_SPRINT) || Lara.waterStatus == LW_WADE)
if (item->hitPoints <= 0 || !Lara.sprintTimer || !(TrInput & IN_SPRINT) || Lara.waterStatus == LW_WADE)
{
item->goalAnimState = LS_RUN_FORWARD;
return;
}
DashTimer--;
Lara.sprintTimer--;
if (TrInput & IN_DUCK
&& (Lara.gunStatus == LG_NO_ARMS

View file

@ -35,7 +35,7 @@ void InitialiseLara(int restore)
Lara.look = true;
Lara.itemNumber = itemNumber;
Lara.hitDirection = -1;
Lara.air = 1800;
Lara.air = LARA_AIR_MAX;
Lara.weaponItem = NO_ITEM;
PoisonFlag = 0;
Lara.poisoned = 0;
@ -59,7 +59,7 @@ void InitialiseLara(int restore)
Lara.location = -1;
Lara.highestLocation = -1;
Lara.ropePtr = -1;
LaraItem->hitPoints = 1000;
LaraItem->hitPoints = LARA_HEALTH_MAX;
Lara.gunStatus = LG_NO_ARMS;
memset(&Lara.NewAnims, 0, sizeof(AnimsNew)); //make sure script changes these AFTER Lara is initialized?
@ -99,7 +99,7 @@ void InitialiseLara(int restore)
InitialiseLaraAnims(LaraItem);
Lara.BeetleLife = 3;
DashTimer = 120;
Lara.sprintTimer = LARA_SPRINT_MAX;
}
void LaraInitialiseMeshes()

View file

@ -997,6 +997,7 @@ struct LaraTightrope
short tightropeItem; // maybe give Tightrope Item a property for difficulty?
};
#endif
struct LaraInfo
{
short itemNumber;
@ -1010,6 +1011,7 @@ struct LaraInfo
short poseCount;
short hitFrame;
short hitDirection;
int sprintTimer;
short air;
short diveCount;
short deathCount;

View file

@ -22,81 +22,6 @@ struct SUBSUIT_INFO
SUBSUIT_INFO Subsuit;
byte SubHitCount = 0;
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;
}
void lara_col_waterroll(ITEM_INFO* item, COLL_INFO* coll)
{
LaraSwimCollision(item, coll);
@ -400,3 +325,78 @@ void SwimTurn(ITEM_INFO* item)
item->pos.zRot += LARA_LEAN_RATE * 2;
}
}
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;
}

View file

@ -1,7 +1,6 @@
#pragma once
#include "collide.h"
void LaraWaterCurrent(COLL_INFO* coll);
void lara_col_waterroll(ITEM_INFO* item, COLL_INFO* coll);
void lara_col_uwdeath(ITEM_INFO* item, COLL_INFO* coll);
void lara_col_dive(ITEM_INFO* item, COLL_INFO* coll);
@ -17,3 +16,4 @@ void lara_as_swim(ITEM_INFO* item, COLL_INFO* coll);
void UpdateSubsuitAngles();
void SwimTurnSubsuit(ITEM_INFO* item);
void SwimTurn(ITEM_INFO* item);
void LaraWaterCurrent(COLL_INFO* coll);

View file

@ -16,14 +16,13 @@ short PickupY;
short CurrentPickup;
DISPLAY_PICKUP Pickups[MAX_COLLECTED_PICKUPS];
short PickupVel;
int OldHitPoints = 1000;
int OldHitPoints = LARA_HEALTH_MAX;
int HealthBarTimer = 40;
float HealthBar = OldHitPoints;
float MutateAmount = 0;
int FlashState = 0;
int FlashCount = 0;
int PoisonFlag = 0;
int DashTimer = 0;
extern RendererHUDBar* g_HealthBar;
extern RendererHUDBar* g_DashBar;
extern RendererHUDBar* g_AirBar;
@ -39,6 +38,7 @@ void DrawHealthBarOverlay(int value)
color2 = 0xA0A000;
else
color2 = 0xA00000;
g_Renderer.drawBar(value, ::g_HealthBar, ID_HEALTH_BAR_TEXTURE, GlobalCounter, Lara.poisoned);
}
}
@ -46,19 +46,17 @@ void DrawHealthBarOverlay(int value)
void DrawHealthBar(float value)
{
if (CurrentLevel)
{
g_Renderer.drawBar(value, ::g_HealthBar, ID_HEALTH_BAR_TEXTURE, GlobalCounter, Lara.poisoned);
}
}
void UpdateHealthBar(int flash)
void UpdateHealthBar(ITEM_INFO* item, int flash)
{
int hitPoints = LaraItem->hitPoints;
auto hitPoints = item->hitPoints;
if (hitPoints < 0)
hitPoints = 0;
else if (hitPoints > 1000)
hitPoints = 1000;
else if (hitPoints > LARA_HEALTH_MAX)
hitPoints = LARA_HEALTH_MAX;
// OPT: smoothly transition health bar display.
if (EnableSmoothHealthBar)
@ -72,8 +70,8 @@ void UpdateHealthBar(int flash)
if (HealthBar - MutateAmount < 0)
MutateAmount = HealthBar;
else if (HealthBar - MutateAmount > 1000)
MutateAmount = HealthBar - 1000;
else if (HealthBar - MutateAmount > LARA_HEALTH_MAX)
MutateAmount = HealthBar - LARA_HEALTH_MAX;
HealthBar -= MutateAmount / 3;
MutateAmount -= MutateAmount / 3;
@ -100,36 +98,32 @@ void UpdateHealthBar(int flash)
HealthBarTimer = 0;
// Flash when at 1/4 capacity AND HP bar is not transitioning.
if (HealthBar <= 1000 / 4)
if (HealthBar <= LARA_HEALTH_MAX / 4)
{
if (!BinocularRange)
{
if (flash)
DrawHealthBar(HealthBar / 1000.0f);
DrawHealthBar(HealthBar / LARA_HEALTH_MAX);
else
DrawHealthBar(0);
}
else
{
if (flash)
DrawHealthBarOverlay(HealthBar / 1000.0f);
DrawHealthBarOverlay(HealthBar / LARA_HEALTH_MAX);
else
DrawHealthBarOverlay(0);
}
}
else if ((HealthBarTimer > 0)
|| (HealthBar <= 0)
|| (Lara.gunStatus == LG_READY && Lara.gunType != WEAPON_TORCH)
|| (Lara.poisoned >= 256))
else if (HealthBarTimer > 0 ||
HealthBar <= 0 ||
Lara.gunStatus == LG_READY && Lara.gunType != WEAPON_TORCH ||
Lara.poisoned >= 256)
{
if (!BinocularRange)
{
DrawHealthBar(HealthBar / 1000.0f);
}
DrawHealthBar(HealthBar / LARA_HEALTH_MAX);
else
{
DrawHealthBarOverlay(HealthBar / 1000.0f);
}
DrawHealthBarOverlay(HealthBar / LARA_HEALTH_MAX);
}
if (PoisonFlag)
@ -139,47 +133,49 @@ void UpdateHealthBar(int flash)
void DrawAirBar(float value)
{
if (CurrentLevel)
{
g_Renderer.drawBar(value, ::g_AirBar,ID_AIR_BAR_TEXTURE,0,0);
}
}
void UpdateAirBar(int flash)
void UpdateAirBar(ITEM_INFO* item, int flash)
{
if (Lara.air == 1800 || LaraItem->hitPoints <= 0)
if (Lara.air == LARA_AIR_MAX || item->hitPoints <= 0)
return;
if ((Lara.Vehicle == NO_ITEM)
|| (g_Level.Items[Lara.Vehicle].objectNumber != ID_UPV))
if (Lara.Vehicle == NO_ITEM ||
g_Level.Items[Lara.Vehicle].objectNumber != ID_UPV)
{
if ((Lara.waterStatus != LW_UNDERWATER)
&& (Lara.waterStatus != LW_SURFACE)
&& (!(TestLaraSwamp(LaraItem) && (Lara.waterSurfaceDist < -775))))
if (Lara.waterStatus != LW_UNDERWATER &&
Lara.waterStatus != LW_SURFACE &&
!(TestLaraSwamp(item) && Lara.waterSurfaceDist < -(STOP_SIZE + STEP_SIZE - 1)))
return;
}
int air = Lara.air;
if (air < 0)
air = 0;
else if (air > 1800)
air = 1800;
if (air <= 450)
else if (air > LARA_AIR_MAX)
air = LARA_AIR_MAX;
if (air <= (LARA_AIR_MAX / 4))
{
if (flash)
DrawAirBar(air / 1800.0f);
DrawAirBar(air / LARA_AIR_MAX);
else
DrawAirBar(0);
}
else
DrawAirBar(air / 1800.0f);
DrawAirBar(air / LARA_AIR_MAX);
}
void DrawDashBar(int value)
void DrawSprintBar(float value)
{
if (CurrentLevel)
{
g_Renderer.drawBar(value, ::g_DashBar, ID_DASH_BAR_TEXTURE, 0, 0);
}
void UpdateSprintBar()
{
if (Lara.sprintTimer < LARA_SPRINT_MAX)
DrawSprintBar(Lara.sprintTimer / LARA_SPRINT_MAX);
}
void DrawAllPickups()
@ -223,6 +219,7 @@ void DrawAllPickups()
if (i == MAX_COLLECTED_PICKUPS)
{
CurrentPickup = 0;
return;
}
}
@ -237,11 +234,11 @@ void AddDisplayPickup(GAME_OBJECT_ID objectNumber)
for (int i = 0; i < MAX_COLLECTED_PICKUPS; i++)
{
if (pickup->life < 0)
{
pickup->life = 45;
pickup->objectNumber = objectNumber;
break;
}
@ -272,5 +269,6 @@ int FlashIt()
FlashState ^= 1;
FlashCount = 5;
}
return FlashState;
}

View file

@ -1,4 +1,6 @@
#pragma once
#include "items.h"
#define MAX_COLLECTED_PICKUPS 32
enum GAME_OBJECT_ID : short;
@ -11,10 +13,11 @@ struct DISPLAY_PICKUP
void DrawHealthBarOverlay(int value);
void DrawHealthBar(float value);
void UpdateHealthBar(int flash);
void UpdateHealthBar(ITEM_INFO* item, int flash);
void DrawAirBar(float value);
void UpdateAirBar(int flash);
void DrawDashBar(int value);
void UpdateAirBar(ITEM_INFO* item, int flash);
void DrawSprintBar(float value);
void UpdateSprintBar();
void AddDisplayPickup(GAME_OBJECT_ID objectNumber);
void DrawAllPickups();
void InitialisePickupDisplay();
@ -31,6 +34,5 @@ extern float HealthBar;
extern float MutateAmount;
extern int FlashState;
extern int PoisonFlag;
extern int DashTimer;
extern bool EnableSmoothHealthBar;

View file

@ -555,7 +555,7 @@ static int MotorBikeCheckGetOff(void)
LaraItem->pos.zRot = 0;
Lara.Vehicle = NO_ITEM;
Lara.gunStatus = LG_NO_ARMS;
DashTimer = 120;
Lara.sprintTimer = 120;
return true;
}
@ -1200,14 +1200,14 @@ static int MotorbikeUserControl(ITEM_INFO* item, int height, int* pitch)
motorbike->revs = 0;
}
if ((TrInput & IN_TURBO) && (TrInput & IN_ACCELERATE) && DashTimer)
if ((TrInput & IN_TURBO) && (TrInput & IN_ACCELERATE) && Lara.sprintTimer)
{
motorbike->flags |= FL_BOOST;
DashTimer -= 2;
if (DashTimer > MOTORBIKE_ACCEL)//hmm
Lara.sprintTimer -= 2;
if (Lara.sprintTimer > MOTORBIKE_ACCEL)//hmm
{
motorbike->flags &= ~FL_BOOST;
DashTimer = 0;
Lara.sprintTimer = 0;
}
}
else

View file

@ -2265,10 +2265,9 @@ namespace TEN::Renderer
// Bars
int flash = FlashIt();
if (DashTimer < 120)
drawBar(DashTimer / 120.0f, g_DashBar,ID_DASH_BAR_TEXTURE,0,0);
UpdateHealthBar(flash);
UpdateAirBar(flash);
UpdateSprintBar();
UpdateHealthBar(LaraItem, flash);
UpdateAirBar(LaraItem, flash);
DrawAllPickups();
drawOverlays(view); // Draw binoculars or lasersight