mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-02 09:47:58 +03:00
New level format: meshes
This commit is contained in:
parent
eaf358f6ae
commit
7ff7397fa7
40 changed files with 368 additions and 2064 deletions
|
@ -36,14 +36,14 @@ typedef enum ZoneType
|
||||||
ZONE_APE, // only 2 click climb
|
ZONE_APE, // only 2 click climb
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct OBJECT_BONES
|
typedef struct OBJECT_Bones
|
||||||
{
|
{
|
||||||
short bone0;
|
short bone0;
|
||||||
short bone1;
|
short bone1;
|
||||||
short bone2;
|
short bone2;
|
||||||
short bone3;
|
short bone3;
|
||||||
|
|
||||||
OBJECT_BONES()
|
OBJECT_Bones()
|
||||||
{
|
{
|
||||||
this->bone0 = 0;
|
this->bone0 = 0;
|
||||||
this->bone1 = 0;
|
this->bone1 = 0;
|
||||||
|
@ -51,7 +51,7 @@ typedef struct OBJECT_BONES
|
||||||
this->bone3 = 0;
|
this->bone3 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
OBJECT_BONES(short all)
|
OBJECT_Bones(short all)
|
||||||
{
|
{
|
||||||
this->bone0 = all;
|
this->bone0 = all;
|
||||||
this->bone1 = all;
|
this->bone1 = all;
|
||||||
|
@ -59,7 +59,7 @@ typedef struct OBJECT_BONES
|
||||||
this->bone3 = all;
|
this->bone3 = all;
|
||||||
}
|
}
|
||||||
|
|
||||||
OBJECT_BONES(short angleY, short angleX)
|
OBJECT_Bones(short angleY, short angleX)
|
||||||
{
|
{
|
||||||
this->bone0 = angleY;
|
this->bone0 = angleY;
|
||||||
this->bone1 = angleX;
|
this->bone1 = angleX;
|
||||||
|
@ -67,7 +67,7 @@ typedef struct OBJECT_BONES
|
||||||
this->bone3 = angleX;
|
this->bone3 = angleX;
|
||||||
}
|
}
|
||||||
|
|
||||||
OBJECT_BONES(short angleY, short angleX, bool total)
|
OBJECT_Bones(short angleY, short angleX, bool total)
|
||||||
{
|
{
|
||||||
this->bone0 = angleY;
|
this->bone0 = angleY;
|
||||||
this->bone1 = angleX;
|
this->bone1 = angleX;
|
||||||
|
|
|
@ -2625,7 +2625,7 @@ int DoRayBox(GAME_VECTOR *start, GAME_VECTOR *end, short *box, PHD_3DPOS *itemOr
|
||||||
hitPos->z = collidedPoint.z - itemOrStaticPos->zPos;
|
hitPos->z = collidedPoint.z - itemOrStaticPos->zPos;
|
||||||
|
|
||||||
// Now in the case of items we need to test single spheres
|
// Now in the case of items we need to test single spheres
|
||||||
short *meshPtr = NULL;
|
MESH* meshPtr = NULL;
|
||||||
int bit = 0;
|
int bit = 0;
|
||||||
int sp = -2;
|
int sp = -2;
|
||||||
float minDistance = SECTOR(1024);
|
float minDistance = SECTOR(1024);
|
||||||
|
@ -2651,7 +2651,7 @@ int DoRayBox(GAME_VECTOR *start, GAME_VECTOR *end, short *box, PHD_3DPOS *itemOr
|
||||||
if (obj->nmeshes <= 0)
|
if (obj->nmeshes <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
meshPtr = Meshes[obj->meshIndex];
|
meshPtr = &Meshes[obj->meshIndex];
|
||||||
|
|
||||||
for (int i = 0; i < obj->nmeshes; i++)
|
for (int i = 0; i < obj->nmeshes; i++)
|
||||||
{
|
{
|
||||||
|
@ -2674,7 +2674,7 @@ int DoRayBox(GAME_VECTOR *start, GAME_VECTOR *end, short *box, PHD_3DPOS *itemOr
|
||||||
if (newDist < minDistance)
|
if (newDist < minDistance)
|
||||||
{
|
{
|
||||||
minDistance = newDist;
|
minDistance = newDist;
|
||||||
meshPtr = Meshes[obj->meshIndex + i];
|
meshPtr = &Meshes[obj->meshIndex + i];
|
||||||
bit = 1 << i;
|
bit = 1 << i;
|
||||||
sp = i;
|
sp = i;
|
||||||
}
|
}
|
||||||
|
@ -3070,7 +3070,7 @@ int ExplodeItemNode(ITEM_INFO *item, int Node, int NoXZVel, int bits)
|
||||||
GetSpheres(item, CreatureSpheres, SPHERES_SPACE_WORLD | SPHERES_SPACE_BONE_ORIGIN, Matrix::Identity);
|
GetSpheres(item, CreatureSpheres, SPHERES_SPACE_WORLD | SPHERES_SPACE_BONE_ORIGIN, Matrix::Identity);
|
||||||
ShatterItem.yRot = item->pos.yRot;
|
ShatterItem.yRot = item->pos.yRot;
|
||||||
ShatterItem.bit = 1 << Node;
|
ShatterItem.bit = 1 << Node;
|
||||||
ShatterItem.meshp = Meshes[Objects[item->objectNumber].meshIndex + Node];
|
ShatterItem.meshp = &Meshes[Objects[item->objectNumber].meshIndex + Node];
|
||||||
ShatterItem.sphere.x = CreatureSpheres[Node].x;
|
ShatterItem.sphere.x = CreatureSpheres[Node].x;
|
||||||
ShatterItem.sphere.y = CreatureSpheres[Node].y;
|
ShatterItem.sphere.y = CreatureSpheres[Node].y;
|
||||||
ShatterItem.sphere.z = CreatureSpheres[Node].z;
|
ShatterItem.sphere.z = CreatureSpheres[Node].z;
|
||||||
|
|
|
@ -24,12 +24,12 @@ DebrisFragment* GetFreeDebrisFragment()
|
||||||
|
|
||||||
void ShatterObject(SHATTER_ITEM* item, MESH_INFO* mesh, int num,short roomNumber,int noZXVel)
|
void ShatterObject(SHATTER_ITEM* item, MESH_INFO* mesh, int num,short roomNumber,int noZXVel)
|
||||||
{
|
{
|
||||||
short* meshPtr = nullptr;
|
MESH* meshPtr = nullptr;
|
||||||
RendererMesh* fragmentsMesh;
|
RendererMesh* fragmentsMesh;
|
||||||
short yRot = 0;
|
short yRot = 0;
|
||||||
Vector3 pos;
|
Vector3 pos;
|
||||||
if (mesh) {
|
if (mesh) {
|
||||||
meshPtr = Meshes[StaticObjects[mesh->staticNumber].meshNumber];
|
meshPtr = &Meshes[StaticObjects[mesh->staticNumber].meshNumber];
|
||||||
yRot = mesh->yRot;
|
yRot = mesh->yRot;
|
||||||
pos = Vector3(mesh->x, mesh->y, mesh->z);
|
pos = Vector3(mesh->x, mesh->y, mesh->z);
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ void ShatterObject(SHATTER_ITEM* item, MESH_INFO* mesh, int num,short roomNumber
|
||||||
yRot = item->yRot;
|
yRot = item->yRot;
|
||||||
pos = Vector3(item->sphere.x, item->sphere.y, item->sphere.z);
|
pos = Vector3(item->sphere.x, item->sphere.y, item->sphere.z);
|
||||||
}
|
}
|
||||||
fragmentsMesh = g_Renderer.getMeshFromMeshPtr(reinterpret_cast<unsigned int>(meshPtr));
|
fragmentsMesh = g_Renderer.getMesh(0);
|
||||||
for (int bucket = RENDERER_BUCKET_SOLID; bucket <= RENDERER_BUCKET_TRANSPARENT; bucket++) {
|
for (int bucket = RENDERER_BUCKET_SOLID; bucket <= RENDERER_BUCKET_TRANSPARENT; bucket++) {
|
||||||
RendererBucket renderBucket = fragmentsMesh->Buckets[bucket];
|
RendererBucket renderBucket = fragmentsMesh->Buckets[bucket];
|
||||||
vector<RendererVertex>* meshVertices = &renderBucket.Vertices;
|
vector<RendererVertex>* meshVertices = &renderBucket.Vertices;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "sphere.h"
|
#include <sphere.h>
|
||||||
#include "Renderer11.h"
|
#include <Renderer11.h>
|
||||||
|
#include <newtypes.h>
|
||||||
|
#include <level.h>
|
||||||
|
|
||||||
#define MAX_DEBRIS 256
|
#define MAX_DEBRIS 256
|
||||||
|
|
||||||
|
@ -25,7 +27,7 @@ typedef struct SHATTER_ITEM
|
||||||
{
|
{
|
||||||
SPHERE sphere;
|
SPHERE sphere;
|
||||||
ITEM_LIGHT* il;
|
ITEM_LIGHT* il;
|
||||||
short* meshp;
|
MESH* meshp;
|
||||||
int bit;
|
int bit;
|
||||||
short yRot;
|
short yRot;
|
||||||
short flags;
|
short flags;
|
||||||
|
|
|
@ -380,12 +380,10 @@ void ExplosionFX(ITEM_INFO* item)//39694(<), 39B94(<) (F)
|
||||||
|
|
||||||
void SwapCrowbar(ITEM_INFO* item)//39638(<), 39B38(<) (F)
|
void SwapCrowbar(ITEM_INFO* item)//39638(<), 39B38(<) (F)
|
||||||
{
|
{
|
||||||
short* tmp = Meshes[Objects[ID_LARA].meshIndex + LM_RHAND];
|
if (Lara.meshPtrs[LM_RHAND] == Objects[ID_LARA].meshIndex + LM_RHAND)
|
||||||
|
Lara.meshPtrs[LM_RHAND] = Objects[ID_LARA_CROWBAR_ANIM].meshIndex + LM_RHAND;
|
||||||
if (Lara.meshPtrs[LM_RHAND] == tmp)
|
|
||||||
Lara.meshPtrs[LM_RHAND] = Meshes[Objects[ID_LARA_CROWBAR_ANIM].meshIndex + LM_RHAND];
|
|
||||||
else
|
else
|
||||||
Lara.meshPtrs[LM_RHAND] = tmp;
|
Lara.meshPtrs[LM_RHAND] = Objects[ID_LARA].meshIndex + LM_RHAND;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActivateKey(ITEM_INFO* item)//39624(<), 39B24(<) (F)
|
void ActivateKey(ITEM_INFO* item)//39624(<), 39B24(<) (F)
|
||||||
|
|
|
@ -110,7 +110,8 @@ void DoFlameTorch() // (F) (D)
|
||||||
}
|
}
|
||||||
else if (Lara.leftArm.frameNumber == 12)
|
else if (Lara.leftArm.frameNumber == 12)
|
||||||
{
|
{
|
||||||
LARA_MESHES(ID_LARA, LM_LHAND);
|
//LARA_MESHES(ID_LARA, LM_LHAND);
|
||||||
|
Lara.meshPtrs[LM_LHAND] = Objects[ID_LARA_SKIN].meshIndex + LM_LHAND;
|
||||||
CreateFlare(ID_BURNING_TORCH_ITEM, 1);
|
CreateFlare(ID_BURNING_TORCH_ITEM, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,7 +131,8 @@ void DoFlameTorch() // (F) (D)
|
||||||
}
|
}
|
||||||
else if (Lara.leftArm.frameNumber == 36)
|
else if (Lara.leftArm.frameNumber == 36)
|
||||||
{
|
{
|
||||||
LARA_MESHES(ID_LARA, LM_LHAND);
|
//LARA_MESHES(ID_LARA, LM_LHAND);
|
||||||
|
Lara.meshPtrs[LM_LHAND] = Objects[ID_LARA_SKIN].meshIndex + LM_LHAND;
|
||||||
CreateFlare(ID_BURNING_TORCH_ITEM, 0);
|
CreateFlare(ID_BURNING_TORCH_ITEM, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -187,7 +189,9 @@ void GetFlameTorch() // (F) (D)
|
||||||
Lara.leftArm.lock = false;
|
Lara.leftArm.lock = false;
|
||||||
Lara.leftArm.frameNumber = 0;
|
Lara.leftArm.frameNumber = 0;
|
||||||
Lara.leftArm.frameBase = Anims[Lara.leftArm.animNumber].framePtr;
|
Lara.leftArm.frameBase = Anims[Lara.leftArm.animNumber].framePtr;
|
||||||
LARA_MESHES(ID_LARA_TORCH_ANIM, LM_LHAND);
|
|
||||||
|
//LARA_MESHES(ID_LARA_TORCH_ANIM, LM_LHAND);
|
||||||
|
Lara.meshPtrs[LM_LHAND] = Objects[ID_LARA_TORCH_ANIM].meshIndex + LM_LHAND;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorchControl(short itemNumber) // (F) (D)
|
void TorchControl(short itemNumber) // (F) (D)
|
||||||
|
|
|
@ -100,47 +100,47 @@ void HairControl(int cutscene, int ponytail, short* framePtr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Lara's spheres in absolute coords, for head, torso, hips and upper arms
|
// Get Lara's spheres in absolute coords, for head, torso, hips and upper arms
|
||||||
short* objptr = Lara.meshPtrs[LM_HIPS];
|
MESH* objptr = &Meshes[Lara.meshPtrs[LM_HIPS]];
|
||||||
PHD_VECTOR pos = { objptr[0], objptr[1], objptr[2] };
|
PHD_VECTOR pos = { (int)objptr->sphere.Center.x, (int)objptr->sphere.Center.y, (int)objptr->sphere.Center.z };
|
||||||
GetLaraJointPosition(&pos, LM_HIPS);
|
GetLaraJointPosition(&pos, LM_HIPS);
|
||||||
sphere[0].x = pos.x;
|
sphere[0].x = pos.x;
|
||||||
sphere[0].y = pos.y;
|
sphere[0].y = pos.y;
|
||||||
sphere[0].z = pos.z;
|
sphere[0].z = pos.z;
|
||||||
sphere[0].r = (int) * (objptr + 3);
|
sphere[0].r = (int)objptr->sphere.Radius;
|
||||||
|
|
||||||
objptr = Lara.meshPtrs[LM_TORSO];
|
objptr = &Meshes[Lara.meshPtrs[LM_TORSO]];
|
||||||
pos = { objptr[0], objptr[1], objptr[2] };
|
pos = { (int)objptr->sphere.Center.x, (int)objptr->sphere.Center.y, (int)objptr->sphere.Center.z };
|
||||||
GetLaraJointPosition(&pos, LM_TORSO);
|
GetLaraJointPosition(&pos, LM_TORSO);
|
||||||
sphere[1].x = pos.x;
|
sphere[1].x = pos.x;
|
||||||
sphere[1].y = pos.y;
|
sphere[1].y = pos.y;
|
||||||
sphere[1].z = pos.z;
|
sphere[1].z = pos.z;
|
||||||
sphere[1].r = (int) * (objptr + 3);
|
sphere[1].r = (int)objptr->sphere.Radius;
|
||||||
if (youngLara)
|
if (youngLara)
|
||||||
sphere[1].r = sphere[1].r - ((sphere[1].r >> 2) + (sphere[1].r >> 3));
|
sphere[1].r = sphere[1].r - ((sphere[1].r >> 2) + (sphere[1].r >> 3));
|
||||||
|
|
||||||
objptr = Lara.meshPtrs[LM_HEAD];
|
objptr = &Meshes[Lara.meshPtrs[LM_HEAD]];
|
||||||
pos = { objptr[0], objptr[1], objptr[2] };
|
pos = { (int)objptr->sphere.Center.x, (int)objptr->sphere.Center.y, (int)objptr->sphere.Center.z };
|
||||||
GetLaraJointPosition(&pos, LM_HEAD);
|
GetLaraJointPosition(&pos, LM_HEAD);
|
||||||
sphere[2].x = pos.x;
|
sphere[2].x = pos.x;
|
||||||
sphere[2].y = pos.y;
|
sphere[2].y = pos.y;
|
||||||
sphere[2].z = pos.z;
|
sphere[2].z = pos.z;
|
||||||
sphere[2].r = (int) * (objptr + 3);
|
sphere[2].r = (int)objptr->sphere.Radius;
|
||||||
|
|
||||||
objptr = Lara.meshPtrs[LM_RINARM];
|
objptr = &Meshes[Lara.meshPtrs[LM_RINARM]];
|
||||||
pos = { objptr[0], objptr[1], objptr[2] };
|
pos = { (int)objptr->sphere.Center.x, (int)objptr->sphere.Center.y, (int)objptr->sphere.Center.z };
|
||||||
GetLaraJointPosition(&pos, LM_RINARM);
|
GetLaraJointPosition(&pos, LM_RINARM);
|
||||||
sphere[3].x = pos.x;
|
sphere[3].x = pos.x;
|
||||||
sphere[3].y = pos.y;
|
sphere[3].y = pos.y;
|
||||||
sphere[3].z = pos.z;
|
sphere[3].z = pos.z;
|
||||||
sphere[3].r = (int) * (objptr + 3) * 3 / 2;
|
sphere[3].r = (int)objptr->sphere.Radius * 3 / 2;
|
||||||
|
|
||||||
objptr = Lara.meshPtrs[LM_LINARM];
|
objptr = &Meshes[Lara.meshPtrs[LM_LINARM]];
|
||||||
pos = { objptr[0], objptr[1], objptr[2] };
|
pos = { (int)objptr->sphere.Center.x, (int)objptr->sphere.Center.y, (int)objptr->sphere.Center.z };
|
||||||
GetLaraJointPosition(&pos, LM_LINARM);
|
GetLaraJointPosition(&pos, LM_LINARM);
|
||||||
sphere[4].x = pos.x;
|
sphere[4].x = pos.x;
|
||||||
sphere[4].y = pos.y;
|
sphere[4].y = pos.y;
|
||||||
sphere[4].z = pos.z;
|
sphere[4].z = pos.z;
|
||||||
sphere[4].r = (int) * (objptr + 3) * 3 / 2;
|
sphere[4].r = (int)objptr->sphere.Radius * 3 / 2;
|
||||||
|
|
||||||
if (youngLara)
|
if (youngLara)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1511,13 +1511,15 @@ void undraw_shotgun(int weapon)
|
||||||
void undraw_shotgun_meshes(int weapon)
|
void undraw_shotgun_meshes(int weapon)
|
||||||
{
|
{
|
||||||
Lara.backGun = WeaponObject(weapon);
|
Lara.backGun = WeaponObject(weapon);
|
||||||
LARA_MESHES(ID_LARA, LM_RHAND);
|
//LARA_MESHES(ID_LARA, LM_RHAND);
|
||||||
|
Lara.meshPtrs[LM_RHAND] = Objects[ID_LARA_SKIN].meshIndex + LM_RHAND;
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_shotgun_meshes(int weaponType)
|
void draw_shotgun_meshes(int weaponType)
|
||||||
{
|
{
|
||||||
Lara.backGun = WEAPON_NONE;
|
Lara.backGun = WEAPON_NONE;
|
||||||
LARA_MESHES(WeaponObjectMesh(weaponType), LM_RHAND);
|
//LARA_MESHES(WeaponObjectMesh(weaponType), LM_RHAND);
|
||||||
|
Lara.meshPtrs[LM_RHAND] = Objects[WeaponObjectMesh(weaponType)].meshIndex + LM_RHAND;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoCrossbowDamage(ITEM_INFO* item1, ITEM_INFO* item2, signed int search)
|
void DoCrossbowDamage(ITEM_INFO* item1, ITEM_INFO* item2, signed int search)
|
||||||
|
|
|
@ -351,7 +351,8 @@ void PistolHandler(int weaponType)
|
||||||
|
|
||||||
void undraw_pistol_mesh_right(int weaponType)
|
void undraw_pistol_mesh_right(int weaponType)
|
||||||
{
|
{
|
||||||
LARA_MESHES(ID_LARA, LM_RHAND);
|
//LARA_MESHES(ID_LARA, LM_RHAND);
|
||||||
|
Lara.meshPtrs[LM_RHAND] = Objects[ID_LARA_SKIN].meshIndex + LM_RHAND;
|
||||||
|
|
||||||
switch (weaponType)
|
switch (weaponType)
|
||||||
{
|
{
|
||||||
|
@ -372,7 +373,8 @@ void undraw_pistol_mesh_left(int weaponType)
|
||||||
{
|
{
|
||||||
if (weaponType != WEAPON_REVOLVER)
|
if (weaponType != WEAPON_REVOLVER)
|
||||||
{
|
{
|
||||||
LARA_MESHES(ID_LARA, LM_LHAND);
|
//LARA_MESHES(ID_LARA, LM_LHAND);
|
||||||
|
Lara.meshPtrs[LM_LHAND] = Objects[ID_LARA_SKIN].meshIndex + LM_LHAND;
|
||||||
|
|
||||||
switch (weaponType)
|
switch (weaponType)
|
||||||
{
|
{
|
||||||
|
@ -390,9 +392,11 @@ void draw_pistol_meshes(int weaponType)
|
||||||
{
|
{
|
||||||
Lara.holster = ID_LARA_HOLSTERS;
|
Lara.holster = ID_LARA_HOLSTERS;
|
||||||
|
|
||||||
LARA_MESHES(WeaponObjectMesh(weaponType), LM_RHAND);
|
//LARA_MESHES(WeaponObjectMesh(weaponType), LM_RHAND);
|
||||||
|
Lara.meshPtrs[LM_RHAND] = Objects[WeaponObjectMesh(weaponType)].meshIndex + LM_RHAND;
|
||||||
if (weaponType != WEAPON_REVOLVER)
|
if (weaponType != WEAPON_REVOLVER)
|
||||||
LARA_MESHES(WeaponObjectMesh(weaponType), LM_LHAND);
|
//LARA_MESHES(WeaponObjectMesh(weaponType), LM_LHAND);
|
||||||
|
Lara.meshPtrs[LM_LHAND] = Objects[WeaponObjectMesh(weaponType)].meshIndex + LM_LHAND;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ready_pistols(int weaponType)
|
void ready_pistols(int weaponType)
|
||||||
|
|
|
@ -835,7 +835,7 @@ typedef struct LaraInfo
|
||||||
PHD_VECTOR lastPos;
|
PHD_VECTOR lastPos;
|
||||||
FX_INFO* spazEffect;
|
FX_INFO* spazEffect;
|
||||||
int meshEffects;
|
int meshEffects;
|
||||||
short* meshPtrs[NUM_LARA_MESHES];
|
int meshPtrs[NUM_LARA_MESHES];
|
||||||
ITEM_INFO* target;
|
ITEM_INFO* target;
|
||||||
short targetAngles[2];
|
short targetAngles[2];
|
||||||
short turnRate;
|
short turnRate;
|
||||||
|
|
|
@ -310,7 +310,7 @@ void AimWeapon(WEAPON_INFO* winfo, LARA_ARM* arm) // (F) (D)
|
||||||
rotX -= speed;
|
rotX -= speed;
|
||||||
arm->xRot = rotX;
|
arm->xRot = rotX;
|
||||||
|
|
||||||
// TODO: set arm rotations to inherit rotations of parent bones. -Sezz
|
// TODO: set arm rotations to inherit rotations of parent Bones. -Sezz
|
||||||
arm->zRot = 0;
|
arm->zRot = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -472,7 +472,8 @@ void LaraGun() // (F) (D)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LG_UNDRAW_GUNS:
|
case LG_UNDRAW_GUNS:
|
||||||
LARA_MESHES(ID_LARA, LM_HEAD);
|
//LARA_MESHES(ID_LARA, LM_HEAD);
|
||||||
|
Lara.meshPtrs[LM_HEAD] = Objects[ID_LARA_SKIN].meshIndex + LM_HEAD;
|
||||||
|
|
||||||
switch (Lara.gunType)
|
switch (Lara.gunType)
|
||||||
{
|
{
|
||||||
|
@ -504,9 +505,11 @@ void LaraGun() // (F) (D)
|
||||||
|
|
||||||
case LG_READY:
|
case LG_READY:
|
||||||
if (!(TrInput & IN_ACTION))
|
if (!(TrInput & IN_ACTION))
|
||||||
LARA_MESHES(ID_LARA, LM_HEAD);
|
//LARA_MESHES(ID_LARA, LM_HEAD);
|
||||||
|
Lara.meshPtrs[LM_HEAD] = Objects[ID_LARA_SKIN].meshIndex + LM_HEAD;
|
||||||
else
|
else
|
||||||
LARA_MESHES(ID_LARA_SCREAM, LM_HEAD);
|
//LARA_MESHES(ID_LARA_SCREAM, LM_HEAD);
|
||||||
|
Lara.meshPtrs[LM_HEAD] = Objects[ID_LARA_SCREAM].meshIndex + LM_HEAD;
|
||||||
|
|
||||||
if (Camera.type != CINEMATIC_CAMERA && Camera.type != LOOK_CAMERA && Camera.type != HEAVY_CAMERA)
|
if (Camera.type != CINEMATIC_CAMERA && Camera.type != LOOK_CAMERA && Camera.type != HEAVY_CAMERA)
|
||||||
Camera.type = COMBAT_CAMERA;
|
Camera.type = COMBAT_CAMERA;
|
||||||
|
@ -580,7 +583,7 @@ void LaraGun() // (F) (D)
|
||||||
case LG_HANDS_BUSY:
|
case LG_HANDS_BUSY:
|
||||||
if (Lara.gunType == WEAPON_FLARE)
|
if (Lara.gunType == WEAPON_FLARE)
|
||||||
{
|
{
|
||||||
if (CHECK_LARA_MESHES(ID_LARA_FLARE_ANIM, LM_LHAND))
|
if (Lara.meshPtrs[LM_LHAND] == Objects[ID_LARA_FLARE_ANIM].meshIndex + LM_LHAND /*CHECK_LARA_MESHES(ID_LARA_FLARE_ANIM, LM_LHAND)*/)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
Lara.flareControlLeft = (Lara.Vehicle != NO_ITEM || CheckForHoldingState(LaraItem->currentAnimState));
|
Lara.flareControlLeft = (Lara.Vehicle != NO_ITEM || CheckForHoldingState(LaraItem->currentAnimState));
|
||||||
|
|
|
@ -104,12 +104,14 @@ void ready_flare() // (F) (D)
|
||||||
|
|
||||||
void undraw_flare_meshes() // (F) (D)
|
void undraw_flare_meshes() // (F) (D)
|
||||||
{
|
{
|
||||||
LARA_MESHES(ID_LARA, LM_LHAND);
|
//LARA_MESHES(ID_LARA, LM_LHAND);
|
||||||
|
Lara.meshPtrs[LM_LHAND] = Objects[ID_LARA_SKIN].meshIndex + LM_LHAND;
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_flare_meshes() // (F) (D)
|
void draw_flare_meshes() // (F) (D)
|
||||||
{
|
{
|
||||||
LARA_MESHES(ID_LARA_FLARE_ANIM, LM_LHAND);
|
//LARA_MESHES(ID_LARA_FLARE_ANIM, LM_LHAND);
|
||||||
|
Lara.meshPtrs[LM_LHAND] = Objects[ID_LARA_FLARE_ANIM].meshIndex + LM_LHAND;
|
||||||
}
|
}
|
||||||
|
|
||||||
void undraw_flare() // (F) (D)
|
void undraw_flare() // (F) (D)
|
||||||
|
|
|
@ -742,8 +742,9 @@ void LaraInitialiseMeshes() // (AF) (D)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < NUM_LARA_MESHES; i++)
|
for (int i = 0; i < NUM_LARA_MESHES; i++)
|
||||||
{
|
{
|
||||||
MESHES(ID_LARA, i) = MESHES(ID_LARA_SKIN, i);
|
//Meshes[i] = Meshes[MESHES(ID_LARA_SKIN, i)];
|
||||||
LARA_MESHES(ID_LARA, i);
|
//LARA_MESHES(ID_LARA, MESHES(ID_LARA_SKIN, i));
|
||||||
|
Lara.meshPtrs[i] = Objects[ID_LARA_SKIN].meshIndex + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hardcoded code */
|
/* Hardcoded code */
|
||||||
|
|
|
@ -1,34 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <framework.h>
|
#include <framework.h>
|
||||||
|
#include <newtypes.h>
|
||||||
typedef struct tr5_room_layer
|
|
||||||
{
|
|
||||||
unsigned int NumLayerVertices; // Number of vertices in this layer (4 bytes)
|
|
||||||
unsigned short UnknownL1;
|
|
||||||
unsigned short NumLayerRectangles; // Number of rectangles in this layer (2 bytes)
|
|
||||||
unsigned short NumLayerTriangles; // Number of triangles in this layer (2 bytes)
|
|
||||||
unsigned short UnknownL2;
|
|
||||||
unsigned short Filler; // Always 0
|
|
||||||
unsigned short Filler2; // Always 0
|
|
||||||
/// The following 6 floats define the bounding box for the layer
|
|
||||||
float LayerBoundingBoxX1;
|
|
||||||
float LayerBoundingBoxY1;
|
|
||||||
float LayerBoundingBoxZ1;
|
|
||||||
float LayerBoundingBoxX2;
|
|
||||||
float LayerBoundingBoxY2;
|
|
||||||
float LayerBoundingBoxZ2;
|
|
||||||
unsigned int Filler3; // Always 0 (4 bytes)
|
|
||||||
void* VerticesOffset;
|
|
||||||
void* PolyOffset;
|
|
||||||
void* PolyOffset2;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct tr5_vertex
|
|
||||||
{
|
|
||||||
float x;
|
|
||||||
float y;
|
|
||||||
float z;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ROOM_VERTEX
|
struct ROOM_VERTEX
|
||||||
{
|
{
|
||||||
|
@ -37,6 +9,7 @@ struct ROOM_VERTEX
|
||||||
Vector2 textureCoordinates;
|
Vector2 textureCoordinates;
|
||||||
Vector3 color;
|
Vector3 color;
|
||||||
int effects;
|
int effects;
|
||||||
|
int index;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ROOM_DOOR
|
struct ROOM_DOOR
|
||||||
|
@ -46,20 +19,6 @@ struct ROOM_DOOR
|
||||||
Vector3 vertices[4];
|
Vector3 vertices[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct tr4_mesh_face3 // 10 bytes
|
|
||||||
{
|
|
||||||
short Vertices[3];
|
|
||||||
short Texture;
|
|
||||||
short Effects; // TR4-5 ONLY: alpha blending and environment mapping strength
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct tr4_mesh_face4 // 12 bytes
|
|
||||||
{
|
|
||||||
short Vertices[4];
|
|
||||||
short Texture;
|
|
||||||
short Effects;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct POLYGON
|
struct POLYGON
|
||||||
{
|
{
|
||||||
int shape;
|
int shape;
|
||||||
|
@ -67,24 +26,6 @@ struct POLYGON
|
||||||
int texture;
|
int texture;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BUCKET
|
|
||||||
{
|
|
||||||
int texture;
|
|
||||||
byte blendMode;
|
|
||||||
bool animated;
|
|
||||||
std::vector<int> indices;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct tr_room_sector // 8 bytes
|
|
||||||
{
|
|
||||||
unsigned short FDindex; // Index into FloorData[]
|
|
||||||
unsigned short BoxIndex; // Index into Boxes[] (-1 if none)
|
|
||||||
unsigned char RoomBelow; // 255 is none
|
|
||||||
signed char Floor; // Absolute height of floor
|
|
||||||
unsigned char RoomAbove; // 255 if none
|
|
||||||
signed char Ceiling; // Absolute height of ceiling
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct ROOM_LIGHT
|
typedef struct ROOM_LIGHT
|
||||||
{
|
{
|
||||||
float x, y, z; // Position of light, in world coordinates
|
float x, y, z; // Position of light, in world coordinates
|
||||||
|
@ -157,7 +98,7 @@ struct SECTOR_COLLISION_INFO
|
||||||
SECTOR_PLANE planes[2];
|
SECTOR_PLANE planes[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct FLOOR_INFO
|
struct FLOOR_INFO
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
int box;
|
int box;
|
||||||
|
@ -171,7 +112,7 @@ typedef struct FLOOR_INFO
|
||||||
SECTOR_COLLISION_INFO ceilingCollision;
|
SECTOR_COLLISION_INFO ceilingCollision;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum RoomEnumFlag
|
enum RoomEnumFlag
|
||||||
{
|
{
|
||||||
ENV_FLAG_WATER = 0x0001,
|
ENV_FLAG_WATER = 0x0001,
|
||||||
ENV_FLAG_SWAMP = 0x0004,
|
ENV_FLAG_SWAMP = 0x0004,
|
||||||
|
@ -185,7 +126,7 @@ typedef enum RoomEnumFlag
|
||||||
ENV_FLAG_UNKNOWN3 = 0x0400
|
ENV_FLAG_UNKNOWN3 = 0x0400
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct ROOM_INFO
|
struct ROOM_INFO
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
|
@ -211,7 +152,7 @@ typedef struct ROOM_INFO
|
||||||
bool boundActive;
|
bool boundActive;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct ANIM_STRUCT
|
struct ANIM_STRUCT
|
||||||
{
|
{
|
||||||
short* framePtr;
|
short* framePtr;
|
||||||
short interpolation;
|
short interpolation;
|
||||||
|
|
|
@ -215,9 +215,6 @@ void SaveGame::saveLara(int arg1, int arg2)
|
||||||
LaraInfo lara;
|
LaraInfo lara;
|
||||||
memcpy(&lara, &Lara, sizeof(Lara));
|
memcpy(&lara, &Lara, sizeof(Lara));
|
||||||
|
|
||||||
for (int i = 0; i < 15; i++)
|
|
||||||
lara.meshPtrs[i] = (short*)((char*)lara.meshPtrs[i] - (ptrdiff_t)MeshBase);
|
|
||||||
|
|
||||||
lara.leftArm.frameBase = (short*)((char *)lara.leftArm.frameBase - (ptrdiff_t)Objects[ID_LARA].frameBase);
|
lara.leftArm.frameBase = (short*)((char *)lara.leftArm.frameBase - (ptrdiff_t)Objects[ID_LARA].frameBase);
|
||||||
lara.rightArm.frameBase = (short*)((char *)lara.rightArm.frameBase - (ptrdiff_t)Objects[ID_LARA].frameBase);
|
lara.rightArm.frameBase = (short*)((char *)lara.rightArm.frameBase - (ptrdiff_t)Objects[ID_LARA].frameBase);
|
||||||
lara.generalPtr = (char *)lara.generalPtr - (ptrdiff_t)malloc_buffer;
|
lara.generalPtr = (char *)lara.generalPtr - (ptrdiff_t)malloc_buffer;
|
||||||
|
@ -512,11 +509,6 @@ bool SaveGame::readLara()
|
||||||
memcpy(&Lara, lara, sizeof(LaraInfo));
|
memcpy(&Lara, lara, sizeof(LaraInfo));
|
||||||
free(buffer);
|
free(buffer);
|
||||||
|
|
||||||
for (int i = 0; i < NUM_LARA_MESHES; i++)
|
|
||||||
{
|
|
||||||
Lara.meshPtrs[i] = AddPtr(Lara.meshPtrs[i], short, MeshBase);
|
|
||||||
}
|
|
||||||
|
|
||||||
Lara.leftArm.frameBase = AddPtr(Lara.leftArm.frameBase, short, Objects[ID_LARA].frameBase);
|
Lara.leftArm.frameBase = AddPtr(Lara.leftArm.frameBase, short, Objects[ID_LARA].frameBase);
|
||||||
Lara.rightArm.frameBase = AddPtr(Lara.rightArm.frameBase, short, Objects[ID_LARA].frameBase);
|
Lara.rightArm.frameBase = AddPtr(Lara.rightArm.frameBase, short, Objects[ID_LARA].frameBase);
|
||||||
|
|
||||||
|
|
|
@ -619,7 +619,7 @@ typedef enum sound_effects
|
||||||
SFX_TR1_BULLET_HITTING_LARA = 500,
|
SFX_TR1_BULLET_HITTING_LARA = 500,
|
||||||
SFX_TR1_LARA_HEH_STARTING_TO_PULL_BLOCK = 501,
|
SFX_TR1_LARA_HEH_STARTING_TO_PULL_BLOCK = 501,
|
||||||
SFX_TR1_LARA_TREADING_WATER = 502,
|
SFX_TR1_LARA_TREADING_WATER = 502,
|
||||||
SFX_TR1_LARA_S_BONES_BREAKING_DYING = 503,
|
SFX_TR1_LARA_S_Bones_BREAKING_DYING = 503,
|
||||||
SFX_TR1_LEDGE_GRAB_BY_LARA = 504,
|
SFX_TR1_LEDGE_GRAB_BY_LARA = 504,
|
||||||
SFX_TR1_LARA_OOMPH_HITTING_WALL_AFTER_GRABBING_LEDGE = 505,
|
SFX_TR1_LARA_OOMPH_HITTING_WALL_AFTER_GRABBING_LEDGE = 505,
|
||||||
SFX_TR1_FOOTSTEP_LEDGE_SHIMMY_BY_LARA = 506,
|
SFX_TR1_FOOTSTEP_LEDGE_SHIMMY_BY_LARA = 506,
|
||||||
|
@ -877,7 +877,7 @@ typedef enum sound_effects
|
||||||
SFX_TR2_BULLET_HITTING_LARA = 756,
|
SFX_TR2_BULLET_HITTING_LARA = 756,
|
||||||
SFX_TR2_LARA_HEH_PULLING_UP = 757,
|
SFX_TR2_LARA_HEH_PULLING_UP = 757,
|
||||||
SFX_TR2_LARA_TREADING_WATER1 = 758,
|
SFX_TR2_LARA_TREADING_WATER1 = 758,
|
||||||
SFX_TR2_LARA_S_BONES_BREAKING_DYING = 759,
|
SFX_TR2_LARA_S_Bones_BREAKING_DYING = 759,
|
||||||
SFX_TR2_LEDGE_GRAB_BY_LARA = 760,
|
SFX_TR2_LEDGE_GRAB_BY_LARA = 760,
|
||||||
SFX_TR2_LARA_OOMPH_HITTING_WALL_AFTER_GRABBING_LEDGE = 761,
|
SFX_TR2_LARA_OOMPH_HITTING_WALL_AFTER_GRABBING_LEDGE = 761,
|
||||||
SFX_TR2_FOOTSTEP_LEDGE_SHIMMY_BY_LARA = 762,
|
SFX_TR2_FOOTSTEP_LEDGE_SHIMMY_BY_LARA = 762,
|
||||||
|
|
|
@ -176,7 +176,7 @@ void BubblesEffect4(short fxNum, short xVel, short yVel, short zVel)
|
||||||
void BubblesShatterFunction(FX_INFO* fx, int param1, int param2)
|
void BubblesShatterFunction(FX_INFO* fx, int param1, int param2)
|
||||||
{
|
{
|
||||||
ShatterItem.yRot = fx->pos.yRot;
|
ShatterItem.yRot = fx->pos.yRot;
|
||||||
ShatterItem.meshp = Meshes[fx->frameNumber];
|
ShatterItem.meshp = &Meshes[fx->frameNumber];
|
||||||
ShatterItem.sphere.x = fx->pos.xPos;
|
ShatterItem.sphere.x = fx->pos.xPos;
|
||||||
ShatterItem.sphere.y = fx->pos.yPos;
|
ShatterItem.sphere.y = fx->pos.yPos;
|
||||||
ShatterItem.sphere.z = fx->pos.zPos;
|
ShatterItem.sphere.z = fx->pos.zPos;
|
||||||
|
|
|
@ -134,7 +134,7 @@ static void createExplosion(ITEM_INFO* item)
|
||||||
|
|
||||||
static void createDragonBone(short front_number)
|
static void createDragonBone(short front_number)
|
||||||
{
|
{
|
||||||
/* Create the bones of the dragon */
|
/* Create the Bones of the dragon */
|
||||||
short bone_back, bone_front;
|
short bone_back, bone_front;
|
||||||
ITEM_INFO* back_dragon, *front_dragon, *item;
|
ITEM_INFO* back_dragon, *front_dragon, *item;
|
||||||
|
|
||||||
|
@ -239,7 +239,8 @@ void DragonCollision(short itemNum, ITEM_INFO* laraitem, COLL_INFO* coll)
|
||||||
Lara.gunStatus = LG_HANDS_BUSY;
|
Lara.gunStatus = LG_HANDS_BUSY;
|
||||||
Lara.hitDirection = -1;
|
Lara.hitDirection = -1;
|
||||||
|
|
||||||
LARA_MESHES(ID_LARA_EXTRA_ANIMS, LM_RHAND);
|
//LARA_MESHES(ID_LARA_EXTRA_ANIMS, LM_RHAND);
|
||||||
|
Lara.meshPtrs[LM_RHAND] = Objects[ID_LARA_EXTRA_ANIMS].meshIndex + LM_RHAND;
|
||||||
|
|
||||||
/* Do cinematic camera */
|
/* Do cinematic camera */
|
||||||
Camera.type = CINEMATIC_CAMERA;
|
Camera.type = CINEMATIC_CAMERA;
|
||||||
|
|
|
@ -247,7 +247,7 @@ static void StartBaddy(ObjectInfo* obj)
|
||||||
obj->savePosition = true;
|
obj->savePosition = true;
|
||||||
//Bones[obj->boneIndex + 5*4] |= (ROT_X | ROT_Y);
|
//Bones[obj->boneIndex + 5*4] |= (ROT_X | ROT_Y);
|
||||||
//Bones[obj->boneIndex + 14*4] |= (ROT_X | ROT_Y);
|
//Bones[obj->boneIndex + 14*4] |= (ROT_X | ROT_Y);
|
||||||
// TODO: get the correct torso and head bones value and assign ROT_X and ROT_Y to it !
|
// TODO: get the correct torso and head Bones value and assign ROT_X and ROT_Y to it !
|
||||||
}
|
}
|
||||||
|
|
||||||
obj = &Objects[ID_WORKER_MACHINEGUN];
|
obj = &Objects[ID_WORKER_MACHINEGUN];
|
||||||
|
@ -267,7 +267,7 @@ static void StartBaddy(ObjectInfo* obj)
|
||||||
obj->savePosition = true;
|
obj->savePosition = true;
|
||||||
//Bones[obj->boneIndex + 5*4] |= (ROT_X | ROT_Y);
|
//Bones[obj->boneIndex + 5*4] |= (ROT_X | ROT_Y);
|
||||||
//Bones[obj->boneIndex + 14*4] |= (ROT_X | ROT_Y);
|
//Bones[obj->boneIndex + 14*4] |= (ROT_X | ROT_Y);
|
||||||
// TODO: get the correct torso and head bones value and assign ROT_X and ROT_Y to it !
|
// TODO: get the correct torso and head Bones value and assign ROT_X and ROT_Y to it !
|
||||||
}
|
}
|
||||||
|
|
||||||
obj = &Objects[ID_SMALL_SPIDER];
|
obj = &Objects[ID_SMALL_SPIDER];
|
||||||
|
@ -377,7 +377,7 @@ static void StartBaddy(ObjectInfo* obj)
|
||||||
obj->savePosition = true;
|
obj->savePosition = true;
|
||||||
//Bones[obj->boneIndex + 8 * 4] |= (ROT_X | ROT_Y);
|
//Bones[obj->boneIndex + 8 * 4] |= (ROT_X | ROT_Y);
|
||||||
//Bones[obj->boneIndex + 0 * 4] |= (ROT_X | ROT_Y);
|
//Bones[obj->boneIndex + 0 * 4] |= (ROT_X | ROT_Y);
|
||||||
// TODO: find the correct for bones (knifethrower).
|
// TODO: find the correct for Bones (knifethrower).
|
||||||
}
|
}
|
||||||
|
|
||||||
obj = &Objects[ID_KNIFETHROWER_KNIFE];
|
obj = &Objects[ID_KNIFETHROWER_KNIFE];
|
||||||
|
@ -505,7 +505,7 @@ static void StartBaddy(ObjectInfo* obj)
|
||||||
obj->savePosition = true;
|
obj->savePosition = true;
|
||||||
Bones[obj->boneIndex + 6 * 4] |= (ROT_X | ROT_Y);
|
Bones[obj->boneIndex + 6 * 4] |= (ROT_X | ROT_Y);
|
||||||
Bones[obj->boneIndex + 16 * 4] |= (ROT_X | ROT_Y);
|
Bones[obj->boneIndex + 16 * 4] |= (ROT_X | ROT_Y);
|
||||||
// TODO: bones value is not correct (shiva) !
|
// TODO: Bones value is not correct (shiva) !
|
||||||
// need the correct one.
|
// need the correct one.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -527,7 +527,7 @@ static void StartBaddy(ObjectInfo* obj)
|
||||||
obj->savePosition = true;
|
obj->savePosition = true;
|
||||||
//Bones[obj->boneIndex + 6 * 4] |= (ROT_X | ROT_Y);
|
//Bones[obj->boneIndex + 6 * 4] |= (ROT_X | ROT_Y);
|
||||||
//Bones[obj->boneIndex + 12 * 4] |= (ROT_X | ROT_Y);
|
//Bones[obj->boneIndex + 12 * 4] |= (ROT_X | ROT_Y);
|
||||||
// TODO: get the correct id for bones ! (spear)
|
// TODO: get the correct id for Bones ! (spear)
|
||||||
}
|
}
|
||||||
|
|
||||||
obj = &Objects[ID_DRAGON_FRONT];
|
obj = &Objects[ID_DRAGON_FRONT];
|
||||||
|
|
|
@ -954,11 +954,11 @@ static void KayakUserInput(ITEM_INFO* kayak, ITEM_INFO* lara, KAYAK_INFO* kinfo)
|
||||||
/* --------------------- */
|
/* --------------------- */
|
||||||
if ((lara->animNumber == Objects[ID_KAYAK_LARA_ANIMS].animIndex + 4) && (frame == 24) && (!(kinfo->Flags & 0x80)))
|
if ((lara->animNumber == Objects[ID_KAYAK_LARA_ANIMS].animIndex + 4) && (frame == 24) && (!(kinfo->Flags & 0x80)))
|
||||||
{
|
{
|
||||||
short* tmp;
|
/*MESH tmp = Meshes[Lara.meshPtrs[LM_RHAND]];
|
||||||
tmp = Lara.meshPtrs[LM_RHAND];
|
|
||||||
|
|
||||||
LARA_MESHES(ID_KAYAK_LARA_ANIMS, LM_RHAND);
|
LARA_MESHES(ID_KAYAK_LARA_ANIMS, LM_RHAND);
|
||||||
Meshes[Objects[ID_KAYAK_LARA_ANIMS].meshIndex + LM_RHAND] = tmp;
|
Meshes[Objects[ID_KAYAK_LARA_ANIMS].meshIndex + LM_RHAND] = tmp;*/
|
||||||
|
Lara.meshPtrs[LM_RHAND] = Objects[ID_KAYAK_LARA_ANIMS].meshIndex + LM_RHAND;
|
||||||
|
|
||||||
lara->meshBits &= ~LARA_LEG_BITS;
|
lara->meshBits &= ~LARA_LEG_BITS;
|
||||||
kinfo->Flags |= 0x80;
|
kinfo->Flags |= 0x80;
|
||||||
|
@ -968,11 +968,11 @@ static void KayakUserInput(ITEM_INFO* kayak, ITEM_INFO* lara, KAYAK_INFO* kinfo)
|
||||||
case KS_JUMPOUT:
|
case KS_JUMPOUT:
|
||||||
if ((lara->animNumber == Objects[ID_KAYAK_LARA_ANIMS].animIndex + 14) && (frame == 27) && (kinfo->Flags & 0x80))
|
if ((lara->animNumber == Objects[ID_KAYAK_LARA_ANIMS].animIndex + 14) && (frame == 27) && (kinfo->Flags & 0x80))
|
||||||
{
|
{
|
||||||
short* tmp;
|
/*MESH tmp = Meshes[Lara.meshPtrs[LM_RHAND]];
|
||||||
tmp = Lara.meshPtrs[LM_RHAND];
|
|
||||||
|
|
||||||
Lara.meshPtrs[LM_RHAND] = Meshes[Objects[ID_KAYAK_LARA_ANIMS].meshIndex + LM_RHAND];
|
LARA_MESHES(ID_KAYAK_LARA_ANIMS, LM_RHAND);
|
||||||
Meshes[Objects[ID_KAYAK_LARA_ANIMS].meshIndex + LM_RHAND] = tmp;
|
Meshes[Objects[ID_KAYAK_LARA_ANIMS].meshIndex + LM_RHAND] = tmp;*/
|
||||||
|
Lara.meshPtrs[LM_RHAND] = Objects[ID_LARA_SKIN].meshIndex + LM_RHAND;
|
||||||
|
|
||||||
lara->meshBits |= LARA_LEG_BITS;
|
lara->meshBits |= LARA_LEG_BITS;
|
||||||
kinfo->Flags &= ~0x80;
|
kinfo->Flags &= ~0x80;
|
||||||
|
|
|
@ -612,12 +612,11 @@ static void DoUserInput(ITEM_INFO* v, ITEM_INFO* l, CART_INFO* cart)
|
||||||
{
|
{
|
||||||
if ((l->frameNumber == GF2(ID_MINECART, 7, 0) + 20) && (cart->Flags & CF_MESH))
|
if ((l->frameNumber == GF2(ID_MINECART, 7, 0) + 20) && (cart->Flags & CF_MESH))
|
||||||
{
|
{
|
||||||
short* tmp;
|
/*MESH tmp = Meshes[Lara.meshPtrs[LM_RHAND]];
|
||||||
|
|
||||||
tmp = Lara.meshPtrs[LM_RHAND];
|
|
||||||
|
|
||||||
LARA_MESHES(ID_MINECART_LARA_ANIMS, LM_RHAND);
|
LARA_MESHES(ID_MINECART_LARA_ANIMS, LM_RHAND);
|
||||||
Meshes[Objects[ID_MINECART_LARA_ANIMS].meshIndex + LM_RHAND] = tmp;
|
Meshes[Objects[ID_MINECART_LARA_ANIMS].meshIndex + LM_RHAND] = tmp;*/
|
||||||
|
Lara.meshPtrs[LM_RHAND] = Objects[ID_MINECART_LARA_ANIMS].meshIndex + LM_RHAND;
|
||||||
|
|
||||||
cart->Flags &= ~CF_MESH;
|
cart->Flags &= ~CF_MESH;
|
||||||
}
|
}
|
||||||
|
@ -674,11 +673,9 @@ static void DoUserInput(ITEM_INFO* v, ITEM_INFO* l, CART_INFO* cart)
|
||||||
case CART_GETIN:
|
case CART_GETIN:
|
||||||
if ((l->animNumber == Objects[ID_MINECART_LARA_ANIMS].animIndex + 5) && (l->frameNumber == GF2(ID_MINECART, 5, 0) + 20) && (!cart->Flags & CF_MESH))
|
if ((l->animNumber == Objects[ID_MINECART_LARA_ANIMS].animIndex + 5) && (l->frameNumber == GF2(ID_MINECART, 5, 0) + 20) && (!cart->Flags & CF_MESH))
|
||||||
{
|
{
|
||||||
short* tmp;
|
MESH tmp = Meshes[Lara.meshPtrs[LM_RHAND]];
|
||||||
|
|
||||||
tmp = Lara.meshPtrs[LM_RHAND];
|
Lara.meshPtrs[LM_RHAND] = Objects[ID_MINECART_LARA_ANIMS].meshIndex + LM_RHAND;
|
||||||
|
|
||||||
Lara.meshPtrs[LM_RHAND] = Meshes[Objects[ID_MINECART_LARA_ANIMS].meshIndex + LM_RHAND];
|
|
||||||
Meshes[Objects[ID_MINECART_LARA_ANIMS].meshIndex + LM_RHAND] = tmp;
|
Meshes[Objects[ID_MINECART_LARA_ANIMS].meshIndex + LM_RHAND] = tmp;
|
||||||
|
|
||||||
cart->Flags |= CF_MESH;
|
cart->Flags |= CF_MESH;
|
||||||
|
|
|
@ -104,7 +104,7 @@ void CrocodileControl(short itemNumber)
|
||||||
ObjectInfo* obj;
|
ObjectInfo* obj;
|
||||||
CREATURE_INFO* crocodile;
|
CREATURE_INFO* crocodile;
|
||||||
AI_INFO info;
|
AI_INFO info;
|
||||||
OBJECT_BONES boneRot;
|
OBJECT_Bones boneRot;
|
||||||
short angle;
|
short angle;
|
||||||
short boneAngle;
|
short boneAngle;
|
||||||
|
|
||||||
|
|
|
@ -261,7 +261,7 @@ void MutantControl(short itemNumber)
|
||||||
ITEM_INFO* item;
|
ITEM_INFO* item;
|
||||||
CREATURE_INFO* mutant;
|
CREATURE_INFO* mutant;
|
||||||
AI_INFO info;
|
AI_INFO info;
|
||||||
OBJECT_BONES mutant_joint;
|
OBJECT_Bones mutant_joint;
|
||||||
short frameNumber;
|
short frameNumber;
|
||||||
short headY;
|
short headY;
|
||||||
short angle;
|
short angle;
|
||||||
|
@ -337,9 +337,9 @@ void MutantControl(short itemNumber)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->currentAnimState != MUTANT_LOCUST1)
|
if (item->currentAnimState != MUTANT_LOCUST1)
|
||||||
mutant_joint = OBJECT_BONES(headY, info.xAngle, true);
|
mutant_joint = OBJECT_Bones(headY, info.xAngle, true);
|
||||||
else
|
else
|
||||||
mutant_joint = OBJECT_BONES(0);
|
mutant_joint = OBJECT_Bones(0);
|
||||||
|
|
||||||
CreatureJoint(item, 0, mutant_joint.bone0);
|
CreatureJoint(item, 0, mutant_joint.bone0);
|
||||||
CreatureJoint(item, 1, mutant_joint.bone1);
|
CreatureJoint(item, 1, mutant_joint.bone1);
|
||||||
|
|
|
@ -221,10 +221,10 @@ void MissileControl(short itemNumber)
|
||||||
|
|
||||||
void ExplodeFX(FX_INFO* fx, int noXZVel, int bits)
|
void ExplodeFX(FX_INFO* fx, int noXZVel, int bits)
|
||||||
{
|
{
|
||||||
short** meshpp = &Meshes[fx->frameNumber];
|
MESH* meshpp = &Meshes[fx->frameNumber];
|
||||||
|
|
||||||
ShatterItem.yRot = fx->pos.yRot;
|
ShatterItem.yRot = fx->pos.yRot;
|
||||||
ShatterItem.meshp = *meshpp;
|
ShatterItem.meshp = meshpp;
|
||||||
ShatterItem.sphere.x = fx->pos.xPos;
|
ShatterItem.sphere.x = fx->pos.xPos;
|
||||||
ShatterItem.sphere.y = fx->pos.yPos;
|
ShatterItem.sphere.y = fx->pos.yPos;
|
||||||
ShatterItem.sphere.z = fx->pos.zPos;
|
ShatterItem.sphere.z = fx->pos.zPos;
|
||||||
|
|
|
@ -67,8 +67,8 @@ void InitAnimating(ObjectInfo* obj, int objectNumber)
|
||||||
obj->saveFlags = true;
|
obj->saveFlags = true;
|
||||||
obj->saveAnim = true;
|
obj->saveAnim = true;
|
||||||
obj->saveMesh = true;
|
obj->saveMesh = true;
|
||||||
Bones[obj->boneIndex + (0 * 4)] |= ROT_Y;
|
//Bones[obj->boneIndex + (0 * 4)] |= ROT_Y;
|
||||||
Bones[obj->boneIndex + (1 * 4)] |= ROT_X;
|
//Bones[obj->boneIndex + (1 * 4)] |= ROT_X;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,7 @@ namespace T5M::Renderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer11::updateAnimation(RendererItem * item, RendererObject * obj, short** frmptr, short frac, short rate, int mask, bool useObjectWorldRotation) {
|
void Renderer11::updateAnimation(RendererItem * item, RendererObject * obj, short** frmptr, short frac, short rate, int mask, bool useObjectWorldRotation) {
|
||||||
RendererBone* bones[32];
|
RendererBone* Bones[32];
|
||||||
int nextBone = 0;
|
int nextBone = 0;
|
||||||
|
|
||||||
Matrix rotation;
|
Matrix rotation;
|
||||||
|
@ -155,11 +155,11 @@ namespace T5M::Renderer {
|
||||||
Matrix* transforms = (item == NULL ? obj->AnimationTransforms.data() : &item->AnimationTransforms[0]);
|
Matrix* transforms = (item == NULL ? obj->AnimationTransforms.data() : &item->AnimationTransforms[0]);
|
||||||
|
|
||||||
// Push
|
// Push
|
||||||
bones[nextBone++] = obj->Skeleton;
|
Bones[nextBone++] = obj->Skeleton;
|
||||||
|
|
||||||
while (nextBone != 0) {
|
while (nextBone != 0) {
|
||||||
// Pop the last bone in the stack
|
// Pop the last bone in the stack
|
||||||
RendererBone* bone = bones[--nextBone];
|
RendererBone* bone = Bones[--nextBone];
|
||||||
|
|
||||||
bool calculateMatrix = (mask >> bone->Index) & 1;
|
bool calculateMatrix = (mask >> bone->Index) & 1;
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ namespace T5M::Renderer {
|
||||||
|
|
||||||
for (int i = 0; i < bone->Children.size(); i++) {
|
for (int i = 0; i < bone->Children.size(); i++) {
|
||||||
// Push
|
// Push
|
||||||
bones[nextBone++] = bone->Children[i];
|
Bones[nextBone++] = bone->Children[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -382,241 +382,64 @@ namespace T5M::Renderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RendererMesh* Renderer11::getRendererMeshFromTrMesh(RendererObject * obj, short* meshPtr, short boneIndex, int isJoints, int isHairs) {
|
RendererMesh* Renderer11::getRendererMeshFromTrMesh(RendererObject * obj, MESH* meshPtr, short boneIndex, int isJoints, int isHairs) {
|
||||||
RendererMesh* mesh = new RendererMesh();
|
RendererMesh* mesh = new RendererMesh();
|
||||||
|
|
||||||
short* basePtr = meshPtr;
|
mesh->Sphere = meshPtr->sphere;
|
||||||
|
|
||||||
short cx = *meshPtr++;
|
if (meshPtr->vertices.size() == 0)
|
||||||
short cy = *meshPtr++;
|
return mesh;
|
||||||
short cz = *meshPtr++;
|
|
||||||
short r1 = *meshPtr++;
|
|
||||||
short r2 = *meshPtr++;
|
|
||||||
|
|
||||||
mesh->Sphere = BoundingSphere(Vector3(cx, cy, cz), r1);
|
MESH_VERTEX * vertices = meshPtr->vertices.data();
|
||||||
|
|
||||||
short numVertices = *meshPtr++;
|
for (int n = 0; n < meshPtr->buckets.size(); n++)
|
||||||
|
|
||||||
VECTOR* vertices = (VECTOR*)malloc(sizeof(VECTOR) * numVertices);
|
|
||||||
for (int v = 0; v < numVertices; v++) {
|
|
||||||
short x = *meshPtr++;
|
|
||||||
short y = *meshPtr++;
|
|
||||||
short z = *meshPtr++;
|
|
||||||
|
|
||||||
vertices[v].vx = x;
|
|
||||||
vertices[v].vy = y;
|
|
||||||
vertices[v].vz = z;
|
|
||||||
|
|
||||||
mesh->Positions.push_back(Vector3(x, y, z));
|
|
||||||
}
|
|
||||||
|
|
||||||
short numNormals = *meshPtr++;
|
|
||||||
VECTOR* normals = NULL;
|
|
||||||
short* colors = NULL;
|
|
||||||
if (numNormals > 0) {
|
|
||||||
normals = (VECTOR*)malloc(sizeof(VECTOR) * numNormals);
|
|
||||||
for (int v = 0; v < numNormals; v++) {
|
|
||||||
short x = *meshPtr++;
|
|
||||||
short y = *meshPtr++;
|
|
||||||
short z = *meshPtr++;
|
|
||||||
|
|
||||||
normals[v].vx = x;
|
|
||||||
normals[v].vy = y;
|
|
||||||
normals[v].vz = z;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
short numLights = -numNormals;
|
|
||||||
colors = (short*)malloc(sizeof(short) * numLights);
|
|
||||||
for (int v = 0; v < numLights; v++) {
|
|
||||||
colors[v] = *meshPtr++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
short numRectangles = *meshPtr++;
|
|
||||||
|
|
||||||
for (int r = 0; r < numRectangles; r++) {
|
|
||||||
short v1 = *meshPtr++;
|
|
||||||
short v2 = *meshPtr++;
|
|
||||||
short v3 = *meshPtr++;
|
|
||||||
short v4 = *meshPtr++;
|
|
||||||
short textureId = *meshPtr++;
|
|
||||||
short effects = *meshPtr++;
|
|
||||||
|
|
||||||
short indices[4] = { v1, v2, v3, v4 };
|
|
||||||
|
|
||||||
short textureIndex = textureId & 0x7FFF;
|
|
||||||
bool doubleSided = (textureId & 0x8000) >> 15;
|
|
||||||
|
|
||||||
// Get the object texture
|
|
||||||
OBJECT_TEXTURE* texture = &ObjectTextures[textureIndex];
|
|
||||||
int tile = texture->tileAndFlag & 0x7FFF;
|
|
||||||
|
|
||||||
// Create vertices
|
|
||||||
RendererBucket* bucket;
|
|
||||||
int bucketIndex = RENDERER_BUCKET_SOLID;
|
|
||||||
if (texture->attribute == 2 || (effects & 1))
|
|
||||||
bucketIndex = RENDERER_BUCKET_TRANSPARENT;
|
|
||||||
else
|
|
||||||
bucketIndex = RENDERER_BUCKET_SOLID;
|
|
||||||
|
|
||||||
// ColAddHorizon special handling
|
|
||||||
if (obj != NULL && obj->Id == ID_HORIZON && g_GameFlow->GetLevel(CurrentLevel)->ColAddHorizon) {
|
|
||||||
if (texture->attribute == 2 || (effects & 1))
|
|
||||||
bucketIndex = RENDERER_BUCKET_TRANSPARENT;
|
|
||||||
else
|
|
||||||
bucketIndex = RENDERER_BUCKET_SOLID;
|
|
||||||
}
|
|
||||||
|
|
||||||
bucket = &mesh->Buckets[bucketIndex];
|
|
||||||
if (obj != NULL)
|
|
||||||
obj->HasDataInBucket[bucketIndex] = true;
|
|
||||||
|
|
||||||
int baseVertices = bucket->NumVertices;
|
|
||||||
for (int v = 0; v < 4; v++) {
|
|
||||||
RendererVertex vertex;
|
|
||||||
|
|
||||||
vertex.Position.x = vertices[indices[v]].vx;
|
|
||||||
vertex.Position.y = vertices[indices[v]].vy;
|
|
||||||
vertex.Position.z = vertices[indices[v]].vz;
|
|
||||||
|
|
||||||
if (numNormals > 0) {
|
|
||||||
vertex.Normal.x = normals[indices[v]].vx / 16300.0f;
|
|
||||||
vertex.Normal.y = normals[indices[v]].vy / 16300.0f;
|
|
||||||
vertex.Normal.z = normals[indices[v]].vz / 16300.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
vertex.UV.x = texture->vertices[v].x;
|
|
||||||
vertex.UV.y = texture->vertices[v].y;
|
|
||||||
|
|
||||||
vertex.Bone = boneIndex;
|
|
||||||
if (isHairs)
|
|
||||||
vertex.Bone = indices[v];
|
|
||||||
|
|
||||||
if (colors == NULL) {
|
|
||||||
vertex.Color = Vector4::One * 0.5f;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
short shade = colors[indices[v]];
|
|
||||||
shade = (255 - shade * 255 / 8191) & 0xFF;
|
|
||||||
vertex.Color = Vector4(shade / 255.0f, shade / 255.0f, shade / 255.0f, 1.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
bucket->NumVertices++;
|
|
||||||
bucket->Vertices.push_back(vertex);
|
|
||||||
}
|
|
||||||
|
|
||||||
bucket->Indices.push_back(baseVertices);
|
|
||||||
bucket->Indices.push_back(baseVertices + 1);
|
|
||||||
bucket->Indices.push_back(baseVertices + 3);
|
|
||||||
bucket->Indices.push_back(baseVertices + 2);
|
|
||||||
bucket->Indices.push_back(baseVertices + 3);
|
|
||||||
bucket->Indices.push_back(baseVertices + 1);
|
|
||||||
bucket->NumIndices += 6;
|
|
||||||
|
|
||||||
RendererPolygon newPolygon;
|
|
||||||
newPolygon.Shape = SHAPE_RECTANGLE;
|
|
||||||
newPolygon.TextureId = textureId;
|
|
||||||
newPolygon.Indices[0] = baseVertices;
|
|
||||||
newPolygon.Indices[1] = baseVertices + 1;
|
|
||||||
newPolygon.Indices[2] = baseVertices + 2;
|
|
||||||
newPolygon.Indices[3] = baseVertices + 3;
|
|
||||||
bucket->Polygons.push_back(newPolygon);
|
|
||||||
}
|
|
||||||
|
|
||||||
short numTriangles = *meshPtr++;
|
|
||||||
|
|
||||||
for (int r = 0; r < numTriangles; r++) {
|
|
||||||
short v1 = *meshPtr++;
|
|
||||||
short v2 = *meshPtr++;
|
|
||||||
short v3 = *meshPtr++;
|
|
||||||
short textureId = *meshPtr++;
|
|
||||||
short effects = *meshPtr++;
|
|
||||||
|
|
||||||
short indices[3] = { v1, v2, v3 };
|
|
||||||
|
|
||||||
short textureIndex = textureId & 0x7FFF;
|
|
||||||
bool doubleSided = (textureId & 0x8000) >> 15;
|
|
||||||
|
|
||||||
// Get the object texture
|
|
||||||
OBJECT_TEXTURE* texture = &ObjectTextures[textureIndex];
|
|
||||||
int tile = texture->tileAndFlag & 0x7FFF;
|
|
||||||
|
|
||||||
// Create vertices
|
|
||||||
RendererBucket* bucket;
|
|
||||||
int bucketIndex = RENDERER_BUCKET_SOLID;
|
|
||||||
if (texture->attribute == 2 || (effects & 1))
|
|
||||||
bucketIndex = RENDERER_BUCKET_TRANSPARENT;
|
|
||||||
else
|
|
||||||
bucketIndex = RENDERER_BUCKET_SOLID;
|
|
||||||
|
|
||||||
bucket = &mesh->Buckets[bucketIndex];
|
|
||||||
if (obj != NULL)
|
|
||||||
obj->HasDataInBucket[bucketIndex] = true;
|
|
||||||
|
|
||||||
int baseVertices = bucket->NumVertices;
|
|
||||||
for (int v = 0; v < 3; v++) {
|
|
||||||
RendererVertex vertex;
|
|
||||||
|
|
||||||
vertex.Position.x = vertices[indices[v]].vx;
|
|
||||||
vertex.Position.y = vertices[indices[v]].vy;
|
|
||||||
vertex.Position.z = vertices[indices[v]].vz;
|
|
||||||
|
|
||||||
if (numNormals > 0) {
|
|
||||||
vertex.Normal.x = normals[indices[v]].vx / 16300.0f;
|
|
||||||
vertex.Normal.y = normals[indices[v]].vy / 16300.0f;
|
|
||||||
vertex.Normal.z = normals[indices[v]].vz / 16300.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
vertex.UV.x = texture->vertices[v].x;
|
|
||||||
vertex.UV.y = texture->vertices[v].y;
|
|
||||||
|
|
||||||
vertex.Bone = boneIndex;
|
|
||||||
if (isHairs)
|
|
||||||
vertex.Bone = indices[v];
|
|
||||||
|
|
||||||
if (colors == NULL) {
|
|
||||||
vertex.Color = Vector4::One * 0.5f;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
short shade = colors[indices[v]];
|
|
||||||
shade = (255 - shade * 255 / 8191) & 0xFF;
|
|
||||||
vertex.Color = Vector4(shade / 255.0f, shade / 255.0f, shade / 255.0f, 1.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
bucket->NumVertices++;
|
|
||||||
bucket->Vertices.push_back(vertex);
|
|
||||||
}
|
|
||||||
|
|
||||||
bucket->Indices.push_back(baseVertices);
|
|
||||||
bucket->Indices.push_back(baseVertices + 1);
|
|
||||||
bucket->Indices.push_back(baseVertices + 2);
|
|
||||||
bucket->NumIndices += 3;
|
|
||||||
|
|
||||||
RendererPolygon newPolygon;
|
|
||||||
newPolygon.Shape = SHAPE_TRIANGLE;
|
|
||||||
newPolygon.TextureId = textureId;
|
|
||||||
newPolygon.Indices[0] = baseVertices;
|
|
||||||
newPolygon.Indices[1] = baseVertices + 1;
|
|
||||||
newPolygon.Indices[2] = baseVertices + 2;
|
|
||||||
bucket->Polygons.push_back(newPolygon);
|
|
||||||
}
|
|
||||||
|
|
||||||
free(vertices);
|
|
||||||
if (normals != NULL)
|
|
||||||
free(normals);
|
|
||||||
if (colors != NULL)
|
|
||||||
free(colors);
|
|
||||||
|
|
||||||
unsigned int castedMeshPtr = reinterpret_cast<unsigned int>(basePtr);
|
|
||||||
|
|
||||||
if (m_meshPointersToMesh.find(castedMeshPtr) == m_meshPointersToMesh.end()) {
|
|
||||||
m_meshPointersToMesh.insert(pair<unsigned int, RendererMesh*>(castedMeshPtr, mesh));
|
|
||||||
}
|
|
||||||
/*else if (m_meshPointersToMesh[castedMeshPtr] == NULL)
|
|
||||||
{
|
{
|
||||||
m_meshPointersToMesh[castedMeshPtr] = mesh;
|
BUCKET* levelBucket = &meshPtr->buckets[n];
|
||||||
}*/
|
RendererBucket* bucket;
|
||||||
|
int bucketIndex;
|
||||||
|
|
||||||
|
if (levelBucket->blendMode != 0)
|
||||||
|
bucketIndex = RENDERER_BUCKET_TRANSPARENT;
|
||||||
|
else
|
||||||
|
bucketIndex = RENDERER_BUCKET_SOLID;
|
||||||
|
|
||||||
|
bucket = &mesh->Buckets[bucketIndex];
|
||||||
|
|
||||||
|
for (int v = 0; v < levelBucket->indices.size(); v++)
|
||||||
|
{
|
||||||
|
int index = levelBucket->indices[v];
|
||||||
|
MESH_VERTEX* levelVertex = &vertices[index];
|
||||||
|
|
||||||
|
RendererVertex vertex;
|
||||||
|
|
||||||
|
vertex.Position.x = levelVertex->position.x;
|
||||||
|
vertex.Position.y = levelVertex->position.y;
|
||||||
|
vertex.Position.z = levelVertex->position.z;
|
||||||
|
|
||||||
|
vertex.Normal.x = levelVertex->normal.x;
|
||||||
|
vertex.Normal.y = levelVertex->normal.y;
|
||||||
|
vertex.Normal.z = levelVertex->normal.z;
|
||||||
|
|
||||||
|
vertex.UV.x = levelVertex->textureCoordinates.x;
|
||||||
|
vertex.UV.y = levelVertex->textureCoordinates.y;
|
||||||
|
|
||||||
|
vertex.Color.x = levelVertex->color.x;
|
||||||
|
vertex.Color.y = levelVertex->color.y;
|
||||||
|
vertex.Color.z = levelVertex->color.z;
|
||||||
|
vertex.Color.w = 1.0f;
|
||||||
|
|
||||||
|
vertex.Bone = boneIndex;
|
||||||
|
//vertex.Index = index;
|
||||||
|
if (isHairs)
|
||||||
|
vertex.Bone = index;
|
||||||
|
|
||||||
|
mesh->Positions.push_back(vertex.Position);
|
||||||
|
|
||||||
|
bucket->Indices.push_back(bucket->NumVertices);
|
||||||
|
bucket->NumVertices++;
|
||||||
|
bucket->Vertices.push_back(vertex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_meshes.push_back(mesh);
|
m_meshes.push_back(mesh);
|
||||||
|
|
||||||
|
@ -924,8 +747,8 @@ namespace T5M::Renderer {
|
||||||
m_rooms[roomNumber2].Room = &Rooms[roomNumber2];
|
m_rooms[roomNumber2].Room = &Rooms[roomNumber2];
|
||||||
}
|
}
|
||||||
|
|
||||||
RendererMesh* Renderer11::getMeshFromMeshPtr(unsigned int meshp) {
|
RendererMesh* Renderer11::getMesh(int meshIndex) {
|
||||||
return m_meshPointersToMesh[meshp];
|
return m_meshes[meshIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer11::GetLaraAbsBonePosition(Vector3 * pos, int joint) {
|
void Renderer11::GetLaraAbsBonePosition(Vector3 * pos, int joint) {
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
#include "ConstantBuffers/CameraMatrixBuffer.h"
|
#include "ConstantBuffers/CameraMatrixBuffer.h"
|
||||||
#include "Texture2D/Texture2D.h"
|
#include "Texture2D/Texture2D.h"
|
||||||
|
|
||||||
|
#include <level.h>
|
||||||
|
|
||||||
namespace T5M::Renderer
|
namespace T5M::Renderer
|
||||||
{
|
{
|
||||||
#define MESH_BITS(x) (1 << x)
|
#define MESH_BITS(x) (1 << x)
|
||||||
|
@ -27,7 +29,7 @@ namespace T5M::Renderer
|
||||||
constexpr auto MAX_LIGHTS_DRAW = 16384;
|
constexpr auto MAX_LIGHTS_DRAW = 16384;
|
||||||
constexpr auto MAX_DYNAMIC_LIGHTS = 16384;
|
constexpr auto MAX_DYNAMIC_LIGHTS = 16384;
|
||||||
constexpr auto MAX_DRAW_STATICS = 16384;
|
constexpr auto MAX_DRAW_STATICS = 16384;
|
||||||
constexpr auto MAX_BONES = 32;
|
constexpr auto MAX_Bones = 32;
|
||||||
constexpr auto MAX_SPRITES = 16384;
|
constexpr auto MAX_SPRITES = 16384;
|
||||||
constexpr auto REFERENCE_RES_WIDTH = 800;
|
constexpr auto REFERENCE_RES_WIDTH = 800;
|
||||||
constexpr auto REFERENCE_RES_HEIGHT = 450;
|
constexpr auto REFERENCE_RES_HEIGHT = 450;
|
||||||
|
@ -55,6 +57,7 @@ namespace T5M::Renderer
|
||||||
DirectX::SimpleMath::Vector2 UV;
|
DirectX::SimpleMath::Vector2 UV;
|
||||||
DirectX::SimpleMath::Vector4 Color;
|
DirectX::SimpleMath::Vector4 Color;
|
||||||
float Bone;
|
float Bone;
|
||||||
|
//int Index;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -475,7 +478,7 @@ namespace T5M::Renderer
|
||||||
int m_numSprites;
|
int m_numSprites;
|
||||||
int m_numSpritesSequences;
|
int m_numSpritesSequences;
|
||||||
std::vector<RendererSpriteSequence> m_spriteSequences;
|
std::vector<RendererSpriteSequence> m_spriteSequences;
|
||||||
std::unordered_map<unsigned int, RendererMesh*> m_meshPointersToMesh;
|
std::unordered_map<int, RendererMesh*> m_meshPointersToMesh;
|
||||||
DirectX::SimpleMath::Matrix m_LaraWorldMatrix;
|
DirectX::SimpleMath::Matrix m_LaraWorldMatrix;
|
||||||
std::vector<RendererAnimatedTextureSet> m_animatedTextureSets;
|
std::vector<RendererAnimatedTextureSet> m_animatedTextureSets;
|
||||||
int m_numAnimatedTextureSets;
|
int m_numAnimatedTextureSets;
|
||||||
|
@ -525,7 +528,7 @@ namespace T5M::Renderer
|
||||||
ID3D11Buffer* createConstantBuffer(size_t size);
|
ID3D11Buffer* createConstantBuffer(size_t size);
|
||||||
int getAnimatedTextureInfo(short textureId);
|
int getAnimatedTextureInfo(short textureId);
|
||||||
void initialiseHairRemaps();
|
void initialiseHairRemaps();
|
||||||
RendererMesh* getRendererMeshFromTrMesh(RendererObject* obj, short* meshPtr, short boneIndex, int isJoints, int isHairs);
|
RendererMesh* getRendererMeshFromTrMesh(RendererObject* obj, MESH* meshPtr, short boneIndex, int isJoints, int isHairs);
|
||||||
void fromTrAngle(DirectX::SimpleMath::Matrix* matrix, short* frameptr, int index);
|
void fromTrAngle(DirectX::SimpleMath::Matrix* matrix, short* frameptr, int index);
|
||||||
void buildHierarchy(RendererObject* obj);
|
void buildHierarchy(RendererObject* obj);
|
||||||
void buildHierarchyRecursive(RendererObject* obj, RendererBone* node, RendererBone* parentNode);
|
void buildHierarchyRecursive(RendererObject* obj, RendererBone* node, RendererBone* parentNode);
|
||||||
|
@ -655,7 +658,7 @@ namespace T5M::Renderer
|
||||||
int GetSpheres(short itemNumber, BoundingSphere* ptr, char worldSpace, DirectX::SimpleMath::Matrix local);
|
int GetSpheres(short itemNumber, BoundingSphere* ptr, char worldSpace, DirectX::SimpleMath::Matrix local);
|
||||||
void GetBoneMatrix(short itemNumber, int joint, DirectX::SimpleMath::Matrix* outMatrix);
|
void GetBoneMatrix(short itemNumber, int joint, DirectX::SimpleMath::Matrix* outMatrix);
|
||||||
|
|
||||||
RendererMesh* getMeshFromMeshPtr(unsigned int meshp);
|
RendererMesh* getMesh(int meshIndex);
|
||||||
private:
|
private:
|
||||||
void drawFootprints();
|
void drawFootprints();
|
||||||
void prepareCameraForFrame();
|
void prepareCameraForFrame();
|
||||||
|
|
|
@ -329,7 +329,7 @@ namespace T5M::Renderer {
|
||||||
// We need to override the bone index because the engine will take mesh 0 while drawing pistols anim,
|
// We need to override the bone index because the engine will take mesh 0 while drawing pistols anim,
|
||||||
// and vertices have bone index 0 and not 10
|
// and vertices have bone index 0 and not 10
|
||||||
RendererMesh* mesh = getRendererMeshFromTrMesh(moveable,
|
RendererMesh* mesh = getRendererMeshFromTrMesh(moveable,
|
||||||
Meshes[obj->meshIndex + j],
|
&Meshes[obj->meshIndex + j],
|
||||||
j, MoveablesIds[i] == ID_LARA_SKIN_JOINTS,
|
j, MoveablesIds[i] == ID_LARA_SKIN_JOINTS,
|
||||||
MoveablesIds[i] == ID_LARA_HAIR);
|
MoveablesIds[i] == ID_LARA_HAIR);
|
||||||
moveable->ObjectMeshes.push_back(mesh);
|
moveable->ObjectMeshes.push_back(mesh);
|
||||||
|
@ -341,75 +341,78 @@ namespace T5M::Renderer {
|
||||||
obj->nmeshes = 0;
|
obj->nmeshes = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int* bone = &Bones[obj->boneIndex];
|
|
||||||
|
|
||||||
stack<RendererBone*> stack;
|
|
||||||
|
|
||||||
for (int j = 0; j < obj->nmeshes; j++) {
|
for (int j = 0; j < obj->nmeshes; j++) {
|
||||||
moveable->LinearizedBones.push_back(new RendererBone(j));
|
moveable->LinearizedBones.push_back(new RendererBone(j));
|
||||||
moveable->AnimationTransforms.push_back(Matrix::Identity);
|
moveable->AnimationTransforms.push_back(Matrix::Identity);
|
||||||
moveable->BindPoseTransforms.push_back(Matrix::Identity);
|
moveable->BindPoseTransforms.push_back(Matrix::Identity);
|
||||||
}
|
}
|
||||||
|
|
||||||
RendererBone* currentBone = moveable->LinearizedBones[0];
|
if (obj->nmeshes > 1)
|
||||||
RendererBone* stackBone = moveable->LinearizedBones[0];
|
{
|
||||||
|
int* bone = &Bones[obj->boneIndex];
|
||||||
|
|
||||||
for (int mi = 0; mi < obj->nmeshes - 1; mi++) {
|
stack<RendererBone*> stack;
|
||||||
int j = mi + 1;
|
|
||||||
|
|
||||||
int opcode = *(bone++);
|
RendererBone* currentBone = moveable->LinearizedBones[0];
|
||||||
int linkX = *(bone++);
|
RendererBone* stackBone = moveable->LinearizedBones[0];
|
||||||
int linkY = *(bone++);
|
|
||||||
int linkZ = *(bone++);
|
|
||||||
|
|
||||||
byte flags = opcode & 0x1C;
|
for (int mi = 0; mi < obj->nmeshes - 1; mi++) {
|
||||||
|
int j = mi + 1;
|
||||||
|
|
||||||
moveable->LinearizedBones[j]->ExtraRotationFlags = flags;
|
int opcode = *(bone++);
|
||||||
|
int linkX = *(bone++);
|
||||||
|
int linkY = *(bone++);
|
||||||
|
int linkZ = *(bone++);
|
||||||
|
|
||||||
switch (opcode & 0x03) {
|
byte flags = opcode & 0x1C;
|
||||||
case 0:
|
|
||||||
moveable->LinearizedBones[j]->Parent = currentBone;
|
|
||||||
moveable->LinearizedBones[j]->Translation = Vector3(linkX, linkY, linkZ);
|
|
||||||
currentBone->Children.push_back(moveable->LinearizedBones[j]);
|
|
||||||
currentBone = moveable->LinearizedBones[j];
|
|
||||||
|
|
||||||
break;
|
moveable->LinearizedBones[j]->ExtraRotationFlags = flags;
|
||||||
case 1:
|
|
||||||
if (stack.empty())
|
|
||||||
continue;
|
|
||||||
currentBone = stack.top();
|
|
||||||
stack.pop();
|
|
||||||
|
|
||||||
moveable->LinearizedBones[j]->Parent = currentBone;
|
switch (opcode & 0x03) {
|
||||||
moveable->LinearizedBones[j]->Translation = Vector3(linkX, linkY, linkZ);
|
case 0:
|
||||||
currentBone->Children.push_back(moveable->LinearizedBones[j]);
|
moveable->LinearizedBones[j]->Parent = currentBone;
|
||||||
currentBone = moveable->LinearizedBones[j];
|
moveable->LinearizedBones[j]->Translation = Vector3(linkX, linkY, linkZ);
|
||||||
|
currentBone->Children.push_back(moveable->LinearizedBones[j]);
|
||||||
|
currentBone = moveable->LinearizedBones[j];
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 1:
|
||||||
stack.push(currentBone);
|
if (stack.empty())
|
||||||
|
continue;
|
||||||
|
currentBone = stack.top();
|
||||||
|
stack.pop();
|
||||||
|
|
||||||
moveable->LinearizedBones[j]->Translation = Vector3(linkX, linkY, linkZ);
|
moveable->LinearizedBones[j]->Parent = currentBone;
|
||||||
moveable->LinearizedBones[j]->Parent = currentBone;
|
moveable->LinearizedBones[j]->Translation = Vector3(linkX, linkY, linkZ);
|
||||||
currentBone->Children.push_back(moveable->LinearizedBones[j]);
|
currentBone->Children.push_back(moveable->LinearizedBones[j]);
|
||||||
currentBone = moveable->LinearizedBones[j];
|
currentBone = moveable->LinearizedBones[j];
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 2:
|
||||||
if (stack.empty())
|
stack.push(currentBone);
|
||||||
continue;
|
|
||||||
RendererBone* theBone = stack.top();
|
|
||||||
stack.pop();
|
|
||||||
|
|
||||||
moveable->LinearizedBones[j]->Translation = Vector3(linkX, linkY, linkZ);
|
moveable->LinearizedBones[j]->Translation = Vector3(linkX, linkY, linkZ);
|
||||||
moveable->LinearizedBones[j]->Parent = theBone;
|
moveable->LinearizedBones[j]->Parent = currentBone;
|
||||||
theBone->Children.push_back(moveable->LinearizedBones[j]);
|
currentBone->Children.push_back(moveable->LinearizedBones[j]);
|
||||||
currentBone = moveable->LinearizedBones[j];
|
currentBone = moveable->LinearizedBones[j];
|
||||||
stack.push(theBone);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
if (stack.empty())
|
||||||
|
continue;
|
||||||
|
RendererBone* theBone = stack.top();
|
||||||
|
stack.pop();
|
||||||
|
|
||||||
|
moveable->LinearizedBones[j]->Translation = Vector3(linkX, linkY, linkZ);
|
||||||
|
moveable->LinearizedBones[j]->Parent = theBone;
|
||||||
|
theBone->Children.push_back(moveable->LinearizedBones[j]);
|
||||||
|
currentBone = moveable->LinearizedBones[j];
|
||||||
|
stack.push(theBone);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int n = 0; n < obj->nmeshes; n++)
|
for (int n = 0; n < obj->nmeshes; n++)
|
||||||
moveable->LinearizedBones[n]->Transform = Matrix::CreateTranslation(
|
moveable->LinearizedBones[n]->Transform = Matrix::CreateTranslation(
|
||||||
|
@ -422,7 +425,7 @@ namespace T5M::Renderer {
|
||||||
|
|
||||||
// Fix Lara skin joints and hairs
|
// Fix Lara skin joints and hairs
|
||||||
if (MoveablesIds[i] == ID_LARA_SKIN_JOINTS) {
|
if (MoveablesIds[i] == ID_LARA_SKIN_JOINTS) {
|
||||||
int bonesToCheck[2] = { 0,0 };
|
int BonesToCheck[2] = { 0,0 };
|
||||||
|
|
||||||
RendererObject* objSkin = m_moveableObjects[ID_LARA_SKIN];
|
RendererObject* objSkin = m_moveableObjects[ID_LARA_SKIN];
|
||||||
|
|
||||||
|
@ -430,8 +433,8 @@ namespace T5M::Renderer {
|
||||||
RendererMesh* jointMesh = moveable->ObjectMeshes[j];
|
RendererMesh* jointMesh = moveable->ObjectMeshes[j];
|
||||||
RendererBone* jointBone = moveable->LinearizedBones[j];
|
RendererBone* jointBone = moveable->LinearizedBones[j];
|
||||||
|
|
||||||
bonesToCheck[0] = jointBone->Parent->Index;
|
BonesToCheck[0] = jointBone->Parent->Index;
|
||||||
bonesToCheck[1] = j;
|
BonesToCheck[1] = j;
|
||||||
|
|
||||||
for (int b1 = 0; b1 < NUM_BUCKETS; b1++) {
|
for (int b1 = 0; b1 < NUM_BUCKETS; b1++) {
|
||||||
RendererBucket* jointBucket = &jointMesh->Buckets[b1];
|
RendererBucket* jointBucket = &jointMesh->Buckets[b1];
|
||||||
|
@ -442,8 +445,8 @@ namespace T5M::Renderer {
|
||||||
bool done = false;
|
bool done = false;
|
||||||
|
|
||||||
for (int k = 0; k < 2; k++) {
|
for (int k = 0; k < 2; k++) {
|
||||||
RendererMesh* skinMesh = objSkin->ObjectMeshes[bonesToCheck[k]];
|
RendererMesh* skinMesh = objSkin->ObjectMeshes[BonesToCheck[k]];
|
||||||
RendererBone* skinBone = objSkin->LinearizedBones[bonesToCheck[k]];
|
RendererBone* skinBone = objSkin->LinearizedBones[BonesToCheck[k]];
|
||||||
|
|
||||||
for (int b2 = 0; b2 < NUM_BUCKETS; b2++) {
|
for (int b2 = 0; b2 < NUM_BUCKETS; b2++) {
|
||||||
RendererBucket* skinBucket = &skinMesh->Buckets[b2];
|
RendererBucket* skinBucket = &skinMesh->Buckets[b2];
|
||||||
|
@ -459,10 +462,15 @@ namespace T5M::Renderer {
|
||||||
int z2 = skinBucket->Vertices[v2].Position.z + skinBone->GlobalTranslation.z;
|
int z2 = skinBucket->Vertices[v2].Position.z + skinBone->GlobalTranslation.z;
|
||||||
|
|
||||||
if (abs(x1 - x2) < 2 && abs(y1 - y2) < 2 && abs(z1 - z2) < 2) {
|
if (abs(x1 - x2) < 2 && abs(y1 - y2) < 2 && abs(z1 - z2) < 2) {
|
||||||
jointVertex->Bone = bonesToCheck[k];
|
jointVertex->Bone = BonesToCheck[k];
|
||||||
jointVertex->Position.x = skinVertex->Position.x;
|
jointVertex->Position.x = skinVertex->Position.x;
|
||||||
jointVertex->Position.y = skinVertex->Position.y;
|
jointVertex->Position.y = skinVertex->Position.y;
|
||||||
jointVertex->Position.z = skinVertex->Position.z;
|
jointVertex->Position.z = skinVertex->Position.z;
|
||||||
|
Vector3 n = (jointVertex->Normal + skinVertex->Normal) / 2.0f;
|
||||||
|
n.Normalize();
|
||||||
|
jointVertex->Normal = n;
|
||||||
|
skinVertex->Normal = n;
|
||||||
|
|
||||||
done = true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -485,7 +493,7 @@ namespace T5M::Renderer {
|
||||||
RendererMesh* mesh = moveable->ObjectMeshes[j];
|
RendererMesh* mesh = moveable->ObjectMeshes[j];
|
||||||
for (int n = 0; n < NUM_BUCKETS; n++) {
|
for (int n = 0; n < NUM_BUCKETS; n++) {
|
||||||
m_numHairVertices += mesh->Buckets[n].NumVertices;
|
m_numHairVertices += mesh->Buckets[n].NumVertices;
|
||||||
m_numHairIndices += mesh->Buckets[n].NumIndices;
|
m_numHairIndices += mesh->Buckets[n].Indices.size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -540,8 +548,7 @@ namespace T5M::Renderer {
|
||||||
RendererObject* staticObject = new RendererObject();
|
RendererObject* staticObject = new RendererObject();
|
||||||
staticObject->Id = StaticObjectsIds[i];
|
staticObject->Id = StaticObjectsIds[i];
|
||||||
|
|
||||||
short* meshPtr = Meshes[obj->meshNumber];
|
RendererMesh* mesh = getRendererMeshFromTrMesh(staticObject, &Meshes[obj->meshNumber], 0, false, false);
|
||||||
RendererMesh* mesh = getRendererMeshFromTrMesh(staticObject, Meshes[obj->meshNumber], 0, false, false);
|
|
||||||
|
|
||||||
staticObject->ObjectMeshes.push_back(mesh);
|
staticObject->ObjectMeshes.push_back(mesh);
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ namespace T5M::Renderer {
|
||||||
updateConstantBuffer(m_cbMisc, &m_stMisc, sizeof(CMiscBuffer));
|
updateConstantBuffer(m_cbMisc, &m_stMisc, sizeof(CMiscBuffer));
|
||||||
m_context->PSSetConstantBuffers(3, 1, &m_cbMisc);
|
m_context->PSSetConstantBuffers(3, 1, &m_cbMisc);
|
||||||
|
|
||||||
m_context->DrawIndexed(bucket->NumIndices, bucket->StartIndex, 0);
|
m_context->DrawIndexed(bucket->Indices.size(), bucket->StartIndex, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ namespace T5M::Renderer {
|
||||||
m_context->PSSetConstantBuffers(1, 1, &m_cbItem);
|
m_context->PSSetConstantBuffers(1, 1, &m_cbItem);
|
||||||
|
|
||||||
for (int k = 0; k < laraSkin->ObjectMeshes.size(); k++) {
|
for (int k = 0; k < laraSkin->ObjectMeshes.size(); k++) {
|
||||||
RendererMesh* mesh = m_meshPointersToMesh[reinterpret_cast<unsigned int>(Lara.meshPtrs[k])];
|
RendererMesh* mesh = getMesh(Lara.meshPtrs[k]);
|
||||||
|
|
||||||
for (int j = 0; j < 2; j++) {
|
for (int j = 0; j < 2; j++) {
|
||||||
RendererBucket* bucket = &mesh->Buckets[j];
|
RendererBucket* bucket = &mesh->Buckets[j];
|
||||||
|
@ -267,7 +267,7 @@ namespace T5M::Renderer {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Draw vertices
|
// Draw vertices
|
||||||
m_context->DrawIndexed(bucket->NumIndices, bucket->StartIndex, 0);
|
m_context->DrawIndexed(bucket->Indices.size(), bucket->StartIndex, 0);
|
||||||
m_numDrawCalls++;
|
m_numDrawCalls++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -285,7 +285,7 @@ namespace T5M::Renderer {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Draw vertices
|
// Draw vertices
|
||||||
m_context->DrawIndexed(bucket->NumIndices, bucket->StartIndex, 0);
|
m_context->DrawIndexed(bucket->Indices.size(), bucket->StartIndex, 0);
|
||||||
m_numDrawCalls++;
|
m_numDrawCalls++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ namespace T5M::Renderer {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Draw vertices
|
// Draw vertices
|
||||||
m_context->DrawIndexed(bucket->NumIndices, bucket->StartIndex, 0);
|
m_context->DrawIndexed(bucket->Indices.size(), bucket->StartIndex, 0);
|
||||||
m_numDrawCalls++;
|
m_numDrawCalls++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -394,7 +394,7 @@ namespace T5M::Renderer {
|
||||||
if (bucket->NumVertices == 0)
|
if (bucket->NumVertices == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
m_context->DrawIndexed(bucket->NumIndices, bucket->StartIndex, 0);
|
m_context->DrawIndexed(bucket->Indices.size(), bucket->StartIndex, 0);
|
||||||
m_numDrawCalls++;
|
m_numDrawCalls++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -580,7 +580,7 @@ namespace T5M::Renderer {
|
||||||
updateConstantBuffer(m_cbMisc, &m_stMisc, sizeof(CMiscBuffer));
|
updateConstantBuffer(m_cbMisc, &m_stMisc, sizeof(CMiscBuffer));
|
||||||
m_context->PSSetConstantBuffers(3, 1, &m_cbMisc);
|
m_context->PSSetConstantBuffers(3, 1, &m_cbMisc);
|
||||||
|
|
||||||
m_context->DrawIndexed(bucket->NumIndices, bucket->StartIndex, 0);
|
m_context->DrawIndexed(bucket->Indices.size(), bucket->StartIndex, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1355,7 +1355,7 @@ namespace T5M::Renderer {
|
||||||
effect->BeginPass(iPass);
|
effect->BeginPass(iPass);
|
||||||
effect->CommitChanges();
|
effect->CommitChanges();
|
||||||
|
|
||||||
drawPrimitives(D3DPT_TRIANGLELIST, 0, 0, bucket->NumVertices, 0, bucket->NumIndices / 3);
|
drawPrimitives(D3DPT_TRIANGLELIST, 0, 0, bucket->NumVertices, 0, bucket->Indices.size() / 3);
|
||||||
|
|
||||||
effect->EndPass();
|
effect->EndPass();
|
||||||
}
|
}
|
||||||
|
@ -1386,8 +1386,7 @@ namespace T5M::Renderer {
|
||||||
RAT_STRUCT* rat = &Rats[i];
|
RAT_STRUCT* rat = &Rats[i];
|
||||||
|
|
||||||
if (rat->on) {
|
if (rat->on) {
|
||||||
short* meshPtr = Meshes[Objects[ID_RATS_EMITTER].meshIndex + (rand() % 8)];
|
RendererMesh* mesh = getMesh(Objects[ID_RATS_EMITTER].meshIndex + (rand() % 8));
|
||||||
RendererMesh* mesh = m_meshPointersToMesh[reinterpret_cast<unsigned int>(meshPtr)];
|
|
||||||
Matrix translation = Matrix::CreateTranslation(rat->pos.xPos, rat->pos.yPos, rat->pos.zPos);
|
Matrix translation = Matrix::CreateTranslation(rat->pos.xPos, rat->pos.yPos, rat->pos.zPos);
|
||||||
Matrix rotation = Matrix::CreateFromYawPitchRoll(rat->pos.yRot, rat->pos.xRot, rat->pos.zRot);
|
Matrix rotation = Matrix::CreateFromYawPitchRoll(rat->pos.yRot, rat->pos.xRot, rat->pos.zRot);
|
||||||
Matrix world = rotation * translation;
|
Matrix world = rotation * translation;
|
||||||
|
@ -1403,7 +1402,7 @@ namespace T5M::Renderer {
|
||||||
if (bucket->NumVertices == 0)
|
if (bucket->NumVertices == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
m_context->DrawIndexed(bucket->NumIndices, bucket->StartIndex, 0);
|
m_context->DrawIndexed(bucket->Indices.size(), bucket->StartIndex, 0);
|
||||||
m_numDrawCalls++;
|
m_numDrawCalls++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1424,9 +1423,8 @@ namespace T5M::Renderer {
|
||||||
|
|
||||||
if (Objects[ID_BATS_EMITTER].loaded) {
|
if (Objects[ID_BATS_EMITTER].loaded) {
|
||||||
ObjectInfo* obj = &Objects[ID_BATS_EMITTER];
|
ObjectInfo* obj = &Objects[ID_BATS_EMITTER];
|
||||||
RendererObject* moveableObj = m_moveableObjects[ID_BATS_EMITTER];
|
RendererObject* moveableObj = m_moveableObjects[ID_BATS_EMITTER];
|
||||||
short* meshPtr = Meshes[Objects[ID_BATS_EMITTER].meshIndex + (-GlobalCounter & 3)];
|
RendererMesh* mesh = getMesh(Objects[ID_BATS_EMITTER].meshIndex + (-GlobalCounter & 3));
|
||||||
RendererMesh* mesh = m_meshPointersToMesh[reinterpret_cast<unsigned int>(meshPtr)];
|
|
||||||
|
|
||||||
for (int m = 0; m < 32; m++)
|
for (int m = 0; m < 32; m++)
|
||||||
memcpy(&m_stItem.BonesMatrices[m], &Matrix::Identity, sizeof(Matrix));
|
memcpy(&m_stItem.BonesMatrices[m], &Matrix::Identity, sizeof(Matrix));
|
||||||
|
@ -1450,7 +1448,7 @@ namespace T5M::Renderer {
|
||||||
m_stItem.AmbientLight = m_rooms[bat->roomNumber].AmbientLight;
|
m_stItem.AmbientLight = m_rooms[bat->roomNumber].AmbientLight;
|
||||||
updateConstantBuffer(m_cbItem, &m_stItem, sizeof(CItemBuffer));
|
updateConstantBuffer(m_cbItem, &m_stItem, sizeof(CItemBuffer));
|
||||||
|
|
||||||
m_context->DrawIndexed(bucket->NumIndices, bucket->StartIndex, 0);
|
m_context->DrawIndexed(bucket->Indices.size(), bucket->StartIndex, 0);
|
||||||
m_numDrawCalls++;
|
m_numDrawCalls++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2074,7 +2072,7 @@ namespace T5M::Renderer {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Draw vertices
|
// Draw vertices
|
||||||
m_context->DrawIndexed(bucket->NumIndices, bucket->StartIndex, 0);
|
m_context->DrawIndexed(bucket->Indices.size(), bucket->StartIndex, 0);
|
||||||
m_numDrawCalls++;
|
m_numDrawCalls++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2141,7 +2139,7 @@ namespace T5M::Renderer {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Draw vertices
|
// Draw vertices
|
||||||
m_context->DrawIndexed(bucket->NumIndices, bucket->StartIndex, 0);
|
m_context->DrawIndexed(bucket->Indices.size(), bucket->StartIndex, 0);
|
||||||
m_numDrawCalls++;
|
m_numDrawCalls++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2398,7 +2396,7 @@ namespace T5M::Renderer {
|
||||||
m_context->OMSetBlendState(m_states->Opaque(), NULL, 0xFFFFFFFF);
|
m_context->OMSetBlendState(m_states->Opaque(), NULL, 0xFFFFFFFF);
|
||||||
|
|
||||||
// Draw vertices
|
// Draw vertices
|
||||||
m_context->DrawIndexed(bucket->NumIndices, bucket->StartIndex, 0);
|
m_context->DrawIndexed(bucket->Indices.size(), bucket->StartIndex, 0);
|
||||||
m_numDrawCalls++;
|
m_numDrawCalls++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -536,7 +536,7 @@ namespace T5M::Renderer {
|
||||||
updateConstantBuffer(m_cbItem, &m_stItem, sizeof(CItemBuffer));
|
updateConstantBuffer(m_cbItem, &m_stItem, sizeof(CItemBuffer));
|
||||||
m_context->VSSetConstantBuffers(1, 1, &m_cbItem);
|
m_context->VSSetConstantBuffers(1, 1, &m_cbItem);
|
||||||
|
|
||||||
m_context->DrawIndexed(flashBucket->NumIndices, flashBucket->StartIndex, 0);
|
m_context->DrawIndexed(flashBucket->Indices.size(), flashBucket->StartIndex, 0);
|
||||||
m_numDrawCalls++;
|
m_numDrawCalls++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -549,7 +549,7 @@ namespace T5M::Renderer {
|
||||||
updateConstantBuffer(m_cbItem, &m_stItem, sizeof(CItemBuffer));
|
updateConstantBuffer(m_cbItem, &m_stItem, sizeof(CItemBuffer));
|
||||||
m_context->VSSetConstantBuffers(1, 1, &m_cbItem);
|
m_context->VSSetConstantBuffers(1, 1, &m_cbItem);
|
||||||
|
|
||||||
m_context->DrawIndexed(flashBucket->NumIndices, flashBucket->StartIndex, 0);
|
m_context->DrawIndexed(flashBucket->Indices.size(), flashBucket->StartIndex, 0);
|
||||||
m_numDrawCalls++;
|
m_numDrawCalls++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -624,7 +624,7 @@ namespace T5M::Renderer {
|
||||||
updateConstantBuffer(m_cbItem, &m_stItem, sizeof(CItemBuffer));
|
updateConstantBuffer(m_cbItem, &m_stItem, sizeof(CItemBuffer));
|
||||||
m_context->VSSetConstantBuffers(1, 1, &m_cbItem);
|
m_context->VSSetConstantBuffers(1, 1, &m_cbItem);
|
||||||
|
|
||||||
m_context->DrawIndexed(flashBucket->NumIndices, flashBucket->StartIndex, 0);
|
m_context->DrawIndexed(flashBucket->Indices.size(), flashBucket->StartIndex, 0);
|
||||||
m_numDrawCalls++;
|
m_numDrawCalls++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -967,7 +967,7 @@ namespace T5M::Renderer {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Draw vertices
|
// Draw vertices
|
||||||
m_context->DrawIndexed(bucket->NumIndices, bucket->StartIndex, 0);
|
m_context->DrawIndexed(bucket->Indices.size(), bucket->StartIndex, 0);
|
||||||
m_numDrawCalls++;
|
m_numDrawCalls++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -404,14 +404,11 @@ namespace T5M::Renderer {
|
||||||
newEffect->Effect = fx;
|
newEffect->Effect = fx;
|
||||||
newEffect->Id = fxNum;
|
newEffect->Id = fxNum;
|
||||||
newEffect->World = Matrix::CreateFromYawPitchRoll(fx->pos.yRot, fx->pos.xPos, fx->pos.zPos) * Matrix::CreateTranslation(fx->pos.xPos, fx->pos.yPos, fx->pos.zPos);
|
newEffect->World = Matrix::CreateFromYawPitchRoll(fx->pos.yRot, fx->pos.xPos, fx->pos.zPos) * Matrix::CreateTranslation(fx->pos.xPos, fx->pos.yPos, fx->pos.zPos);
|
||||||
newEffect->Mesh = m_meshPointersToMesh[reinterpret_cast<unsigned int>(Meshes[(obj->nmeshes ? obj->meshIndex : fx->frameNumber)])];
|
newEffect->Mesh = getMesh(obj->nmeshes ? obj->meshIndex : fx->frameNumber);
|
||||||
|
|
||||||
collectLightsForEffect(fx->roomNumber, newEffect);
|
collectLightsForEffect(fx->roomNumber, newEffect);
|
||||||
|
|
||||||
m_effectsToDraw.push_back(newEffect);
|
m_effectsToDraw.push_back(newEffect);
|
||||||
|
|
||||||
short* mp = Meshes[(obj->nmeshes ? obj->meshIndex : fx->frameNumber)];
|
|
||||||
short hhh = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,8 @@ bool Renderer11::Initialise(int w, int h, int refreshRate, bool windowed, HWND h
|
||||||
{"NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
{"NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
||||||
{"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 24, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
{"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 24, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
||||||
{"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 32, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
{"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 32, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
||||||
{"BLENDINDICES", 0, DXGI_FORMAT_R32_FLOAT, 0, 48, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
{"BLENDINDICES", 0, DXGI_FORMAT_R32_FLOAT, 0, 48, D3D11_INPUT_PER_VERTEX_DATA, 0}/*,
|
||||||
|
{"TEXCOORD", 1, DXGI_FORMAT_R32_UINT, 0, 52, D3D11_INPUT_PER_VERTEX_DATA, 0},*/
|
||||||
};
|
};
|
||||||
|
|
||||||
m_inputLayout = NULL;
|
m_inputLayout = NULL;
|
||||||
|
|
|
@ -136,6 +136,8 @@ void Renderer11::UpdateLaraAnimations(bool force)
|
||||||
laraObj->AnimationTransforms[m] = item->AnimationTransforms[m];
|
laraObj->AnimationTransforms[m] = item->AnimationTransforms[m];
|
||||||
|
|
||||||
// At this point, Lara's matrices are ready. Now let's do ponytails...
|
// At this point, Lara's matrices are ready. Now let's do ponytails...
|
||||||
|
// TODO: disabled for now
|
||||||
|
/*
|
||||||
if (m_moveableObjects[ID_LARA_HAIR] != NULL)
|
if (m_moveableObjects[ID_LARA_HAIR] != NULL)
|
||||||
{
|
{
|
||||||
RendererObject* hairsObj = m_moveableObjects[ID_LARA_HAIR];
|
RendererObject* hairsObj = m_moveableObjects[ID_LARA_HAIR];
|
||||||
|
@ -262,7 +264,7 @@ void Renderer11::UpdateLaraAnimations(bool force)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
m_items[Lara.itemNumber].DoneAnimations = true;
|
m_items[Lara.itemNumber].DoneAnimations = true;
|
||||||
}
|
}
|
||||||
|
@ -334,7 +336,7 @@ bool Renderer11::drawLara(bool transparent, bool shadowMap)
|
||||||
|
|
||||||
for (int k = 0; k < laraSkin->ObjectMeshes.size(); k++)
|
for (int k = 0; k < laraSkin->ObjectMeshes.size(); k++)
|
||||||
{
|
{
|
||||||
RendererMesh* mesh = m_meshPointersToMesh[reinterpret_cast<unsigned int>(Lara.meshPtrs[k])];
|
RendererMesh* mesh = getMesh(Lara.meshPtrs[k]);
|
||||||
|
|
||||||
for (int j = firstBucket; j < lastBucket; j++)
|
for (int j = firstBucket; j < lastBucket; j++)
|
||||||
{
|
{
|
||||||
|
@ -344,7 +346,7 @@ bool Renderer11::drawLara(bool transparent, bool shadowMap)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Draw vertices
|
// Draw vertices
|
||||||
m_context->DrawIndexed(bucket->NumIndices, bucket->StartIndex, 0);
|
m_context->DrawIndexed(bucket->Indices.size(), bucket->StartIndex, 0);
|
||||||
m_numDrawCalls++;
|
m_numDrawCalls++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -365,7 +367,7 @@ bool Renderer11::drawLara(bool transparent, bool shadowMap)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Draw vertices
|
// Draw vertices
|
||||||
m_context->DrawIndexed(bucket->NumIndices, bucket->StartIndex, 0);
|
m_context->DrawIndexed(bucket->Indices.size(), bucket->StartIndex, 0);
|
||||||
m_numDrawCalls++;
|
m_numDrawCalls++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -373,7 +375,7 @@ bool Renderer11::drawLara(bool transparent, bool shadowMap)
|
||||||
|
|
||||||
if (!transparent)
|
if (!transparent)
|
||||||
{
|
{
|
||||||
for (int k = 0; k < laraSkin->ObjectMeshes.size(); k++)
|
/*for (int k = 0; k < laraSkin->ObjectMeshes.size(); k++)
|
||||||
{
|
{
|
||||||
RendererMesh* mesh = laraSkin->ObjectMeshes[k];
|
RendererMesh* mesh = laraSkin->ObjectMeshes[k];
|
||||||
|
|
||||||
|
@ -385,13 +387,13 @@ bool Renderer11::drawLara(bool transparent, bool shadowMap)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Draw vertices
|
// Draw vertices
|
||||||
m_context->DrawIndexed(bucket->NumIndices, bucket->StartIndex, 0);
|
m_context->DrawIndexed(bucket->Indices.size(), bucket->StartIndex, 0);
|
||||||
m_numDrawCalls++;
|
m_numDrawCalls++;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// Hairs are pre-transformed
|
// Hairs are pre-transformed
|
||||||
Matrix matrices[8] = { Matrix::Identity, Matrix::Identity, Matrix::Identity, Matrix::Identity,
|
/*Matrix matrices[8] = { Matrix::Identity, Matrix::Identity, Matrix::Identity, Matrix::Identity,
|
||||||
Matrix::Identity, Matrix::Identity, Matrix::Identity, Matrix::Identity };
|
Matrix::Identity, Matrix::Identity, Matrix::Identity, Matrix::Identity };
|
||||||
memcpy(m_stItem.BonesMatrices, matrices, sizeof(Matrix) * 8);
|
memcpy(m_stItem.BonesMatrices, matrices, sizeof(Matrix) * 8);
|
||||||
m_stItem.World = Matrix::Identity;
|
m_stItem.World = Matrix::Identity;
|
||||||
|
@ -402,7 +404,7 @@ bool Renderer11::drawLara(bool transparent, bool shadowMap)
|
||||||
m_primitiveBatch->Begin();
|
m_primitiveBatch->Begin();
|
||||||
m_primitiveBatch->DrawIndexed(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST, (const uint16_t*)m_hairIndices.data(), m_numHairIndices, m_hairVertices.data(), m_numHairVertices);
|
m_primitiveBatch->DrawIndexed(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST, (const uint16_t*)m_hairIndices.data(), m_numHairIndices, m_hairVertices.data(), m_numHairVertices);
|
||||||
m_primitiveBatch->End();
|
m_primitiveBatch->End();
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -12,11 +12,12 @@
|
||||||
#include "door.h"
|
#include "door.h"
|
||||||
#include "box.h"
|
#include "box.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "levelloader.h"
|
|
||||||
#include "GameFlowScript.h"
|
#include "GameFlowScript.h"
|
||||||
|
|
||||||
using T5M::Renderer::g_Renderer;
|
using T5M::Renderer::g_Renderer;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
ChunkId* ChunkTriggersList = ChunkId::FromString("Tr5Triggers");
|
ChunkId* ChunkTriggersList = ChunkId::FromString("Tr5Triggers");
|
||||||
ChunkId* ChunkTrigger = ChunkId::FromString("Tr5Trigger");
|
ChunkId* ChunkTrigger = ChunkId::FromString("Tr5Trigger");
|
||||||
ChunkId* ChunkLuaIds = ChunkId::FromString("Tr5LuaIds");
|
ChunkId* ChunkLuaIds = ChunkId::FromString("Tr5LuaIds");
|
||||||
|
@ -24,17 +25,13 @@ ChunkId* ChunkLuaId = ChunkId::FromString("Tr5LuaId");
|
||||||
|
|
||||||
extern GameScript* g_GameScript;
|
extern GameScript* g_GameScript;
|
||||||
|
|
||||||
short* RawMeshData;
|
std::vector<int> Bones;
|
||||||
int MeshDataSize;
|
std::vector<MESH> Meshes;
|
||||||
int* MeshTrees;
|
|
||||||
int* RawMeshPointers;
|
|
||||||
int NumObjects;
|
int NumObjects;
|
||||||
int NumStaticObjects;
|
int NumStaticObjects;
|
||||||
int NumMeshPointers;
|
int NumMeshPointers;
|
||||||
int NumObjectTextures;
|
int NumObjectTextures;
|
||||||
int NumTextureTiles;
|
int NumTextureTiles;
|
||||||
short* MeshBase;
|
|
||||||
short** Meshes;
|
|
||||||
int NumItems;
|
int NumItems;
|
||||||
FILE* LevelFilePtr;
|
FILE* LevelFilePtr;
|
||||||
|
|
||||||
|
@ -57,7 +54,6 @@ ANIM_STRUCT* Anims;
|
||||||
CHANGE_STRUCT* Changes;
|
CHANGE_STRUCT* Changes;
|
||||||
RANGE_STRUCT* Ranges;
|
RANGE_STRUCT* Ranges;
|
||||||
short* Commands;
|
short* Commands;
|
||||||
int* Bones;
|
|
||||||
short* Frames;
|
short* Frames;
|
||||||
int AnimationsCount;
|
int AnimationsCount;
|
||||||
short* FloorData;
|
short* FloorData;
|
||||||
|
@ -76,8 +72,6 @@ int g_NumSpritesSequences;
|
||||||
|
|
||||||
ChunkReader* g_levelChunkIO;
|
ChunkReader* g_levelChunkIO;
|
||||||
|
|
||||||
TrLevel g_Level;
|
|
||||||
|
|
||||||
short ReadInt8()
|
short ReadInt8()
|
||||||
{
|
{
|
||||||
byte value = *(byte*)LevelDataPtr;
|
byte value = *(byte*)LevelDataPtr;
|
||||||
|
@ -187,25 +181,56 @@ void LoadObjects()
|
||||||
memset(Objects, 0, sizeof(ObjectInfo) * ID_NUMBER_OBJECTS);
|
memset(Objects, 0, sizeof(ObjectInfo) * ID_NUMBER_OBJECTS);
|
||||||
memset(StaticObjects, 0, sizeof(StaticInfo) * MAX_STATICS);
|
memset(StaticObjects, 0, sizeof(StaticInfo) * MAX_STATICS);
|
||||||
|
|
||||||
int numMeshDataWords = ReadInt32();
|
int numMeshes = ReadInt32();
|
||||||
int numMeshDataBytes = 2 * numMeshDataWords;
|
Meshes.reserve(numMeshes);
|
||||||
|
for (int i = 0; i < numMeshes; i++)
|
||||||
MeshBase = (short*)game_malloc(numMeshDataBytes);
|
|
||||||
ReadBytes(MeshBase, numMeshDataBytes);
|
|
||||||
|
|
||||||
MeshDataSize = numMeshDataBytes;
|
|
||||||
|
|
||||||
int numMeshPointers = ReadInt32();
|
|
||||||
Meshes = (short**)game_malloc(sizeof(short*) * numMeshPointers);
|
|
||||||
ReadBytes(Meshes, sizeof(short*) * numMeshPointers);
|
|
||||||
|
|
||||||
for (int i = 0; i < numMeshPointers; i++)
|
|
||||||
{
|
{
|
||||||
Meshes[i] = &MeshBase[(int)Meshes[i] / 2];
|
MESH mesh;
|
||||||
}
|
|
||||||
|
|
||||||
int numMeshes = numMeshPointers;
|
mesh.sphere = BoundingSphere(Vector3(ReadFloat(), ReadFloat(), ReadFloat()), ReadFloat());
|
||||||
NumMeshPointers = numMeshes;
|
|
||||||
|
int numVertices = ReadInt32();
|
||||||
|
mesh.vertices.reserve(numVertices);
|
||||||
|
for (int j = 0; j < numVertices; j++)
|
||||||
|
{
|
||||||
|
MESH_VERTEX vertex;
|
||||||
|
vertex.position.x = ReadFloat();
|
||||||
|
vertex.position.y = ReadFloat();
|
||||||
|
vertex.position.z = ReadFloat();
|
||||||
|
vertex.normal.x = ReadFloat();
|
||||||
|
vertex.normal.y = ReadFloat();
|
||||||
|
vertex.normal.z = ReadFloat();
|
||||||
|
vertex.textureCoordinates.x = ReadFloat();
|
||||||
|
vertex.textureCoordinates.y = ReadFloat();
|
||||||
|
vertex.color.x = ReadFloat();
|
||||||
|
vertex.color.y = ReadFloat();
|
||||||
|
vertex.color.z = ReadFloat();
|
||||||
|
ReadFloat();
|
||||||
|
vertex.bone = ReadInt32();
|
||||||
|
vertex.index = ReadInt32();
|
||||||
|
mesh.vertices.push_back(vertex);
|
||||||
|
}
|
||||||
|
|
||||||
|
int numBuckets = ReadInt32();
|
||||||
|
mesh.buckets.reserve(numBuckets);
|
||||||
|
for (int j = 0; j < numBuckets; j++)
|
||||||
|
{
|
||||||
|
BUCKET bucket;
|
||||||
|
|
||||||
|
bucket.texture = ReadInt32();
|
||||||
|
bucket.blendMode = ReadInt8();
|
||||||
|
bucket.animated = ReadInt8();
|
||||||
|
|
||||||
|
int numIndices = ReadInt32();
|
||||||
|
bucket.indices.reserve(numIndices);
|
||||||
|
for (int k = 0; k < numIndices; k++)
|
||||||
|
bucket.indices.push_back(ReadInt32());
|
||||||
|
|
||||||
|
mesh.buckets.push_back(bucket);
|
||||||
|
}
|
||||||
|
|
||||||
|
Meshes.push_back(mesh);
|
||||||
|
}
|
||||||
|
|
||||||
int numAnimations = ReadInt32();
|
int numAnimations = ReadInt32();
|
||||||
Anims = (ANIM_STRUCT*)game_malloc(sizeof(ANIM_STRUCT) * numAnimations);
|
Anims = (ANIM_STRUCT*)game_malloc(sizeof(ANIM_STRUCT) * numAnimations);
|
||||||
|
@ -224,21 +249,11 @@ void LoadObjects()
|
||||||
ReadBytes(Commands, sizeof(short) * numCommands);
|
ReadBytes(Commands, sizeof(short) * numCommands);
|
||||||
|
|
||||||
int numBones = ReadInt32();
|
int numBones = ReadInt32();
|
||||||
Bones = (int*)game_malloc(sizeof(int) * numBones);
|
Bones.reserve(numBones);
|
||||||
ReadBytes(Bones, sizeof(int) * numBones);
|
for (int i = 0; i < numBones; i++)
|
||||||
|
|
||||||
int* bone = Bones;
|
|
||||||
for (int i = 0; i < 15; i++)
|
|
||||||
{
|
{
|
||||||
int opcode = *(bone++);
|
Bones.push_back(ReadInt32());
|
||||||
int linkX = *(bone++);
|
|
||||||
int linkY = *(bone++);
|
|
||||||
int linkZ = *(bone++);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MeshTrees = (int*)game_malloc(sizeof(int) * numBones);
|
|
||||||
|
|
||||||
memcpy(MeshTrees, Bones, sizeof(int) * numBones);
|
|
||||||
|
|
||||||
int numFrames = ReadInt32();
|
int numFrames = ReadInt32();
|
||||||
Frames = (short*)game_malloc(sizeof(short) * numFrames);
|
Frames = (short*)game_malloc(sizeof(short) * numFrames);
|
||||||
|
@ -260,11 +275,11 @@ void LoadObjects()
|
||||||
MoveablesIds.push_back(objNum);
|
MoveablesIds.push_back(objNum);
|
||||||
|
|
||||||
Objects[objNum].loaded = true;
|
Objects[objNum].loaded = true;
|
||||||
Objects[objNum].nmeshes = ReadInt16();
|
Objects[objNum].nmeshes = (short)ReadInt16();
|
||||||
Objects[objNum].meshIndex = ReadInt16();
|
Objects[objNum].meshIndex = (short)ReadInt16();
|
||||||
Objects[objNum].boneIndex = ReadInt32();
|
Objects[objNum].boneIndex = ReadInt32();
|
||||||
Objects[objNum].frameBase = (short*)(ReadInt32() + (int)Frames);
|
Objects[objNum].frameBase = (short*)(ReadInt32() + (int)Frames);
|
||||||
Objects[objNum].animIndex = ReadInt16();
|
Objects[objNum].animIndex = (short)ReadInt16();
|
||||||
|
|
||||||
ReadInt16();
|
ReadInt16();
|
||||||
|
|
||||||
|
@ -281,7 +296,7 @@ void LoadObjects()
|
||||||
int meshID = ReadInt32();
|
int meshID = ReadInt32();
|
||||||
StaticObjectsIds.push_back(meshID);
|
StaticObjectsIds.push_back(meshID);
|
||||||
|
|
||||||
StaticObjects[meshID].meshNumber = ReadInt16();
|
StaticObjects[meshID].meshNumber = (short)ReadInt16();
|
||||||
|
|
||||||
StaticObjects[meshID].yMinp = ReadInt16();
|
StaticObjects[meshID].yMinp = ReadInt16();
|
||||||
StaticObjects[meshID].xMaxp = ReadInt16();
|
StaticObjects[meshID].xMaxp = ReadInt16();
|
||||||
|
@ -297,7 +312,7 @@ void LoadObjects()
|
||||||
StaticObjects[meshID].zMinc = ReadInt16();
|
StaticObjects[meshID].zMinc = ReadInt16();
|
||||||
StaticObjects[meshID].zMaxc = ReadInt16();
|
StaticObjects[meshID].zMaxc = ReadInt16();
|
||||||
|
|
||||||
StaticObjects[meshID].flags = ReadInt16();
|
StaticObjects[meshID].flags = (short)ReadInt16();
|
||||||
}
|
}
|
||||||
|
|
||||||
// HACK: to remove after decompiling LoadSprites
|
// HACK: to remove after decompiling LoadSprites
|
||||||
|
@ -442,6 +457,7 @@ void ReadRooms()
|
||||||
vertex.color.y = ReadFloat();
|
vertex.color.y = ReadFloat();
|
||||||
vertex.color.z = ReadFloat();
|
vertex.color.z = ReadFloat();
|
||||||
vertex.effects = ReadInt32();
|
vertex.effects = ReadInt32();
|
||||||
|
vertex.index = ReadInt32();
|
||||||
room.vertices.push_back(vertex);
|
room.vertices.push_back(vertex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -736,6 +752,9 @@ void FreeLevel()
|
||||||
StaticsTextures.clear();
|
StaticsTextures.clear();
|
||||||
SpritesTextures.clear();
|
SpritesTextures.clear();
|
||||||
ObjectTextures.clear();
|
ObjectTextures.clear();
|
||||||
|
Bones.clear();
|
||||||
|
Meshes.clear();
|
||||||
|
MoveablesIds.clear();
|
||||||
g_Renderer.FreeRendererData();
|
g_Renderer.FreeRendererData();
|
||||||
g_GameScript->FreeLevelScripts();
|
g_GameScript->FreeLevelScripts();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include "room.h"
|
#include "room.h"
|
||||||
|
|
||||||
#define AddPtr(p, t, n) p = (t*)((char*)(p) + (ptrdiff_t)(n));
|
#define AddPtr(p, t, n) p = (t*)((char*)(p) + (ptrdiff_t)(n));
|
||||||
#define MESHES(slot, mesh) Meshes[Objects[slot].meshIndex + mesh]
|
#define MESHES(slot, mesh) (Objects[slot].meshIndex + mesh)
|
||||||
|
|
||||||
struct ChunkId;
|
struct ChunkId;
|
||||||
struct LEB128;
|
struct LEB128;
|
||||||
|
@ -28,30 +28,15 @@ typedef struct OBJECT_TEXTURE
|
||||||
int destination;
|
int destination;
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
struct TEXTURE
|
||||||
struct tr_object_texture_vert
|
|
||||||
{
|
{
|
||||||
byte Xcoordinate; // 1 if Xpixel is the low value, 255 if Xpixel is the high value in the object texture
|
int width;
|
||||||
byte Xpixel;
|
int height;
|
||||||
byte Ycoordinate; // 1 if Ypixel is the low value, 255 if Ypixel is the high value in the object texture
|
int size;
|
||||||
byte Ypixel;
|
std::vector<byte> data;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tr4_object_texture
|
struct AIOBJECT
|
||||||
{
|
|
||||||
short Attribute;
|
|
||||||
short TileAndFlag;
|
|
||||||
short NewFlags;
|
|
||||||
tr_object_texture_vert Vertices[4]; // The four corners of the texture
|
|
||||||
int OriginalU;
|
|
||||||
int OriginalV;
|
|
||||||
int Width; // Actually width-1
|
|
||||||
int Height; // Actually height-1
|
|
||||||
short Padding;
|
|
||||||
};
|
|
||||||
#pragma pack(pop)
|
|
||||||
|
|
||||||
typedef struct AIOBJECT
|
|
||||||
{
|
{
|
||||||
short objectNumber;
|
short objectNumber;
|
||||||
short roomNumber;
|
short roomNumber;
|
||||||
|
@ -64,14 +49,14 @@ typedef struct AIOBJECT
|
||||||
short boxNumber;
|
short boxNumber;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct CHANGE_STRUCT
|
struct CHANGE_STRUCT
|
||||||
{
|
{
|
||||||
short goalAnimState;
|
short goalAnimState;
|
||||||
short numberRanges;
|
short numberRanges;
|
||||||
short rangeIndex;
|
short rangeIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct RANGE_STRUCT
|
struct RANGE_STRUCT
|
||||||
{
|
{
|
||||||
short startFrame;
|
short startFrame;
|
||||||
short endFrame;
|
short endFrame;
|
||||||
|
@ -79,7 +64,7 @@ typedef struct RANGE_STRUCT
|
||||||
short linkFrameNum;
|
short linkFrameNum;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct SPRITE
|
struct SPRITE
|
||||||
{
|
{
|
||||||
int tile;
|
int tile;
|
||||||
float x1;
|
float x1;
|
||||||
|
@ -92,26 +77,37 @@ typedef struct SPRITE
|
||||||
float y4;
|
float y4;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern short* MeshData;
|
struct MESH_VERTEX
|
||||||
extern int MeshDataSize;
|
{
|
||||||
|
Vector3 position;
|
||||||
|
Vector3 normal;
|
||||||
|
Vector2 textureCoordinates;
|
||||||
|
Vector3 color;
|
||||||
|
int bone;
|
||||||
|
int index;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct MESH
|
||||||
|
{
|
||||||
|
BoundingSphere sphere;
|
||||||
|
std::vector<MESH_VERTEX> vertices;
|
||||||
|
std::vector<BUCKET> buckets;
|
||||||
|
};
|
||||||
|
|
||||||
extern OBJECT_TEXTURE* NewObjectTextures;
|
extern OBJECT_TEXTURE* NewObjectTextures;
|
||||||
extern uintptr_t hLoadLevel;
|
extern uintptr_t hLoadLevel;
|
||||||
extern int NumMeshPointers;
|
extern std::vector<int> Bones;
|
||||||
extern int* MeshTrees;
|
|
||||||
extern int NumObjects;
|
extern int NumObjects;
|
||||||
extern int NumStaticObjects;
|
extern int NumStaticObjects;
|
||||||
extern std::vector<int> MoveablesIds;
|
extern std::vector<int> MoveablesIds;
|
||||||
extern std::vector<int> StaticObjectsIds;
|
extern std::vector<int> StaticObjectsIds;
|
||||||
extern int* RawMeshPointers;
|
|
||||||
extern short* RawMeshData;
|
|
||||||
extern int NumObjectTextures;
|
extern int NumObjectTextures;
|
||||||
extern char* LevelDataPtr;
|
extern char* LevelDataPtr;
|
||||||
extern int IsLevelLoading;
|
extern int IsLevelLoading;
|
||||||
extern int NumTextureTiles;
|
extern int NumTextureTiles;
|
||||||
extern int g_NumSprites;
|
extern int g_NumSprites;
|
||||||
extern int g_NumSpritesSequences;
|
extern int g_NumSpritesSequences;
|
||||||
extern short* MeshBase;
|
extern std::vector<MESH> Meshes;
|
||||||
extern short** Meshes;
|
|
||||||
extern int NumItems;
|
extern int NumItems;
|
||||||
extern std::vector<OBJECT_TEXTURE> ObjectTextures;
|
extern std::vector<OBJECT_TEXTURE> ObjectTextures;
|
||||||
extern ITEM_INFO* Items;
|
extern ITEM_INFO* Items;
|
||||||
|
@ -121,7 +117,6 @@ extern ANIM_STRUCT* Anims;
|
||||||
extern CHANGE_STRUCT* Changes;
|
extern CHANGE_STRUCT* Changes;
|
||||||
extern RANGE_STRUCT* Ranges;
|
extern RANGE_STRUCT* Ranges;
|
||||||
extern short* Commands;
|
extern short* Commands;
|
||||||
extern int* Bones;
|
|
||||||
extern short* Frames;
|
extern short* Frames;
|
||||||
extern int AnimationsCount;
|
extern int AnimationsCount;
|
||||||
extern short* FloorData;
|
extern short* FloorData;
|
||||||
|
@ -135,8 +130,6 @@ extern std::vector<TEXTURE> StaticsTextures;
|
||||||
extern std::vector<TEXTURE> SpritesTextures;
|
extern std::vector<TEXTURE> SpritesTextures;
|
||||||
extern TEXTURE MiscTextures;
|
extern TEXTURE MiscTextures;
|
||||||
|
|
||||||
extern TrLevel g_Level;
|
|
||||||
|
|
||||||
void LoadTextures();
|
void LoadTextures();
|
||||||
void LoadRooms();
|
void LoadRooms();
|
||||||
int LoadItems();
|
int LoadItems();
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,101 +0,0 @@
|
||||||
#pragma once
|
|
||||||
#include "framework.h"
|
|
||||||
#include "sound.h"
|
|
||||||
#include "Streams.h"
|
|
||||||
#include "newtypes.h"
|
|
||||||
#include "ChunkId.h"
|
|
||||||
#include "ChunkReader.h"
|
|
||||||
|
|
||||||
class LevelLoader
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
ChunkId* m_chunkTextureAtlas = ChunkId::FromString("T5MTex");
|
|
||||||
ChunkId* m_chunkTextureColor = ChunkId::FromString("T5MTexColMap");
|
|
||||||
ChunkId* m_chunkTextureNormalMap = ChunkId::FromString("T5MTexNrmMap");
|
|
||||||
ChunkId* m_chunkRoom = ChunkId::FromString("T5MRoom");
|
|
||||||
ChunkId* m_chunkRoomInfo = ChunkId::FromString("T5MRoomInfo");
|
|
||||||
ChunkId* m_chunkBucket = ChunkId::FromString("T5MBckt");
|
|
||||||
ChunkId* m_chunkRoomLight = ChunkId::FromString("T5MLight");
|
|
||||||
ChunkId* m_chunkRoomStatic = ChunkId::FromString("T5MRoomSt");
|
|
||||||
ChunkId* m_chunkRoomPortal = ChunkId::FromString("T5MPortal");
|
|
||||||
ChunkId* m_chunkRoomSector = ChunkId::FromString("T5MSector");
|
|
||||||
ChunkId* m_chunkRoomTriggerVolume = ChunkId::FromString("T5MTrigVol");
|
|
||||||
ChunkId* m_chunkRoomClimbVolume = ChunkId::FromString("T5MClimbVol");
|
|
||||||
ChunkId* m_chunkMaterial = ChunkId::FromString("T5MMat");
|
|
||||||
ChunkId* m_chunkVerticesPositions = ChunkId::FromString("T5MVrtPos");
|
|
||||||
ChunkId* m_chunkVerticesNormals = ChunkId::FromString("T5MVrtN");
|
|
||||||
ChunkId* m_chunkVerticesTextureCoords = ChunkId::FromString("T5MVrtUV");
|
|
||||||
ChunkId* m_chunkVerticesColors = ChunkId::FromString("T5MVrtCol");
|
|
||||||
ChunkId* m_chunkVerticesEffects = ChunkId::FromString("T5MVrtFX");
|
|
||||||
ChunkId* m_chunkVerticesBones = ChunkId::FromString("T5MVrtB");
|
|
||||||
ChunkId* m_chunkPolygon = ChunkId::FromString("T5MPoly");
|
|
||||||
ChunkId* m_chunkMesh = ChunkId::FromString("T5MMesh");
|
|
||||||
ChunkId* m_chunkBone = ChunkId::FromString("T5MBone");
|
|
||||||
ChunkId* m_chunkKeyFrame = ChunkId::FromString("T5MKf");
|
|
||||||
ChunkId* m_chunkAnimCommand = ChunkId::FromString("T5MAnCmd");
|
|
||||||
ChunkId* m_chunkStateChange = ChunkId::FromString("T5MStCh");
|
|
||||||
ChunkId* m_chunkAnimDispatch = ChunkId::FromString("T5MAnDisp");
|
|
||||||
ChunkId* m_chunkAnimation = ChunkId::FromString("T5MAnim");
|
|
||||||
ChunkId* m_chunkMoveable = ChunkId::FromString("T5MMoveable");
|
|
||||||
ChunkId* m_chunkStatic = ChunkId::FromString("T5MStatic");
|
|
||||||
ChunkId* m_chunkItem = ChunkId::FromString("T5MItem");
|
|
||||||
ChunkId* m_chunkAiItem = ChunkId::FromString("T5MAiItem");
|
|
||||||
ChunkId* m_chunkCamera = ChunkId::FromString("T5MCamera");
|
|
||||||
ChunkId* m_chunkSink = ChunkId::FromString("T5MSink");
|
|
||||||
ChunkId* m_chunkFlybyCamera = ChunkId::FromString("T5MFlyBy");
|
|
||||||
ChunkId* m_chunkSoundSource = ChunkId::FromString("T5MSndSrc");
|
|
||||||
ChunkId* m_chunkBox = ChunkId::FromString("T5MBox");
|
|
||||||
ChunkId* m_chunkOverlap = ChunkId::FromString("T5MOv");
|
|
||||||
ChunkId* m_chunkZone = ChunkId::FromString("T5MZone");
|
|
||||||
ChunkId* m_chunkSoundMap = ChunkId::FromString("T5MSoundMap");
|
|
||||||
ChunkId* m_chunkSoundDetail = ChunkId::FromString("T5MSndDet");
|
|
||||||
ChunkId* m_chunkSample = ChunkId::FromString("T5MSam");
|
|
||||||
ChunkId* m_chunkLeelScript = ChunkId::FromString("T5MScript");
|
|
||||||
ChunkId* m_chunkSprite = ChunkId::FromString("T5MSpr");
|
|
||||||
ChunkId* m_chunkSpriteSequence = ChunkId::FromString("T5MSprSeq");
|
|
||||||
ChunkId* m_chunkDummy = ChunkId::FromString("T5MDummy");
|
|
||||||
ChunkId* m_chunkAnimatedTextureSequence = ChunkId::FromString("T5MAnTxSeq");
|
|
||||||
ChunkId* m_chunkAnimatedTextureFrame = ChunkId::FromString("T5MAnTxFr");
|
|
||||||
ChunkId* m_chunkFloorData = ChunkId::FromString("T5MFloorData");
|
|
||||||
|
|
||||||
int m_magicNumber = 0x4D355254;
|
|
||||||
std::string m_filename;
|
|
||||||
ChunkReader* m_reader;
|
|
||||||
FileStream* m_stream;
|
|
||||||
int m_numSamples = 0;
|
|
||||||
TrLevel m_level;
|
|
||||||
|
|
||||||
bool readTexture();
|
|
||||||
bool readAnimatedTextureSequence();
|
|
||||||
bool readRoom();
|
|
||||||
bool readBucket(TrBucket* bucket);
|
|
||||||
bool readMesh();
|
|
||||||
bool readAnimation();
|
|
||||||
bool readChange();
|
|
||||||
bool readDispatch();
|
|
||||||
bool readBone();
|
|
||||||
bool readKeyFrame();
|
|
||||||
bool readCommand();
|
|
||||||
bool readOverlap();
|
|
||||||
bool readFloorData();
|
|
||||||
bool readMoveable();
|
|
||||||
bool readStatic();
|
|
||||||
bool readSpriteSequence();
|
|
||||||
bool readItem();
|
|
||||||
bool readAiItem();
|
|
||||||
bool readSink();
|
|
||||||
bool readCamera();
|
|
||||||
bool readFlybyCamera();
|
|
||||||
bool readSoundSource();
|
|
||||||
bool readBox();
|
|
||||||
bool readZones();
|
|
||||||
bool readSoundMap();
|
|
||||||
bool readSoundDetail();
|
|
||||||
bool readSample();
|
|
||||||
|
|
||||||
public:
|
|
||||||
LevelLoader(std::string filename);
|
|
||||||
~LevelLoader();
|
|
||||||
bool Load();
|
|
||||||
bool FillLegacyData();
|
|
||||||
};
|
|
|
@ -1,386 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "framework.h"
|
#include "framework.h"
|
||||||
|
|
||||||
struct TEXTURE
|
struct BUCKET
|
||||||
{
|
|
||||||
int width;
|
|
||||||
int height;
|
|
||||||
int size;
|
|
||||||
std::vector<byte> data;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrTexturePage
|
|
||||||
{
|
|
||||||
int width;
|
|
||||||
int height;
|
|
||||||
int flags;
|
|
||||||
int format;
|
|
||||||
byte* colorMap;
|
|
||||||
byte* normalMap;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrPolygon
|
|
||||||
{
|
|
||||||
std::vector<int> indices;
|
|
||||||
int animatedSequence;
|
|
||||||
int frame;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrMaterial
|
|
||||||
{
|
{
|
||||||
int texture;
|
int texture;
|
||||||
byte blendMode;
|
byte blendMode;
|
||||||
bool animated;
|
bool animated;
|
||||||
|
std::vector<int> indices;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TrBucket
|
|
||||||
{
|
|
||||||
TrMaterial material;
|
|
||||||
std::vector<Vector3> positions;
|
|
||||||
std::vector<Vector3> colors;
|
|
||||||
std::vector<Vector2> textureCoords;
|
|
||||||
std::vector<Vector3> normals;
|
|
||||||
std::vector<int> verticesEffects;
|
|
||||||
std::vector<int> bones;
|
|
||||||
std::vector<TrPolygon> polygons;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrVolume
|
|
||||||
{
|
|
||||||
int type;
|
|
||||||
Vector3 position;
|
|
||||||
Quaternion rotation;
|
|
||||||
BoundingBox box;
|
|
||||||
BoundingSphere sphere;
|
|
||||||
std::string script;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrClimbVolume : TrVolume
|
|
||||||
{
|
|
||||||
int climbType;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrTriggerVolume : TrVolume
|
|
||||||
{
|
|
||||||
int activators;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrSector
|
|
||||||
{
|
|
||||||
int floorDataIndex;
|
|
||||||
int floorDataCount;
|
|
||||||
int box;
|
|
||||||
int pathfindingFlags;
|
|
||||||
int stepSound;
|
|
||||||
int roomBelow;
|
|
||||||
int roomAbove;
|
|
||||||
int floor;
|
|
||||||
int ceiling;
|
|
||||||
std::vector<int> floorData;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrLight
|
|
||||||
{
|
|
||||||
Vector3 position;
|
|
||||||
Vector3 color;
|
|
||||||
Vector3 direction;
|
|
||||||
byte type;
|
|
||||||
bool castShadows;
|
|
||||||
float intensity;
|
|
||||||
float in;
|
|
||||||
float out;
|
|
||||||
float len;
|
|
||||||
float cutoff;
|
|
||||||
int flags;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrRoomStatic
|
|
||||||
{
|
|
||||||
std::string name;
|
|
||||||
Vector3 position;
|
|
||||||
Quaternion rotation;
|
|
||||||
Vector3 scale;
|
|
||||||
int staticNumber;
|
|
||||||
Vector3 color;
|
|
||||||
bool receiveShadows;
|
|
||||||
bool castShadows;
|
|
||||||
int flags;
|
|
||||||
std::string script;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrPortal
|
|
||||||
{
|
|
||||||
int adjoiningRoom;
|
|
||||||
Vector3 normal;
|
|
||||||
std::vector<Vector3> vertices;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrRoom
|
|
||||||
{
|
|
||||||
int x;
|
|
||||||
int z;
|
|
||||||
int yBottom;
|
|
||||||
int yTop;
|
|
||||||
int numXsectors;
|
|
||||||
int numZsectors;
|
|
||||||
int roomType;
|
|
||||||
int reverb;
|
|
||||||
int effect;
|
|
||||||
float effectStrength;
|
|
||||||
int alternateRoom;
|
|
||||||
int alternatGroup;
|
|
||||||
int flags;
|
|
||||||
Vector3 ambient;
|
|
||||||
std::vector<TrBucket> buckets;
|
|
||||||
std::vector<TrLight> lights;
|
|
||||||
std::vector<TrRoomStatic> statics;
|
|
||||||
std::vector<TrSector> sectors;
|
|
||||||
std::vector<TrPortal> portals;
|
|
||||||
std::vector<TrTriggerVolume> triggers;
|
|
||||||
std::vector<TrClimbVolume> climbVolumes;
|
|
||||||
int itemNumber;
|
|
||||||
int fxNumber;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrMesh
|
|
||||||
{
|
|
||||||
BoundingSphere sphere;
|
|
||||||
std::vector<TrBucket> buckets;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrBone
|
|
||||||
{
|
|
||||||
int opcode;
|
|
||||||
Vector3 offset;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrKeyFrame
|
|
||||||
{
|
|
||||||
Vector3 origin;
|
|
||||||
BoundingBox boundingBox;
|
|
||||||
std::vector<Quaternion> angles;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrAnimCommand
|
|
||||||
{
|
|
||||||
int type;
|
|
||||||
int frame;
|
|
||||||
std::vector<int> params;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrAnimDispatch
|
|
||||||
{
|
|
||||||
int inFrame;
|
|
||||||
int outFrame;
|
|
||||||
int nextAnimation;
|
|
||||||
int nextFrame;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrStateChange
|
|
||||||
{
|
|
||||||
int state;
|
|
||||||
int dispatchIndex;
|
|
||||||
int dispatchCount;
|
|
||||||
std::vector<TrAnimDispatch> dispatches;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrAnimation
|
|
||||||
{
|
|
||||||
int framerate;
|
|
||||||
int state;
|
|
||||||
int nextAnimation;
|
|
||||||
int nextFrame;
|
|
||||||
int frameBase;
|
|
||||||
int frameEnd;
|
|
||||||
float speed;
|
|
||||||
float acceleration;
|
|
||||||
float lateralSpeed;
|
|
||||||
float lateralAcceleration;
|
|
||||||
int framesIndex;
|
|
||||||
int framesCount;
|
|
||||||
int changesIndex;
|
|
||||||
int changesCount;
|
|
||||||
int commandsIndex;
|
|
||||||
int commandsCount;
|
|
||||||
std::vector<TrKeyFrame> keyframes;
|
|
||||||
std::vector<TrStateChange> changes;
|
|
||||||
std::vector<TrAnimCommand> commands;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrMoveable
|
|
||||||
{
|
|
||||||
int id;
|
|
||||||
int animationIndex;
|
|
||||||
int animationCount;
|
|
||||||
int meshIndex;
|
|
||||||
int meshCount;
|
|
||||||
int bonesIndex;
|
|
||||||
int bonesCount;
|
|
||||||
std::vector<TrMesh> meshes;
|
|
||||||
std::vector<TrBone> bones;
|
|
||||||
std::vector<TrAnimation> animations;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrStatic
|
|
||||||
{
|
|
||||||
int id;
|
|
||||||
BoundingBox visibilityBox;
|
|
||||||
BoundingBox collisionBox;
|
|
||||||
int meshNumber;
|
|
||||||
int meshCount;
|
|
||||||
std::vector<TrMesh> meshes;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrAnimatedTexturesFrame
|
|
||||||
{
|
|
||||||
int texture;
|
|
||||||
std::vector<Vector2> textureCoords;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrAnimatedTexturesSequence
|
|
||||||
{
|
|
||||||
byte animationType;
|
|
||||||
float fps;
|
|
||||||
int uvRotate;
|
|
||||||
std::vector<TrAnimatedTexturesFrame> frames;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrItem
|
|
||||||
{
|
|
||||||
std::string name;
|
|
||||||
Vector3 position;
|
|
||||||
Quaternion rotation;
|
|
||||||
float angle;
|
|
||||||
Vector3 scale;
|
|
||||||
Vector3 color;
|
|
||||||
int roomNumber;
|
|
||||||
int objectNumber;
|
|
||||||
std::string script;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrCamera
|
|
||||||
{
|
|
||||||
std::string name;
|
|
||||||
Vector3 position;
|
|
||||||
int roomNumber;
|
|
||||||
int type;
|
|
||||||
int flags;
|
|
||||||
std::string script;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrSoundSource
|
|
||||||
{
|
|
||||||
std::string name;
|
|
||||||
Vector3 position;
|
|
||||||
int roomNumber;
|
|
||||||
float volume;
|
|
||||||
int sound;
|
|
||||||
int playMode;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrSink
|
|
||||||
{
|
|
||||||
std::string name;
|
|
||||||
Vector3 position;
|
|
||||||
int roomNumber;
|
|
||||||
float strength;
|
|
||||||
int box;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrOverlap
|
|
||||||
{
|
|
||||||
int flags;
|
|
||||||
int box;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrBox
|
|
||||||
{
|
|
||||||
Vector2 min;
|
|
||||||
Vector2 max;
|
|
||||||
int floor;
|
|
||||||
int flags;
|
|
||||||
int overlapsIndex;
|
|
||||||
int overlapsCount;
|
|
||||||
std::vector<TrOverlap> overlaps;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrSample
|
|
||||||
{
|
|
||||||
int uncompressedSize;
|
|
||||||
int compressedSize;
|
|
||||||
byte* data;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrSoundDetails
|
|
||||||
{
|
|
||||||
float volume;
|
|
||||||
float range;
|
|
||||||
float chance;
|
|
||||||
float pitch;
|
|
||||||
bool randomizePitch;
|
|
||||||
bool randomizeGain;
|
|
||||||
bool noPanoramic;
|
|
||||||
byte loop;
|
|
||||||
std::vector<TrSample> samples;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrFlybyCamera
|
|
||||||
{
|
|
||||||
std::string name;
|
|
||||||
int sequence;
|
|
||||||
int number;
|
|
||||||
Vector3 position;
|
|
||||||
Vector3 direction;
|
|
||||||
float fov;
|
|
||||||
float roll;
|
|
||||||
float speed;
|
|
||||||
int timer;
|
|
||||||
int roomNumber;
|
|
||||||
int flags;
|
|
||||||
std::string script;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrSprite
|
|
||||||
{
|
|
||||||
int texture;
|
|
||||||
std::vector<Vector2> textureCoords;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrSpriteSequence
|
|
||||||
{
|
|
||||||
int id;
|
|
||||||
int spritesIndex;
|
|
||||||
int spritesCount;
|
|
||||||
std::vector<TrSprite> sprites;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TrLevel
|
|
||||||
{
|
|
||||||
std::vector<TrTexturePage> textures;
|
|
||||||
std::vector<TrRoom> rooms;
|
|
||||||
std::vector<int> floorData;
|
|
||||||
std::vector<TrMesh> meshes;
|
|
||||||
std::vector<TrAnimation> animations;
|
|
||||||
std::vector<TrBone> bones;
|
|
||||||
std::vector<TrStateChange> changes;
|
|
||||||
std::vector<TrAnimDispatch> dispatches;
|
|
||||||
std::vector<TrKeyFrame> frames;
|
|
||||||
std::vector<TrAnimCommand> commands;
|
|
||||||
std::vector<TrAnimatedTexturesSequence> animatedTextures;
|
|
||||||
std::vector<TrSprite> sprites;
|
|
||||||
std::vector<TrSpriteSequence> spriteSequences;
|
|
||||||
std::vector<int> soundMap;
|
|
||||||
std::vector<TrSoundDetails> soundDetails;
|
|
||||||
std::vector<TrSample> samples;
|
|
||||||
std::vector<TrItem> items;
|
|
||||||
std::vector<TrItem> aiItems;
|
|
||||||
std::vector<TrMoveable> moveables;
|
|
||||||
std::vector<TrStatic> statics;
|
|
||||||
std::vector<TrBox> boxes;
|
|
||||||
std::vector<TrOverlap> overlaps;
|
|
||||||
std::vector<int> zones[5][2];
|
|
||||||
std::vector<TrSink> sinks;
|
|
||||||
std::vector<TrCamera> cameras;
|
|
||||||
std::vector<TrSoundSource> soundSources;
|
|
||||||
std::vector<TrFlybyCamera> flybyCameras;
|
|
||||||
};
|
|
|
@ -387,7 +387,6 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts"</Command>
|
||||||
<ClInclude Include="Specific\input.h" />
|
<ClInclude Include="Specific\input.h" />
|
||||||
<ClInclude Include="Specific\IO\Streams.h" />
|
<ClInclude Include="Specific\IO\Streams.h" />
|
||||||
<ClInclude Include="Specific\level.h" />
|
<ClInclude Include="Specific\level.h" />
|
||||||
<ClInclude Include="Specific\levelloader.h" />
|
|
||||||
<ClInclude Include="Specific\newtypes.h" />
|
<ClInclude Include="Specific\newtypes.h" />
|
||||||
<ClInclude Include="Specific\setup.h" />
|
<ClInclude Include="Specific\setup.h" />
|
||||||
<ClInclude Include="Specific\winmain.h" />
|
<ClInclude Include="Specific\winmain.h" />
|
||||||
|
@ -627,7 +626,6 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts"</Command>
|
||||||
<ClCompile Include="Specific\IO\ChunkReader.cpp" />
|
<ClCompile Include="Specific\IO\ChunkReader.cpp" />
|
||||||
<ClCompile Include="Specific\IO\Streams.cpp" />
|
<ClCompile Include="Specific\IO\Streams.cpp" />
|
||||||
<ClCompile Include="Specific\level.cpp" />
|
<ClCompile Include="Specific\level.cpp" />
|
||||||
<ClCompile Include="Specific\levelloader.cpp" />
|
|
||||||
<ClCompile Include="Specific\setup.cpp" />
|
<ClCompile Include="Specific\setup.cpp" />
|
||||||
<ClCompile Include="Specific\winmain.cpp" />
|
<ClCompile Include="Specific\winmain.cpp" />
|
||||||
<ClCompile Include="Objects\TR5\Object\tr5_genslot.cpp" />
|
<ClCompile Include="Objects\TR5\Object\tr5_genslot.cpp" />
|
||||||
|
|
|
@ -699,9 +699,6 @@
|
||||||
<ClInclude Include="Game\lara_struct.h">
|
<ClInclude Include="Game\lara_struct.h">
|
||||||
<Filter>File di intestazione</Filter>
|
<Filter>File di intestazione</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="Specific\levelloader.h">
|
|
||||||
<Filter>File di intestazione</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Specific\newtypes.h">
|
<ClInclude Include="Specific\newtypes.h">
|
||||||
<Filter>File di intestazione</Filter>
|
<Filter>File di intestazione</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -1424,9 +1421,6 @@
|
||||||
<ClCompile Include="Game\trmath.cpp">
|
<ClCompile Include="Game\trmath.cpp">
|
||||||
<Filter>File di origine</Filter>
|
<Filter>File di origine</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Specific\levelloader.cpp">
|
|
||||||
<Filter>File di origine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Objects\TR5\Light\tr5_light.cpp">
|
<ClCompile Include="Objects\TR5\Light\tr5_light.cpp">
|
||||||
<Filter>File di origine</Filter>
|
<Filter>File di origine</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue