Merge branch 'vault_without_embedding' into state_cleaning_tier_2

This commit is contained in:
Sezz 2022-01-13 18:45:28 +11:00
commit 25df67c227
8 changed files with 35 additions and 20 deletions

View file

@ -44,6 +44,7 @@ constexpr auto LARA_HEIGHT_CRAWL = 350; // Lara height in crawl states.
constexpr auto LARA_HEIGHT_MONKEY = 705; // Lara height in monkey swing states.
constexpr auto LARA_HEIGHT_SURFSWIM = 700; // Lara height in water treading states.
constexpr auto LARA_HEIGHT_STRETCH = 870; // Lara height in jump-up and ledge hanging states.
constexpr auto LARA_HEIGHT_REACH = 820; // Lara height in reach state.
constexpr auto LARA_HEIGHT_SURFACE = 800; // Lara height when surfacing water.
constexpr auto LARA_HEADROOM = 160; // Amount of reasonable space above Lara's head.
constexpr auto LARA_RAD = 100;

View file

@ -189,9 +189,16 @@ void lara_col_reach(ITEM_INFO* item, COLL_INFO* coll)
{
LaraInfo*& info = item->data;
if (info->ropePtr == -1)
item->gravityStatus = true;
info->moveAngle = item->pos.yRot;
item->gravityStatus = (info->ropePtr == -1) ? true : false;
coll->Setup.Height = LARA_HEIGHT_STRETCH;
// HACK: height is altered according to fallspeed to fix "issues" with physically impossible
// 6-click high ceiling running jumps. While TEN model is physically correct, original engines
// allowed certain margin of deflection due to bug caused by hacky inclusion of headroom in coll checks.
coll->Setup.Height = item->fallspeed > 0 ? LARA_HEIGHT_REACH : LARA_HEIGHT;
coll->Setup.BadHeightDown = NO_BAD_POS;
coll->Setup.BadHeightUp = 0;
coll->Setup.BadCeilingHeight = BAD_JUMP_CEILING;

View file

@ -75,29 +75,38 @@ void lara_as_surftread(ITEM_INFO* item, COLL_INFO* coll)
if (TrInput & IN_FORWARD)
{
item->goalAnimState = LS_ONWATER_FORWARD;
return;
}
else if (TrInput & IN_BACK)
{
item->goalAnimState = LS_ONWATER_BACK;
return;
}
if (TrInput & IN_LSTEP)
else if (TrInput & IN_ROLL)
{
item->goalAnimState = LS_ROLL_FORWARD;
return;
}
else if (TrInput & IN_LSTEP)
{
item->goalAnimState = LS_ONWATER_LEFT;
return;
}
else if (TrInput & IN_RSTEP)
{
item->goalAnimState = LS_ONWATER_RIGHT;
return;
}
if (TrInput & IN_JUMP)
else if (TrInput & IN_JUMP)
{
Lara.diveCount++;
if (Lara.diveCount == 10)
SwimDive(item);
return;
}
else
Lara.diveCount = 0;
Lara.diveCount = 0;
item->goalAnimState = LS_ONWATER_STOP;
}
void lara_as_surfright(ITEM_INFO* item, COLL_INFO* coll)

View file

@ -1993,8 +1993,8 @@ bool TestLaraCrawlVault(ITEM_INFO* item, COLL_INFO* coll)
bool TestLaraCrawlToHang(ITEM_INFO* item, COLL_INFO* coll)
{
int y = item->pos.yPos;
auto probe = GetCollisionResult(item, item->pos.yRot + ANGLE(180.0f), CLICK(1), -LARA_HEIGHT_CRAWL);
bool objectCollided = TestLaraObjectCollision(item, item->pos.yRot + ANGLE(180.0f), CLICK(1), -LARA_HEIGHT_CRAWL);
auto probe = GetCollisionResult(item, item->pos.yRot + ANGLE(180.0f), CLICK(1.2f), -LARA_HEIGHT_CRAWL);
bool objectCollided = TestLaraObjectCollision(item, item->pos.yRot + ANGLE(180.0f), CLICK(1.2f), -LARA_HEIGHT_CRAWL);
if (!objectCollided && // No obstruction.
(probe.Position.Floor - y) >= LARA_HEIGHT_STRETCH && // Highest floor bound.

View file

@ -917,8 +917,8 @@ short GetNearestLedgeAngle(ITEM_INFO* item, COLL_INFO* coll, float& dist)
auto block = GetCollisionResult(ffpX, y, ffpZ, room).Block;
// Get front floor surface heights
auto floorHeight = block->BridgeFloorHeight(ffpX, y, ffpZ); // HACK? FloorHeight never returns real bridge height!
auto ceilingHeight = block->CeilingHeight(ffpX, y, ffpZ);
auto floorHeight = GetFloorHeight(ROOM_VECTOR{ block->Room, y }, ffpX, ffpZ).value_or(NO_HEIGHT);
auto ceilingHeight = GetCeilingHeight(ROOM_VECTOR{ block->Room, y }, ffpX, ffpZ).value_or(NO_HEIGHT);
// If ceiling height tests lower than Y value, it means ceiling
// ledge is in front and we should use it instead of floor.

View file

@ -611,7 +611,7 @@ void TestTriggers(FLOOR_INFO* floor, int x, int y, int z, bool heavy, int heavyF
if (!UseSpotCam || CurrentLevel == 0)
{
UseSpotCam = true;
if (LastSpotCam != value)
if (LastSpotCamSequence != value)
TrackCameraInit = false;
InitialiseSpotCam(value);
}

View file

@ -14,7 +14,6 @@ using namespace TEN::Renderer;
using namespace TEN::Control::Volumes;
int TrackCameraInit;
int LastSequence;
int SpotcamTimer;
int SpotcamPaused;
int SpotcamLoopCnt;
@ -42,7 +41,7 @@ QUAKE_CAMERA QuakeCam;
int SplineFromCamera;
bool SpotCamFirstLook;
short CurrentSplineCamera;
int LastSpotCam;
int LastSpotCamSequence;
int LaraHealth;
int LaraAir;
int CurrentSpotcamSequence;
@ -111,7 +110,7 @@ void InitialiseSpotCam(short Sequence)
int sp;
int i;
if (TrackCameraInit != 0 && LastSequence == Sequence)
if (TrackCameraInit != 0 && LastSpotCamSequence == Sequence)
{
TrackCameraInit = 0;
return;
@ -134,7 +133,7 @@ void InitialiseSpotCam(short Sequence)
Lara.busy = 0;
CameraFade = -1;
LastSequence = Sequence;
LastSpotCamSequence = Sequence;
TrackCameraInit = 0;
SpotcamTimer = 0;
SpotcamPaused = 0;
@ -508,8 +507,7 @@ void CalculateSpotCameras()
Camera.pos.y = cpy;
Camera.pos.z = cpz;
if ((s->flags & SCF_FOCUS_LARA_HEAD
|| s->flags & SCF_TRACKING_CAM))
if ((s->flags & SCF_FOCUS_LARA_HEAD) || (s->flags & SCF_TRACKING_CAM))
{
Camera.target.x = LaraItem->pos.xPos;
Camera.target.y = LaraItem->pos.yPos;

View file

@ -51,7 +51,7 @@ enum SPOTCAM_FLAGS
extern SPOTCAM SpotCam[MAX_SPOTCAMS];
extern byte SpotCamRemap[MAX_SPOTCAMS];
extern byte CameraCnt[MAX_SPOTCAMS];
extern int LastSpotCam;
extern int LastSpotCamSequence;
extern int NumberSpotcams;
extern int UseSpotCam;
extern int SpotcamDontDrawLara;