Refactoring; Added all sounds from all TR; Removed trash legacy functions for skinning and meshes processing; New skinning procedure, without fixed arrays; Code cleaning; Decompiled LoadSamples; Dynamic size sound map;

This commit is contained in:
MontyTRC89 2020-03-02 09:49:11 +01:00
parent 49070202eb
commit ac7d6b95f7
32 changed files with 1510 additions and 279 deletions

View file

@ -36,6 +36,8 @@
#define phd_RotY_I ((void(__cdecl*)(short)) 0x0042BFC0)
#define phd_RotX_I ((void(__cdecl*)(short)) 0x0042C030)
#define phd_RotZ_I ((void(__cdecl*)(short)) 0x0042C0A0)
#define phd_SetTrans ((void (__cdecl*)(int, int, int)) 0x0048FA40)
#define phd_RotBoundingBoxNoPersp ((void (__cdecl*)(short*, short*)) 0x0042E240)
#define phd_DxTranslateRel ((void(__cdecl*)(int, int, int)) 0x00490790)
#define phd_DxTranslateAbs ((void(__cdecl*)(int, int, int)) 0x00490610)

View file

@ -1997,6 +1997,8 @@ int Inventory::DoPassport()
}
else if (DbInput & IN_LEFT || moveLeft)
{
SoundEffect(SFX_TR3_MENU_PASSPORT, NULL, 0);
moveLeft = false;
moveRight = false;
closePassport = false;
@ -2015,6 +2017,8 @@ int Inventory::DoPassport()
}
else if (DbInput & IN_RIGHT || moveRight)
{
SoundEffect(SFX_TR3_MENU_PASSPORT, NULL, 0);
moveLeft = false;
moveRight = false;
closePassport = false;

View file

@ -5,11 +5,6 @@
using namespace std;
// Legacy stuff
#define ObjectInInventory ((int (__cdecl*)(short)) 0x00464360)
void Inject_Inventory();
// New inventory
#define NUM_INVENTORY_OBJECTS_PER_RING 120
#define NUM_INVENTORY_RINGS 5

View file

@ -751,15 +751,13 @@ void InitialiseLara(int restore)
Lara.gunStatus = LG_NO_ARMS;
Lara.skelebob = 0;
short gun;
short gun = WEAPON_NONE;
// TODO: we should script this behaviour
if (Objects[ID_HK_ITEM].loaded)
gun = WEAPON_HK;
else if (Objects[ID_PISTOLS_ITEM].loaded)
if (Objects[ID_PISTOLS_ITEM].loaded)
gun = WEAPON_PISTOLS;
else
gun = WEAPON_NONE; // avoid problem with empty gun level
Lara.lastGunType = Lara.gunType = Lara.requestGunType = gun;

View file

@ -3,9 +3,6 @@
extern COLL_INFO coll;
#define phd_SetTrans ((void (__cdecl*)(int, int, int)) 0x0048FA40)
#define phd_RotBoundingBoxNoPersp ((void (__cdecl*)(short*, short*)) 0x0042E240)
void GetLaraDeadlyBounds();
void DelAlignLaraToRope(ITEM_INFO* item);
void InitialiseLaraAnims(ITEM_INFO* item);

View file

@ -16,6 +16,10 @@ const BASS_BFX_FREEVERB BASS_ReverbTypes[NUM_REVERB_TYPES] = // Reverb preset
};
vector<AudioTrack> g_AudioTracks;
short SampleLUT[SOUND_NEW_SOUNDMAP_MAX_SIZE];
short SoundMapSize;
int NumSamplesInfos;
SAMPLE_INFO* SampleInfo;
bool Sound_LoadSample(char *pointer, int compSize, int uncompSize, int index) // Replaces DXCreateSampleADPCM()
{
@ -98,7 +102,7 @@ bool Sound_LoadSample(char *pointer, int compSize, int uncompSize, int index) //
long SoundEffect(int effectID, PHD_3DPOS* position, int env_flags)
{
if (effectID >= SOUND_LEGACY_SOUNDMAP_SIZE)
if (effectID >= SoundMapSize)
return 0;
if (BASS_GetDevice() == -1)

File diff suppressed because it is too large Load diff

View file

@ -78,8 +78,8 @@
#define W2VMatrix ARRAY_(0x0055D26C, int, [16])
#define Unk_876C48 VAR_U_(0x00876C48, int)
#define Unk_007E7FE8 VAR_U_(0x007E7FE8, int)
#define SampleLUT VAR_U_(0x00E528A4, short*)
#define SampleInfo VAR_U_(0x00E528A8, SAMPLE_INFO*)
//#define SampleLUT VAR_U_(0x00E528A4, short*)
//#define SampleInfo VAR_U_(0x00E528A8, SAMPLE_INFO*)
#define SamplePointer ARRAY_(0x0086BEF0, HSAMPLE, [SOUND_MAX_SAMPLES])
#define SoundSlot ARRAY_(0x00E52430, SoundEffectSlot, [SOUND_MAX_CHANNELS])
#define TrackNamePrefix VAR_U_(0x00511828, char)

View file

@ -63,7 +63,7 @@ void KnifeControl(short fxNum)
fx->speed = LaraItem->speed;
fx->frameNumber = fx->counter = 0;
SoundEffect(SFX_TR2_HIT_BY_KNIFE_ID317, &fx->pos, 0); // knife hit lara sound
SoundEffect(SFX_TR2_CRUNCH2, &fx->pos, 0); // knife hit lara sound
DoBloodSplat(fx->pos.xPos, fx->pos.yPos, fx->pos.zPos, 80, fx->pos.yRot, fx->roomNumber);
KillEffect(fxNum);
}

View file

@ -208,7 +208,7 @@ void MonkControl(short itemNum)
LaraItem->hitStatus = true;
monk->flags |= 0x1000;
SoundEffect(SFX_TR2_MONK_HIT_TARGET_ID245, &item->pos, 0);
SoundEffect(SFX_TR2_CRUNCH1, &item->pos, 0);
CreatureEffect(item, &monkBite, DoBloodSplat);
}
}
@ -224,7 +224,7 @@ void MonkControl(short itemNum)
enemy->hitStatus = true;
monk->flags |= 0x1000;
SoundEffect(SFX_TR2_MONK_HIT_TARGET_ID245, &item->pos, 0);
SoundEffect(SFX_TR2_CRUNCH1, &item->pos, 0);
}
}
}

View file

@ -14,7 +14,7 @@ void XianDamage(ITEM_INFO* item, CREATURE_INFO* xian, int damage)
LaraItem->hitStatus = true;
CreatureEffect(item, &spearRightBite, DoBloodSplat);
xian->flags |= 1;
SoundEffect(SFX_TR2_SWORD_HITTARGET_ID318, &item->pos, 0);
SoundEffect(SFX_TR2_CRUNCH3, &item->pos, 0);
}
if (!(xian->flags & 2) && (item->touchBits & 0x800))
@ -23,7 +23,7 @@ void XianDamage(ITEM_INFO* item, CREATURE_INFO* xian, int damage)
LaraItem->hitStatus = true;
CreatureEffect(item, &spearLeftBite, DoBloodSplat);
xian->flags |= 2;
SoundEffect(SFX_TR2_SWORD_HITTARGET_ID318, &item->pos, 0);
SoundEffect(SFX_TR2_CRUNCH3, &item->pos, 0);
}
}

View file

@ -30,7 +30,7 @@ void SwordGuardianFly(ITEM_INFO* item)
pos.z = (GetRandomControl() << 8 >> 15) + item->pos.zPos - 128;
TriggerGunSmoke(pos.x, pos.y, pos.z, 1, 1, 1, 1, WEAPON_GRENADE_LAUNCHER, 32);
SoundEffect(SFX_TR2_SWORD_GUARDIAN_FLYING_ID312, &item->pos, 0);
SoundEffect(SFX_TR2_WARRIOR_HOVER, &item->pos, 0);
}
void SwordGuardianControl(short itemNum)

View file

@ -90,7 +90,7 @@ void MPGunControl(short itemNumber)
torsoY = info.angle;
head = info.angle;
ShotLara(item, &info, &mpgunBite, torsoY, 32);
SoundEffect(SFX_TR3_OIL_SMG_FIRE_ID72, &item->pos, 3 << 13);
SoundEffect(SFX_TR3_OIL_SMG_FIRE, &item->pos, 3 << 13);
}
}
@ -162,7 +162,7 @@ void MPGunControl(short itemNumber)
if (laraInfo.distance < SQUARE(1024) || item->hitStatus || TargetVisible(item, &laraInfo))
{
if (!creature->alerted)
SoundEffect(SFX_TR3_AMERCAN_HOY_ID300, &item->pos, 0);
SoundEffect(SFX_TR3_AMERCAN_HOY, &item->pos, 0);
AlertAllGuards(itemNumber);
}
creature->enemy = enemy;

View file

@ -140,7 +140,7 @@ void MPStickControl(short itemNumber)
if (item->hitStatus || ((laraInfo.distance < SQUARE(1024) || TargetVisible(item, &laraInfo)) && (abs(LaraItem->pos.yPos - item->pos.yPos) < 1024))) // TS- TODO: take this back out after demo!!
{
if (!creature->alerted)
SoundEffect(SFX_TR3_AMERCAN_HOY_ID300, &item->pos, 0);
SoundEffect(SFX_TR3_AMERCAN_HOY, &item->pos, 0);
AlertAllGuards(itemNumber);
}
creature->enemy = enemy;

View file

@ -105,7 +105,7 @@ void ShivaDamage(ITEM_INFO* item, CREATURE_INFO* shiva, int damage)
LaraItem->hitStatus = true;
CreatureEffect(item, &shivaRightBite, DoBloodSplat);
shiva->flags = 1;
SoundEffect(SFX_TR2_SWORD_HITTARGET_ID318, &item->pos, 0);
SoundEffect(SFX_TR2_CRUNCH3, &item->pos, 0);
}
if (!(shiva->flags) && (item->touchBits & 0x2400))
@ -114,7 +114,7 @@ void ShivaDamage(ITEM_INFO* item, CREATURE_INFO* shiva, int damage)
LaraItem->hitStatus = true;
CreatureEffect(item, &shivaLeftBite, DoBloodSplat);
shiva->flags = 1;
SoundEffect(SFX_TR2_SWORD_HITTARGET_ID318, &item->pos, 0);
SoundEffect(SFX_TR2_CRUNCH3, &item->pos, 0);
}
}

View file

@ -355,7 +355,7 @@ static void ExplodeLondonBoss(ITEM_INFO* item)
for (lp = 0; lp < 2; lp++)
TriggerExplosionSparks(x, y, z, 3, -1, 2, 0);
SoundEffect(SFX_TR3_BOSS_EXPLODE_ID76, &item->pos, PITCH_SHIFT | 0x800000);
SoundEffect(SFX_TR3_BLAST_CIRCLE, &item->pos, PITCH_SHIFT | 0x800000);
}
// Adjust shield coordinates.

View file

@ -729,7 +729,7 @@ void GuideControl(short itemNum)
{
item->requiredAnimState = 3;
item->swapMeshFlags |= 0x200000;
SoundEffect(SFX_TR4_GUIDE_SCARED_ID194, &item->pos, 0);
SoundEffect(SFX_TR4_GUIDE_SCARE, &item->pos, 0);
}
}
else if (enemy->pos.yRot - item->pos.yRot <= ANGLE(2))

View file

@ -175,7 +175,7 @@ void KnightTemplarControl(short itemNum)
mesh->staticNumber >= 50)
{
ShatterObject(NULL, mesh, -64, LaraItem->roomNumber, 0);
SoundEffect(SFX_TR4_HIT_ROCK_ID347, &item->pos, 0);
SoundEffect(SFX_TR4_HIT_ROCK, &item->pos, 0);
mesh->Flags &= ~1;
currentFloor->stopper = false;

View file

@ -573,7 +573,7 @@ void SkeletonControl(short itemNum)
if (abs(pos.x - staticMesh->x) < 1024 && abs(pos.z - staticMesh->z) < 1024 && staticMesh->staticNumber >= 50)
{
ShatterObject(0, staticMesh, -128, LaraItem->roomNumber, 0);
SoundEffect(SFX_TR4_HIT_ROCK_ID347, &item->pos, 0);
SoundEffect(SFX_TR4_HIT_ROCK, &item->pos, 0);
staticMesh->Flags &= ~1;
floor->stopper = 0;
GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos);

View file

@ -46,7 +46,7 @@ void SphinxControl(short itemNum)
if (mesh->z >> 10 == z >> 10 && mesh->x >> 10 == x >> 10 && mesh->staticNumber >= 50)
{
ShatterObject(NULL, mesh, -64, item->roomNumber, 0);
SoundEffect(SFX_TR4_HIT_ROCK_ID347, &item->pos, 0);
SoundEffect(SFX_TR4_HIT_ROCK, &item->pos, 0);
mesh->Flags &= ~0x100;
floor->stopper = false;

View file

@ -703,7 +703,7 @@ static void DoUserInput(ITEM_INFO* v, ITEM_INFO* l, CART_INFO* cart)
if ((fh > -STEP_SIZE) && (fh < STEP_SIZE))
{
if ((Wibble & 7) == 0)
SoundEffect(SFX_TR3_MINECART_HIT_ID202, &v->pos, 2);
SoundEffect(SFX_TR3_QUAD_FRONT_IMPACT, &v->pos, 2);
v->pos.xPos += (TURN_DEATH_VEL * SIN(v->pos.yRot)) >> W2V_SHIFT;
v->pos.zPos += (TURN_DEATH_VEL * COS(v->pos.yRot)) >> W2V_SHIFT;

View file

@ -354,9 +354,9 @@ void SkidooAnimation(ITEM_INFO* skidoo, int collide, int dead)
if (LaraItem->currentAnimState != SKID_HIT)
{
if (collide == SKIDOO_HIT_FRONT)
SoundEffect(SFX_TR2_SNOWMOBILE_HITF_ID201, &skidoo->pos, 0);
SoundEffect(SFX_TR2_CLATTER_1, &skidoo->pos, 0);
else
SoundEffect(SFX_TR2_SNOWMOBILE_HITB_ID202, &skidoo->pos, 0);
SoundEffect(SFX_TR2_CLATTER_2, &skidoo->pos, 0);
LaraItem->animNumber = (short)(Objects[ID_SNOWMOBILE_LARA_ANIMS].animIndex + collide);
LaraItem->frameNumber = Anims[LaraItem->animNumber].frameBase;
LaraItem->currentAnimState = LaraItem->goalAnimState = SKID_HIT;
@ -429,7 +429,7 @@ void SkidooAnimation(ITEM_INFO* skidoo, int collide, int dead)
case SKID_FALL:
if (skidoo->fallspeed <= 0 || skinfo->left_fallspeed <= 0 || skinfo->right_fallspeed <= 0)
{
SoundEffect(SFX_TR2_SNOWMOBILE_FALL_ID203, &skidoo->pos, 0);
SoundEffect(SFX_TR2_CLATTER_3, &skidoo->pos, 0);
LaraItem->goalAnimState = SKID_SIT;
}
else if (skidoo->fallspeed > DAMAGE_START + DAMAGE_LENGTH) // when Lara let's go, it's terminal
@ -1029,13 +1029,13 @@ int SkidooControl()
/* Do engine noise */
skinfo->pitch += (pitch - skinfo->pitch) >> 2;
SoundEffect(SFX_TR2_SNOWMOBILE_MOVE_ID155, &skidoo->pos, 4 + ((0x10000 - (SKIDOO_MAX_SPEED - skinfo->pitch) * 100) << 8));
SoundEffect(SFX_TR2_SNOWMOBILE_HIGH_ENGINE_RPM, &skidoo->pos, 4 + ((0x10000 - (SKIDOO_MAX_SPEED - skinfo->pitch) * 100) << 8));
}
else
{
skinfo->track_mesh = 0;
if (!drive)
SoundEffect(SFX_TR2_SNOWMOBILE_IDLE_ID153, &skidoo->pos, 0);
SoundEffect(SFX_TR2_SNOWMOBILE_IDLE, &skidoo->pos, 0);
skinfo->pitch = 0;
}
skidoo->floor = height;

View file

@ -120,7 +120,7 @@ static void FireSubHarpoon(ITEM_INFO* v)
AddActiveItem(itemNum);
SoundEffect(SFX_TR3_UPV_HARPOON_SHOT_ID23, &LaraItem->pos, 2);
SoundEffect(SFX_TR3_LARA_HARPOON_FIRE_WATER, &LaraItem->pos, 2);
// if lara have ammo, reduce it.
if (g_LaraExtra.Weapons[WEAPON_HARPOON_GUN].Ammo[0])

View file

@ -131,7 +131,7 @@ void ScalesCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)
}
else if (l->frameNumber == Anims[402].frameBase + 51)
{
SoundEffect(SFX_TR4_POUR_ID97, &l->pos, 0);
SoundEffect(SFX_TR4_POUR, &l->pos, 0);
item->pos.yRot = rotY;
}
else if (l->frameNumber == Anims[402].frameBase + 74)
@ -238,7 +238,7 @@ void LaraDoubleControl(short itemNum)
{
ITEM_INFO* item = &Items[itemNum];
SoundEffect(SFX_TR4_METAL_SCRAPE_LOOP_1_ID12, &item->pos, 0);
SoundEffect(SFX_TR4_METAL_SCRAPE_LOOP, &item->pos, 0);
if (CreatureActive(itemNum))
{

View file

@ -300,7 +300,7 @@ void StargateControl(short itemNum)
if (TriggerActive(item))
{
SoundEffect(SFX_TR4_STARGATE_SWIRL_ID23, &item->pos, 0);
SoundEffect(SFX_TR4_STARGATE_SWIRL, &item->pos, 0);
item->itemFlags[0] = 57521664;
AnimateItem(item);
}
@ -563,8 +563,8 @@ void SlicerDicerControl(short itemNum)
{
ITEM_INFO* item = &Items[itemNum];
SoundEffect(SFX_TR4_METAL_SCRAPE_LOOP_2_ID20, &item->pos, 0);
SoundEffect(SFX_TR4_METAL_SCRAPE_LOOP_1_ID12, &item->pos, 0);
SoundEffect(SFX_TR4_METAL_SCRAPE_LOOP1, &item->pos, 0);
SoundEffect(SFX_TR4_METAL_SCRAPE_LOOP, &item->pos, 0);
int factor = (9 * COS(item->triggerFlags) << 9 >> W2V_SHIFT) * COS(item->pos.yRot) >> W2V_SHIFT;
@ -735,7 +735,7 @@ void MineCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)
l->currentAnimState = 8;
l->speed = 0;
SoundEffect(SFX_TR4_MINE_EXPLOSION_OVERLAY_ID103, &item->pos, 0);
SoundEffect(SFX_TR4_MINE_EXP_OVERLAY, &item->pos, 0);
}
}
else
@ -772,7 +772,7 @@ void MineCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)
KillItem(i);
if (!(GetRandomControl() & 3))
SoundEffect(SFX_TR4_MINE_EXPLOSION_OVERLAY_ID103, &currentItem->pos, 0);
SoundEffect(SFX_TR4_MINE_EXP_OVERLAY, &currentItem->pos, 0);
currentItem->status = ITEM_INVISIBLE;
}
@ -846,7 +846,7 @@ void SentryGunControl(short itemNum)
{
if (info.distance < SQUARE(9 * WALL_SIZE))
{
if (!ObjectInInventory(ID_PUZZLE_ITEM5) &&
if (!g_Inventory->IsObjectPresentInInventory(ID_PUZZLE_ITEM5) &&
!item->itemFlags[0])
{
if (info.distance <= SQUARE(2048))
@ -862,7 +862,7 @@ void SentryGunControl(short itemNum)
item->itemFlags[0] = 2;
ShotLara(item, &info, &sentryGunBite, creature->jointRotation[0], 5);
SoundEffect(SFX_TR4_AUTOGUNS_ID358, &item->pos, 0);
SoundEffect(SFX_TR4_AUTOGUNS, &item->pos, 0);
item->itemFlags[2] += 256;
if (item->itemFlags[2] > 6144)

View file

@ -519,8 +519,6 @@ RendererMesh* Renderer11::getRendererMeshFromTrMesh(RendererObject* obj, short*
vertex.UV.y = (texture->vertices[v].y * 256.0f + 0.5f + GET_ATLAS_PAGE_Y(tile)) / (float)TEXTURE_ATLAS_SIZE;
vertex.Bone = boneIndex;
if (isJoints && boneIndex != 0 && m_laraSkinJointRemap[boneIndex][indices[v]] != -1)
vertex.Bone = m_laraSkinJointRemap[boneIndex][indices[v]];
if (isHairs)
vertex.Bone = indices[v];
@ -616,8 +614,6 @@ RendererMesh* Renderer11::getRendererMeshFromTrMesh(RendererObject* obj, short*
vertex.UV.y = (texture->vertices[v].y * 256.0f + 0.5f + GET_ATLAS_PAGE_Y(tile)) / (float)TEXTURE_ATLAS_SIZE;
vertex.Bone = boneIndex;
if (isJoints && boneIndex != 0 && m_laraSkinJointRemap[boneIndex][indices[v]] != -1)
vertex.Bone = m_laraSkinJointRemap[boneIndex][indices[v]];
if (isHairs)
vertex.Bone = indices[v];

View file

@ -764,9 +764,6 @@ private:
IndexBuffer* m_staticsIndexBuffer;
vector<RendererRoom> m_rooms;
Matrix m_hairsMatrices[12];
short m_normalLaraSkinJointRemap[15][32];
short m_youngLaraSkinJointRemap[15][32];
short m_laraSkinJointRemap[15][32];
short m_numHairVertices;
short m_numHairIndices;
vector<RendererVertex> m_hairVertices;

View file

@ -64,15 +64,6 @@ bool Renderer11::PrepareDataForTheRenderer()
int blockX = 0;
int blockY = 0;
if (g_GameFlow->GetLevel(CurrentLevel)->LaraType == LARA_YOUNG)
{
memcpy(m_laraSkinJointRemap, m_youngLaraSkinJointRemap, 15 * 32 * 2);
}
else
{
memcpy(m_laraSkinJointRemap, m_normalLaraSkinJointRemap, 15 * 32 * 2);
}
for (int p = 0; p < NumTexturePages; p++)
{
for (int y = 0; y < 256; y++)
@ -594,6 +585,8 @@ bool Renderer11::PrepareDataForTheRenderer()
// Fix Lara skin joints and hairs
if (MoveablesIds[i] == ID_LARA_SKIN_JOINTS)
{
int bonesToCheck[2] = { 0,0 };
RendererObject* objSkin = m_moveableObjects[ID_LARA_SKIN];
for (int j = 1; j < obj->nmeshes; j++)
@ -601,16 +594,23 @@ bool Renderer11::PrepareDataForTheRenderer()
RendererMesh* jointMesh = moveable->ObjectMeshes[j];
RendererBone* jointBone = moveable->LinearizedBones[j];
bonesToCheck[0] = jointBone->Parent->Index;
bonesToCheck[1] = j;
for (int b1 = 0; b1 < NUM_BUCKETS; b1++)
{
RendererBucket* jointBucket = &jointMesh->Buckets[b1];
for (int v1 = 0; v1 < jointBucket->Vertices.size(); v1++)
{
RendererVertex* jointVertex = &jointBucket->Vertices[v1];
if (jointVertex->Bone != j)
bool done = false;
for (int k = 0; k < 2; k++)
{
RendererMesh* skinMesh = objSkin->ObjectMeshes[jointVertex->Bone];
RendererBone* skinBone = objSkin->LinearizedBones[jointVertex->Bone];
RendererMesh* skinMesh = objSkin->ObjectMeshes[bonesToCheck[k]];
RendererBone* skinBone = objSkin->LinearizedBones[bonesToCheck[k]];
for (int b2 = 0; b2 < NUM_BUCKETS; b2++)
{
@ -629,12 +629,21 @@ bool Renderer11::PrepareDataForTheRenderer()
if (abs(x1 - x2) < 2 && abs(y1 - y2) < 2 && abs(z1 - z2) < 2)
{
jointVertex->Bone = bonesToCheck[k];
jointVertex->Position.x = skinVertex->Position.x;
jointVertex->Position.y = skinVertex->Position.y;
jointVertex->Position.z = skinVertex->Position.z;
done = true;
break;
}
}
if (done)
break;
}
if (done)
break;
}
}
}

View file

@ -444,184 +444,5 @@ bool Renderer11::Create()
void Renderer11::initialiseHairRemaps()
{
memset(m_normalLaraSkinJointRemap, -1, 15 * 32 * 2);
memset(m_youngLaraSkinJointRemap, -1, 15 * 32 * 2);
// Normal Lara
m_normalLaraSkinJointRemap[1][0] = 0;
m_normalLaraSkinJointRemap[1][1] = 0;
m_normalLaraSkinJointRemap[1][2] = 0;
m_normalLaraSkinJointRemap[1][3] = 0;
m_normalLaraSkinJointRemap[1][4] = 0;
m_normalLaraSkinJointRemap[1][5] = 0;
m_normalLaraSkinJointRemap[2][0] = 1;
m_normalLaraSkinJointRemap[2][1] = 1;
m_normalLaraSkinJointRemap[2][2] = 1;
m_normalLaraSkinJointRemap[2][3] = 1;
m_normalLaraSkinJointRemap[2][4] = 1;
m_normalLaraSkinJointRemap[3][4] = 2;
m_normalLaraSkinJointRemap[3][5] = 2;
m_normalLaraSkinJointRemap[3][6] = 2;
m_normalLaraSkinJointRemap[3][7] = 2;
m_normalLaraSkinJointRemap[4][0] = 0;
m_normalLaraSkinJointRemap[4][1] = 0;
m_normalLaraSkinJointRemap[4][2] = 0;
m_normalLaraSkinJointRemap[4][3] = 0;
m_normalLaraSkinJointRemap[4][4] = 0;
m_normalLaraSkinJointRemap[4][5] = 0;
m_normalLaraSkinJointRemap[5][0] = 4;
m_normalLaraSkinJointRemap[5][1] = 4;
m_normalLaraSkinJointRemap[5][2] = 4;
m_normalLaraSkinJointRemap[5][3] = 4;
m_normalLaraSkinJointRemap[5][4] = 4;
m_normalLaraSkinJointRemap[6][4] = 5;
m_normalLaraSkinJointRemap[6][5] = 5;
m_normalLaraSkinJointRemap[6][6] = 5;
m_normalLaraSkinJointRemap[6][7] = 5;
m_normalLaraSkinJointRemap[7][0] = 0;
m_normalLaraSkinJointRemap[7][1] = 0;
m_normalLaraSkinJointRemap[7][2] = 0;
m_normalLaraSkinJointRemap[7][3] = 0;
m_normalLaraSkinJointRemap[7][4] = 0;
m_normalLaraSkinJointRemap[7][5] = 0;
m_normalLaraSkinJointRemap[8][6] = 7;
m_normalLaraSkinJointRemap[8][7] = 7;
m_normalLaraSkinJointRemap[8][8] = 7;
m_normalLaraSkinJointRemap[8][9] = 7;
m_normalLaraSkinJointRemap[8][10] = 7;
m_normalLaraSkinJointRemap[8][11] = 7;
m_normalLaraSkinJointRemap[9][5] = 8;
m_normalLaraSkinJointRemap[9][6] = 8;
m_normalLaraSkinJointRemap[9][7] = 8;
m_normalLaraSkinJointRemap[9][8] = 8;
m_normalLaraSkinJointRemap[9][9] = 8;
m_normalLaraSkinJointRemap[10][0] = 9;
m_normalLaraSkinJointRemap[10][1] = 9;
m_normalLaraSkinJointRemap[10][2] = 9;
m_normalLaraSkinJointRemap[10][3] = 9;
m_normalLaraSkinJointRemap[10][4] = 9;
m_normalLaraSkinJointRemap[11][6] = 7;
m_normalLaraSkinJointRemap[11][7] = 7;
m_normalLaraSkinJointRemap[11][8] = 7;
m_normalLaraSkinJointRemap[11][9] = 7;
m_normalLaraSkinJointRemap[11][10] = 7;
m_normalLaraSkinJointRemap[11][11] = 7;
m_normalLaraSkinJointRemap[12][5] = 11;
m_normalLaraSkinJointRemap[12][6] = 11;
m_normalLaraSkinJointRemap[12][7] = 11;
m_normalLaraSkinJointRemap[12][8] = 11;
m_normalLaraSkinJointRemap[12][9] = 11;
m_normalLaraSkinJointRemap[13][0] = 12;
m_normalLaraSkinJointRemap[13][1] = 12;
m_normalLaraSkinJointRemap[13][2] = 12;
m_normalLaraSkinJointRemap[13][3] = 12;
m_normalLaraSkinJointRemap[13][4] = 12;
m_normalLaraSkinJointRemap[14][6] = 7;
m_normalLaraSkinJointRemap[14][7] = 7;
m_normalLaraSkinJointRemap[14][8] = 7;
m_normalLaraSkinJointRemap[14][9] = 7;
m_normalLaraSkinJointRemap[14][10] = 7;
m_normalLaraSkinJointRemap[14][11] = 7;
// Young Lara
m_youngLaraSkinJointRemap[1][0] = 0; // Left up leg
m_youngLaraSkinJointRemap[1][1] = 0;
m_youngLaraSkinJointRemap[1][2] = 0;
m_youngLaraSkinJointRemap[1][3] = 0;
m_youngLaraSkinJointRemap[1][4] = 0;
m_youngLaraSkinJointRemap[1][5] = 0;
m_youngLaraSkinJointRemap[2][0] = 1; // Bottom left leg
m_youngLaraSkinJointRemap[2][1] = 1;
m_youngLaraSkinJointRemap[2][2] = 1;
m_youngLaraSkinJointRemap[2][3] = 1;
m_youngLaraSkinJointRemap[2][4] = 1;
m_youngLaraSkinJointRemap[3][0] = 2; // Left foot
m_youngLaraSkinJointRemap[3][1] = 2;
m_youngLaraSkinJointRemap[3][2] = 2;
m_youngLaraSkinJointRemap[3][3] = 2;
m_youngLaraSkinJointRemap[4][6] = 0; // Right upper leg
m_youngLaraSkinJointRemap[4][7] = 0;
m_youngLaraSkinJointRemap[4][8] = 0;
m_youngLaraSkinJointRemap[4][9] = 0;
m_youngLaraSkinJointRemap[4][10] = 0;
m_youngLaraSkinJointRemap[4][11] = 0;
m_youngLaraSkinJointRemap[5][0] = 4; // Right bottom leg
m_youngLaraSkinJointRemap[5][1] = 4;
m_youngLaraSkinJointRemap[5][2] = 4;
m_youngLaraSkinJointRemap[5][3] = 4;
m_youngLaraSkinJointRemap[5][4] = 4;
m_youngLaraSkinJointRemap[6][0] = 5; // Right foot
m_youngLaraSkinJointRemap[6][1] = 5;
m_youngLaraSkinJointRemap[6][2] = 5;
m_youngLaraSkinJointRemap[6][3] = 5;
m_youngLaraSkinJointRemap[7][0] = 0; // Torso
m_youngLaraSkinJointRemap[7][1] = 0;
m_youngLaraSkinJointRemap[7][2] = 0;
m_youngLaraSkinJointRemap[7][3] = 0;
m_youngLaraSkinJointRemap[7][4] = 0;
m_youngLaraSkinJointRemap[7][5] = 0;
m_youngLaraSkinJointRemap[8][0] = 7; // Left upper arm
m_youngLaraSkinJointRemap[8][1] = 7;
m_youngLaraSkinJointRemap[8][2] = 7;
m_youngLaraSkinJointRemap[8][3] = 7;
m_youngLaraSkinJointRemap[8][4] = 7;
m_youngLaraSkinJointRemap[8][5] = 7;
m_youngLaraSkinJointRemap[9][5] = 8; // Left bottom arm
m_youngLaraSkinJointRemap[9][6] = 8;
m_youngLaraSkinJointRemap[9][7] = 8;
m_youngLaraSkinJointRemap[9][8] = 8;
m_youngLaraSkinJointRemap[9][9] = 8;
m_youngLaraSkinJointRemap[10][0] = 9; // Left hand
m_youngLaraSkinJointRemap[10][1] = 9;
m_youngLaraSkinJointRemap[10][2] = 9;
m_youngLaraSkinJointRemap[10][3] = 9;
m_youngLaraSkinJointRemap[10][4] = 9;
m_youngLaraSkinJointRemap[11][0] = 7; // Right upper arm
m_youngLaraSkinJointRemap[11][1] = 7;
m_youngLaraSkinJointRemap[11][2] = 7;
m_youngLaraSkinJointRemap[11][3] = 7;
m_youngLaraSkinJointRemap[11][4] = 7;
m_youngLaraSkinJointRemap[11][5] = 7;
m_youngLaraSkinJointRemap[12][5] = 11; // Right low arm
m_youngLaraSkinJointRemap[12][6] = 11;
m_youngLaraSkinJointRemap[12][7] = 11;
m_youngLaraSkinJointRemap[12][8] = 11;
m_youngLaraSkinJointRemap[12][9] = 11;
m_youngLaraSkinJointRemap[13][0] = 12; // Right arm
m_youngLaraSkinJointRemap[13][1] = 12;
m_youngLaraSkinJointRemap[13][2] = 12;
m_youngLaraSkinJointRemap[13][3] = 12;
m_youngLaraSkinJointRemap[13][4] = 12;
m_youngLaraSkinJointRemap[14][0] = 7; // Head
m_youngLaraSkinJointRemap[14][1] = 7;
m_youngLaraSkinJointRemap[14][2] = 7;
m_youngLaraSkinJointRemap[14][3] = 7;
m_youngLaraSkinJointRemap[14][4] = 7;
m_youngLaraSkinJointRemap[14][5] = 7;
}

View file

@ -443,7 +443,7 @@ bool GameFlow::DoGameflow()
{
// First we need to fill some legacy variables in PCTomb5.exe
GameScriptLevel* level = Levels[CurrentLevel];
//level->LaraType = LARA_YOUNG;
CurrentAtmosphere = level->Soundtrack;
if (level->Horizon)

View file

@ -480,7 +480,7 @@ unsigned __stdcall LoadLevel(void* data)
char* filename = (char*)data;
LevelDataPtr = NULL;
LevelFilePtr = 0;
LevelFilePtr = NULL;
g_Renderer->UpdateProgress(0);
@ -536,7 +536,7 @@ unsigned __stdcall LoadLevel(void* data)
LoadItems();
LoadAIObjects();
LoadDemoData();
//LoadDemoData();
LoadSamples();
g_Renderer->UpdateProgress(80);
@ -587,6 +587,55 @@ unsigned __stdcall LoadLevel(void* data)
return true;
}
void LoadSamples()
{
// Legacy soundmap size was 450, for now let's store new soundmap size into NumDemoData field
SoundMapSize = ReadInt16();
if (SoundMapSize == 0)
SoundMapSize = SOUND_LEGACY_SOUNDMAP_SIZE;
for (int i = 0; i < SoundMapSize; i++)
SampleLUT[i] = ReadInt16();
NumSamplesInfos = ReadInt32();
if (NumSamplesInfos)
{
SampleInfo = (SAMPLE_INFO*)GameMalloc(NumSamplesInfos * sizeof(SAMPLE_INFO));
ReadBytes(SampleInfo, NumSamplesInfos * sizeof(SAMPLE_INFO));
int numSampleIndices = ReadInt32();
if (numSampleIndices)
{
int numSamples = 0;
ReadFileEx(&numSamples, 1, 4, LevelFilePtr);
//if (feof(LevelFilePtr))
// return;
if (numSamples <= 0)
return;
int uncompressedSize;
int compressedSize;
char* buffer = (char*)malloc(1048576);
for (int i = 0; i < numSamples; i++)
{
ReadFileEx(&uncompressedSize, 4, 1, LevelFilePtr);
ReadFileEx(&compressedSize, 4, 1, LevelFilePtr);
ReadFileEx(buffer, 1, compressedSize, LevelFilePtr);
Sound_LoadSample(buffer, compressedSize, uncompressedSize, i);
}
free(buffer);
}
}
else
{
//Log(1, aNoSampleInfos);
}
}
void LoadBoxes()
{
// Read boxes

View file

@ -15,8 +15,8 @@ struct LEB128;
#define DoSomethingWithRooms ((void (__cdecl*)()) 0x004774D0)
#define FreeItemsStuff ((void (__cdecl*)(int)) 0x00440590)
//#define InitialiseClosedDoors ((void (__cdecl*)()) 0x00473600)
#define CreateSkinningData ((void (__cdecl*)()) 0x00456AE0)
#define ProcessMeshData ((void (__cdecl*)(int)) 0x0049A3D0)
//#define CreateSkinningData ((void (__cdecl*)()) 0x00456AE0)
//#define ProcessMeshData ((void (__cdecl*)(int)) 0x0049A3D0)
#define ReadFileEx ((int (__cdecl*)(void*, int, int, FILE*)) 0x004E1D20)
#define Decompress ((int (__cdecl*)(byte*, byte*, int, int)) 0x004A3EF0)
#define ReadRoomOriginal ((int (__cdecl*)(ROOM_INFO*, ROOM_INFO*)) 0x004917D0)
@ -29,7 +29,7 @@ struct LEB128;
#define LoadTextureInfos ((void (__cdecl*)()) 0x004A60E0)
#define LoadAIObjects ((void (__cdecl*)()) 0x004A67F0)
#define LoadDemoData ((void (__cdecl*)()) 0x004A67D0)
#define LoadSamples ((void (__cdecl*)()) 0x004A6880)
//#define LoadSamples ((void (__cdecl*)()) 0x004A6880)
#define InitialiseLaraLoad ((void (__cdecl*)(short)) 0x004568C0)
#define LoadRooms ((void (__cdecl*)()) 0x004A4DA0)
#define InitialiseGameStuff ((void (__cdecl*)()) 0x004778F0)
@ -73,6 +73,7 @@ void LoadSprites();
void GetCarriedItems();
void GetAIPickups();
void LoadBoxes();
void LoadSamples();
unsigned __stdcall LoadLevel(void* data);