mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-12 05:26:57 +03:00
Merge branch 'master' into renderdatarefactor
# Conflicts: # TR5Main/Renderer/Render11Helper.cpp # TR5Main/Renderer/Renderer11Compatibility.cpp # TR5Main/Renderer/Renderer11Draw.cpp # TR5Main/Renderer/Renderer11Frame.cpp # TR5Main/Renderer/Renderer11Lara.cpp
This commit is contained in:
commit
822ec19f08
40 changed files with 1302 additions and 2676 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -23,6 +23,8 @@
|
||||||
|
|
||||||
struct CAMERA_INFO;
|
struct CAMERA_INFO;
|
||||||
|
|
||||||
|
#include <level.h>
|
||||||
|
|
||||||
namespace T5M::Renderer
|
namespace T5M::Renderer
|
||||||
{
|
{
|
||||||
#define MESH_BITS(x) (1 << x)
|
#define MESH_BITS(x) (1 << x)
|
||||||
|
@ -32,7 +34,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;
|
||||||
|
@ -60,6 +62,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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -481,7 +484,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;
|
||||||
|
@ -531,7 +534,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);
|
||||||
|
@ -665,7 +668,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();
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,13 @@
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
#include "control.h"
|
#include "control.h"
|
||||||
#include "objects.h"
|
#include "objects.h"
|
||||||
using std::vector;
|
|
||||||
using std::stack;
|
|
||||||
using std::optional;
|
using std::optional;
|
||||||
namespace T5M::Renderer {
|
using std::stack;
|
||||||
bool Renderer11::PrepareDataForTheRenderer() {
|
using std::vector;
|
||||||
|
namespace T5M::Renderer
|
||||||
|
{
|
||||||
|
bool Renderer11::PrepareDataForTheRenderer()
|
||||||
|
{
|
||||||
m_moveableObjects.resize(ID_NUMBER_OBJECTS);
|
m_moveableObjects.resize(ID_NUMBER_OBJECTS);
|
||||||
m_spriteSequences.resize(ID_NUMBER_OBJECTS);
|
m_spriteSequences.resize(ID_NUMBER_OBJECTS);
|
||||||
m_staticObjects.resize(MAX_STATICS);
|
m_staticObjects.resize(MAX_STATICS);
|
||||||
|
@ -19,7 +21,7 @@ namespace T5M::Renderer {
|
||||||
|
|
||||||
// Step 0: prepare animated textures
|
// Step 0: prepare animated textures
|
||||||
short numSets = *AnimTextureRanges;
|
short numSets = *AnimTextureRanges;
|
||||||
short* animatedPtr = AnimTextureRanges;
|
short *animatedPtr = AnimTextureRanges;
|
||||||
animatedPtr++;
|
animatedPtr++;
|
||||||
|
|
||||||
m_animatedTextureSets = vector<RendererAnimatedTextureSet>(NUM_ANIMATED_SETS);
|
m_animatedTextureSets = vector<RendererAnimatedTextureSet>(NUM_ANIMATED_SETS);
|
||||||
|
@ -28,7 +30,7 @@ namespace T5M::Renderer {
|
||||||
for (int i = 0; i < numSets; i++)
|
for (int i = 0; i < numSets; i++)
|
||||||
{
|
{
|
||||||
m_animatedTextureSets[i] = RendererAnimatedTextureSet();
|
m_animatedTextureSets[i] = RendererAnimatedTextureSet();
|
||||||
RendererAnimatedTextureSet& const set = m_animatedTextureSets[i];
|
RendererAnimatedTextureSet &const set = m_animatedTextureSets[i];
|
||||||
short numTextures = *animatedPtr + 1;
|
short numTextures = *animatedPtr + 1;
|
||||||
animatedPtr++;
|
animatedPtr++;
|
||||||
|
|
||||||
|
@ -40,10 +42,10 @@ namespace T5M::Renderer {
|
||||||
short textureId = *animatedPtr;
|
short textureId = *animatedPtr;
|
||||||
animatedPtr++;
|
animatedPtr++;
|
||||||
|
|
||||||
OBJECT_TEXTURE* texture = &ObjectTextures[textureId];
|
OBJECT_TEXTURE *texture = &ObjectTextures[textureId];
|
||||||
int tile = texture->tileAndFlag & 0x7FFF;
|
int tile = texture->tileAndFlag & 0x7FFF;
|
||||||
set.Textures[j] = RendererAnimatedTexture();
|
set.Textures[j] = RendererAnimatedTexture();
|
||||||
RendererAnimatedTexture& const newTexture = set.Textures[j];
|
RendererAnimatedTexture &const newTexture = set.Textures[j];
|
||||||
newTexture.Id = textureId;
|
newTexture.Id = textureId;
|
||||||
|
|
||||||
for (int k = 0; k < 4; k++)
|
for (int k = 0; k < 4; k++)
|
||||||
|
@ -53,7 +55,6 @@ namespace T5M::Renderer {
|
||||||
|
|
||||||
newTexture.UV[k] = Vector2(x, y);
|
newTexture.UV[k] = Vector2(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,34 +100,37 @@ namespace T5M::Renderer {
|
||||||
if (m_skyTexture == NULL)
|
if (m_skyTexture == NULL)
|
||||||
return false;*/
|
return false;*/
|
||||||
|
|
||||||
//D3DX11SaveTextureToFileA(m_context, m_skyTexture->Texture, D3DX11_IFF_PNG, "H:\\sky.png");
|
//D3DX11SaveTextureToFileA(m_context, m_skyTexture->Texture, D3DX11_IFF_PNG, "H:\\sky.png");
|
||||||
|
|
||||||
//free(buffer);
|
//free(buffer);
|
||||||
|
|
||||||
// Upload textures to GPU memory
|
// Upload textures to GPU memory
|
||||||
for (int i = 0; i < RoomTextures.size(); i++) {
|
for (int i = 0; i < RoomTextures.size(); i++)
|
||||||
TEXTURE* texture = &RoomTextures[i];
|
{
|
||||||
|
TEXTURE *texture = &RoomTextures[i];
|
||||||
m_roomTextures.push_back(Texture2D(m_device, texture->data.data(), texture->size));
|
m_roomTextures.push_back(Texture2D(m_device, texture->data.data(), texture->size));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < MoveablesTextures.size(); i++) {
|
for (int i = 0; i < MoveablesTextures.size(); i++)
|
||||||
TEXTURE* texture = &MoveablesTextures[i];
|
{
|
||||||
|
TEXTURE *texture = &MoveablesTextures[i];
|
||||||
m_moveablesTextures.push_back(Texture2D(m_device, texture->data.data(), texture->size));
|
m_moveablesTextures.push_back(Texture2D(m_device, texture->data.data(), texture->size));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < StaticsTextures.size(); i++) {
|
for (int i = 0; i < StaticsTextures.size(); i++)
|
||||||
TEXTURE* texture = &StaticsTextures[i];
|
{
|
||||||
|
TEXTURE *texture = &StaticsTextures[i];
|
||||||
m_staticsTextures.push_back(Texture2D(m_device, texture->data.data(), texture->size));
|
m_staticsTextures.push_back(Texture2D(m_device, texture->data.data(), texture->size));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < SpritesTextures.size(); i++) {
|
for (int i = 0; i < SpritesTextures.size(); i++)
|
||||||
TEXTURE* texture = &SpritesTextures[i];
|
{
|
||||||
|
TEXTURE *texture = &SpritesTextures[i];
|
||||||
m_spritesTextures.push_back(Texture2D(m_device, texture->data.data(), texture->size));
|
m_spritesTextures.push_back(Texture2D(m_device, texture->data.data(), texture->size));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_skyTexture = Texture2D(m_device, MiscTextures.data.data(), MiscTextures.size);
|
m_skyTexture = Texture2D(m_device, MiscTextures.data.data(), MiscTextures.size);
|
||||||
|
|
||||||
|
|
||||||
// Step 2: prepare rooms
|
// Step 2: prepare rooms
|
||||||
vector<RendererVertex> roomVertices;
|
vector<RendererVertex> roomVertices;
|
||||||
vector<int> roomIndices;
|
vector<int> roomIndices;
|
||||||
|
@ -136,10 +140,10 @@ namespace T5M::Renderer {
|
||||||
|
|
||||||
for (int i = 0; i < Rooms.size(); i++)
|
for (int i = 0; i < Rooms.size(); i++)
|
||||||
{
|
{
|
||||||
ROOM_INFO* room = &Rooms[i];
|
ROOM_INFO *room = &Rooms[i];
|
||||||
|
|
||||||
m_rooms[i] = RendererRoom();
|
m_rooms[i] = RendererRoom();
|
||||||
RendererRoom& r = m_rooms[i];
|
RendererRoom &r = m_rooms[i];
|
||||||
r.RoomNumber = i;
|
r.RoomNumber = i;
|
||||||
r.Room = room;
|
r.Room = room;
|
||||||
r.AmbientLight = Vector4(room->ambient.x, room->ambient.y, room->ambient.z, 1.0f);
|
r.AmbientLight = Vector4(room->ambient.x, room->ambient.y, room->ambient.z, 1.0f);
|
||||||
|
@ -149,12 +153,12 @@ namespace T5M::Renderer {
|
||||||
if (room->vertices.size() == 0)
|
if (room->vertices.size() == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ROOM_VERTEX * vertices = room->vertices.data();
|
ROOM_VERTEX *vertices = room->vertices.data();
|
||||||
|
|
||||||
for (int n = 0; n < room->buckets.size(); n++)
|
for (int n = 0; n < room->buckets.size(); n++)
|
||||||
{
|
{
|
||||||
BUCKET* levelBucket = &room->buckets[n];
|
BUCKET *levelBucket = &room->buckets[n];
|
||||||
RendererBucket* bucket;
|
RendererBucket *bucket;
|
||||||
int bucketIndex;
|
int bucketIndex;
|
||||||
|
|
||||||
if (levelBucket->blendMode != 0)
|
if (levelBucket->blendMode != 0)
|
||||||
|
@ -174,7 +178,7 @@ namespace T5M::Renderer {
|
||||||
for (int v = 0; v < levelBucket->indices.size(); v++)
|
for (int v = 0; v < levelBucket->indices.size(); v++)
|
||||||
{
|
{
|
||||||
int index = levelBucket->indices[v];
|
int index = levelBucket->indices[v];
|
||||||
ROOM_VERTEX* levelVertex = &vertices[index];
|
ROOM_VERTEX *levelVertex = &vertices[index];
|
||||||
|
|
||||||
RendererVertex vertex;
|
RendererVertex vertex;
|
||||||
|
|
||||||
|
@ -207,7 +211,7 @@ namespace T5M::Renderer {
|
||||||
for (int l = 0; l < room->lights.size(); l++)
|
for (int l = 0; l < room->lights.size(); l++)
|
||||||
{
|
{
|
||||||
RendererLight light;
|
RendererLight light;
|
||||||
ROOM_LIGHT* oldLight = &room->lights[l];
|
ROOM_LIGHT *oldLight = &room->lights[l];
|
||||||
|
|
||||||
if (oldLight->type == LIGHT_TYPES::LIGHT_TYPE_SUN)
|
if (oldLight->type == LIGHT_TYPES::LIGHT_TYPE_SUN)
|
||||||
{
|
{
|
||||||
|
@ -262,7 +266,7 @@ namespace T5M::Renderer {
|
||||||
// Merge vertices and indices in a single list
|
// Merge vertices and indices in a single list
|
||||||
for (int j = 0; j < NUM_BUCKETS; j++)
|
for (int j = 0; j < NUM_BUCKETS; j++)
|
||||||
{
|
{
|
||||||
RendererBucket* bucket = &r.Buckets[j];
|
RendererBucket *bucket = &r.Buckets[j];
|
||||||
|
|
||||||
bucket->StartVertex = baseRoomVertex;
|
bucket->StartVertex = baseRoomVertex;
|
||||||
bucket->StartIndex = baseRoomIndex;
|
bucket->StartIndex = baseRoomIndex;
|
||||||
|
@ -292,13 +296,15 @@ namespace T5M::Renderer {
|
||||||
int baseMoveablesIndex = 0;
|
int baseMoveablesIndex = 0;
|
||||||
|
|
||||||
// Step 3: prepare moveables
|
// Step 3: prepare moveables
|
||||||
for (int i = 0; i < MoveablesIds.size(); i++) {
|
for (int i = 0; i < MoveablesIds.size(); i++)
|
||||||
|
{
|
||||||
int objNum = MoveablesIds[i];
|
int objNum = MoveablesIds[i];
|
||||||
ObjectInfo* obj = &Objects[objNum];
|
ObjectInfo *obj = &Objects[objNum];
|
||||||
|
|
||||||
if (obj->nmeshes > 0) {
|
if (obj->nmeshes > 0)
|
||||||
|
{
|
||||||
m_moveableObjects[MoveablesIds[i]] = RendererObject();
|
m_moveableObjects[MoveablesIds[i]] = RendererObject();
|
||||||
RendererObject& moveable = *m_moveableObjects[MoveablesIds[i]];
|
RendererObject &moveable = *m_moveableObjects[MoveablesIds[i]];
|
||||||
moveable.Id = MoveablesIds[i];
|
moveable.Id = MoveablesIds[i];
|
||||||
|
|
||||||
// Assign the draw routine
|
// Assign the draw routine
|
||||||
|
@ -311,99 +317,108 @@ namespace T5M::Renderer {
|
||||||
objNum == ID_CAMERA_TARGET || objNum == ID_WATERFALLMIST || objNum == ID_SMOKE_EMITTER_BLACK ||
|
objNum == ID_CAMERA_TARGET || objNum == ID_WATERFALLMIST || objNum == ID_SMOKE_EMITTER_BLACK ||
|
||||||
objNum == ID_SMOKE_EMITTER_WHITE)
|
objNum == ID_SMOKE_EMITTER_WHITE)
|
||||||
{
|
{
|
||||||
moveable->DoNotDraw = true;
|
moveable.DoNotDraw = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
moveable->DoNotDraw = false;
|
moveable.DoNotDraw = false;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
moveable.DoNotDraw = (obj->drawRoutine == NULL);
|
moveable.DoNotDraw = (obj->drawRoutine == NULL);
|
||||||
|
|
||||||
for (int j = 0; j < obj->nmeshes; j++) {
|
for (int j = 0; j < obj->nmeshes; j++)
|
||||||
|
{
|
||||||
// HACK: mesh pointer 0 is the placeholder for Lara's body parts and is right hand with pistols
|
// HACK: mesh pointer 0 is the placeholder for Lara's body parts and is right hand with pistols
|
||||||
// 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (objNum == ID_IMP_ROCK || objNum == ID_ENERGY_BUBBLES || objNum == ID_BUBBLES || objNum == ID_BODY_PART) {
|
if (objNum == ID_IMP_ROCK || objNum == ID_ENERGY_BUBBLES || objNum == ID_BUBBLES || objNum == ID_BODY_PART)
|
||||||
|
{
|
||||||
// HACK: these objects must have nmeshes = 0 because engine will use them in a different way while drawing Effects.
|
// HACK: these objects must have nmeshes = 0 because engine will use them in a different way while drawing Effects.
|
||||||
// In Core's code this was done in SETUP.C but we must do it here because we need to create renderer's meshes.
|
// In Core's code this was done in SETUP.C but we must do it here because we need to create renderer's meshes.
|
||||||
obj->nmeshes = 0;
|
obj->nmeshes = 0;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
int* bone = &Bones[obj->boneIndex];
|
{
|
||||||
|
for (int j = 0; j < obj->nmeshes; j++)
|
||||||
stack<RendererBone*> stack;
|
{
|
||||||
|
|
||||||
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);
|
{
|
||||||
currentBone->Children.push_back(moveable.LinearizedBones[j]);
|
case 0:
|
||||||
currentBone = moveable.LinearizedBones[j];
|
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;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,34 +432,41 @@ namespace T5M::Renderer {
|
||||||
buildHierarchy(&moveable);
|
buildHierarchy(&moveable);
|
||||||
|
|
||||||
// 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];
|
||||||
|
|
||||||
for (int j = 1; j < obj->nmeshes; j++) {
|
for (int j = 1; j < obj->nmeshes; j++)
|
||||||
RendererMesh* jointMesh = moveable.ObjectMeshes[j];
|
{
|
||||||
RendererBone* jointBone = moveable.LinearizedBones[j];
|
RendererMesh *jointMesh = moveable.ObjectMeshes[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];
|
||||||
|
|
||||||
for (int v1 = 0; v1 < jointBucket->Vertices.size(); v1++) {
|
for (int v1 = 0; v1 < jointBucket->Vertices.size(); v1++)
|
||||||
RendererVertex* jointVertex = &jointBucket->Vertices[v1];
|
{
|
||||||
|
RendererVertex *jointVertex = &jointBucket->Vertices[v1];
|
||||||
|
|
||||||
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]];
|
{
|
||||||
RendererBone* skinBone = objSkin.LinearizedBones[bonesToCheck[k]];
|
RendererMesh *skinMesh = objSkin.ObjectMeshes[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];
|
{
|
||||||
for (int v2 = 0; v2 < skinBucket->Vertices.size(); v2++) {
|
RendererBucket *skinBucket = &skinMesh->Buckets[b2];
|
||||||
RendererVertex* skinVertex = &skinBucket->Vertices[v2];
|
for (int v2 = 0; v2 < skinBucket->Vertices.size(); v2++)
|
||||||
|
{
|
||||||
|
RendererVertex *skinVertex = &skinBucket->Vertices[v2];
|
||||||
|
|
||||||
int x1 = jointBucket->Vertices[v1].Position.x + jointBone->GlobalTranslation.x;
|
int x1 = jointBucket->Vertices[v1].Position.x + jointBone->GlobalTranslation.x;
|
||||||
int y1 = jointBucket->Vertices[v1].Position.y + jointBone->GlobalTranslation.y;
|
int y1 = jointBucket->Vertices[v1].Position.y + jointBone->GlobalTranslation.y;
|
||||||
|
@ -454,12 +476,12 @@ namespace T5M::Renderer {
|
||||||
int y2 = skinBucket->Vertices[v2].Position.y + skinBone->GlobalTranslation.y;
|
int y2 = skinBucket->Vertices[v2].Position.y + skinBone->GlobalTranslation.y;
|
||||||
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->Position.x = skinVertex->Position.x;
|
jointVertex->Bone = BonesToCheck[k];
|
||||||
jointVertex->Position.y = skinVertex->Position.y;
|
jointVertex->Position = skinVertex->Position;
|
||||||
jointVertex->Position.z = skinVertex->Position.z;
|
|
||||||
jointVertex->Normal = skinVertex->Normal;
|
jointVertex->Normal = skinVertex->Normal;
|
||||||
|
|
||||||
done = true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -477,12 +499,15 @@ namespace T5M::Renderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MoveablesIds[i] == ID_LARA_HAIR) {
|
if (MoveablesIds[i] == ID_LARA_HAIR)
|
||||||
for (int j = 0; j < moveable.ObjectMeshes.size(); j++) {
|
{
|
||||||
RendererMesh* mesh = moveable.ObjectMeshes[j];
|
for (int j = 0; j < moveable.ObjectMeshes.size(); j++)
|
||||||
for (int n = 0; n < NUM_BUCKETS; n++) {
|
{
|
||||||
|
RendererMesh *mesh = moveable.ObjectMeshes[j];
|
||||||
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,13 +522,14 @@ namespace T5M::Renderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Merge vertices and indices in a single list
|
// Merge vertices and indices in a single list
|
||||||
for (int m = 0; m < moveable.ObjectMeshes.size(); m++) {
|
for (int m = 0; m < moveable.ObjectMeshes.size(); m++)
|
||||||
RendererMesh* msh = moveable.ObjectMeshes[m];
|
{
|
||||||
|
RendererMesh *msh = moveable.ObjectMeshes[m];
|
||||||
|
|
||||||
for (int j = 0; j < NUM_BUCKETS; j++) {
|
for (int j = 0; j < NUM_BUCKETS; j++)
|
||||||
RendererBucket* bucket = &msh->Buckets[j];
|
{
|
||||||
|
RendererBucket *bucket = &msh->Buckets[j];
|
||||||
|
|
||||||
bucket->StartVertex = baseMoveablesVertex;
|
bucket->StartVertex = baseMoveablesVertex;
|
||||||
bucket->StartIndex = baseMoveablesIndex;
|
bucket->StartIndex = baseMoveablesIndex;
|
||||||
|
@ -531,24 +557,25 @@ namespace T5M::Renderer {
|
||||||
int baseStaticsVertex = 0;
|
int baseStaticsVertex = 0;
|
||||||
int baseStaticsIndex = 0;
|
int baseStaticsIndex = 0;
|
||||||
|
|
||||||
for (int i = 0; i < StaticObjectsIds.size(); i++) {
|
for (int i = 0; i < StaticObjectsIds.size(); i++)
|
||||||
StaticInfo* obj = &StaticObjects[StaticObjectsIds[i]];
|
{
|
||||||
|
StaticInfo *obj = &StaticObjects[StaticObjectsIds[i]];
|
||||||
m_staticObjects[StaticObjectsIds[i]] = RendererObject();
|
m_staticObjects[StaticObjectsIds[i]] = RendererObject();
|
||||||
RendererObject& staticObject = *m_staticObjects[StaticObjectsIds[i]];
|
RendererObject &staticObject = *m_staticObjects[StaticObjectsIds[i]];
|
||||||
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);
|
||||||
|
|
||||||
m_staticObjects[StaticObjectsIds[i]] = staticObject;
|
m_staticObjects[StaticObjectsIds[i]] = staticObject;
|
||||||
|
|
||||||
// Merge vertices and indices in a single list
|
// Merge vertices and indices in a single list
|
||||||
RendererMesh* msh = staticObject.ObjectMeshes[0];
|
RendererMesh *msh = staticObject.ObjectMeshes[0];
|
||||||
|
|
||||||
for (int j = 0; j < NUM_BUCKETS; j++) {
|
for (int j = 0; j < NUM_BUCKETS; j++)
|
||||||
RendererBucket* bucket = &msh->Buckets[j];
|
{
|
||||||
|
RendererBucket *bucket = &msh->Buckets[j];
|
||||||
|
|
||||||
bucket->StartVertex = baseStaticsVertex;
|
bucket->StartVertex = baseStaticsVertex;
|
||||||
bucket->StartIndex = baseStaticsIndex;
|
bucket->StartIndex = baseStaticsIndex;
|
||||||
|
@ -571,30 +598,32 @@ namespace T5M::Renderer {
|
||||||
// Step 5: prepare sprites
|
// Step 5: prepare sprites
|
||||||
m_sprites.resize(g_NumSprites);
|
m_sprites.resize(g_NumSprites);
|
||||||
|
|
||||||
for (int i = 0; i < g_NumSprites; i++) {
|
for (int i = 0; i < g_NumSprites; i++)
|
||||||
SPRITE* oldSprite = &Sprites[i];
|
{
|
||||||
|
SPRITE *oldSprite = &Sprites[i];
|
||||||
m_sprites[i] = RendererSprite();
|
m_sprites[i] = RendererSprite();
|
||||||
RendererSprite& sprite = m_sprites[i];
|
RendererSprite &sprite = m_sprites[i];
|
||||||
|
|
||||||
sprite.UV[0] = Vector2(oldSprite->x1, oldSprite->y1);
|
sprite.UV[0] = Vector2(oldSprite->x1, oldSprite->y1);
|
||||||
sprite.UV[1] = Vector2(oldSprite->x2, oldSprite->y2);
|
sprite.UV[1] = Vector2(oldSprite->x2, oldSprite->y2);
|
||||||
sprite.UV[2] = Vector2(oldSprite->x3, oldSprite->y3);
|
sprite.UV[2] = Vector2(oldSprite->x3, oldSprite->y3);
|
||||||
sprite.UV[3] = Vector2(oldSprite->x4, oldSprite->y4);
|
sprite.UV[3] = Vector2(oldSprite->x4, oldSprite->y4);
|
||||||
sprite.Texture = &m_spritesTextures[oldSprite->tile];
|
sprite.Texture = &m_spritesTextures[oldSprite->tile];
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < MoveablesIds.size(); i++) {
|
|
||||||
ObjectInfo* obj = &Objects[MoveablesIds[i]];
|
|
||||||
|
|
||||||
if (obj->nmeshes < 0) {
|
for (int i = 0; i < MoveablesIds.size(); i++)
|
||||||
|
{
|
||||||
|
ObjectInfo *obj = &Objects[MoveablesIds[i]];
|
||||||
|
|
||||||
|
if (obj->nmeshes < 0)
|
||||||
|
{
|
||||||
short numSprites = abs(obj->nmeshes);
|
short numSprites = abs(obj->nmeshes);
|
||||||
short baseSprite = obj->meshIndex;
|
short baseSprite = obj->meshIndex;
|
||||||
m_spriteSequences[MoveablesIds[i]] = RendererSpriteSequence(MoveablesIds[i], numSprites);
|
m_spriteSequences[MoveablesIds[i]] = RendererSpriteSequence(MoveablesIds[i], numSprites);
|
||||||
RendererSpriteSequence& sequence = m_spriteSequences[MoveablesIds[i]];
|
RendererSpriteSequence &sequence = m_spriteSequences[MoveablesIds[i]];
|
||||||
|
|
||||||
for (int j = baseSprite; j < baseSprite + numSprites; j++) {
|
for (int j = baseSprite; j < baseSprite + numSprites; j++)
|
||||||
|
{
|
||||||
sequence.SpritesList[j - baseSprite] = &m_sprites[j];
|
sequence.SpritesList[j - baseSprite] = &m_sprites[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -602,10 +631,12 @@ namespace T5M::Renderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++)
|
||||||
if (Objects[ID_WATERFALL1 + i].loaded) {
|
{
|
||||||
|
if (Objects[ID_WATERFALL1 + i].loaded)
|
||||||
|
{
|
||||||
// Get the first textured bucket
|
// Get the first textured bucket
|
||||||
RendererBucket* bucket = NULL;
|
RendererBucket *bucket = NULL;
|
||||||
for (int j = 0; j < NUM_BUCKETS; j++)
|
for (int j = 0; j < NUM_BUCKETS; j++)
|
||||||
if (m_moveableObjects[ID_WATERFALL1 + i]->ObjectMeshes[0]->Buckets[j].Polygons.size() > 0)
|
if (m_moveableObjects[ID_WATERFALL1 + i]->ObjectMeshes[0]->Buckets[j].Polygons.size() > 0)
|
||||||
bucket = &m_moveableObjects[ID_WATERFALL1 + i]->ObjectMeshes[0]->Buckets[j];
|
bucket = &m_moveableObjects[ID_WATERFALL1 + i]->ObjectMeshes[0]->Buckets[j];
|
||||||
|
@ -613,7 +644,7 @@ namespace T5M::Renderer {
|
||||||
if (bucket == NULL)
|
if (bucket == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
OBJECT_TEXTURE * texture = &ObjectTextures[bucket->Polygons[0].TextureId];
|
OBJECT_TEXTURE *texture = &ObjectTextures[bucket->Polygons[0].TextureId];
|
||||||
WaterfallTextures[i] = texture;
|
WaterfallTextures[i] = texture;
|
||||||
WaterfallY[i] = texture->vertices[0].y;
|
WaterfallY[i] = texture->vertices[0].y;
|
||||||
}
|
}
|
||||||
|
@ -621,4 +652,4 @@ namespace T5M::Renderer {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
} // namespace T5M::Renderer
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -558,7 +558,7 @@ namespace T5M::Renderer {
|
||||||
updateConstantBuffer<CItemBuffer>(m_cbItem, m_stItem);
|
updateConstantBuffer<CItemBuffer>(m_cbItem, m_stItem);
|
||||||
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++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,7 +571,7 @@ namespace T5M::Renderer {
|
||||||
updateConstantBuffer<CItemBuffer>(m_cbItem, m_stItem);
|
updateConstantBuffer<CItemBuffer>(m_cbItem, m_stItem);
|
||||||
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++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -646,7 +646,7 @@ namespace T5M::Renderer {
|
||||||
updateConstantBuffer<CItemBuffer>(m_cbItem, m_stItem);
|
updateConstantBuffer<CItemBuffer>(m_cbItem, m_stItem);
|
||||||
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++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -909,7 +909,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++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,35 +7,41 @@
|
||||||
#include "level.h"
|
#include "level.h"
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
#include "RenderView\RenderView.h"
|
#include "RenderView\RenderView.h"
|
||||||
namespace T5M::Renderer {
|
namespace T5M::Renderer
|
||||||
|
{
|
||||||
using namespace T5M::Renderer;
|
using namespace T5M::Renderer;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
void Renderer11::collectRooms(RenderView& renderView) {
|
void Renderer11::collectRooms(RenderView &renderView)
|
||||||
|
{
|
||||||
short baseRoomIndex = renderView.camera.RoomNumber;
|
short baseRoomIndex = renderView.camera.RoomNumber;
|
||||||
|
|
||||||
for (int i = 0; i < Rooms.size(); i++) {
|
for (int i = 0; i < Rooms.size(); i++)
|
||||||
|
{
|
||||||
m_rooms[i].Visited = false;
|
m_rooms[i].Visited = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector4 vp = Vector4(-1.0f, -1.0f, 1.0f, 1.0f);
|
Vector4 vp = Vector4(-1.0f, -1.0f, 1.0f, 1.0f);
|
||||||
vector<RendererRoom*> collectedRooms;
|
vector<RendererRoom *> collectedRooms;
|
||||||
collectedRooms.reserve(128);
|
collectedRooms.reserve(128);
|
||||||
getVisibleObjects(-1, baseRoomIndex, &vp, false, 0,renderView);
|
getVisibleObjects(-1, baseRoomIndex, &vp, false, 0, renderView);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer11::collectItems(short roomNumber,RenderView& renderView) {
|
void Renderer11::collectItems(short roomNumber, RenderView &renderView)
|
||||||
if (m_rooms.size() <= roomNumber) {
|
{
|
||||||
|
if (m_rooms.size() <= roomNumber)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RendererRoom& const room = m_rooms[roomNumber];
|
RendererRoom &const room = m_rooms[roomNumber];
|
||||||
|
|
||||||
ROOM_INFO* r = room.Room;
|
ROOM_INFO *r = room.Room;
|
||||||
|
|
||||||
short itemNum = NO_ITEM;
|
short itemNum = NO_ITEM;
|
||||||
for (itemNum = r->itemNumber; itemNum != NO_ITEM; itemNum = Items[itemNum].nextItem) {
|
for (itemNum = r->itemNumber; itemNum != NO_ITEM; itemNum = Items[itemNum].nextItem)
|
||||||
|
{
|
||||||
//printf("ItemNum: %d, NextItem: %d\n", itemNum, Items[itemNum].nextItem);
|
//printf("ItemNum: %d, NextItem: %d\n", itemNum, Items[itemNum].nextItem);
|
||||||
|
|
||||||
ITEM_INFO* item = &Items[itemNum];
|
ITEM_INFO *item = &Items[itemNum];
|
||||||
|
|
||||||
if (item->objectNumber == ID_LARA && itemNum == Items[itemNum].nextItem)
|
if (item->objectNumber == ID_LARA && itemNum == Items[itemNum].nextItem)
|
||||||
break;
|
break;
|
||||||
|
@ -48,8 +54,8 @@ namespace T5M::Renderer {
|
||||||
|
|
||||||
if (!m_moveableObjects[item->objectNumber].has_value())
|
if (!m_moveableObjects[item->objectNumber].has_value())
|
||||||
continue;
|
continue;
|
||||||
RendererItem* newItem = &m_items[itemNum];
|
RendererItem *newItem = &m_items[itemNum];
|
||||||
short* bounds = GetBoundsAccurate(item);
|
short *bounds = GetBoundsAccurate(item);
|
||||||
Vector3 min = (Vector3(bounds[0], bounds[2], bounds[4])) + Vector3(item->pos.xPos, item->pos.yPos, item->pos.zPos);
|
Vector3 min = (Vector3(bounds[0], bounds[2], bounds[4])) + Vector3(item->pos.xPos, item->pos.yPos, item->pos.zPos);
|
||||||
Vector3 max = (Vector3(bounds[1], bounds[3], bounds[5])) + Vector3(item->pos.xPos, item->pos.yPos, item->pos.zPos);
|
Vector3 max = (Vector3(bounds[1], bounds[3], bounds[5])) + Vector3(item->pos.xPos, item->pos.yPos, item->pos.zPos);
|
||||||
if (!renderView.camera.frustum.AABBInFrustum(min, max))
|
if (!renderView.camera.frustum.AABBInFrustum(min, max))
|
||||||
|
@ -63,24 +69,27 @@ namespace T5M::Renderer {
|
||||||
TO_RAD(item->pos.zRot));
|
TO_RAD(item->pos.zRot));
|
||||||
newItem->Scale = Matrix::CreateScale(1.0f);
|
newItem->Scale = Matrix::CreateScale(1.0f);
|
||||||
newItem->World = newItem->Rotation * newItem->Translation;
|
newItem->World = newItem->Rotation * newItem->Translation;
|
||||||
collectLightsForItem(item->roomNumber, newItem,renderView);
|
collectLightsForItem(item->roomNumber, newItem, renderView);
|
||||||
renderView.itemsToDraw.push_back(newItem);
|
renderView.itemsToDraw.push_back(newItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer11::collectStatics(short roomNumber, RenderView& renderView) {
|
void Renderer11::collectStatics(short roomNumber, RenderView &renderView)
|
||||||
if (m_rooms.size() <= roomNumber) {
|
{
|
||||||
|
if (m_rooms.size() <= roomNumber)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RendererRoom& const room = m_rooms[roomNumber];
|
RendererRoom &const room = m_rooms[roomNumber];
|
||||||
ROOM_INFO* r = room.Room;
|
ROOM_INFO *r = room.Room;
|
||||||
if (r->mesh.size() <= 0)
|
if (r->mesh.size() <= 0)
|
||||||
return;
|
return;
|
||||||
int numStatics = r->mesh.size();
|
int numStatics = r->mesh.size();
|
||||||
for (int i = 0; i < numStatics; i++) {
|
for (int i = 0; i < numStatics; i++)
|
||||||
MESH_INFO* mesh = &r->mesh[i];
|
{
|
||||||
RendererStatic* newStatic = &room.Statics[i];
|
MESH_INFO *mesh = &r->mesh[i];
|
||||||
StaticInfo* staticInfo = &StaticObjects[mesh->staticNumber];
|
RendererStatic *newStatic = &room.Statics[i];
|
||||||
|
StaticInfo *staticInfo = &StaticObjects[mesh->staticNumber];
|
||||||
Vector3 min = Vector3(staticInfo->xMinc, staticInfo->yMinc, staticInfo->zMinc);
|
Vector3 min = Vector3(staticInfo->xMinc, staticInfo->yMinc, staticInfo->zMinc);
|
||||||
Vector3 max = Vector3(staticInfo->xMaxc, staticInfo->yMaxc, staticInfo->zMaxc);
|
Vector3 max = Vector3(staticInfo->xMaxc, staticInfo->yMaxc, staticInfo->zMaxc);
|
||||||
min += Vector3(mesh->x, mesh->y, mesh->z);
|
min += Vector3(mesh->x, mesh->y, mesh->z);
|
||||||
|
@ -96,14 +105,16 @@ namespace T5M::Renderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer11::collectLightsForEffect(short roomNumber, RendererEffect* effect, RenderView& renderView) {
|
void Renderer11::collectLightsForEffect(short roomNumber, RendererEffect *effect, RenderView &renderView)
|
||||||
|
{
|
||||||
effect->Lights.clear();
|
effect->Lights.clear();
|
||||||
if (m_rooms.size() <= roomNumber) {
|
if (m_rooms.size() <= roomNumber)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RendererRoom& const room = m_rooms[roomNumber];
|
RendererRoom &const room = m_rooms[roomNumber];
|
||||||
|
|
||||||
ROOM_INFO* r = room.Room;
|
ROOM_INFO *r = room.Room;
|
||||||
|
|
||||||
if (r->lights.size() <= 0)
|
if (r->lights.size() <= 0)
|
||||||
return;
|
return;
|
||||||
|
@ -113,8 +124,9 @@ namespace T5M::Renderer {
|
||||||
Vector3 itemPosition = Vector3(effect->Effect->pos.xPos, effect->Effect->pos.yPos, effect->Effect->pos.zPos);
|
Vector3 itemPosition = Vector3(effect->Effect->pos.xPos, effect->Effect->pos.yPos, effect->Effect->pos.zPos);
|
||||||
|
|
||||||
// Dynamic lights have the priority
|
// Dynamic lights have the priority
|
||||||
for (int i = 0; i < m_dynamicLights.size(); i++) {
|
for (int i = 0; i < m_dynamicLights.size(); i++)
|
||||||
RendererLight* light = m_dynamicLights[i];
|
{
|
||||||
|
RendererLight *light = m_dynamicLights[i];
|
||||||
|
|
||||||
Vector3 lightPosition = Vector3(light->Position.x, light->Position.y, light->Position.z);
|
Vector3 lightPosition = Vector3(light->Position.x, light->Position.y, light->Position.z);
|
||||||
|
|
||||||
|
@ -128,16 +140,20 @@ namespace T5M::Renderer {
|
||||||
int numLights = room.Lights.size();
|
int numLights = room.Lights.size();
|
||||||
|
|
||||||
m_shadowLight = NULL;
|
m_shadowLight = NULL;
|
||||||
RendererLight* brightestLight = NULL;
|
RendererLight *brightestLight = NULL;
|
||||||
float brightest = 0.0f;
|
float brightest = 0.0f;
|
||||||
|
|
||||||
for (int j = 0; j < numLights; j++) {
|
for (int j = 0; j < numLights; j++)
|
||||||
RendererLight* light = &room.Lights[j];
|
{
|
||||||
|
RendererLight *light = &room.Lights[j];
|
||||||
|
|
||||||
// Check only lights different from sun
|
// Check only lights different from sun
|
||||||
if (light->Type == LIGHT_TYPE_SUN) {
|
if (light->Type == LIGHT_TYPE_SUN)
|
||||||
|
{
|
||||||
// Sun is added without checks
|
// Sun is added without checks
|
||||||
} else if (light->Type == LIGHT_TYPE_POINT || light->Type == LIGHT_TYPE_SHADOW) {
|
}
|
||||||
|
else if (light->Type == LIGHT_TYPE_POINT || light->Type == LIGHT_TYPE_SHADOW)
|
||||||
|
{
|
||||||
Vector3 lightPosition = Vector3(light->Position.x, light->Position.y, light->Position.z);
|
Vector3 lightPosition = Vector3(light->Position.x, light->Position.y, light->Position.z);
|
||||||
|
|
||||||
float distance = (itemPosition - lightPosition).Length();
|
float distance = (itemPosition - lightPosition).Length();
|
||||||
|
@ -151,16 +167,20 @@ namespace T5M::Renderer {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// If Lara, try to collect shadow casting light
|
// If Lara, try to collect shadow casting light
|
||||||
if (effect->Effect->objectNumber == ID_LARA) {
|
if (effect->Effect->objectNumber == ID_LARA)
|
||||||
|
{
|
||||||
float attenuation = 1.0f - distance / light->Out;
|
float attenuation = 1.0f - distance / light->Out;
|
||||||
float intensity = max(0.0f, attenuation * (light->Color.x + light->Color.y + light->Color.z) / 3.0f);
|
float intensity = max(0.0f, attenuation * (light->Color.x + light->Color.y + light->Color.z) / 3.0f);
|
||||||
|
|
||||||
if (intensity >= brightest) {
|
if (intensity >= brightest)
|
||||||
|
{
|
||||||
brightest = intensity;
|
brightest = intensity;
|
||||||
brightestLight = light;
|
brightestLight = light;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (light->Type == LIGHT_TYPE_SPOT) {
|
}
|
||||||
|
else if (light->Type == LIGHT_TYPE_SPOT)
|
||||||
|
{
|
||||||
Vector3 lightPosition = Vector3(light->Position.x, light->Position.y, light->Position.z);
|
Vector3 lightPosition = Vector3(light->Position.x, light->Position.y, light->Position.z);
|
||||||
|
|
||||||
float distance = (itemPosition - lightPosition).Length();
|
float distance = (itemPosition - lightPosition).Length();
|
||||||
|
@ -172,7 +192,9 @@ namespace T5M::Renderer {
|
||||||
// Check the range
|
// Check the range
|
||||||
if (distance > light->Range)
|
if (distance > light->Range)
|
||||||
continue;
|
continue;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Invalid light type
|
// Invalid light type
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -180,19 +202,22 @@ namespace T5M::Renderer {
|
||||||
m_tempItemLights.push_back(light);
|
m_tempItemLights.push_back(light);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < min(MAX_LIGHTS_PER_ITEM, m_tempItemLights.size()); i++) {
|
for (int i = 0; i < min(MAX_LIGHTS_PER_ITEM, m_tempItemLights.size()); i++)
|
||||||
|
{
|
||||||
renderView.lightsToDraw.push_back(m_tempItemLights[i]);
|
renderView.lightsToDraw.push_back(m_tempItemLights[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer11::collectLightsForItem(short roomNumber, RendererItem* item,RenderView& renderView) {
|
void Renderer11::collectLightsForItem(short roomNumber, RendererItem *item, RenderView &renderView)
|
||||||
|
{
|
||||||
item->Lights.clear();
|
item->Lights.clear();
|
||||||
if (m_rooms.size() <= roomNumber) {
|
if (m_rooms.size() <= roomNumber)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RendererRoom& const room = m_rooms[roomNumber];
|
RendererRoom &const room = m_rooms[roomNumber];
|
||||||
|
|
||||||
ROOM_INFO* r = room.Room;
|
ROOM_INFO *r = room.Room;
|
||||||
|
|
||||||
if (r->lights.size() <= 0)
|
if (r->lights.size() <= 0)
|
||||||
return;
|
return;
|
||||||
|
@ -202,8 +227,9 @@ namespace T5M::Renderer {
|
||||||
Vector3 itemPosition = Vector3(item->Item->pos.xPos, item->Item->pos.yPos, item->Item->pos.zPos);
|
Vector3 itemPosition = Vector3(item->Item->pos.xPos, item->Item->pos.yPos, item->Item->pos.zPos);
|
||||||
|
|
||||||
// Dynamic lights have the priority
|
// Dynamic lights have the priority
|
||||||
for (int i = 0; i < m_dynamicLights.size(); i++) {
|
for (int i = 0; i < m_dynamicLights.size(); i++)
|
||||||
RendererLight* light = m_dynamicLights[i];
|
{
|
||||||
|
RendererLight *light = m_dynamicLights[i];
|
||||||
|
|
||||||
Vector3 lightPosition = Vector3(light->Position.x, light->Position.y, light->Position.z);
|
Vector3 lightPosition = Vector3(light->Position.x, light->Position.y, light->Position.z);
|
||||||
|
|
||||||
|
@ -217,16 +243,20 @@ namespace T5M::Renderer {
|
||||||
int numLights = room.Lights.size();
|
int numLights = room.Lights.size();
|
||||||
|
|
||||||
m_shadowLight = NULL;
|
m_shadowLight = NULL;
|
||||||
RendererLight* brightestLight = NULL;
|
RendererLight *brightestLight = NULL;
|
||||||
float brightest = 0.0f;
|
float brightest = 0.0f;
|
||||||
|
|
||||||
for (int j = 0; j < numLights; j++) {
|
for (int j = 0; j < numLights; j++)
|
||||||
RendererLight* light = &room.Lights[j];
|
{
|
||||||
|
RendererLight *light = &room.Lights[j];
|
||||||
|
|
||||||
// Check only lights different from sun
|
// Check only lights different from sun
|
||||||
if (light->Type == LIGHT_TYPE_SUN) {
|
if (light->Type == LIGHT_TYPE_SUN)
|
||||||
|
{
|
||||||
// Sun is added without checks
|
// Sun is added without checks
|
||||||
} else if (light->Type == LIGHT_TYPE_POINT || light->Type == LIGHT_TYPE_SHADOW) {
|
}
|
||||||
|
else if (light->Type == LIGHT_TYPE_POINT || light->Type == LIGHT_TYPE_SHADOW)
|
||||||
|
{
|
||||||
Vector3 lightPosition = Vector3(light->Position.x, light->Position.y, light->Position.z);
|
Vector3 lightPosition = Vector3(light->Position.x, light->Position.y, light->Position.z);
|
||||||
|
|
||||||
float distance = (itemPosition - lightPosition).Length();
|
float distance = (itemPosition - lightPosition).Length();
|
||||||
|
@ -240,16 +270,20 @@ namespace T5M::Renderer {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// If Lara, try to collect shadow casting light
|
// If Lara, try to collect shadow casting light
|
||||||
if (item->Item->objectNumber == ID_LARA) {
|
if (item->Item->objectNumber == ID_LARA)
|
||||||
|
{
|
||||||
float attenuation = 1.0f - distance / light->Out;
|
float attenuation = 1.0f - distance / light->Out;
|
||||||
float intensity = max(0.0f, attenuation * (light->Color.x + light->Color.y + light->Color.z) / 3.0f);
|
float intensity = max(0.0f, attenuation * (light->Color.x + light->Color.y + light->Color.z) / 3.0f);
|
||||||
|
|
||||||
if (intensity >= brightest) {
|
if (intensity >= brightest)
|
||||||
|
{
|
||||||
brightest = intensity;
|
brightest = intensity;
|
||||||
brightestLight = light;
|
brightestLight = light;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (light->Type == LIGHT_TYPE_SPOT) {
|
}
|
||||||
|
else if (light->Type == LIGHT_TYPE_SPOT)
|
||||||
|
{
|
||||||
Vector3 lightPosition = Vector3(light->Position.x, light->Position.y, light->Position.z);
|
Vector3 lightPosition = Vector3(light->Position.x, light->Position.y, light->Position.z);
|
||||||
|
|
||||||
float distance = (itemPosition - lightPosition).Length();
|
float distance = (itemPosition - lightPosition).Length();
|
||||||
|
@ -263,16 +297,20 @@ namespace T5M::Renderer {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// If Lara, try to collect shadow casting light
|
// If Lara, try to collect shadow casting light
|
||||||
if (item->Item->objectNumber == ID_LARA) {
|
if (item->Item->objectNumber == ID_LARA)
|
||||||
|
{
|
||||||
float attenuation = 1.0f - distance / light->Range;
|
float attenuation = 1.0f - distance / light->Range;
|
||||||
float intensity = max(0.0f, attenuation * (light->Color.x + light->Color.y + light->Color.z) / 3.0f);
|
float intensity = max(0.0f, attenuation * (light->Color.x + light->Color.y + light->Color.z) / 3.0f);
|
||||||
|
|
||||||
if (intensity >= brightest) {
|
if (intensity >= brightest)
|
||||||
|
{
|
||||||
brightest = intensity;
|
brightest = intensity;
|
||||||
brightestLight = light;
|
brightestLight = light;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Invalid light type
|
// Invalid light type
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -280,27 +318,32 @@ namespace T5M::Renderer {
|
||||||
m_tempItemLights.push_back(light);
|
m_tempItemLights.push_back(light);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < min(MAX_LIGHTS_PER_ITEM, m_tempItemLights.size()); i++) {
|
for (int i = 0; i < min(MAX_LIGHTS_PER_ITEM, m_tempItemLights.size()); i++)
|
||||||
|
{
|
||||||
item->Lights.push_back(m_tempItemLights[i]);
|
item->Lights.push_back(m_tempItemLights[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->Item->objectNumber == ID_LARA) {
|
if (item->Item->objectNumber == ID_LARA)
|
||||||
|
{
|
||||||
m_shadowLight = brightestLight;
|
m_shadowLight = brightestLight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer11::collectLightsForRoom(short roomNumber,RenderView& renderView) {
|
void Renderer11::collectLightsForRoom(short roomNumber, RenderView &renderView)
|
||||||
if (m_rooms.size() <= roomNumber) {
|
{
|
||||||
|
if (m_rooms.size() <= roomNumber)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RendererRoom& const room = m_rooms[roomNumber];
|
RendererRoom &const room = m_rooms[roomNumber];
|
||||||
ROOM_INFO* r = &Rooms[roomNumber];
|
ROOM_INFO *r = &Rooms[roomNumber];
|
||||||
|
|
||||||
int numLights = room.Lights.size();
|
int numLights = room.Lights.size();
|
||||||
|
|
||||||
// Collect dynamic lights for rooms
|
// Collect dynamic lights for rooms
|
||||||
for (int i = 0; i < m_dynamicLights.size(); i++) {
|
for (int i = 0; i < m_dynamicLights.size(); i++)
|
||||||
RendererLight* light = m_dynamicLights[i];
|
{
|
||||||
|
RendererLight *light = m_dynamicLights[i];
|
||||||
|
|
||||||
Vector3 boxMin = Vector3(r->x - WALL_SIZE, -r->minfloor, r->z - WALL_SIZE);
|
Vector3 boxMin = Vector3(r->x - WALL_SIZE, -r->minfloor, r->z - WALL_SIZE);
|
||||||
Vector3 boxMax = Vector3(r->x + r->xSize * WALL_SIZE, -r->maxceiling, r->z + r->ySize * WALL_SIZE);
|
Vector3 boxMax = Vector3(r->x + r->xSize * WALL_SIZE, -r->maxceiling, r->z + r->ySize * WALL_SIZE);
|
||||||
|
@ -311,7 +354,8 @@ namespace T5M::Renderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer11::prepareLights() {
|
void Renderer11::prepareLights()
|
||||||
|
{
|
||||||
// Add dynamic lights
|
// Add dynamic lights
|
||||||
for (int i = 0; i < m_dynamicLights.size(); i++)
|
for (int i = 0; i < m_dynamicLights.size(); i++)
|
||||||
m_lightsToDraw.push_back(m_dynamicLights[i]);
|
m_lightsToDraw.push_back(m_dynamicLights[i]);
|
||||||
|
@ -325,16 +369,18 @@ namespace T5M::Renderer {
|
||||||
// m_lightsToDraw.resize(32);
|
// m_lightsToDraw.resize(32);
|
||||||
|
|
||||||
// Now try to search for a shadow caster, using Lara as reference
|
// Now try to search for a shadow caster, using Lara as reference
|
||||||
RendererRoom& const room = m_rooms[LaraItem->roomNumber];
|
RendererRoom &const room = m_rooms[LaraItem->roomNumber];
|
||||||
|
|
||||||
// Search for the brightest light. We do a simple version of the classic calculation done in pixel shader.
|
// Search for the brightest light. We do a simple version of the classic calculation done in pixel shader.
|
||||||
RendererLight* brightestLight = NULL;
|
RendererLight *brightestLight = NULL;
|
||||||
float brightest = 0.0f;
|
float brightest = 0.0f;
|
||||||
|
|
||||||
// Try room lights
|
// Try room lights
|
||||||
if (room.Lights.size() != 0) {
|
if (room.Lights.size() != 0)
|
||||||
for (int j = 0; j < room.Lights.size(); j++) {
|
{
|
||||||
RendererLight* light = &room.Lights[j];
|
for (int j = 0; j < room.Lights.size(); j++)
|
||||||
|
{
|
||||||
|
RendererLight *light = &room.Lights[j];
|
||||||
|
|
||||||
Vector4 itemPos = Vector4(LaraItem->pos.xPos, LaraItem->pos.yPos, LaraItem->pos.zPos, 1.0f);
|
Vector4 itemPos = Vector4(LaraItem->pos.xPos, LaraItem->pos.yPos, LaraItem->pos.zPos, 1.0f);
|
||||||
Vector4 lightVector = itemPos - light->Position;
|
Vector4 lightVector = itemPos - light->Position;
|
||||||
|
@ -349,7 +395,8 @@ namespace T5M::Renderer {
|
||||||
float attenuationRange;
|
float attenuationRange;
|
||||||
float attenuationAngle;
|
float attenuationAngle;
|
||||||
|
|
||||||
switch ((int)light->Type) {
|
switch ((int)light->Type)
|
||||||
|
{
|
||||||
case LIGHT_TYPES::LIGHT_TYPE_POINT:
|
case LIGHT_TYPES::LIGHT_TYPE_POINT:
|
||||||
if (distance > light->Out || light->Out < 2048.0f)
|
if (distance > light->Out || light->Out < 2048.0f)
|
||||||
continue;
|
continue;
|
||||||
|
@ -357,21 +404,23 @@ namespace T5M::Renderer {
|
||||||
attenuation = 1.0f - distance / light->Out;
|
attenuation = 1.0f - distance / light->Out;
|
||||||
intensity = max(0.0f, attenuation * (light->Color.x + light->Color.y + light->Color.z) / 3.0f);
|
intensity = max(0.0f, attenuation * (light->Color.x + light->Color.y + light->Color.z) / 3.0f);
|
||||||
|
|
||||||
if (intensity >= brightest) {
|
if (intensity >= brightest)
|
||||||
|
{
|
||||||
brightest = intensity;
|
brightest = intensity;
|
||||||
brightestLight = light;
|
brightestLight = light;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LIGHT_TYPES::LIGHT_TYPE_SPOT:
|
case LIGHT_TYPES::LIGHT_TYPE_SPOT:
|
||||||
if (distance > light->Range)
|
if (distance > light->Range)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
attenuation = 1.0f - distance / light->Range;
|
attenuation = 1.0f - distance / light->Range;
|
||||||
intensity = max(0.0f, attenuation * (light->Color.x + light->Color.y + light->Color.z) / 3.0f);
|
intensity = max(0.0f, attenuation * (light->Color.x + light->Color.y + light->Color.z) / 3.0f);
|
||||||
|
|
||||||
if (intensity >= brightest) {
|
if (intensity >= brightest)
|
||||||
|
{
|
||||||
brightest = intensity;
|
brightest = intensity;
|
||||||
brightestLight = light;
|
brightestLight = light;
|
||||||
}
|
}
|
||||||
|
@ -385,40 +434,42 @@ namespace T5M::Renderer {
|
||||||
m_shadowLight = brightestLight;
|
m_shadowLight = brightestLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer11::collectEffects(short roomNumber,RenderView& renderView) {
|
void Renderer11::collectEffects(short roomNumber, RenderView &renderView)
|
||||||
if (m_rooms.size() <= roomNumber) return;
|
{
|
||||||
RendererRoom& const room = m_rooms[roomNumber];
|
if (m_rooms.size() <= roomNumber)
|
||||||
|
return;
|
||||||
|
RendererRoom &const room = m_rooms[roomNumber];
|
||||||
|
|
||||||
ROOM_INFO* r = room.Room;
|
ROOM_INFO *r = room.Room;
|
||||||
|
|
||||||
short fxNum = NO_ITEM;
|
short fxNum = NO_ITEM;
|
||||||
for (fxNum = r->fxNumber; fxNum != NO_ITEM; fxNum = EffectList[fxNum].nextFx) {
|
for (fxNum = r->fxNumber; fxNum != NO_ITEM; fxNum = EffectList[fxNum].nextFx)
|
||||||
FX_INFO* fx = &EffectList[fxNum];
|
{
|
||||||
|
FX_INFO *fx = &EffectList[fxNum];
|
||||||
|
|
||||||
if (fx->objectNumber < 0)
|
if (fx->objectNumber < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ObjectInfo* obj = &Objects[fx->objectNumber];
|
ObjectInfo *obj = &Objects[fx->objectNumber];
|
||||||
|
|
||||||
RendererEffect* newEffect = &m_effects[fxNum];
|
RendererEffect *newEffect = &m_effects[fxNum];
|
||||||
|
|
||||||
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,renderView);
|
collectLightsForEffect(fx->roomNumber, newEffect, renderView);
|
||||||
|
|
||||||
renderView.effectsToDraw.push_back(newEffect);
|
m_effectsToDraw.push_back(newEffect);
|
||||||
|
|
||||||
short* mp = Meshes[(obj->nmeshes ? obj->meshIndex : fx->frameNumber)];
|
|
||||||
short hhh = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer11::ResetAnimations() {
|
void Renderer11::ResetAnimations()
|
||||||
for (int i = 0; i < NUM_ITEMS; i++) {
|
{
|
||||||
|
for (int i = 0; i < NUM_ITEMS; i++)
|
||||||
|
{
|
||||||
m_items[i].DoneAnimations = false;
|
m_items[i].DoneAnimations = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} // namespace T5M::Renderer
|
|
@ -81,7 +81,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;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "GameFlowScript.h"
|
#include "GameFlowScript.h"
|
||||||
using namespace T5M::Renderer;
|
using namespace T5M::Renderer;
|
||||||
|
|
||||||
extern GameFlow* g_GameFlow;
|
extern GameFlow *g_GameFlow;
|
||||||
|
|
||||||
void Renderer11::UpdateLaraAnimations(bool force)
|
void Renderer11::UpdateLaraAnimations(bool force)
|
||||||
{
|
{
|
||||||
|
@ -22,14 +22,14 @@ void Renderer11::UpdateLaraAnimations(bool force)
|
||||||
Matrix identity;
|
Matrix identity;
|
||||||
Matrix world;
|
Matrix world;
|
||||||
|
|
||||||
RendererItem* item = &m_items[Lara.itemNumber];
|
RendererItem *item = &m_items[Lara.itemNumber];
|
||||||
item->Id = Lara.itemNumber;
|
item->Id = Lara.itemNumber;
|
||||||
item->Item = LaraItem;
|
item->Item = LaraItem;
|
||||||
|
|
||||||
if (!force && item->DoneAnimations)
|
if (!force && item->DoneAnimations)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RendererObject& laraObj = *m_moveableObjects[ID_LARA];
|
RendererObject &laraObj = *m_moveableObjects[ID_LARA];
|
||||||
|
|
||||||
// Clear extra rotations
|
// Clear extra rotations
|
||||||
for (int i = 0; i < laraObj.LinearizedBones.size(); i++)
|
for (int i = 0; i < laraObj.LinearizedBones.size(); i++)
|
||||||
|
@ -48,7 +48,7 @@ void Renderer11::UpdateLaraAnimations(bool force)
|
||||||
|
|
||||||
// First calculate matrices for legs, hips, head and torso
|
// First calculate matrices for legs, hips, head and torso
|
||||||
int mask = MESH_BITS(LM_HIPS) | MESH_BITS(LM_LTHIGH) | MESH_BITS(LM_LSHIN) | MESH_BITS(LM_LFOOT) | MESH_BITS(LM_RTHIGH) | MESH_BITS(LM_RSHIN) | MESH_BITS(LM_RFOOT) | MESH_BITS(LM_TORSO) | MESH_BITS(LM_HEAD);
|
int mask = MESH_BITS(LM_HIPS) | MESH_BITS(LM_LTHIGH) | MESH_BITS(LM_LSHIN) | MESH_BITS(LM_LFOOT) | MESH_BITS(LM_RTHIGH) | MESH_BITS(LM_RSHIN) | MESH_BITS(LM_RFOOT) | MESH_BITS(LM_TORSO) | MESH_BITS(LM_HEAD);
|
||||||
short* framePtr[2];
|
short *framePtr[2];
|
||||||
int rate, frac;
|
int rate, frac;
|
||||||
|
|
||||||
frac = GetFrame_D2(LaraItem, framePtr, &rate);
|
frac = GetFrame_D2(LaraItem, framePtr, &rate);
|
||||||
|
@ -68,8 +68,8 @@ void Renderer11::UpdateLaraAnimations(bool force)
|
||||||
laraObj.LinearizedBones[LM_LINARM]->ExtraRotation += Vector3(TO_RAD(Lara.leftArm.xRot), TO_RAD(Lara.leftArm.zRot), TO_RAD(-Lara.leftArm.yRot));
|
laraObj.LinearizedBones[LM_LINARM]->ExtraRotation += Vector3(TO_RAD(Lara.leftArm.xRot), TO_RAD(Lara.leftArm.zRot), TO_RAD(-Lara.leftArm.yRot));
|
||||||
laraObj.LinearizedBones[LM_RINARM]->ExtraRotation += Vector3(TO_RAD(Lara.rightArm.xRot), TO_RAD(Lara.rightArm.zRot), TO_RAD(-Lara.rightArm.yRot));
|
laraObj.LinearizedBones[LM_RINARM]->ExtraRotation += Vector3(TO_RAD(Lara.rightArm.xRot), TO_RAD(Lara.rightArm.zRot), TO_RAD(-Lara.rightArm.yRot));
|
||||||
|
|
||||||
LARA_ARM * leftArm = &Lara.leftArm;
|
LARA_ARM *leftArm = &Lara.leftArm;
|
||||||
LARA_ARM * rightArm = &Lara.rightArm;
|
LARA_ARM *rightArm = &Lara.rightArm;
|
||||||
|
|
||||||
// HACK: backguns handles differently // TokyoSU: not really a hack since it's the original way to do that.
|
// HACK: backguns handles differently // TokyoSU: not really a hack since it's the original way to do that.
|
||||||
switch (Lara.gunType)
|
switch (Lara.gunType)
|
||||||
|
@ -79,7 +79,7 @@ void Renderer11::UpdateLaraAnimations(bool force)
|
||||||
case WEAPON_CROSSBOW:
|
case WEAPON_CROSSBOW:
|
||||||
case WEAPON_GRENADE_LAUNCHER:
|
case WEAPON_GRENADE_LAUNCHER:
|
||||||
case WEAPON_HARPOON_GUN:
|
case WEAPON_HARPOON_GUN:
|
||||||
short* shotgunFramePtr;
|
short *shotgunFramePtr;
|
||||||
|
|
||||||
// Left arm
|
// Left arm
|
||||||
mask = MESH_BITS(LM_LINARM) | MESH_BITS(LM_LOUTARM) | MESH_BITS(LM_LHAND);
|
mask = MESH_BITS(LM_LINARM) | MESH_BITS(LM_LOUTARM) | MESH_BITS(LM_LHAND);
|
||||||
|
@ -97,7 +97,7 @@ void Renderer11::UpdateLaraAnimations(bool force)
|
||||||
case WEAPON_REVOLVER:
|
case WEAPON_REVOLVER:
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
short* pistolFramePtr;
|
short *pistolFramePtr;
|
||||||
|
|
||||||
// Left arm
|
// Left arm
|
||||||
int upperArmMask = MESH_BITS(LM_LINARM);
|
int upperArmMask = MESH_BITS(LM_LINARM);
|
||||||
|
@ -136,7 +136,9 @@ 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...
|
||||||
if (m_moveableObjects[ID_LARA_HAIR].has_value())
|
// TODO: disabled for now
|
||||||
|
/*
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
@ -284,7 +286,7 @@ bool Renderer11::drawLara(bool transparent, bool shadowMap)
|
||||||
m_context->IASetInputLayout(m_inputLayout);
|
m_context->IASetInputLayout(m_inputLayout);
|
||||||
m_context->IASetIndexBuffer(m_moveablesIndexBuffer.Buffer.Get(), DXGI_FORMAT_R32_UINT, 0);
|
m_context->IASetIndexBuffer(m_moveablesIndexBuffer.Buffer.Get(), DXGI_FORMAT_R32_UINT, 0);
|
||||||
|
|
||||||
RendererItem * item = &m_items[Lara.itemNumber];
|
RendererItem *item = &m_items[Lara.itemNumber];
|
||||||
|
|
||||||
// Set shaders
|
// Set shaders
|
||||||
if (shadowMap)
|
if (shadowMap)
|
||||||
|
@ -301,16 +303,16 @@ bool Renderer11::drawLara(bool transparent, bool shadowMap)
|
||||||
// Set texture
|
// Set texture
|
||||||
m_context->PSSetShaderResources(0, 1, m_moveablesTextures[0].ShaderResourceView.GetAddressOf());
|
m_context->PSSetShaderResources(0, 1, m_moveablesTextures[0].ShaderResourceView.GetAddressOf());
|
||||||
m_context->PSSetShaderResources(1, 1, m_reflectionCubemap.ShaderResourceView.GetAddressOf());
|
m_context->PSSetShaderResources(1, 1, m_reflectionCubemap.ShaderResourceView.GetAddressOf());
|
||||||
ID3D11SamplerState* sampler = m_states->AnisotropicClamp();
|
ID3D11SamplerState *sampler = m_states->AnisotropicClamp();
|
||||||
m_context->PSSetSamplers(0, 1, &sampler);
|
m_context->PSSetSamplers(0, 1, &sampler);
|
||||||
|
|
||||||
m_stMisc.AlphaTest = !transparent;
|
m_stMisc.AlphaTest = !transparent;
|
||||||
updateConstantBuffer<CMiscBuffer>(m_cbMisc, m_stMisc);
|
updateConstantBuffer<CMiscBuffer>(m_cbMisc, m_stMisc);
|
||||||
m_context->PSSetConstantBuffers(3, 1, &m_cbMisc);
|
m_context->PSSetConstantBuffers(3, 1, &m_cbMisc);
|
||||||
|
|
||||||
RendererObject& laraObj = *m_moveableObjects[ID_LARA];
|
RendererObject &laraObj = *m_moveableObjects[ID_LARA];
|
||||||
RendererObject& laraSkin = *m_moveableObjects[ID_LARA_SKIN];
|
RendererObject &laraSkin = *m_moveableObjects[ID_LARA_SKIN];
|
||||||
RendererRoom& const room = m_rooms[LaraItem->roomNumber];
|
RendererRoom &const room = m_rooms[LaraItem->roomNumber];
|
||||||
|
|
||||||
m_stItem.World = m_LaraWorldMatrix;
|
m_stItem.World = m_LaraWorldMatrix;
|
||||||
m_stItem.Position = Vector4(LaraItem->pos.xPos, LaraItem->pos.yPos, LaraItem->pos.zPos, 1.0f);
|
m_stItem.Position = Vector4(LaraItem->pos.xPos, LaraItem->pos.yPos, LaraItem->pos.zPos, 1.0f);
|
||||||
|
@ -331,38 +333,38 @@ 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++)
|
||||||
{
|
{
|
||||||
RendererBucket* bucket = &mesh->Buckets[j];
|
RendererBucket *bucket = &mesh->Buckets[j];
|
||||||
|
|
||||||
if (bucket->Vertices.size() == 0)
|
if (bucket->Vertices.size() == 0)
|
||||||
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++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_moveableObjects[ID_LARA_SKIN_JOINTS].has_value())
|
if (m_moveableObjects[ID_LARA_SKIN_JOINTS].has_value())
|
||||||
{
|
{
|
||||||
RendererObject& laraSkinJoints = *m_moveableObjects[ID_LARA_SKIN_JOINTS];
|
RendererObject &laraSkinJoints = *m_moveableObjects[ID_LARA_SKIN_JOINTS];
|
||||||
|
|
||||||
for (int k = 0; k < laraSkinJoints.ObjectMeshes.size(); k++)
|
for (int k = 0; k < laraSkinJoints.ObjectMeshes.size(); k++)
|
||||||
{
|
{
|
||||||
RendererMesh* mesh = laraSkinJoints.ObjectMeshes[k];
|
RendererMesh *mesh = laraSkinJoints.ObjectMeshes[k];
|
||||||
|
|
||||||
for (int j = firstBucket; j < lastBucket; j++)
|
for (int j = firstBucket; j < lastBucket; j++)
|
||||||
{
|
{
|
||||||
RendererBucket* bucket = &mesh->Buckets[j];
|
RendererBucket *bucket = &mesh->Buckets[j];
|
||||||
|
|
||||||
if (bucket->Vertices.size() == 0)
|
if (bucket->Vertices.size() == 0)
|
||||||
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++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -370,7 +372,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];
|
||||||
|
|
||||||
|
@ -382,13 +384,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;
|
||||||
|
@ -399,7 +401,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;
|
|
||||||
};
|
|
|
@ -389,7 +389,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" />
|
||||||
|
@ -632,7 +631,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>
|
||||||
|
@ -1430,9 +1427,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