Globals cleanup, remove wrecking ball hack, remove gassed property, fix diagonal block jump bug

This commit is contained in:
Lwmte 2021-08-29 23:53:58 +03:00
parent 5fde174058
commit 21df1e84f1
37 changed files with 120 additions and 172 deletions

View file

@ -756,14 +756,6 @@ void LaraControl(short itemNumber)
} }
} }
} }
else if (Lara.gassed)
{
if (item->hitPoints >= 0 && --Lara.air < 0)
{
Lara.air = -1;
item->hitPoints -= 5;
}
}
else if (Lara.air < 1800 && item->hitPoints >= 0) else if (Lara.air < 1800 && item->hitPoints >= 0)
{ {
if (Lara.Vehicle == NO_ITEM) // only for the upv !! if (Lara.Vehicle == NO_ITEM) // only for the upv !!
@ -924,7 +916,7 @@ void LaraAboveWater(ITEM_INFO* item, COLL_INFO* coll) //hmmmm
lara_collision_routines[item->currentAnimState](item, coll); lara_collision_routines[item->currentAnimState](item, coll);
} }
UpdateLaraRoom(item, -LARA_HITE / 2); UpdateLaraRoom(item, -LARA_HEIGHT / 2);
//if (Lara.gunType == WEAPON_CROSSBOW && !LaserSight) //if (Lara.gunType == WEAPON_CROSSBOW && !LaserSight)
// TrInput &= ~IN_ACTION; // TrInput &= ~IN_ACTION;
@ -1164,7 +1156,7 @@ void AnimateLara(ITEM_INFO* item)
{ {
case COMMAND_MOVE_ORIGIN: case COMMAND_MOVE_ORIGIN:
TranslateItem(item, cmd[0], cmd[1], cmd[2]); TranslateItem(item, cmd[0], cmd[1], cmd[2]);
UpdateLaraRoom(item, -LARA_HITE / 2); UpdateLaraRoom(item, -LARA_HEIGHT / 2);
cmd += 3; cmd += 3;
break; break;

View file

@ -10,7 +10,7 @@
#define LARA_MED_TURN ANGLE(6.0f) #define LARA_MED_TURN ANGLE(6.0f)
#define LARA_FAST_TURN ANGLE(8.0f) #define LARA_FAST_TURN ANGLE(8.0f)
constexpr auto LARA_HITE = 762; // The size of lara (from the floor to the top of the head) constexpr auto LARA_HEIGHT = 762; // The size of lara (from the floor to the top of the head)
constexpr auto LARA_HEADROOM = 160; // Amount of reasonable space above Lara's head constexpr auto LARA_HEADROOM = 160; // Amount of reasonable space above Lara's head
constexpr auto LARA_FREEFALL_SPEED = 131; constexpr auto LARA_FREEFALL_SPEED = 131;
constexpr auto LARA_RAD = 100; constexpr auto LARA_RAD = 100;

View file

@ -28,7 +28,7 @@ void lara_default_col(ITEM_INFO* item, COLL_INFO* coll)
coll->slopesArePits = true; coll->slopesArePits = true;
coll->slopesAreWalls = true; coll->slopesAreWalls = true;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
} }
void lara_as_special(ITEM_INFO* item, COLL_INFO* coll) void lara_as_special(ITEM_INFO* item, COLL_INFO* coll)
@ -132,7 +132,7 @@ void lara_col_walk(ITEM_INFO* item, COLL_INFO* coll)
coll->lavaIsPit = 1; coll->lavaIsPit = 1;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
if (!LaraHitCeiling(item, coll) && !TestLaraVault(item, coll)) if (!LaraHitCeiling(item, coll) && !TestLaraVault(item, coll))
{ {
@ -308,7 +308,7 @@ void lara_col_run(ITEM_INFO* item, COLL_INFO* coll)
coll->slopesAreWalls = true; coll->slopesAreWalls = true;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
if (!LaraHitCeiling(item, coll) && !TestLaraVault(item, coll)) if (!LaraHitCeiling(item, coll) && !TestLaraVault(item, coll))
{ {
@ -429,7 +429,7 @@ void lara_as_stop(ITEM_INFO* item, COLL_INFO* coll)
if (TrInput & IN_LSTEP) if (TrInput & IN_LSTEP)
{ {
auto collFloorResult = LaraCollisionFront(item, item->pos.yRot - ANGLE(90.0f), LARA_RAD + 48); auto collFloorResult = LaraCollisionFront(item, item->pos.yRot - ANGLE(90.0f), LARA_RAD + 48);
auto collCeilingResult = LaraCeilingCollisionFront(item, item->pos.yRot - ANGLE(90.0f), LARA_RAD + 48, LARA_HITE); auto collCeilingResult = LaraCeilingCollisionFront(item, item->pos.yRot - ANGLE(90.0f), LARA_RAD + 48, LARA_HEIGHT);
if ((collFloorResult.FloorHeight < 128 && collFloorResult.FloorHeight > -128) && collFloorResult.HeightType != BIG_SLOPE && collCeilingResult.CeilingHeight <= 0) if ((collFloorResult.FloorHeight < 128 && collFloorResult.FloorHeight > -128) && collFloorResult.HeightType != BIG_SLOPE && collCeilingResult.CeilingHeight <= 0)
item->goalAnimState = LS_STEP_LEFT; item->goalAnimState = LS_STEP_LEFT;
@ -437,7 +437,7 @@ void lara_as_stop(ITEM_INFO* item, COLL_INFO* coll)
else if (TrInput & IN_RSTEP) else if (TrInput & IN_RSTEP)
{ {
auto collFloorResult = LaraCollisionFront(item, item->pos.yRot + ANGLE(90.0f), LARA_RAD + 48); auto collFloorResult = LaraCollisionFront(item, item->pos.yRot + ANGLE(90.0f), LARA_RAD + 48);
auto collCeilingResult = LaraCeilingCollisionFront(item, item->pos.yRot + ANGLE(90.0f), LARA_RAD + 48, LARA_HITE); auto collCeilingResult = LaraCeilingCollisionFront(item, item->pos.yRot + ANGLE(90.0f), LARA_RAD + 48, LARA_HEIGHT);
if ((collFloorResult.FloorHeight < 128 && collFloorResult.FloorHeight > -128) && collFloorResult.HeightType != BIG_SLOPE && collCeilingResult.CeilingHeight <= 0) if ((collFloorResult.FloorHeight < 128 && collFloorResult.FloorHeight > -128) && collFloorResult.HeightType != BIG_SLOPE && collCeilingResult.CeilingHeight <= 0)
item->goalAnimState = LS_STEP_RIGHT; item->goalAnimState = LS_STEP_RIGHT;
@ -488,7 +488,7 @@ void lara_as_stop(ITEM_INFO* item, COLL_INFO* coll)
coll->radius = LARA_RAD + 2; coll->radius = LARA_RAD + 2;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
if (TestLaraVault(item, coll)) if (TestLaraVault(item, coll))
return; return;
@ -510,7 +510,7 @@ void lara_as_stop(ITEM_INFO* item, COLL_INFO* coll)
else if (TrInput & IN_FORWARD) else if (TrInput & IN_FORWARD)
{ {
auto collFloorResult = LaraCollisionFront(item, item->pos.yRot, LARA_RAD + 4); auto collFloorResult = LaraCollisionFront(item, item->pos.yRot, LARA_RAD + 4);
auto collCeilingResult = LaraCeilingCollisionFront(item, item->pos.yRot, LARA_RAD + 4, LARA_HITE); auto collCeilingResult = LaraCeilingCollisionFront(item, item->pos.yRot, LARA_RAD + 4, LARA_HEIGHT);
if ((collFloorResult.HeightType == BIG_SLOPE || collFloorResult.HeightType == DIAGONAL) && (collFloorResult.FloorHeight < 0 || collCeilingResult.CeilingHeight > 0)) if ((collFloorResult.HeightType == BIG_SLOPE || collFloorResult.HeightType == DIAGONAL) && (collFloorResult.FloorHeight < 0 || collCeilingResult.CeilingHeight > 0))
{ {
@ -550,7 +550,7 @@ void lara_col_stop(ITEM_INFO* item, COLL_INFO* coll)
coll->slopesArePits = true; coll->slopesArePits = true;
coll->slopesAreWalls = true; coll->slopesAreWalls = true;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
if (LaraHitCeiling(item, coll)) if (LaraHitCeiling(item, coll))
return; return;
@ -629,7 +629,7 @@ void lara_col_forwardjump(ITEM_INFO* item, COLL_INFO* coll)
coll->badCeiling = BAD_JUMP_CEILING; coll->badCeiling = BAD_JUMP_CEILING;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
LaraDeflectEdgeJump(item, coll); LaraDeflectEdgeJump(item, coll);
if (item->speed < 0) if (item->speed < 0)
@ -710,7 +710,7 @@ void lara_col_fastback(ITEM_INFO* item, COLL_INFO* coll)
coll->badCeiling = 0; coll->badCeiling = 0;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
if (!LaraHitCeiling(item, coll)) if (!LaraHitCeiling(item, coll))
{ {
@ -799,7 +799,7 @@ void lara_col_turn_r(ITEM_INFO* item, COLL_INFO* coll)
coll->slopesAreWalls = true; coll->slopesAreWalls = true;
coll->slopesArePits = true; coll->slopesArePits = true;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
#if 1 #if 1
if (coll->middle.Floor > 100) if (coll->middle.Floor > 100)
@ -916,7 +916,7 @@ void lara_col_death(ITEM_INFO* item, COLL_INFO* coll)
coll->radius = 400; coll->radius = 400;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
ShiftItem(item, coll); ShiftItem(item, coll);
item->hitPoints = -1; item->hitPoints = -1;
@ -946,7 +946,7 @@ void lara_col_fastfall(ITEM_INFO* item, COLL_INFO* coll)
coll->badCeiling = BAD_JUMP_CEILING; coll->badCeiling = BAD_JUMP_CEILING;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
LaraSlideEdgeJump(item, coll); LaraSlideEdgeJump(item, coll);
if (coll->middle.Floor <= 0) if (coll->middle.Floor <= 0)
@ -996,7 +996,7 @@ void lara_col_reach(ITEM_INFO* item, COLL_INFO* coll)
coll->badCeiling = BAD_JUMP_CEILING; coll->badCeiling = BAD_JUMP_CEILING;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
short angle; short angle;
bool result = false; bool result = false;
@ -1049,7 +1049,7 @@ void lara_col_reach(ITEM_INFO* item, COLL_INFO* coll)
{ {
LaraSlideEdgeJump(item, coll); LaraSlideEdgeJump(item, coll);
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
ShiftItem(item, coll); ShiftItem(item, coll);
if (item->fallspeed > 0 && coll->middle.Floor <= 0) if (item->fallspeed > 0 && coll->middle.Floor <= 0)
@ -1164,7 +1164,7 @@ void lara_col_splat(ITEM_INFO* item, COLL_INFO* coll)
coll->badCeiling = 0; coll->badCeiling = 0;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
ShiftItem(item, coll); ShiftItem(item, coll);
if (coll->middle.Floor >= -256 && coll->middle.Floor <= 256) if (coll->middle.Floor >= -256 && coll->middle.Floor <= 256)
@ -1184,22 +1184,22 @@ void lara_as_compress(ITEM_INFO* item, COLL_INFO* coll)
/*collision: lara_col_compress*/ /*collision: lara_col_compress*/
if (Lara.waterStatus != LW_WADE) if (Lara.waterStatus != LW_WADE)
{ {
if (TrInput & IN_FORWARD && LaraFloorFront(item, item->pos.yRot, 256) >= -384) if (TrInput & IN_FORWARD && !LaraFacingCorner(item, item->pos.yRot, 256) && LaraFloorFront(item, item->pos.yRot, 256) >= -384)
{ {
item->goalAnimState = LS_JUMP_FORWARD; item->goalAnimState = LS_JUMP_FORWARD;
Lara.moveAngle = item->pos.yRot; Lara.moveAngle = item->pos.yRot;
} }
else if (TrInput & IN_LEFT && LaraFloorFront(item, item->pos.yRot - ANGLE(90.0f), 256) >= -384) else if (TrInput & IN_LEFT && !LaraFacingCorner(item, item->pos.yRot - ANGLE(90.0f), 256) && LaraFloorFront(item, item->pos.yRot - ANGLE(90.0f), 256) >= -384)
{ {
item->goalAnimState = LS_JUMP_LEFT; item->goalAnimState = LS_JUMP_LEFT;
Lara.moveAngle = item->pos.yRot - ANGLE(90); Lara.moveAngle = item->pos.yRot - ANGLE(90);
} }
else if (TrInput & IN_RIGHT && LaraFloorFront(item, item->pos.yRot + ANGLE(90.0f), 256) >= -384) else if (TrInput & IN_RIGHT && !LaraFacingCorner(item, item->pos.yRot + ANGLE(90.0f), 256) && LaraFloorFront(item, item->pos.yRot + ANGLE(90.0f), 256) >= -384)
{ {
item->goalAnimState = LS_JUMP_RIGHT; item->goalAnimState = LS_JUMP_RIGHT;
Lara.moveAngle = item->pos.yRot + ANGLE(90); Lara.moveAngle = item->pos.yRot + ANGLE(90);
} }
else if (TrInput & IN_BACK && LaraFloorFront(item, item->pos.yRot - ANGLE(180.0f), 256) >= -384) else if (TrInput & IN_BACK && !LaraFacingCorner(item, item->pos.yRot - ANGLE(180.0f), 256) && LaraFloorFront(item, item->pos.yRot - ANGLE(180.0f), 256) >= -384)
{ {
item->goalAnimState = LS_JUMP_BACK; item->goalAnimState = LS_JUMP_BACK;
Lara.moveAngle = item->pos.yRot + ANGLE(180); Lara.moveAngle = item->pos.yRot + ANGLE(180);
@ -1222,7 +1222,7 @@ void lara_col_compress(ITEM_INFO* item, COLL_INFO* coll)
coll->badCeiling = 0; coll->badCeiling = 0;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
if (!LaraFallen(item, coll)) if (!LaraFallen(item, coll))
{ {
@ -1296,7 +1296,7 @@ void lara_col_back(ITEM_INFO* item, COLL_INFO* coll)
coll->slopesArePits = true; coll->slopesArePits = true;
coll->slopesAreWalls = true; coll->slopesAreWalls = true;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
if (LaraHitCeiling(item, coll)) if (LaraHitCeiling(item, coll))
return; return;
@ -1418,7 +1418,7 @@ void lara_col_stepright(ITEM_INFO* item, COLL_INFO* coll)
coll->badCeiling = 0; coll->badCeiling = 0;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
if (!LaraHitCeiling(item, coll)) if (!LaraHitCeiling(item, coll))
{ {
@ -1487,7 +1487,7 @@ void lara_col_roll2(ITEM_INFO* item, COLL_INFO* coll)
item->fallspeed = 0; item->fallspeed = 0;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
if (LaraHitCeiling(item, coll)) if (LaraHitCeiling(item, coll))
return; return;
@ -1588,7 +1588,7 @@ void lara_col_jumper(ITEM_INFO* item, COLL_INFO* coll)
coll->badCeiling = BAD_JUMP_CEILING; coll->badCeiling = BAD_JUMP_CEILING;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
LaraDeflectEdgeJump(item, coll); LaraDeflectEdgeJump(item, coll);
if (item->fallspeed > 0 && coll->middle.Floor <= 0) if (item->fallspeed > 0 && coll->middle.Floor <= 0)
@ -1803,7 +1803,7 @@ void lara_col_fallback(ITEM_INFO* item, COLL_INFO* coll)
coll->badCeiling = BAD_JUMP_CEILING; coll->badCeiling = BAD_JUMP_CEILING;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
LaraDeflectEdgeJump(item, coll); LaraDeflectEdgeJump(item, coll);
if (item->fallspeed > 0 && coll->middle.Floor <= 0) if (item->fallspeed > 0 && coll->middle.Floor <= 0)
@ -1837,7 +1837,7 @@ void lara_col_roll(ITEM_INFO* item, COLL_INFO* coll)
item->fallspeed = 0; item->fallspeed = 0;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
if (LaraHitCeiling(item, coll)) if (LaraHitCeiling(item, coll))
return; return;
@ -1881,7 +1881,7 @@ void lara_col_swandive(ITEM_INFO* item, COLL_INFO* coll)
coll->badCeiling = BAD_JUMP_CEILING; coll->badCeiling = BAD_JUMP_CEILING;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
LaraDeflectEdgeJump(item, coll); LaraDeflectEdgeJump(item, coll);
if (coll->middle.Floor <= 0 && item->fallspeed > 0) if (coll->middle.Floor <= 0 && item->fallspeed > 0)
@ -1917,7 +1917,7 @@ void lara_col_fastdive(ITEM_INFO* item, COLL_INFO* coll)
coll->badCeiling = BAD_JUMP_CEILING; coll->badCeiling = BAD_JUMP_CEILING;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
LaraDeflectEdgeJump(item, coll); LaraDeflectEdgeJump(item, coll);
if (coll->middle.Floor <= 0 && item->fallspeed > 0) if (coll->middle.Floor <= 0 && item->fallspeed > 0)
@ -2069,7 +2069,7 @@ void lara_col_wade(ITEM_INFO* item, COLL_INFO* coll)
coll->slopesAreWalls = true; coll->slopesAreWalls = true;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
if (LaraHitCeiling(item, coll)) if (LaraHitCeiling(item, coll))
return; return;
@ -2189,7 +2189,7 @@ void lara_col_dash(ITEM_INFO* item, COLL_INFO* coll)
coll->slopesAreWalls = true; coll->slopesAreWalls = true;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
if (!LaraHitCeiling(item, coll) && !TestLaraVault(item, coll)) if (!LaraHitCeiling(item, coll) && !TestLaraVault(item, coll))
{ {
@ -2265,7 +2265,7 @@ void lara_col_dashdive(ITEM_INFO* item, COLL_INFO* coll)
coll->slopesAreWalls = true; coll->slopesAreWalls = true;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
LaraDeflectEdgeJump(item, coll); LaraDeflectEdgeJump(item, coll);
if (!LaraFallen(item, coll)) if (!LaraFallen(item, coll))

View file

@ -965,7 +965,7 @@ int LaraTestClimbUpPos(ITEM_INFO* item, int front, int right, int* shift, int* l
ceiling = GetCeiling(floor, x + xFront, y, z + zFront) - y; ceiling = GetCeiling(floor, x + xFront, y, z + zFront) - y;
if (ceiling < 512) if (ceiling < 512)
{ {
if (height - ceiling <= 762) if (height - ceiling <= LARA_HEIGHT)
{ {
if (height - ceiling < 512) if (height - ceiling < 512)
return 0; return 0;

View file

@ -34,7 +34,6 @@ void InitialiseLara(int restore)
Lara.air = 1800; Lara.air = 1800;
Lara.weaponItem = NO_ITEM; Lara.weaponItem = NO_ITEM;
PoisonFlag = 0; PoisonFlag = 0;
Lara.dpoisoned = 0;
Lara.poisoned = 0; Lara.poisoned = 0;
Lara.waterSurfaceDist = 100; Lara.waterSurfaceDist = 100;
if (Lara.Weapons[static_cast<int>(LARA_WEAPON_TYPE::WEAPON_PISTOLS)].Present) { if (Lara.Weapons[static_cast<int>(LARA_WEAPON_TYPE::WEAPON_PISTOLS)].Present) {

View file

@ -641,7 +641,7 @@ void lara_col_polestat(ITEM_INFO* item, COLL_INFO* coll)
coll->radius = 100; coll->radius = 100;
coll->slopesAreWalls = true; coll->slopesAreWalls = true;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
if (TrInput & IN_ACTION) if (TrInput & IN_ACTION)
{ {
@ -736,13 +736,13 @@ void lara_col_poledown(ITEM_INFO* item, COLL_INFO* coll)
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
coll->radius = 100; coll->radius = 100;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
if (coll->middle.Floor < 0) if (coll->middle.Floor < 0)
{ {
short roomNumber = item->roomNumber; short roomNumber = item->roomNumber;
item->floor = GetFloorHeight(GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber), item->floor = GetFloorHeight(GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber),
item->pos.xPos, item->pos.yPos - 762, item->pos.zPos); item->pos.xPos, item->pos.yPos - LARA_HEIGHT, item->pos.zPos);
item->goalAnimState = LS_POLE_IDLE; item->goalAnimState = LS_POLE_IDLE;
item->itemFlags[2] = 0; item->itemFlags[2] = 0;

View file

@ -65,7 +65,7 @@ void lara_slide_slope(ITEM_INFO* item, COLL_INFO* coll)
coll->badCeiling = 0; coll->badCeiling = 0;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
if (!LaraHitCeiling(item, coll)) if (!LaraHitCeiling(item, coll))
{ {

View file

@ -1008,7 +1008,6 @@ struct LaraInfo
HolsterInfo holsterInfo; HolsterInfo holsterInfo;
short flareFrame; short flareFrame;
short poisoned; short poisoned;
short dpoisoned;
byte wet[NUM_LARA_MESHES]; byte wet[NUM_LARA_MESHES];
bool flareControlLeft; bool flareControlLeft;
bool look; bool look;
@ -1017,7 +1016,6 @@ struct LaraInfo
bool isMoving; bool isMoving;
bool canMonkeySwing; bool canMonkeySwing;
byte burnBlue; byte burnBlue;
bool gassed;
bool burnSmoke; bool burnSmoke;
bool isDucked; bool isDucked;
bool hasFired; bool hasFired;

View file

@ -314,7 +314,7 @@ int LaraTestWaterClimbOut(ITEM_INFO* item, COLL_INFO* coll)
item->pos.yPos += frontFloor - 5; item->pos.yPos += frontFloor - 5;
UpdateLaraRoom(item, -LARA_HITE / 2); UpdateLaraRoom(item, -LARA_HEIGHT / 2);
/*if (coll->middle.SplitFloor) /*if (coll->middle.SplitFloor)
{ {

View file

@ -522,7 +522,7 @@ void LaraSwimCollision(ITEM_INFO* item, COLL_INFO* coll)
coll->facing = item->pos.yRot; coll->facing = item->pos.yRot;
} }
short height = 762 * phd_sin(item->pos.xRot); short height = LARA_HEIGHT * phd_sin(item->pos.xRot);
height = abs(height); height = abs(height);
if (height < ((LaraDrawType == LARA_TYPE::DIVESUIT) * 64) + 200) if (height < ((LaraDrawType == LARA_TYPE::DIVESUIT) * 64) + 200)

View file

@ -321,7 +321,7 @@ int LaraHangTest(ITEM_INFO* item, COLL_INFO* coll)
coll->badCeiling = 0; coll->badCeiling = 0;
Lara.moveAngle = item->pos.yRot; Lara.moveAngle = item->pos.yRot;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
result = 0; result = 0;
if (Lara.climbStatus) if (Lara.climbStatus)
{ {
@ -796,7 +796,7 @@ int IsValidHangPos(ITEM_INFO* item, COLL_INFO* coll)
Lara.moveAngle = item->pos.yRot; Lara.moveAngle = item->pos.yRot;
coll->facing = Lara.moveAngle; coll->facing = Lara.moveAngle;
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
if (coll->middle.Ceiling >= 0 || coll->collType != CT_FRONT || coll->hitStatic) if (coll->middle.Ceiling >= 0 || coll->collType != CT_FRONT || coll->hitStatic)
return 0; return 0;
@ -1112,6 +1112,32 @@ void SetCornerAnimFeet(ITEM_INFO* item, COLL_INFO* coll, short rot, short flip)
} }
} }
bool LaraFacingCorner(ITEM_INFO* item, short ang, int dist)
{
auto angle1 = ang + ANGLE(15);
auto angle2 = ang - ANGLE(15);
auto vec1 = GAME_VECTOR(item->pos.xPos + dist * phd_sin(angle1),
item->pos.yPos - (LARA_HEIGHT / 2),
item->pos.zPos + dist * phd_cos(angle1),
item->roomNumber);
auto vec2 = GAME_VECTOR(item->pos.xPos + dist * phd_sin(angle2),
item->pos.yPos - (LARA_HEIGHT / 2),
item->pos.zPos + dist * phd_cos(angle2),
item->roomNumber);
auto pos = GAME_VECTOR(item->pos.xPos,
item->pos.yPos,
item->pos.zPos,
item->roomNumber);
auto result1 = LOS(&pos, &vec1);
auto result2 = LOS(&pos, &vec2);
return (result1 == 0 && result2 == 0);
}
int LaraFloorFront(ITEM_INFO* item, short ang, int dist) int LaraFloorFront(ITEM_INFO* item, short ang, int dist)
{ {
return LaraCollisionFront(item, ang, dist).FloorHeight; return LaraCollisionFront(item, ang, dist).FloorHeight;
@ -1120,7 +1146,7 @@ int LaraFloorFront(ITEM_INFO* item, short ang, int dist)
COLL_RESULT LaraCollisionFront(ITEM_INFO* item, short ang, int dist) COLL_RESULT LaraCollisionFront(ITEM_INFO* item, short ang, int dist)
{ {
int x = item->pos.xPos + dist * phd_sin(ang); int x = item->pos.xPos + dist * phd_sin(ang);
int y = item->pos.yPos - 762; int y = item->pos.yPos - LARA_HEIGHT;
int z = item->pos.zPos + dist * phd_cos(ang); int z = item->pos.zPos + dist * phd_cos(ang);
auto collResult = GetCollisionResult(x, y, z, item->roomNumber); auto collResult = GetCollisionResult(x, y, z, item->roomNumber);

View file

@ -15,6 +15,7 @@ bool TestHangFeet(ITEM_INFO* item, short angle);
int CanLaraHangSideways(ITEM_INFO* item, COLL_INFO* coll, short angle); int CanLaraHangSideways(ITEM_INFO* item, COLL_INFO* coll, short angle);
void SetCornerAnim(ITEM_INFO* item, COLL_INFO* coll, short rot, short flip); void SetCornerAnim(ITEM_INFO* item, COLL_INFO* coll, short rot, short flip);
void SetCornerAnimFeet(ITEM_INFO* item, COLL_INFO* coll, short rot, short flip); void SetCornerAnimFeet(ITEM_INFO* item, COLL_INFO* coll, short rot, short flip);
bool LaraFacingCorner(ITEM_INFO* item, short ang, int dist);
int LaraFloorFront(ITEM_INFO* item, short ang, int dist); int LaraFloorFront(ITEM_INFO* item, short ang, int dist);
COLL_RESULT LaraCollisionFront(ITEM_INFO* item, short ang, int dist); COLL_RESULT LaraCollisionFront(ITEM_INFO* item, short ang, int dist);
int LaraCeilingFront(ITEM_INFO* item, short ang, int dist, int h); int LaraCeilingFront(ITEM_INFO* item, short ang, int dist, int h);

View file

@ -44,7 +44,6 @@ int TargetSnaps = 0;
GAME_VECTOR LookCamPosition; GAME_VECTOR LookCamPosition;
GAME_VECTOR LookCamTarget; GAME_VECTOR LookCamTarget;
int LSHKTimer = 0; int LSHKTimer = 0;
int ExittingBinos = 0;
int LSHKShotsFired = 0; int LSHKShotsFired = 0;
PHD_VECTOR CamOldPos; PHD_VECTOR CamOldPos;
int TLFlag = 0; int TLFlag = 0;
@ -58,7 +57,6 @@ int BinocularOn;
CAMERA_TYPE BinocularOldCamera; CAMERA_TYPE BinocularOldCamera;
int LaserSight; int LaserSight;
int SniperCount; int SniperCount;
int ExitingBinocular;
int PhdPerspective; int PhdPerspective;
short CurrentFOV; short CurrentFOV;
int GetLaraOnLOS; int GetLaraOnLOS;
@ -1155,6 +1153,8 @@ void BounceCamera(ITEM_INFO* item, short bounce, short maxDistance)
void BinocularCamera(ITEM_INFO* item) void BinocularCamera(ITEM_INFO* item)
{ {
static int exittingBinos = 0;
if (LSHKTimer) if (LSHKTimer)
--LSHKTimer; --LSHKTimer;
@ -1162,11 +1162,11 @@ void BinocularCamera(ITEM_INFO* item)
{ {
if (InputBusy & IN_DRAW) if (InputBusy & IN_DRAW)
{ {
ExittingBinos = 1; exittingBinos = 1;
} }
else if (ExittingBinos) else if (exittingBinos)
{ {
ExittingBinos = 0; exittingBinos = 0;
BinocularRange = 0; BinocularRange = 0;
AlterFOV(14560); AlterFOV(14560);
LaraItem->meshBits = -1; LaraItem->meshBits = -1;
@ -1440,6 +1440,7 @@ void BinocularCamera(ITEM_INFO* item)
if (!(InputBusy & IN_ACTION) || Infrared) if (!(InputBusy & IN_ACTION) || Infrared)
{ {
// Reimplement this mode?
} }
else else
{ {

View file

@ -64,7 +64,6 @@ extern int BinocularOn;
extern CAMERA_TYPE BinocularOldCamera; extern CAMERA_TYPE BinocularOldCamera;
extern int LaserSight; extern int LaserSight;
extern int SniperCount; extern int SniperCount;
extern int ExitingBinocular;
extern int PhdPerspective; extern int PhdPerspective;
extern short CurrentFOV; extern short CurrentFOV;
extern int GetLaraOnLOS; extern int GetLaraOnLOS;

View file

@ -439,11 +439,11 @@ int ItemPushLaraStatic(ITEM_INFO* item, BOUNDING_BOX* bounds, PHD_3DPOS* pos, CO
coll->facing = phd_atan(item->pos.zPos - coll->old.z, item->pos.xPos - coll->old.x); coll->facing = phd_atan(item->pos.zPos - coll->old.z, item->pos.xPos - coll->old.x);
if (item == LaraItem) if (item == LaraItem)
{ {
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
} }
else else
{ {
GetObjectCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE); GetObjectCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
} }
coll->facing = oldFacing; coll->facing = oldFacing;
@ -569,11 +569,11 @@ int ItemPushLara(ITEM_INFO* item, ITEM_INFO* l, COLL_INFO* coll, int spazon, cha
if (l == LaraItem) if (l == LaraItem)
{ {
GetCollisionInfo(coll, l->pos.xPos, l->pos.yPos, l->pos.zPos, l->roomNumber, LARA_HITE); GetCollisionInfo(coll, l->pos.xPos, l->pos.yPos, l->pos.zPos, l->roomNumber, LARA_HEIGHT);
} }
else else
{ {
GetObjectCollisionInfo(coll, l->pos.xPos, l->pos.yPos, l->pos.zPos, l->roomNumber, LARA_HITE); GetObjectCollisionInfo(coll, l->pos.xPos, l->pos.yPos, l->pos.zPos, l->roomNumber, LARA_HEIGHT);
} }
coll->facing = facing; coll->facing = facing;

View file

@ -76,7 +76,6 @@ int ClosestDist;
PHD_VECTOR ClosestCoord; PHD_VECTOR ClosestCoord;
int RumbleTimer = 0; int RumbleTimer = 0;
int InGameCnt = 0; int InGameCnt = 0;
byte IsAtmospherePlaying = 0;
byte FlipStatus = 0; byte FlipStatus = 0;
int FlipStats[MAX_FLIPMAP]; int FlipStats[MAX_FLIPMAP];
int FlipMap[MAX_FLIPMAP]; int FlipMap[MAX_FLIPMAP];
@ -102,7 +101,6 @@ short CurrentRoom;
int GameTimer; int GameTimer;
short GlobalCounter; short GlobalCounter;
byte LevelComplete; byte LevelComplete;
short DelCutSeqPlayer;
#ifndef NEW_INV #ifndef NEW_INV
int LastInventoryItem; int LastInventoryItem;
#endif #endif
@ -112,27 +110,21 @@ int InitialiseGame;
int RequiredStartPos; int RequiredStartPos;
int WeaponDelay; int WeaponDelay;
int WeaponEnemyTimer; int WeaponEnemyTimer;
int HeavyTriggered;
short SkyPos1; short SkyPos1;
short SkyPos2; short SkyPos2;
CVECTOR SkyColor1; CVECTOR SkyColor1;
CVECTOR SkyColor2; CVECTOR SkyColor2;
int CutSeqNum; int CutSeqNum;
int CutSeqTriggered;
int GlobalPlayingCutscene;
int CurrentLevel; int CurrentLevel;
bool SoundActive;
bool DoTheGame; bool DoTheGame;
bool ThreadEnded; bool ThreadEnded;
int OnFloor; int OnFloor;
int SmokeWindX; int SmokeWindX;
int SmokeWindZ; int SmokeWindZ;
int KillEverythingFlag;
int FlipTimer; int FlipTimer;
int FlipEffect; int FlipEffect;
int TriggerTimer; int TriggerTimer;
int JustLoaded; int JustLoaded;
int PoisonFlags;
int OldLaraBusy; int OldLaraBusy;
int Infrared; int Infrared;
short FlashFadeR; short FlashFadeR;
@ -196,17 +188,13 @@ GAME_STATUS ControlPhase(int numFrames, int demoMode)
TrInput &= IN_LOOK; TrInput &= IN_LOOK;
} }
// If cutscene has been triggered then clear input
if (CutSeqTriggered)
TrInput = IN_NONE;
// Does the player want to enter inventory? // Does the player want to enter inventory?
SetDebounce = false; SetDebounce = false;
#ifdef NEW_INV #ifdef NEW_INV
if (CurrentLevel != 0 && !g_Renderer.isFading()) if (CurrentLevel != 0 && !g_Renderer.isFading())
{ {
if (TrInput & IN_PAUSE && GLOBAL_invMode != IM_PAUSE && LaraItem->hitPoints > 0 && !CutSeqTriggered) if (TrInput & IN_PAUSE && GLOBAL_invMode != IM_PAUSE && LaraItem->hitPoints > 0)
{ {
SOUND_Stop(); SOUND_Stop();
g_Renderer.DumpGameScene(); g_Renderer.DumpGameScene();
@ -214,7 +202,7 @@ GAME_STATUS ControlPhase(int numFrames, int demoMode)
pause_menu_to_display = pause_main_menu; pause_menu_to_display = pause_main_menu;
pause_selected_option = 1; pause_selected_option = 1;
} }
else if ((DbInput & IN_DESELECT || GLOBAL_enterinventory != NO_ITEM) && !CutSeqTriggered && LaraItem->hitPoints > 0) else if ((DbInput & IN_DESELECT || GLOBAL_enterinventory != NO_ITEM) && LaraItem->hitPoints > 0)
{ {
// Stop all sounds // Stop all sounds
SOUND_Stop(); SOUND_Stop();
@ -237,7 +225,7 @@ GAME_STATUS ControlPhase(int numFrames, int demoMode)
#else #else
if (CurrentLevel != 0 && !g_Renderer.isFading()) if (CurrentLevel != 0 && !g_Renderer.isFading())
{ {
if ((DbInput & IN_DESELECT || g_Inventory.GetEnterObject() != NO_ITEM) && !CutSeqTriggered && LaraItem->hitPoints > 0) if ((DbInput & IN_DESELECT || g_Inventory.GetEnterObject() != NO_ITEM) && LaraItem->hitPoints > 0)
{ {
// Stop all sounds // Stop all sounds
SOUND_Stop(); SOUND_Stop();
@ -435,23 +423,10 @@ GAME_STATUS ControlPhase(int numFrames, int demoMode)
{ {
if (Lara.poisoned > 4096) if (Lara.poisoned > 4096)
Lara.poisoned = 4096; Lara.poisoned = 4096;
else if (Lara.dpoisoned)
Lara.dpoisoned++;
if (!Lara.gassed)
{
if (Lara.dpoisoned)
{
Lara.dpoisoned -= 8;
if (Lara.dpoisoned < 0)
Lara.dpoisoned = 0;
}
}
if (Lara.poisoned >= 256 && !(Wibble & 0xFF)) if (Lara.poisoned >= 256 && !(Wibble & 0xFF))
{ {
LaraItem->hitPoints -= Lara.poisoned >> (8 - Lara.gassed); LaraItem->hitPoints -= Lara.poisoned >> 8;
PoisonFlags = 16;
} }
} }
@ -575,6 +550,9 @@ GAME_STATUS ControlPhase(int numFrames, int demoMode)
if (FlipEffect != -1) if (FlipEffect != -1)
effect_routines[FlipEffect](NULL); effect_routines[FlipEffect](NULL);
// Clear savegame loaded flag
JustLoaded = false;
// Update timers // Update timers
HealthBarTimer--; HealthBarTimer--;
GameTimer++; GameTimer++;
@ -657,7 +635,6 @@ GAME_STATUS DoTitle(int index)
#ifndef NEW_INV #ifndef NEW_INV
LastInventoryItem = -1; LastInventoryItem = -1;
#endif #endif
DelCutSeqPlayer = 0;
// Initialise flyby cameras // Initialise flyby cameras
InitSpotCamSequences(); InitSpotCamSequences();
@ -669,7 +646,6 @@ GAME_STATUS DoTitle(int index)
// Play background music // Play background music
//CurrentAtmosphere = ambient; //CurrentAtmosphere = ambient;
S_CDPlay(CurrentAtmosphere, 1); S_CDPlay(CurrentAtmosphere, 1);
IsAtmospherePlaying = true;
// Initialise ponytails // Initialise ponytails
InitialiseHair(); InitialiseHair();
@ -797,7 +773,6 @@ GAME_STATUS DoLevel(int index, std::string ambient, bool loadFromSavegame)
#ifndef NEW_INV #ifndef NEW_INV
LastInventoryItem = -1; LastInventoryItem = -1;
#endif #endif
DelCutSeqPlayer = 0;
#ifdef NEW_INV #ifdef NEW_INV
GLOBAL_inventoryitemchosen = NO_ITEM; GLOBAL_inventoryitemchosen = NO_ITEM;
@ -813,7 +788,6 @@ GAME_STATUS DoLevel(int index, std::string ambient, bool loadFromSavegame)
// Play background music // Play background music
CurrentAtmosphere = ambient; CurrentAtmosphere = ambient;
S_CDPlay(CurrentAtmosphere, 1); S_CDPlay(CurrentAtmosphere, 1);
IsAtmospherePlaying = true;
// Initialise ponytails // Initialise ponytails
InitialiseHair(); InitialiseHair();
@ -925,8 +899,6 @@ void TestTriggers(short *data, bool heavy, int heavyFlags)
} }
} }
HeavyTriggered = false;
if (!data) if (!data)
return; return;
@ -1196,7 +1168,6 @@ void TestTriggers(short *data, bool heavy, int heavyFlags)
item->touchBits = 0; item->touchBits = 0;
AddActiveItem(value); AddActiveItem(value);
item->status = ITEM_ACTIVE; item->status = ITEM_ACTIVE;
HeavyTriggered = heavy;
} }
} }
} }

View file

@ -62,7 +62,6 @@ enum COMMAND_TYPES
#define OUTSIDE_SIZE 108 #define OUTSIDE_SIZE 108
extern int KeyTriggerActive; extern int KeyTriggerActive;
extern byte IsAtmospherePlaying;
extern byte FlipStatus; extern byte FlipStatus;
constexpr auto MAX_FLIPMAP = 255; constexpr auto MAX_FLIPMAP = 255;
@ -89,7 +88,6 @@ extern short CurrentRoom;
extern int GameTimer; extern int GameTimer;
extern short GlobalCounter; extern short GlobalCounter;
extern byte LevelComplete; extern byte LevelComplete;
extern short DelCutSeqPlayer;
#ifndef NEW_INV #ifndef NEW_INV
extern int LastInventoryItem; extern int LastInventoryItem;
#endif #endif
@ -99,27 +97,21 @@ extern int InitialiseGame;
extern int RequiredStartPos; extern int RequiredStartPos;
extern int WeaponDelay; extern int WeaponDelay;
extern int WeaponEnemyTimer; extern int WeaponEnemyTimer;
extern int HeavyTriggered;
extern short SkyPos1; extern short SkyPos1;
extern short SkyPos2; extern short SkyPos2;
extern CVECTOR SkyColor1; extern CVECTOR SkyColor1;
extern CVECTOR SkyColor2; extern CVECTOR SkyColor2;
extern int CutSeqNum; extern int CutSeqNum;
extern int CutSeqTriggered;
extern int GlobalPlayingCutscene;
extern int CurrentLevel; extern int CurrentLevel;
extern bool SoundActive;
extern bool DoTheGame; extern bool DoTheGame;
extern bool ThreadEnded; extern bool ThreadEnded;
extern int OnFloor; extern int OnFloor;
extern int SmokeWindX; extern int SmokeWindX;
extern int SmokeWindZ; extern int SmokeWindZ;
extern int KillEverythingFlag;
extern int FlipTimer; extern int FlipTimer;
extern int FlipEffect; extern int FlipEffect;
extern int TriggerTimer; extern int TriggerTimer;
extern int JustLoaded; extern int JustLoaded;
extern int PoisonFlags;
extern int OldLaraBusy; extern int OldLaraBusy;
extern int Infrared; extern int Infrared;
extern short FlashFadeR; extern short FlashFadeR;

View file

@ -1275,7 +1275,7 @@ void TriggerDartSmoke(int x, int y, int z, int xv, int zv, int hit)
void KillAllCurrentItems(short itemNumber) void KillAllCurrentItems(short itemNumber)
{ {
KillEverythingFlag = 1; // TODO: Reimplement this functionality
} }
void TriggerDynamicLight(int x, int y, int z, short falloff, byte r, byte g, byte b) void TriggerDynamicLight(int x, int y, int z, short falloff, byte r, byte g, byte b)
@ -1865,9 +1865,4 @@ void TriggerMetalSparks(int x, int y, int z, int xv, int yv, int zv, int additio
spark->dSize = ((r / 256) & 0xF) + 24; spark->dSize = ((r / 256) & 0xF) + 24;
} }
} }
}
void KillEverything()
{
KillEverythingFlag = 0;
} }

View file

@ -32,11 +32,11 @@ void DrawHealthBarOverlay(int value)
if (CurrentLevel) if (CurrentLevel)
{ {
int color2 = 0; int color2 = 0;
if (Lara.poisoned || Lara.gassed) if (Lara.poisoned)
color2 = 0xA0A000; color2 = 0xA0A000;
else else
color2 = 0xA00000; color2 = 0xA00000;
g_Renderer.drawBar(value, ::g_HealthBar, ID_HEALTH_BAR_TEXTURE, GlobalCounter,Lara.poisoned || Lara.gassed); g_Renderer.drawBar(value, ::g_HealthBar, ID_HEALTH_BAR_TEXTURE, GlobalCounter, Lara.poisoned);
} }
} }
@ -44,7 +44,7 @@ void DrawHealthBar(float value)
{ {
if (CurrentLevel) if (CurrentLevel)
{ {
g_Renderer.drawBar(value, ::g_HealthBar, ID_HEALTH_BAR_TEXTURE,GlobalCounter,Lara.poisoned || Lara.gassed); g_Renderer.drawBar(value, ::g_HealthBar, ID_HEALTH_BAR_TEXTURE, GlobalCounter, Lara.poisoned);
} }
} }
@ -170,13 +170,6 @@ void UpdateAirBar(int flash)
} }
else else
DrawAirBar(air / 1800.0f); DrawAirBar(air / 1800.0f);
if (Lara.gassed)
{
if (Lara.dpoisoned < 2048)
Lara.dpoisoned += 2;
Lara.gassed = false;
}
} }
void DrawDashBar(int value) void DrawDashBar(int value)

View file

@ -1879,7 +1879,6 @@ int Inventory::DoTitleInventory()
} }
CurrentAtmosphere = CDA_XA11_FLYBY1; CurrentAtmosphere = CDA_XA11_FLYBY1;
IsAtmospherePlaying = true;
S_CDPlay(CurrentAtmosphere, 1); S_CDPlay(CurrentAtmosphere, 1);
OpenRing(INV_RING_OPTIONS, true); OpenRing(INV_RING_OPTIONS, true);

View file

@ -6,8 +6,9 @@
#include "setup.h" #include "setup.h"
#include "Renderer11.h" #include "Renderer11.h"
#include "trmath.h" #include "trmath.h"
using namespace ten::renderer; using namespace ten::renderer;
int NumLaraSpheres;
bool GotLaraSpheres; bool GotLaraSpheres;
SPHERE LaraSpheres[MAX_SPHERES]; SPHERE LaraSpheres[MAX_SPHERES];
SPHERE CreatureSpheres[MAX_SPHERES]; SPHERE CreatureSpheres[MAX_SPHERES];
@ -37,19 +38,14 @@ int TestCollision(ITEM_INFO* item, ITEM_INFO* l)
{ {
int flags = 0; int flags = 0;
int num1 = GetSpheres(item, CreatureSpheres, SPHERES_SPACE_WORLD, Matrix::Identity); int creatureSphereCount = GetSpheres(item, CreatureSpheres, SPHERES_SPACE_WORLD, Matrix::Identity);
int num2 = 0; int laraSphereCount = 0;
if (l == LaraItem) if (l == LaraItem)
{ {
if (GotLaraSpheres) if (!GotLaraSpheres)
{ {
num2 = NumLaraSpheres; laraSphereCount = GetSpheres(l, LaraSpheres, SPHERES_SPACE_WORLD, Matrix::Identity);
}
else
{
num2 = GetSpheres(l, LaraSpheres, SPHERES_SPACE_WORLD, Matrix::Identity);
NumLaraSpheres = num2;
if (l == LaraItem) if (l == LaraItem)
GotLaraSpheres = true; GotLaraSpheres = true;
} }
@ -58,22 +54,21 @@ int TestCollision(ITEM_INFO* item, ITEM_INFO* l)
{ {
GotLaraSpheres = false; GotLaraSpheres = false;
num2 = GetSpheres(l, LaraSpheres, SPHERES_SPACE_WORLD, Matrix::Identity); laraSphereCount = GetSpheres(l, LaraSpheres, SPHERES_SPACE_WORLD, Matrix::Identity);
NumLaraSpheres = num2;
if (l == LaraItem) if (l == LaraItem)
GotLaraSpheres = true; GotLaraSpheres = true;
} }
l->touchBits = 0; l->touchBits = 0;
if (num1 <= 0) if (creatureSphereCount <= 0)
{ {
item->touchBits = 0; item->touchBits = 0;
return 0; return 0;
} }
else else
{ {
for (int i = 0; i < num1; i++) for (int i = 0; i < creatureSphereCount; i++)
{ {
SPHERE* ptr1 = &CreatureSpheres[i]; SPHERE* ptr1 = &CreatureSpheres[i];
@ -84,7 +79,7 @@ int TestCollision(ITEM_INFO* item, ITEM_INFO* l)
if (r1 > 0) if (r1 > 0)
{ {
for (int j = 0; j < num2; j++) for (int j = 0; j < laraSphereCount; j++)
{ {
SPHERE* ptr2 = &LaraSpheres[j]; SPHERE* ptr2 = &LaraSpheres[j];

View file

@ -14,7 +14,6 @@ struct SPHERE
int r; int r;
}; };
extern int NumLaraSpheres;
extern bool GotLaraSpheres; extern bool GotLaraSpheres;
extern SPHERE LaraSpheres[MAX_SPHERES]; extern SPHERE LaraSpheres[MAX_SPHERES];
extern SPHERE CreatureSpheres[MAX_SPHERES]; extern SPHERE CreatureSpheres[MAX_SPHERES];

View file

@ -565,15 +565,8 @@ void WreckingBallControl(short itemNumber)
} }
if (item->itemFlags[2] < 900) if (item->itemFlags[2] < 900)
++item->itemFlags[2]; ++item->itemFlags[2];
if (GlobalPlayingCutscene)
{ if (item->itemFlags[1] <= 0)
room = item->roomNumber;
item->goalAnimState = 0;
item->pos.xPos = 47616;
item->pos.zPos = 34816;
item->pos.yPos = GetCeiling(GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &room), item->pos.xPos, item->pos.yPos, item->pos.zPos) + 1664;
}
else if (item->itemFlags[1] <= 0)
{ {
oldX = item->pos.xPos; oldX = item->pos.xPos;
oldZ = item->pos.zPos; oldZ = item->pos.zPos;

View file

@ -220,7 +220,7 @@ bool SpeedBoatCanGetOff(int direction)
if (collResult.HeightType == BIG_SLOPE || collResult.HeightType == DIAGONAL) if (collResult.HeightType == BIG_SLOPE || collResult.HeightType == DIAGONAL)
return false; return false;
if ((collResult.CeilingHeight - v->pos.yPos > -LARA_HITE) || (collResult.FloorHeight - collResult.CeilingHeight < LARA_HITE)) if ((collResult.CeilingHeight - v->pos.yPos > -LARA_HEIGHT) || (collResult.FloorHeight - collResult.CeilingHeight < LARA_HEIGHT))
return false; return false;
return true; return true;

View file

@ -240,7 +240,7 @@ bool SkidooCheckGetOffOK(int direction)
if (abs(collResult.FloorHeight - skidoo->pos.yPos) > WALL_SIZE / 2) if (abs(collResult.FloorHeight - skidoo->pos.yPos) > WALL_SIZE / 2)
return false; return false;
if (collResult.CeilingHeight - skidoo->pos.yPos > -LARA_HITE || collResult.FloorHeight - collResult.CeilingHeight < LARA_HITE) if (collResult.CeilingHeight - skidoo->pos.yPos > -LARA_HEIGHT || collResult.FloorHeight - collResult.CeilingHeight < LARA_HEIGHT)
return false; return false;
return true; return true;

View file

@ -110,7 +110,7 @@ void ScubaControl(short itemNumber)
start.roomNumber = item->roomNumber; start.roomNumber = item->roomNumber;
target.x = LaraItem->pos.xPos; target.x = LaraItem->pos.xPos;
target.y = LaraItem->pos.yPos - (LARA_HITE - 150); target.y = LaraItem->pos.yPos - (LARA_HEIGHT - 150);
target.z = LaraItem->pos.zPos; target.z = LaraItem->pos.zPos;
shoot = LOS(&start, &target); shoot = LOS(&start, &target);

View file

@ -93,7 +93,7 @@ static short GetCollision(ITEM_INFO* v, short ang, int dist, short* ceiling)
short roomNumber; short roomNumber;
x = v->pos.xPos + phd_sin(ang) * dist; x = v->pos.xPos + phd_sin(ang) * dist;
y = v->pos.yPos - LARA_HITE; y = v->pos.yPos - LARA_HEIGHT;
z = v->pos.zPos + phd_cos(ang) * dist; z = v->pos.zPos + phd_cos(ang) * dist;
roomNumber = v->roomNumber; roomNumber = v->roomNumber;
@ -163,7 +163,7 @@ static bool CanGetOut(int direction)
if (abs(collResult.FloorHeight - v->pos.yPos) > WALL_SIZE / 2) if (abs(collResult.FloorHeight - v->pos.yPos) > WALL_SIZE / 2)
return false; return false;
if ((collResult.CeilingHeight - v->pos.yPos > -LARA_HITE) || (collResult.FloorHeight - collResult.CeilingHeight < LARA_HITE)) if ((collResult.CeilingHeight - v->pos.yPos > -LARA_HEIGHT) || (collResult.FloorHeight - collResult.CeilingHeight < LARA_HEIGHT))
return false; return false;
return true; return true;

View file

@ -185,7 +185,7 @@ static int CanQuadbikeGetOff(int direction)
if (abs(collResult.FloorHeight - item->pos.yPos) > 512) if (abs(collResult.FloorHeight - item->pos.yPos) > 512)
return false; return false;
if ((collResult.CeilingHeight - item->pos.yPos > -LARA_HITE) || (collResult.FloorHeight - collResult.CeilingHeight < LARA_HITE)) if ((collResult.CeilingHeight - item->pos.yPos > -LARA_HEIGHT) || (collResult.FloorHeight - collResult.CeilingHeight < LARA_HEIGHT))
return false; return false;
return true; return true;

View file

@ -668,7 +668,7 @@ static int CanGetOffRubberBoat(int direction)
if (collResult.HeightType == BIG_SLOPE || collResult.HeightType == DIAGONAL) if (collResult.HeightType == BIG_SLOPE || collResult.HeightType == DIAGONAL)
return 0; return 0;
if ((collResult.CeilingHeight - boat->pos.yPos > -762) || (collResult.FloorHeight - collResult.CeilingHeight < 762)) if ((collResult.CeilingHeight - boat->pos.yPos > -LARA_HEIGHT) || (collResult.FloorHeight - collResult.CeilingHeight < LARA_HEIGHT))
return 0; return 0;
return 1; return 1;

View file

@ -732,7 +732,7 @@ static void UserInput(ITEM_INFO* v, ITEM_INFO* l, SUB_INFO* sub)
l->gravityStatus = false; l->gravityStatus = false;
l->pos.xRot = l->pos.zRot = 0; l->pos.xRot = l->pos.zRot = 0;
UpdateLaraRoom(l, -LARA_HITE / 2); UpdateLaraRoom(l, -LARA_HEIGHT / 2);
Lara.waterStatus = LW_SURFACE; Lara.waterStatus = LW_SURFACE;
Lara.waterSurfaceDist = -hfw; Lara.waterSurfaceDist = -hfw;

View file

@ -305,8 +305,8 @@ static int JeepCanGetOff()
int ceiling = GetCeiling(floor, x, y, z); int ceiling = GetCeiling(floor, x, y, z);
if ((ceiling - item->pos.yPos > -LARA_HITE) if ((ceiling - item->pos.yPos > -LARA_HEIGHT)
|| (height - ceiling < LARA_HITE)) || (height - ceiling < LARA_HEIGHT))
return 0; return 0;
return 1; return 1;
@ -418,7 +418,6 @@ static int JeepCheckGetOff()
Lara.Vehicle = NO_ITEM; Lara.Vehicle = NO_ITEM;
Lara.gunStatus = LG_NO_ARMS; Lara.gunStatus = LG_NO_ARMS;
CurrentAtmosphere = 110; CurrentAtmosphere = 110;
IsAtmospherePlaying = true;
S_CDPlay(110, 1); S_CDPlay(110, 1);
return false; return false;
} }
@ -1607,7 +1606,6 @@ void JeepCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll)
item->flags |= 0x20; item->flags |= 0x20;
CurrentAtmosphere = 98; CurrentAtmosphere = 98;
IsAtmospherePlaying = 1;
S_CDPlay(98, 1); S_CDPlay(98, 1);
} }
else else

View file

@ -976,9 +976,9 @@ static BOOL MotorbikeCanGetOff(void)
return false; return false;
if (abs(collResult.FloorHeight - item->pos.yPos) > STEP_SIZE) if (abs(collResult.FloorHeight - item->pos.yPos) > STEP_SIZE)
return false; return false;
if ((collResult.CeilingHeight - item->pos.yPos) > -LARA_HITE) if ((collResult.CeilingHeight - item->pos.yPos) > -LARA_HEIGHT)
return false; return false;
if ((collResult.FloorHeight - collResult.CeilingHeight) < LARA_HITE) if ((collResult.FloorHeight - collResult.CeilingHeight) < LARA_HEIGHT)
return false; return false;
return true; return true;

View file

@ -143,7 +143,7 @@ void ShiftLaraOnPlatform(short itemNumber, bool isExpanding)
xShift = lara_coll.radius / 6; xShift = lara_coll.radius / 6;
} }
auto coll = lara_coll; auto coll = lara_coll;
GetCollisionInfo(&coll, LaraItem->pos.xPos + xShift, LaraItem->pos.yPos, LaraItem->pos.zPos + zShift, LaraItem->roomNumber, LARA_HITE); GetCollisionInfo(&coll, LaraItem->pos.xPos + xShift, LaraItem->pos.yPos, LaraItem->pos.zPos + zShift, LaraItem->roomNumber, LARA_HEIGHT);
if (coll.middle.Ceiling >= 0 || coll.hitStatic) if (coll.middle.Ceiling >= 0 || coll.hitStatic)
return; return;

View file

@ -737,7 +737,7 @@ int TestBlockPull(ITEM_INFO* item, int blockhite, short quadrant)
roomNum = LaraItem->roomNumber; roomNum = LaraItem->roomNumber;
collResult = GetCollisionResult(x, y - LARA_HITE, z, LaraItem->roomNumber); collResult = GetCollisionResult(x, y - LARA_HEIGHT, z, LaraItem->roomNumber);
r = &g_Level.Rooms[roomNum]; r = &g_Level.Rooms[roomNum];
if (XZ_GET_SECTOR(r, x - r->x, z - r->z).stopper) if (XZ_GET_SECTOR(r, x - r->x, z - r->z).stopper)
@ -746,7 +746,7 @@ int TestBlockPull(ITEM_INFO* item, int blockhite, short quadrant)
if (collResult.FloorHeight != y) if (collResult.FloorHeight != y)
return 0; return 0;
if (collResult.Block->ceiling * 256 > y - LARA_HITE) if (collResult.Block->ceiling * 256 > y - LARA_HEIGHT)
return 0; return 0;
oldX = LaraItem->pos.xPos; oldX = LaraItem->pos.xPos;

View file

@ -179,7 +179,6 @@ void ControlTeleporter(short itemNumber)
{ {
if (item->itemFlags[0] == 15) if (item->itemFlags[0] == 15)
{ {
IsAtmospherePlaying = 0;
//S_CDPlay("xa12_z_10", 0); //S_CDPlay("xa12_z_10", 0);
} }
else if (item->itemFlags[0] == 70) else if (item->itemFlags[0] == 70)

View file

@ -46,7 +46,6 @@ void InitialiseGameFlags()
FlipEffect = -1; FlipEffect = -1;
FlipStatus = 0; FlipStatus = 0;
IsAtmospherePlaying = 0;
Camera.underwater = 0; Camera.underwater = 0;
} }

View file

@ -285,7 +285,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
//g_Renderer->Test(); //g_Renderer->Test();
SoundActive = false;
DoTheGame = true; DoTheGame = true;
ThreadEnded = false; ThreadEnded = false;