mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-08 11:38:08 +03:00
Replace some magic numbers; cleanup
This commit is contained in:
parent
aa289da863
commit
1516f03c07
4 changed files with 18 additions and 23 deletions
|
@ -732,6 +732,8 @@ void LaraAboveWater(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
{
|
{
|
||||||
LaraInfo*& info = item->data;
|
LaraInfo*& info = item->data;
|
||||||
|
|
||||||
|
coll->Setup.BadCeilingHeightUp = MAX_HEIGHT;
|
||||||
|
|
||||||
coll->Setup.OldPosition.x = item->pos.xPos;
|
coll->Setup.OldPosition.x = item->pos.xPos;
|
||||||
coll->Setup.OldPosition.y = item->pos.yPos;
|
coll->Setup.OldPosition.y = item->pos.yPos;
|
||||||
coll->Setup.OldPosition.z = item->pos.zPos;
|
coll->Setup.OldPosition.z = item->pos.zPos;
|
||||||
|
@ -739,7 +741,6 @@ void LaraAboveWater(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
coll->Setup.OldAnimNumber = item->animNumber;
|
coll->Setup.OldAnimNumber = item->animNumber;
|
||||||
coll->Setup.OldFrameNumber = item->frameNumber;
|
coll->Setup.OldFrameNumber = item->frameNumber;
|
||||||
|
|
||||||
coll->Setup.BadCeilingHeightUp = MAX_HEIGHT;
|
|
||||||
coll->Setup.EnableObjectPush = true;
|
coll->Setup.EnableObjectPush = true;
|
||||||
coll->Setup.EnableSpaz = true;
|
coll->Setup.EnableSpaz = true;
|
||||||
coll->Setup.FloorSlopesAreWalls = false;
|
coll->Setup.FloorSlopesAreWalls = false;
|
||||||
|
@ -926,9 +927,9 @@ void LaraUnderWater(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
{
|
{
|
||||||
LaraInfo*& info = item->data;
|
LaraInfo*& info = item->data;
|
||||||
|
|
||||||
coll->Setup.BadFloorHeightDown = 32512;
|
coll->Setup.BadFloorHeightDown = SHRT_MAX - (CLICK(1) - 1);
|
||||||
coll->Setup.BadFloorHeightUp = -400;
|
coll->Setup.BadFloorHeightUp = -(LARA_RAD_UNDERWATER + (LARA_RAD_UNDERWATER / 3));
|
||||||
coll->Setup.BadCeilingHeightDown = 400;
|
coll->Setup.BadCeilingHeightDown = LARA_RAD_UNDERWATER + (LARA_RAD_UNDERWATER / 3);
|
||||||
coll->Setup.BadCeilingHeightUp = MAX_HEIGHT;
|
coll->Setup.BadCeilingHeightUp = MAX_HEIGHT;
|
||||||
|
|
||||||
coll->Setup.OldPosition.x = item->pos.xPos;
|
coll->Setup.OldPosition.x = item->pos.xPos;
|
||||||
|
@ -1035,9 +1036,9 @@ void LaraSurface(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
|
|
||||||
Camera.targetElevation = -ANGLE(22.0f);
|
Camera.targetElevation = -ANGLE(22.0f);
|
||||||
|
|
||||||
coll->Setup.BadFloorHeightDown = 32512;
|
coll->Setup.BadFloorHeightDown = SHRT_MAX - (CLICK(1) - 1);
|
||||||
coll->Setup.BadFloorHeightUp = -128;
|
coll->Setup.BadFloorHeightUp = -CLICK(0.5f);
|
||||||
coll->Setup.BadCeilingHeightDown = 100;
|
coll->Setup.BadCeilingHeightDown = LARA_RAD;
|
||||||
coll->Setup.BadCeilingHeightUp = MAX_HEIGHT;
|
coll->Setup.BadCeilingHeightUp = MAX_HEIGHT;
|
||||||
|
|
||||||
coll->Setup.OldPosition.x = item->pos.xPos;
|
coll->Setup.OldPosition.x = item->pos.xPos;
|
||||||
|
@ -1085,7 +1086,7 @@ void LaraSurface(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
if (info->Vehicle == NO_ITEM)
|
if (info->Vehicle == NO_ITEM)
|
||||||
lara_collision_routines[item->currentAnimState](item, coll);
|
lara_collision_routines[item->currentAnimState](item, coll);
|
||||||
|
|
||||||
UpdateItemRoom(item, 100);
|
UpdateItemRoom(item, LARA_RAD);
|
||||||
|
|
||||||
LaraGun(item);
|
LaraGun(item);
|
||||||
|
|
||||||
|
|
|
@ -177,9 +177,9 @@ void DoLaraFallDamage(ITEM_INFO* item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
short GetLaraSlideDirection(COLL_INFO* coll)
|
short GetLaraSlideDirection(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
{
|
{
|
||||||
short dir = 0;
|
short direction = item->pos.yRot;
|
||||||
|
|
||||||
//if (g_GameFlow->Animations.SlideExtended)
|
//if (g_GameFlow->Animations.SlideExtended)
|
||||||
//{
|
//{
|
||||||
|
@ -188,17 +188,17 @@ short GetLaraSlideDirection(COLL_INFO* coll)
|
||||||
//else
|
//else
|
||||||
{
|
{
|
||||||
if (coll->FloorTiltX > 2)
|
if (coll->FloorTiltX > 2)
|
||||||
dir = -ANGLE(90.0f);
|
direction = -ANGLE(90.0f);
|
||||||
else if (coll->FloorTiltX < -2)
|
else if (coll->FloorTiltX < -2)
|
||||||
dir = ANGLE(90.0f);
|
direction = ANGLE(90.0f);
|
||||||
|
|
||||||
if (coll->FloorTiltZ > 2 && coll->FloorTiltZ > abs(coll->FloorTiltX))
|
if (coll->FloorTiltZ > 2 && coll->FloorTiltZ > abs(coll->FloorTiltX))
|
||||||
dir = ANGLE(180.0f);
|
direction = ANGLE(180.0f);
|
||||||
else if (coll->FloorTiltZ < -2 && -coll->FloorTiltZ > abs(coll->FloorTiltX))
|
else if (coll->FloorTiltZ < -2 && -coll->FloorTiltZ > abs(coll->FloorTiltX))
|
||||||
dir = ANGLE(0.0f);
|
direction = ANGLE(0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
return dir;
|
return direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetLaraJumpDirection(ITEM_INFO* item, COLL_INFO* coll)
|
void SetLaraJumpDirection(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
|
@ -301,7 +301,7 @@ void SetLaraSlideState(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
{
|
{
|
||||||
LaraInfo*& info = item->data;
|
LaraInfo*& info = item->data;
|
||||||
|
|
||||||
short direction = GetLaraSlideDirection(coll);
|
short direction = GetLaraSlideDirection(item, coll);
|
||||||
short delta = direction - item->pos.yRot;
|
short delta = direction - item->pos.yRot;
|
||||||
static short oldAngle = 1;
|
static short oldAngle = 1;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ void DoLaraCrawlToHangSnap(ITEM_INFO* item, COLL_INFO* coll);
|
||||||
void DoLaraCrawlFlex(ITEM_INFO* item, COLL_INFO* coll, short maxAngle, short rate);
|
void DoLaraCrawlFlex(ITEM_INFO* item, COLL_INFO* coll, short maxAngle, short rate);
|
||||||
void DoLaraFallDamage(ITEM_INFO* item);
|
void DoLaraFallDamage(ITEM_INFO* item);
|
||||||
|
|
||||||
short GetLaraSlideDirection(COLL_INFO* coll);
|
short GetLaraSlideDirection(ITEM_INFO* item, COLL_INFO* coll);
|
||||||
|
|
||||||
void SetLaraJumpDirection(ITEM_INFO* item, COLL_INFO* coll);
|
void SetLaraJumpDirection(ITEM_INFO* item, COLL_INFO* coll);
|
||||||
void SetLaraRunJumpQueue(ITEM_INFO* item, COLL_INFO* coll);
|
void SetLaraRunJumpQueue(ITEM_INFO* item, COLL_INFO* coll);
|
||||||
|
|
|
@ -365,11 +365,6 @@ void GetCollisionInfo(COLL_INFO* coll, ITEM_INFO* item, PHD_VECTOR offset, bool
|
||||||
coll->Front.Floor = height;
|
coll->Front.Floor = height;
|
||||||
coll->Front.Ceiling = ceiling;
|
coll->Front.Ceiling = ceiling;
|
||||||
|
|
||||||
// Extra GCI call for front probe going beyond radius causes bugs with sector flag detection.
|
|
||||||
// It appears to be a dubious solution to an aspect of floor slope collision.
|
|
||||||
// Commenting out for now. Let's see what happens... @Sezz 2021.01.23
|
|
||||||
//collResult = GetCollisionResult(x + xfront, y, z + zfront, topRoomNumber);
|
|
||||||
|
|
||||||
if (playerCollision)
|
if (playerCollision)
|
||||||
{
|
{
|
||||||
tfLocation = GetRoom(tfLocation, x + xfront, y, z + zfront);
|
tfLocation = GetRoom(tfLocation, x + xfront, y, z + zfront);
|
||||||
|
@ -378,7 +373,6 @@ void GetCollisionInfo(COLL_INFO* coll, ITEM_INFO* item, PHD_VECTOR offset, bool
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
height = GetCollisionResult(x + xfront, y, z + zfront, topRoomNumber).Position.Floor;
|
height = GetCollisionResult(x + xfront, y, z + zfront, topRoomNumber).Position.Floor;
|
||||||
// height = collResult.Position.Floor; // Old. @Sezz 2021.01.23
|
|
||||||
}
|
}
|
||||||
if (height != NO_HEIGHT) height -= (playerCollision ? yPos : y);
|
if (height != NO_HEIGHT) height -= (playerCollision ? yPos : y);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue