TombEngine/TR5Main/Game/debris.h

99 lines
1.8 KiB
C
Raw Normal View History

2018-08-19 09:46:58 +02:00
#pragma once
2020-07-03 07:05:33 +02:00
#include <sphere.h>
#include <Renderer11.h>
#include <newtypes.h>
#include <level.h>
2018-09-19 20:48:17 +02:00
#define MAX_DEBRIS 256
2020-04-01 07:24:15 +02:00
typedef struct ILIGHT
{
short x;
short y;
short z;
short pad1;
unsigned char r;
unsigned char g;
unsigned char b;
unsigned char pad;
};
typedef struct ITEM_LIGHT
{
ILIGHT light[4];
};
typedef struct SHATTER_ITEM
{
SPHERE sphere;
ITEM_LIGHT* il;
2020-07-03 07:05:33 +02:00
MESH* meshp;
int bit;
short yRot;
short flags;
};
typedef struct ShatterImpactInfo
{
2020-03-29 10:38:29 +02:00
Vector3 impactDirection;
Vector3 impactLocation;
};
2020-04-01 07:24:15 +02:00
typedef struct DebrisMesh
{
2020-03-29 10:38:29 +02:00
RENDERER_BUCKETS bucket;
std::array<T5M::Renderer::RendererVertex, 3> vertices;
2020-03-29 10:38:29 +02:00
};
2020-04-01 07:24:15 +02:00
typedef struct DebrisFragment
{
2020-03-29 10:38:29 +02:00
DebrisMesh mesh;
Quaternion rotation;
Vector3 angularVelocity;
Vector3 worldPosition;
Vector3 velocity;
Vector3 gravity;
float terminalVelocity;
float linearDrag;
float angularDrag;
float friction;
float restitution;
uint32_t roomNumber;
uint32_t numBounces;
bool active;
};
2018-09-19 20:48:17 +02:00
typedef struct DEBRIS_STRUCT
{
void* textInfo;
int x;
int y;
int z;
short xyzOffsets1[3];
short dir;
short xyzOffsets2[3];
short speed;
short xyzOffsets3[3];
short yVel;
short gravity;
short roomNumber;
byte on;
byte xRot;
byte yRot;
byte r;
byte g;
byte b;
byte pad[22];
};
2020-04-01 07:24:15 +02:00
extern SHATTER_ITEM ShatterItem;
2020-06-18 15:54:08 +02:00
extern std::vector<DebrisFragment> DebrisFragments;
2020-04-01 07:24:15 +02:00
extern ShatterImpactInfo ShatterImpactData;
extern short SmashedMeshCount;
extern MESH_INFO* SmashedMesh[32];
extern short SmashedMeshRoom[32];
void ShatterObject(SHATTER_ITEM* item, MESH_INFO* mesh, int num, short roomNumber, int noZXVel);
DebrisFragment* GetFreeDebrisFragment();
Vector3 CalculateFragmentImpactVelocity(Vector3 fragmentWorldPosition, Vector3 impactDirection, Vector3 impactLocation);
2020-04-24 19:15:05 +02:00
void UpdateDebris();