Merge branch 'master' into item_data

# Conflicts:
#	TR5Main/Game/items.cpp
This commit is contained in:
Nils 2021-09-04 11:52:34 +02:00
commit d08a1fa596
21 changed files with 146 additions and 274 deletions

View file

@ -912,7 +912,7 @@ void LaraAboveWater(ITEM_INFO* item, COLL_INFO* coll) //hmmmm
if (Lara.ExtraAnim == -1)
{
// Check for collision with items
LaraBaddieCollision(item, coll);
DoObjectCollision(item, coll);
// Handle Lara collision
if (Lara.Vehicle == NO_ITEM)
@ -1030,7 +1030,7 @@ void LaraUnderWater(ITEM_INFO* item, COLL_INFO* coll)
item->pos.yPos -= item->fallspeed * phd_sin(item->pos.xRot) / 4;
item->pos.zPos += phd_cos(item->pos.xRot) * item->fallspeed * phd_cos(item->pos.yRot) / 4;
LaraBaddieCollision(item, coll);
DoObjectCollision(item, coll);
if (/*Lara.ExtraAnim == -1 &&*/ Lara.Vehicle == NO_ITEM)
lara_collision_routines[item->currentAnimState](item, coll);
@ -1088,7 +1088,7 @@ void LaraSurface(ITEM_INFO* item, COLL_INFO* coll)
item->pos.xPos += item->fallspeed * phd_sin(Lara.moveAngle) / 4;
item->pos.zPos += item->fallspeed * phd_cos(Lara.moveAngle) / 4;
LaraBaddieCollision(item, coll);
DoObjectCollision(item, coll);
if (Lara.Vehicle == NO_ITEM)
lara_collision_routines[item->currentAnimState](item, coll);

View file

@ -434,6 +434,7 @@ void lara_col_all4s(ITEM_INFO* item, COLL_INFO* coll)
}
auto collResult = LaraCollisionFront(item, item->pos.yRot, -300);
height = collResult.FloorHeight;
if (abs(height) >= 255 || collResult.HeightType == BIG_SLOPE)
{
@ -483,7 +484,7 @@ void lara_col_all4s(ITEM_INFO* item, COLL_INFO* coll)
}
}
}
else if (!(abs(height) >= 127))
else if (!(abs(height) >= STEP_SIZE))
{
item->goalAnimState = LS_CRAWL_BACK;
}

View file

@ -1034,7 +1034,10 @@ int SearchLOT(LOT_INFO* LOT, int depth)
continue;
delta = g_Level.Boxes[boxNumber].height - box->height;
if ((delta > LOT->step || delta < LOT->drop) && !((flags & BOX_MONKEY) && LOT->canMonkey))
if ((delta > LOT->step || delta < LOT->drop) && (!(flags & BOX_MONKEY) || !LOT->canMonkey))
continue;
if ((flags & BOX_JUMP) && !LOT->canJump)
continue;
expand = &LOT->node[boxNumber];
@ -1147,9 +1150,8 @@ int StalkBox(ITEM_INFO* item, ITEM_INFO* enemy, int boxNumber)
if (x > xrange || x < -xrange || z > zrange || z < -zrange)
return false;
enemyQuad = enemy->pos.yRot / 16384 + 2;
enemyQuad = enemy->pos.yRot / ANGLE(90) + 2;
// boxQuad = (z <= 0 ? (x <= 0 ? 0 : 3) : (x > 0) + 1);
if (z > 0)
boxQuad = (x > 0) ? 2 : 1;
else
@ -1185,13 +1187,20 @@ int CreatureVault(short itemNum, short angle, int vault, int shift)
CreatureAnimation(itemNum, angle, 0);
if (item->floor > y + CHECK_CLICK(13) && creature->LOT.drop == -1792)
vault = -7;
if (item->floor > y + CHECK_CLICK(9))
vault = 0;
else if (item->floor > y + CHECK_CLICK(7))
vault = -4;
else if (item->floor > y + CHECK_CLICK(5))
// FIXME: edit assets adding climb down animations for Von Croy and baddies?
else if (item->floor > y + CHECK_CLICK(5)
&& item->objectNumber != ID_VON_CROY
&& item->objectNumber != ID_BADDY1
&& item->objectNumber != ID_BADDY2)
vault = -3;
else if (item->floor > y + CHECK_CLICK(3) && item->objectNumber != ID_BADDY1 && item->objectNumber != ID_BADDY2) // Baddy 1&2 don't have some climb down animations
else if (item->floor > y + CHECK_CLICK(3)
&& item->objectNumber != ID_VON_CROY
&& item->objectNumber != ID_BADDY1
&& item->objectNumber != ID_BADDY2)
vault = -2;
else if (item->pos.yPos > y - CHECK_CLICK(3))
return 0;
@ -1199,11 +1208,10 @@ int CreatureVault(short itemNum, short angle, int vault, int shift)
vault = 2;
else if (item->pos.yPos > y - CHECK_CLICK(7))
vault = 3;
else if (item->pos.yPos > y - CHECK_CLICK(15) && creature->LOT.step == 1792)
vault = 7;
else
vault = 4;
// Jump
newXblock = item->pos.xPos / SECTOR(1);
newZblock = item->pos.zPos / SECTOR(1);
@ -1261,7 +1269,7 @@ void GetAITarget(CREATURE_INFO* creature)
enemyObjectNumber = NO_ITEM;
item = &g_Level.Items[creature->itemNum];
if (item->aiBits & GUARD)
{
creature->enemy = LaraItem;
@ -1271,7 +1279,7 @@ void GetAITarget(CREATURE_INFO* creature)
if (item->aiBits & AMBUSH)
item->aiBits |= MODIFY;
}
}
}
else if (item->aiBits & PATROL1)
{
if (creature->alerted || creature->hurtByLara)
@ -1280,20 +1288,24 @@ void GetAITarget(CREATURE_INFO* creature)
if (item->aiBits & AMBUSH)
{
item->aiBits |= MODIFY;
item->itemFlags[3] = (item->TOSSPAD & 0xFF);
// NOTE: added in TR5
//item->itemFlags[3] = (item->TOSSPAD & 0xFF);
}
}
else if (!creature->patrol2 && enemyObjectNumber != ID_AI_PATROL1)
else if (!creature->patrol2)
{
FindAITargetObject(creature, ID_AI_PATROL1);
if (enemyObjectNumber != ID_AI_PATROL1)
{
FindAITargetObject(creature, ID_AI_PATROL1);
}
}
else if (creature->patrol2 && enemyObjectNumber != ID_AI_PATROL2)
else if (enemyObjectNumber != ID_AI_PATROL2)
{
FindAITargetObject(creature, ID_AI_PATROL2);
}
else if (abs(enemy->pos.xPos - item->pos.xPos) < REACHED_GOAL_RADIUS &&
abs(enemy->pos.zPos - item->pos.zPos) < REACHED_GOAL_RADIUS &&
abs(enemy->pos.yPos - item->pos.yPos) < REACHED_GOAL_RADIUS
abs(enemy->pos.yPos - item->pos.yPos) < REACHED_GOAL_RADIUS &&
abs(enemy->pos.zPos - item->pos.zPos) < REACHED_GOAL_RADIUS
|| Objects[item->objectNumber].waterCreature)
{
TestTriggers(enemy, true, NULL);
@ -1302,29 +1314,33 @@ void GetAITarget(CREATURE_INFO* creature)
}
else if (item->aiBits & AMBUSH)
{
if (!(item->aiBits & MODIFY) && !creature->hurtByLara)
// First if was removed probably after TR3 and was it used by monkeys?
/*if (!(item->aiBits & MODIFY) && !creature->hurtByLara)
{
creature->enemy = LaraItem;
}
else if (enemyObjectNumber != ID_AI_AMBUSH)
else*/ if (enemyObjectNumber != ID_AI_AMBUSH)
{
FindAITargetObject(creature, ID_AI_AMBUSH);
}
else if (item->objectNumber == ID_MONKEY)
/*else if (item->objectNumber == ID_MONKEY)
{
return;
}
}*/
else if (abs(enemy->pos.xPos - item->pos.xPos) < REACHED_GOAL_RADIUS &&
abs(enemy->pos.zPos - item->pos.zPos) < REACHED_GOAL_RADIUS &&
abs(enemy->pos.yPos - item->pos.yPos) < REACHED_GOAL_RADIUS)
abs(enemy->pos.yPos - item->pos.yPos) < REACHED_GOAL_RADIUS &&
abs(enemy->pos.zPos - item->pos.zPos) < REACHED_GOAL_RADIUS)
{
TestTriggers(enemy, true, NULL);
creature->reachedGoal = true;
creature->enemy = LaraItem;
item->aiBits &= ~(AMBUSH|MODIFY);
item->aiBits |= GUARD;
creature->alerted = false;
item->aiBits &= ~(AMBUSH /* | MODIFY*/);
if (item->aiBits != MODIFY)
{
item->aiBits |= GUARD;
creature->alerted = false;
}
}
}
else if (item->aiBits & FOLLOW)
@ -1343,15 +1359,15 @@ void GetAITarget(CREATURE_INFO* creature)
{
FindAITargetObject(creature, ID_AI_FOLLOW);
}
else if (abs(enemy->pos.xPos - item->pos.xPos) < REACHED_GOAL_RADIUS &&
abs(enemy->pos.zPos - item->pos.zPos) < REACHED_GOAL_RADIUS &&
abs(enemy->pos.yPos - item->pos.yPos) < REACHED_GOAL_RADIUS)
else if (abs(enemy->pos.xPos - item->pos.xPos) < REACHED_GOAL_RADIUS &&
abs(enemy->pos.yPos - item->pos.yPos) < REACHED_GOAL_RADIUS &&
abs(enemy->pos.zPos - item->pos.zPos) < REACHED_GOAL_RADIUS)
{
creature->reachedGoal = true;
item->aiBits &= ~FOLLOW;
}
}
else if (item->objectNumber == ID_MONKEY && item->carriedItem == NO_ITEM)
/*else if (item->objectNumber == ID_MONKEY && item->carriedItem == NO_ITEM)
{
if (item->aiBits != MODIFY)
{
@ -1367,10 +1383,10 @@ void GetAITarget(CREATURE_INFO* creature)
FindAITargetObject(creature, ID_KEY_ITEM4);
}
}
}
}*/
}
// tr3 old way..
// TR3 old way..
void FindAITarget(CREATURE_INFO* creature, short objectNumber)
{
ITEM_INFO* item = &g_Level.Items[creature->itemNum];
@ -1412,6 +1428,11 @@ void FindAITargetObject(CREATURE_INFO* creature, short objectNumber)
r = &g_Level.Rooms[aiObject->roomNumber];
aiObject->boxNumber = XZ_GET_SECTOR(r, aiObject->x - r->x, aiObject->z - r->z)->box;
if (item->boxNumber == NO_BOX || aiObject->boxNumber == NO_BOX)
{
return;
}
if (zone[item->boxNumber] == zone[aiObject->boxNumber])
{
foundObject = aiObject;
@ -1525,11 +1546,12 @@ void CreatureAIInfo(ITEM_INFO* item, AI_INFO* info)
}
info->angle = angle - item->pos.yRot;
info->enemyFacing = -ANGLE(180) + angle - enemy->pos.yRot;
info->enemyFacing = 0x8000 + angle - enemy->pos.yRot;
x = abs(x);
z = abs(z);
// Makes Lara smaller
if (enemy == LaraItem)
{
short laraState = LaraItem->currentAnimState;
@ -1545,9 +1567,9 @@ void CreatureAIInfo(ITEM_INFO* item, AI_INFO* info)
}
if (x > z)
info->xAngle = phd_atan(x + (z / 2), y);
info->xAngle = phd_atan(x + (z >> 1), y);
else
info->xAngle = phd_atan(z + (x / 2), y);
info->xAngle = phd_atan(z + (x >> 1), y);
info->ahead = (info->angle > -FRONT_ARC && info->angle < FRONT_ARC);
info->bite = (info->ahead && enemy->hitPoints > 0 && abs(enemy->pos.yPos - item->pos.yPos) <= (STEP_SIZE * 2));
@ -1571,7 +1593,7 @@ void CreatureMood(ITEM_INFO* item, AI_INFO* info, int violent)
switch (creature->mood)
{
case BORED_MOOD:
boxNumber = LOT->node[GetRandomControl() * LOT->zoneCount / 32768].boxNumber;
boxNumber = LOT->node[GetRandomControl() * LOT->zoneCount >> 15].boxNumber;
if (ValidBox(item, info->zoneNumber, boxNumber)
&& !(GetRandomControl() & 0x0F))
{
@ -1601,7 +1623,7 @@ void CreatureMood(ITEM_INFO* item, AI_INFO* info, int violent)
break;
case ESCAPE_MOOD:
boxNumber = LOT->node[GetRandomControl() * LOT->zoneCount / 32768].boxNumber;
boxNumber = LOT->node[GetRandomControl() * LOT->zoneCount >> 15].boxNumber;
if (ValidBox(item, info->zoneNumber, boxNumber) && LOT->requiredBox == NO_BOX)
{
if (EscapeBox(item, enemy, boxNumber))
@ -1619,7 +1641,7 @@ void CreatureMood(ITEM_INFO* item, AI_INFO* info, int violent)
case STALK_MOOD:
if (LOT->requiredBox == NO_BOX || !StalkBox(item, enemy, LOT->requiredBox))
{
boxNumber = LOT->node[GetRandomControl() * LOT->zoneCount / 32768].boxNumber;
boxNumber = LOT->node[GetRandomControl() * LOT->zoneCount >> 15].boxNumber;
if (ValidBox(item, info->zoneNumber, boxNumber))
{
if (StalkBox(item, enemy, boxNumber))
@ -1688,7 +1710,7 @@ void CreatureMood(ITEM_INFO* item, AI_INFO* info, int violent)
{
nextBox = g_Level.Overlaps[overlapIndex].box;
flags = g_Level.Overlaps[overlapIndex++].flags;
} while (nextBox != NO_BOX && ((flags & BOX_END_BIT) == FALSE) && (nextBox != startBox));
} while (nextBox != NO_BOX && ((flags & BOX_END_BIT) == false) && (nextBox != startBox));
}
if (nextBox == startBox)

View file

@ -20,87 +20,6 @@ BOUNDING_BOX GlobalCollisionBounds;
ITEM_INFO* CollidedItems[MAX_COLLIDED_OBJECTS];
MESH_INFO* CollidedMeshes[MAX_COLLIDED_OBJECTS];
int CollideStaticObjects(COLL_INFO* coll, int x, int y, int z, short roomNumber, int hite)
{
ROOM_INFO* room;
MESH_INFO* mesh;
short roomList[255];
short numRooms = 0;
int xMin = 0, xMax = 0, zMin = 0, zMax = 0;
int inXmin, inXmax, inZmin, inZmax, inYmin;
coll->hitStatic = false;
inXmin = x - coll->radius;
inXmax = x + coll->radius;
inZmin = z - coll->radius;
inZmax = z + coll->radius;
inYmin = y - hite;
// Collect all the rooms where to check
GetRoomList(roomNumber, roomList, &numRooms);
for (int i = 0; i < numRooms; i++)
{
room = &g_Level.Rooms[roomList[i]];
for (int j = 0; j < room->mesh.size(); j++, mesh++)
{
mesh = &room->mesh[j];
STATIC_INFO* sInfo = &StaticObjects[mesh->staticNumber];
if ((sInfo->flags & 1)) // No collision
continue;
int yMin = mesh->y + sInfo->collisionBox.Y1;
int yMax = mesh->y + sInfo->collisionBox.Y2;
short yRot = mesh->yRot;
if (yRot == ANGLE(180))
{
xMin = mesh->x - sInfo->collisionBox.X2;
xMax = mesh->x - sInfo->collisionBox.X1;
zMin = mesh->z - sInfo->collisionBox.Z2;
zMax = mesh->z - sInfo->collisionBox.Z1;
}
else if (yRot == -ANGLE(90))
{
xMin = mesh->x - sInfo->collisionBox.Z2;
xMax = mesh->x - sInfo->collisionBox.Z1;
zMin = mesh->z + sInfo->collisionBox.X1;
zMax = mesh->z + sInfo->collisionBox.X2;
}
else if (yRot == ANGLE(90))
{
xMin = mesh->x + sInfo->collisionBox.Z1;
xMax = mesh->x + sInfo->collisionBox.Z2;
zMin = mesh->z - sInfo->collisionBox.X2;
zMax = mesh->z - sInfo->collisionBox.X1;
}
else
{
xMin = mesh->x + sInfo->collisionBox.X1;
xMax = mesh->x + sInfo->collisionBox.X2;
zMin = mesh->z + sInfo->collisionBox.Z1;
zMax = mesh->z + sInfo->collisionBox.Z2;
}
if (inXmax <= xMin
|| inXmin >= xMax
|| y <= yMin
|| inYmin >= yMax
|| inZmax <= zMin
|| inZmin >= zMax)
continue;
coll->hitStatic = true;
return 1;
}
}
return 0;
}
int GetCollidedObjects(ITEM_INFO* collidingItem, int radius, int onlyVisible, ITEM_INFO** collidedItems, MESH_INFO** collidedMeshes, int ignoreLara)
{
ROOM_INFO* room;
@ -388,7 +307,7 @@ int TestBoundsCollideStatic(BOUNDING_BOX* bounds, PHD_3DPOS* pos, int radius)
}
}
int ItemPushLaraStatic(ITEM_INFO* item, BOUNDING_BOX* bounds, PHD_3DPOS* pos, COLL_INFO* coll)
int ItemPushStatic(ITEM_INFO* l, BOUNDING_BOX* bounds, PHD_3DPOS* pos, COLL_INFO* coll) // previously ItemPushLaraStatic
{
float c, s;
int dx, dz, rx, rz, minX, maxX, minZ, maxZ;
@ -397,8 +316,8 @@ int ItemPushLaraStatic(ITEM_INFO* item, BOUNDING_BOX* bounds, PHD_3DPOS* pos, CO
c = phd_cos(pos->yRot);
s = phd_sin(pos->yRot);
dx = LaraItem->pos.xPos - pos->xPos;
dz = LaraItem->pos.zPos - pos->zPos;
dx = l->pos.xPos - pos->xPos;
dz = l->pos.zPos - pos->zPos;
rx = c * dx - s * dz;
rz = c * dz + s * dx;
minX = bounds->X1 - coll->radius;
@ -428,40 +347,40 @@ int ItemPushLaraStatic(ITEM_INFO* item, BOUNDING_BOX* bounds, PHD_3DPOS* pos, CO
else
rz -= bottom;
item->pos.xPos = pos->xPos + c * rx + s * rz;
item->pos.zPos = pos->zPos + c * rz - s * rx;
l->pos.xPos = pos->xPos + c * rx + s * rz;
l->pos.zPos = pos->zPos + c * rz - s * rx;
coll->badPos = NO_BAD_POS;
coll->badNeg = -STEPUP_HEIGHT;
coll->badCeiling = 0;
oldFacing = coll->facing;
coll->facing = phd_atan(item->pos.zPos - coll->old.z, item->pos.xPos - coll->old.x);
if (item == LaraItem)
coll->facing = phd_atan(l->pos.zPos - coll->old.z, l->pos.xPos - coll->old.x);
if (l == LaraItem)
{
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
GetCollisionInfo(coll, l->pos.xPos, l->pos.yPos, l->pos.zPos, l->roomNumber, LARA_HEIGHT);
}
else
{
GetObjectCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HEIGHT);
GetObjectCollisionInfo(coll, l->pos.xPos, l->pos.yPos, l->pos.zPos, l->roomNumber, LARA_HEIGHT);
}
coll->facing = oldFacing;
if (coll->collType == CT_NONE)
{
coll->old.x = item->pos.xPos;
coll->old.y = item->pos.yPos;
coll->old.z = item->pos.zPos;
coll->old.x = l->pos.xPos;
coll->old.y = l->pos.yPos;
coll->old.z = l->pos.zPos;
UpdateLaraRoom(item, -10);
UpdateLaraRoom(l, -10);
}
else
{
item->pos.xPos = coll->old.x;
item->pos.zPos = coll->old.z;
l->pos.xPos = coll->old.x;
l->pos.zPos = coll->old.z;
}
if (item == LaraItem && Lara.isMoving && Lara.moveCount > 15)
if (l == LaraItem && Lara.isMoving && Lara.moveCount > 15)
{
Lara.isMoving = false;
Lara.gunStatus = LG_NO_ARMS;
@ -470,7 +389,7 @@ int ItemPushLaraStatic(ITEM_INFO* item, BOUNDING_BOX* bounds, PHD_3DPOS* pos, CO
return true;
}
int ItemPushLara(ITEM_INFO* item, ITEM_INFO* l, COLL_INFO* coll, int spazon, char bigpush)
int ItemPushItem(ITEM_INFO* item, ITEM_INFO* l, COLL_INFO* coll, int spazon, char bigpush) // previously ItemPushLara
{
float c, s;
int dx, dz, rx, rz, minX, maxX, minZ, maxZ;
@ -618,7 +537,7 @@ void ObjectCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* c)
if (TestCollision(item, l))
{
if (c->enableBaddiePush)
ItemPushLara(item, l, c, false, true);
ItemPushItem(item, l, c, false, true);
}
}
}
@ -902,7 +821,7 @@ void CreatureCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)
{
if (coll->enableBaddiePush || Lara.waterStatus == LW_UNDERWATER || Lara.waterStatus == LW_SURFACE)
{
ItemPushLara(item, l, coll, coll->enableSpaz, 0);
ItemPushItem(item, l, coll, coll->enableSpaz, 0);
}
else if (coll->enableSpaz)
{
@ -1148,17 +1067,15 @@ void GetCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int roomNum
int yTop = y - LARA_HEADROOM;
int z = zPos;
ROOM_VECTOR tfLocation = GetRoom(LaraItem->location, x, yTop, z);
auto collResult = GetCollisionResult(x, yTop, z, roomNumber);
auto topRoomNumber = collResult.RoomNumber; // Keep top room number as we need it to re-probe from origin room
ROOM_VECTOR tfLocation = GetRoom(LaraItem->location, x, yTop, z);
int height = GetFloorHeight(tfLocation, x, z).value_or(NO_HEIGHT);
if (height != NO_HEIGHT)
height -= yPos;
ROOM_VECTOR tcLocation = GetRoom(LaraItem->location, x, yTop - LaraItem->fallspeed, z);
int ceiling = GetCeilingHeight(tcLocation, x, z).value_or(NO_HEIGHT);
if (ceiling != NO_HEIGHT)
ceiling -= y;
@ -1220,13 +1137,6 @@ void GetCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int roomNum
break;
}
//XFront = phd_sin(coll->facing) * coll->radius; // WAS COMMENTED BEFORE LWMTE FLOORDATA REFACTOR!
//ZFront = phd_cos(coll->facing) * coll->radius; // WAS COMMENTED BEFORE LWMTE FLOORDATA REFACTOR!
//xleft = -ZFront; // WAS COMMENTED BEFORE LWMTE FLOORDATA REFACTOR!
//zleft = XFront; // WAS COMMENTED BEFORE LWMTE FLOORDATA REFACTOR!
//xright = ZFront; // WAS COMMENTED BEFORE LWMTE FLOORDATA REFACTOR!
//zright = -XFront; // WAS COMMENTED BEFORE LWMTE FLOORDATA REFACTOR!
x = xfront + xPos;
z = zfront + zPos;
@ -1237,18 +1147,14 @@ void GetCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int roomNum
topRoomNumber = roomNumber;
}
tfLocation = GetRoom(tfLocation, x, yTop, z);
//floor = GetFloor(x, yTop, z, &tRoomNumber);
//DoFloorThings(floor, x, yTop, z);
collResult = GetCollisionResult(x, yTop, z, topRoomNumber);
tfLocation = GetRoom(tfLocation, x, yTop, z);
height = GetFloorHeight(tfLocation, x, z).value_or(NO_HEIGHT);
if (height != NO_HEIGHT)
height -= yPos;
tcLocation = GetRoom(tcLocation, x, yTop - LaraItem->fallspeed, z);
ceiling = GetCeilingHeight(tcLocation, x, z).value_or(NO_HEIGHT);
if (ceiling != NO_HEIGHT)
ceiling -= y;
@ -1259,8 +1165,6 @@ void GetCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int roomNum
coll->front.SplitFloor = collResult.SplitFloor;
coll->front.SplitCeiling = collResult.SplitCeiling;
//floor = GetFloor(x + XFront, yTop, z + ZFront, &tRoomNumber);
//DoFloorThings(floor, x + XFront, yTop, z + ZFront);
collResult = GetCollisionResult(x + xfront, yTop, z + zfront, topRoomNumber);
tfLocation = GetRoom(tfLocation, x + xfront, yTop, z + zfront);
@ -1292,19 +1196,14 @@ void GetCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int roomNum
x = xPos + xleft;
z = zPos + zleft;
ROOM_VECTOR lrfLocation = GetRoom(LaraItem->location, x, yTop, z);
//short lrRoomNumber = roomNumber;
//floor = GetFloor(x, yTop, z, &lrRoomNumber);
//DoFloorThings(floor, x, yTop, z);
collResult = GetCollisionResult(x, yTop, z, roomNumber);
ROOM_VECTOR lrfLocation = GetRoom(LaraItem->location, x, yTop, z);
height = GetFloorHeight(lrfLocation, x, z).value_or(NO_HEIGHT);
if (height != NO_HEIGHT)
height -= yPos;
ROOM_VECTOR lrcLocation = GetRoom(LaraItem->location, x, yTop - LaraItem->fallspeed, z);
ceiling = GetCeilingHeight(lrcLocation, x, z).value_or(NO_HEIGHT);
if (ceiling != NO_HEIGHT)
ceiling -= y;
@ -1322,18 +1221,14 @@ void GetCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int roomNum
else if (coll->lavaIsPit && coll->middleLeft.Floor > 0 && collResult.BottomBlock->Flags.Death)
coll->middleLeft.Floor = STOP_SIZE;
tfLocation = GetRoom(tfLocation, x, yTop, z);
//floor = GetFloor(x + XFront, yTop, z + ZFront, &tRoomNumber); // WRONG COPYPASTE BY CHOCO
//DoFloorThings(floor, x, yTop, z);
collResult = GetCollisionResult(x, yTop, z, topRoomNumber); // We use plain x/z values here, proposed by Choco
tfLocation = GetRoom(tfLocation, x, yTop, z);
height = GetFloorHeight(tfLocation, x, z).value_or(NO_HEIGHT);
if (height != NO_HEIGHT)
height -= yPos;
tcLocation = GetRoom(tcLocation, x, yTop - LaraItem->fallspeed, z);
ceiling = GetCeilingHeight(tcLocation, x, z).value_or(NO_HEIGHT);
if (ceiling != NO_HEIGHT)
ceiling -= y;
@ -1354,19 +1249,14 @@ void GetCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int roomNum
x = xPos + xright;
z = zPos + zright;
lrfLocation = GetRoom(LaraItem->location, x, yTop, z);
//lrRoomNumber = roomNumber;
//floor = GetFloor(x, yTop, z, &lrRoomNumber);
//DoFloorThings(floor, x, yTop, z);
collResult = GetCollisionResult(x, yTop, z, roomNumber);
lrfLocation = GetRoom(LaraItem->location, x, yTop, z);
height = GetFloorHeight(lrfLocation, x, z).value_or(NO_HEIGHT);
if (height != NO_HEIGHT)
height -= yPos;
lrcLocation = GetRoom(LaraItem->location, x, yTop - LaraItem->fallspeed, z);
ceiling = GetCeilingHeight(lrcLocation, x, z).value_or(NO_HEIGHT);
if (ceiling != NO_HEIGHT)
ceiling -= y;
@ -1384,18 +1274,14 @@ void GetCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int roomNum
else if (coll->lavaIsPit && coll->middleRight.Floor > 0 && collResult.BottomBlock->Flags.Death)
coll->middleRight.Floor = STOP_SIZE;
tfLocation = GetRoom(tfLocation, x, yTop, z);
//floor = GetFloor(x, yTop, z, &tRoomNumber);
//DoFloorThings(floor, x, yTop, z);
collResult = GetCollisionResult(x, yTop, z, topRoomNumber);
tfLocation = GetRoom(tfLocation, x, yTop, z);
height = GetFloorHeight(tfLocation, x, z).value_or(NO_HEIGHT);
if (height != NO_HEIGHT)
height -= yPos;
tcLocation = GetRoom(tcLocation, x, yTop - LaraItem->fallspeed, z);
ceiling = GetCeilingHeight(tcLocation, x, z).value_or(NO_HEIGHT);
if (ceiling != NO_HEIGHT)
ceiling -= y;
@ -1413,8 +1299,6 @@ void GetCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int roomNum
else if (coll->lavaIsPit && coll->frontRight.Floor > 0 && collResult.BottomBlock->Flags.Death)
coll->frontRight.Floor = STOP_SIZE;
CollideStaticObjects(coll, xPos, yPos, zPos, topRoomNumber, objectHeight);
if (coll->middle.Floor == NO_HEIGHT)
{
coll->shift.x = coll->old.x - xPos;
@ -1615,9 +1499,6 @@ void GetObjectCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int r
int yTop = y - LARA_HEADROOM;
int z = zPos;
//short tRoomNumber = roomNumber;
//FLOOR_INFO* floor = GetFloor(x, yTop, z, &tRoomNumber);
//int height = GetFloorHeight(floor, x, yTop, z);
auto collResult = GetCollisionResult(x, yTop, z, roomNumber);
auto topRoomNumber = collResult.RoomNumber;
@ -1685,23 +1566,12 @@ void GetObjectCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int r
break;
}
//XFront = phd_sin(coll->facing) * coll->radius; // WAS COMMENTED BEFORE LWMTE FLOORDATA REFACTOR!
//ZFront = phd_cos(coll->facing) * coll->radius; // WAS COMMENTED BEFORE LWMTE FLOORDATA REFACTOR!
//xleft = -ZFront; // WAS COMMENTED BEFORE LWMTE FLOORDATA REFACTOR!
//zleft = XFront; // WAS COMMENTED BEFORE LWMTE FLOORDATA REFACTOR!
//xright = ZFront; // WAS COMMENTED BEFORE LWMTE FLOORDATA REFACTOR!
//zright = -XFront; // WAS COMMENTED BEFORE LWMTE FLOORDATA REFACTOR!
x = xfront + xPos;
z = zfront + zPos;
if (resetRoom)
topRoomNumber = roomNumber;
//floor = GetFloor(x, yTop, z, &tRoomNumber);
//
//height = GetFloorHeight(floor, x, yTop, z);
collResult = GetCollisionResult(x, yTop, z, topRoomNumber);
if (collResult.FloorHeight != NO_HEIGHT)
collResult.FloorHeight -= yPos;
@ -1716,10 +1586,7 @@ void GetObjectCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int r
coll->front.SplitFloor = collResult.SplitFloor;
coll->front.SplitCeiling = collResult.SplitCeiling;
//floor = GetFloor(x + XFront, yTop, z + ZFront, &tRoomNumber);
//height = GetFloorHeight(floor, x + XFront, yTop, z + ZFront);
collResult = GetCollisionResult(x + xfront, yTop, z + zfront, topRoomNumber);
if (collResult.FloorHeight != NO_HEIGHT)
collResult.FloorHeight -= yPos;
@ -1747,11 +1614,6 @@ void GetObjectCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int r
x = xPos + xleft;
z = zPos + zleft;
//short lrRoomNumber = roomNumber;
//floor = GetFloor(x, yTop, z, &lrRoomNumber);
//
//height = GetFloorHeight(floor, x, yTop, z);
collResult = GetCollisionResult(x + xfront, yTop, z + zfront, roomNumber);
if (collResult.FloorHeight != NO_HEIGHT)
collResult.FloorHeight -= yPos;
@ -1773,10 +1635,6 @@ void GetObjectCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int r
else if (coll->lavaIsPit && coll->middleLeft.Floor > 0 && collResult.BottomBlock->Flags.Death)
coll->middleLeft.Floor = STOP_SIZE;
//floor = GetFloor(x, yTop, z, &tRoomNumber);
//
//height = GetFloorHeight(floor, x, yTop, z);
collResult = GetCollisionResult(x, yTop, z, topRoomNumber);
if (collResult.FloorHeight != NO_HEIGHT)
collResult.FloorHeight -= yPos;
@ -1801,13 +1659,7 @@ void GetObjectCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int r
x = xPos + xright;
z = zPos + zright;
//lrRoomNumber = roomNumber;
//floor = GetFloor(x, yTop, z, &lrRoomNumber);
//
//height = GetFloorHeight(floor, x, yTop, z);
collResult = GetCollisionResult(x, yTop, z, roomNumber);
if (collResult.FloorHeight != NO_HEIGHT)
collResult.FloorHeight -= yPos;
@ -1828,12 +1680,7 @@ void GetObjectCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int r
else if (coll->lavaIsPit && coll->middleRight.Floor > 0 && collResult.BottomBlock->Flags.Death)
coll->middleRight.Floor = STOP_SIZE;
//floor = GetFloor(x, yTop, z, &tRoomNumber);
//
//height = GetFloorHeight(floor, x, yTop, z);
collResult = GetCollisionResult(x, yTop, z, topRoomNumber);
if (collResult.FloorHeight != NO_HEIGHT)
collResult.FloorHeight -= yPos;
@ -1853,8 +1700,6 @@ void GetObjectCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int r
coll->frontRight.Floor = STOP_SIZE;
else if (coll->lavaIsPit && coll->frontRight.Floor > 0 && collResult.BottomBlock->Flags.Death)
coll->frontRight.Floor = STOP_SIZE;
CollideStaticObjects(coll, xPos, yPos, zPos, topRoomNumber, objectHeight);
if (coll->middle.Floor == NO_HEIGHT)
{
@ -2032,7 +1877,7 @@ void GetObjectCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int r
}
}
void DoProjectileDynamics(short itemNumber, int x, int y, int z, int xv, int yv, int zv)
void DoProjectileDynamics(short itemNumber, int x, int y, int z, int xv, int yv, int zv) // previously DoProperDetection
{
int bs, yang;
@ -2521,13 +2366,16 @@ void DoProjectileDynamics(short itemNumber, int x, int y, int z, int xv, int yv,
ItemNewRoom(itemNumber, collResult.RoomNumber);
}
void LaraBaddieCollision(ITEM_INFO* l, COLL_INFO* coll)
void DoObjectCollision(ITEM_INFO* l, COLL_INFO* coll) // previously LaraBaddieCollision
{
ITEM_INFO* item;
OBJECT_INFO* obj;
l->hitStatus = false;
Lara.hitDirection = -1;
coll->hitStatic = false;
if (l == LaraItem)
Lara.hitDirection = -1;
if (l->hitPoints > 0)
{
@ -2564,37 +2412,39 @@ void LaraBaddieCollision(ITEM_INFO* l, COLL_INFO* coll)
itemNumber = item->nextItem;
}
if (coll->enableBaddiePush)
for (int j = 0; j < g_Level.Rooms[roomsToCheck[i]].mesh.size(); j++)
{
for (int j = 0; j < g_Level.Rooms[roomsToCheck[i]].mesh.size(); j++)
MESH_INFO* mesh = &g_Level.Rooms[roomsToCheck[i]].mesh[j];
if (mesh->flags & 1)
{
MESH_INFO* mesh = &g_Level.Rooms[roomsToCheck[i]].mesh[j];
int x = l->pos.xPos - mesh->x;
int y = l->pos.yPos - mesh->y;
int z = l->pos.zPos - mesh->z;
if (mesh->flags & 1)
if (x > -3072 && x < 3072 && y > -3072 && y < 3072 && z > -3072 && z < 3072)
{
int x = l->pos.xPos - mesh->x;
int y = l->pos.yPos - mesh->y;
int z = l->pos.zPos - mesh->z;
PHD_3DPOS pos;
pos.xPos = mesh->x;
pos.yPos = mesh->y;
pos.zPos = mesh->z;
pos.yRot = mesh->yRot;
if (x > -3072 && x < 3072 && y > -3072 && y < 3072 && z > -3072 && z < 3072)
if (TestBoundsCollideStatic(&StaticObjects[mesh->staticNumber].collisionBox, &pos, coll->radius))
{
PHD_3DPOS pos;
pos.xPos = mesh->x;
pos.yPos = mesh->y;
pos.zPos = mesh->z;
pos.yRot = mesh->yRot;
coll->hitStatic = true;
if (TestBoundsCollideStatic(&StaticObjects[mesh->staticNumber].collisionBox, &pos, coll->radius))
ItemPushLaraStatic(l, &StaticObjects[mesh->staticNumber].collisionBox, &pos, coll);
if (coll->enableBaddiePush)
ItemPushStatic(l, &StaticObjects[mesh->staticNumber].collisionBox, &pos, coll);
else
break;
}
}
mesh++;
}
}
}
if (Lara.hitDirection == -1)
if (l == LaraItem && Lara.hitDirection == -1)
Lara.hitFrame = 0;
}
}
@ -2639,7 +2489,7 @@ void GenericSphereBoxCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)
int y = l->pos.yPos;
int z = l->pos.zPos;
if (ItemPushLara(item, l, coll, ((deadlyBits & 1) & coll->enableSpaz), 3) && (deadlyBits & 1))
if (ItemPushItem(item, l, coll, ((deadlyBits & 1) & coll->enableSpaz), 3) && (deadlyBits & 1))
{
l->hitPoints -= item->itemFlags[3];

View file

@ -89,7 +89,6 @@ extern ITEM_INFO* CollidedItems[MAX_ITEMS];
extern MESH_INFO* CollidedMeshes[MAX_ITEMS];
void GenericSphereBoxCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll);
int CollideStaticObjects(COLL_INFO* coll, int x, int y, int z, short roomNumber, int hite);
int GetCollidedObjects(ITEM_INFO* collidingItem, int radius, int flag1, ITEM_INFO** collidedItems, MESH_INFO** collidedMeshes, int flag2);
int TestWithGlobalCollisionBounds(ITEM_INFO* item, ITEM_INFO* lara, COLL_INFO* coll);
void TrapCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* c);
@ -101,11 +100,11 @@ 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);
int ItemPushItem(ITEM_INFO* item, ITEM_INFO* l, COLL_INFO* coll, int spazon, char bigpush);
int ItemPushStatic(ITEM_INFO* l, 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);
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);
@ -114,7 +113,7 @@ void CreatureCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll);
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);
void DoObjectCollision(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);

View file

@ -441,7 +441,7 @@ void DoorCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)
{
if (!(item->objectNumber >= ID_LIFT_DOORS1 && item->objectNumber <= ID_LIFT_DOORS2) || item->itemFlags[0])
{
ItemPushLara(item, l, coll, FALSE, TRUE);
ItemPushItem(item, l, coll, FALSE, TRUE);
}
}
}
@ -980,7 +980,7 @@ void SteelDoorCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll)
if (TestCollision(item, l))
{
if (coll->enableBaddiePush)
ItemPushLara(item, l, coll, 0, 1);
ItemPushItem(item, l, coll, 0, 1);
}
}
}

View file

@ -240,7 +240,7 @@ void TorchControl(short itemNumber)
pos.yPos = CollidedMeshes[0]->y;
pos.zPos = CollidedMeshes[0]->z;
pos.yRot = CollidedMeshes[0]->yRot;
ItemPushLaraStatic(item, &sobj->collisionBox, &pos, &lara_coll);
ItemPushStatic(item, &sobj->collisionBox, &pos, &lara_coll);
}
item->speed /= 2;
}

View file

@ -14,9 +14,7 @@ void ClearItem(short itemNum)
item->collidable = true;
item->data = nullptr;
item->drawRoom = (((item->pos.zPos - room->z) / SECTOR(1)) & 0xFF) | ((((item->pos.xPos - room->x) / SECTOR(1)) & 0xFF) * 256);
item->TOSSPAD = item->pos.yRot & 0xE000;
item->itemFlags[2] = item->roomNumber | ((item->pos.yPos - room->minfloor) & 0xFF00);
item->startPos = item->pos;
}
void KillItem(short itemNum)

View file

@ -501,7 +501,7 @@ void WreckingBallCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll)
z = l->pos.zPos;
test = (x & 1023) > 256 && (x & 1023) < 768 && (z & 1023) > 256 && (z & 1023) < 768;
damage = item->fallspeed > 0 ? 96 : 0;
if (ItemPushLara(item, l, coll, coll->enableSpaz, 1))
if (ItemPushItem(item, l, coll, coll->enableSpaz, 1))
{
if (test)
l->hitPoints = 0;

View file

@ -161,14 +161,14 @@ namespace TEN::Entities::Switches
GlobalCollisionBounds.Z1 = -512;
GlobalCollisionBounds.Z2 = 512;
ItemPushLara(item, l, coll, 0, 2);
ItemPushItem(item, l, coll, 0, 2);
GlobalCollisionBounds.X1 = 256;
GlobalCollisionBounds.X2 = 1024;
GlobalCollisionBounds.Z1 = -128;
GlobalCollisionBounds.Z2 = 128;
ItemPushLara(item, l, coll, 0, 2);
ItemPushItem(item, l, coll, 0, 2);
}
}

View file

@ -229,7 +229,7 @@ void DragonCollision(short itemNum, ITEM_INFO* laraitem, COLL_INFO* coll)
}
}
ItemPushLara(item, laraitem, coll, 1, 0);
ItemPushItem(item, laraitem, coll, 1, 0);
}
void DragonControl(short backNum)

View file

@ -68,9 +68,9 @@ void SkidManCollision(short itemNum, ITEM_INFO* laraitem, COLL_INFO* coll)
if (coll->enableBaddiePush)
{
if (item->speed > 0)
ItemPushLara(item, laraitem, coll, coll->enableSpaz, 0);
ItemPushItem(item, laraitem, coll, coll->enableSpaz, 0);
else
ItemPushLara(item, laraitem, coll, 0, 0);
ItemPushItem(item, laraitem, coll, 0, 0);
}
if (Lara.Vehicle == NO_ITEM && item->speed > 0)

View file

@ -303,7 +303,7 @@ int BigGunControl(COLL_INFO *coll)
coll->enableSpaz = false;
coll->enableBaddiePush = false;
LaraBaddieCollision(lara, coll);
DoObjectCollision(lara, coll);
Camera.targetElevation = -ANGLE(15);
return 1;

View file

@ -733,7 +733,9 @@ static void DoUserInput(ITEM_INFO* v, ITEM_INFO* l, CART_INFO* cart)
coll.quadrant = short((v->pos.yRot + 0x2000) / 0x4000);
coll.radius = CART_RADIUS;
if (CollideStaticObjects(&coll, v->pos.xPos, v->pos.yPos, v->pos.zPos, v->roomNumber, CART_HEIGHT))
DoObjectCollision(v, &coll);
if (coll.hitStatic)
{
int hits;

View file

@ -849,7 +849,7 @@ void NoGetOnCollision(short item_num, ITEM_INFO *laraitem, COLL_INFO *coll)
return;
if (!TestCollision(item, laraitem))
return;
ItemPushLara(item, laraitem, coll, 0, 0);
ItemPushItem(item, laraitem, coll, 0, 0);
}
void SubCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)

View file

@ -141,7 +141,7 @@ void ElementPuzzleDoCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* c)
{
if (c->enableBaddiePush)
{
ItemPushLara(item, l, c, 0, 0);
ItemPushItem(item, l, c, 0, 0);
}
}
}

View file

@ -97,17 +97,17 @@ void ScalesCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)
GlobalCollisionBounds.Z1 = -256;
GlobalCollisionBounds.Z2 = 384;
ItemPushLara(item, l, coll, 0, 2);
ItemPushItem(item, l, coll, 0, 2);
GlobalCollisionBounds.X1 = -256;
GlobalCollisionBounds.X2 = 256;
ItemPushLara(item, l, coll, 0, 2);
ItemPushItem(item, l, coll, 0, 2);
GlobalCollisionBounds.X1 = -1280;
GlobalCollisionBounds.X2 = -640;
ItemPushLara(item, l, coll, 0, 2);
ItemPushItem(item, l, coll, 0, 2);
}
else
{

View file

@ -25,7 +25,7 @@ void BladeCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)
int dy = 0;
int dz = 0;
if (ItemPushLara(item, l, coll, 1, 1))
if (ItemPushItem(item, l, coll, 1, 1))
{
LaraItem->hitPoints -= item->itemFlags[3];

View file

@ -48,7 +48,7 @@ void StargateCollision(short itemNum, ITEM_INFO* l, COLL_INFO* c)
GlobalCollisionBounds.Z1 = StargateBounds[3 * i + 2];
if (TestWithGlobalCollisionBounds(item, l, c))
ItemPushLara(item, l, c, 0, 2);
ItemPushItem(item, l, c, 0, 2);
}
int result = TestCollision(item, l);
@ -75,7 +75,7 @@ void StargateCollision(short itemNum, ITEM_INFO* l, COLL_INFO* c)
int oldY = LaraItem->pos.yPos;
int oldZ = LaraItem->pos.zPos;
if (ItemPushLara(item, l, c, flags & 1, 2))
if (ItemPushItem(item, l, c, flags & 1, 2))
{
if ((flags & 1) &&
(oldX != LaraItem->pos.xPos || oldY != LaraItem->pos.yPos || oldZ != LaraItem->pos.zPos) &&

View file

@ -312,7 +312,7 @@ void ClassicRollingBallCollision(short itemNum, ITEM_INFO* lara, COLL_INFO* coll
if (lara->gravityStatus)
{
if (coll->enableBaddiePush)
ItemPushLara(item, lara, coll, coll->enableSpaz, 1);
ItemPushItem(item, lara, coll, coll->enableSpaz, 1);
lara->hitPoints -= 100;
x = lara->pos.xPos - item->pos.xPos;
y = (lara->pos.yPos - 350) - (item->pos.yPos - 512);

View file

@ -87,8 +87,8 @@ namespace TEN::Renderer
{
RendererStatic* newStatic = &room.Statics[i];
STATIC_INFO* sinfo = &StaticObjects[mesh->staticNumber];
Vector3 min = Vector3(sinfo->collisionBox.X1, sinfo->collisionBox.Y1, sinfo->collisionBox.Z1);
Vector3 max = Vector3(sinfo->collisionBox.X2, sinfo->collisionBox.Y2, sinfo->collisionBox.Z2);
Vector3 min = Vector3(sinfo->visibilityBox.X1, sinfo->visibilityBox.Y1, sinfo->visibilityBox.Z1);
Vector3 max = Vector3(sinfo->visibilityBox.X2, sinfo->visibilityBox.Y2, sinfo->visibilityBox.Z2);
min += Vector3(mesh->x, mesh->y, mesh->z);
max += Vector3(mesh->x, mesh->y, mesh->z);
if (!renderView.camera.frustum.AABBInFrustum(min, max))