2018-08-19 09:46:58 +02:00
|
|
|
#pragma once
|
2020-05-30 15:55:23 +02:00
|
|
|
#include "phd_global.h"
|
|
|
|
#include "level.h"
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
// used by coll->badPos
|
|
|
|
#define NO_BAD_POS (-NO_HEIGHT)
|
|
|
|
// used by coll->badNeg
|
|
|
|
#define NO_BAD_NEG NO_HEIGHT
|
|
|
|
|
2020-05-28 15:17:34 +02:00
|
|
|
struct COLL_FLOOR
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
|
|
|
|
int radius;
|
|
|
|
int badPos;
|
|
|
|
int badNeg;
|
|
|
|
int badCeiling;
|
|
|
|
PHD_VECTOR shift;
|
|
|
|
PHD_VECTOR old;
|
|
|
|
short oldAnimState;
|
|
|
|
short oldAnimNumber;
|
|
|
|
short oldFrameNumber;
|
|
|
|
short facing;
|
|
|
|
short quadrant;
|
2020-06-04 15:09:54 -03:00
|
|
|
short octant;
|
2020-05-28 15:17:34 +02:00
|
|
|
short collType; // CT_enum
|
|
|
|
short* trigger;
|
|
|
|
signed char tiltX;
|
|
|
|
signed char tiltZ;
|
|
|
|
bool hitByBaddie;
|
|
|
|
bool hitStatic;
|
|
|
|
bool slopesAreWalls;
|
|
|
|
bool slopesArePits;
|
|
|
|
bool lavaIsPit;
|
|
|
|
bool enableBaddiePush;
|
|
|
|
bool enableSpaz;
|
|
|
|
bool hitCeiling;
|
|
|
|
};
|
|
|
|
|
2020-07-25 18:02:35 +02:00
|
|
|
struct OBJECT_COLLISION_BOUNDS
|
|
|
|
{
|
|
|
|
BOUNDING_BOX boundingBox;
|
|
|
|
short rotX1;
|
|
|
|
short rotX2;
|
|
|
|
short rotY1;
|
|
|
|
short rotY2;
|
|
|
|
short rotZ1;
|
|
|
|
short rotZ2;
|
|
|
|
};
|
|
|
|
|
2020-04-14 06:11:10 +02:00
|
|
|
extern BOUNDING_BOX GlobalCollisionBounds;
|
2020-05-30 15:55:23 +02:00
|
|
|
constexpr auto MAX_ITEMS = 1024;
|
|
|
|
extern ITEM_INFO* CollidedItems[MAX_ITEMS];
|
|
|
|
extern MESH_INFO* CollidedMeshes[MAX_ITEMS];
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2020-04-14 06:11:10 +02:00
|
|
|
void GenericSphereBoxCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll);
|
2019-12-02 14:49:19 +01:00
|
|
|
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);
|
|
|
|
void TestForObjectOnLedge(ITEM_INFO* item, COLL_INFO* coll);
|
|
|
|
void ShiftItem(ITEM_INFO* item, COLL_INFO* coll);
|
2019-12-04 18:51:23 +01:00
|
|
|
void UpdateLaraRoom(ITEM_INFO* item, int height);
|
2019-12-17 17:37:53 +01:00
|
|
|
short GetTiltType(FLOOR_INFO* floor, int x, int y, int z);
|
2019-12-07 08:36:13 +01:00
|
|
|
int FindGridShift(int x, int z);
|
2020-07-25 18:02:35 +02:00
|
|
|
int TestBoundsCollideStatic(BOUNDING_BOX* bounds, PHD_3DPOS* pos, int radius);
|
|
|
|
int ItemPushLaraStatic(ITEM_INFO* item, BOUNDING_BOX* bounds, PHD_3DPOS* pos, COLL_INFO* coll);
|
2020-01-12 08:02:48 +01:00
|
|
|
void AIPickupCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* c);
|
2019-12-07 08:36:13 +01:00
|
|
|
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);
|
2020-07-25 18:02:35 +02:00
|
|
|
int TestLaraPosition(OBJECT_COLLISION_BOUNDS* bounds, ITEM_INFO* item, ITEM_INFO* l);
|
2019-12-07 08:36:13 +01:00
|
|
|
int Move3DPosTo3DPos(PHD_3DPOS* src, PHD_3DPOS* dest, int velocity, short angAdd);
|
|
|
|
int MoveLaraPosition(PHD_VECTOR* pos, ITEM_INFO* item, ITEM_INFO* l);
|
2019-12-07 09:51:50 +01:00
|
|
|
int TestBoundsCollide(ITEM_INFO* item, ITEM_INFO* l, int radius);
|
2019-12-17 17:37:53 +01:00
|
|
|
void CreatureCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll);
|
2019-12-29 01:40:55 -03:00
|
|
|
void GetCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int roomNumber, int objectHeight);
|
2019-12-08 08:01:55 +01:00
|
|
|
void LaraBaddieCollision(ITEM_INFO* item, COLL_INFO* coll);
|
2020-06-06 15:48:38 -03:00
|
|
|
bool SnapToQuadrant(short& angle, int interval);
|
|
|
|
int GetQuadrant(short angle);
|
|
|
|
bool SnapToDiagonal(short& angle, int interval);
|
|
|
|
int GetOctant(short angle);
|
2020-06-21 14:31:35 -03:00
|
|
|
void RotateBoundingBox(std::array<float, 4>& box, short angle);
|
2020-06-07 09:30:14 +02:00
|
|
|
// 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 !!!!
|
2020-06-07 20:32:00 +02:00
|
|
|
void CalcItemToFloorRotation(ITEM_INFO* item, int radiusDivide = 1);
|
2020-06-07 02:49:38 +02:00
|
|
|
Vector2 GetDiagonalIntersect(int xPos, int zPos, int splitType, int radius, short yRot); // find xPos, zPos that intersects with diagonal on sector
|
2020-06-09 12:09:00 -03:00
|
|
|
Vector2 GetOrthogonalIntersect(int xPos, int zPos, int radius, short yRot); // find xPos, zPos near sector bound, offset by radius;
|