mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-12 05:26:57 +03:00
Merge pull request #311 from MontyTRC89/legacy_trigger_refactor
Floordata convenience improvements and de-corefication
This commit is contained in:
commit
a88aafef72
173 changed files with 4296 additions and 4678 deletions
|
@ -34,11 +34,11 @@
|
|||
|
||||
#include "GameFlowScript.h"
|
||||
#include "health.h"
|
||||
#include "effect2.h"
|
||||
#include "flipeffect.h"
|
||||
#include "sound.h"
|
||||
#include "savegame.h"
|
||||
#include "rope.h"
|
||||
#include <Objects\TR3\Vehicles\rubberboat.h>
|
||||
#include "rubberboat.h"
|
||||
#include <Game\misc.h>
|
||||
|
||||
using std::function;
|
||||
|
@ -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)
|
||||
{
|
||||
if (Lara.Vehicle == NO_ITEM) // only for the upv !!
|
||||
|
@ -833,7 +825,6 @@ void LaraAboveWater(ITEM_INFO* item, COLL_INFO* coll) //hmmmm
|
|||
coll->oldAnimNumber = item->animNumber;
|
||||
coll->oldFrameNumber = item->frameNumber;
|
||||
coll->radius = LARA_RAD;
|
||||
coll->trigger = NULL;
|
||||
|
||||
if ((TrInput & IN_LOOK) && Lara.ExtraAnim == NO_ITEM && Lara.look)
|
||||
LookLeftRight();
|
||||
|
@ -920,16 +911,12 @@ void LaraAboveWater(ITEM_INFO* item, COLL_INFO* coll) //hmmmm
|
|||
// Check for collision with items
|
||||
LaraBaddieCollision(item, coll);
|
||||
|
||||
// FIXME: refresh floor globals because sometimes they are messed by calling GetFloorHeight
|
||||
// all over the place. Needed for monkeyswing. Remove when block flags decoupled from floordata. -- Lwmte 19.08.21
|
||||
RefreshFloorGlobals(item);
|
||||
|
||||
// Handle Lara collision
|
||||
if (Lara.Vehicle == NO_ITEM)
|
||||
lara_collision_routines[item->currentAnimState](item, coll);
|
||||
}
|
||||
|
||||
UpdateLaraRoom(item, -LARA_HITE / 2);
|
||||
UpdateLaraRoom(item, -LARA_HEIGHT / 2);
|
||||
|
||||
//if (Lara.gunType == WEAPON_CROSSBOW && !LaserSight)
|
||||
// TrInput &= ~IN_ACTION;
|
||||
|
@ -937,8 +924,9 @@ void LaraAboveWater(ITEM_INFO* item, COLL_INFO* coll) //hmmmm
|
|||
// Handle weapons
|
||||
LaraGun();
|
||||
|
||||
// Test if there's a trigger
|
||||
TestTriggers(coll->trigger, FALSE, 0);
|
||||
// Test for flags & triggers
|
||||
ProcessSectorFlags(item);
|
||||
TestTriggers(item, false, NULL);
|
||||
}
|
||||
|
||||
void LaraUnderWater(ITEM_INFO* item, COLL_INFO* coll)
|
||||
|
@ -951,15 +939,14 @@ void LaraUnderWater(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->old.y = item->pos.yPos;
|
||||
coll->old.z = item->pos.zPos;
|
||||
|
||||
coll->slopesAreWalls = 0;
|
||||
coll->slopesArePits = 0;
|
||||
coll->lavaIsPit = 0;
|
||||
coll->slopesAreWalls = false;
|
||||
coll->slopesArePits = false;
|
||||
coll->lavaIsPit = false;
|
||||
|
||||
coll->enableBaddiePush = true;
|
||||
coll->enableSpaz = false;
|
||||
|
||||
coll->radius = 300;
|
||||
coll->trigger = NULL;
|
||||
|
||||
if (TrInput & IN_LOOK && Lara.look)
|
||||
LookLeftRight();
|
||||
|
@ -1048,7 +1035,8 @@ void LaraUnderWater(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
LaraGun();
|
||||
|
||||
TestTriggers(coll->trigger, 0, 0);
|
||||
ProcessSectorFlags(item);
|
||||
TestTriggers(item, false, NULL);
|
||||
}
|
||||
|
||||
void LaraSurface(ITEM_INFO* item, COLL_INFO* coll)
|
||||
|
@ -1063,14 +1051,13 @@ void LaraSurface(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->old.y = item->pos.yPos;
|
||||
coll->old.z = item->pos.zPos;
|
||||
|
||||
coll->slopesAreWalls = 0;
|
||||
coll->slopesArePits = 0;
|
||||
coll->lavaIsPit = 0;
|
||||
coll->slopesAreWalls = false;
|
||||
coll->slopesArePits = false;
|
||||
coll->lavaIsPit = false;
|
||||
coll->enableBaddiePush = false;
|
||||
coll->enableSpaz = false;
|
||||
|
||||
coll->radius = 100;
|
||||
coll->trigger = NULL;
|
||||
|
||||
if (TrInput & IN_LOOK && Lara.look)
|
||||
LookLeftRight();
|
||||
|
@ -1105,7 +1092,8 @@ void LaraSurface(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
LaraGun();
|
||||
|
||||
TestTriggers(coll->trigger, 0, 0);
|
||||
ProcessSectorFlags(item);
|
||||
TestTriggers(item, false, NULL);
|
||||
}
|
||||
|
||||
void LaraCheat(ITEM_INFO* item, COLL_INFO* coll)
|
||||
|
@ -1168,7 +1156,7 @@ void AnimateLara(ITEM_INFO* item)
|
|||
{
|
||||
case COMMAND_MOVE_ORIGIN:
|
||||
TranslateItem(item, cmd[0], cmd[1], cmd[2]);
|
||||
UpdateLaraRoom(item, -LARA_HITE / 2);
|
||||
UpdateLaraRoom(item, -LARA_HEIGHT / 2);
|
||||
cmd += 3;
|
||||
break;
|
||||
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
#define LARA_MED_TURN ANGLE(6.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_FREEFALL_SPEED = 131;
|
||||
constexpr auto LARA_RAD = 100;
|
||||
constexpr auto LARA_VELOCITY = 12;
|
||||
|
|
|
@ -28,7 +28,7 @@ void lara_default_col(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->slopesArePits = true;
|
||||
coll->slopesAreWalls = true;
|
||||
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)
|
||||
|
@ -132,7 +132,7 @@ void lara_col_walk(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->lavaIsPit = 1;
|
||||
|
||||
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))
|
||||
{
|
||||
|
@ -147,11 +147,11 @@ void lara_col_walk(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
if (!LaraFallen(item, coll))
|
||||
{
|
||||
if (coll->midFloor > STEP_SIZE / 2)
|
||||
if (coll->middle.Floor > STEP_SIZE / 2)
|
||||
{
|
||||
if (coll->frontFloor == NO_HEIGHT || coll->frontFloor <= STEP_SIZE / 2)
|
||||
if (coll->front.Floor == NO_HEIGHT || coll->front.Floor <= STEP_SIZE / 2)
|
||||
{
|
||||
coll->midFloor = 0;
|
||||
coll->middle.Floor = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -159,13 +159,13 @@ void lara_col_walk(ITEM_INFO* item, COLL_INFO* coll)
|
|||
GetChange(item, &g_Level.Anims[item->animNumber]);
|
||||
}
|
||||
}
|
||||
if (coll->midFloor >= -STEPUP_HEIGHT && coll->midFloor < -STEP_SIZE / 2)
|
||||
if (coll->middle.Floor >= -STEPUP_HEIGHT && coll->middle.Floor < -STEP_SIZE / 2)
|
||||
{
|
||||
if (coll->frontFloor == NO_HEIGHT ||
|
||||
coll->frontFloor < -STEPUP_HEIGHT ||
|
||||
coll->frontFloor >= -STEP_SIZE / 2)
|
||||
if (coll->front.Floor == NO_HEIGHT ||
|
||||
coll->front.Floor < -STEPUP_HEIGHT ||
|
||||
coll->front.Floor >= -STEP_SIZE / 2)
|
||||
{
|
||||
coll->midFloor = 0;
|
||||
coll->middle.Floor = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -174,8 +174,8 @@ void lara_col_walk(ITEM_INFO* item, COLL_INFO* coll)
|
|||
}
|
||||
}
|
||||
|
||||
if (!TestLaraSlide(item, coll) && coll->midFloor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (!TestLaraSlide(item, coll) && coll->middle.Floor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ void lara_col_run(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->slopesAreWalls = true;
|
||||
|
||||
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))
|
||||
{
|
||||
|
@ -331,11 +331,11 @@ void lara_col_run(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
if (!LaraFallen(item, coll))
|
||||
{
|
||||
if (coll->midFloor >= -STEPUP_HEIGHT && coll->midFloor < -STEP_SIZE / 2)
|
||||
if (coll->middle.Floor >= -STEPUP_HEIGHT && coll->middle.Floor < -STEP_SIZE / 2)
|
||||
{
|
||||
if (coll->frontFloor == NO_HEIGHT || coll->frontFloor < -STEPUP_HEIGHT || coll->frontFloor >= -STEP_SIZE / 2)
|
||||
if (coll->front.Floor == NO_HEIGHT || coll->front.Floor < -STEPUP_HEIGHT || coll->front.Floor >= -STEP_SIZE / 2)
|
||||
{
|
||||
coll->midFloor = 0;
|
||||
coll->middle.Floor = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -346,16 +346,16 @@ void lara_col_run(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
if (!TestLaraSlide(item, coll))
|
||||
{
|
||||
if (coll->midFloor < 50)
|
||||
if (coll->middle.Floor < 50)
|
||||
{
|
||||
if (coll->midFloor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
}
|
||||
else
|
||||
{
|
||||
item->goalAnimState = LS_STEP_DOWN; // for theoretical running stepdown anims, not in default anims
|
||||
if (GetChange(item, &g_Level.Anims[item->animNumber]))
|
||||
item->pos.yPos += coll->midFloor; // move Lara to midFloor
|
||||
item->pos.yPos += coll->middle.Floor; // move Lara to middle.Floor
|
||||
else
|
||||
item->pos.yPos += 50; // do the default aligment
|
||||
}
|
||||
|
@ -368,8 +368,8 @@ void lara_as_stop(ITEM_INFO* item, COLL_INFO* coll)
|
|||
{
|
||||
/*state 2*/
|
||||
/*collision: lara_col_stop*/
|
||||
short fheight = NO_HEIGHT;
|
||||
short rheight = NO_HEIGHT;
|
||||
COLL_RESULT fheight = {}; fheight.FloorHeight = NO_HEIGHT;
|
||||
COLL_RESULT rheight = {}; rheight.FloorHeight = NO_HEIGHT;
|
||||
|
||||
if (item->hitPoints <= 0)
|
||||
{
|
||||
|
@ -413,9 +413,9 @@ void lara_as_stop(ITEM_INFO* item, COLL_INFO* coll)
|
|||
LookUpDown();
|
||||
|
||||
if (TrInput & IN_FORWARD)
|
||||
fheight = LaraFloorFront(item, item->pos.yRot, LARA_RAD + 4);
|
||||
fheight = LaraCollisionFront(item, item->pos.yRot, LARA_RAD + 4);
|
||||
else if (TrInput & IN_BACK)
|
||||
rheight = LaraFloorFront(item, item->pos.yRot - ANGLE(180.0f), LARA_RAD + 4); // TR3: item->pos.yRot + ANGLE(180) ?
|
||||
rheight = LaraCollisionFront(item, item->pos.yRot - ANGLE(180.0f), LARA_RAD + 4); // TR3: item->pos.yRot + ANGLE(180) ?
|
||||
|
||||
if (g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP)
|
||||
{
|
||||
|
@ -428,22 +428,18 @@ void lara_as_stop(ITEM_INFO* item, COLL_INFO* coll)
|
|||
{
|
||||
if (TrInput & IN_LSTEP)
|
||||
{
|
||||
short height, ceiling;
|
||||
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_HEIGHT);
|
||||
|
||||
height = LaraFloorFront(item, item->pos.yRot - ANGLE(90.0f), LARA_RAD + 48);
|
||||
ceiling = LaraCeilingFront(item, item->pos.yRot - ANGLE(90.0f), LARA_RAD + 48, LARA_HITE);
|
||||
|
||||
if ((height < 128 && height > -128) && HeightType != BIG_SLOPE && ceiling <= 0)
|
||||
if ((collFloorResult.FloorHeight < 128 && collFloorResult.FloorHeight > -128) && collFloorResult.HeightType != BIG_SLOPE && collCeilingResult.CeilingHeight <= 0)
|
||||
item->goalAnimState = LS_STEP_LEFT;
|
||||
}
|
||||
else if (TrInput & IN_RSTEP)
|
||||
{
|
||||
short height, ceiling;
|
||||
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_HEIGHT);
|
||||
|
||||
height = LaraFloorFront(item, item->pos.yRot + ANGLE(90.0f), LARA_RAD + 48);
|
||||
ceiling = LaraCeilingFront(item, item->pos.yRot + ANGLE(90.0f), LARA_RAD + 48, LARA_HITE);
|
||||
|
||||
if ((height < 128 && height > -128) && HeightType != BIG_SLOPE && ceiling <= 0)
|
||||
if ((collFloorResult.FloorHeight < 128 && collFloorResult.FloorHeight > -128) && collFloorResult.HeightType != BIG_SLOPE && collCeilingResult.CeilingHeight <= 0)
|
||||
item->goalAnimState = LS_STEP_RIGHT;
|
||||
}
|
||||
else if (TrInput & IN_LEFT)
|
||||
|
@ -467,7 +463,7 @@ void lara_as_stop(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
if (g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP)
|
||||
{
|
||||
if (fheight > -(STEPUP_HEIGHT - 1))
|
||||
if (fheight.FloorHeight > -(STEPUP_HEIGHT - 1))
|
||||
{
|
||||
lara_as_wade(item, coll);
|
||||
wade = true;
|
||||
|
@ -475,7 +471,7 @@ void lara_as_stop(ITEM_INFO* item, COLL_INFO* coll)
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((fheight < (STEPUP_HEIGHT - 1)) && (fheight > -(STEPUP_HEIGHT - 1)))
|
||||
if ((fheight.FloorHeight < (STEPUP_HEIGHT - 1)) && (fheight.FloorHeight > -(STEPUP_HEIGHT - 1)))
|
||||
{
|
||||
lara_as_wade(item, coll);
|
||||
wade = true;
|
||||
|
@ -492,7 +488,7 @@ void lara_as_stop(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->radius = LARA_RAD + 2;
|
||||
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))
|
||||
return;
|
||||
|
||||
|
@ -501,7 +497,7 @@ void lara_as_stop(ITEM_INFO* item, COLL_INFO* coll)
|
|||
}
|
||||
else if (TrInput & IN_BACK)
|
||||
{
|
||||
if ((rheight < (STEPUP_HEIGHT - 1)) && (rheight > -(STEPUP_HEIGHT - 1)))
|
||||
if ((rheight.FloorHeight < (STEPUP_HEIGHT - 1)) && (rheight.FloorHeight > -(STEPUP_HEIGHT - 1)))
|
||||
lara_as_back(item, coll);
|
||||
}
|
||||
}
|
||||
|
@ -513,12 +509,10 @@ void lara_as_stop(ITEM_INFO* item, COLL_INFO* coll)
|
|||
}
|
||||
else if (TrInput & IN_FORWARD)
|
||||
{
|
||||
short height, ceiling;
|
||||
auto collFloorResult = LaraCollisionFront(item, item->pos.yRot, LARA_RAD + 4);
|
||||
auto collCeilingResult = LaraCeilingCollisionFront(item, item->pos.yRot, LARA_RAD + 4, LARA_HEIGHT);
|
||||
|
||||
height = LaraFloorFront(item, item->pos.yRot, LARA_RAD + 4);
|
||||
ceiling = LaraCeilingFront(item, item->pos.yRot, LARA_RAD + 4, LARA_HITE);
|
||||
|
||||
if ((HeightType == BIG_SLOPE || HeightType == DIAGONAL) && (height < 0 || ceiling > 0))
|
||||
if ((collFloorResult.HeightType == BIG_SLOPE || collFloorResult.HeightType == DIAGONAL) && (collFloorResult.FloorHeight < 0 || collCeilingResult.CeilingHeight > 0))
|
||||
{
|
||||
item->goalAnimState = LS_STOP;
|
||||
return;
|
||||
|
@ -532,10 +526,10 @@ void lara_as_stop(ITEM_INFO* item, COLL_INFO* coll)
|
|||
{
|
||||
if (TrInput & IN_WALK)
|
||||
{
|
||||
if ((rheight < (STEPUP_HEIGHT - 1)) && (rheight > -(STEPUP_HEIGHT - 1)) && HeightType != BIG_SLOPE)
|
||||
if ((rheight.FloorHeight < (STEPUP_HEIGHT - 1)) && (rheight.FloorHeight > -(STEPUP_HEIGHT - 1)) && rheight.HeightType != BIG_SLOPE)
|
||||
lara_as_back(item, coll);
|
||||
}
|
||||
else if (rheight > -(STEPUP_HEIGHT - 1))
|
||||
else if (rheight.FloorHeight > -(STEPUP_HEIGHT - 1))
|
||||
{
|
||||
item->goalAnimState = LS_HOP_BACK;
|
||||
}
|
||||
|
@ -554,9 +548,9 @@ void lara_col_stop(ITEM_INFO* item, COLL_INFO* coll)
|
|||
item->gravityStatus = false;
|
||||
item->fallspeed = 0;
|
||||
coll->slopesArePits = true;
|
||||
coll->slopesAreWalls = 1;
|
||||
coll->slopesAreWalls = true;
|
||||
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))
|
||||
return;
|
||||
|
@ -570,12 +564,12 @@ void lara_col_stop(ITEM_INFO* item, COLL_INFO* coll)
|
|||
ShiftItem(item, coll);
|
||||
|
||||
#if 1
|
||||
if (coll->midFloor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
#else
|
||||
if (!(g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP) || coll->midFloor < 0)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
else if (g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP && coll->midFloor)
|
||||
if (!(g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP) || coll->middle.Floor < 0)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
else if (g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP && coll->middle.Floor)
|
||||
item->pos.yPos += SWAMP_GRAVITY;
|
||||
#endif
|
||||
}
|
||||
|
@ -635,13 +629,13 @@ void lara_col_forwardjump(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->badCeiling = BAD_JUMP_CEILING;
|
||||
|
||||
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);
|
||||
|
||||
if (item->speed < 0)
|
||||
Lara.moveAngle = item->pos.yRot;
|
||||
|
||||
if (coll->midFloor <= 0 && item->fallspeed > 0)
|
||||
if (coll->middle.Floor <= 0 && item->fallspeed > 0)
|
||||
{
|
||||
if (LaraLandedBad(item, coll))
|
||||
{
|
||||
|
@ -666,8 +660,8 @@ void lara_col_forwardjump(ITEM_INFO* item, COLL_INFO* coll)
|
|||
item->fallspeed = 0;
|
||||
item->speed = 0;
|
||||
|
||||
if (coll->midFloor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
|
||||
AnimateLara(item);
|
||||
}
|
||||
|
@ -708,7 +702,7 @@ void lara_col_fastback(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
Lara.moveAngle = item->pos.yRot + ANGLE(180);
|
||||
|
||||
coll->slopesAreWalls = 0;
|
||||
coll->slopesAreWalls = false;
|
||||
coll->slopesArePits = true;
|
||||
|
||||
coll->badPos = NO_BAD_POS;
|
||||
|
@ -716,17 +710,17 @@ void lara_col_fastback(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->badCeiling = 0;
|
||||
|
||||
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 (coll->midFloor <= 200)
|
||||
if (coll->middle.Floor <= 200)
|
||||
{
|
||||
if (LaraDeflectEdge(item, coll))
|
||||
LaraCollideStop(item, coll);
|
||||
|
||||
if (!TestLaraSlide(item, coll) && coll->midFloor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (!TestLaraSlide(item, coll) && coll->middle.Floor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -802,15 +796,15 @@ void lara_col_turn_r(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->badPos = STEPUP_HEIGHT;
|
||||
coll->badNeg = -STEPUP_HEIGHT;
|
||||
coll->badCeiling = 0;
|
||||
coll->slopesAreWalls = 1;
|
||||
coll->slopesAreWalls = true;
|
||||
coll->slopesArePits = true;
|
||||
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 (coll->midFloor > 100)
|
||||
if (coll->middle.Floor > 100)
|
||||
#else
|
||||
if (coll->midFloor > 100 && !(g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP))
|
||||
if (coll->middle.Floor > 100 && !(g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP))
|
||||
#endif
|
||||
{
|
||||
item->fallspeed = 0;
|
||||
|
@ -826,12 +820,12 @@ void lara_col_turn_r(ITEM_INFO* item, COLL_INFO* coll)
|
|||
return;
|
||||
|
||||
#if 1
|
||||
if (coll->midFloor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
#else
|
||||
if (!(g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP) || coll->midFloor < 0)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
else if (g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP && coll->midFloor)
|
||||
if (!(g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP) || coll->middle.Floor < 0)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
else if (g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP && coll->middle.Floor)
|
||||
item->pos.yPos += SWAMP_GRAVITY;
|
||||
#endif
|
||||
}
|
||||
|
@ -922,14 +916,14 @@ void lara_col_death(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->radius = 400;
|
||||
|
||||
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);
|
||||
|
||||
item->hitPoints = -1;
|
||||
Lara.air = -1;
|
||||
|
||||
if (coll->midFloor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
}
|
||||
|
||||
void lara_as_fastfall(ITEM_INFO* item, COLL_INFO* coll)
|
||||
|
@ -952,10 +946,10 @@ void lara_col_fastfall(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->badCeiling = BAD_JUMP_CEILING;
|
||||
|
||||
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);
|
||||
|
||||
if (coll->midFloor <= 0)
|
||||
if (coll->middle.Floor <= 0)
|
||||
{
|
||||
if (LaraLandedBad(item, coll))
|
||||
{
|
||||
|
@ -974,8 +968,8 @@ void lara_col_fastfall(ITEM_INFO* item, COLL_INFO* coll)
|
|||
item->fallspeed = 0;
|
||||
item->gravityStatus = false;
|
||||
|
||||
if (coll->midFloor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1002,7 +996,7 @@ void lara_col_reach(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->badCeiling = BAD_JUMP_CEILING;
|
||||
|
||||
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;
|
||||
bool result = false;
|
||||
|
@ -1030,8 +1024,8 @@ void lara_col_reach(ITEM_INFO* item, COLL_INFO* coll)
|
|||
return;
|
||||
}
|
||||
|
||||
if (coll->midCeiling <= -384 &&
|
||||
coll->midFloor >= 200 &&
|
||||
if (coll->middle.Ceiling <= -384 &&
|
||||
coll->middle.Floor >= 200 &&
|
||||
coll->collType == CT_FRONT)
|
||||
{
|
||||
edgeCatch = LaraTestEdgeCatch(item, coll, &edge);
|
||||
|
@ -1039,7 +1033,7 @@ void lara_col_reach(ITEM_INFO* item, COLL_INFO* coll)
|
|||
if (!(!edgeCatch || edgeCatch < 0 && !LaraTestHangOnClimbWall(item, coll)))
|
||||
{
|
||||
angle = item->pos.yRot;
|
||||
/*if (coll->midSplitFloor && coll->frontSplitFloor == coll->midSplitFloor)
|
||||
/*if (coll->middle.SplitFloor && coll->front.SplitFloor == coll->middle.SplitFloor)
|
||||
{
|
||||
result = SnapToDiagonal(angle, 35);
|
||||
}
|
||||
|
@ -1055,10 +1049,10 @@ void lara_col_reach(ITEM_INFO* item, COLL_INFO* coll)
|
|||
{
|
||||
LaraSlideEdgeJump(item, coll);
|
||||
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);
|
||||
|
||||
if (item->fallspeed > 0 && coll->midFloor <= 0)
|
||||
if (item->fallspeed > 0 && coll->middle.Floor <= 0)
|
||||
{
|
||||
if (LaraLandedBad(item, coll))
|
||||
{
|
||||
|
@ -1069,8 +1063,8 @@ void lara_col_reach(ITEM_INFO* item, COLL_INFO* coll)
|
|||
item->goalAnimState = LS_STOP;
|
||||
item->fallspeed = 0;
|
||||
item->gravityStatus = false;
|
||||
if (coll->midFloor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1127,11 +1121,11 @@ void lara_col_reach(ITEM_INFO* item, COLL_INFO* coll)
|
|||
}
|
||||
else
|
||||
{
|
||||
item->pos.yPos += coll->frontFloor - bounds->Y1;
|
||||
item->pos.yPos += coll->front.Floor - bounds->Y1;
|
||||
|
||||
/*if (coll->midSplitFloor)
|
||||
/*if (coll->middle.SplitFloor)
|
||||
{
|
||||
Vector2 v = GetDiagonalIntersect(item->pos.xPos, item->pos.zPos, coll->midSplitFloor, LARA_RAD, angle);
|
||||
Vector2 v = GetDiagonalIntersect(item->pos.xPos, item->pos.zPos, coll->middle.SplitFloor, LARA_RAD, angle);
|
||||
item->pos.xPos = v.x;
|
||||
item->pos.zPos = v.y;
|
||||
}
|
||||
|
@ -1170,11 +1164,11 @@ void lara_col_splat(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->badCeiling = 0;
|
||||
|
||||
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);
|
||||
|
||||
if (coll->midFloor >= -256 && coll->midFloor <= 256)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor >= -256 && coll->middle.Floor <= 256)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
}
|
||||
|
||||
void lara_col_land(ITEM_INFO* item, COLL_INFO* coll)
|
||||
|
@ -1190,22 +1184,22 @@ void lara_as_compress(ITEM_INFO* item, COLL_INFO* coll)
|
|||
/*collision: lara_col_compress*/
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
Lara.moveAngle = item->pos.yRot + ANGLE(180);
|
||||
|
@ -1228,11 +1222,11 @@ void lara_col_compress(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->badCeiling = 0;
|
||||
|
||||
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 (coll->midCeiling > -100)
|
||||
if (coll->middle.Ceiling > -100)
|
||||
{
|
||||
item->animNumber = LA_STAND_SOLID;
|
||||
item->frameNumber = g_Level.Anims[item->animNumber].frameBase;
|
||||
|
@ -1248,8 +1242,8 @@ void lara_col_compress(ITEM_INFO* item, COLL_INFO* coll)
|
|||
item->pos.zPos = coll->old.z;
|
||||
}
|
||||
|
||||
if (coll->midFloor > -256 && coll->midFloor < 256)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor > -256 && coll->middle.Floor < 256)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1300,9 +1294,9 @@ void lara_col_back(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->badNeg = -STEPUP_HEIGHT;
|
||||
coll->badCeiling = 0;
|
||||
coll->slopesArePits = true;
|
||||
coll->slopesAreWalls = 1;
|
||||
coll->slopesAreWalls = true;
|
||||
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))
|
||||
return;
|
||||
|
@ -1313,7 +1307,7 @@ void lara_col_back(ITEM_INFO* item, COLL_INFO* coll)
|
|||
if (LaraFallen(item, coll))
|
||||
return;
|
||||
|
||||
if (coll->midFloor > STEP_SIZE / 2 && coll->midFloor < STEPUP_HEIGHT)
|
||||
if (coll->middle.Floor > STEP_SIZE / 2 && coll->middle.Floor < STEPUP_HEIGHT)
|
||||
{
|
||||
item->goalAnimState = LS_STEP_BACK_DOWN;
|
||||
GetChange(item, &g_Level.Anims[item->animNumber]);
|
||||
|
@ -1323,13 +1317,13 @@ void lara_col_back(ITEM_INFO* item, COLL_INFO* coll)
|
|||
return;
|
||||
|
||||
#if 0
|
||||
if (!(g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP) || coll->midFloor < 0)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
else if (g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP && coll->midFloor)
|
||||
if (!(g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP) || coll->middle.Floor < 0)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
else if (g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP && coll->middle.Floor)
|
||||
item->pos.yPos += SWAMP_GRAVITY;
|
||||
#else
|
||||
if (coll->midFloor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1424,15 +1418,15 @@ void lara_col_stepright(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->badCeiling = 0;
|
||||
|
||||
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 (LaraDeflectEdge(item, coll))
|
||||
LaraCollideStop(item, coll);
|
||||
|
||||
if (!LaraFallen(item, coll) && !TestLaraSlide(item, coll) && coll->midFloor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (!LaraFallen(item, coll) && !TestLaraSlide(item, coll) && coll->middle.Floor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1493,14 +1487,14 @@ void lara_col_roll2(ITEM_INFO* item, COLL_INFO* coll)
|
|||
item->fallspeed = 0;
|
||||
|
||||
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))
|
||||
return;
|
||||
if (TestLaraSlide(item, coll))
|
||||
return;
|
||||
|
||||
if (coll->midFloor > 200)
|
||||
if (coll->middle.Floor > 200)
|
||||
{
|
||||
item->animNumber = LA_FALL_BACK;
|
||||
item->frameNumber = g_Level.Anims[item->animNumber].frameBase;
|
||||
|
@ -1513,8 +1507,8 @@ void lara_col_roll2(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
ShiftItem(item, coll);
|
||||
|
||||
if (coll->midFloor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
}
|
||||
|
||||
void lara_as_backjump(ITEM_INFO* item, COLL_INFO* coll)
|
||||
|
@ -1594,10 +1588,10 @@ void lara_col_jumper(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->badCeiling = BAD_JUMP_CEILING;
|
||||
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);
|
||||
|
||||
if (item->fallspeed > 0 && coll->midFloor <= 0)
|
||||
if (item->fallspeed > 0 && coll->middle.Floor <= 0)
|
||||
{
|
||||
if (LaraLandedBad(item, coll))
|
||||
item->goalAnimState = LS_DEATH;
|
||||
|
@ -1607,8 +1601,8 @@ void lara_col_jumper(ITEM_INFO* item, COLL_INFO* coll)
|
|||
item->fallspeed = 0;
|
||||
item->gravityStatus = 0;
|
||||
|
||||
if (coll->midFloor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1661,7 +1655,7 @@ void lara_col_upjump(ITEM_INFO* item, COLL_INFO* coll)
|
|||
return;
|
||||
}
|
||||
|
||||
if (coll->collType == CT_FRONT && coll->midCeiling <= -STEPUP_HEIGHT)
|
||||
if (coll->collType == CT_FRONT && coll->middle.Ceiling <= -STEPUP_HEIGHT)
|
||||
{
|
||||
int edge;
|
||||
int edgeCatch = LaraTestEdgeCatch(item, coll, &edge);
|
||||
|
@ -1673,7 +1667,7 @@ void lara_col_upjump(ITEM_INFO* item, COLL_INFO* coll)
|
|||
short angle = item->pos.yRot;
|
||||
bool result;
|
||||
|
||||
/*if (coll->midSplitFloor && coll->frontSplitFloor == coll->midSplitFloor)
|
||||
/*if (coll->middle.SplitFloor && coll->front.SplitFloor == coll->middle.SplitFloor)
|
||||
{
|
||||
result = SnapToDiagonal(angle, 35);
|
||||
}
|
||||
|
@ -1716,11 +1710,11 @@ void lara_col_upjump(ITEM_INFO* item, COLL_INFO* coll)
|
|||
if (edgeCatch <= 0)
|
||||
item->pos.yPos = edge - bounds->Y1 + 4;
|
||||
else
|
||||
item->pos.yPos += coll->frontFloor - bounds->Y1;
|
||||
item->pos.yPos += coll->front.Floor - bounds->Y1;
|
||||
|
||||
/*if (coll->midSplitFloor)
|
||||
/*if (coll->middle.SplitFloor)
|
||||
{
|
||||
Vector2 v = GetDiagonalIntersect(item->pos.xPos, item->pos.zPos, coll->midSplitFloor, LARA_RAD, item->pos.yRot);
|
||||
Vector2 v = GetDiagonalIntersect(item->pos.xPos, item->pos.zPos, coll->middle.SplitFloor, LARA_RAD, item->pos.yRot);
|
||||
item->pos.xPos = v.x;
|
||||
item->pos.zPos = v.y;
|
||||
}
|
||||
|
@ -1774,15 +1768,15 @@ void lara_col_upjump(ITEM_INFO* item, COLL_INFO* coll)
|
|||
item->speed = item->speed <= 0 ? -2 : 2;
|
||||
}
|
||||
|
||||
if (item->fallspeed > 0 && coll->midFloor <= 0)
|
||||
if (item->fallspeed > 0 && coll->middle.Floor <= 0)
|
||||
{
|
||||
item->goalAnimState = LaraLandedBad(item, coll) ? LS_DEATH : LS_STOP;
|
||||
|
||||
item->gravityStatus = false;
|
||||
item->fallspeed = 0;
|
||||
|
||||
if (coll->midFloor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1809,10 +1803,10 @@ void lara_col_fallback(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->badCeiling = BAD_JUMP_CEILING;
|
||||
|
||||
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);
|
||||
|
||||
if (item->fallspeed > 0 && coll->midFloor <= 0)
|
||||
if (item->fallspeed > 0 && coll->middle.Floor <= 0)
|
||||
{
|
||||
if (LaraLandedBad(item, coll))
|
||||
item->goalAnimState = LS_DEATH;
|
||||
|
@ -1822,8 +1816,8 @@ void lara_col_fallback(ITEM_INFO* item, COLL_INFO* coll)
|
|||
item->fallspeed = 0;
|
||||
item->gravityStatus = 0;
|
||||
|
||||
if (coll->midFloor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1843,7 +1837,7 @@ void lara_col_roll(ITEM_INFO* item, COLL_INFO* coll)
|
|||
item->fallspeed = 0;
|
||||
|
||||
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))
|
||||
return;
|
||||
|
@ -1862,8 +1856,8 @@ void lara_col_roll(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
ShiftItem(item, coll);
|
||||
|
||||
if (coll->midFloor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
}
|
||||
|
||||
void lara_as_swandive(ITEM_INFO* item, COLL_INFO* coll)
|
||||
|
@ -1887,17 +1881,17 @@ void lara_col_swandive(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->badCeiling = BAD_JUMP_CEILING;
|
||||
|
||||
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);
|
||||
|
||||
if (coll->midFloor <= 0 && item->fallspeed > 0)
|
||||
if (coll->middle.Floor <= 0 && item->fallspeed > 0)
|
||||
{
|
||||
item->goalAnimState = LS_STOP;
|
||||
item->fallspeed = 0;
|
||||
item->gravityStatus = 0;
|
||||
|
||||
if (coll->midFloor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1923,10 +1917,10 @@ void lara_col_fastdive(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->badCeiling = BAD_JUMP_CEILING;
|
||||
|
||||
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);
|
||||
|
||||
if (coll->midFloor <= 0 && item->fallspeed > 0)
|
||||
if (coll->middle.Floor <= 0 && item->fallspeed > 0)
|
||||
{
|
||||
if (item->fallspeed <= 133)
|
||||
item->goalAnimState = LS_STOP;
|
||||
|
@ -1936,8 +1930,8 @@ void lara_col_fastdive(ITEM_INFO* item, COLL_INFO* coll)
|
|||
item->fallspeed = 0;
|
||||
item->gravityStatus = 0;
|
||||
|
||||
if (coll->midFloor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2075,7 +2069,7 @@ void lara_col_wade(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->slopesAreWalls = true;
|
||||
|
||||
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))
|
||||
return;
|
||||
|
@ -2088,7 +2082,7 @@ void lara_col_wade(ITEM_INFO* item, COLL_INFO* coll)
|
|||
item->pos.zRot = 0;
|
||||
|
||||
|
||||
if ((coll->frontType == WALL || coll->frontType == SPLIT_TRI) && coll->frontFloor < -((STEP_SIZE * 5) / 2) && !(g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP))
|
||||
if ((coll->front.Type == WALL || coll->front.Type == SPLIT_TRI) && coll->front.Floor < -((STEP_SIZE * 5) / 2) && !(g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP))
|
||||
{
|
||||
item->goalAnimState = LS_SPLAT;
|
||||
if (GetChange(item, &g_Level.Anims[item->animNumber]))
|
||||
|
@ -2099,21 +2093,21 @@ void lara_col_wade(ITEM_INFO* item, COLL_INFO* coll)
|
|||
}
|
||||
|
||||
|
||||
if (coll->midFloor >= -STEPUP_HEIGHT && coll->midFloor < -STEP_SIZE / 2 && !(g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP))
|
||||
if (coll->middle.Floor >= -STEPUP_HEIGHT && coll->middle.Floor < -STEP_SIZE / 2 && !(g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP))
|
||||
{
|
||||
item->goalAnimState = LS_STEP_UP;
|
||||
GetChange(item, &g_Level.Anims[item->animNumber]);
|
||||
}
|
||||
|
||||
if (coll->midFloor >= 50 && !(g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP))
|
||||
if (coll->middle.Floor >= 50 && !(g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP))
|
||||
{
|
||||
item->pos.yPos += 50;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP) || coll->midFloor < 0)
|
||||
item->pos.yPos += coll->midFloor; // Enforce to floor height.. if not a swamp room.
|
||||
else if (g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP && coll->midFloor)
|
||||
if (!(g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP) || coll->middle.Floor < 0)
|
||||
item->pos.yPos += coll->middle.Floor; // Enforce to floor height.. if not a swamp room.
|
||||
else if (g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP && coll->middle.Floor)
|
||||
item->pos.yPos += SWAMP_GRAVITY;
|
||||
}
|
||||
|
||||
|
@ -2195,7 +2189,7 @@ void lara_col_dash(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->slopesAreWalls = true;
|
||||
|
||||
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))
|
||||
{
|
||||
|
@ -2218,7 +2212,7 @@ void lara_col_dash(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
if (!LaraFallen(item, coll))
|
||||
{
|
||||
if (coll->midFloor >= -STEPUP_HEIGHT && coll->midFloor < -STEP_SIZE / 2)
|
||||
if (coll->middle.Floor >= -STEPUP_HEIGHT && coll->middle.Floor < -STEP_SIZE / 2)
|
||||
{
|
||||
item->goalAnimState = LS_STEP_UP;
|
||||
GetChange(item, &g_Level.Anims[item->animNumber]);
|
||||
|
@ -2226,16 +2220,16 @@ void lara_col_dash(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
if (!TestLaraSlide(item, coll))
|
||||
{
|
||||
if (coll->midFloor < 50)
|
||||
if (coll->middle.Floor < 50)
|
||||
{
|
||||
if (coll->midFloor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
}
|
||||
else
|
||||
{
|
||||
item->goalAnimState = LS_STEP_DOWN; // for theoretical sprint stepdown anims, not in default anims
|
||||
if (GetChange(item, &g_Level.Anims[item->animNumber]))
|
||||
item->pos.yPos += coll->midFloor; // move Lara to midFloor
|
||||
item->pos.yPos += coll->middle.Floor; // move Lara to middle.Floor
|
||||
else
|
||||
item->pos.yPos += 50; // do the default aligment
|
||||
}
|
||||
|
@ -2265,13 +2259,13 @@ void lara_col_dashdive(ITEM_INFO* item, COLL_INFO* coll)
|
|||
Lara.moveAngle = item->pos.yRot;
|
||||
|
||||
coll->badPos = NO_BAD_POS;
|
||||
coll->badNeg = -256;
|
||||
coll->badNeg = -STEPUP_HEIGHT;
|
||||
coll->badCeiling = BAD_JUMP_CEILING;
|
||||
|
||||
coll->slopesAreWalls = true;
|
||||
|
||||
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);
|
||||
|
||||
if (!LaraFallen(item, coll))
|
||||
|
@ -2279,7 +2273,7 @@ void lara_col_dashdive(ITEM_INFO* item, COLL_INFO* coll)
|
|||
if (item->speed < 0)
|
||||
Lara.moveAngle = item->pos.yRot;
|
||||
|
||||
if (coll->midFloor <= 0 && item->fallspeed > 0)
|
||||
if (coll->middle.Floor <= 0 && item->fallspeed > 0)
|
||||
{
|
||||
if (LaraLandedBad(item, coll))
|
||||
{
|
||||
|
@ -2296,7 +2290,7 @@ void lara_col_dashdive(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
item->gravityStatus = false;
|
||||
item->fallspeed = 0;
|
||||
item->pos.yPos += coll->midFloor;
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
item->speed = 0;
|
||||
|
||||
AnimateLara(item);
|
||||
|
@ -2304,7 +2298,7 @@ void lara_col_dashdive(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
ShiftItem(item, coll);
|
||||
|
||||
if (coll->midFloor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,33 +8,34 @@
|
|||
#include "level.h"
|
||||
#include "input.h"
|
||||
|
||||
short LeftIntRightExtTab[4] = // offset 0xA0B7C
|
||||
CLIMB_DIRECTION LeftIntRightExtTab[4] =
|
||||
{
|
||||
0x0800, 0x0100, 0x0200, 0x0400
|
||||
CLIMB_DIRECTION::West, CLIMB_DIRECTION::North, CLIMB_DIRECTION::East, CLIMB_DIRECTION::South
|
||||
};
|
||||
short LeftExtRightIntTab[4] = // offset 0xA0B84
|
||||
CLIMB_DIRECTION LeftExtRightIntTab[4] =
|
||||
{
|
||||
0x0200, 0x0400, 0x0800, 0x0100
|
||||
CLIMB_DIRECTION::East, CLIMB_DIRECTION::South, CLIMB_DIRECTION::West, CLIMB_DIRECTION::North
|
||||
};
|
||||
|
||||
short GetClimbTrigger(int x, int y, int z, short roomNumber)
|
||||
short GetClimbFlags(int x, int y, int z, short roomNumber)
|
||||
{
|
||||
GetFloorHeight(GetFloor(x, y, z, &roomNumber), x, y, z);
|
||||
return GetClimbFlags(GetFloor(x, y, z, &roomNumber));
|
||||
}
|
||||
|
||||
short* data = TriggerIndex;
|
||||
short GetClimbFlags(FLOOR_INFO* floor)
|
||||
{
|
||||
short result = 0;
|
||||
|
||||
if (data == NULL)
|
||||
return 0;
|
||||
if (floor->Flags.ClimbEast)
|
||||
result |= (short)CLIMB_DIRECTION::East;
|
||||
if (floor->Flags.ClimbWest)
|
||||
result |= (short)CLIMB_DIRECTION::West;
|
||||
if (floor->Flags.ClimbNorth)
|
||||
result |= (short)CLIMB_DIRECTION::North;
|
||||
if (floor->Flags.ClimbSouth)
|
||||
result |= (short)CLIMB_DIRECTION::South;
|
||||
|
||||
if ((*data & DATA_TYPE) == LAVA_TYPE)
|
||||
{
|
||||
if (*data & END_BIT)
|
||||
return 0;
|
||||
|
||||
data++;
|
||||
}
|
||||
|
||||
return (*data & DATA_TYPE) == CLIMB_TYPE ? *data : 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
void lara_col_climbend(ITEM_INFO* item, COLL_INFO* coll)
|
||||
|
@ -620,7 +621,7 @@ int LaraClimbRightCornerTest(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
int shift = 0;
|
||||
|
||||
if (GetClimbTrigger(x, item->pos.yPos, z, item->roomNumber) & LeftExtRightIntTab[angle])
|
||||
if (GetClimbFlags(x, item->pos.yPos, z, item->roomNumber) & (short)LeftExtRightIntTab[angle])
|
||||
{
|
||||
item->pos.xPos = x;
|
||||
Lara.cornerX = x;
|
||||
|
@ -666,7 +667,7 @@ int LaraClimbRightCornerTest(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
}
|
||||
|
||||
if (GetClimbTrigger(newX, item->pos.yPos, newZ, item->roomNumber) & LeftIntRightExtTab[angle])
|
||||
if (GetClimbFlags(newX, item->pos.yPos, newZ, item->roomNumber) & (short)LeftIntRightExtTab[angle])
|
||||
{
|
||||
item->pos.xPos = newX;
|
||||
Lara.cornerX = newX;
|
||||
|
@ -718,7 +719,7 @@ int LaraClimbLeftCornerTest(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
int shift = 0;
|
||||
|
||||
if (GetClimbTrigger(x, item->pos.yPos, z, item->roomNumber) & LeftIntRightExtTab[angle])
|
||||
if (GetClimbFlags(x, item->pos.yPos, z, item->roomNumber) & (short)LeftIntRightExtTab[angle])
|
||||
{
|
||||
item->pos.xPos = x;
|
||||
Lara.cornerX = x;
|
||||
|
@ -765,7 +766,7 @@ int LaraClimbLeftCornerTest(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
}
|
||||
|
||||
if (GetClimbTrigger(newX, item->pos.yPos, newZ, item->roomNumber) & LeftExtRightIntTab[angle])
|
||||
if (GetClimbFlags(newX, item->pos.yPos, newZ, item->roomNumber) & (short)LeftExtRightIntTab[angle])
|
||||
{
|
||||
item->pos.xPos = newX;
|
||||
Lara.cornerX = newX;
|
||||
|
@ -964,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;
|
||||
if (ceiling < 512)
|
||||
{
|
||||
if (height - ceiling <= 762)
|
||||
if (height - ceiling <= LARA_HEIGHT)
|
||||
{
|
||||
if (height - ceiling < 512)
|
||||
return 0;
|
||||
|
@ -994,11 +995,6 @@ int LaraCheckForLetGo(ITEM_INFO* item, COLL_INFO* coll)
|
|||
item->gravityStatus = false;
|
||||
item->fallspeed = 0;
|
||||
|
||||
GetFloorHeight(GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber),
|
||||
item->pos.xPos, item->pos.yPos, item->pos.zPos);
|
||||
|
||||
coll->trigger = TriggerIndex;
|
||||
|
||||
if (TrInput & IN_ACTION && item->hitPoints > 0 || item->animNumber == LA_ONWATER_TO_LADDER)//can't let go on this anim
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -2,7 +2,17 @@
|
|||
#include "items.h"
|
||||
#include "collide.h"
|
||||
|
||||
short GetClimbTrigger(int x, int y, int z, short roomNumber);
|
||||
enum class CLIMB_DIRECTION : short
|
||||
{
|
||||
North = 0x0100,
|
||||
East = 0x0200,
|
||||
South = 0x0400,
|
||||
West = 0x0800
|
||||
};
|
||||
|
||||
short GetClimbFlags(int x, int y, int z, short roomNumber);
|
||||
short GetClimbFlags(FLOOR_INFO* floor);
|
||||
|
||||
void lara_col_climbend(ITEM_INFO* item, COLL_INFO* coll);
|
||||
void lara_as_climbend(ITEM_INFO* item, COLL_INFO* coll);
|
||||
void lara_col_climbdown(ITEM_INFO* item, COLL_INFO* coll);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "input.h"
|
||||
#include "draw.h"
|
||||
#include "effect2.h"
|
||||
#include "control.h"
|
||||
|
||||
/*this file has all the generic **collision** test functions called in lara's state code*/
|
||||
|
||||
|
@ -43,9 +44,9 @@ void LaraDeflectEdgeJump(ITEM_INFO* item, COLL_INFO* coll)
|
|||
case CT_TOP_FRONT:
|
||||
if (!Lara.climbStatus || item->speed != 2)
|
||||
{
|
||||
if (coll->midFloor <= 512)
|
||||
if (coll->middle.Floor <= 512)
|
||||
{
|
||||
if (coll->midFloor <= 128)
|
||||
if (coll->middle.Floor <= 128)
|
||||
{
|
||||
item->goalAnimState = LS_GRAB_TO_FALL;
|
||||
item->currentAnimState = LS_GRAB_TO_FALL;
|
||||
|
@ -87,7 +88,7 @@ void LaraDeflectEdgeJump(ITEM_INFO* item, COLL_INFO* coll)
|
|||
item->pos.zPos -= 400 * phd_cos(coll->facing);
|
||||
|
||||
item->speed = 0;
|
||||
coll->midFloor = 0;
|
||||
coll->middle.Floor = 0;
|
||||
|
||||
if (item->fallspeed <= 0)
|
||||
item->fallspeed = 16;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "lara_slide.h"
|
||||
#include "lara_collide.h"
|
||||
#include "draw.h"
|
||||
#include "control.h"
|
||||
#include <Game/Lara/lara_flare.h>
|
||||
|
||||
/*this file has all the related functions to ducking and crawling*/
|
||||
|
@ -104,12 +105,12 @@ void lara_col_duck(ITEM_INFO* item, COLL_INFO* coll)
|
|||
}
|
||||
else if (!TestLaraSlide(item, coll))
|
||||
{
|
||||
Lara.keepDucked = coll->midCeiling >= -362;
|
||||
Lara.keepDucked = coll->middle.Ceiling >= -362;
|
||||
|
||||
ShiftItem(item, coll);
|
||||
|
||||
if (coll->midFloor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
|
||||
if (TrInput & IN_DUCK && Lara.waterStatus != LW_WADE ||
|
||||
Lara.keepDucked ||
|
||||
|
@ -150,19 +151,19 @@ void lara_col_crouch_roll(ITEM_INFO* item, COLL_INFO* coll)//horrible name.
|
|||
coll->facing = item->pos.yRot;
|
||||
coll->badNeg = -384;
|
||||
coll->badCeiling = 0;
|
||||
coll->slopesAreWalls = 1;
|
||||
coll->slopesAreWalls = true;
|
||||
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, 400);
|
||||
|
||||
if (LaraFallen(item, coll))
|
||||
Lara.gunStatus = LG_NO_ARMS;
|
||||
else if (!TestLaraSlide(item, coll))
|
||||
{
|
||||
if (coll->midCeiling >= -362)
|
||||
if (coll->middle.Ceiling >= -362)
|
||||
Lara.keepDucked = 1;
|
||||
else
|
||||
Lara.keepDucked = 0;
|
||||
|
||||
if (coll->midFloor < coll->badNeg)//hit a wall, stop
|
||||
if (coll->middle.Floor < coll->badNeg)//hit a wall, stop
|
||||
{
|
||||
item->pos.xPos = coll->old.x;
|
||||
item->pos.yPos = coll->old.y;
|
||||
|
@ -173,7 +174,7 @@ void lara_col_crouch_roll(ITEM_INFO* item, COLL_INFO* coll)//horrible name.
|
|||
ShiftItem(item, coll);
|
||||
|
||||
if (!LaraHitCeiling(item, coll))
|
||||
item->pos.yPos += coll->midFloor;
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
}
|
||||
}
|
||||
/*crouch/duck end*/
|
||||
|
@ -207,14 +208,13 @@ void lara_as_all4s(ITEM_INFO* item, COLL_INFO* coll)
|
|||
LaraCeilingFront(item, item->pos.yRot, 768, 512) != NO_HEIGHT &&
|
||||
LaraCeilingFront(item, item->pos.yRot, 768, 512) <= 0)
|
||||
{
|
||||
|
||||
s.x = LaraItem->pos.xPos;
|
||||
s.y = LaraItem->pos.yPos - 96;
|
||||
s.z = LaraItem->pos.zPos;
|
||||
s.roomNumber = LaraItem->roomNumber;
|
||||
|
||||
d.x = s.x + 768 * phd_sin(LaraItem->pos.yRot);
|
||||
d.y = s.y + 160;
|
||||
d.y = s.y + LARA_HEADROOM;
|
||||
d.z = s.z + 768 * phd_cos(LaraItem->pos.yRot);
|
||||
|
||||
if (LOS(&s, &d) && item->animNumber != LA_CROUCH_TO_CRAWL_START && item->animNumber != LA_CROUCH_TO_CRAWL_CONTINUE)
|
||||
|
@ -240,7 +240,7 @@ void lara_as_all4s(ITEM_INFO* item, COLL_INFO* coll)
|
|||
s.roomNumber = LaraItem->roomNumber;
|
||||
|
||||
d.x = s.x + 768 * phd_sin(LaraItem->pos.yRot);
|
||||
d.y = s.y + 160;
|
||||
d.y = s.y + LARA_HEADROOM;
|
||||
d.z = s.z + 768 * phd_cos(LaraItem->pos.yRot);
|
||||
|
||||
if (LOS(&s, &d) && item->animNumber != LA_CROUCH_TO_CRAWL_START && item->animNumber != LA_CROUCH_TO_CRAWL_CONTINUE && Lara.NewAnims.CrawlExit3click)
|
||||
|
@ -264,7 +264,7 @@ void lara_as_all4s(ITEM_INFO* item, COLL_INFO* coll)
|
|||
s.roomNumber = LaraItem->roomNumber;
|
||||
|
||||
d.x = s.x + 768 * phd_sin(LaraItem->pos.yRot);
|
||||
d.y = s.y + 160;
|
||||
d.y = s.y + LARA_HEADROOM;
|
||||
d.z = s.z + 768 * phd_cos(LaraItem->pos.yRot);
|
||||
|
||||
if (LOS(&s, &d) && item->animNumber != LA_CROUCH_TO_CRAWL_START && item->animNumber != LA_CROUCH_TO_CRAWL_CONTINUE && Lara.NewAnims.CrawlExit2click)
|
||||
|
@ -287,7 +287,7 @@ void lara_as_all4s(ITEM_INFO* item, COLL_INFO* coll)
|
|||
s.roomNumber = LaraItem->roomNumber;
|
||||
|
||||
d.x = s.x + 768 * phd_sin(LaraItem->pos.yRot);
|
||||
d.y = s.y + 160;
|
||||
d.y = s.y + LARA_HEADROOM;
|
||||
d.z = s.z + 768 * phd_cos(LaraItem->pos.yRot);
|
||||
|
||||
if (LOS(&s, &d) && item->animNumber != LA_CROUCH_TO_CRAWL_START && item->animNumber != LA_CROUCH_TO_CRAWL_CONTINUE && Lara.NewAnims.CrawlExit1click)
|
||||
|
@ -379,14 +379,14 @@ void lara_col_all4s(ITEM_INFO* item, COLL_INFO* coll)
|
|||
}
|
||||
else if (!TestLaraSlide(item, coll))
|
||||
{
|
||||
int slope = abs(coll->leftFloor2 - coll->rightFloor2);
|
||||
int slope = abs(coll->frontLeft.Floor - coll->frontRight.Floor);
|
||||
|
||||
Lara.keepDucked = coll->midCeiling >= -362;
|
||||
Lara.keepDucked = coll->middle.Ceiling >= -362;
|
||||
|
||||
ShiftItem(item, coll);
|
||||
|
||||
if (coll->midFloor != NO_HEIGHT && coll->midFloor > -256)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor != NO_HEIGHT && coll->middle.Floor > -256)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
|
||||
if (TrInput & IN_DUCK || Lara.keepDucked &&
|
||||
(!(TrInput & IN_FLARE) && !(TrInput & IN_DRAW) || TrInput & IN_FORWARD) &&
|
||||
|
@ -399,7 +399,8 @@ void lara_col_all4s(ITEM_INFO* item, COLL_INFO* coll)
|
|||
{
|
||||
if (TrInput & IN_FORWARD)
|
||||
{
|
||||
if (abs(LaraFloorFront(item, item->pos.yRot, 256)) < 127 && HeightType != BIG_SLOPE)
|
||||
auto collResult = LaraCollisionFront(item, item->pos.yRot, 256);
|
||||
if (abs(collResult.FloorHeight < 127 && collResult.HeightType != BIG_SLOPE))
|
||||
item->goalAnimState = LS_CRAWL_FORWARD;
|
||||
}
|
||||
else if (TrInput & IN_BACK)
|
||||
|
@ -429,9 +430,9 @@ void lara_col_all4s(ITEM_INFO* item, COLL_INFO* coll)
|
|||
item->pos.zPos = z;
|
||||
}
|
||||
|
||||
height = LaraFloorFront(item, item->pos.yRot, -300);
|
||||
auto collResult = LaraCollisionFront(item, item->pos.yRot, -300);
|
||||
|
||||
if (abs(height) >= 255 || HeightType == BIG_SLOPE)
|
||||
if (abs(height) >= 255 || collResult.HeightType == BIG_SLOPE)
|
||||
{
|
||||
if (TrInput & IN_ACTION)
|
||||
{
|
||||
|
@ -596,8 +597,8 @@ void lara_col_crawl(ITEM_INFO* item, COLL_INFO* coll)
|
|||
{
|
||||
ShiftItem(item, coll);
|
||||
|
||||
if (coll->midFloor != NO_HEIGHT && coll->midFloor > -256)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor != NO_HEIGHT && coll->middle.Floor > -256)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -651,8 +652,8 @@ void lara_col_all4turnlr(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
if (!TestLaraSlide(item, coll))
|
||||
{
|
||||
if (coll->midFloor != NO_HEIGHT && coll->midFloor > -256)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor != NO_HEIGHT && coll->middle.Floor > -256)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -737,8 +738,8 @@ void lara_col_crawlb(ITEM_INFO* item, COLL_INFO* coll)
|
|||
{
|
||||
ShiftItem(item, coll);
|
||||
|
||||
if (coll->midFloor != NO_HEIGHT && coll->midFloor > -256)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor != NO_HEIGHT && coll->middle.Floor > -256)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
|
||||
Lara.moveAngle = item->pos.yRot;
|
||||
}
|
||||
|
@ -792,15 +793,15 @@ void lara_col_ducklr(ITEM_INFO* item, COLL_INFO* coll)
|
|||
}
|
||||
else if (!TestLaraSlide(item, coll))
|
||||
{
|
||||
if (coll->midCeiling < -362)
|
||||
if (coll->middle.Ceiling < -362)
|
||||
Lara.keepDucked = false;
|
||||
else
|
||||
Lara.keepDucked = true;
|
||||
|
||||
ShiftItem(item, coll);
|
||||
|
||||
if (coll->midFloor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor != NO_HEIGHT)
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
}
|
||||
}
|
||||
/*crawling end*/
|
||||
|
@ -903,7 +904,7 @@ void lara_col_crawl2hang(ITEM_INFO* item, COLL_INFO* coll)
|
|||
break;
|
||||
}
|
||||
}
|
||||
item->pos.yPos += coll->frontFloor - bounds->Y1;
|
||||
item->pos.yPos += coll->front.Floor - bounds->Y1;
|
||||
item->pos.yRot = angle;
|
||||
|
||||
item->gravityStatus = true;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "lara_two_guns.h"
|
||||
#include "camera.h"
|
||||
#include "objects.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "sphere.h"
|
||||
#include "draw.h"
|
||||
#include "effect2.h"
|
||||
|
@ -1109,505 +1109,6 @@ void LaraGetNewTarget(WEAPON_INFO* weapon)
|
|||
LaraTargetInfo(weapon);
|
||||
}
|
||||
|
||||
void DoProperDetection(short itemNumber, int x, int y, int z, int xv, int yv, int zv)
|
||||
{
|
||||
HEIGHT_TYPES oldtype;
|
||||
int ceiling, height, oldonobj, oldheight;
|
||||
int bs, yang;
|
||||
|
||||
ITEM_INFO* item = &g_Level.Items[itemNumber];
|
||||
|
||||
short roomNumber = item->roomNumber;
|
||||
FLOOR_INFO* floor = GetFloor(x, y, z, &roomNumber);
|
||||
oldheight = GetFloorHeight(floor, x, y, z);
|
||||
oldonobj = OnObject;
|
||||
oldtype = HeightType;
|
||||
|
||||
roomNumber = item->roomNumber;
|
||||
floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber);
|
||||
height = GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos);
|
||||
if (item->pos.yPos >= height)
|
||||
{
|
||||
bs = 0;
|
||||
|
||||
if ((HeightType == BIG_SLOPE || HeightType == DIAGONAL) && oldheight < height)
|
||||
{
|
||||
yang = (long)((unsigned short)item->pos.yRot);
|
||||
if (TiltYOffset < 0)
|
||||
{
|
||||
if (yang >= 0x8000)
|
||||
bs = 1;
|
||||
}
|
||||
else if (TiltYOffset > 0)
|
||||
{
|
||||
if (yang <= 0x8000)
|
||||
bs = 1;
|
||||
}
|
||||
|
||||
if (TiltXOffset < 0)
|
||||
{
|
||||
if (yang >= 0x4000 && yang <= 0xc000)
|
||||
bs = 1;
|
||||
}
|
||||
else if (TiltXOffset > 0)
|
||||
{
|
||||
if (yang <= 0x4000 || yang >= 0xc000)
|
||||
bs = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* If last position of item was also below this floor height, we've hit a wall, else we've hit a floor */
|
||||
|
||||
if (y > (height + 32) && bs == 0 &&
|
||||
(((x / SECTOR(1)) != (item->pos.xPos / SECTOR(1))) ||
|
||||
((z / SECTOR(1)) != (item->pos.zPos / SECTOR(1)))))
|
||||
{
|
||||
// Need to know which direction the wall is.
|
||||
|
||||
long xs;
|
||||
|
||||
if ((x & (~(WALL_SIZE - 1))) != (item->pos.xPos & (~(WALL_SIZE - 1))) && // X crossed boundary?
|
||||
(z & (~(WALL_SIZE - 1))) != (item->pos.zPos & (~(WALL_SIZE - 1)))) // Z crossed boundary as well?
|
||||
{
|
||||
if (abs(x - item->pos.xPos) < abs(z - item->pos.zPos))
|
||||
xs = 1; // X has travelled the shortest, so (maybe) hit first. (Seems to work ok).
|
||||
else
|
||||
xs = 0;
|
||||
}
|
||||
else
|
||||
xs = 1;
|
||||
|
||||
if ((x & (~(WALL_SIZE - 1))) != (item->pos.xPos & (~(WALL_SIZE - 1))) && xs) // X crossed boundary?
|
||||
{
|
||||
if (xv <= 0) // Hit angle = 0xc000.
|
||||
item->pos.yRot = 0x4000 + (0xc000 - item->pos.yRot);
|
||||
else // Hit angle = 0x4000.
|
||||
item->pos.yRot = 0xc000 + (0x4000 - item->pos.yRot);
|
||||
}
|
||||
else // Z crossed boundary.
|
||||
item->pos.yRot = 0x8000 - item->pos.yRot;
|
||||
|
||||
item->speed /= 2;
|
||||
|
||||
/* Put item back in its last position */
|
||||
item->pos.xPos = x;
|
||||
item->pos.yPos = y;
|
||||
item->pos.zPos = z;
|
||||
}
|
||||
else if (HeightType == BIG_SLOPE || HeightType == DIAGONAL) // Hit a steep slope?
|
||||
{
|
||||
// Need to know which direction the slope is.
|
||||
|
||||
item->speed -= (item->speed / 4);
|
||||
|
||||
if (TiltYOffset < 0 && ((abs(TiltYOffset)) - (abs(TiltXOffset)) >= 2)) // Hit angle = 0x4000
|
||||
{
|
||||
if (((unsigned short)item->pos.yRot) > 0x8000)
|
||||
{
|
||||
item->pos.yRot = 0x4000 + (0xc000 - (unsigned short)item->pos.yRot - 1);
|
||||
if (item->fallspeed > 0)
|
||||
item->fallspeed = -(item->fallspeed / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item->speed < 32)
|
||||
{
|
||||
item->speed -= TiltYOffset * 2;
|
||||
if ((unsigned short)item->pos.yRot > 0x4000 && (unsigned short)item->pos.yRot < 0xc000)
|
||||
{
|
||||
item->pos.yRot -= 4096;
|
||||
if ((unsigned short)item->pos.yRot < 0x4000)
|
||||
item->pos.yRot = 0x4000;
|
||||
}
|
||||
else if ((unsigned short)item->pos.yRot < 0x4000)
|
||||
{
|
||||
item->pos.yRot += 4096;
|
||||
if ((unsigned short)item->pos.yRot > 0x4000)
|
||||
item->pos.yRot = 0x4000;
|
||||
}
|
||||
}
|
||||
|
||||
if (item->fallspeed > 0)
|
||||
item->fallspeed = -(item->fallspeed / 2);
|
||||
else
|
||||
item->fallspeed = 0;
|
||||
}
|
||||
}
|
||||
else if (TiltYOffset > 0 && ((abs(TiltYOffset)) - (abs(TiltXOffset)) >= 2)) // Hit angle = 0xc000
|
||||
{
|
||||
if (((unsigned short)item->pos.yRot) < 0x8000)
|
||||
{
|
||||
item->pos.yRot = 0xc000 + (0x4000 - (unsigned short)item->pos.yRot - 1);
|
||||
if (item->fallspeed > 0)
|
||||
item->fallspeed = -(item->fallspeed / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item->speed < 32)
|
||||
{
|
||||
item->speed += TiltYOffset * 2;
|
||||
if ((unsigned short)item->pos.yRot > 0xc000 || (unsigned short)item->pos.yRot < 0x4000)
|
||||
{
|
||||
item->pos.yRot -= 4096;
|
||||
if ((unsigned short)item->pos.yRot < 0xc000)
|
||||
item->pos.yRot = 0xc000;
|
||||
}
|
||||
else if ((unsigned short)item->pos.yRot < 0xc000)
|
||||
{
|
||||
item->pos.yRot += 4096;
|
||||
if ((unsigned short)item->pos.yRot > 0xc000)
|
||||
item->pos.yRot = 0xc000;
|
||||
}
|
||||
}
|
||||
|
||||
if (item->fallspeed > 0)
|
||||
item->fallspeed = -(item->fallspeed / 2);
|
||||
else
|
||||
item->fallspeed = 0;
|
||||
}
|
||||
}
|
||||
else if (TiltXOffset < 0 && ((abs(TiltXOffset)) - (abs(TiltYOffset)) >= 2)) // Hit angle = 0
|
||||
{
|
||||
if (((unsigned short)item->pos.yRot) > 0x4000 && ((unsigned short)item->pos.yRot) < 0xc000)
|
||||
{
|
||||
item->pos.yRot = (0x8000 - item->pos.yRot - 1);
|
||||
if (item->fallspeed > 0)
|
||||
item->fallspeed = -(item->fallspeed / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item->speed < 32)
|
||||
{
|
||||
item->speed -= TiltXOffset * 2;
|
||||
|
||||
if ((unsigned short)item->pos.yRot < 0x8000)
|
||||
{
|
||||
item->pos.yRot -= 4096;
|
||||
if ((unsigned short)item->pos.yRot > 0xf000)
|
||||
item->pos.yRot = 0;
|
||||
}
|
||||
else if ((unsigned short)item->pos.yRot >= 0x8000)
|
||||
{
|
||||
item->pos.yRot += 4096;
|
||||
if ((unsigned short)item->pos.yRot < 0x1000)
|
||||
item->pos.yRot = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (item->fallspeed > 0)
|
||||
item->fallspeed = -(item->fallspeed / 2);
|
||||
else
|
||||
item->fallspeed = 0;
|
||||
}
|
||||
}
|
||||
else if (TiltXOffset > 0 && ((abs(TiltXOffset)) - (abs(TiltYOffset)) >= 2)) // Hit angle = 0x8000
|
||||
{
|
||||
if (((unsigned short)item->pos.yRot) > 0xc000 || ((unsigned short)item->pos.yRot) < 0x4000)
|
||||
{
|
||||
item->pos.yRot = (0x8000 - item->pos.yRot - 1);
|
||||
if (item->fallspeed > 0)
|
||||
item->fallspeed = -(item->fallspeed / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item->speed < 32)
|
||||
{
|
||||
item->speed += TiltXOffset * 2;
|
||||
|
||||
if ((unsigned short)item->pos.yRot > 0x8000)
|
||||
{
|
||||
item->pos.yRot -= 4096;
|
||||
if ((unsigned short)item->pos.yRot < 0x8000)
|
||||
item->pos.yRot = 0x8000;
|
||||
}
|
||||
else if ((unsigned short)item->pos.yRot < 0x8000)
|
||||
{
|
||||
item->pos.yRot += 4096;
|
||||
if ((unsigned short)item->pos.yRot > 0x8000)
|
||||
item->pos.yRot = 0x8000;
|
||||
}
|
||||
}
|
||||
|
||||
if (item->fallspeed > 0)
|
||||
item->fallspeed = -(item->fallspeed / 2);
|
||||
else
|
||||
item->fallspeed = 0;
|
||||
}
|
||||
}
|
||||
else if (TiltYOffset < 0 && TiltXOffset < 0) // Hit angle = 0x2000
|
||||
{
|
||||
if (((unsigned short)item->pos.yRot) > 0x6000 && ((unsigned short)item->pos.yRot) < 0xe000)
|
||||
{
|
||||
item->pos.yRot = 0x2000 + (0xa000 - (unsigned short)item->pos.yRot - 1);
|
||||
if (item->fallspeed > 0)
|
||||
item->fallspeed = -(item->fallspeed / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item->speed < 32)
|
||||
{
|
||||
item->speed += (-TiltYOffset) + (-TiltXOffset);
|
||||
if ((unsigned short)item->pos.yRot > 0x2000 && (unsigned short)item->pos.yRot < 0xa000)
|
||||
{
|
||||
item->pos.yRot -= 4096;
|
||||
if ((unsigned short)item->pos.yRot < 0x2000)
|
||||
item->pos.yRot = 0x2000;
|
||||
}
|
||||
else if ((unsigned short)item->pos.yRot != 0x2000)
|
||||
{
|
||||
item->pos.yRot += 4096;
|
||||
if ((unsigned short)item->pos.yRot > 0x2000)
|
||||
item->pos.yRot = 0x2000;
|
||||
}
|
||||
}
|
||||
|
||||
if (item->fallspeed > 0)
|
||||
item->fallspeed = -(item->fallspeed / 2);
|
||||
else
|
||||
item->fallspeed = 0;
|
||||
}
|
||||
}
|
||||
else if (TiltYOffset < 0 && TiltXOffset > 0) // Hit angle = 0x6000
|
||||
{
|
||||
if (((unsigned short)item->pos.yRot) > 0xa000 || ((unsigned short)item->pos.yRot) < 0x2000)
|
||||
{
|
||||
item->pos.yRot = 0x6000 + (0xe000 - (unsigned short)item->pos.yRot - 1);
|
||||
if (item->fallspeed > 0)
|
||||
item->fallspeed = -(item->fallspeed / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item->speed < 32)
|
||||
{
|
||||
item->speed += (-TiltYOffset) + TiltXOffset;
|
||||
if ((unsigned short)item->pos.yRot < 0xe000 && (unsigned short)item->pos.yRot > 0x6000)
|
||||
{
|
||||
item->pos.yRot -= 4096;
|
||||
if ((unsigned short)item->pos.yRot < 0x6000)
|
||||
item->pos.yRot = 0x6000;
|
||||
}
|
||||
else if ((unsigned short)item->pos.yRot != 0x6000)
|
||||
{
|
||||
item->pos.yRot += 4096;
|
||||
if ((unsigned short)item->pos.yRot > 0x6000)
|
||||
item->pos.yRot = 0x6000;
|
||||
}
|
||||
}
|
||||
|
||||
if (item->fallspeed > 0)
|
||||
item->fallspeed = -(item->fallspeed / 2);
|
||||
else
|
||||
item->fallspeed = 0;
|
||||
}
|
||||
}
|
||||
else if (TiltYOffset > 0 && TiltXOffset > 0) // Hit angle = 0xa000
|
||||
{
|
||||
if (((unsigned short)item->pos.yRot) > 0xe000 || ((unsigned short)item->pos.yRot) < 0x6000)
|
||||
{
|
||||
item->pos.yRot = 0xa000 + (0x2000 - (unsigned short)item->pos.yRot - 1);
|
||||
if (item->fallspeed > 0)
|
||||
item->fallspeed = -(item->fallspeed / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item->speed < 32)
|
||||
{
|
||||
item->speed += TiltYOffset + TiltXOffset;
|
||||
if ((unsigned short)item->pos.yRot < 0x2000 || (unsigned short)item->pos.yRot > 0xa000)
|
||||
{
|
||||
item->pos.yRot -= 4096;
|
||||
if ((unsigned short)item->pos.yRot < 0xa000)
|
||||
item->pos.yRot = 0xa000;
|
||||
}
|
||||
else if ((unsigned short)item->pos.yRot != 0xa000)
|
||||
{
|
||||
item->pos.yRot += 4096;
|
||||
if ((unsigned short)item->pos.yRot > 0xa000)
|
||||
item->pos.yRot = 0xa000;
|
||||
}
|
||||
}
|
||||
|
||||
if (item->fallspeed > 0)
|
||||
item->fallspeed = -(item->fallspeed / 2);
|
||||
else
|
||||
item->fallspeed = 0;
|
||||
}
|
||||
}
|
||||
else if (TiltYOffset > 0 && TiltXOffset < 0) // Hit angle = 0xe000
|
||||
{
|
||||
if (((unsigned short)item->pos.yRot) > 0x2000 && ((unsigned short)item->pos.yRot) < 0xa000)
|
||||
{
|
||||
item->pos.yRot = 0xe000 + (0x6000 - (unsigned short)item->pos.yRot - 1);
|
||||
if (item->fallspeed > 0)
|
||||
item->fallspeed = -(item->fallspeed / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item->speed < 32)
|
||||
{
|
||||
item->speed += TiltYOffset + (-TiltXOffset);
|
||||
if ((unsigned short)item->pos.yRot < 0x6000 || (unsigned short)item->pos.yRot > 0xe000)
|
||||
{
|
||||
item->pos.yRot -= 4096;
|
||||
if ((unsigned short)item->pos.yRot < 0xe000)
|
||||
item->pos.yRot = 0xe000;
|
||||
}
|
||||
else if ((unsigned short)item->pos.yRot != 0xe000)
|
||||
{
|
||||
item->pos.yRot += 4096;
|
||||
if ((unsigned short)item->pos.yRot > 0xe000)
|
||||
item->pos.yRot = 0xe000;
|
||||
}
|
||||
}
|
||||
|
||||
if (item->fallspeed > 0)
|
||||
item->fallspeed = -(item->fallspeed / 2);
|
||||
else
|
||||
item->fallspeed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Put item back in its last position */
|
||||
item->pos.xPos = x;
|
||||
item->pos.yPos = y;
|
||||
item->pos.zPos = z;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Hit the floor; bounce and slow down */
|
||||
if (item->fallspeed > 0)
|
||||
{
|
||||
if (item->fallspeed > 16)
|
||||
{
|
||||
if (item->objectNumber == ID_GRENADE)
|
||||
item->fallspeed = -(item->fallspeed - (item->fallspeed / 2));
|
||||
else
|
||||
{
|
||||
item->fallspeed = -(item->fallspeed / 2);
|
||||
if (item->fallspeed < -100)
|
||||
item->fallspeed = -100;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Roll on floor */
|
||||
item->fallspeed = 0;
|
||||
if (item->objectNumber == ID_GRENADE)
|
||||
{
|
||||
item->requiredAnimState = 1;
|
||||
item->pos.xRot = 0;
|
||||
item->speed--;
|
||||
}
|
||||
else
|
||||
item->speed -= 3;
|
||||
|
||||
if (item->speed < 0)
|
||||
item->speed = 0;
|
||||
}
|
||||
}
|
||||
item->pos.yPos = height;
|
||||
}
|
||||
}
|
||||
else // Check for on top of object.
|
||||
{
|
||||
if (yv >= 0)
|
||||
{
|
||||
roomNumber = item->roomNumber;
|
||||
floor = GetFloor(item->pos.xPos, y, item->pos.zPos, &roomNumber);
|
||||
oldheight = GetFloorHeight(floor, item->pos.xPos, y, item->pos.zPos);
|
||||
oldonobj = OnObject;
|
||||
roomNumber = item->roomNumber;
|
||||
floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber);
|
||||
GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos);
|
||||
|
||||
/* Bounce off floor */
|
||||
if (item->pos.yPos >= oldheight && oldonobj) // If old and new pos above object then detect.
|
||||
{
|
||||
/* Hit the floor; bounce and slow down */
|
||||
if (item->fallspeed > 0)
|
||||
{
|
||||
if (item->fallspeed > 16)
|
||||
{
|
||||
if (item->objectNumber == ID_GRENADE)
|
||||
item->fallspeed = -(item->fallspeed - (item->fallspeed / 2));
|
||||
else
|
||||
{
|
||||
item->fallspeed = -(item->fallspeed / 4);
|
||||
if (item->fallspeed < -100)
|
||||
item->fallspeed = -100;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Roll on floor */
|
||||
item->fallspeed = 0;
|
||||
if (item->objectNumber == ID_GRENADE)
|
||||
{
|
||||
item->requiredAnimState = 1;
|
||||
item->pos.xRot = 0;
|
||||
item->speed--;
|
||||
}
|
||||
else
|
||||
item->speed -= 3;
|
||||
|
||||
if (item->speed < 0)
|
||||
item->speed = 0;
|
||||
}
|
||||
}
|
||||
item->pos.yPos = oldheight;
|
||||
}
|
||||
}
|
||||
// else
|
||||
{
|
||||
/* Bounce off ceiling */
|
||||
roomNumber = item->roomNumber;
|
||||
floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber);
|
||||
ceiling = GetCeiling(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos);
|
||||
if (item->pos.yPos < ceiling)
|
||||
{
|
||||
if (y < ceiling &&
|
||||
(((x / SECTOR(1)) != (item->pos.xPos / SECTOR(1))) ||
|
||||
((z / SECTOR(1)) != (item->pos.zPos / SECTOR(1)))))
|
||||
{
|
||||
// Need to know which direction the wall is.
|
||||
|
||||
if ((x & (~(WALL_SIZE - 1))) != (item->pos.xPos & (~(WALL_SIZE - 1)))) // X crossed boundary?
|
||||
{
|
||||
if (xv <= 0) // Hit angle = 0xc000.
|
||||
item->pos.yRot = 0x4000 + (0xc000 - item->pos.yRot);
|
||||
else // Hit angle = 0x4000.
|
||||
item->pos.yRot = 0xc000 + (0x4000 - item->pos.yRot);
|
||||
}
|
||||
else // Z crossed boundary.
|
||||
{
|
||||
item->pos.yRot = 0x8000 - item->pos.yRot;
|
||||
}
|
||||
|
||||
if (item->objectNumber == ID_GRENADE)
|
||||
item->speed -= item->speed / 8;
|
||||
else
|
||||
item->speed /= 2;
|
||||
|
||||
/* Put item back in its last position */
|
||||
item->pos.xPos = x;
|
||||
item->pos.yPos = y;
|
||||
item->pos.zPos = z;
|
||||
}
|
||||
else
|
||||
item->pos.yPos = ceiling;
|
||||
|
||||
if (item->fallspeed < 0)
|
||||
item->fallspeed = -item->fallspeed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
roomNumber = item->roomNumber;
|
||||
floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber);
|
||||
if (roomNumber != item->roomNumber)
|
||||
ItemNewRoom(itemNumber, roomNumber);
|
||||
}
|
||||
|
||||
HOLSTER_SLOT HolsterSlotForWeapon(LARA_WEAPON_TYPE weapon)
|
||||
{
|
||||
switch(weapon){
|
||||
|
|
|
@ -49,5 +49,4 @@ void find_target_point(ITEM_INFO* item, GAME_VECTOR* target);
|
|||
void LaraTargetInfo(WEAPON_INFO* weapon);
|
||||
bool CheckForHoldingState(int state);
|
||||
void LaraGetNewTarget(WEAPON_INFO* weapon);
|
||||
void DoProperDetection(short itemNumber, int x, int y, int z, int xv, int yv, int zv);
|
||||
HOLSTER_SLOT HolsterSlotForWeapon(LARA_WEAPON_TYPE weapon);
|
|
@ -61,7 +61,7 @@ void FlareControl(short itemNumber)
|
|||
|
||||
item->pos.yPos += item->fallspeed;
|
||||
|
||||
DoProperDetection(itemNumber, oldX, oldY, oldZ, xv, item->fallspeed, zv);
|
||||
DoProjectileDynamics(itemNumber, oldX, oldY, oldZ, xv, item->fallspeed, zv);
|
||||
|
||||
short age = (short)(item->data) & 0x7FFF;
|
||||
if (age >= FLARE_AGE)
|
||||
|
|
|
@ -92,14 +92,14 @@ void lara_col_hang(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
if (TrInput & IN_FORWARD)
|
||||
{
|
||||
if (coll->frontFloor > -850)
|
||||
if (coll->front.Floor > -850)
|
||||
{
|
||||
if (coll->frontFloor < -650 &&
|
||||
coll->frontFloor >= coll->frontCeiling &&
|
||||
coll->frontFloor >= coll->leftCeiling2 &&
|
||||
coll->frontFloor >= coll->rightCeiling2)
|
||||
if (coll->front.Floor < -650 &&
|
||||
coll->front.Floor >= coll->front.Ceiling &&
|
||||
coll->front.Floor >= coll->frontLeft.Ceiling &&
|
||||
coll->front.Floor >= coll->frontRight.Ceiling)
|
||||
{
|
||||
if (abs(coll->leftFloor2 - coll->rightFloor2) < 60 && !coll->hitStatic)
|
||||
if (abs(coll->frontLeft.Floor - coll->frontRight.Floor) < 60 && !coll->hitStatic)
|
||||
{
|
||||
if (TrInput & IN_WALK)
|
||||
{
|
||||
|
@ -119,12 +119,12 @@ void lara_col_hang(ITEM_INFO* item, COLL_INFO* coll)
|
|||
}
|
||||
}
|
||||
|
||||
if (coll->frontFloor < -650 &&
|
||||
coll->frontFloor - coll->frontCeiling >= -256 &&
|
||||
coll->frontFloor - coll->leftCeiling2 >= -256 &&
|
||||
coll->frontFloor - coll->rightCeiling2 >= -256)
|
||||
if (coll->front.Floor < -650 &&
|
||||
coll->front.Floor - coll->front.Ceiling >= -256 &&
|
||||
coll->front.Floor - coll->frontLeft.Ceiling >= -256 &&
|
||||
coll->front.Floor - coll->frontRight.Ceiling >= -256)
|
||||
{
|
||||
if (abs(coll->leftFloor2 - coll->rightFloor2) < 60 && !coll->hitStatic)
|
||||
if (abs(coll->frontLeft.Floor - coll->frontRight.Floor) < 60 && !coll->hitStatic)
|
||||
{
|
||||
item->goalAnimState = LS_HANG_TO_CRAWL;
|
||||
item->requiredAnimState = LS_CROUCH_IDLE;
|
||||
|
@ -135,8 +135,8 @@ void lara_col_hang(ITEM_INFO* item, COLL_INFO* coll)
|
|||
}
|
||||
|
||||
if (Lara.climbStatus != 0 &&
|
||||
coll->midCeiling <= -256 &&
|
||||
abs(coll->leftCeiling2 - coll->rightCeiling2) < 60)
|
||||
coll->middle.Ceiling <= -256 &&
|
||||
abs(coll->frontLeft.Ceiling - coll->frontRight.Ceiling) < 60)
|
||||
{
|
||||
if (LaraTestClimbStance(item, coll))
|
||||
{
|
||||
|
@ -156,7 +156,7 @@ void lara_col_hang(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
if (TrInput & IN_BACK &&
|
||||
Lara.climbStatus &&
|
||||
coll->midFloor > 344 &&
|
||||
coll->middle.Floor > 344 &&
|
||||
item->animNumber == LA_REACH_TO_HANG)
|
||||
{
|
||||
if (LaraTestClimbStance(item, coll))
|
||||
|
@ -356,14 +356,14 @@ void lara_col_hang_feet(ITEM_INFO* item, COLL_INFO* coll)
|
|||
TestForObjectOnLedge(item, coll);
|
||||
if (TrInput & IN_FORWARD)
|
||||
{
|
||||
if (coll->frontFloor > -850)
|
||||
if (coll->front.Floor > -850)
|
||||
{
|
||||
if (coll->frontFloor < -650 &&
|
||||
coll->frontFloor >= coll->frontCeiling &&
|
||||
coll->frontFloor >= coll->leftCeiling2 &&
|
||||
coll->frontFloor >= coll->rightCeiling2)
|
||||
if (coll->front.Floor < -650 &&
|
||||
coll->front.Floor >= coll->front.Ceiling &&
|
||||
coll->front.Floor >= coll->frontLeft.Ceiling &&
|
||||
coll->front.Floor >= coll->frontRight.Ceiling)
|
||||
{
|
||||
if (abs(coll->leftFloor2 - coll->rightFloor2) < 60 && !coll->hitStatic)
|
||||
if (abs(coll->frontLeft.Floor - coll->frontRight.Floor) < 60 && !coll->hitStatic)
|
||||
{
|
||||
if (TrInput & IN_WALK)
|
||||
{
|
||||
|
@ -382,12 +382,12 @@ void lara_col_hang_feet(ITEM_INFO* item, COLL_INFO* coll)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (coll->frontFloor < -650 &&
|
||||
coll->frontFloor - coll->frontCeiling >= -256 &&
|
||||
coll->frontFloor - coll->leftCeiling2 >= -256 &&
|
||||
coll->frontFloor - coll->rightCeiling2 >= -256)
|
||||
if (coll->front.Floor < -650 &&
|
||||
coll->front.Floor - coll->front.Ceiling >= -256 &&
|
||||
coll->front.Floor - coll->frontLeft.Ceiling >= -256 &&
|
||||
coll->front.Floor - coll->frontRight.Ceiling >= -256)
|
||||
{
|
||||
if (abs(coll->leftFloor2 - coll->rightFloor2) < 60 && !coll->hitStatic)
|
||||
if (abs(coll->frontLeft.Floor - coll->frontRight.Floor) < 60 && !coll->hitStatic)
|
||||
{
|
||||
item->goalAnimState = LS_HANG_TO_CRAWL;
|
||||
item->requiredAnimState = LS_CROUCH_IDLE;
|
||||
|
@ -397,8 +397,8 @@ void lara_col_hang_feet(ITEM_INFO* item, COLL_INFO* coll)
|
|||
}
|
||||
|
||||
if (Lara.climbStatus != 0 &&
|
||||
coll->midCeiling <= -256 &&
|
||||
abs(coll->leftCeiling2 - coll->rightCeiling2) < 60)
|
||||
coll->middle.Ceiling <= -256 &&
|
||||
abs(coll->frontLeft.Ceiling - coll->frontRight.Ceiling) < 60)
|
||||
{
|
||||
if (LaraTestClimbStance(item, coll))
|
||||
{
|
||||
|
|
|
@ -34,7 +34,6 @@ void InitialiseLara(int restore)
|
|||
Lara.air = 1800;
|
||||
Lara.weaponItem = NO_ITEM;
|
||||
PoisonFlag = 0;
|
||||
Lara.dpoisoned = 0;
|
||||
Lara.poisoned = 0;
|
||||
Lara.waterSurfaceDist = 100;
|
||||
if (Lara.Weapons[static_cast<int>(LARA_WEAPON_TYPE::WEAPON_PISTOLS)].Present) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "framework.h"
|
||||
#include "lara.h"
|
||||
#include "input.h"
|
||||
#include "control.h"
|
||||
#include "lara_collide.h"
|
||||
#include "lara_tests.h"
|
||||
#include "lara_monkey.h"
|
||||
|
@ -52,7 +53,7 @@ void lara_col_hang2(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->badNeg = NO_HEIGHT;
|
||||
coll->badCeiling = 0;
|
||||
|
||||
coll->slopesAreWalls = 0;
|
||||
coll->slopesAreWalls = false;
|
||||
coll->facing = Lara.moveAngle;
|
||||
coll->radius = 100;
|
||||
|
||||
|
@ -64,7 +65,7 @@ void lara_col_hang2(ITEM_INFO* item, COLL_INFO* coll)
|
|||
Lara.NewAnims.Monkey180Roll = 1;
|
||||
|
||||
|
||||
if (TrInput & IN_FORWARD && coll->collType != CT_FRONT && abs(coll->midCeiling - coll->frontCeiling) < 50)
|
||||
if (TrInput & IN_FORWARD && coll->collType != CT_FRONT && abs(coll->middle.Ceiling - coll->front.Ceiling) < 50)
|
||||
{
|
||||
item->goalAnimState = LS_MONKEYSWING_FORWARD;
|
||||
}
|
||||
|
@ -89,7 +90,7 @@ void lara_col_hang2(ITEM_INFO* item, COLL_INFO* coll)
|
|||
item->goalAnimState = LS_MONKEYSWING_TURN_180;
|
||||
}
|
||||
|
||||
if (abs(coll->midCeiling - coll->frontCeiling) < 50)
|
||||
if (abs(coll->middle.Ceiling - coll->front.Ceiling) < 50)
|
||||
MonkeySwingSnap(item, coll);
|
||||
}
|
||||
else
|
||||
|
@ -101,19 +102,19 @@ void lara_col_hang2(ITEM_INFO* item, COLL_INFO* coll)
|
|||
TestForObjectOnLedge(item, coll);
|
||||
|
||||
if (!(TrInput & IN_FORWARD) ||
|
||||
coll->frontFloor <= -850 ||
|
||||
coll->frontFloor >= -650 ||
|
||||
coll->frontFloor < coll->frontCeiling ||
|
||||
coll->leftFloor2 < coll->leftCeiling2 ||
|
||||
coll->rightFloor2 < coll->rightCeiling2 ||
|
||||
coll->front.Floor <= -850 ||
|
||||
coll->front.Floor >= -650 ||
|
||||
coll->front.Floor < coll->front.Ceiling ||
|
||||
coll->frontLeft.Floor < coll->frontLeft.Ceiling ||
|
||||
coll->frontRight.Floor < coll->frontRight.Ceiling ||
|
||||
coll->hitStatic)
|
||||
{
|
||||
if (!(TrInput & IN_FORWARD) ||
|
||||
coll->frontFloor <= -850 ||
|
||||
coll->frontFloor >= -650 ||
|
||||
coll->frontFloor - coll->frontCeiling < -256 ||
|
||||
coll->leftFloor2 - coll->leftCeiling2 < -256 ||
|
||||
coll->rightFloor2 - coll->rightCeiling2 < -256 ||
|
||||
coll->front.Floor <= -850 ||
|
||||
coll->front.Floor >= -650 ||
|
||||
coll->front.Floor - coll->front.Ceiling < -256 ||
|
||||
coll->frontLeft.Floor - coll->frontLeft.Ceiling < -256 ||
|
||||
coll->frontRight.Floor - coll->frontRight.Ceiling < -256 ||
|
||||
coll->hitStatic)
|
||||
{
|
||||
if (TrInput & IN_LEFT || TrInput & IN_LSTEP)
|
||||
|
@ -209,7 +210,7 @@ void lara_col_monkeyswing(ITEM_INFO* item, COLL_INFO* coll)
|
|||
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, 600);
|
||||
|
||||
if (coll->collType == CT_FRONT
|
||||
|| abs(coll->midCeiling - coll->frontCeiling) > 50)
|
||||
|| abs(coll->middle.Ceiling - coll->front.Ceiling) > 50)
|
||||
{
|
||||
item->animNumber = LA_MONKEYSWING_IDLE;
|
||||
item->frameNumber = g_Level.Anims[item->animNumber].frameBase;
|
||||
|
@ -218,9 +219,9 @@ void lara_col_monkeyswing(ITEM_INFO* item, COLL_INFO* coll)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (abs(coll->midCeiling - coll->leftCeiling2) <= 50)
|
||||
if (abs(coll->middle.Ceiling - coll->frontLeft.Ceiling) <= 50)
|
||||
{
|
||||
if (abs(coll->midCeiling - coll->rightCeiling2) > 50)
|
||||
if (abs(coll->middle.Ceiling - coll->frontRight.Ceiling) > 50)
|
||||
{
|
||||
ShiftItem(item, coll);
|
||||
item->pos.yRot -= ANGLE(5.0f);
|
||||
|
@ -436,13 +437,13 @@ short TestMonkeyRight(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->badNeg = -STEPUP_HEIGHT;
|
||||
coll->badCeiling = 0;
|
||||
Lara.moveAngle = item->pos.yRot + ANGLE(90);
|
||||
coll->slopesAreWalls = 0;
|
||||
coll->slopesAreWalls = false;
|
||||
coll->facing = Lara.moveAngle;
|
||||
coll->radius = 100;
|
||||
|
||||
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, 600);
|
||||
|
||||
if (abs(coll->midCeiling - coll->frontCeiling) > 50)
|
||||
if (abs(coll->middle.Ceiling - coll->front.Ceiling) > 50)
|
||||
return 0;
|
||||
|
||||
if (!coll->collType)
|
||||
|
@ -472,13 +473,13 @@ short TestMonkeyLeft(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->badNeg = NO_HEIGHT;
|
||||
coll->badCeiling = 0;
|
||||
Lara.moveAngle = item->pos.yRot - ANGLE(90);
|
||||
coll->slopesAreWalls = 0;
|
||||
coll->slopesAreWalls = false;
|
||||
coll->facing = Lara.moveAngle;
|
||||
coll->radius = 100;
|
||||
|
||||
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, 600);
|
||||
|
||||
if (abs(coll->midCeiling - coll->frontCeiling) > 50)
|
||||
if (abs(coll->middle.Ceiling - coll->front.Ceiling) > 50)
|
||||
return 0;
|
||||
|
||||
if (!coll->collType)
|
||||
|
|
|
@ -641,7 +641,7 @@ void lara_col_polestat(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->radius = 100;
|
||||
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)
|
||||
{
|
||||
|
@ -669,7 +669,7 @@ void lara_col_polestat(ITEM_INFO* item, COLL_INFO* coll)
|
|||
item->goalAnimState = LS_POLE_UP;
|
||||
}
|
||||
}
|
||||
else if (TrInput & IN_BACK && coll->midFloor > 0)
|
||||
else if (TrInput & IN_BACK && coll->middle.Floor > 0)
|
||||
{
|
||||
item->goalAnimState = LS_POLE_DOWN;
|
||||
item->itemFlags[2] = 0;
|
||||
|
@ -678,7 +678,7 @@ void lara_col_polestat(ITEM_INFO* item, COLL_INFO* coll)
|
|||
if (TrInput & IN_JUMP)
|
||||
item->goalAnimState = LS_JUMP_BACK;
|
||||
}
|
||||
else if (coll->midFloor <= 0)
|
||||
else if (coll->middle.Floor <= 0)
|
||||
{
|
||||
item->goalAnimState = LS_STOP;
|
||||
}
|
||||
|
@ -736,13 +736,13 @@ void lara_col_poledown(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->facing = Lara.moveAngle;
|
||||
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->midFloor < 0)
|
||||
if (coll->middle.Floor < 0)
|
||||
{
|
||||
short roomNumber = item->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->itemFlags[2] = 0;
|
||||
|
@ -811,11 +811,6 @@ void lara_as_deathslide(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
Camera.targetAngle = ANGLE(70.0f);
|
||||
|
||||
GetFloorHeight(GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber),
|
||||
item->pos.xPos, item->pos.yPos, item->pos.zPos);
|
||||
|
||||
coll->trigger = TriggerIndex;
|
||||
|
||||
if (!(TrInput & IN_ACTION))
|
||||
{
|
||||
item->goalAnimState = LS_JUMP_FORWARD;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "draw.h"
|
||||
#include "box.h"
|
||||
#include "control.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "effect2.h"
|
||||
#include "tomb4fx.h"
|
||||
#include "lot.h"
|
||||
|
@ -550,7 +550,7 @@ void ControlGrenade(short itemNumber)
|
|||
short sYrot = item->pos.yRot;
|
||||
item->pos.yRot = item->goalAnimState;
|
||||
|
||||
DoProperDetection(itemNumber, oldX, oldY, oldZ, xv, yv, zv);
|
||||
DoProjectileDynamics(itemNumber, oldX, oldY, oldZ, xv, yv, zv);
|
||||
|
||||
item->goalAnimState = item->pos.yRot;
|
||||
item->pos.yRot = sYrot;
|
||||
|
@ -634,28 +634,21 @@ void ControlGrenade(short itemNumber)
|
|||
|
||||
ITEM_INFO* currentItem = CollidedItems[i];
|
||||
|
||||
if (currentItem->objectNumber < ID_SMASH_OBJECT1
|
||||
|| currentItem->objectNumber > ID_SMASH_OBJECT16)
|
||||
if (currentItem->objectNumber < ID_SMASH_OBJECT1 || currentItem->objectNumber > ID_SMASH_OBJECT16)
|
||||
{
|
||||
if (currentItem->objectNumber < ID_SHOOT_SWITCH1 ||
|
||||
currentItem->objectNumber > ID_SHOOT_SWITCH4 ||
|
||||
(currentItem->flags & 0x40))
|
||||
if (currentItem->objectNumber < ID_SHOOT_SWITCH1 || currentItem->objectNumber > ID_SHOOT_SWITCH4 || (currentItem->flags & 0x40))
|
||||
{
|
||||
if (Objects[currentItem->objectNumber].intelligent
|
||||
|| currentItem->objectNumber != ID_LARA)
|
||||
if (Objects[currentItem->objectNumber].intelligent || currentItem->objectNumber == ID_LARA)
|
||||
{
|
||||
DoExplosiveDamageOnBaddie(currentItem, item, WEAPON_GRENADE_LAUNCHER);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((currentItem->flags & 0x3E00) &&
|
||||
(currentItem->flags & 0x3E00) != 0x3E00)
|
||||
if ((currentItem->flags & IFLAG_ACTIVATION_MASK) &&
|
||||
(currentItem->flags & IFLAG_ACTIVATION_MASK) != IFLAG_ACTIVATION_MASK)
|
||||
{
|
||||
roomNumber = currentItem->roomNumber;
|
||||
FLOOR_INFO* floor = GetFloor(currentItem->pos.xPos, currentItem->pos.yPos - 256, currentItem->pos.zPos, &roomNumber);
|
||||
GetFloorHeight(floor, currentItem->pos.xPos, currentItem->pos.yPos - 256, currentItem->pos.zPos);
|
||||
TestTriggers(TriggerIndex, 1, currentItem->flags & 0x3E00);
|
||||
TestTriggers(currentItem->pos.xPos, currentItem->pos.yPos - 256, currentItem->pos.zPos, roomNumber, true, IFLAG_ACTIVATION_MASK);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1760,7 +1753,7 @@ void DoExplosiveDamageOnBaddie(ITEM_INFO* dest, ITEM_INFO* src, int weapon)
|
|||
}
|
||||
else
|
||||
{
|
||||
LaraItem->hitPoints -= Weapons[weapon].damage;
|
||||
LaraItem->hitPoints -= (Weapons[weapon].damage * 5);
|
||||
if (!(g_Level.Rooms[dest->roomNumber].flags & ENV_FLAG_WATER) && LaraItem->hitPoints <= Weapons[weapon].damage)
|
||||
LaraBurn();
|
||||
}
|
||||
|
|
|
@ -65,17 +65,17 @@ void lara_slide_slope(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->badCeiling = 0;
|
||||
|
||||
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))
|
||||
{
|
||||
LaraDeflectEdge(item, coll);
|
||||
|
||||
if (coll->midFloor <= 200)
|
||||
if (coll->middle.Floor <= 200)
|
||||
{
|
||||
TestLaraSlide(item, coll);
|
||||
|
||||
item->pos.yPos += coll->midFloor;
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
|
||||
if (abs(coll->tiltX) <= 2 && abs(coll->tiltZ) <= 2)
|
||||
{
|
||||
|
@ -141,7 +141,7 @@ void LaraSlideEdgeJump(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
item->speed = 0;
|
||||
|
||||
coll->midFloor = 0;
|
||||
coll->middle.Floor = 0;
|
||||
|
||||
if (item->fallspeed <= 0)
|
||||
item->fallspeed = 16;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
#include "box.h"
|
||||
#include "collide.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "objectslist.h"
|
||||
#include "trmath.h"
|
||||
#include "Renderer11.h"
|
||||
|
@ -1008,7 +1008,6 @@ struct LaraInfo
|
|||
HolsterInfo holsterInfo;
|
||||
short flareFrame;
|
||||
short poisoned;
|
||||
short dpoisoned;
|
||||
byte wet[NUM_LARA_MESHES];
|
||||
bool flareControlLeft;
|
||||
bool look;
|
||||
|
@ -1017,7 +1016,6 @@ struct LaraInfo
|
|||
bool isMoving;
|
||||
bool canMonkeySwing;
|
||||
byte burnBlue;
|
||||
bool gassed;
|
||||
bool burnSmoke;
|
||||
bool isDucked;
|
||||
bool hasFired;
|
||||
|
@ -1025,7 +1023,6 @@ struct LaraInfo
|
|||
bool litTorch;
|
||||
bool isClimbing;
|
||||
bool fired;
|
||||
bool ClockworkBeetleFlag;
|
||||
int waterSurfaceDist;
|
||||
PHD_VECTOR lastPos;
|
||||
FX_INFO* spazEffect;
|
||||
|
|
|
@ -237,7 +237,7 @@ void LaraSurfaceCollision(ITEM_INFO* item, COLL_INFO* coll)
|
|||
ShiftItem(item, coll);
|
||||
|
||||
if (coll->collType & (CT_FRONT | CT_TOP | CT_TOP_FRONT | CT_CLAMP) ||
|
||||
coll->midFloor < 0 && (coll->midType == BIG_SLOPE || coll->midType == DIAGONAL))
|
||||
coll->middle.Floor < 0 && (coll->middle.Type == BIG_SLOPE || coll->middle.Type == DIAGONAL))
|
||||
{
|
||||
item->fallspeed = 0;
|
||||
item->pos.xPos = coll->old.x;
|
||||
|
@ -282,14 +282,14 @@ int LaraTestWaterClimbOut(ITEM_INFO* item, COLL_INFO* coll)
|
|||
if (Lara.gunStatus && (Lara.gunStatus != LG_READY || Lara.gunType != WEAPON_FLARE))
|
||||
return 0;
|
||||
|
||||
if (coll->frontCeiling > 0)
|
||||
if (coll->front.Ceiling > 0)
|
||||
return 0;
|
||||
|
||||
if (coll->midCeiling > -384)
|
||||
if (coll->middle.Ceiling > -384)
|
||||
return 0;
|
||||
|
||||
int frontFloor = coll->frontFloor + 700;
|
||||
int frontCeiling = coll->frontCeiling + 700;
|
||||
int frontFloor = coll->front.Floor + 700;
|
||||
int frontCeiling = coll->front.Ceiling + 700;
|
||||
if (frontFloor <= -512 || frontFloor > 316)
|
||||
return 0;
|
||||
|
||||
|
@ -297,13 +297,13 @@ int LaraTestWaterClimbOut(ITEM_INFO* item, COLL_INFO* coll)
|
|||
int slope = 0;
|
||||
bool result;
|
||||
|
||||
/*if (coll->midSplitFloor)
|
||||
/*if (coll->middle.SplitFloor)
|
||||
{
|
||||
result = SnapToDiagonal(rot, 35);
|
||||
}
|
||||
else*/
|
||||
{
|
||||
if (abs(coll->rightFloor2 - coll->leftFloor2) >= 60)
|
||||
if (abs(coll->frontRight.Floor - coll->frontLeft.Floor) >= 60)
|
||||
return 0;
|
||||
|
||||
result = SnapToQuadrant(rot, 35);
|
||||
|
@ -314,11 +314,11 @@ int LaraTestWaterClimbOut(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
item->pos.yPos += frontFloor - 5;
|
||||
|
||||
UpdateLaraRoom(item, -LARA_HITE / 2);
|
||||
UpdateLaraRoom(item, -LARA_HEIGHT / 2);
|
||||
|
||||
/*if (coll->midSplitFloor)
|
||||
/*if (coll->middle.SplitFloor)
|
||||
{
|
||||
Vector2 v = GetDiagonalIntersect(item->pos.xPos, item->pos.zPos, coll->midSplitFloor, -LARA_RAD, item->pos.yRot);
|
||||
Vector2 v = GetDiagonalIntersect(item->pos.xPos, item->pos.zPos, coll->middle.SplitFloor, -LARA_RAD, item->pos.yRot);
|
||||
item->pos.xPos = v.x;
|
||||
item->pos.zPos = v.y;
|
||||
}
|
||||
|
@ -391,14 +391,14 @@ int LaraTestWaterClimbOut(ITEM_INFO* item, COLL_INFO* coll)
|
|||
int LaraTestWaterStepOut(ITEM_INFO* item, COLL_INFO* coll)
|
||||
{
|
||||
if (coll->collType == CT_FRONT
|
||||
|| coll->midType == BIG_SLOPE
|
||||
|| coll->midType == DIAGONAL
|
||||
|| coll->midFloor >= 0)
|
||||
|| coll->middle.Type == BIG_SLOPE
|
||||
|| coll->middle.Type == DIAGONAL
|
||||
|| coll->middle.Floor >= 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (coll->midFloor >= -128)
|
||||
if (coll->middle.Floor >= -128)
|
||||
{
|
||||
if (item->goalAnimState == LS_ONWATER_LEFT)
|
||||
{
|
||||
|
@ -424,7 +424,7 @@ int LaraTestWaterStepOut(ITEM_INFO* item, COLL_INFO* coll)
|
|||
item->goalAnimState = LS_STOP;
|
||||
}
|
||||
|
||||
item->pos.yPos += coll->frontFloor + 695;
|
||||
item->pos.yPos += coll->front.Floor + 695;
|
||||
|
||||
UpdateLaraRoom(item, -381);
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "box.h"
|
||||
#include "Lara.h"
|
||||
#include "lara_surface.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "lara_fire.h"
|
||||
#include "draw.h"
|
||||
#include "camera.h"
|
||||
|
@ -98,8 +98,8 @@ void LaraWaterCurrent(COLL_INFO* coll)
|
|||
LaraItem->pos.yRot -= ANGLE(5);
|
||||
}
|
||||
|
||||
if (coll->midFloor < 0 && coll->midFloor != NO_HEIGHT)
|
||||
LaraItem->pos.yPos += coll->midFloor;
|
||||
if (coll->middle.Floor < 0 && coll->middle.Floor != NO_HEIGHT)
|
||||
LaraItem->pos.yPos += coll->middle.Floor;
|
||||
|
||||
ShiftItem(LaraItem, coll);
|
||||
|
||||
|
@ -522,7 +522,7 @@ void LaraSwimCollision(ITEM_INFO* item, COLL_INFO* coll)
|
|||
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);
|
||||
|
||||
if (height < ((LaraDrawType == LARA_TYPE::DIVESUIT) * 64) + 200)
|
||||
|
@ -630,11 +630,11 @@ void LaraSwimCollision(ITEM_INFO* item, COLL_INFO* coll)
|
|||
break;
|
||||
}
|
||||
|
||||
if (coll->midFloor < 0 && coll->midFloor != NO_HEIGHT)
|
||||
if (coll->middle.Floor < 0 && coll->middle.Floor != NO_HEIGHT)
|
||||
{
|
||||
flag = 1;
|
||||
item->pos.xRot += ANGLE(1);
|
||||
item->pos.yPos += coll->midFloor;
|
||||
item->pos.yPos += coll->middle.Floor;
|
||||
}
|
||||
|
||||
if (oldX == item->pos.xPos
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "lara_tests.h"
|
||||
#include "input.h"
|
||||
#include "draw.h"
|
||||
#include "control.h"
|
||||
#include "lara_climb.h"
|
||||
#include "lara_collide.h"
|
||||
|
||||
|
@ -36,9 +37,9 @@ int TestLaraVault(ITEM_INFO* item, COLL_INFO* coll)
|
|||
short angle = item->pos.yRot;
|
||||
bool result;
|
||||
|
||||
/*if (coll->midSplitFloor)
|
||||
/*if (coll->middle.SplitFloor)
|
||||
{
|
||||
if (coll->frontSplitFloor != coll->midSplitFloor)
|
||||
if (coll->front.SplitFloor != coll->middle.SplitFloor)
|
||||
return 0;
|
||||
result = SnapToDiagonal(angle, 30);
|
||||
}
|
||||
|
@ -50,26 +51,26 @@ int TestLaraVault(ITEM_INFO* item, COLL_INFO* coll)
|
|||
if (!result)
|
||||
return 0;
|
||||
|
||||
int slope = abs(coll->leftFloor2 - coll->rightFloor2) >= 60;
|
||||
int slope = abs(coll->frontLeft.Floor - coll->frontRight.Floor) >= 60;
|
||||
|
||||
if (coll->frontFloor < 0 && coll->frontFloor >= -256)
|
||||
if (coll->front.Floor < 0 && coll->front.Floor >= -256)
|
||||
{
|
||||
if (!slope && (abs(coll->frontCeiling - coll->frontFloor) < 256) && Lara.NewAnims.CrawlVault1click)
|
||||
if (!slope && (abs(coll->front.Ceiling - coll->front.Floor) < 256) && Lara.NewAnims.CrawlVault1click)
|
||||
{
|
||||
item->animNumber = LA_VAULT_TO_CROUCH_1CLICK;
|
||||
item->currentAnimState = LS_GRABBING;
|
||||
item->frameNumber = g_Level.Anims[item->animNumber].frameBase;
|
||||
item->goalAnimState = LS_CROUCH_IDLE;
|
||||
item->pos.yPos += coll->frontFloor + 256;
|
||||
item->pos.yPos += coll->front.Floor + 256;
|
||||
Lara.gunStatus = LG_HANDS_BUSY;
|
||||
}
|
||||
}
|
||||
else if (coll->frontFloor >= -640 && coll->frontFloor <= -384)
|
||||
else if (coll->front.Floor >= -640 && coll->front.Floor <= -384)
|
||||
{
|
||||
if (!slope &&
|
||||
coll->frontFloor - coll->frontCeiling >= 0 &&
|
||||
coll->leftFloor2 - coll->leftCeiling2 >= 0 &&
|
||||
coll->rightFloor2 - coll->rightCeiling2 >= 0)
|
||||
coll->front.Floor - coll->front.Ceiling >= 0 &&
|
||||
coll->frontLeft.Floor - coll->frontLeft.Ceiling >= 0 &&
|
||||
coll->frontRight.Floor - coll->frontRight.Ceiling >= 0)
|
||||
{
|
||||
#if 0
|
||||
if (g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP && Lara.waterSurfaceDist < -768)
|
||||
|
@ -80,16 +81,16 @@ int TestLaraVault(ITEM_INFO* item, COLL_INFO* coll)
|
|||
item->currentAnimState = LS_GRABBING;
|
||||
item->frameNumber = g_Level.Anims[item->animNumber].frameBase;
|
||||
item->goalAnimState = LS_STOP;
|
||||
item->pos.yPos += coll->frontFloor + 512;
|
||||
item->pos.yPos += coll->front.Floor + 512;
|
||||
Lara.gunStatus = LG_HANDS_BUSY;
|
||||
}
|
||||
else if ((!slope && (abs(coll->frontCeiling - coll->frontFloor) < 256)) && Lara.NewAnims.CrawlVault2click)
|
||||
else if ((!slope && (abs(coll->front.Ceiling - coll->front.Floor) < 256)) && Lara.NewAnims.CrawlVault2click)
|
||||
{
|
||||
item->animNumber = LA_VAULT_TO_CROUCH_2CLICK;
|
||||
item->frameNumber = g_Level.Anims[item->animNumber].frameBase;
|
||||
item->currentAnimState = LS_GRABBING;
|
||||
item->goalAnimState = LS_CROUCH_IDLE;
|
||||
item->pos.yPos += coll->frontFloor + 512;
|
||||
item->pos.yPos += coll->front.Floor + 512;
|
||||
Lara.gunStatus = LG_HANDS_BUSY;
|
||||
}
|
||||
else
|
||||
|
@ -97,12 +98,12 @@ int TestLaraVault(ITEM_INFO* item, COLL_INFO* coll)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
else if (coll->frontFloor >= -896 && coll->frontFloor <= -640)
|
||||
else if (coll->front.Floor >= -896 && coll->front.Floor <= -640)
|
||||
{
|
||||
if (!slope &&
|
||||
coll->frontFloor - coll->frontCeiling >= 0 &&
|
||||
coll->leftFloor2 - coll->leftCeiling2 >= 0 &&
|
||||
coll->rightFloor2 - coll->rightCeiling2 >= 0)
|
||||
coll->front.Floor - coll->front.Ceiling >= 0 &&
|
||||
coll->frontLeft.Floor - coll->frontLeft.Ceiling >= 0 &&
|
||||
coll->frontRight.Floor - coll->frontRight.Ceiling >= 0)
|
||||
{
|
||||
#if 0
|
||||
if (g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP && Lara.waterSurfaceDist < -768)
|
||||
|
@ -113,16 +114,16 @@ int TestLaraVault(ITEM_INFO* item, COLL_INFO* coll)
|
|||
item->currentAnimState = LS_GRABBING;
|
||||
item->frameNumber = g_Level.Anims[item->animNumber].frameBase;
|
||||
item->goalAnimState = LS_STOP;
|
||||
item->pos.yPos += coll->frontFloor + 768;
|
||||
item->pos.yPos += coll->front.Floor + 768;
|
||||
Lara.gunStatus = LG_HANDS_BUSY;
|
||||
}
|
||||
else if ((!slope && (abs(coll->frontCeiling - coll->frontFloor) < 256)) && Lara.NewAnims.CrawlVault3click)
|
||||
else if ((!slope && (abs(coll->front.Ceiling - coll->front.Floor) < 256)) && Lara.NewAnims.CrawlVault3click)
|
||||
{
|
||||
item->animNumber = LA_VAULT_TO_CROUCH_3CLICK;
|
||||
item->frameNumber = g_Level.Anims[item->animNumber].frameBase;
|
||||
item->currentAnimState = LS_GRABBING;
|
||||
item->goalAnimState = LS_CROUCH_IDLE;
|
||||
item->pos.yPos += coll->frontFloor + 768;
|
||||
item->pos.yPos += coll->front.Floor + 768;
|
||||
Lara.gunStatus = LG_HANDS_BUSY;
|
||||
}
|
||||
else
|
||||
|
@ -130,7 +131,7 @@ int TestLaraVault(ITEM_INFO* item, COLL_INFO* coll)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
else if (!slope && coll->frontFloor >= -1920 && coll->frontFloor <= -896)
|
||||
else if (!slope && coll->front.Floor >= -1920 && coll->front.Floor <= -896)
|
||||
{
|
||||
#if 0
|
||||
if (g_Level.Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP)
|
||||
|
@ -141,7 +142,7 @@ int TestLaraVault(ITEM_INFO* item, COLL_INFO* coll)
|
|||
item->frameNumber = g_Level.Anims[item->animNumber].frameBase;
|
||||
item->goalAnimState = LS_JUMP_UP;
|
||||
item->currentAnimState = LS_STOP;
|
||||
Lara.calcFallSpeed = -3 - sqrt(-9600 - 12 * coll->frontFloor);
|
||||
Lara.calcFallSpeed = -3 - sqrt(-9600 - 12 * coll->front.Floor);
|
||||
AnimateLara(item);
|
||||
}
|
||||
else
|
||||
|
@ -149,9 +150,9 @@ int TestLaraVault(ITEM_INFO* item, COLL_INFO* coll)
|
|||
if (!Lara.climbStatus)
|
||||
return 0;
|
||||
|
||||
if (coll->frontFloor > -1920 || Lara.waterStatus == LW_WADE || coll->leftFloor2 > -1920 || coll->rightFloor2 > -2048 || coll->midCeiling > -1158)
|
||||
if (coll->front.Floor > -1920 || Lara.waterStatus == LW_WADE || coll->frontLeft.Floor > -1920 || coll->frontRight.Floor > -2048 || coll->middle.Ceiling > -1158)
|
||||
{
|
||||
if ((coll->frontFloor < -1024 || coll->frontCeiling >= 506) && coll->midCeiling <= -518)
|
||||
if ((coll->front.Floor < -1024 || coll->front.Ceiling >= 506) && coll->middle.Ceiling <= -518)
|
||||
{
|
||||
ShiftItem(item, coll);
|
||||
|
||||
|
@ -181,9 +182,9 @@ int TestLaraVault(ITEM_INFO* item, COLL_INFO* coll)
|
|||
item->pos.yRot = angle;
|
||||
ShiftItem(item, coll);
|
||||
|
||||
/*if (coll->midSplitFloor) // diagonal alignment
|
||||
/*if (coll->middle.SplitFloor) // diagonal alignment
|
||||
{
|
||||
Vector2 v = GetDiagonalIntersect(item->pos.xPos, item->pos.zPos, coll->midSplitFloor, LARA_RAD, item->pos.yRot);
|
||||
Vector2 v = GetDiagonalIntersect(item->pos.xPos, item->pos.zPos, coll->middle.SplitFloor, LARA_RAD, item->pos.yRot);
|
||||
item->pos.xPos = v.x;
|
||||
item->pos.zPos = v.y;
|
||||
}
|
||||
|
@ -320,7 +321,7 @@ int LaraHangTest(ITEM_INFO* item, COLL_INFO* coll)
|
|||
coll->badCeiling = 0;
|
||||
Lara.moveAngle = item->pos.yRot;
|
||||
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;
|
||||
if (Lara.climbStatus)
|
||||
{
|
||||
|
@ -361,13 +362,13 @@ int LaraHangTest(ITEM_INFO* item, COLL_INFO* coll)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (TrInput & IN_ACTION && item->hitPoints > 0 && coll->frontFloor <= 0)
|
||||
if (TrInput & IN_ACTION && item->hitPoints > 0 && coll->front.Floor <= 0)
|
||||
{
|
||||
if (flag && hdif > 0 && delta > 0 == coll->leftFloor > coll->rightFloor)
|
||||
if (flag && hdif > 0 && delta > 0 == coll->middleLeft.Floor > coll->middleRight.Floor)
|
||||
flag = 0;
|
||||
frame = (ANIM_FRAME*)GetBoundsAccurate(item);
|
||||
front = coll->frontFloor;
|
||||
dfront = coll->frontFloor - frame->boundingBox.Y1;
|
||||
front = coll->front.Floor;
|
||||
dfront = coll->front.Floor - frame->boundingBox.Y1;
|
||||
flag2 = 0;
|
||||
x = item->pos.xPos;
|
||||
z = item->pos.zPos;
|
||||
|
@ -387,18 +388,18 @@ int LaraHangTest(ITEM_INFO* item, COLL_INFO* coll)
|
|||
break;
|
||||
}
|
||||
Lara.moveAngle = angle;
|
||||
if (256 << dir & GetClimbTrigger(x, item->pos.yPos, z, item->roomNumber))
|
||||
if (256 << dir & GetClimbFlags(x, item->pos.yPos, z, item->roomNumber))
|
||||
{
|
||||
if (!LaraTestHangOnClimbWall(item, coll))
|
||||
dfront = 0;
|
||||
}
|
||||
else if (abs(coll->leftFloor2 - coll->rightFloor2) >= 60)
|
||||
else if (abs(coll->frontLeft.Floor - coll->frontRight.Floor) >= 60)
|
||||
{
|
||||
if (delta < 0 && coll->leftFloor2 != coll->frontFloor || delta > 0 && coll->rightFloor2 != coll->frontFloor)
|
||||
if (delta < 0 && coll->frontLeft.Floor != coll->front.Floor || delta > 0 && coll->frontRight.Floor != coll->front.Floor)
|
||||
flag2 = 1;
|
||||
}
|
||||
coll->frontFloor = front;
|
||||
if (!flag2 && coll->midCeiling < 0 && coll->collType == CT_FRONT && !flag && !coll->hitStatic && cdif <= -950 && dfront >= -60 && dfront <= 60)
|
||||
coll->front.Floor = front;
|
||||
if (!flag2 && coll->middle.Ceiling < 0 && coll->collType == CT_FRONT && !flag && !coll->hitStatic && cdif <= -950 && dfront >= -60 && dfront <= 60)
|
||||
{
|
||||
switch (dir)
|
||||
{
|
||||
|
@ -468,7 +469,7 @@ int LaraHangLeftCornerTest(ITEM_INFO* item, COLL_INFO* coll)
|
|||
int oldXpos = item->pos.xPos;
|
||||
int oldZpos = item->pos.zPos;
|
||||
short oldYrot = item->pos.yRot;
|
||||
int oldFrontFloor = coll->frontFloor;
|
||||
int oldFrontFloor = coll->front.Floor;
|
||||
|
||||
short angle = GetQuadrant(item->pos.yRot);
|
||||
if (angle != NORTH && angle != SOUTH)
|
||||
|
@ -493,7 +494,7 @@ int LaraHangLeftCornerTest(ITEM_INFO* item, COLL_INFO* coll)
|
|||
{
|
||||
if (Lara.climbStatus)
|
||||
{
|
||||
if (GetClimbTrigger(x, item->pos.yPos, z, item->roomNumber) & RightClimbTab[angle])
|
||||
if (GetClimbFlags(x, item->pos.yPos, z, item->roomNumber) & RightClimbTab[angle])
|
||||
{
|
||||
item->pos.xPos = oldXpos;
|
||||
item->pos.zPos = oldZpos;
|
||||
|
@ -504,7 +505,7 @@ int LaraHangLeftCornerTest(ITEM_INFO* item, COLL_INFO* coll)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (abs(oldFrontFloor - coll->frontFloor) <= 60)
|
||||
if (abs(oldFrontFloor - coll->front.Floor) <= 60)
|
||||
{
|
||||
item->pos.xPos = oldXpos;
|
||||
item->pos.zPos = oldZpos;
|
||||
|
@ -570,7 +571,7 @@ int LaraHangLeftCornerTest(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
if (!Lara.climbStatus)
|
||||
{
|
||||
if (abs(oldFrontFloor - coll->frontFloor) <= 60)
|
||||
if (abs(oldFrontFloor - coll->front.Floor) <= 60)
|
||||
{
|
||||
switch (angle)
|
||||
{
|
||||
|
@ -596,11 +597,11 @@ int LaraHangLeftCornerTest(ITEM_INFO* item, COLL_INFO* coll)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (GetClimbTrigger(x, item->pos.yPos, z, item->roomNumber) & LeftClimbTab[angle])
|
||||
if (GetClimbFlags(x, item->pos.yPos, z, item->roomNumber) & LeftClimbTab[angle])
|
||||
return result;
|
||||
|
||||
short front = LaraFloorFront(item, item->pos.yRot, 116);
|
||||
if (abs(front - coll->frontFloor) > 60)
|
||||
if (abs(front - coll->front.Floor) > 60)
|
||||
return 0;
|
||||
|
||||
if (front < -768)
|
||||
|
@ -623,7 +624,7 @@ int LaraHangRightCornerTest(ITEM_INFO* item, COLL_INFO* coll)
|
|||
int oldXpos = item->pos.xPos;
|
||||
int oldZpos = item->pos.zPos;
|
||||
short oldYrot = item->pos.yRot;
|
||||
int oldFrontFloor = coll->frontFloor;
|
||||
int oldFrontFloor = coll->front.Floor;
|
||||
|
||||
short angle = GetQuadrant(item->pos.yRot);
|
||||
if (angle != NORTH && angle != SOUTH)
|
||||
|
@ -648,7 +649,7 @@ int LaraHangRightCornerTest(ITEM_INFO* item, COLL_INFO* coll)
|
|||
{
|
||||
if (Lara.climbStatus)
|
||||
{
|
||||
if (GetClimbTrigger(x, item->pos.yPos, z, item->roomNumber) & LeftClimbTab[angle])
|
||||
if (GetClimbFlags(x, item->pos.yPos, z, item->roomNumber) & LeftClimbTab[angle])
|
||||
{
|
||||
item->pos.xPos = oldXpos;
|
||||
item->pos.zPos = oldZpos;
|
||||
|
@ -659,7 +660,7 @@ int LaraHangRightCornerTest(ITEM_INFO* item, COLL_INFO* coll)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (abs(oldFrontFloor - coll->frontFloor) <= 60)
|
||||
if (abs(oldFrontFloor - coll->front.Floor) <= 60)
|
||||
{
|
||||
item->pos.xPos = oldXpos;
|
||||
item->pos.zPos = oldZpos;
|
||||
|
@ -725,7 +726,7 @@ int LaraHangRightCornerTest(ITEM_INFO* item, COLL_INFO* coll)
|
|||
|
||||
if (!Lara.climbStatus)
|
||||
{
|
||||
if (abs(oldFrontFloor - coll->frontFloor) <= 60)
|
||||
if (abs(oldFrontFloor - coll->front.Floor) <= 60)
|
||||
{
|
||||
switch (angle)
|
||||
{
|
||||
|
@ -751,11 +752,11 @@ int LaraHangRightCornerTest(ITEM_INFO* item, COLL_INFO* coll)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (GetClimbTrigger(x, item->pos.yPos, z, item->roomNumber) & RightClimbTab[angle])
|
||||
if (GetClimbFlags(x, item->pos.yPos, z, item->roomNumber) & RightClimbTab[angle])
|
||||
return result;
|
||||
|
||||
short front = LaraFloorFront(item, item->pos.yRot, 116);
|
||||
if (abs(front - coll->frontFloor) > 60)
|
||||
if (abs(front - coll->front.Floor) > 60)
|
||||
return 0;
|
||||
|
||||
if (front < -768)
|
||||
|
@ -795,12 +796,12 @@ int IsValidHangPos(ITEM_INFO* item, COLL_INFO* coll)
|
|||
Lara.moveAngle = item->pos.yRot;
|
||||
|
||||
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->midCeiling >= 0 || coll->collType != CT_FRONT || coll->hitStatic)
|
||||
if (coll->middle.Ceiling >= 0 || coll->collType != CT_FRONT || coll->hitStatic)
|
||||
return 0;
|
||||
|
||||
return abs(coll->frontFloor - coll->rightFloor2) < 60;
|
||||
return abs(coll->front.Floor - coll->frontRight.Floor) < 60;
|
||||
}
|
||||
|
||||
int LaraTestClimbStance(ITEM_INFO* item, COLL_INFO* coll)
|
||||
|
@ -896,7 +897,7 @@ int LaraTestEdgeCatch(ITEM_INFO* item, COLL_INFO* coll, int* edge)
|
|||
{
|
||||
|
||||
BOUNDING_BOX* bounds = GetBoundsAccurate(item);
|
||||
int hdif = coll->frontFloor - bounds->Y1;
|
||||
int hdif = coll->front.Floor - bounds->Y1;
|
||||
|
||||
if (hdif < 0 == hdif + item->fallspeed < 0)
|
||||
{
|
||||
|
@ -915,7 +916,7 @@ int LaraTestEdgeCatch(ITEM_INFO* item, COLL_INFO* coll, int* edge)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (abs(coll->leftFloor2 - coll->rightFloor2) >= SLOPE_DIF)
|
||||
if (abs(coll->frontLeft.Floor - coll->frontRight.Floor) >= SLOPE_DIF)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
|
@ -1111,41 +1112,73 @@ 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)
|
||||
{
|
||||
return LaraCollisionFront(item, ang, dist).FloorHeight;
|
||||
}
|
||||
|
||||
COLL_RESULT LaraCollisionFront(ITEM_INFO* item, short ang, int dist)
|
||||
{
|
||||
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);
|
||||
|
||||
ROOM_VECTOR location = GetRoom(item->location, x, y, z);
|
||||
auto collResult = GetCollisionResult(x, y, z, item->roomNumber);
|
||||
|
||||
int height = GetFloorHeight(location, x, z).value_or(NO_HEIGHT);
|
||||
if (collResult.FloorHeight != NO_HEIGHT)
|
||||
collResult.FloorHeight -= item->pos.yPos;
|
||||
|
||||
if (height != NO_HEIGHT)
|
||||
height -= item->pos.yPos;
|
||||
|
||||
return height;
|
||||
return collResult;
|
||||
}
|
||||
|
||||
int LaraCeilingFront(ITEM_INFO* item, short ang, int dist, int h)
|
||||
{
|
||||
return LaraCeilingCollisionFront(item, ang, dist, h).CeilingHeight;
|
||||
}
|
||||
|
||||
COLL_RESULT LaraCeilingCollisionFront(ITEM_INFO* item, short ang, int dist, int h)
|
||||
{
|
||||
int x = item->pos.xPos + dist * phd_sin(ang);
|
||||
int y = item->pos.yPos - h;
|
||||
int z = item->pos.zPos + dist * phd_cos(ang);
|
||||
|
||||
ROOM_VECTOR location = GetRoom(item->location, x, y, z);
|
||||
auto collResult = GetCollisionResult(x, y, z, item->roomNumber);
|
||||
|
||||
int height = GetCeilingHeight(location, x, z).value_or(NO_HEIGHT);
|
||||
if (collResult.CeilingHeight != NO_HEIGHT)
|
||||
collResult.CeilingHeight += h - item->pos.yPos;
|
||||
|
||||
if (height != NO_HEIGHT)
|
||||
height += h - item->pos.yPos;
|
||||
|
||||
return height;
|
||||
return collResult;
|
||||
}
|
||||
|
||||
int LaraFallen(ITEM_INFO* item, COLL_INFO* coll)
|
||||
{
|
||||
if (Lara.waterStatus == LW_WADE || coll->midFloor <= STEPUP_HEIGHT)
|
||||
if (Lara.waterStatus == LW_WADE || coll->middle.Floor <= STEPUP_HEIGHT)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -15,8 +15,11 @@ bool TestHangFeet(ITEM_INFO* item, 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 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);
|
||||
COLL_RESULT LaraCollisionFront(ITEM_INFO* item, short ang, int dist);
|
||||
int LaraCeilingFront(ITEM_INFO* item, short ang, int dist, int h);
|
||||
COLL_RESULT LaraCeilingCollisionFront(ITEM_INFO* item, short ang, int dist, int h);
|
||||
int LaraFallen(ITEM_INFO* item, COLL_INFO* coll);
|
||||
int LaraLandedBad(ITEM_INFO* l, COLL_INFO* coll);
|
||||
void GetTighRopeFallOff(int Regularity);
|
||||
|
|
|
@ -1268,9 +1268,7 @@ void GetAITarget(CREATURE_INFO* creature)
|
|||
abs(enemy->pos.yPos - item->pos.yPos) < REACHED_GOAL_RADIUS
|
||||
|| Objects[item->objectNumber].waterCreature)
|
||||
{
|
||||
floor = GetFloor(enemy->pos.xPos, enemy->pos.yPos, enemy->pos.zPos, &(enemy->roomNumber));
|
||||
GetFloorHeight(floor, enemy->pos.xPos, enemy->pos.yPos, enemy->pos.zPos);
|
||||
TestTriggers(TriggerIndex, TRUE, 0);
|
||||
TestTriggers(enemy, true, NULL);
|
||||
creature->patrol2 = !creature->patrol2;
|
||||
}
|
||||
}
|
||||
|
@ -1292,9 +1290,7 @@ void GetAITarget(CREATURE_INFO* creature)
|
|||
abs(enemy->pos.zPos - item->pos.zPos) < REACHED_GOAL_RADIUS &&
|
||||
abs(enemy->pos.yPos - item->pos.yPos) < REACHED_GOAL_RADIUS)
|
||||
{
|
||||
floor = GetFloor(enemy->pos.xPos, enemy->pos.yPos, enemy->pos.zPos, &(enemy->roomNumber));
|
||||
GetFloorHeight(floor, enemy->pos.xPos, enemy->pos.yPos, enemy->pos.zPos);
|
||||
TestTriggers(TriggerIndex, TRUE, 0);
|
||||
TestTriggers(enemy, true, NULL);
|
||||
|
||||
creature->reachedGoal = true;
|
||||
creature->enemy = LaraItem;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "camera.h"
|
||||
#include "draw.h"
|
||||
#include "lara.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "effect2.h"
|
||||
#include "debris.h"
|
||||
#include "lara_fire.h"
|
||||
|
@ -44,7 +44,6 @@ int TargetSnaps = 0;
|
|||
GAME_VECTOR LookCamPosition;
|
||||
GAME_VECTOR LookCamTarget;
|
||||
int LSHKTimer = 0;
|
||||
int ExittingBinos = 0;
|
||||
int LSHKShotsFired = 0;
|
||||
PHD_VECTOR CamOldPos;
|
||||
int TLFlag = 0;
|
||||
|
@ -58,7 +57,6 @@ int BinocularOn;
|
|||
CAMERA_TYPE BinocularOldCamera;
|
||||
int LaserSight;
|
||||
int SniperCount;
|
||||
int ExitingBinocular;
|
||||
int PhdPerspective;
|
||||
short CurrentFOV;
|
||||
int GetLaraOnLOS;
|
||||
|
@ -1155,6 +1153,8 @@ void BounceCamera(ITEM_INFO* item, short bounce, short maxDistance)
|
|||
|
||||
void BinocularCamera(ITEM_INFO* item)
|
||||
{
|
||||
static int exittingBinos = 0;
|
||||
|
||||
if (LSHKTimer)
|
||||
--LSHKTimer;
|
||||
|
||||
|
@ -1162,11 +1162,11 @@ void BinocularCamera(ITEM_INFO* item)
|
|||
{
|
||||
if (InputBusy & IN_DRAW)
|
||||
{
|
||||
ExittingBinos = 1;
|
||||
exittingBinos = 1;
|
||||
}
|
||||
else if (ExittingBinos)
|
||||
else if (exittingBinos)
|
||||
{
|
||||
ExittingBinos = 0;
|
||||
exittingBinos = 0;
|
||||
BinocularRange = 0;
|
||||
AlterFOV(14560);
|
||||
LaraItem->meshBits = -1;
|
||||
|
@ -1440,6 +1440,7 @@ void BinocularCamera(ITEM_INFO* item)
|
|||
|
||||
if (!(InputBusy & IN_ACTION) || Infrared)
|
||||
{
|
||||
// Reimplement this mode?
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -64,7 +64,6 @@ extern int BinocularOn;
|
|||
extern CAMERA_TYPE BinocularOldCamera;
|
||||
extern int LaserSight;
|
||||
extern int SniperCount;
|
||||
extern int ExitingBinocular;
|
||||
extern int PhdPerspective;
|
||||
extern short CurrentFOV;
|
||||
extern int GetLaraOnLOS;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -9,60 +9,40 @@
|
|||
|
||||
#define MAX_COLLIDED_OBJECTS 1024
|
||||
|
||||
struct COLL_FLOOR
|
||||
struct COLL_RESULT
|
||||
{
|
||||
int floor;
|
||||
int ceiling;
|
||||
int type;
|
||||
int splitFloor;
|
||||
int splitCeiling;
|
||||
FLOOR_INFO* Block;
|
||||
FLOOR_INFO* BottomBlock;
|
||||
int RoomNumber;
|
||||
|
||||
int FloorHeight;
|
||||
int HeightType;
|
||||
|
||||
int TiltX;
|
||||
int TiltZ;
|
||||
int SplitFloor;
|
||||
|
||||
int CeilingHeight;
|
||||
int SplitCeiling;
|
||||
};
|
||||
|
||||
struct COLL_POSITION
|
||||
{
|
||||
int Floor;
|
||||
int Ceiling;
|
||||
int Type;
|
||||
int SplitFloor;
|
||||
int SplitCeiling;
|
||||
};
|
||||
|
||||
struct COLL_INFO
|
||||
{
|
||||
/*
|
||||
COLL_FLOOR middle; // mid
|
||||
COLL_FLOOR middle_left; // left
|
||||
COLL_FLOOR middle_right; // right
|
||||
COLL_FLOOR front; // front
|
||||
COLL_FLOOR front_left; // left2
|
||||
COLL_FLOOR front_right; // right2
|
||||
*/
|
||||
int midFloor;
|
||||
int midCeiling;
|
||||
int midType;
|
||||
int midSplitFloor;
|
||||
int midSplitCeil;
|
||||
|
||||
int frontFloor;
|
||||
int frontCeiling;
|
||||
int frontType;
|
||||
int frontSplitFloor;
|
||||
int frontSplitCeil;
|
||||
|
||||
int leftFloor;
|
||||
int leftCeiling;
|
||||
int leftType;
|
||||
int leftSplitFloor;
|
||||
int leftSplitCeil;
|
||||
|
||||
int rightFloor;
|
||||
int rightCeiling;
|
||||
int rightType;
|
||||
int rightSplitFloor;
|
||||
int rightSplitCeil;
|
||||
|
||||
int leftFloor2;
|
||||
int leftCeiling2;
|
||||
int leftType2;
|
||||
int leftSplitFloor2;
|
||||
int leftSplitCeil2;
|
||||
|
||||
int rightFloor2;
|
||||
int rightCeiling2;
|
||||
int rightType2;
|
||||
int rightSplitFloor2;
|
||||
int rightSplitCeil2;
|
||||
COLL_POSITION middle; // mid
|
||||
COLL_POSITION middleLeft; // left
|
||||
COLL_POSITION middleRight; // right
|
||||
COLL_POSITION front; // front
|
||||
COLL_POSITION frontLeft; // left2
|
||||
COLL_POSITION frontRight; // right2
|
||||
|
||||
int radius;
|
||||
int badPos;
|
||||
|
@ -76,10 +56,8 @@ struct COLL_INFO
|
|||
short facing;
|
||||
short quadrant;
|
||||
short collType; // CT_enum
|
||||
short* trigger;
|
||||
signed char tiltX;
|
||||
signed char tiltZ;
|
||||
bool hitByBaddie;
|
||||
bool hitStatic;
|
||||
bool slopesAreWalls;
|
||||
bool slopesArePits;
|
||||
|
@ -100,8 +78,10 @@ struct OBJECT_COLLISION_BOUNDS
|
|||
short rotZ2;
|
||||
};
|
||||
|
||||
extern BOUNDING_BOX GlobalCollisionBounds;
|
||||
constexpr auto MAX_ITEMS = 1024;
|
||||
constexpr auto ITEM_RADIUS_YMAX = SECTOR(3);
|
||||
|
||||
extern BOUNDING_BOX GlobalCollisionBounds;
|
||||
extern ITEM_INFO* CollidedItems[MAX_ITEMS];
|
||||
extern MESH_INFO* CollidedMeshes[MAX_ITEMS];
|
||||
|
||||
|
@ -113,31 +93,30 @@ void TrapCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* c);
|
|||
void TestForObjectOnLedge(ITEM_INFO* item, COLL_INFO* coll);
|
||||
void ShiftItem(ITEM_INFO* item, COLL_INFO* coll);
|
||||
void UpdateLaraRoom(ITEM_INFO* item, int height);
|
||||
short GetTiltType(FLOOR_INFO* floor, int x, int y, int z);
|
||||
COLL_RESULT GetCollisionResult(FLOOR_INFO* floor, int x, int y, int z);
|
||||
COLL_RESULT GetCollisionResult(int x, int y, int z, short roomNumber);
|
||||
COLL_RESULT GetCollisionResult(ITEM_INFO* item);
|
||||
int FindGridShift(int x, int z);
|
||||
int TestBoundsCollideStatic(BOUNDING_BOX* bounds, PHD_3DPOS* pos, int radius);
|
||||
int ItemPushLaraStatic(ITEM_INFO* item, BOUNDING_BOX* bounds, PHD_3DPOS* pos, COLL_INFO* coll);
|
||||
void AIPickupCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* c);
|
||||
void ObjectCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* c);
|
||||
void AlignLaraPosition(PHD_VECTOR* vec, ITEM_INFO* item, ITEM_INFO* l);
|
||||
void TriggerLaraBlood();
|
||||
int ItemPushLara(ITEM_INFO* item, ITEM_INFO* l, COLL_INFO* coll, int spazon, char bigpush);
|
||||
int TestLaraPosition(OBJECT_COLLISION_BOUNDS* bounds, ITEM_INFO* item, ITEM_INFO* l);
|
||||
int Move3DPosTo3DPos(PHD_3DPOS* src, PHD_3DPOS* dest, int velocity, short angAdd);
|
||||
int MoveLaraPosition(PHD_VECTOR* pos, ITEM_INFO* item, ITEM_INFO* l);
|
||||
int TestBoundsCollide(ITEM_INFO* item, ITEM_INFO* l, int radius);
|
||||
void CreatureCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll);
|
||||
void RefreshFloorGlobals(ITEM_INFO* item);
|
||||
void GetCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int roomNumber, int objectHeight);
|
||||
void GetObjectCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int roomNumber, int objectHeight);
|
||||
void DoProjectileDynamics(short itemNumber, int x, int y, int z, int xv, int yv, int zv);
|
||||
void LaraBaddieCollision(ITEM_INFO* item, COLL_INFO* coll);
|
||||
bool ItemNearLara(PHD_3DPOS* pos, int radius);
|
||||
bool ItemNearTarget(PHD_3DPOS* src, ITEM_INFO* target, int radius);
|
||||
bool SnapToQuadrant(short& angle, int interval);
|
||||
int GetQuadrant(short angle);
|
||||
bool SnapToDiagonal(short& angle, int interval);
|
||||
// New function for rotating item along XZ slopes.
|
||||
// (int radiusDivide) is for radiusZ, else the MaxZ is too high and cause rotation problem !
|
||||
// Dont need to set a value in radiusDivide if you dont need it (radiusDivide is set to 1 by default).
|
||||
// Warning: dont set it to 0 !!!!
|
||||
void CalcItemToFloorRotation(ITEM_INFO* item, int radiusDivide = 1);
|
||||
Vector2 GetDiagonalIntersect(int xPos, int zPos, int splitType, int radius, short yRot); // find xPos, zPos that intersects with diagonal on sector
|
||||
Vector2 GetOrthogonalIntersect(int xPos, int zPos, int radius, short yRot); // find xPos, zPos near sector bound, offset by radius;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "Lara.h"
|
||||
#include "hair.h"
|
||||
#include "items.h"
|
||||
#include "effect2.h"
|
||||
#include "flipeffect.h"
|
||||
#include "draw.h"
|
||||
#ifdef NEW_INV
|
||||
#include "newinv2.h"
|
||||
|
@ -28,7 +28,7 @@
|
|||
#include "rope.h"
|
||||
#include "tomb4fx.h"
|
||||
#include "traps.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "sphere.h"
|
||||
#include "debris.h"
|
||||
#include "lara_fire.h"
|
||||
|
@ -51,6 +51,7 @@
|
|||
#include <process.h>
|
||||
#include "prng.h"
|
||||
#include <Game/Lara/lara_one_gun.h>
|
||||
#include <Game/Lara/lara_climb.h>
|
||||
#include "generic_switch.h"
|
||||
|
||||
using namespace TEN::Entities::Switches;
|
||||
|
@ -75,7 +76,6 @@ int ClosestDist;
|
|||
PHD_VECTOR ClosestCoord;
|
||||
int RumbleTimer = 0;
|
||||
int InGameCnt = 0;
|
||||
byte IsAtmospherePlaying = 0;
|
||||
byte FlipStatus = 0;
|
||||
int FlipStats[MAX_FLIPMAP];
|
||||
int FlipMap[MAX_FLIPMAP];
|
||||
|
@ -86,7 +86,6 @@ short NextFxActive;
|
|||
short NextFxFree;
|
||||
short NextItemActive;
|
||||
short NextItemFree;
|
||||
short *TriggerIndex;
|
||||
|
||||
int DisableLaraControl = 0;
|
||||
int WeatherType;
|
||||
|
@ -102,7 +101,6 @@ short CurrentRoom;
|
|||
int GameTimer;
|
||||
short GlobalCounter;
|
||||
byte LevelComplete;
|
||||
short DelCutSeqPlayer;
|
||||
#ifndef NEW_INV
|
||||
int LastInventoryItem;
|
||||
#endif
|
||||
|
@ -112,29 +110,21 @@ int InitialiseGame;
|
|||
int RequiredStartPos;
|
||||
int WeaponDelay;
|
||||
int WeaponEnemyTimer;
|
||||
HEIGHT_TYPES HeightType;
|
||||
int HeavyTriggered;
|
||||
short SkyPos1;
|
||||
short SkyPos2;
|
||||
CVECTOR SkyColor1;
|
||||
CVECTOR SkyColor2;
|
||||
int CutSeqNum;
|
||||
int CutSeqTriggered;
|
||||
int GlobalPlayingCutscene;
|
||||
int CurrentLevel;
|
||||
bool SoundActive;
|
||||
bool DoTheGame;
|
||||
bool ThreadEnded;
|
||||
int OnFloor;
|
||||
int SmokeWindX;
|
||||
int SmokeWindZ;
|
||||
int OnObject;
|
||||
int KillEverythingFlag;
|
||||
int FlipTimer;
|
||||
int FlipEffect;
|
||||
int TriggerTimer;
|
||||
int JustLoaded;
|
||||
int PoisonFlags;
|
||||
int OldLaraBusy;
|
||||
int Infrared;
|
||||
short FlashFadeR;
|
||||
|
@ -142,12 +132,6 @@ short FlashFadeG;
|
|||
short FlashFadeB;
|
||||
short FlashFader;
|
||||
|
||||
int SplitFloor;
|
||||
int SplitCeiling;
|
||||
int TiltXOffset;
|
||||
int TiltYOffset;
|
||||
int FramesCount;
|
||||
|
||||
std::vector<short> OutsideRoomTable[OUTSIDE_SIZE][OUTSIDE_SIZE];
|
||||
short IsRoomOutsideNo;
|
||||
|
||||
|
@ -178,6 +162,7 @@ GAME_STATUS ControlPhase(int numFrames, int demoMode)
|
|||
|
||||
SetDebounce = true;
|
||||
|
||||
static int FramesCount = 0;
|
||||
for (FramesCount += numFrames; FramesCount > 0; FramesCount -= 2)
|
||||
{
|
||||
GlobalCounter++;
|
||||
|
@ -203,17 +188,13 @@ GAME_STATUS ControlPhase(int numFrames, int demoMode)
|
|||
TrInput &= IN_LOOK;
|
||||
}
|
||||
|
||||
// If cutscene has been triggered then clear input
|
||||
if (CutSeqTriggered)
|
||||
TrInput = IN_NONE;
|
||||
|
||||
// Does the player want to enter inventory?
|
||||
SetDebounce = false;
|
||||
|
||||
#ifdef NEW_INV
|
||||
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();
|
||||
g_Renderer.DumpGameScene();
|
||||
|
@ -221,7 +202,7 @@ GAME_STATUS ControlPhase(int numFrames, int demoMode)
|
|||
pause_menu_to_display = pause_main_menu;
|
||||
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
|
||||
SOUND_Stop();
|
||||
|
@ -244,7 +225,7 @@ GAME_STATUS ControlPhase(int numFrames, int demoMode)
|
|||
#else
|
||||
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
|
||||
SOUND_Stop();
|
||||
|
@ -442,23 +423,10 @@ GAME_STATUS ControlPhase(int numFrames, int demoMode)
|
|||
{
|
||||
if (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))
|
||||
{
|
||||
LaraItem->hitPoints -= Lara.poisoned >> (8 - Lara.gassed);
|
||||
PoisonFlags = 16;
|
||||
LaraItem->hitPoints -= Lara.poisoned >> 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -517,13 +485,10 @@ GAME_STATUS ControlPhase(int numFrames, int demoMode)
|
|||
SmashedMesh[SmashedMeshCount]->z,
|
||||
&SmashedMeshRoom[SmashedMeshCount]);
|
||||
|
||||
int height = GetFloorHeight(
|
||||
floor,
|
||||
SmashedMesh[SmashedMeshCount]->x,
|
||||
SmashedMesh[SmashedMeshCount]->y,
|
||||
SmashedMesh[SmashedMeshCount]->z);
|
||||
|
||||
TestTriggers(TriggerIndex, 1, 0);
|
||||
TestTriggers(SmashedMesh[SmashedMeshCount]->x,
|
||||
SmashedMesh[SmashedMeshCount]->y,
|
||||
SmashedMesh[SmashedMeshCount]->z,
|
||||
SmashedMeshRoom[SmashedMeshCount], true, 0);
|
||||
|
||||
floor->stopper = false;
|
||||
SmashedMesh[SmashedMeshCount] = 0;
|
||||
|
@ -585,6 +550,9 @@ GAME_STATUS ControlPhase(int numFrames, int demoMode)
|
|||
if (FlipEffect != -1)
|
||||
effect_routines[FlipEffect](NULL);
|
||||
|
||||
// Clear savegame loaded flag
|
||||
JustLoaded = false;
|
||||
|
||||
// Update timers
|
||||
HealthBarTimer--;
|
||||
GameTimer++;
|
||||
|
@ -667,7 +635,6 @@ GAME_STATUS DoTitle(int index)
|
|||
#ifndef NEW_INV
|
||||
LastInventoryItem = -1;
|
||||
#endif
|
||||
DelCutSeqPlayer = 0;
|
||||
|
||||
// Initialise flyby cameras
|
||||
InitSpotCamSequences();
|
||||
|
@ -679,7 +646,6 @@ GAME_STATUS DoTitle(int index)
|
|||
// Play background music
|
||||
//CurrentAtmosphere = ambient;
|
||||
S_CDPlay(CurrentAtmosphere, 1);
|
||||
IsAtmospherePlaying = true;
|
||||
|
||||
// Initialise ponytails
|
||||
InitialiseHair();
|
||||
|
@ -807,7 +773,6 @@ GAME_STATUS DoLevel(int index, std::string ambient, bool loadFromSavegame)
|
|||
#ifndef NEW_INV
|
||||
LastInventoryItem = -1;
|
||||
#endif
|
||||
DelCutSeqPlayer = 0;
|
||||
|
||||
#ifdef NEW_INV
|
||||
GLOBAL_inventoryitemchosen = NO_ITEM;
|
||||
|
@ -823,7 +788,6 @@ GAME_STATUS DoLevel(int index, std::string ambient, bool loadFromSavegame)
|
|||
// Play background music
|
||||
CurrentAtmosphere = ambient;
|
||||
S_CDPlay(CurrentAtmosphere, 1);
|
||||
IsAtmospherePlaying = true;
|
||||
|
||||
// Initialise ponytails
|
||||
InitialiseHair();
|
||||
|
@ -867,7 +831,7 @@ GAME_STATUS DoLevel(int index, std::string ambient, bool loadFromSavegame)
|
|||
}
|
||||
}
|
||||
|
||||
void TestTriggers(short *data, int heavy, int HeavyFlags)
|
||||
void TestTriggers(short *data, bool heavy, int heavyFlags)
|
||||
{
|
||||
int flip = -1;
|
||||
int flipAvailable = 0;
|
||||
|
@ -935,79 +899,9 @@ void TestTriggers(short *data, int heavy, int HeavyFlags)
|
|||
}
|
||||
}
|
||||
|
||||
HeavyTriggered = false;
|
||||
|
||||
if (!heavy)
|
||||
{
|
||||
Lara.canMonkeySwing = false;
|
||||
Lara.climbStatus = false;
|
||||
Lara.ClockworkBeetleFlag = false;
|
||||
}
|
||||
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
// Burn Lara
|
||||
if ((*data & 0x1F) == LAVA_TYPE)
|
||||
{
|
||||
if (!heavy && (LaraItem->pos.yPos == LaraItem->floor || Lara.waterStatus))
|
||||
LavaBurn(LaraItem);
|
||||
|
||||
if (*data & 0x8000)
|
||||
return;
|
||||
|
||||
data++;
|
||||
}
|
||||
|
||||
// Lara can climb
|
||||
if ((*data & 0x1F) == CLIMB_TYPE)
|
||||
{
|
||||
if (!heavy)
|
||||
{
|
||||
short quad = GetQuadrant(LaraItem->pos.yRot);
|
||||
if ((1 << (quad + 8)) & *data)
|
||||
Lara.climbStatus = true;
|
||||
}
|
||||
|
||||
if (*data & 0x8000)
|
||||
return;
|
||||
|
||||
data++;
|
||||
}
|
||||
|
||||
// Lara can monkey
|
||||
if ((*data & 0x1F) == MONKEY_TYPE)
|
||||
{
|
||||
if (!heavy)
|
||||
Lara.canMonkeySwing = true;
|
||||
|
||||
if (*data & 0x8000)
|
||||
return;
|
||||
|
||||
data++;
|
||||
}
|
||||
|
||||
//for the stupid beetle
|
||||
if ((*data & 0x1F) == MINER_TYPE)
|
||||
{
|
||||
if (!heavy)
|
||||
Lara.ClockworkBeetleFlag = 1;
|
||||
|
||||
if (*data & 0x8000)
|
||||
return;
|
||||
|
||||
data++;
|
||||
}
|
||||
|
||||
// Trigger triggerer
|
||||
if ((*data & 0x1F) == TRIGTRIGGER_TYPE)
|
||||
{
|
||||
if (!(*data & 0x20) || *data & 0x8000)
|
||||
return;
|
||||
|
||||
data++;
|
||||
}
|
||||
|
||||
short triggerType = (*(data++) >> 8) & 0x3F;
|
||||
short flags = *(data++);
|
||||
short timer = flags & 0xFF;
|
||||
|
@ -1021,24 +915,24 @@ void TestTriggers(short *data, int heavy, int HeavyFlags)
|
|||
{
|
||||
switch (triggerType)
|
||||
{
|
||||
case HEAVY:
|
||||
case HEAVYANTITRIGGER:
|
||||
case TRIGGER_TYPES::HEAVY:
|
||||
case TRIGGER_TYPES::HEAVYANTITRIGGER:
|
||||
break;
|
||||
|
||||
case HEAVYSWITCH:
|
||||
if (!HeavyFlags)
|
||||
case TRIGGER_TYPES::HEAVYSWITCH:
|
||||
if (!heavyFlags)
|
||||
return;
|
||||
|
||||
if (HeavyFlags >= 0)
|
||||
if (heavyFlags >= 0)
|
||||
{
|
||||
flags &= CODE_BITS;
|
||||
if (flags != HeavyFlags)
|
||||
if (flags != heavyFlags)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags |= CODE_BITS;
|
||||
flags += HeavyFlags;
|
||||
flags += heavyFlags;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1186,7 +1080,7 @@ void TestTriggers(short *data, int heavy, int HeavyFlags)
|
|||
if (triggerType == TRIGGER_TYPES::SWITCH ||
|
||||
triggerType == TRIGGER_TYPES::HEAVYSWITCH)
|
||||
{
|
||||
if (HeavyFlags >= 0)
|
||||
if (heavyFlags >= 0)
|
||||
{
|
||||
if (switchFlag)
|
||||
item->flags |= (flags & CODE_BITS);
|
||||
|
@ -1274,7 +1168,6 @@ void TestTriggers(short *data, int heavy, int HeavyFlags)
|
|||
item->touchBits = 0;
|
||||
AddActiveItem(value);
|
||||
item->status = ITEM_ACTIVE;
|
||||
HeavyTriggered = heavy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1286,7 +1179,7 @@ void TestTriggers(short *data, int heavy, int HeavyFlags)
|
|||
if (keyResult == 1)
|
||||
break;
|
||||
|
||||
if (g_Level.Cameras[value].flags & 0x100)
|
||||
if (g_Level.Cameras[value].flags & ONESHOT)
|
||||
break;
|
||||
|
||||
Camera.number = value;
|
||||
|
@ -1304,7 +1197,7 @@ void TestTriggers(short *data, int heavy, int HeavyFlags)
|
|||
{
|
||||
Camera.timer = (trigger & 0xFF) * 30;
|
||||
|
||||
if (trigger & 0x100)
|
||||
if (trigger & ONESHOT)
|
||||
g_Level.Cameras[Camera.number].flags |= ONESHOT;
|
||||
|
||||
Camera.speed = ((trigger & CODE_BITS) >> 6) + 1;
|
||||
|
@ -1335,7 +1228,7 @@ void TestTriggers(short *data, int heavy, int HeavyFlags)
|
|||
|
||||
if (!(SpotCam[spotCamIndex].flags & SCF_CAMERA_ONE_SHOT))
|
||||
{
|
||||
if (trigger & 0x100)
|
||||
if (trigger & ONESHOT)
|
||||
SpotCam[spotCamIndex].flags |= SCF_CAMERA_ONE_SHOT;
|
||||
|
||||
if (!UseSpotCam || CurrentLevel == 0)
|
||||
|
@ -1416,7 +1309,7 @@ void TestTriggers(short *data, int heavy, int HeavyFlags)
|
|||
break;
|
||||
}
|
||||
|
||||
} while (!(trigger & 0x8000));
|
||||
} while (!(trigger & END_BIT));
|
||||
|
||||
if (cameraItem && (Camera.type == FIXED_CAMERA || Camera.type == HEAVY_CAMERA))
|
||||
Camera.item = cameraItem;
|
||||
|
@ -1801,16 +1694,16 @@ int CheckNoColCeilingTriangle(FLOOR_INFO *floor, int x, int z)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int GetFloorHeight(FLOOR_INFO *floor, int x, int y, int z)
|
||||
short* GetTriggerIndex(ITEM_INFO* item)
|
||||
{
|
||||
auto roomNumber = item->roomNumber;
|
||||
auto floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber);
|
||||
return GetTriggerIndex(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos);
|
||||
}
|
||||
|
||||
TiltYOffset = 0;
|
||||
TiltXOffset = 0;
|
||||
OnObject = 0;
|
||||
HeightType = WALL;
|
||||
SplitFloor = 0;
|
||||
|
||||
ROOM_INFO *r;
|
||||
short* GetTriggerIndex(FLOOR_INFO* floor, int x, int y, int z)
|
||||
{
|
||||
ROOM_INFO* r;
|
||||
while (floor->pitRoom != NO_ROOM)
|
||||
{
|
||||
if (CheckNoColFloorTriangle(floor, x, z) == 1)
|
||||
|
@ -1819,202 +1712,75 @@ int GetFloorHeight(FLOOR_INFO *floor, int x, int y, int z)
|
|||
floor = &XZ_GET_SECTOR(r, x - r->x, z - r->z);
|
||||
}
|
||||
|
||||
int height = floor->floor * 256;
|
||||
if (height != NO_HEIGHT)
|
||||
if ((floor->floor * 256) == NO_HEIGHT || floor->index == 0)
|
||||
return NULL;
|
||||
|
||||
short* triggerIndex = NULL;
|
||||
|
||||
short* data = &g_Level.FloorData[floor->index];
|
||||
short type;
|
||||
int trigger;
|
||||
do
|
||||
{
|
||||
// return height;
|
||||
type = *(data++);
|
||||
|
||||
|
||||
TriggerIndex = NULL;
|
||||
|
||||
if (floor->index != 0)
|
||||
switch (type & DATA_TYPE)
|
||||
{
|
||||
// return height;
|
||||
case DOOR_TYPE:
|
||||
case TILT_TYPE:
|
||||
case ROOF_TYPE:
|
||||
case SPLIT1:
|
||||
case SPLIT2:
|
||||
case SPLIT3:
|
||||
case SPLIT4:
|
||||
case NOCOLF1T:
|
||||
case NOCOLF1B:
|
||||
case NOCOLF2T:
|
||||
case NOCOLF2B:
|
||||
case NOCOLC1T:
|
||||
case NOCOLC1B:
|
||||
case NOCOLC2T:
|
||||
case NOCOLC2B:
|
||||
data++;
|
||||
break;
|
||||
|
||||
short* data = &g_Level.FloorData[floor->index];
|
||||
short type, hadj;
|
||||
case LAVA_TYPE:
|
||||
case CLIMB_TYPE:
|
||||
case MONKEY_TYPE:
|
||||
case TRIGTRIGGER_TYPE:
|
||||
case MINER_TYPE:
|
||||
break;
|
||||
|
||||
int xOff, yOff, trigger;
|
||||
ITEM_INFO* item;
|
||||
OBJECT_INFO* obj;
|
||||
int tilts, t0, t1, t2, t3, t4, dx, dz, h1, h2;
|
||||
do
|
||||
{
|
||||
type = *(data++);
|
||||
case TRIGGER_TYPE:
|
||||
triggerIndex = data - 1;
|
||||
data++;
|
||||
|
||||
switch (type & DATA_TYPE)
|
||||
do
|
||||
{
|
||||
case DOOR_TYPE:
|
||||
case ROOF_TYPE:
|
||||
case SPLIT3:
|
||||
case SPLIT4:
|
||||
case NOCOLC1T:
|
||||
case NOCOLC1B:
|
||||
case NOCOLC2T:
|
||||
case NOCOLC2B:
|
||||
data++;
|
||||
break;
|
||||
trigger = *(data++);
|
||||
|
||||
case TILT_TYPE:
|
||||
TiltXOffset = xOff = (*data >> 8);
|
||||
TiltYOffset = yOff = *(char*)data;
|
||||
|
||||
if ((abs(xOff)) > 2 || (abs(yOff)) > 2)
|
||||
HeightType = BIG_SLOPE;
|
||||
else
|
||||
HeightType = SMALL_SLOPE;
|
||||
|
||||
if (xOff >= 0)
|
||||
height += (xOff * ((-1 - z) & 1023) >> 2);
|
||||
else
|
||||
height -= (xOff * (z & 1023) >> 2);
|
||||
|
||||
if (yOff >= 0)
|
||||
height += yOff * ((-1 - x) & 1023) >> 2;
|
||||
else
|
||||
height -= yOff * (x & 1023) >> 2;
|
||||
|
||||
data++;
|
||||
break;
|
||||
|
||||
case TRIGGER_TYPE:
|
||||
if (!TriggerIndex)
|
||||
TriggerIndex = data - 1;
|
||||
|
||||
data++;
|
||||
|
||||
do
|
||||
if (TRIG_BITS(trigger) != TO_OBJECT)
|
||||
{
|
||||
trigger = *(data++);
|
||||
|
||||
if (TRIG_BITS(trigger) != TO_OBJECT)
|
||||
if (TRIG_BITS(trigger) == TO_CAMERA ||
|
||||
TRIG_BITS(trigger) == TO_FLYBY)
|
||||
{
|
||||
if (TRIG_BITS(trigger) == TO_CAMERA ||
|
||||
TRIG_BITS(trigger) == TO_FLYBY)
|
||||
{
|
||||
trigger = *(data++);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*item = &g_Level.Items[trigger & VALUE_BITS];
|
||||
obj = &Objects[item->objectNumber];
|
||||
|
||||
if (obj->floor && !(item->flags & 0x8000))
|
||||
{
|
||||
(obj->floor)(item, x, y, z, &height);
|
||||
}*/
|
||||
}
|
||||
|
||||
} while (!(trigger & END_BIT));
|
||||
break;
|
||||
|
||||
case LAVA_TYPE:
|
||||
TriggerIndex = data - 1;
|
||||
break;
|
||||
|
||||
case CLIMB_TYPE:
|
||||
case MONKEY_TYPE:
|
||||
case TRIGTRIGGER_TYPE:
|
||||
case MINER_TYPE:
|
||||
if (!TriggerIndex)
|
||||
TriggerIndex = data - 1;
|
||||
break;
|
||||
|
||||
case SPLIT1:
|
||||
case SPLIT2:
|
||||
case NOCOLF1T:
|
||||
case NOCOLF1B:
|
||||
case NOCOLF2T:
|
||||
case NOCOLF2B:
|
||||
tilts = *data;
|
||||
t0 = tilts & 15;
|
||||
t1 = (tilts >> 4) & 15;
|
||||
t2 = (tilts >> 8) & 15;
|
||||
t3 = (tilts >> 12) & 15;
|
||||
|
||||
dx = x & 1023;
|
||||
dz = z & 1023;
|
||||
|
||||
xOff = yOff = 0;
|
||||
|
||||
HeightType = SPLIT_TRI;
|
||||
SplitFloor = (type & DATA_TYPE);
|
||||
|
||||
if ((type & DATA_TYPE) == SPLIT1 ||
|
||||
(type & DATA_TYPE) == NOCOLF1T ||
|
||||
(type & DATA_TYPE) == NOCOLF1B)
|
||||
{
|
||||
if (dx <= (1024 - dz))
|
||||
{
|
||||
hadj = (type >> 10) & 0x1F;
|
||||
if (hadj & 0x10)
|
||||
hadj |= 0xfff0;
|
||||
height += 256 * hadj;
|
||||
xOff = t2 - t1;
|
||||
yOff = t0 - t1;
|
||||
}
|
||||
else
|
||||
{
|
||||
hadj = (type >> 5) & 0x1F;
|
||||
if (hadj & 0x10)
|
||||
hadj |= 0xFFF0;
|
||||
height += 256 * hadj;
|
||||
xOff = t3 - t0;
|
||||
yOff = t3 - t2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dx <= dz)
|
||||
{
|
||||
hadj = (type >> 10) & 0x1f;
|
||||
if (hadj & 0x10)
|
||||
hadj |= 0xfff0;
|
||||
height += 256 * hadj;
|
||||
xOff = t2 - t1;
|
||||
yOff = t3 - t2;
|
||||
}
|
||||
else
|
||||
{
|
||||
hadj = (type >> 5) & 0x1f;
|
||||
if (hadj & 0x10)
|
||||
hadj |= 0xfff0;
|
||||
height += 256 * hadj;
|
||||
xOff = t3 - t0;
|
||||
yOff = t0 - t1;
|
||||
trigger = *(data++);
|
||||
}
|
||||
}
|
||||
|
||||
TiltXOffset = xOff;
|
||||
TiltYOffset = yOff;
|
||||
} while (!(trigger & END_BIT));
|
||||
break;
|
||||
|
||||
if ((abs(xOff)) > 2 || (abs(yOff)) > 2)
|
||||
HeightType = DIAGONAL;
|
||||
else if (HeightType != SPLIT_TRI)
|
||||
HeightType = SMALL_SLOPE;
|
||||
|
||||
if (xOff >= 0)
|
||||
height += xOff * ((-1 - z) & 1023) >> 2;
|
||||
else
|
||||
height -= xOff * (z & 1023) >> 2;
|
||||
|
||||
if (yOff >= 0)
|
||||
height += yOff * ((-1 - x) & 1023) >> 2;
|
||||
else
|
||||
height -= yOff * (x & 1023) >> 2;
|
||||
|
||||
data++;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} while (!(type & END_BIT));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*return height;*/
|
||||
} while (!(type & END_BIT));
|
||||
|
||||
return triggerIndex;
|
||||
}
|
||||
|
||||
int GetFloorHeight(FLOOR_INFO *floor, int x, int y, int z)
|
||||
{
|
||||
return GetFloorHeight(ROOM_VECTOR{floor->Room, y}, x, z).value_or(NO_HEIGHT);
|
||||
}
|
||||
|
||||
|
@ -2332,7 +2098,7 @@ int GetTargetOnLOS(GAME_VECTOR *src, GAME_VECTOR *dest, int DrawTarget, int firi
|
|||
MESH_INFO *mesh;
|
||||
PHD_VECTOR vector;
|
||||
ITEM_INFO *item;
|
||||
short angle, room, triggerItems[8];
|
||||
short angle, triggerItems[8];
|
||||
VECTOR dir;
|
||||
Vector3 direction = Vector3(dest->x, dest->y, dest->z) - Vector3(src->x, src->y, src->z);
|
||||
direction.Normalize();
|
||||
|
@ -2493,9 +2259,7 @@ int GetTargetOnLOS(GAME_VECTOR *src, GAME_VECTOR *dest, int DrawTarget, int firi
|
|||
|
||||
if (item->flags & IFLAG_ACTIVATION_MASK && (item->flags & IFLAG_ACTIVATION_MASK) != IFLAG_ACTIVATION_MASK)
|
||||
{
|
||||
room = item->roomNumber;
|
||||
GetFloorHeight(GetFloor(item->pos.xPos, item->pos.yPos - 256, item->pos.zPos, &room), item->pos.xPos, item->pos.yPos - 256, item->pos.zPos);
|
||||
TestTriggers(TriggerIndex, 1, item->flags & IFLAG_ACTIVATION_MASK);
|
||||
TestTriggers(item->pos.xPos, item->pos.yPos - 256, item->pos.zPos, item->roomNumber, true, item->flags & IFLAG_ACTIVATION_MASK);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3565,10 +3329,45 @@ int IsRoomOutside(int x, int y, int z)
|
|||
return -2;
|
||||
}
|
||||
|
||||
void TestTriggersAtXYZ(int x, int y, int z, short roomNumber, int heavy, int flags)
|
||||
void TestTriggers(ITEM_INFO* item, bool heavy, int heavyFlags)
|
||||
{
|
||||
GetFloorHeight(GetFloor(x, y, z, &roomNumber), x, y, z);
|
||||
TestTriggers(TriggerIndex, heavy, flags);
|
||||
TestTriggers(item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, heavy, NULL);
|
||||
}
|
||||
|
||||
void TestTriggers(int x, int y, int z, short roomNumber, bool heavy, int heavyFlags)
|
||||
{
|
||||
auto roomNum = roomNumber;
|
||||
auto floor = GetFloor(x, y, z, &roomNum);
|
||||
|
||||
// Don't process legacy triggers if trigger triggerer wasn't used
|
||||
if (floor->Flags.MarkTriggerer && !floor->Flags.MarkTriggererActive)
|
||||
return;
|
||||
|
||||
TestTriggers(GetTriggerIndex(floor, x, y, z), heavy, heavyFlags);
|
||||
}
|
||||
|
||||
void ProcessSectorFlags(ITEM_INFO* item)
|
||||
{
|
||||
ProcessSectorFlags(GetCollisionResult(item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber).BottomBlock);
|
||||
}
|
||||
|
||||
void ProcessSectorFlags(int x, int y, int z, short roomNumber)
|
||||
{
|
||||
ProcessSectorFlags(GetCollisionResult(x, y, z, roomNumber).BottomBlock);
|
||||
}
|
||||
|
||||
void ProcessSectorFlags(FLOOR_INFO* floor)
|
||||
{
|
||||
// Monkeyswing
|
||||
Lara.canMonkeySwing = floor->Flags.Monkeyswing;
|
||||
|
||||
// Burn Lara
|
||||
if (floor->Flags.Death && (LaraItem->pos.yPos == LaraItem->floor || Lara.waterStatus))
|
||||
LavaBurn(LaraItem);
|
||||
|
||||
// Set climb status
|
||||
if ((1 << (GetQuadrant(LaraItem->pos.yRot) + 8)) & GetClimbFlags(floor))
|
||||
Lara.climbStatus = true;
|
||||
}
|
||||
|
||||
void ResetGlobals()
|
||||
|
|
|
@ -62,7 +62,6 @@ enum COMMAND_TYPES
|
|||
#define OUTSIDE_SIZE 108
|
||||
|
||||
extern int KeyTriggerActive;
|
||||
extern byte IsAtmospherePlaying;
|
||||
extern byte FlipStatus;
|
||||
|
||||
constexpr auto MAX_FLIPMAP = 255;
|
||||
|
@ -76,7 +75,6 @@ extern short NextFxActive;
|
|||
extern short NextFxFree;
|
||||
extern short NextItemActive;
|
||||
extern short NextItemFree;
|
||||
extern short* TriggerIndex;
|
||||
extern int DisableLaraControl;
|
||||
extern int WeatherType;
|
||||
extern int LaraDrawType;
|
||||
|
@ -90,7 +88,6 @@ extern short CurrentRoom;
|
|||
extern int GameTimer;
|
||||
extern short GlobalCounter;
|
||||
extern byte LevelComplete;
|
||||
extern short DelCutSeqPlayer;
|
||||
#ifndef NEW_INV
|
||||
extern int LastInventoryItem;
|
||||
#endif
|
||||
|
@ -100,37 +97,27 @@ extern int InitialiseGame;
|
|||
extern int RequiredStartPos;
|
||||
extern int WeaponDelay;
|
||||
extern int WeaponEnemyTimer;
|
||||
extern HEIGHT_TYPES HeightType;
|
||||
extern int HeavyTriggered;
|
||||
extern short SkyPos1;
|
||||
extern short SkyPos2;
|
||||
extern CVECTOR SkyColor1;
|
||||
extern CVECTOR SkyColor2;
|
||||
extern int CutSeqNum;
|
||||
extern int CutSeqTriggered;
|
||||
extern int GlobalPlayingCutscene;
|
||||
extern int CurrentLevel;
|
||||
extern bool SoundActive;
|
||||
extern bool DoTheGame;
|
||||
extern bool ThreadEnded;
|
||||
extern int OnFloor;
|
||||
extern int SmokeWindX;
|
||||
extern int SmokeWindZ;
|
||||
extern int OnObject;
|
||||
extern int KillEverythingFlag;
|
||||
extern int FlipTimer;
|
||||
extern int FlipEffect;
|
||||
extern int TriggerTimer;
|
||||
extern int JustLoaded;
|
||||
extern int PoisonFlags;
|
||||
extern int OldLaraBusy;
|
||||
extern int Infrared;
|
||||
extern short FlashFadeR;
|
||||
extern short FlashFadeG;
|
||||
extern short FlashFadeB;
|
||||
extern short FlashFader;
|
||||
extern int TiltXOffset;
|
||||
extern int TiltYOffset;
|
||||
extern std::vector<short> OutsideRoomTable[OUTSIDE_SIZE][OUTSIDE_SIZE];
|
||||
extern short IsRoomOutsideNo;
|
||||
extern bool g_CollidedVolume;
|
||||
|
@ -142,7 +129,6 @@ void UpdateSky();
|
|||
void AnimateWaterfalls();
|
||||
short GetDoor(FLOOR_INFO* floor);
|
||||
void TranslateItem(ITEM_INFO* item, int x, int y, int z);
|
||||
void TestTriggers(short* data, int heavy, int HeavyFlags);
|
||||
int GetWaterSurface(int x, int y, int z, short roomNumber);
|
||||
void KillMoveItems();
|
||||
void KillMoveEffects();
|
||||
|
@ -151,6 +137,8 @@ void AlterFloorHeight(ITEM_INFO* item, int height);
|
|||
int CheckNoColCeilingTriangle(FLOOR_INFO* floor, int x, int z);
|
||||
int CheckNoColFloorTriangle(FLOOR_INFO* floor, int x, int z);
|
||||
int GetFloorHeight(FLOOR_INFO* floor, int x, int y, int z);
|
||||
short* GetTriggerIndex(FLOOR_INFO* floor, int x, int y, int z);
|
||||
short* GetTriggerIndex(ITEM_INFO* item);
|
||||
FLOOR_INFO* GetFloor(int x, int y, int z, short* roomNumber);
|
||||
//void UpdateDebris();
|
||||
int LOS(GAME_VECTOR* start, GAME_VECTOR* end);
|
||||
|
@ -176,7 +164,13 @@ int GetWaterHeight(int x, int y, int z, short roomNumber);
|
|||
int is_object_in_room(short roomNumber, short objectNumber);
|
||||
void InterpolateAngle(short angle, short* rotation, short* outAngle, int shift);
|
||||
int IsRoomOutside(int x, int y, int z);
|
||||
void TestTriggersAtXYZ(int x, int y, int z, short roomNumber, int heavy, int flags);
|
||||
|
||||
void TestTriggers(short* data, bool heavy, int heavyFlags);
|
||||
void TestTriggers(int x, int y, int z, short roomNumber, bool heavy, int heavyFlags);
|
||||
void TestTriggers(ITEM_INFO* item, bool heavy, int heavyFlags);
|
||||
void ProcessSectorFlags(FLOOR_INFO* floor);
|
||||
void ProcessSectorFlags(int x, int y, int z, short roomNumber);
|
||||
void ProcessSectorFlags(ITEM_INFO* item);
|
||||
void ResetGlobals();
|
||||
|
||||
unsigned CALLBACK GameMain(void*);
|
|
@ -68,7 +68,7 @@ void SequenceDoorControl(short itemNumber)
|
|||
else
|
||||
item->goalAnimState = 0;
|
||||
|
||||
TestTriggersAtXYZ(item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, TRUE, 0);
|
||||
TestTriggers(item, true, NULL);
|
||||
}
|
||||
|
||||
CurrentSequence = 4;
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
#pragma once
|
||||
#include "items.h"
|
||||
#include "control.h"
|
||||
|
||||
#define EffectFunction void(ITEM_INFO* item)
|
||||
|
||||
struct FX_INFO
|
||||
{
|
||||
PHD_3DPOS pos;
|
||||
short roomNumber;
|
||||
short objectNumber;
|
||||
short nextFx;
|
||||
short nextActive;
|
||||
short speed;
|
||||
short fallspeed;
|
||||
short frameNumber;
|
||||
short counter;
|
||||
short shade;
|
||||
short flag1;
|
||||
short flag2;
|
||||
};
|
||||
|
||||
extern std::function<EffectFunction> effect_routines[];
|
||||
extern FX_INFO* EffectList;
|
||||
|
||||
bool ItemNearLara(PHD_3DPOS* pos, int radius);
|
||||
bool ItemNearTarget(PHD_3DPOS* src, ITEM_INFO* target, int radius);
|
||||
void StopSoundEffect(short sampleIndex);
|
||||
short DoBloodSplat(int x, int y, int z, short speed, short yRot, short roomNumber);
|
||||
void AddFootprint(ITEM_INFO* item);
|
||||
void ControlWaterfallMist(short itemNumber);
|
||||
void void_effect(ITEM_INFO* item);
|
||||
void finish_level_effect(ITEM_INFO* item);
|
||||
void turn180_effect(ITEM_INFO* item);
|
||||
void floor_shake_effect(ITEM_INFO* item);
|
||||
void SoundFlipEffect(ITEM_INFO* item);
|
||||
void RubbleFX(ITEM_INFO* item);
|
||||
void PoseidonSFX(ITEM_INFO* item);
|
||||
void ActivateCamera(ITEM_INFO* item);
|
||||
void ActivateKey(ITEM_INFO* item);
|
||||
void SwapCrowbar(ITEM_INFO* item);
|
||||
void ExplosionFX(ITEM_INFO* item);
|
||||
void LaraLocation(ITEM_INFO* item);
|
||||
void LaraLocationPad(ITEM_INFO* item);
|
||||
void KillActiveBaddies(ITEM_INFO* item);
|
||||
void lara_hands_free(ITEM_INFO* item);
|
||||
void shoot_right_gun(ITEM_INFO* item);
|
||||
void shoot_left_gun(ITEM_INFO* item);
|
||||
void SetFog(ITEM_INFO* item);
|
||||
void invisibility_on(ITEM_INFO* item);
|
||||
void invisibility_off(ITEM_INFO* item);
|
||||
void reset_hair(ITEM_INFO* item);
|
||||
void Richochet(PHD_3DPOS* pos);
|
||||
void DoLotsOfBlood(int x, int y, int z, int speed, short direction, short roomNumber, int count);
|
||||
void pickup(ITEM_INFO* item);
|
||||
void puzzle(ITEM_INFO* item);
|
||||
void draw_right_pistol(ITEM_INFO* item);
|
||||
void draw_left_pistol(ITEM_INFO* item);
|
||||
void MeshSwapToPour(ITEM_INFO* item);
|
||||
void MeshSwapFromPour(ITEM_INFO* item);
|
|
@ -1,7 +1,7 @@
|
|||
#include "framework.h"
|
||||
#include "effect2.h"
|
||||
#include "draw.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "lara.h"
|
||||
#include "tomb4fx.h"
|
||||
#include "traps.h"
|
||||
|
@ -17,11 +17,15 @@
|
|||
#include <Game\bubble.h>
|
||||
#include "smoke.h"
|
||||
#include "prng.h"
|
||||
|
||||
using ten::renderer::g_Renderer;
|
||||
using ten::Effects::Explosion::TriggerExplosion;
|
||||
using namespace ten::Effects::Spark;
|
||||
using namespace ten::Math::Random;
|
||||
|
||||
short FXType;
|
||||
FX_INFO* EffectList;
|
||||
|
||||
int NextSpark;
|
||||
int DeadlyBounds[6];
|
||||
SPLASH_SETUP SplashSetup;
|
||||
|
@ -1048,11 +1052,78 @@ void SetupRipple(int x, int y, int z, float size, char flags,unsigned int sprite
|
|||
}
|
||||
}
|
||||
|
||||
short DoBloodSplat(int x, int y, int z, short a4, short a5, short roomNumber)
|
||||
{
|
||||
short roomNum = roomNumber;
|
||||
GetFloor(x, y, z, &roomNum);
|
||||
if (g_Level.Rooms[roomNum].flags & ENV_FLAG_WATER)
|
||||
TriggerUnderwaterBlood(x, y, z, a4);
|
||||
else
|
||||
TriggerBlood(x, y, z, a5 / 16, a4);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DoLotsOfBlood(int x, int y, int z, int speed, short direction, short roomNumber, int count)
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
DoBloodSplat(x + 256 - (GetRandomControl() * 512 / 0x8000),
|
||||
y + 256 - (GetRandomControl() * 512 / 0x8000),
|
||||
z + 256 - (GetRandomControl() * 512 / 0x8000),
|
||||
speed, direction, roomNumber);
|
||||
}
|
||||
}
|
||||
|
||||
void TriggerLaraBlood()
|
||||
{
|
||||
int i;
|
||||
int node = 1;
|
||||
|
||||
for (i = 0; i < LARA_MESHES::LM_HEAD; i++)
|
||||
{
|
||||
if (node & LaraItem->touchBits)
|
||||
{
|
||||
PHD_VECTOR vec;
|
||||
vec.x = (GetRandomControl() & 31) - 16;
|
||||
vec.y = (GetRandomControl() & 31) - 16;
|
||||
vec.z = (GetRandomControl() & 31) - 16;
|
||||
|
||||
GetLaraJointPosition(&vec, (LARA_MESHES)i);
|
||||
DoBloodSplat(vec.x, vec.y, vec.z, (GetRandomControl() & 7) + 8, 2 * GetRandomControl(), LaraItem->roomNumber);
|
||||
}
|
||||
|
||||
node *= 2;
|
||||
}
|
||||
}
|
||||
|
||||
void TriggerUnderwaterBlood(int x, int y, int z, int sizeme)
|
||||
{
|
||||
SetupRipple(x, y, z, sizeme, RIPPLE_FLAG_BLOOD | RIPPLE_FLAG_RAND_POS | RIPPLE_FLAG_RAND_ROT, Objects[ID_DEFAULT_SPRITES].meshIndex + SPR_BLOOD);
|
||||
}
|
||||
|
||||
void Richochet(PHD_3DPOS* pos)
|
||||
{
|
||||
short angle = mGetAngle(pos->zPos, pos->xPos, LaraItem->pos.zPos, LaraItem->pos.xPos);
|
||||
GAME_VECTOR target;
|
||||
target.x = pos->xPos;
|
||||
target.y = pos->yPos;
|
||||
target.z = pos->zPos;
|
||||
TriggerRicochetSpark(&target, angle / 16, 3, 0);
|
||||
SoundEffect(SFX_TR4_LARA_RICOCHET, pos, 0);
|
||||
}
|
||||
|
||||
void ControlWaterfallMist(short itemNumber) // ControlWaterfallMist
|
||||
{
|
||||
ITEM_INFO* item = &g_Level.Items[itemNumber];
|
||||
int x, z;
|
||||
|
||||
x = item->pos.xPos - phd_sin(item->pos.yRot + ANGLE(180)) * 512 + phd_sin(item->pos.yRot - ANGLE(90)) * 256;
|
||||
z = item->pos.zPos - phd_cos(item->pos.yRot + ANGLE(180)) * 512 + phd_cos(item->pos.yRot - ANGLE(90)) * 256;
|
||||
|
||||
TriggerWaterfallMist(x, item->pos.yPos, z, item->pos.yRot + ANGLE(180));
|
||||
SoundEffect(SFX_TR4_WATERFALL_LOOP, &item->pos, 0);
|
||||
}
|
||||
|
||||
void TriggerWaterfallMist(int x, int y, int z, int angle)
|
||||
{
|
||||
SPARKS* spark;
|
||||
|
@ -1204,7 +1275,7 @@ void TriggerDartSmoke(int x, int y, int z, int xv, int zv, int hit)
|
|||
|
||||
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)
|
||||
|
@ -1794,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void KillEverything()
|
||||
{
|
||||
KillEverythingFlag = 0;
|
||||
}
|
|
@ -47,6 +47,22 @@ enum FireSizeEnum
|
|||
SP_BIGFIRE
|
||||
};
|
||||
|
||||
struct FX_INFO
|
||||
{
|
||||
PHD_3DPOS pos;
|
||||
short roomNumber;
|
||||
short objectNumber;
|
||||
short nextFx;
|
||||
short nextActive;
|
||||
short speed;
|
||||
short fallspeed;
|
||||
short frameNumber;
|
||||
short counter;
|
||||
short shade;
|
||||
short flag1;
|
||||
short flag2;
|
||||
};
|
||||
|
||||
struct NODEOFFSET_INFO
|
||||
{
|
||||
short x;
|
||||
|
@ -179,6 +195,8 @@ extern int SplashCount;
|
|||
extern PHD_VECTOR NodeVectors[MAX_NODE];
|
||||
extern NODEOFFSET_INFO NodeOffsets[MAX_NODE];
|
||||
|
||||
extern FX_INFO* EffectList;
|
||||
|
||||
void DetatchSpark(int num, SpriteEnumFlag type);
|
||||
int GetFreeSpark();
|
||||
void UpdateSparks();
|
||||
|
@ -192,12 +210,15 @@ void TriggerSuperJetFlame(ITEM_INFO* item, int yvel, int deadly);
|
|||
void SetupSplash(const SPLASH_SETUP* const setup,int room);
|
||||
void UpdateSplashes();
|
||||
void SetupRipple(int x, int y, int z, float size, char flags,unsigned int spriteID,float rotation = 0);
|
||||
void TriggerLaraBlood();
|
||||
short DoBloodSplat(int x, int y, int z, short speed, short yRot, short roomNumber);
|
||||
void DoLotsOfBlood(int x, int y, int z, int speed, short direction, short roomNumber, int count);
|
||||
void TriggerUnderwaterBlood(int x, int y, int z, int sizeme);
|
||||
void ControlWaterfallMist(short itemNumber);
|
||||
void TriggerWaterfallMist(int x, int y, int z, int angle);
|
||||
void TriggerDartSmoke(int x, int y, int z, int xv, int zv, int hit);
|
||||
void KillAllCurrentItems(short itemNumber);
|
||||
void TriggerDynamicLight(int x, int y, int z, short falloff, byte r, byte g, byte b);
|
||||
void ClearDynamicLights();
|
||||
void TriggerRocketFlame(int x, int y, int z, int xv, int yv, int zv, int itemNumber);
|
||||
void TriggerRocketSmoke(int x, int y, int z, int bodyPart);
|
||||
void TriggerFireFlame(int x, int y, int z, int flag1, int flag2);
|
||||
|
@ -206,4 +227,5 @@ void TriggerMetalSparks(int x, int y, int z, int xv, int yv, int zv, int additio
|
|||
void WadeSplash(ITEM_INFO* item, int wh, int wd);
|
||||
void Splash(ITEM_INFO* item);
|
||||
void TriggerRocketFire(int x, int y, int z);
|
||||
void TriggerExplosionBubbles(int x, int y, int z, short roomNumber);
|
||||
void TriggerExplosionBubbles(int x, int y, int z, short roomNumber);
|
||||
void Richochet(PHD_3DPOS* pos);
|
|
@ -1,6 +1,6 @@
|
|||
#include "framework.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "flipeffect.h"
|
||||
#include "Lara.h"
|
||||
#include "lot.h"
|
||||
#include "tomb4fx.h"
|
||||
|
@ -23,57 +23,53 @@
|
|||
#include "lara_fire.h"
|
||||
|
||||
using std::function;
|
||||
constexpr auto ITEM_RADIUS_YMAX = SECTOR(3);
|
||||
using namespace ten::Effects::Footprints;
|
||||
|
||||
short FXType;
|
||||
FX_INFO* EffectList;
|
||||
|
||||
function<EffectFunction> effect_routines[59] =
|
||||
{
|
||||
turn180_effect, //0
|
||||
floor_shake_effect, //1
|
||||
Turn180, //0
|
||||
FloorShake, //1
|
||||
PoseidonSFX, //2
|
||||
LaraBubbles, //3
|
||||
finish_level_effect, //4
|
||||
FinishLevel, //4
|
||||
ActivateCamera, //5
|
||||
ActivateKey, //6
|
||||
RubbleFX, //7
|
||||
SwapCrowbar, //8
|
||||
pickup, //9
|
||||
SoundFlipEffect, //10
|
||||
Pickup, //9
|
||||
PlaySoundEffect, //10
|
||||
ExplosionFX, //11
|
||||
lara_hands_free, //12
|
||||
puzzle, //13
|
||||
draw_right_pistol, //14
|
||||
draw_left_pistol, //15
|
||||
shoot_right_gun, //16
|
||||
shoot_left_gun, //17
|
||||
pushLoop, //18
|
||||
pushEnd, //19
|
||||
void_effect, //20
|
||||
invisibility_on, //21
|
||||
invisibility_off, //22
|
||||
void_effect, //23
|
||||
void_effect, //24
|
||||
void_effect, //25
|
||||
reset_hair, //26
|
||||
void_effect, //27
|
||||
LaraHandsFree, //12
|
||||
Puzzle, //13
|
||||
DrawRightPistol, //14
|
||||
DrawLeftPistol, //15
|
||||
ShootRightGun, //16
|
||||
ShootLeftGun, //17
|
||||
PushLoop, //18
|
||||
PushEnd, //19
|
||||
VoidEffect, //20
|
||||
InvisibilityOn, //21
|
||||
InvisibilityOff, //22
|
||||
VoidEffect, //23
|
||||
VoidEffect, //24
|
||||
VoidEffect, //25
|
||||
ResetHair, //26
|
||||
VoidEffect, //27
|
||||
SetFog, //28
|
||||
void_effect, //29
|
||||
VoidEffect, //29
|
||||
LaraLocation, //30
|
||||
ClearSpidersPatch, //31
|
||||
AddFootprint, //32
|
||||
void_effect, //33
|
||||
void_effect, //34
|
||||
void_effect, //35
|
||||
void_effect, //36
|
||||
void_effect, //37
|
||||
void_effect, //38
|
||||
void_effect, //39
|
||||
void_effect, //40
|
||||
void_effect, //41
|
||||
void_effect, //42
|
||||
VoidEffect, //33
|
||||
VoidEffect, //34
|
||||
VoidEffect, //35
|
||||
VoidEffect, //36
|
||||
VoidEffect, //37
|
||||
VoidEffect, //38
|
||||
VoidEffect, //39
|
||||
VoidEffect, //40
|
||||
VoidEffect, //41
|
||||
VoidEffect, //42
|
||||
MeshSwapToPour, //43
|
||||
MeshSwapFromPour, //44
|
||||
LaraLocationPad, //45
|
||||
|
@ -90,12 +86,12 @@ void MeshSwapFromPour(ITEM_INFO* item)
|
|||
Lara.meshPtrs[LM_LHAND] = Objects[ID_LARA_SKIN].meshIndex + LM_LHAND;
|
||||
}
|
||||
|
||||
void pickup(ITEM_INFO* item)
|
||||
void Pickup(ITEM_INFO* item)
|
||||
{
|
||||
do_pickup();
|
||||
}
|
||||
|
||||
void puzzle(ITEM_INFO* item)
|
||||
void Puzzle(ITEM_INFO* item)
|
||||
{
|
||||
do_puzzle();
|
||||
}
|
||||
|
@ -138,17 +134,17 @@ void AddFootprint(ITEM_INFO* item)
|
|||
}
|
||||
}
|
||||
|
||||
void reset_hair(ITEM_INFO* item)
|
||||
void ResetHair(ITEM_INFO* item)
|
||||
{
|
||||
InitialiseHair();
|
||||
}
|
||||
|
||||
void invisibility_off(ITEM_INFO* item)
|
||||
void InvisibilityOff(ITEM_INFO* item)
|
||||
{
|
||||
item->status = ITEM_ACTIVE;
|
||||
}
|
||||
|
||||
void invisibility_on(ITEM_INFO* item)
|
||||
void InvisibilityOn(ITEM_INFO* item)
|
||||
{
|
||||
item->status = ITEM_INVISIBLE;
|
||||
}
|
||||
|
@ -158,7 +154,7 @@ void SetFog(ITEM_INFO* item)
|
|||
FlipEffect = -1;
|
||||
}
|
||||
|
||||
void draw_left_pistol(ITEM_INFO* item)
|
||||
void DrawLeftPistol(ITEM_INFO* item)
|
||||
{
|
||||
if (Lara.meshPtrs[LM_LHAND] == Objects[ID_LARA_SKIN].meshIndex + LM_LHAND)
|
||||
{
|
||||
|
@ -172,7 +168,7 @@ void draw_left_pistol(ITEM_INFO* item)
|
|||
}
|
||||
}
|
||||
|
||||
void draw_right_pistol(ITEM_INFO* item)
|
||||
void DrawRightPistol(ITEM_INFO* item)
|
||||
{
|
||||
if (Lara.meshPtrs[LM_RHAND] == Objects[ID_LARA_SKIN].meshIndex + LM_RHAND)
|
||||
{
|
||||
|
@ -186,17 +182,17 @@ void draw_right_pistol(ITEM_INFO* item)
|
|||
}
|
||||
}
|
||||
|
||||
void shoot_left_gun(ITEM_INFO* item)
|
||||
void ShootLeftGun(ITEM_INFO* item)
|
||||
{
|
||||
Lara.leftArm.flash_gun = 3;
|
||||
}
|
||||
|
||||
void shoot_right_gun(ITEM_INFO* item)
|
||||
void ShootRightGun(ITEM_INFO* item)
|
||||
{
|
||||
Lara.rightArm.flash_gun = 3;
|
||||
}
|
||||
|
||||
void lara_hands_free(ITEM_INFO* item)
|
||||
void LaraHandsFree(ITEM_INFO* item)
|
||||
{
|
||||
Lara.gunStatus = LG_NO_ARMS;
|
||||
}
|
||||
|
@ -299,13 +295,13 @@ void RubbleFX(ITEM_INFO* item)
|
|||
FlipEffect = -1;
|
||||
}
|
||||
|
||||
void SoundFlipEffect(ITEM_INFO* item)
|
||||
void PlaySoundEffect(ITEM_INFO* item)
|
||||
{
|
||||
SoundEffect(TriggerTimer, NULL, 0);
|
||||
FlipEffect = -1;
|
||||
}
|
||||
|
||||
void floor_shake_effect(ITEM_INFO* item)
|
||||
void FloorShake(ITEM_INFO* item)
|
||||
{
|
||||
int x = abs(item->pos.xPos - Camera.pos.x);
|
||||
int y = abs(item->pos.yPos - Camera.pos.y);
|
||||
|
@ -317,115 +313,18 @@ void floor_shake_effect(ITEM_INFO* item)
|
|||
}
|
||||
}
|
||||
|
||||
void turn180_effect(ITEM_INFO* item)
|
||||
void Turn180(ITEM_INFO* item)
|
||||
{
|
||||
item->pos.yRot -= ANGLE(180);
|
||||
item->pos.xRot = -item->pos.xRot;
|
||||
}
|
||||
|
||||
void finish_level_effect(ITEM_INFO* item)
|
||||
void FinishLevel(ITEM_INFO* item)
|
||||
{
|
||||
LevelComplete = CurrentLevel + 1;
|
||||
}
|
||||
|
||||
void void_effect(ITEM_INFO* item)
|
||||
void VoidEffect(ITEM_INFO* item)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ControlWaterfallMist(short itemNumber) // ControlWaterfallMist
|
||||
{
|
||||
ITEM_INFO* item = &g_Level.Items[itemNumber];
|
||||
int x, z;
|
||||
|
||||
x = item->pos.xPos - phd_sin(item->pos.yRot + ANGLE(180)) * 512 + phd_sin(item->pos.yRot - ANGLE(90)) * 256;
|
||||
z = item->pos.zPos - phd_cos(item->pos.yRot + ANGLE(180)) * 512 + phd_cos(item->pos.yRot - ANGLE(90)) * 256;
|
||||
|
||||
TriggerWaterfallMist(x, item->pos.yPos, z, item->pos.yRot + ANGLE(180));
|
||||
SoundEffect(SFX_TR4_WATERFALL_LOOP, &item->pos, 0);
|
||||
}
|
||||
|
||||
short DoBloodSplat(int x, int y, int z, short a4, short a5, short roomNumber)
|
||||
{
|
||||
short roomNum = roomNumber;
|
||||
GetFloor(x, y, z, &roomNum);
|
||||
if (g_Level.Rooms[roomNum].flags & ENV_FLAG_WATER)
|
||||
TriggerUnderwaterBlood(x, y, z, a4);
|
||||
else
|
||||
TriggerBlood(x, y, z, a5 / 16, a4);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool ItemCollide(int value, int radius)
|
||||
{
|
||||
return value >= -radius && value <= radius;
|
||||
}
|
||||
|
||||
static bool ItemInRange(int x, int z, int radius)
|
||||
{
|
||||
return (SQUARE(x) + SQUARE(z)) <= SQUARE(radius);
|
||||
}
|
||||
|
||||
bool ItemNearLara(PHD_3DPOS* pos, int radius)
|
||||
{
|
||||
BOUNDING_BOX* bounds;
|
||||
GAME_VECTOR target;
|
||||
target.x = pos->xPos - LaraItem->pos.xPos;
|
||||
target.y = pos->yPos - LaraItem->pos.yPos;
|
||||
target.z = pos->zPos - LaraItem->pos.zPos;
|
||||
if (!ItemCollide(target.y, ITEM_RADIUS_YMAX))
|
||||
return false;
|
||||
if (!ItemCollide(target.x, radius) || !ItemCollide(target.z, radius))
|
||||
return false;
|
||||
if (!ItemInRange(target.x, target.z, radius))
|
||||
return false;
|
||||
|
||||
bounds = GetBoundsAccurate(LaraItem);
|
||||
if (target.y >= bounds->Y1 && target.y <= (bounds->Y2 + LARA_RAD))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ItemNearTarget(PHD_3DPOS* src, ITEM_INFO* target, int radius)
|
||||
{
|
||||
BOUNDING_BOX* bounds;
|
||||
PHD_VECTOR pos;
|
||||
pos.x = src->xPos - target->pos.xPos;
|
||||
pos.y = src->yPos - target->pos.yPos;
|
||||
pos.z = src->zPos - target->pos.zPos;
|
||||
if (!ItemCollide(pos.y, ITEM_RADIUS_YMAX))
|
||||
return false;
|
||||
if (!ItemCollide(pos.x, radius) || !ItemCollide(pos.z, radius))
|
||||
return false;
|
||||
if (!ItemInRange(pos.x, pos.z, radius))
|
||||
return false;
|
||||
|
||||
bounds = GetBoundsAccurate(target);
|
||||
if (pos.y >= bounds->Y1 && pos.y <= bounds->Y2)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Richochet(PHD_3DPOS* pos)
|
||||
{
|
||||
short angle = mGetAngle(pos->zPos, pos->xPos, LaraItem->pos.zPos, LaraItem->pos.xPos);
|
||||
GAME_VECTOR target;
|
||||
target.x = pos->xPos;
|
||||
target.y = pos->yPos;
|
||||
target.z = pos->zPos;
|
||||
TriggerRicochetSpark(&target, angle / 16, 3, 0);
|
||||
SoundEffect(SFX_TR4_LARA_RICOCHET, pos, 0);
|
||||
}
|
||||
|
||||
void DoLotsOfBlood(int x, int y, int z, int speed, short direction, short roomNumber, int count)
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
DoBloodSplat(x + 256 - (GetRandomControl() * 512 / 0x8000),
|
||||
y + 256 - (GetRandomControl() * 512 / 0x8000),
|
||||
z + 256 - (GetRandomControl() * 512 / 0x8000),
|
||||
speed, direction, roomNumber);
|
||||
}
|
||||
}
|
36
TR5Main/Game/flipeffect.h
Normal file
36
TR5Main/Game/flipeffect.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
#pragma once
|
||||
#include "items.h"
|
||||
#include "control.h"
|
||||
|
||||
#define EffectFunction void(ITEM_INFO* item)
|
||||
|
||||
extern std::function<EffectFunction> effect_routines[];
|
||||
|
||||
void AddFootprint(ITEM_INFO* item);
|
||||
void VoidEffect(ITEM_INFO* item);
|
||||
void FinishLevel(ITEM_INFO* item);
|
||||
void Turn180(ITEM_INFO* item);
|
||||
void FloorShake(ITEM_INFO* item);
|
||||
void PlaySoundEffect(ITEM_INFO* item);
|
||||
void RubbleFX(ITEM_INFO* item);
|
||||
void PoseidonSFX(ITEM_INFO* item);
|
||||
void ActivateCamera(ITEM_INFO* item);
|
||||
void ActivateKey(ITEM_INFO* item);
|
||||
void SwapCrowbar(ITEM_INFO* item);
|
||||
void ExplosionFX(ITEM_INFO* item);
|
||||
void LaraLocation(ITEM_INFO* item);
|
||||
void LaraLocationPad(ITEM_INFO* item);
|
||||
void KillActiveBaddies(ITEM_INFO* item);
|
||||
void LaraHandsFree(ITEM_INFO* item);
|
||||
void ShootRightGun(ITEM_INFO* item);
|
||||
void ShootLeftGun(ITEM_INFO* item);
|
||||
void SetFog(ITEM_INFO* item);
|
||||
void InvisibilityOn(ITEM_INFO* item);
|
||||
void InvisibilityOff(ITEM_INFO* item);
|
||||
void ResetHair(ITEM_INFO* item);
|
||||
void Pickup(ITEM_INFO* item);
|
||||
void Puzzle(ITEM_INFO* item);
|
||||
void DrawRightPistol(ITEM_INFO* item);
|
||||
void DrawLeftPistol(ITEM_INFO* item);
|
||||
void MeshSwapToPour(ITEM_INFO* item);
|
||||
void MeshSwapFromPour(ITEM_INFO* item);
|
|
@ -222,7 +222,8 @@ void TorchControl(short itemNumber)
|
|||
|
||||
item->pos.yPos += item->fallspeed;
|
||||
|
||||
DoProperDetection(itemNumber, oldX, oldY, oldZ, xv, item->fallspeed, zv);
|
||||
DoProjectileDynamics(itemNumber, oldX, oldY, oldZ, xv, item->fallspeed, zv);
|
||||
|
||||
if (GetCollidedObjects(item, 0, 1, CollidedItems, CollidedMeshes, 0))
|
||||
{
|
||||
lara_coll.enableBaddiePush = true;
|
||||
|
@ -331,7 +332,7 @@ void FireCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll)
|
|||
{
|
||||
if (l->frameNumber - g_Level.Anims[l->animNumber].frameBase == 40)
|
||||
{
|
||||
TestTriggersAtXYZ(item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, 1, item->flags & 0x3E00);
|
||||
TestTriggers(item, true, item->flags & IFLAG_ACTIVATION_MASK);
|
||||
item->flags |= 0x3E00;
|
||||
item->itemFlags[3] = 0;
|
||||
item->status = ITEM_ACTIVE;
|
||||
|
|
|
@ -9,6 +9,20 @@ struct SECTOR_COLLISION_INFO
|
|||
Vector3 Planes[2];
|
||||
};
|
||||
|
||||
struct SECTOR_FLAGS
|
||||
{
|
||||
bool Death;
|
||||
bool Monkeyswing;
|
||||
bool ClimbNorth;
|
||||
bool ClimbSouth;
|
||||
bool ClimbWest;
|
||||
bool ClimbEast;
|
||||
bool MarkBeetle;
|
||||
|
||||
bool MarkTriggerer;
|
||||
bool MarkTriggererActive; // TODO: IT NEEDS TO BE WRITTEN/READ FROM SAVEGAMES!
|
||||
};
|
||||
|
||||
class FLOOR_INFO
|
||||
{
|
||||
public:
|
||||
|
@ -22,6 +36,7 @@ public:
|
|||
int ceiling;
|
||||
SECTOR_COLLISION_INFO FloorCollision;
|
||||
SECTOR_COLLISION_INFO CeilingCollision;
|
||||
SECTOR_FLAGS Flags;
|
||||
int WallPortal;
|
||||
std::set<short> BridgeItem;
|
||||
int Room;
|
||||
|
|
|
@ -32,11 +32,11 @@ void DrawHealthBarOverlay(int value)
|
|||
if (CurrentLevel)
|
||||
{
|
||||
int color2 = 0;
|
||||
if (Lara.poisoned || Lara.gassed)
|
||||
if (Lara.poisoned)
|
||||
color2 = 0xA0A000;
|
||||
else
|
||||
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)
|
||||
{
|
||||
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
|
||||
DrawAirBar(air / 1800.0f);
|
||||
|
||||
if (Lara.gassed)
|
||||
{
|
||||
if (Lara.dpoisoned < 2048)
|
||||
Lara.dpoisoned += 2;
|
||||
Lara.gassed = false;
|
||||
}
|
||||
}
|
||||
|
||||
void DrawDashBar(int value)
|
||||
|
|
|
@ -1879,7 +1879,6 @@ int Inventory::DoTitleInventory()
|
|||
}
|
||||
|
||||
CurrentAtmosphere = CDA_XA11_FLYBY1;
|
||||
IsAtmospherePlaying = true;
|
||||
S_CDPlay(CurrentAtmosphere, 1);
|
||||
|
||||
OpenRing(INV_RING_OPTIONS, true);
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
#include "setup.h"
|
||||
#include "level.h"
|
||||
#include "lara.h"
|
||||
#include "effect.h"
|
||||
#include "control.h"
|
||||
#include "effect2.h"
|
||||
|
||||
void ClearItem(short itemNum)
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "missile.h"
|
||||
#include "sound.h"
|
||||
#include "items.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "draw.h"
|
||||
#include "debris.h"
|
||||
#include "level.h"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
|
||||
void ShootAtLara(FX_INFO* fx);
|
||||
void ControlMissile(short fxNumber);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "framework.h"
|
||||
#include "objects.h"
|
||||
#include "items.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "effect2.h"
|
||||
#include "draw.h"
|
||||
#include "Lara.h"
|
||||
|
@ -130,40 +130,13 @@ void ControlTriggerTriggerer(short itemNumber)
|
|||
{
|
||||
ITEM_INFO* item = &g_Level.Items[itemNumber];
|
||||
FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &item->roomNumber);
|
||||
int height = GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos);
|
||||
|
||||
if (TriggerIndex)
|
||||
|
||||
if (floor->Flags.MarkTriggerer)
|
||||
{
|
||||
short* trigger = TriggerIndex;
|
||||
|
||||
if ((*trigger & 0x1F) == 5)
|
||||
{
|
||||
if ((*trigger & 0x8000) != 0)
|
||||
return;
|
||||
trigger++;
|
||||
}
|
||||
|
||||
if ((*trigger & 0x1F) == 6)
|
||||
{
|
||||
if ((*trigger & 0x8000) != 0)
|
||||
return;
|
||||
trigger++;
|
||||
}
|
||||
|
||||
if ((*trigger & 0x1F) == 19)
|
||||
{
|
||||
if ((*trigger & 0x8000) != 0)
|
||||
return;
|
||||
trigger++;
|
||||
}
|
||||
|
||||
if ((*trigger & 0x1F) == 20)
|
||||
{
|
||||
if (TriggerActive(item))
|
||||
*trigger |= 0x20u;
|
||||
else
|
||||
*trigger &= 0xDFu;
|
||||
}
|
||||
if (TriggerActive(item))
|
||||
floor->Flags.MarkTriggererActive = true;
|
||||
else
|
||||
floor->Flags.MarkTriggererActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "framework.h"
|
||||
#include "people.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "effect2.h"
|
||||
#include "draw.h"
|
||||
#include "control.h"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#else
|
||||
#include "inventory.h"
|
||||
#endif
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "effect2.h"
|
||||
#include "control.h"
|
||||
#include "sphere.h"
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "switch.h"
|
||||
#include "pickup.h"
|
||||
#include "draw.h"
|
||||
#include "control.h"
|
||||
#include "puzzles_keys.h"
|
||||
#include "generic_switch.h"
|
||||
|
||||
|
|
|
@ -168,5 +168,4 @@ struct ANIM_STRUCT
|
|||
};
|
||||
|
||||
constexpr auto NUM_ROOMS = 1024;
|
||||
constexpr auto NO_ROOM = -1;
|
||||
constexpr auto NO_HEIGHT = (-0x7F00);
|
||||
constexpr auto NO_ROOM = -1;
|
|
@ -812,10 +812,11 @@ bool SaveGame::readGameStatusChunks(ChunkId* chunkId, int maxSize, int arg)
|
|||
g_Level.Rooms[roomIndex].mesh[staticIndex].y,
|
||||
g_Level.Rooms[roomIndex].mesh[staticIndex].z,
|
||||
&roomIndex);
|
||||
int height = GetFloorHeight(floor, g_Level.Rooms[roomIndex].mesh[staticIndex].x,
|
||||
g_Level.Rooms[roomIndex].mesh[staticIndex].y,
|
||||
g_Level.Rooms[roomIndex].mesh[staticIndex].z);
|
||||
TestTriggers(TriggerIndex, 1, 0);
|
||||
|
||||
TestTriggers(g_Level.Rooms[roomIndex].mesh[staticIndex].x,
|
||||
g_Level.Rooms[roomIndex].mesh[staticIndex].y,
|
||||
g_Level.Rooms[roomIndex].mesh[staticIndex].z, roomIndex, true, NULL);
|
||||
|
||||
floor->stopper = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
#include "setup.h"
|
||||
#include "Renderer11.h"
|
||||
#include "trmath.h"
|
||||
|
||||
using namespace ten::renderer;
|
||||
int NumLaraSpheres;
|
||||
|
||||
bool GotLaraSpheres;
|
||||
SPHERE LaraSpheres[MAX_SPHERES];
|
||||
SPHERE CreatureSpheres[MAX_SPHERES];
|
||||
|
@ -37,19 +38,14 @@ int TestCollision(ITEM_INFO* item, ITEM_INFO* l)
|
|||
{
|
||||
int flags = 0;
|
||||
|
||||
int num1 = GetSpheres(item, CreatureSpheres, SPHERES_SPACE_WORLD, Matrix::Identity);
|
||||
int num2 = 0;
|
||||
int creatureSphereCount = GetSpheres(item, CreatureSpheres, SPHERES_SPACE_WORLD, Matrix::Identity);
|
||||
int laraSphereCount = 0;
|
||||
|
||||
if (l == LaraItem)
|
||||
{
|
||||
if (GotLaraSpheres)
|
||||
if (!GotLaraSpheres)
|
||||
{
|
||||
num2 = NumLaraSpheres;
|
||||
}
|
||||
else
|
||||
{
|
||||
num2 = GetSpheres(l, LaraSpheres, SPHERES_SPACE_WORLD, Matrix::Identity);
|
||||
NumLaraSpheres = num2;
|
||||
laraSphereCount = GetSpheres(l, LaraSpheres, SPHERES_SPACE_WORLD, Matrix::Identity);
|
||||
if (l == LaraItem)
|
||||
GotLaraSpheres = true;
|
||||
}
|
||||
|
@ -58,22 +54,21 @@ int TestCollision(ITEM_INFO* item, ITEM_INFO* l)
|
|||
{
|
||||
GotLaraSpheres = false;
|
||||
|
||||
num2 = GetSpheres(l, LaraSpheres, SPHERES_SPACE_WORLD, Matrix::Identity);
|
||||
NumLaraSpheres = num2;
|
||||
laraSphereCount = GetSpheres(l, LaraSpheres, SPHERES_SPACE_WORLD, Matrix::Identity);
|
||||
if (l == LaraItem)
|
||||
GotLaraSpheres = true;
|
||||
}
|
||||
|
||||
l->touchBits = 0;
|
||||
|
||||
if (num1 <= 0)
|
||||
if (creatureSphereCount <= 0)
|
||||
{
|
||||
item->touchBits = 0;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < num1; i++)
|
||||
for (int i = 0; i < creatureSphereCount; i++)
|
||||
{
|
||||
SPHERE* ptr1 = &CreatureSpheres[i];
|
||||
|
||||
|
@ -84,7 +79,7 @@ int TestCollision(ITEM_INFO* item, ITEM_INFO* l)
|
|||
|
||||
if (r1 > 0)
|
||||
{
|
||||
for (int j = 0; j < num2; j++)
|
||||
for (int j = 0; j < laraSphereCount; j++)
|
||||
{
|
||||
SPHERE* ptr2 = &LaraSpheres[j];
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ struct SPHERE
|
|||
int r;
|
||||
};
|
||||
|
||||
extern int NumLaraSpheres;
|
||||
extern bool GotLaraSpheres;
|
||||
extern SPHERE LaraSpheres[MAX_SPHERES];
|
||||
extern SPHERE CreatureSpheres[MAX_SPHERES];
|
||||
|
|
|
@ -551,12 +551,12 @@ void CalculateSpotCameras()
|
|||
Camera.type = HEAVY_CAMERA;
|
||||
if (CurrentLevel != 0)
|
||||
{
|
||||
TestTriggersAtXYZ(Camera.pos.x, Camera.pos.y, Camera.pos.z, Camera.pos.roomNumber, 1, 0);
|
||||
TestTriggers(Camera.pos.x, Camera.pos.y, Camera.pos.z, Camera.pos.roomNumber, true, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
TestTriggersAtXYZ(Camera.pos.x, Camera.pos.y, Camera.pos.z, Camera.pos.roomNumber, 0, 0);
|
||||
TestTriggersAtXYZ(Camera.pos.x, Camera.pos.y, Camera.pos.z, Camera.pos.roomNumber, 1, 0);
|
||||
TestTriggers(Camera.pos.x, Camera.pos.y, Camera.pos.z, Camera.pos.roomNumber, false, NULL);
|
||||
TestTriggers(Camera.pos.x, Camera.pos.y, Camera.pos.z, Camera.pos.roomNumber, true, NULL);
|
||||
}
|
||||
Camera.type = oldType;
|
||||
CheckTrigger = false;
|
||||
|
@ -745,12 +745,12 @@ void CalculateSpotCameras()
|
|||
Camera.type = HEAVY_CAMERA;
|
||||
if (CurrentLevel)
|
||||
{
|
||||
TestTriggersAtXYZ(Camera.pos.x, Camera.pos.y, Camera.pos.z, Camera.pos.roomNumber, 1, 0);
|
||||
TestTriggers(Camera.pos.x, Camera.pos.y, Camera.pos.z, Camera.pos.roomNumber, true, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
TestTriggersAtXYZ(Camera.pos.x, Camera.pos.y, Camera.pos.z, Camera.pos.roomNumber, 0, 0);
|
||||
TestTriggersAtXYZ(Camera.pos.x, Camera.pos.y, Camera.pos.z, Camera.pos.roomNumber, 1, 0);
|
||||
TestTriggers(Camera.pos.x, Camera.pos.y, Camera.pos.z, Camera.pos.roomNumber, false, NULL);
|
||||
TestTriggers(Camera.pos.x, Camera.pos.y, Camera.pos.z, Camera.pos.roomNumber, true, NULL);
|
||||
}
|
||||
Camera.type = oldType;
|
||||
CheckTrigger = false;
|
||||
|
|
|
@ -27,7 +27,7 @@ void ProcessExplodingSwitchType8(ITEM_INFO* item)
|
|||
pos.y = 0;
|
||||
pos.z = 0;
|
||||
GetJointAbsPosition(item, &pos, 0);
|
||||
TestTriggersAtXYZ(pos.x, pos.y, pos.z, item->roomNumber, 1, 0);
|
||||
TestTriggers(pos.x, pos.y, pos.z, item->roomNumber, true, NULL);
|
||||
ExplodeItemNode(item, Objects[item->objectNumber].nmeshes - 1, 0, 64);
|
||||
item->meshBits |= 1 << ((Objects[item->objectNumber].nmeshes & 0xFF) - 2);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "items.h"
|
||||
#include "effect2.h"
|
||||
#include "tomb4fx.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "lara.h"
|
||||
#include "collide.h"
|
||||
#include "sphere.h"
|
||||
|
@ -565,15 +565,8 @@ void WreckingBallControl(short itemNumber)
|
|||
}
|
||||
if (item->itemFlags[2] < 900)
|
||||
++item->itemFlags[2];
|
||||
if (GlobalPlayingCutscene)
|
||||
{
|
||||
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)
|
||||
|
||||
if (item->itemFlags[1] <= 0)
|
||||
{
|
||||
oldX = item->pos.xPos;
|
||||
oldZ = item->pos.zPos;
|
||||
|
@ -842,7 +835,7 @@ void FlameEmitterCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll)
|
|||
{
|
||||
if (l->frameNumber - g_Level.Anims[l->animNumber].frameBase == 40)
|
||||
{
|
||||
TestTriggersAtXYZ(item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, 1, item->flags & 0x3E00);
|
||||
TestTriggers(item, true, item->flags & IFLAG_ACTIVATION_MASK);
|
||||
|
||||
item->flags |= 0x3E00;
|
||||
item->itemFlags[3] = 0;
|
||||
|
|
|
@ -18,10 +18,13 @@ constexpr auto PI = 3.14159265358979323846f;
|
|||
constexpr auto RADIAN = 0.01745329252f;
|
||||
constexpr auto ONE_DEGREE = 182;
|
||||
constexpr auto PREDICTIVE_SCALE_FACTOR = 14;
|
||||
constexpr auto STEP_SIZE = 256;
|
||||
constexpr auto WALL_SIZE = 1024;
|
||||
constexpr auto STEP_SIZE = WALL_SIZE / 4;
|
||||
constexpr auto STOP_SIZE = WALL_SIZE / 2;
|
||||
constexpr auto STEPUP_HEIGHT = ((STEP_SIZE * 3) / 2);
|
||||
constexpr auto BAD_JUMP_CEILING = ((STEP_SIZE * 3) / 4);
|
||||
constexpr auto NO_HEIGHT = (-0x7F00);
|
||||
constexpr auto MAX_HEIGHT = (-0x7FFF);
|
||||
|
||||
constexpr auto SQUARE = [](auto x) { return x * x; };
|
||||
constexpr auto CLICK = [](auto x) { return STEP_SIZE * x; };
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
#include "traps.h"
|
||||
#include "draw.h"
|
||||
#include "tomb4fx.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "level.h"
|
||||
#include "lara.h"
|
||||
#include "control.h"
|
||||
#include "tr4_mutant.h"
|
||||
|
||||
namespace ten::entities::all
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
#include "items.h"
|
||||
#include "collide.h"
|
||||
#include "control.h"
|
||||
|
||||
void InitialiseTrapDoor(short itemNumber);
|
||||
void TrapDoorCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll);
|
||||
|
|
|
@ -21,19 +21,17 @@ namespace TEN::Entities::Switches
|
|||
|
||||
void CogSwitchCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)
|
||||
{
|
||||
ITEM_INFO* item = &g_Level.Items[itemNum];
|
||||
auto item = &g_Level.Items[itemNum];
|
||||
auto triggerIndex = GetTriggerIndex(item);
|
||||
|
||||
FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &item->roomNumber);
|
||||
GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos);
|
||||
|
||||
if (!TriggerIndex)
|
||||
if (!triggerIndex)
|
||||
{
|
||||
ObjectCollision(itemNum, l, coll);
|
||||
return;
|
||||
}
|
||||
|
||||
short* trigger = TriggerIndex;
|
||||
for (int i = *TriggerIndex; (i & 0x1F) != 4; trigger++)
|
||||
short* trigger = triggerIndex;
|
||||
for (int i = *triggerIndex; (i & 0x1F) != 4; trigger++)
|
||||
{
|
||||
if (i < 0)
|
||||
break;
|
||||
|
|
|
@ -230,13 +230,12 @@ namespace TEN::Entities::Switches
|
|||
|
||||
int GetKeyTrigger(ITEM_INFO* item)
|
||||
{
|
||||
FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &item->roomNumber);
|
||||
GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos);
|
||||
auto triggerIndex = GetTriggerIndex(item);
|
||||
|
||||
if (TriggerIndex)
|
||||
if (triggerIndex)
|
||||
{
|
||||
short* trigger = TriggerIndex;
|
||||
for (short i = *TriggerIndex; (i & 0x1F) != 4; trigger++)
|
||||
short* trigger = triggerIndex;
|
||||
for (short i = *triggerIndex; (i & 0x1F) != 4; trigger++)
|
||||
{
|
||||
if (i < 0)
|
||||
break;
|
||||
|
@ -258,13 +257,12 @@ namespace TEN::Entities::Switches
|
|||
|
||||
int GetSwitchTrigger(ITEM_INFO* item, short* itemNos, int AttatchedToSwitch)
|
||||
{
|
||||
FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &item->roomNumber);
|
||||
GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos);
|
||||
auto triggerIndex = GetTriggerIndex(item);
|
||||
|
||||
if (TriggerIndex)
|
||||
if (triggerIndex)
|
||||
{
|
||||
short* trigger;
|
||||
for (trigger = TriggerIndex; (*trigger & DATA_TYPE) != TRIGGER_TYPE; trigger++)
|
||||
for (trigger = triggerIndex; (*trigger & DATA_TYPE) != TRIGGER_TYPE; trigger++)
|
||||
{
|
||||
if (*trigger & END_BIT)
|
||||
break;
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#include "framework.h"
|
||||
#include "tr1_ape.h"
|
||||
#include "box.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "setup.h"
|
||||
#include "level.h"
|
||||
#include "lara.h"
|
||||
#include "control.h"
|
||||
|
||||
BITE_INFO apeBite = { 0, -19, 75, 15 };
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#include "framework.h"
|
||||
#include "tr1_bear.h"
|
||||
#include "box.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "setup.h"
|
||||
#include "level.h"
|
||||
#include "control.h"
|
||||
#include "lara.h"
|
||||
|
||||
BITE_INFO bearBite = { 0, 96, 335, 14 };
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
#include "framework.h"
|
||||
#include "tr1_bigrat.h"
|
||||
#include "box.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "lara.h"
|
||||
#include "level.h"
|
||||
#include "misc.h"
|
||||
#include "people.h"
|
||||
#include "setup.h"
|
||||
#include "control.h"
|
||||
|
||||
#define BIG_RAT_RUN_TURN ANGLE(6.0f)
|
||||
#define BIG_RAT_SWIM_TURN ANGLE(3.0f)
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "misc.h"
|
||||
#include "level.h"
|
||||
#include "lara.h"
|
||||
#include "control.h"
|
||||
|
||||
// TODO: Evil lara is not targetable and cant move like lara.
|
||||
|
||||
|
@ -121,13 +122,12 @@ void DoppelgangerControl(short itemNum)
|
|||
floor = GetFloor(x, y, z, &room_num);
|
||||
h = GetFloorHeight(floor, x, y, z);
|
||||
item->floor = h;
|
||||
TestTriggers(TriggerIndex, TRUE, 0);
|
||||
TestTriggers(x, y, z, item->roomNumber, true, NULL);
|
||||
if (item->pos.yPos >= h)
|
||||
{
|
||||
item->floor = item->pos.yPos = h;
|
||||
floor = GetFloor(x, h, z, &room_num);
|
||||
GetFloorHeight(floor, x, h, z);
|
||||
TestTriggers(TriggerIndex, TRUE, 0);
|
||||
TestTriggers(x, h, z, item->roomNumber, true, NULL);
|
||||
|
||||
item->gravityStatus = false;
|
||||
item->fallspeed = 0;
|
||||
item->goalAnimState = LS_DEATH;
|
||||
|
|
|
@ -210,9 +210,7 @@ void AbortionControl(short itemNum)
|
|||
SoundEffect(171, &item->pos, NULL);
|
||||
ExplodingDeath(itemNum, 0xffffffff, ABORT_PART_DAMAGE);
|
||||
|
||||
floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &item->roomNumber);
|
||||
GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos);
|
||||
TestTriggers(TriggerIndex, TRUE, 0);
|
||||
TestTriggers(item, true, NULL);
|
||||
|
||||
KillItem(itemNum);
|
||||
item->status = ITEM_DEACTIVATED;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "level.h"
|
||||
#include "sound.h"
|
||||
#include "effect2.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "trmath.h"
|
||||
|
||||
#define NATLA_NEAR_DEATH 200
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
#include "tr1_wolf.h"
|
||||
#include "items.h"
|
||||
#include "box.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "lara.h"
|
||||
#include "setup.h"
|
||||
#include "control.h"
|
||||
#include "level.h"
|
||||
|
||||
BITE_INFO wolfBite = { 0, -14, 174, 6 };
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "framework.h"
|
||||
#include "tr2_barracuda.h"
|
||||
#include "box.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "lara.h"
|
||||
#include "setup.h"
|
||||
#include "level.h"
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#include "framework.h"
|
||||
#include "tr2_birdmonster.h"
|
||||
#include "box.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "lara.h"
|
||||
#include "setup.h"
|
||||
#include "level.h"
|
||||
#include "control.h"
|
||||
|
||||
BITE_INFO birdyBiteL = { 0, 224, 0, 19 };
|
||||
BITE_INFO birdyBiteR = { 0, 224, 0, 22 };
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "framework.h"
|
||||
#include "tr2_eagle_or_crow.h"
|
||||
#include "box.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "lara.h"
|
||||
#include "items.h"
|
||||
#include "setup.h"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "framework.h"
|
||||
#include "tr2_knifethrower.h"
|
||||
#include "items.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "box.h"
|
||||
#include "people.h"
|
||||
#include "setup.h"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "framework.h"
|
||||
#include "tr2_monk.h"
|
||||
#include "box.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "lara.h"
|
||||
#include "sound.h"
|
||||
#include "setup.h"
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
#include "tr2_rat.h"
|
||||
#include "lara.h"
|
||||
#include "box.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "setup.h"
|
||||
#include "control.h"
|
||||
#include "level.h"
|
||||
|
||||
BITE_INFO ratBite = { 0, 0, 57, 2 };
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#include "framework.h"
|
||||
#include "tr2_shark.h"
|
||||
#include "box.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "lara.h"
|
||||
#include "setup.h"
|
||||
#include "level.h"
|
||||
#include "control.h"
|
||||
|
||||
BITE_INFO sharkBite = { 17, -22, 344, 12 };
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "framework.h"
|
||||
#include "tr2_spear_guardian.h"
|
||||
#include "box.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "items.h"
|
||||
#include "setup.h"
|
||||
#include "level.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "framework.h"
|
||||
#include "tr2_spider.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "sphere.h"
|
||||
#include "box.h"
|
||||
#include "items.h"
|
||||
|
@ -10,6 +10,7 @@
|
|||
#include "setup.h"
|
||||
#include "tomb4fx.h"
|
||||
#include "level.h"
|
||||
#include "control.h"
|
||||
|
||||
BITE_INFO spiderBite = { 0, 0, 41, 1 };
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "framework.h"
|
||||
#include "tr2_sword_guardian.h"
|
||||
#include "box.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "lot.h"
|
||||
#include "effect2.h"
|
||||
#include "items.h"
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
#include "tomb4fx.h"
|
||||
#include "setup.h"
|
||||
#include "level.h"
|
||||
#include "effect.h"
|
||||
#include "control.h"
|
||||
#include "effect2.h"
|
||||
#include "trmath.h"
|
||||
|
||||
BITE_INFO workerFlameThrower = { 0, 250, 32, 9 };
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
#include "framework.h"
|
||||
#include "tr2_yeti.h"
|
||||
#include "box.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "items.h"
|
||||
#include "lara.h"
|
||||
#include "setup.h"
|
||||
#include "level.h"
|
||||
#include "control.h"
|
||||
|
||||
BITE_INFO yetiBiteR = { 12, 101, 19, 10 };
|
||||
BITE_INFO yetiBiteL = { 12, 101, 19, 13 };
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "setup.h"
|
||||
#include "control.h"
|
||||
#include "lara.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
|
||||
void InitialiseKillerStatue(short itemNumber)
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "control.h"
|
||||
#include "lara.h"
|
||||
#include "setup.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "sound.h"
|
||||
#include "items.h"
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ void SpeedBoatGetOff(ITEM_INFO* boat)
|
|||
|
||||
bool SpeedBoatCanGetOff(int direction)
|
||||
{
|
||||
ITEM_INFO* v = &g_Level.Items[Lara.Vehicle];
|
||||
auto v = &g_Level.Items[Lara.Vehicle];
|
||||
|
||||
short angle;
|
||||
if (direction < 0)
|
||||
|
@ -212,18 +212,15 @@ bool SpeedBoatCanGetOff(int direction)
|
|||
int y = v->pos.yPos;
|
||||
int z = v->pos.zPos + GETOFF_DIST * phd_cos(angle);
|
||||
|
||||
short roomNumber = v->roomNumber;
|
||||
FLOOR_INFO* floor = GetFloor(x, y, z, &roomNumber);
|
||||
int height = GetFloorHeight(floor, x, y, z);
|
||||
auto collResult = GetCollisionResult(x, y, z, v->roomNumber);
|
||||
|
||||
if ((height - v->pos.yPos) < -(WALL_SIZE / 2))
|
||||
if ((collResult.FloorHeight - v->pos.yPos) < -(WALL_SIZE / 2))
|
||||
return false;
|
||||
|
||||
if ((HeightType == BIG_SLOPE) || (HeightType == DIAGONAL))
|
||||
if (collResult.HeightType == BIG_SLOPE || collResult.HeightType == DIAGONAL)
|
||||
return false;
|
||||
|
||||
int ceiling = GetCeiling(floor, x, y, z);
|
||||
if ((ceiling - v->pos.yPos > -LARA_HITE) || (height - ceiling < LARA_HITE))
|
||||
if ((collResult.CeilingHeight - v->pos.yPos > -LARA_HEIGHT) || (collResult.FloorHeight - collResult.CeilingHeight < LARA_HEIGHT))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -920,8 +917,8 @@ void SpeedBoatControl(short itemNumber)
|
|||
|
||||
if (Lara.Vehicle == itemNumber)
|
||||
{
|
||||
TestTriggers(TriggerIndex, 0, 0);
|
||||
TestTriggers(TriggerIndex, 1, 0);
|
||||
TestTriggers(boat, true, NULL);
|
||||
TestTriggers(boat, false, NULL);
|
||||
}
|
||||
|
||||
binfo->water = water = GetWaterHeight(boat->pos.xPos, boat->pos.yPos, boat->pos.zPos, roomNumber);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "lara.h"
|
||||
#include "items.h"
|
||||
#include "collide.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "lara_fire.h"
|
||||
#include "lara_one_gun.h"
|
||||
#include "effect2.h"
|
||||
|
@ -220,7 +220,7 @@ void SkidooExplode(ITEM_INFO* skidoo)
|
|||
|
||||
bool SkidooCheckGetOffOK(int direction)
|
||||
{
|
||||
ITEM_INFO* skidoo = &g_Level.Items[Lara.Vehicle];
|
||||
auto skidoo = &g_Level.Items[Lara.Vehicle];
|
||||
|
||||
short angle;
|
||||
if (direction == STATE_SKIDOO_GETOFFL)
|
||||
|
@ -232,18 +232,15 @@ bool SkidooCheckGetOffOK(int direction)
|
|||
int y = skidoo->pos.yPos;
|
||||
int z = skidoo->pos.zPos - SKIDOO_GETOFF_DIST * phd_cos(angle);
|
||||
|
||||
short roomNumber = skidoo->roomNumber;
|
||||
FLOOR_INFO* floor = GetFloor(x, y, z, &roomNumber);
|
||||
int height = GetFloorHeight(floor, x, y, z);
|
||||
auto collResult = GetCollisionResult(x, y, z, skidoo->roomNumber);
|
||||
|
||||
if (HeightType == BIG_SLOPE || height == NO_HEIGHT || HeightType == DIAGONAL)
|
||||
if (collResult.HeightType == BIG_SLOPE || collResult.HeightType == DIAGONAL || collResult.FloorHeight == NO_HEIGHT)
|
||||
return false;
|
||||
|
||||
if (abs(height - skidoo->pos.yPos) > WALL_SIZE / 2)
|
||||
if (abs(collResult.FloorHeight - skidoo->pos.yPos) > WALL_SIZE / 2)
|
||||
return false;
|
||||
|
||||
int ceiling = GetCeiling(floor, x, y, z);
|
||||
if (ceiling - skidoo->pos.yPos > -LARA_HITE || height - ceiling < LARA_HITE)
|
||||
if (collResult.CeilingHeight - skidoo->pos.yPos > -LARA_HEIGHT || collResult.FloorHeight - collResult.CeilingHeight < LARA_HEIGHT)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -941,8 +938,8 @@ bool SkidooControl()
|
|||
FLOOR_INFO* floor = GetFloor(skidoo->pos.xPos, skidoo->pos.yPos, skidoo->pos.zPos, &roomNumber);
|
||||
int height = GetFloorHeight(floor, skidoo->pos.xPos, skidoo->pos.yPos, skidoo->pos.zPos);
|
||||
|
||||
TestTriggers(TriggerIndex, 0, 0);
|
||||
TestTriggers(TriggerIndex, 1, 0);
|
||||
TestTriggers(skidoo, true, NULL);
|
||||
TestTriggers(skidoo, false, NULL);
|
||||
|
||||
bool dead = false;
|
||||
int drive = 0;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "tr3_civvy.h"
|
||||
#include "box.h"
|
||||
#include "effect2.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "people.h"
|
||||
#include "setup.h"
|
||||
#include "level.h"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "framework.h"
|
||||
#include "tr3_cobra.h"
|
||||
#include "box.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "items.h"
|
||||
#include "lara.h"
|
||||
#include "setup.h"
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
#include "framework.h"
|
||||
#include "tr3_fishemitter.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "draw.h"
|
||||
#include "level.h"
|
||||
#include "lara.h"
|
||||
#include "fish.h"
|
||||
#include "control.h"
|
||||
#include "effect2.h"
|
||||
|
||||
#define PIRAHNA_DAMAGE 4
|
||||
#define X 0
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "level.h"
|
||||
#include "lara.h"
|
||||
#include "sound.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
|
||||
BITE_INFO flamerBite = { 0, 340, 64, 7 };
|
||||
|
||||
|
|
|
@ -2,11 +2,12 @@
|
|||
#include "tr3_monkey.h"
|
||||
#include "box.h"
|
||||
#include "lara.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "items.h"
|
||||
#include "setup.h"
|
||||
#include "lot.h"
|
||||
#include "level.h"
|
||||
#include "control.h"
|
||||
|
||||
BITE_INFO monkeyBite = { 10, 10, 11, 13 };
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "box.h"
|
||||
#include "sphere.h"
|
||||
#include "effect2.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "people.h"
|
||||
#include "setup.h"
|
||||
#include "lot.h"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "framework.h"
|
||||
#include "tr3_mpstick.h"
|
||||
#include "box.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "people.h"
|
||||
#include "items.h"
|
||||
#include "setup.h"
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
#include "framework.h"
|
||||
#include "tr3_raptor.h"
|
||||
#include "box.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "setup.h"
|
||||
#include "lot.h"
|
||||
#include "level.h"
|
||||
#include "lara.h"
|
||||
#include "control.h"
|
||||
|
||||
static BITE_INFO raptorBite = { 0, 66, 318, 22 };
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
#include "framework.h"
|
||||
#include "tr3_scuba.h"
|
||||
#include "items.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "box.h"
|
||||
#include "lara.h"
|
||||
#include "setup.h"
|
||||
#include "level.h"
|
||||
#include "control.h"
|
||||
|
||||
BITE_INFO scubaGun = { 17, 164, 44, 18 };
|
||||
|
||||
|
@ -109,7 +110,7 @@ void ScubaControl(short itemNumber)
|
|||
start.roomNumber = item->roomNumber;
|
||||
|
||||
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;
|
||||
|
||||
shoot = LOS(&start, &target);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "tr3_shiva.h"
|
||||
#include "effect2.h"
|
||||
#include "box.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "sphere.h"
|
||||
#include "items.h"
|
||||
#include "setup.h"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "sphere.h"
|
||||
#include "people.h"
|
||||
#include "draw.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "misc.h"
|
||||
#include "setup.h"
|
||||
#include "level.h"
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#include "framework.h"
|
||||
#include "tr3_tiger.h"
|
||||
#include "box.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "setup.h"
|
||||
#include "level.h"
|
||||
#include "control.h"
|
||||
#include "lara.h"
|
||||
|
||||
BITE_INFO tigerBite = { 19, -13, 3, 26 };
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "boss.h"
|
||||
#include "box.h"
|
||||
#include "draw.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "level.h"
|
||||
#include "setup.h"
|
||||
#include "lara.h"
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "setup.h"
|
||||
#include "level.h"
|
||||
#include "lara.h"
|
||||
#include "control.h"
|
||||
|
||||
void LaraTyrannosaurDeath(ITEM_INFO* item)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "framework.h"
|
||||
#include "tr3_tribesman.h"
|
||||
#include "box.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "items.h"
|
||||
#include "sphere.h"
|
||||
#include "effect2.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "framework.h"
|
||||
#include "kayak.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "effect2.h"
|
||||
#include "draw.h"
|
||||
#include "camera.h"
|
||||
|
@ -11,6 +11,7 @@
|
|||
#include "level.h"
|
||||
#include "setup.h"
|
||||
#include "input.h"
|
||||
#include "control.h"
|
||||
|
||||
using std::vector;
|
||||
|
||||
|
@ -1262,7 +1263,8 @@ int KayakControl()
|
|||
short roomNumber = v->roomNumber;
|
||||
FLOOR_INFO* floor = GetFloor(v->pos.xPos, v->pos.yPos, v->pos.zPos, &roomNumber);
|
||||
int h = GetFloorHeight(floor, v->pos.xPos, v->pos.yPos, v->pos.zPos);
|
||||
TestTriggers(TriggerIndex, 0, 0);
|
||||
|
||||
TestTriggers(v, false, NULL);
|
||||
|
||||
int water;
|
||||
if ((kayak->Water = water = GetWaterHeight(v->pos.xPos, v->pos.yPos, v->pos.zPos, roomNumber)) == NO_HEIGHT)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "minecart.h"
|
||||
#include "lara.h"
|
||||
#include "collide.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "lara_flare.h"
|
||||
#include "items.h"
|
||||
#include "sphere.h"
|
||||
|
@ -13,7 +13,9 @@
|
|||
#include "setup.h"
|
||||
#include "input.h"
|
||||
#include "sound.h"
|
||||
|
||||
using std::vector;
|
||||
|
||||
enum MINECART_STATE {
|
||||
CART_GETIN,
|
||||
CART_GETOUT,
|
||||
|
@ -91,7 +93,7 @@ static short GetCollision(ITEM_INFO* v, short ang, int dist, short* ceiling)
|
|||
short roomNumber;
|
||||
|
||||
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;
|
||||
|
||||
roomNumber = v->roomNumber;
|
||||
|
@ -141,35 +143,27 @@ static bool GetInMineCart(ITEM_INFO* v, ITEM_INFO* l, COLL_INFO* coll)
|
|||
|
||||
static bool CanGetOut(int direction)
|
||||
{
|
||||
ITEM_INFO* v;
|
||||
FLOOR_INFO* floor;
|
||||
short roomNumber, angle;
|
||||
int x, y, z, height, ceiling;
|
||||
|
||||
v = &g_Level.Items[Lara.Vehicle];
|
||||
auto v = &g_Level.Items[Lara.Vehicle];
|
||||
|
||||
short angle;
|
||||
if (direction < 0)
|
||||
angle = v->pos.yRot + 0x4000;
|
||||
else
|
||||
angle = v->pos.yRot - 0x4000;
|
||||
|
||||
int x = v->pos.xPos - GETOFF_DIST * phd_sin(angle);
|
||||
int y = v->pos.yPos;
|
||||
int z = v->pos.zPos - GETOFF_DIST * phd_cos(angle);
|
||||
|
||||
x = v->pos.xPos - GETOFF_DIST * phd_sin(angle);
|
||||
y = v->pos.yPos;
|
||||
z = v->pos.zPos - GETOFF_DIST * phd_cos(angle);
|
||||
auto collResult = GetCollisionResult(x, y, z, v->roomNumber);
|
||||
|
||||
roomNumber = v->roomNumber;
|
||||
floor = GetFloor(x, y, z, &roomNumber);
|
||||
height = GetFloorHeight(floor, x, y, z);
|
||||
|
||||
if ((HeightType == BIG_SLOPE) || (HeightType == DIAGONAL) || (height == NO_HEIGHT))
|
||||
if (collResult.HeightType == BIG_SLOPE || collResult.HeightType == DIAGONAL || collResult.FloorHeight == NO_HEIGHT)
|
||||
return false;
|
||||
|
||||
if (abs(height - v->pos.yPos) > WALL_SIZE / 2)
|
||||
if (abs(collResult.FloorHeight - v->pos.yPos) > WALL_SIZE / 2)
|
||||
return false;
|
||||
|
||||
ceiling = GetCeiling(floor, x, y, z);
|
||||
if ((ceiling - v->pos.yPos > -LARA_HITE) || (height - ceiling < LARA_HITE))
|
||||
if ((collResult.CeilingHeight - v->pos.yPos > -LARA_HEIGHT) || (collResult.FloorHeight - collResult.CeilingHeight < LARA_HEIGHT))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -219,11 +213,7 @@ static void CartToBaddieCollision(ITEM_INFO* v)
|
|||
if ((frame >= 12) && (frame <= 22))
|
||||
{
|
||||
SoundEffect(220, &item->pos, 2);
|
||||
|
||||
roomNumber = item->roomNumber;
|
||||
floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber);
|
||||
|
||||
TestTriggers(TriggerIndex, TRUE, 0);
|
||||
TestTriggers(item, true, NULL);
|
||||
item->frameNumber++;
|
||||
}
|
||||
}
|
||||
|
@ -868,7 +858,7 @@ int MineCartControl(void)
|
|||
ItemNewRoom(Lara.itemNumber, roomNumber);
|
||||
}
|
||||
|
||||
TestTriggers(TriggerIndex, FALSE, 0);
|
||||
TestTriggers(v, false, NULL);
|
||||
|
||||
if (!(cart->Flags & CF_DEAD))
|
||||
{
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "collide.h"
|
||||
#include "camera.h"
|
||||
#include "tomb4fx.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "lara_flare.h"
|
||||
#include "lara_one_gun.h"
|
||||
#include "misc.h"
|
||||
|
@ -166,7 +166,7 @@ static int CanQuadbikeGetOff(int direction)
|
|||
{
|
||||
short angle;
|
||||
|
||||
ITEM_INFO* item = &g_Level.Items[Lara.Vehicle];
|
||||
auto item = &g_Level.Items[Lara.Vehicle];
|
||||
|
||||
if (direction < 0)
|
||||
angle = item->pos.yRot - ANGLE(90);
|
||||
|
@ -177,19 +177,15 @@ static int CanQuadbikeGetOff(int direction)
|
|||
int y = item->pos.yPos;
|
||||
int z = item->pos.zPos + 512 * phd_cos(angle);
|
||||
|
||||
short roomNumber = item->roomNumber;
|
||||
FLOOR_INFO* floor = GetFloor(x, y, z, &roomNumber);
|
||||
int height = GetFloorHeight(floor, x, y, z);
|
||||
auto collResult = GetCollisionResult(x, y, z, item->roomNumber);
|
||||
|
||||
if ((HeightType == BIG_SLOPE) || (HeightType == DIAGONAL) || (height == NO_HEIGHT))
|
||||
if (collResult.HeightType == BIG_SLOPE || collResult.HeightType == DIAGONAL || collResult.FloorHeight == NO_HEIGHT)
|
||||
return false;
|
||||
|
||||
if (abs(height - item->pos.yPos) > 512)
|
||||
if (abs(collResult.FloorHeight - item->pos.yPos) > 512)
|
||||
return false;
|
||||
|
||||
int ceiling = GetCeiling(floor, x, y, z);
|
||||
|
||||
if ((ceiling - item->pos.yPos > -LARA_HITE) || (height - ceiling < LARA_HITE))
|
||||
if ((collResult.CeilingHeight - item->pos.yPos > -LARA_HEIGHT) || (collResult.FloorHeight - collResult.CeilingHeight < LARA_HEIGHT))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -1288,11 +1284,7 @@ int QuadBikeControl(void)
|
|||
int hfl = TestQuadHeight(item, QUAD_FRONT, -QUAD_SIDE, &fl);
|
||||
int hfr = TestQuadHeight(item, QUAD_FRONT, QUAD_SIDE, &fr);
|
||||
|
||||
roomNumber = item->roomNumber;
|
||||
floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber);
|
||||
height = GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos);
|
||||
|
||||
TestTriggers(TriggerIndex, 0, 0);
|
||||
TestTriggers(item, false, NULL);
|
||||
|
||||
if (LaraItem->hitPoints <= 0)
|
||||
{
|
||||
|
|
|
@ -648,34 +648,27 @@ void RubberBoatCollision(short itemNum, ITEM_INFO *lara, COLL_INFO *coll)
|
|||
|
||||
static int CanGetOffRubberBoat(int direction)
|
||||
{
|
||||
ITEM_INFO *boat;
|
||||
FLOOR_INFO *floor;
|
||||
short roomNum, angle;
|
||||
int x, y, z, height, ceiling;
|
||||
|
||||
boat = &g_Level.Items[Lara.Vehicle];
|
||||
short angle;
|
||||
auto boat = &g_Level.Items[Lara.Vehicle];
|
||||
|
||||
if (direction < 0)
|
||||
angle = boat->pos.yRot - ANGLE(90);
|
||||
else
|
||||
angle = boat->pos.yRot + ANGLE(90);
|
||||
|
||||
x = boat->pos.xPos + 1024 * phd_sin(angle);
|
||||
y = boat->pos.yPos;
|
||||
z = boat->pos.zPos + 1024 * phd_cos(angle);
|
||||
auto x = boat->pos.xPos + 1024 * phd_sin(angle);
|
||||
auto y = boat->pos.yPos;
|
||||
auto z = boat->pos.zPos + 1024 * phd_cos(angle);
|
||||
|
||||
roomNum = boat->roomNumber;
|
||||
floor = GetFloor(x, y, z, &roomNum);
|
||||
height = GetFloorHeight(floor, x, y, z);
|
||||
ceiling = GetCeiling(floor, x, y, z);
|
||||
auto collResult = GetCollisionResult(x, y, z, boat->roomNumber);
|
||||
|
||||
if (height - boat->pos.yPos < -512)
|
||||
if (collResult.FloorHeight - boat->pos.yPos < -512)
|
||||
return 0;
|
||||
|
||||
if (HeightType == BIG_SLOPE || HeightType == DIAGONAL)
|
||||
if (collResult.HeightType == BIG_SLOPE || collResult.HeightType == DIAGONAL)
|
||||
return 0;
|
||||
|
||||
if ((ceiling - boat->pos.yPos > -762) || (height - ceiling < 762))
|
||||
if ((collResult.CeilingHeight - boat->pos.yPos > -LARA_HEIGHT) || (collResult.FloorHeight - collResult.CeilingHeight < LARA_HEIGHT))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
|
@ -896,8 +889,8 @@ void RubberBoatControl(short itemNum)
|
|||
|
||||
if (Lara.Vehicle == itemNum)
|
||||
{
|
||||
TestTriggers(TriggerIndex, 0, 0);
|
||||
TestTriggers(TriggerIndex, 1, 0);
|
||||
TestTriggers(boat, false, NULL);
|
||||
TestTriggers(boat, true, NULL);
|
||||
}
|
||||
|
||||
binfo->water = water = GetWaterHeight(boat->pos.xPos, boat->pos.yPos, boat->pos.zPos, roomNumber);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "items.h"
|
||||
#include "sphere.h"
|
||||
#include "effect2.h"
|
||||
#include "effect.h"
|
||||
#include "effect2.h"
|
||||
#include "collide.h"
|
||||
#include "box.h"
|
||||
#include "lara_flare.h"
|
||||
|
@ -435,7 +435,6 @@ static void BackgroundCollision(ITEM_INFO* v, ITEM_INFO* l, SUB_INFO* sub)
|
|||
coll->old.y = v->pos.yPos;
|
||||
coll->old.z = v->pos.zPos;
|
||||
coll->radius = SUB_RADIUS;
|
||||
coll->trigger = NULL;
|
||||
coll->slopesAreWalls = false;
|
||||
coll->slopesArePits = false;
|
||||
coll->lavaIsPit = false;
|
||||
|
@ -495,9 +494,9 @@ static void BackgroundCollision(ITEM_INFO* v, ITEM_INFO* l, SUB_INFO* sub)
|
|||
return;
|
||||
}
|
||||
|
||||
if (coll->midFloor < 0)
|
||||
if (coll->middle.Floor < 0)
|
||||
{
|
||||
v->pos.yPos += coll->midFloor;
|
||||
v->pos.yPos += coll->middle.Floor;
|
||||
sub->RotX += WALLDEFLECT;
|
||||
}
|
||||
}
|
||||
|
@ -733,7 +732,7 @@ static void UserInput(ITEM_INFO* v, ITEM_INFO* l, SUB_INFO* sub)
|
|||
l->gravityStatus = false;
|
||||
l->pos.xRot = l->pos.zRot = 0;
|
||||
|
||||
UpdateLaraRoom(l, -LARA_HITE / 2);
|
||||
UpdateLaraRoom(l, -LARA_HEIGHT / 2);
|
||||
|
||||
Lara.waterStatus = LW_SURFACE;
|
||||
Lara.waterSurfaceDist = -hfw;
|
||||
|
@ -1006,7 +1005,7 @@ int SubControl(void)
|
|||
}
|
||||
}
|
||||
|
||||
TestTriggers(TriggerIndex, false, 0);
|
||||
TestTriggers(v, false, NULL);
|
||||
SubEffects(Lara.Vehicle);
|
||||
|
||||
if ((Lara.Vehicle != NO_ITEM) && (!(sub->Flags & UPV_DEAD)))
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue