mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-01 17:28:00 +03:00
Merge branch 'master' of https://github.com/MontyTRC89/TR5Main
This commit is contained in:
commit
3b042da185
33 changed files with 641 additions and 270 deletions
|
@ -417,6 +417,7 @@ GAME_STATUS ControlPhase(int numFrames, int demoMode)
|
|||
UpdateGunShells();
|
||||
updateFootprints();
|
||||
UpdateSplashes();
|
||||
UpdateEnergyArcs();
|
||||
UpdateDrips();
|
||||
UpdateRats();
|
||||
UpdateBats();
|
||||
|
@ -2723,7 +2724,7 @@ int DoRayBox(GAME_VECTOR* start, GAME_VECTOR* end, short* box, PHD_3DPOS* itemOr
|
|||
if (newDist < minDistance)
|
||||
{
|
||||
minDistance = newDist;
|
||||
meshPtr = Meshes[obj->meshIndex + 2 * i];
|
||||
meshPtr = Meshes[obj->meshIndex + i];
|
||||
bit = 1 << i;
|
||||
sp = i;
|
||||
}
|
||||
|
@ -2810,7 +2811,6 @@ void AnimateItem(ITEM_INFO* item)
|
|||
item->afterDeath = 1;
|
||||
item->status = ITEM_DEACTIVATED;
|
||||
break;
|
||||
|
||||
case COMMAND_SOUND_FX:
|
||||
case COMMAND_EFFECT:
|
||||
cmd += 2;
|
||||
|
@ -3125,7 +3125,7 @@ int ExplodeItemNode(ITEM_INFO* item, int Node, int NoXZVel, int bits)
|
|||
GetSpheres(item, SphereList, 3);
|
||||
ShatterItem.yRot = item->pos.yRot;
|
||||
ShatterItem.bit = 1 << Node;
|
||||
ShatterItem.meshp = Meshes[Objects[item->objectNumber].meshIndex + 2 * Node];
|
||||
ShatterItem.meshp = Meshes[Objects[item->objectNumber].meshIndex + Node];
|
||||
ShatterItem.sphere.x = SphereList[Node].x;
|
||||
ShatterItem.sphere.y = SphereList[Node].y;
|
||||
ShatterItem.sphere.z = SphereList[Node].z;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "sphere.h"
|
||||
#include "footprint.h"
|
||||
#include "..\Objects\oldobjects.h"
|
||||
#include "..\Specific\roomload.h"
|
||||
|
||||
int wf = 256;
|
||||
extern std::deque<FOOTPRINT_STRUCT> footprints;
|
||||
|
@ -359,10 +360,10 @@ void ExplosionFX(ITEM_INFO* item)//39694(<), 39B94(<) (F)
|
|||
|
||||
void SwapCrowbar(ITEM_INFO* item)//39638(<), 39B38(<) (F)
|
||||
{
|
||||
short* tmp = Meshes[Objects[ID_LARA].meshIndex + 2 * LM_RHAND];
|
||||
short* tmp = Meshes[Objects[ID_LARA].meshIndex + LM_RHAND];
|
||||
|
||||
if (Lara.meshPtrs[LM_RHAND] == tmp)
|
||||
Lara.meshPtrs[LM_RHAND] = Meshes[Objects[ID_LARA_CROWBAR_ANIM].meshIndex + 2 * LM_RHAND];
|
||||
Lara.meshPtrs[LM_RHAND] = Meshes[Objects[ID_LARA_CROWBAR_ANIM].meshIndex + LM_RHAND];
|
||||
else
|
||||
Lara.meshPtrs[LM_RHAND] = tmp;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "laramisc.h"
|
||||
#include "switch.h"
|
||||
#include "items.h"
|
||||
#include "..\Specific\roomload.h"
|
||||
|
||||
short FireBounds[12] =
|
||||
{
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "..\Global\global.h"
|
||||
#include "..\Scripting\GameFlowScript.h"
|
||||
#include "..\Specific\roomload.h"
|
||||
|
||||
extern LaraExtraInfo g_LaraExtra;
|
||||
extern GameFlow* g_GameFlow;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "lara.h"
|
||||
#include "effect2.h"
|
||||
#include "tomb4fx.h"
|
||||
#include "..\Specific\roomload.h"
|
||||
|
||||
PISTOL_DEF PistolsTable[4] =
|
||||
{
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "draw.h"
|
||||
#include "effect2.h"
|
||||
#include "flmtorch.h"
|
||||
#include "..\Specific\roomload.h"
|
||||
|
||||
WEAPON_INFO Weapons[NUM_WEAPONS] =
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "laraflar.h"
|
||||
|
||||
#include "..\Global\global.h"
|
||||
#include "..\Specific\roomload.h"
|
||||
|
||||
#include "draw.h"
|
||||
#include "items.h"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "laramisc.h"
|
||||
#include "..\Global\global.h"
|
||||
#include "..\Specific\roomload.h"
|
||||
#include "..\Scripting\GameFlowScript.h"
|
||||
#include "effects.h"
|
||||
#include "collide.h"
|
||||
|
@ -42,7 +43,7 @@ void GetLaraDeadlyBounds() // (F) (D)
|
|||
DeadlyBounds[5] = LaraItem->pos.zPos + tbounds[5];
|
||||
}
|
||||
|
||||
void InitialiseLaraAnims(ITEM_INFO* item) // (F) (D)
|
||||
void InitialiseLaraAnims(ITEM_INFO* item)
|
||||
{
|
||||
if (Rooms[item->roomNumber].flags & ENV_FLAG_WATER)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "sphere.h"
|
||||
#include "draw.h"
|
||||
#include "../Specific/roomload.h"
|
||||
|
||||
int NumLaraSpheres;
|
||||
bool GotLaraSpheres;
|
||||
|
|
|
@ -42,6 +42,7 @@ BUBBLE_STRUCT Bubbles[MAX_BUBBLES];
|
|||
DRIP_STRUCT Drips[MAX_DRIPS];
|
||||
SHOCKWAVE_STRUCT ShockWaves[MAX_SHOCKWAVE];
|
||||
FIRE_LIST Fires[MAX_FIRE_LIST];
|
||||
ENERGY_ARC EnergyArcs[MAX_ENERGY_ARCS];
|
||||
|
||||
extern int NextSpark;
|
||||
extern SPARKS Sparks[MAX_SPARKS];
|
||||
|
@ -325,6 +326,19 @@ void UpdateFireSparks()
|
|||
}
|
||||
}
|
||||
|
||||
void UpdateEnergyArcs()
|
||||
{
|
||||
for (int i = 0; i < MAX_ENERGY_ARCS; i++)
|
||||
{
|
||||
ENERGY_ARC* arc = &EnergyArcs[i];
|
||||
|
||||
if (arc->life > 0)
|
||||
{
|
||||
arc->life--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int GetFreeSmokeSpark()
|
||||
{
|
||||
SMOKE_SPARKS* spark = &SmokeSparks[NextSmokeSpark];
|
||||
|
@ -1862,6 +1876,29 @@ void TriggerSmallSplash(int x, int y, int z, int num)
|
|||
}
|
||||
}
|
||||
|
||||
void TriggerEnergyArc(PHD_VECTOR* start, PHD_VECTOR* end, byte r, byte g, byte b, int segmentSize, byte life)
|
||||
{
|
||||
ENERGY_ARC* arc = NULL;
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
arc = &EnergyArcs[i];
|
||||
if (arc->life == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (arc == NULL)
|
||||
return;
|
||||
|
||||
arc->pos1 = *start;
|
||||
arc->pos4 = *end;
|
||||
arc->life = life;
|
||||
arc->r = r;
|
||||
arc->g = g;
|
||||
arc->b = b;
|
||||
arc->segmentSize = segmentSize;
|
||||
}
|
||||
|
||||
void Inject_Tomb4FX()
|
||||
{
|
||||
INJECT(0x004827E0, TriggerBlood);
|
||||
|
|
|
@ -17,7 +17,7 @@ struct ENERGY_ARC
|
|||
byte byte3D; // 61
|
||||
byte flags; // 62
|
||||
byte byte3F; // 63
|
||||
int byte40; // 64
|
||||
int segmentSize; // 64
|
||||
};
|
||||
|
||||
extern int LaserSightX;
|
||||
|
@ -35,6 +35,7 @@ extern int NextSpider;
|
|||
extern int NextGunShell;
|
||||
|
||||
extern SMOKE_SPARKS SmokeSparks[MAX_SPARKS_SMOKE];
|
||||
extern ENERGY_ARC EnergyArcs[MAX_ENERGY_ARCS];
|
||||
|
||||
void TriggerBlood(int x, int y, int z, int unk, int num);
|
||||
void TriggerExplosionBubble(int x, int y, int z, short roomNum);
|
||||
|
@ -73,5 +74,7 @@ void UpdateShockwaves();
|
|||
void TriggerSmallSplash(int x, int y, int z, int num);
|
||||
void SetFadeClip(short height, short speed);
|
||||
void TriggerLightningGlow(int x, int y, int z, int rgb);
|
||||
void TriggerEnergyArc(PHD_VECTOR* start, PHD_VECTOR* end, byte r, byte g, byte b, int segmentSize, byte life);
|
||||
void UpdateEnergyArcs();
|
||||
|
||||
void Inject_Tomb4FX();
|
|
@ -65,6 +65,7 @@
|
|||
#define MAX_FIRE_LIST 32 // FIRE_SPARKS list
|
||||
#define MAX_SPARKS_SMOKE 32
|
||||
#define MAX_SPARKS_BLOOD 32
|
||||
#define MAX_ENERGY_ARCS 256
|
||||
#define MAX_GUNSHELL 24
|
||||
#define MAX_GUNFLASH 4
|
||||
#define MAX_DRIPS 32
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#define BLUE(rgb) ((rgb) & 0xFF)
|
||||
#define ALPHA(rgb) (((rgb) >> 24) & 0xFF)
|
||||
|
||||
#define MESHES(slot, mesh) Meshes[Objects[slot].meshIndex + mesh * 2]
|
||||
#define MESHES(slot, mesh) Meshes[Objects[slot].meshIndex + mesh]
|
||||
#define MESH_BITS(x) (1 << x)
|
||||
#define LARA_MESHES(slot, mesh) Lara.meshPtrs[mesh] = MESHES(slot, mesh)
|
||||
#define CHECK_LARA_MESHES(slot, mesh) Lara.meshPtrs[mesh] == MESHES(slot, mesh)
|
||||
|
|
|
@ -37,8 +37,6 @@
|
|||
#define Bones VAR_U_(0x00875178, int*)
|
||||
#define Changes VAR_U_(0x0087515C, CHANGE_STRUCT*)
|
||||
#define Ranges VAR_U_(0x00875160, RANGE_STRUCT*)
|
||||
#define MeshBase VAR_U_(0x0087516C, short*)
|
||||
#define Meshes VAR_U_(0x00875170, short**)
|
||||
#define Frames VAR_U_(0x00875174, short*)
|
||||
#define Commands VAR_U_(0x0087517C, short*)
|
||||
#define MeshesCount VAR_U_(0x00875140, int)
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "../../Game/draw.h"
|
||||
#include "../../Game/tomb4fx.h"
|
||||
#include "../../Game/effects.h"
|
||||
#include "..\..\Specific\roomload.h"
|
||||
|
||||
void BubblesEffect1(short fxNum, short xVel, short yVel, short zVel)
|
||||
{
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
#define STATE_HITMAN_GASSED 42
|
||||
#define STATE_HITMAN_DEATH 43
|
||||
|
||||
BITE_INFO CyborgGun = { 0, 300, 64, 7 };
|
||||
byte CyborgJoints[12] = { 15, 14, 13, 6, 5, 12, 7, 4, 10, 11, 19 };
|
||||
BITE_INFO HitmanGun = { 0, 300, 64, 7 };
|
||||
byte HitmanJoints[12] = { 15, 14, 13, 6, 5, 12, 7, 4, 10, 11, 19 };
|
||||
|
||||
void InitialiseHitman(short itemNum)
|
||||
{
|
||||
|
@ -135,10 +135,10 @@ void HitmanControl(short itemNumber)
|
|||
if (item->firedWeapon)
|
||||
{
|
||||
PHD_VECTOR pos;
|
||||
pos.x = CyborgGun.x;
|
||||
pos.y = CyborgGun.y;
|
||||
pos.z = CyborgGun.z;
|
||||
GetJointAbsPosition(item, &pos, CyborgGun.meshNum);
|
||||
pos.x = HitmanGun.x;
|
||||
pos.y = HitmanGun.y;
|
||||
pos.z = HitmanGun.z;
|
||||
GetJointAbsPosition(item, &pos, HitmanGun.meshNum);
|
||||
TriggerDynamicLight(pos.x, pos.y, pos.z, 2 * item->firedWeapon + 10, 192, 128, 32);
|
||||
item->firedWeapon--;
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ void HitmanControl(short itemNumber)
|
|||
{
|
||||
if (item->itemFlags[0] < 11)
|
||||
{
|
||||
item->swapMeshFlags |= 1 << CyborgJoints[item->itemFlags[0]];
|
||||
item->swapMeshFlags |= 1 << HitmanJoints[item->itemFlags[0]];
|
||||
item->itemFlags[0]++;
|
||||
}
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ void HitmanControl(short itemNumber)
|
|||
pos.x = 0;
|
||||
pos.y = 0;
|
||||
pos.z = 50;
|
||||
GetJointAbsPosition(item, &pos, CyborgJoints[random]);
|
||||
GetJointAbsPosition(item, &pos, HitmanJoints[random]);
|
||||
|
||||
TriggerLightningGlow(pos.x, pos.y, pos.z, 807411776);
|
||||
TriggerHitmanSparks(pos.x, pos.y, pos.z, -1, -1, -1);
|
||||
|
@ -517,7 +517,7 @@ void HitmanControl(short itemNumber)
|
|||
&& ((byte)item->frameNumber - (byte)Anims[item->animNumber].frameBase) & 1)
|
||||
{
|
||||
item->firedWeapon = 1;
|
||||
ShotLara(item, &info, &CyborgGun, joint0, 12);
|
||||
ShotLara(item, &info, &HitmanGun, joint0, 12);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "../../Game/Box.h"
|
||||
#include "../../Game/effect2.h"
|
||||
#include "../../Game/people.h"
|
||||
#include "../../Game/tomb4fx.h"
|
||||
#include "../../Game/draw.h"
|
||||
|
||||
BITE_INFO SwatGun = { 80, 200, 13, 0 };
|
||||
|
@ -380,6 +381,8 @@ void GuardControl(short itemNum)
|
|||
ITEM_INFO* currentItem;
|
||||
short currentItemNumber;
|
||||
|
||||
PHD_VECTOR pos1, pos2;
|
||||
|
||||
switch (item->currentAnimState)
|
||||
{
|
||||
case STATE_GUARD_STOP:
|
||||
|
@ -520,6 +523,8 @@ void GuardControl(short itemNum)
|
|||
ShotLara(item, &info, &SwatGun, joint0, 30);
|
||||
else
|
||||
ShotLara(item, &info, &SwatGun, joint0, 10);
|
||||
|
||||
TriggerEnergyArc((PHD_VECTOR*)& item->pos, (PHD_VECTOR*)& LaraItem->pos, 0, 0, 128, 256, 150);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -362,3 +362,42 @@ void ControlHydra(short itemNumber)
|
|||
CreatureAnimation(itemNumber, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void TriggerHydraMissileSparks(PHD_VECTOR* pos, short xv, short yv, short zv)
|
||||
{
|
||||
SPARKS* spark = &Sparks[GetFreeSpark()];
|
||||
|
||||
spark->on = 1;
|
||||
spark->sB = 0;
|
||||
spark->sR = (GetRandomControl() & 0x3F) - 96;
|
||||
spark->sG = spark->sR >> 1;
|
||||
spark->dB = 0;
|
||||
spark->dR = (GetRandomControl() & 0x3F) - 96;
|
||||
spark->dG = spark->dR >> 1;
|
||||
spark->fadeToBlack = 8;
|
||||
spark->colFadeSpeed = (GetRandomControl() & 3) + 8;
|
||||
spark->transType = COLADD;
|
||||
spark->dynamic = -1;
|
||||
spark->life = spark->sLife = (GetRandomControl() & 3) + 20;
|
||||
spark->y = 0;
|
||||
spark->x = (GetRandomControl() & 0xF) - 8;
|
||||
spark->z = (GetRandomControl() & 0xF) - 8;
|
||||
spark->x += pos->x;
|
||||
spark->y += pos->y;
|
||||
spark->z += pos->z;
|
||||
spark->xVel = xv;
|
||||
spark->yVel = yv;
|
||||
spark->zVel = zv;
|
||||
spark->friction = 68;
|
||||
spark->flags = SP_EXPDEF | SP_ROTATE | SP_DEF | SP_SCALE;
|
||||
spark->rotAng = GetRandomControl() & 0xFFF;
|
||||
if (GetRandomControl() & 1)
|
||||
spark->rotAdd = -32 - (GetRandomControl() & 0x1F);
|
||||
else
|
||||
spark->rotAdd = (GetRandomControl() & 0x1F) + 32;
|
||||
spark->gravity = 0;
|
||||
spark->maxYvel = 0;
|
||||
spark->scalar = 1;
|
||||
spark->sSize = spark->size = (GetRandomControl() & 0xF) + 96;
|
||||
spark->dSize = spark->size >> 2;
|
||||
}
|
|
@ -7,6 +7,19 @@
|
|||
#include "../../Game/effect2.h"
|
||||
#include "../../Game/Box.h"
|
||||
|
||||
#define STATE_IMP_WALK 0
|
||||
#define STATE_IMP_STOP 1
|
||||
#define STATE_IMP_RUN 2
|
||||
#define STATE_IMP_ATTACK1 3
|
||||
#define STATE_IMP_ATTACK2 5
|
||||
#define STATE_IMP_SCARED 6
|
||||
#define STATE_IMP_START_CLIMB 7
|
||||
#define STATE_IMP_START_ROLL 8
|
||||
#define STATE_IMP_DEATH 9
|
||||
#define STATE_IMP_THROW_STONES 11
|
||||
|
||||
#define ANIMATION_IMP_DEATH 18
|
||||
|
||||
BITE_INFO ImpBite = { 0, 0x64, 0, 9 };
|
||||
|
||||
void InitialiseImp(short itemNum)
|
||||
|
@ -16,14 +29,15 @@ void InitialiseImp(short itemNum)
|
|||
|
||||
item = &Items[itemNum];
|
||||
ClearItem(itemNum);
|
||||
|
||||
if (item->triggerFlags == 2 || item->triggerFlags == 12)
|
||||
{
|
||||
stateid = 8;
|
||||
stateid = STATE_IMP_START_ROLL;
|
||||
item->animNumber = Objects[ID_IMP].animIndex + 8;
|
||||
}
|
||||
else if (item->triggerFlags == 1 || item->triggerFlags == 11)
|
||||
{
|
||||
stateid = 7;
|
||||
stateid = STATE_IMP_START_CLIMB;
|
||||
item->animNumber = Objects[ID_IMP].animIndex + 7;
|
||||
}
|
||||
else
|
||||
|
@ -80,8 +94,8 @@ void ImpThrowStones(ITEM_INFO* item)
|
|||
if (fx->speed < 256)
|
||||
fx->speed = 256;
|
||||
fx->fallspeed = 0;
|
||||
fxNum = Objects[ID_BUBBLES].meshIndex + 2 * (GetRandomControl() & 7);
|
||||
fx->objectNumber = ID_BUBBLES;
|
||||
fxNum = Objects[ID_IMP_ROCK].meshIndex + (GetRandomControl() & 7);
|
||||
fx->objectNumber = ID_IMP_ROCK;
|
||||
fx->shade = 16912;
|
||||
fx->counter = 0;
|
||||
fx->frameNumber = fxNum;
|
||||
|
@ -144,7 +158,7 @@ void ControlImp(short itemNumber)
|
|||
info.xAngle = ATAN(d2, d1);
|
||||
|
||||
GetCreatureMood(item, &info, VIOLENT);
|
||||
if (item->currentAnimState == 6)
|
||||
if (item->currentAnimState == STATE_IMP_SCARED)
|
||||
creature->mood = ESCAPE_MOOD;
|
||||
|
||||
CreatureMood(item, &info, VIOLENT);
|
||||
|
@ -162,66 +176,66 @@ void ControlImp(short itemNumber)
|
|||
|
||||
switch (item->currentAnimState)
|
||||
{
|
||||
case 0:
|
||||
case STATE_IMP_WALK:
|
||||
creature->maximumTurn = ANGLE(7);
|
||||
if (info.distance <= SQUARE(2048))
|
||||
{
|
||||
if (info.distance < SQUARE(2048))
|
||||
item->goalAnimState = 1;
|
||||
item->goalAnimState = STATE_IMP_STOP;
|
||||
}
|
||||
else
|
||||
{
|
||||
item->goalAnimState = 2;
|
||||
item->goalAnimState = STATE_IMP_RUN;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
case STATE_IMP_STOP:
|
||||
creature->maximumTurn = -1;
|
||||
creature->flags = 0;
|
||||
if (info.bite && info.distance < SQUARE(170) && item->triggerFlags < 10)
|
||||
{
|
||||
if (GetRandomControl() & 1)
|
||||
item->goalAnimState = 3;
|
||||
item->goalAnimState = STATE_IMP_ATTACK1;
|
||||
else
|
||||
item->goalAnimState = 5;
|
||||
item->goalAnimState = STATE_IMP_ATTACK2;
|
||||
}
|
||||
else if (item->aiBits & FOLLOW)
|
||||
{
|
||||
item->goalAnimState = 0;
|
||||
item->goalAnimState = STATE_IMP_WALK;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item->triggerFlags == 3)
|
||||
{
|
||||
item->goalAnimState = 11;
|
||||
item->goalAnimState = STATE_IMP_THROW_STONES;
|
||||
}
|
||||
else if (info.distance <= SQUARE(2048))
|
||||
{
|
||||
if (info.distance > SQUARE(512) || item->triggerFlags < 10)
|
||||
item->goalAnimState = 0;
|
||||
item->goalAnimState = STATE_IMP_WALK;
|
||||
}
|
||||
else
|
||||
{
|
||||
item->goalAnimState = 2;
|
||||
item->goalAnimState = STATE_IMP_RUN;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case STATE_IMP_RUN:
|
||||
creature->maximumTurn = ANGLE(7);
|
||||
if (info.distance >= SQUARE(512))
|
||||
{
|
||||
if (info.distance < SQUARE(2048))
|
||||
item->goalAnimState = 0;
|
||||
item->goalAnimState = STATE_IMP_WALK;
|
||||
}
|
||||
else
|
||||
{
|
||||
item->goalAnimState = 1;
|
||||
item->goalAnimState = STATE_IMP_STOP;
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
case 5:
|
||||
case STATE_IMP_ATTACK1:
|
||||
case STATE_IMP_ATTACK2:
|
||||
creature->maximumTurn = -1;
|
||||
if (creature->flags == 0
|
||||
&& item->touchBits & 0x280)
|
||||
|
@ -232,18 +246,18 @@ void ControlImp(short itemNumber)
|
|||
}
|
||||
break;
|
||||
|
||||
case 6:
|
||||
case STATE_IMP_SCARED:
|
||||
creature->maximumTurn = ANGLE(7);
|
||||
if (TorchRoom != 11)
|
||||
item->goalAnimState = 1;
|
||||
item->goalAnimState = STATE_IMP_STOP;
|
||||
break;
|
||||
|
||||
case 7:
|
||||
case 8:
|
||||
case STATE_IMP_START_CLIMB:
|
||||
case STATE_IMP_START_ROLL:
|
||||
creature->maximumTurn = 0;
|
||||
break;
|
||||
|
||||
case 11:
|
||||
case STATE_IMP_THROW_STONES:
|
||||
creature->maximumTurn = -1;
|
||||
if (item->frameNumber - Anims[item->animNumber].frameBase == 40)
|
||||
ImpThrowStones(item);
|
||||
|
@ -257,10 +271,10 @@ void ControlImp(short itemNumber)
|
|||
else
|
||||
{
|
||||
item->hitPoints = 0;
|
||||
if (item->currentAnimState != 9)
|
||||
if (item->currentAnimState != STATE_IMP_DEATH)
|
||||
{
|
||||
item->animNumber = Objects[ID_IMP].animIndex + 45;
|
||||
item->currentAnimState = 9;
|
||||
item->animNumber = Objects[ID_IMP].animIndex + ANIMATION_IMP_DEATH;
|
||||
item->currentAnimState = STATE_IMP_DEATH;
|
||||
item->frameNumber = Anims[item->animNumber].frameBase;
|
||||
}
|
||||
}
|
||||
|
@ -282,7 +296,7 @@ void ControlImp(short itemNumber)
|
|||
}
|
||||
|
||||
if (TorchRoom == 11)
|
||||
item->goalAnimState = 6;
|
||||
item->goalAnimState = STATE_IMP_SCARED;
|
||||
|
||||
CreatureTilt(item, 0);
|
||||
CreatureJoint(item, 1, joint1);
|
||||
|
|
|
@ -5,4 +5,199 @@
|
|||
#include "../../Game/sphere.h"
|
||||
#include "../../Game/tomb4fx.h"
|
||||
#include "../../Game/effect2.h"
|
||||
#include "../../Game/draw.h"
|
||||
#include "../../Game/effects.h"
|
||||
#include "../../Game/traps.h"
|
||||
|
||||
void MissileControl(short itemNumber)
|
||||
{
|
||||
FX_INFO* fx = &Effects[itemNumber];
|
||||
if (fx->flag1 == 2)
|
||||
{
|
||||
fx->pos.zRot += 16 * fx->speed;
|
||||
|
||||
if (fx->speed > 64)
|
||||
fx->speed -= 4;
|
||||
|
||||
if (fx->pos.xRot > -12288)
|
||||
{
|
||||
if (fx->fallspeed < 512)
|
||||
fx->fallspeed += 36;
|
||||
fx->pos.xRot -= fx->fallspeed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
short angles[2];
|
||||
phd_GetVectorAngles(
|
||||
LaraItem->pos.xPos - fx->pos.xPos,
|
||||
LaraItem->pos.yPos - fx->pos.yPos - 256,
|
||||
LaraItem->pos.zPos - fx->pos.zPos,
|
||||
angles);
|
||||
|
||||
int dh;
|
||||
if (fx->flag1)
|
||||
{
|
||||
dh = fx->flag1 != 1 ? 768 : 384;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fx->counter)
|
||||
fx->counter--;
|
||||
dh = 256;
|
||||
}
|
||||
|
||||
if (fx->speed < 192)
|
||||
{
|
||||
if (fx->flag1 == 0 || fx->flag1 == 1)
|
||||
fx->speed++;
|
||||
|
||||
int dy = abs(angles[0] - fx->pos.yRot) >> 3;
|
||||
int dx = abs(angles[1] - fx->pos.xRot) >> 3;
|
||||
|
||||
if (dy <= dh)
|
||||
{
|
||||
if (dy < -dh)
|
||||
dy = -dh;
|
||||
}
|
||||
else
|
||||
{
|
||||
dy = dh;
|
||||
}
|
||||
|
||||
if (dx <= dh)
|
||||
{
|
||||
if (dx < -dh)
|
||||
dx = -dh;
|
||||
}
|
||||
else
|
||||
{
|
||||
dx = dh;
|
||||
}
|
||||
|
||||
fx->pos.yRot += dy;
|
||||
fx->pos.xRot += dx;
|
||||
}
|
||||
|
||||
fx->pos.zRot += 16 * fx->speed;
|
||||
|
||||
if (!fx->flag1)
|
||||
fx->pos.zRot += 16 * fx->speed;
|
||||
}
|
||||
|
||||
int x = fx->pos.xPos;
|
||||
int y = fx->pos.yPos;
|
||||
int z = fx->pos.zPos;
|
||||
|
||||
int c = fx->speed * COS(fx->pos.xRot) >> W2V_SHIFT;
|
||||
|
||||
fx->pos.xPos += c * SIN(fx->pos.yRot) >> W2V_SHIFT;
|
||||
fx->pos.yPos += fx->speed * SIN(-fx->pos.xRot) >> W2V_SHIFT;
|
||||
fx->pos.zPos += c * COS(fx->pos.yRot) >> W2V_SHIFT;
|
||||
|
||||
short roomNumber = fx->roomNumber;
|
||||
FLOOR_INFO* floor = GetFloor(fx->pos.xPos, fx->pos.yPos, fx->pos.zPos, &roomNumber);
|
||||
int fh = GetFloorHeight(floor, fx->pos.xPos, fx->pos.yPos, fx->pos.zPos);
|
||||
int ch = GetCeiling(floor, fx->pos.xPos, fx->pos.yPos, fx->pos.zPos);
|
||||
|
||||
if (fx->pos.yPos >= fh || fx->pos.yPos <= ch)
|
||||
{
|
||||
fx->pos.xPos = x;
|
||||
fx->pos.yPos = y;
|
||||
fx->pos.zPos = z;
|
||||
|
||||
if (fx->flag1)
|
||||
{
|
||||
if (fx->flag1 == 1)
|
||||
{
|
||||
TriggerExplosionSparks(x, y, z, 3, -2, 2, fx->roomNumber);
|
||||
fx->pos.yPos -= 64;
|
||||
//TriggerShockwave((PHD_VECTOR*)fx, 16777264, 64, 402686016, 0x10000);
|
||||
fx->pos.yPos -= 128;
|
||||
//TriggerShockwave((PHD_VECTOR*)fx, 15728688, 48, 402686016, 0x10000);
|
||||
}
|
||||
else if (fx->flag1 == 2)
|
||||
{
|
||||
//ExplodeFX(fx, 0, 32);
|
||||
SoundEffect(251, &fx->pos, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TriggerExplosionSparks(x, y, z, 3, -2, 0, fx->roomNumber);
|
||||
//TriggerShockwave(fx, 15728688, 48, 411066368, 0x20000);
|
||||
}
|
||||
|
||||
KillEffect(itemNumber);
|
||||
}
|
||||
else if (ItemNearLara((PHD_3DPOS*)fx, 200))
|
||||
{
|
||||
LaraItem->hitStatus = true;
|
||||
|
||||
if (fx->flag1)
|
||||
{
|
||||
if (fx->flag1 == 1)
|
||||
{
|
||||
TriggerExplosionSparks(x, y, z, 3, -2, 2, fx->roomNumber);
|
||||
fx->pos.yPos -= 64;
|
||||
//TriggerShockwave(fx, 16777264, 64, 402686016, 0x10000);
|
||||
fx->pos.yPos -= 128;
|
||||
//TriggerShockwave(fx, 15728688, 48, 402686016, 0x10000);
|
||||
LaraItem->hitPoints -= 200;
|
||||
KillEffect(itemNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fx->flag1 == 2)
|
||||
{
|
||||
//ExplodeFX(fx, 0, 32);
|
||||
LaraItem->hitPoints -= 50;
|
||||
DoBloodSplat(fx->pos.xPos, fx->pos.yPos, fx->pos.zPos, (GetRandomControl() & 3) + 2, LaraItem->pos.yRot, LaraItem->roomNumber);
|
||||
SoundEffect(251, &fx->pos, 0);
|
||||
SoundEffect(31, &LaraItem->pos, 0);
|
||||
}
|
||||
|
||||
KillEffect(itemNumber);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TriggerExplosionSparks(x, y, z, 3, -2, 0, fx->roomNumber);
|
||||
//TriggerShockwave(fx, 15728688, 48, 411066368, 0);
|
||||
if (LaraItem->hitPoints >= 500)
|
||||
LaraItem->hitPoints -= 300;
|
||||
else
|
||||
LaraBurn();
|
||||
KillEffect(itemNumber);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (roomNumber != fx->roomNumber)
|
||||
EffectNewRoom(itemNumber, roomNumber);
|
||||
|
||||
if (GlobalCounter & 1)
|
||||
{
|
||||
PHD_VECTOR pos;
|
||||
pos.x = x;
|
||||
pos.y = y;
|
||||
pos.z = z;
|
||||
|
||||
int xv = x - fx->pos.xPos;
|
||||
int yv = y - fx->pos.yPos;
|
||||
int zv = z - fx->pos.zPos;
|
||||
|
||||
if (fx->flag1)
|
||||
{
|
||||
if (fx->flag1 == 1)
|
||||
TriggerRomanStatueMissileSparks(&pos, itemNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
TriggerHydraMissileSparks(&pos, 4 * xv, 4 * yv, 4 * zv);
|
||||
TriggerHydraMissileSparks((PHD_VECTOR*)&fx, 4 * xv, 4 * yv, 4 * zv);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -917,3 +917,37 @@ void RomanStatueAttack(PHD_3DPOS* pos, short roomNumber, short count)
|
|||
fx->frameNumber = Objects[ID_BUBBLES].meshIndex + 16;
|
||||
}
|
||||
}
|
||||
|
||||
void TriggerRomanStatueMissileSparks(PHD_VECTOR* pos, char fxObj)
|
||||
{
|
||||
SPARKS* spark = &Sparks[GetFreeSpark()];
|
||||
|
||||
spark->on = 1;
|
||||
spark->sR = 0;
|
||||
spark->sG = (GetRandomControl() & 0x3F) - 96;
|
||||
spark->sB = spark->sG >> 1;
|
||||
spark->dR = 0;
|
||||
spark->dG = (GetRandomControl() & 0x3F) - 96;
|
||||
spark->dB = spark->dG >> 1;
|
||||
spark->fadeToBlack = 8;
|
||||
spark->colFadeSpeed = (GetRandomControl() & 3) + 8;
|
||||
spark->transType = COLADD;
|
||||
spark->dynamic = -1;
|
||||
spark->life = spark->sLife = (GetRandomControl() & 3) + 20;
|
||||
spark->x = pos->x + (GetRandomControl() & 0xF) - 8;
|
||||
spark->y = pos->y + (GetRandomControl() & 0xF) - 8;
|
||||
spark->z = pos->z + (GetRandomControl() & 0xF) - 8;
|
||||
spark->xVel = (GetRandomControl() & 0x3FF) - 512;
|
||||
spark->yVel = (GetRandomControl() & 0x3FF) - 512;
|
||||
spark->zVel = (GetRandomControl() & 0x3FF) - 512;
|
||||
spark->friction = 68;
|
||||
spark->flags = SP_ROTATE | SP_FX | SP_ROTATE | SP_DEF | SP_SCALE;
|
||||
spark->rotAng = GetRandomControl() & 0xFFF;
|
||||
spark->gravity = 0;
|
||||
spark->maxYvel = 0;
|
||||
spark->rotAdd = (GetRandomControl() & 0x3F) - 32;
|
||||
spark->fxObj = fxObj;
|
||||
spark->scalar = 2;
|
||||
spark->sSize = spark->size = (GetRandomControl() & 0xF) + 96;
|
||||
spark->dSize = spark->size >> 2;
|
||||
}
|
|
@ -7,6 +7,8 @@
|
|||
#include "../../Game/collide.h"
|
||||
#include "../../Game/laraflar.h"
|
||||
#include "../../Game/items.h"
|
||||
#include "..\..\Specific\roomload.h"
|
||||
#include "..\..\Specific\roomload.h"
|
||||
|
||||
extern LaraExtraInfo g_LaraExtra;
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "../../Game/sphere.h"
|
||||
#include "../../Game/draw.h"
|
||||
#include "../../Game/misc.h"
|
||||
#include "..\..\Specific\roomload.h"
|
||||
|
||||
extern LaraExtraInfo g_LaraExtra;
|
||||
|
||||
|
|
|
@ -108,6 +108,7 @@ void TriggerRomanStatueShockwaveAttackSparks(int x, int y, int z, int color);
|
|||
void TriggerRomanStatueScreamingSparks(int x, int y, int z, short xv, short yv, short zv, int flags);
|
||||
void TriggerRomanStatueAttackEffect1(short itemNum, int factor);
|
||||
void RomanStatueAttack(PHD_3DPOS* pos, short roomNumber, short count);
|
||||
void TriggerRomanStatueMissileSparks(PHD_VECTOR* pos, char fxObj);
|
||||
void InitialiseRomanStatue(short itemNum);
|
||||
void ControlRomanStatue(short itemNumber);
|
||||
void InitialiseTeleporter(short itemNumber);
|
||||
|
@ -144,6 +145,7 @@ void ControlGunShip(short itemNumber);
|
|||
void ControlHydra(short itemNumber);
|
||||
void TriggerHydraSparks(short itemNumber, int frame);
|
||||
void HydraBubblesAttack(PHD_3DPOS* pos, short roomNumber, int count);
|
||||
void TriggerHydraMissileSparks(PHD_VECTOR* pos, short xv, short yv, short zv);
|
||||
void TriggerAutoGunSmoke(PHD_VECTOR* pos, char shade);
|
||||
void ControlAutoGuns(short itemNumber);
|
||||
void TriggerLaserHeadSparks1(PHD_VECTOR* pos, int count, CVECTOR* color, int unk);
|
||||
|
@ -158,3 +160,4 @@ void ClearRats();
|
|||
void UpdateSpiders();
|
||||
void UpdateRats();
|
||||
void UpdateBats();
|
||||
void MissileControl(short itemNumber);
|
|
@ -393,8 +393,7 @@ void Renderer11::buildHierarchy(RendererObject* obj)
|
|||
}
|
||||
}
|
||||
|
||||
RendererMesh* Renderer11::getRendererMeshFromTrMesh(RendererObject* obj, short* meshPtr, short* refMeshPtr,
|
||||
short boneIndex, int isJoints, int isHairs)
|
||||
RendererMesh* Renderer11::getRendererMeshFromTrMesh(RendererObject* obj, short* meshPtr, short boneIndex, int isJoints, int isHairs)
|
||||
{
|
||||
RendererMesh* mesh = new RendererMesh();
|
||||
|
||||
|
@ -650,10 +649,16 @@ RendererMesh* Renderer11::getRendererMeshFromTrMesh(RendererObject* obj, short*
|
|||
if (normals != NULL) free(normals);
|
||||
if (colors != NULL) free(colors);
|
||||
|
||||
unsigned int castedMeshPtr = reinterpret_cast<unsigned int>(refMeshPtr);
|
||||
unsigned int castedMeshPtr = reinterpret_cast<unsigned int>(basePtr);
|
||||
|
||||
if (m_meshPointersToMesh.find(castedMeshPtr) == m_meshPointersToMesh.end())
|
||||
{
|
||||
m_meshPointersToMesh.insert(pair<unsigned int, RendererMesh*>(castedMeshPtr, mesh));
|
||||
}
|
||||
/*else if (m_meshPointersToMesh[castedMeshPtr] == NULL)
|
||||
{
|
||||
m_meshPointersToMesh[castedMeshPtr] = mesh;
|
||||
}*/
|
||||
|
||||
m_meshes.push_back(mesh);
|
||||
|
||||
|
|
|
@ -839,7 +839,7 @@ private:
|
|||
ID3D11Buffer* createConstantBuffer(int size);
|
||||
int getAnimatedTextureInfo(short textureId);
|
||||
void initialiseHairRemaps();
|
||||
RendererMesh* getRendererMeshFromTrMesh(RendererObject* obj, short* meshPtr, short* refMeshPtr, short boneIndex, int isJoints, int isHairs);
|
||||
RendererMesh* getRendererMeshFromTrMesh(RendererObject* obj, short* meshPtr, short boneIndex, int isJoints, int isHairs);
|
||||
void fromTrAngle(Matrix* matrix, short* frameptr, int index);
|
||||
void buildHierarchy(RendererObject* obj);
|
||||
void buildHierarchyRecursive(RendererObject* obj, RendererBone* node, RendererBone* parentNode);
|
||||
|
@ -878,6 +878,7 @@ private:
|
|||
void drawFires();
|
||||
void drawSparks();
|
||||
void drawSmokes();
|
||||
void drawEnergyArcs();
|
||||
void drawBlood();
|
||||
void drawDrips();
|
||||
void drawBubbles();
|
||||
|
|
|
@ -488,18 +488,21 @@ bool Renderer11::PrepareDataForTheRenderer()
|
|||
// 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,
|
||||
// and vertices have bone index 0 and not 10
|
||||
int meshPtrIndex = RawMeshPointers[obj->meshIndex / 2 + j] / 2;
|
||||
int boneIndex = (meshPtrIndex == 0 ? LM_RHAND : j);
|
||||
int boneIndex = (Meshes[obj->meshIndex + j] == Meshes[0] ? LM_RHAND : j);
|
||||
|
||||
short* meshPtr = &RawMeshData[meshPtrIndex];
|
||||
RendererMesh * mesh = getRendererMeshFromTrMesh(moveable,
|
||||
meshPtr,
|
||||
Meshes[obj->meshIndex + 2 * j],
|
||||
Meshes[obj->meshIndex + j],
|
||||
boneIndex, MoveablesIds[i] == ID_LARA_SKIN_JOINTS,
|
||||
MoveablesIds[i] == ID_LARA_HAIR);
|
||||
moveable->ObjectMeshes.push_back(mesh);
|
||||
}
|
||||
|
||||
if (objNum == ID_IMP_ROCK || objNum == ID_ENERGY_BUBBLES || objNum == ID_BUBBLES)
|
||||
{
|
||||
obj->nmeshes = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int* bone = &Bones[obj->boneIndex];
|
||||
|
||||
stack<RendererBone*> stack;
|
||||
|
@ -671,6 +674,7 @@ bool Renderer11::PrepareDataForTheRenderer()
|
|||
for (int m = 0; m < m_numHairIndices * 2; m++)
|
||||
m_hairIndices.push_back(0);
|
||||
}
|
||||
}
|
||||
|
||||
m_moveableObjects[MoveablesIds[i]] = moveable;
|
||||
|
||||
|
@ -715,8 +719,8 @@ bool Renderer11::PrepareDataForTheRenderer()
|
|||
RendererObject* staticObject = new RendererObject();
|
||||
staticObject->Id = StaticObjectsIds[i];
|
||||
|
||||
short* meshPtr = &RawMeshData[RawMeshPointers[obj->meshNumber / 2] / 2];
|
||||
RendererMesh* mesh = getRendererMeshFromTrMesh(staticObject, meshPtr, Meshes[obj->meshNumber], 0, false, false);
|
||||
short* meshPtr = Meshes[obj->meshNumber];
|
||||
RendererMesh* mesh = getRendererMeshFromTrMesh(staticObject, Meshes[obj->meshNumber], 0, false, false);
|
||||
|
||||
staticObject->ObjectMeshes.push_back(mesh);
|
||||
|
||||
|
@ -744,22 +748,19 @@ bool Renderer11::PrepareDataForTheRenderer()
|
|||
}
|
||||
|
||||
// Create missing meshes (effect objects like ID_BODY_PART have nmeshes = 0 and they are "lost" with current procedures)
|
||||
for (int i = 0; i < NumMeshPointers; i++)
|
||||
/*for (int i = 0; i < NumMeshPointers; i++)
|
||||
{
|
||||
unsigned int mp = reinterpret_cast<unsigned int>(Meshes[i * 2]);
|
||||
RendererMesh* mesh = m_meshPointersToMesh[mp];
|
||||
if (mesh == NULL)
|
||||
unsigned int mp = reinterpret_cast<unsigned int>(Meshes[i]);
|
||||
//RendererMesh* mesh = m_meshPointersToMesh[mp];
|
||||
if (m_meshPointersToMesh.find(mp) == m_meshPointersToMesh.end())
|
||||
{
|
||||
int meshPtrIndex = RawMeshPointers[i] / 2;
|
||||
short* meshPtr = &RawMeshData[meshPtrIndex];
|
||||
RendererMesh* mesh = getRendererMeshFromTrMesh(NULL,
|
||||
meshPtr,
|
||||
Meshes[i * 2],
|
||||
Meshes[i],
|
||||
0,
|
||||
false,
|
||||
false);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// Create a single vertex buffer and a single index buffer for all statics
|
||||
m_staticsVertexBuffer = VertexBuffer::Create(m_device, staticsVertices.size(), staticsVertices.data());
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "../Game/tomb4fx.h"
|
||||
#include "../Game/door.h"
|
||||
#include "../Objects/oldobjects.h"
|
||||
#include "..\Specific\roomload.h"
|
||||
|
||||
extern GUNSHELL_STRUCT Gunshells[MAX_GUNSHELL];
|
||||
extern RendererHUDBar* g_DashBar;
|
||||
|
@ -1480,7 +1481,7 @@ bool Renderer11::drawRats()
|
|||
|
||||
if (rat->on)
|
||||
{
|
||||
short* meshPtr = Meshes[Objects[ID_RATS_EMITTER].meshIndex + (((i + Wibble) >> 2) & 0xE)];
|
||||
short* meshPtr = Meshes[Objects[ID_RATS_EMITTER].meshIndex + (((i + Wibble) >> 1) & 0xE)];
|
||||
RendererMesh * mesh = m_meshPointersToMesh[reinterpret_cast<unsigned int>(meshPtr)];
|
||||
Matrix translation = Matrix::CreateTranslation(rat->pos.xPos, rat->pos.yPos, rat->pos.zPos);
|
||||
Matrix rotation = Matrix::CreateFromYawPitchRoll(rat->pos.yRot, rat->pos.xRot, rat->pos.zRot);
|
||||
|
@ -1522,7 +1523,7 @@ bool Renderer11::drawBats()
|
|||
{
|
||||
OBJECT_INFO* obj = &Objects[ID_BATS_EMITTER];
|
||||
RendererObject* moveableObj = m_moveableObjects[ID_BATS_EMITTER];
|
||||
short* meshPtr = Meshes[Objects[ID_BATS_EMITTER].meshIndex + 2 * (-GlobalCounter & 3)];
|
||||
short* meshPtr = Meshes[Objects[ID_BATS_EMITTER].meshIndex + (-GlobalCounter & 3)];
|
||||
RendererMesh* mesh = m_meshPointersToMesh[reinterpret_cast<unsigned int>(meshPtr)];
|
||||
|
||||
for (int m = 0; m < 32; m++)
|
||||
|
@ -2009,8 +2010,7 @@ bool Renderer11::drawScene(bool dump)
|
|||
drawUnderwaterDust();
|
||||
drawSplahes();
|
||||
drawShockwaves();
|
||||
|
||||
|
||||
drawEnergyArcs();
|
||||
|
||||
switch (level->Weather)
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "../Game/footprint.h"
|
||||
#include "../Game/effect2.h"
|
||||
#include "../Game/sphere.h"
|
||||
#include "../Game/tomb4fx.h"
|
||||
#include "../Game/lara.h"
|
||||
#include "../Game/draw.h"
|
||||
|
||||
|
@ -16,8 +17,10 @@ extern GUNFLASH_STRUCT Gunflashes[MAX_GUNFLASH]; // offset 0xA31D8
|
|||
extern SPARKS Sparks[MAX_SPARKS];
|
||||
extern SPLASH_STRUCT Splashes[MAX_SPLASH];
|
||||
extern RIPPLE_STRUCT Ripples[MAX_RIPPLES];
|
||||
extern ENERGY_ARC EnergyArcs[MAX_ENERGY_ARCS];
|
||||
extern std::deque<FOOTPRINT_STRUCT> footprints;
|
||||
extern int g_NumSprites;
|
||||
|
||||
void Renderer11::AddSprite3D(RendererSprite* sprite, Vector3 vtx1, Vector3 vtx2, Vector3 vtx3, Vector3 vtx4, Vector4 color, float rotation, float scale, float width, float height, BLEND_MODES blendMode)
|
||||
{
|
||||
if (m_nextSprite >= MAX_SPRITES)
|
||||
|
@ -46,6 +49,34 @@ void Renderer11::AddSprite3D(RendererSprite* sprite, Vector3 vtx1, Vector3 vtx2,
|
|||
m_spritesToDraw.push_back(spr);
|
||||
}
|
||||
|
||||
RendererLine3D ArcBuffer[1024];
|
||||
|
||||
void Renderer11::drawEnergyArcs()
|
||||
{
|
||||
for (int i = 0; i < MAX_ENERGY_ARCS; i++)
|
||||
{
|
||||
ENERGY_ARC* arc = &EnergyArcs[i];
|
||||
|
||||
if (arc->life > 0)
|
||||
{
|
||||
Vector3 pos1 = Vector3(arc->pos1.x, arc->pos1.y, arc->pos1.z);
|
||||
Vector3 pos2 = Vector3(arc->pos4.x, arc->pos4.y, arc->pos4.z);
|
||||
|
||||
float length = Vector3::Distance(pos1, pos2);
|
||||
int numSegments = (length / arc->segmentSize) + 1;
|
||||
|
||||
Vector3 pos = pos1;
|
||||
Vector3 dp = Vector3(pos2.x - pos1.x, pos2.y - pos1.y, pos2.z - pos1.z);
|
||||
|
||||
for (int j = 1; j < numSegments; j++)
|
||||
{
|
||||
AddLine3D(pos, pos + dp, Vector4(arc->r / 255.0f, arc->g / 255.0f, arc->b / 255.0f, 1.0f));
|
||||
pos = pos + dp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Renderer11::drawSmokes()
|
||||
{
|
||||
for (int i = 0; i < 32; i++)
|
||||
|
@ -803,7 +834,7 @@ bool Renderer11::drawEffect(RendererEffect* effect, bool transparent)
|
|||
int lastBucket = (transparent ? 4 : 2);
|
||||
|
||||
RendererRoom & const room = m_rooms[effect->Effect->roomNumber];
|
||||
RendererObject * moveableObj = m_moveableObjects[effect->Effect->objectNumber];
|
||||
//RendererObject * moveableObj = m_moveableObjects[effect->Effect->objectNumber];
|
||||
|
||||
m_stItem.World = effect->World.Transpose();
|
||||
m_stItem.Position = Vector4(effect->Effect->pos.xPos, effect->Effect->pos.yPos, effect->Effect->pos.zPos, 1.0f);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "Renderer11.h"
|
||||
#include "../Game/draw.h"
|
||||
#include "../Game/camera.h"
|
||||
#include "..\Specific\roomload.h"
|
||||
|
||||
void Renderer11::collectRooms()
|
||||
{
|
||||
|
@ -441,7 +442,7 @@ void Renderer11::collectEffects(short roomNumber)
|
|||
newEffect->Effect = fx;
|
||||
newEffect->Id = fxNum;
|
||||
newEffect->World = Matrix::CreateTranslation(fx->pos.xPos, fx->pos.yPos, fx->pos.zPos);
|
||||
newEffect->Mesh = m_meshPointersToMesh[reinterpret_cast<unsigned int>(Meshes[0 (obj->nmeshes ? obj->meshIndex : fx->frameNumber * 2)])];
|
||||
newEffect->Mesh = m_meshPointersToMesh[reinterpret_cast<unsigned int>(Meshes[(obj->nmeshes ? obj->meshIndex : fx->frameNumber)])];
|
||||
|
||||
collectLightsForEffect(fx->roomNumber, newEffect);
|
||||
|
||||
|
|
|
@ -43,6 +43,8 @@ int NumStaticObjects;
|
|||
int NumMeshPointers;
|
||||
int NumObjectTextures;
|
||||
int NumTextureTiles;
|
||||
short* MeshBase;
|
||||
short** Meshes;
|
||||
|
||||
uintptr_t hLoadLevel;
|
||||
unsigned int ThreadId;
|
||||
|
@ -185,20 +187,17 @@ void LoadObjects()
|
|||
|
||||
MeshBase = (short*)GameMalloc(numMeshDataBytes);
|
||||
ReadBytes(MeshBase, numMeshDataBytes);
|
||||
RawMeshData = (short*)malloc(numMeshDataBytes);
|
||||
memcpy(RawMeshData, MeshBase, numMeshDataBytes);
|
||||
|
||||
MeshDataSize = numMeshDataBytes;
|
||||
|
||||
// TR5 functions do something strange with meshes so I save just for me raw meshes and raw mesh pointers
|
||||
int numMeshPointers = ReadInt32();
|
||||
Meshes = (short**)GameMalloc(8 * numMeshPointers);
|
||||
RawMeshPointers = (int*)malloc(4 * numMeshPointers);
|
||||
ReadBytes(RawMeshPointers, 4 * numMeshPointers);
|
||||
memcpy(Meshes, RawMeshPointers, 4 * numMeshPointers);
|
||||
Meshes = (short**)GameMalloc(4 * numMeshPointers);
|
||||
ReadBytes(Meshes, 4 * numMeshPointers);
|
||||
|
||||
for (int i = 0; i < numMeshPointers; i++)
|
||||
{
|
||||
Meshes[i] = &MeshBase[(int)Meshes[i] / 2];
|
||||
}
|
||||
|
||||
int numMeshes = numMeshPointers;
|
||||
NumMeshPointers = numMeshes;
|
||||
|
@ -267,19 +266,6 @@ void LoadObjects()
|
|||
Objects[objNum].loaded = true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < ID_NUMBER_OBJECTS; i++)
|
||||
{
|
||||
Objects[i].meshIndex *= 2;
|
||||
}
|
||||
|
||||
memcpy(&Meshes[numMeshes], &Meshes[0], sizeof(short*) * numMeshes);
|
||||
|
||||
for (int i = 0; i < numMeshes; i++)
|
||||
{
|
||||
Meshes[2 * i] = Meshes[numMeshes + i];
|
||||
Meshes[2 * i + 1] = Meshes[numMeshes + i];
|
||||
}
|
||||
|
||||
InitialiseObjects();
|
||||
InitialiseClosedDoors();
|
||||
|
||||
|
@ -309,11 +295,6 @@ void LoadObjects()
|
|||
StaticObjects[meshID].flags = ReadInt16();
|
||||
}
|
||||
|
||||
for (int i = 0; i < NUM_STATICS; i++)
|
||||
{
|
||||
StaticObjects[i].meshNumber *= 2;
|
||||
}
|
||||
|
||||
// HACK: to remove after decompiling LoadSprites
|
||||
MoveablesIds.push_back(ID_DEFAULT_SPRITES);
|
||||
}
|
||||
|
|
|
@ -30,11 +30,11 @@ struct LEB128;
|
|||
#define LoadAIObjects ((void (__cdecl*)()) 0x004A67F0)
|
||||
#define LoadDemoData ((void (__cdecl*)()) 0x004A67D0)
|
||||
//#define LoadSamples ((void (__cdecl*)()) 0x004A6880)
|
||||
#define InitialiseLaraLoad ((void (__cdecl*)(short)) 0x004568C0)
|
||||
//#define InitialiseLaraLoad ((void (__cdecl*)(short)) 0x004568C0)
|
||||
#define LoadRooms ((void (__cdecl*)()) 0x004A4DA0)
|
||||
#define InitialiseGameStuff ((void (__cdecl*)()) 0x004778F0)
|
||||
#define InitialiseLaraMeshes ((void (__cdecl*)()) 0x00455680)
|
||||
#define InitialiseLaraAnims ((void (__cdecl*)(ITEM_INFO*)) 0x00456900)
|
||||
//#define InitialiseLaraAnims ((void (__cdecl*)(ITEM_INFO*)) 0x00456900)
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -59,6 +59,8 @@ extern int IsLevelLoading;
|
|||
extern int NumTextureTiles;
|
||||
extern int g_NumSprites;
|
||||
extern int g_NumSpritesSequences;
|
||||
extern short* MeshBase;
|
||||
extern short** Meshes;
|
||||
|
||||
void LoadTextures();
|
||||
int LoadRoomsNew();
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include "..\Game\hydra.h"
|
||||
#include "..\Game\guardian.h"
|
||||
|
||||
#include "roomload.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -188,9 +190,9 @@ void NewObjects()
|
|||
Bones[obj->boneIndex + 88 * 4] |= ROT_Y;
|
||||
Bones[obj->boneIndex + 88 * 4] |= ROT_X;
|
||||
|
||||
/*Meshes[obj->meshIndex + 18 * 2] = Meshes[Objects[ID_MESHSWAP_BADDY1].meshIndex + 16 * 2];
|
||||
Meshes[obj->meshIndex + 30 * 2] = Meshes[Objects[ID_MESHSWAP_BADDY1].meshIndex + 28 * 2];
|
||||
Meshes[obj->meshIndex + 18 * 2] = Meshes[Objects[ID_MESHSWAP_BADDY1].meshIndex + 11 * 2];*/
|
||||
/*Meshes[obj->meshIndex + 18] = Meshes[Objects[ID_MESHSWAP_BADDY1].meshIndex + 16];
|
||||
Meshes[obj->meshIndex + 30] = Meshes[Objects[ID_MESHSWAP_BADDY1].meshIndex + 28];
|
||||
Meshes[obj->meshIndex + 18] = Meshes[Objects[ID_MESHSWAP_BADDY1].meshIndex + 11];*/
|
||||
}
|
||||
|
||||
obj = &Objects[ID_BADDY2];
|
||||
|
@ -929,9 +931,9 @@ void NewObjects()
|
|||
Bones[obj->boneIndex + 20 * 4] |= ROT_X | ROT_Y;
|
||||
|
||||
// TODO: check if constants are byte, short or int
|
||||
Meshes[obj->meshIndex + 60 * 2] = Meshes[Objects[ID_MESHSWAP2].meshIndex + 60 * 2];
|
||||
Meshes[obj->meshIndex + 72 * 2] = Meshes[Objects[ID_MESHSWAP2].meshIndex + 72 * 2];
|
||||
Meshes[obj->meshIndex + 84 * 2] = Meshes[Objects[ID_MESHSWAP2].meshIndex + 84 * 2];
|
||||
Meshes[obj->meshIndex + 60] = Meshes[Objects[ID_MESHSWAP2].meshIndex + 60];
|
||||
Meshes[obj->meshIndex + 72] = Meshes[Objects[ID_MESHSWAP2].meshIndex + 72];
|
||||
Meshes[obj->meshIndex + 84] = Meshes[Objects[ID_MESHSWAP2].meshIndex + 84];
|
||||
}
|
||||
|
||||
obj = &Objects[ID_CROCODILE];
|
||||
|
@ -1217,8 +1219,8 @@ void BaddyObjects()
|
|||
Bones[obj->boneIndex + 6 * 4] |= ROT_X;
|
||||
Bones[obj->boneIndex + 13 * 4] |= ROT_Y;
|
||||
Bones[obj->boneIndex + 13 * 4] |= ROT_X;
|
||||
//Meshes[obj->meshIndex + 10 * 2] = Meshes[Objects[ID_MESHSWAP1].meshIndex + 10 * 2];
|
||||
//Meshes[obj->meshIndex + 13 * 2] = Meshes[Objects[ID_MESHSWAP1].meshIndex + 13 * 2];
|
||||
//Meshes[obj->meshIndex + 10] = Meshes[Objects[ID_MESHSWAP1].meshIndex + 10];
|
||||
//Meshes[obj->meshIndex + 13] = Meshes[Objects[ID_MESHSWAP1].meshIndex + 13];
|
||||
}
|
||||
|
||||
obj = &Objects[ID_GUARD1];
|
||||
|
@ -1247,8 +1249,8 @@ void BaddyObjects()
|
|||
Bones[obj->boneIndex + 6 * 4] |= ROT_X;
|
||||
Bones[obj->boneIndex + 13 * 4] |= ROT_Y;
|
||||
Bones[obj->boneIndex + 13 * 4] |= ROT_X;
|
||||
Meshes[obj->meshIndex + 10 * 2] = Meshes[Objects[ID_MESHSWAP1].meshIndex + 10 * 2];
|
||||
Meshes[obj->meshIndex + 13 * 2] = Meshes[Objects[ID_MESHSWAP1].meshIndex + 13 * 2];
|
||||
Meshes[obj->meshIndex + 10] = Meshes[Objects[ID_MESHSWAP1].meshIndex + 10];
|
||||
Meshes[obj->meshIndex + 13] = Meshes[Objects[ID_MESHSWAP1].meshIndex + 13];
|
||||
}
|
||||
|
||||
obj = &Objects[ID_SWAT_PLUS];
|
||||
|
@ -1280,8 +1282,8 @@ void BaddyObjects()
|
|||
Bones[obj->boneIndex + 6 * 4] |= ROT_X;
|
||||
Bones[obj->boneIndex + 13 * 4] |= ROT_Y;
|
||||
Bones[obj->boneIndex + 13 * 4] |= ROT_X;
|
||||
//Meshes[obj->meshIndex + 10 * 2] = Meshes[Objects[ID_MESHSWAP1].meshIndex + 10 * 2];
|
||||
//Meshes[obj->meshIndex + 13 * 2] = Meshes[Objects[ID_MESHSWAP1].meshIndex + 13 * 2];
|
||||
//Meshes[obj->meshIndex + 10] = Meshes[Objects[ID_MESHSWAP1].meshIndex + 10];
|
||||
//Meshes[obj->meshIndex + 13] = Meshes[Objects[ID_MESHSWAP1].meshIndex + 13];
|
||||
}
|
||||
|
||||
obj = &Objects[ID_MAFIA];
|
||||
|
@ -1314,8 +1316,8 @@ void BaddyObjects()
|
|||
Bones[obj->boneIndex + 6 * 4] |= ROT_X;
|
||||
Bones[obj->boneIndex + 13 * 4] |= ROT_Y;
|
||||
Bones[obj->boneIndex + 13 * 4] |= ROT_X;
|
||||
Meshes[obj->meshIndex + 10 * 2] = Meshes[Objects[ID_MESHSWAP1].meshIndex + 10 * 2];
|
||||
Meshes[obj->meshIndex + 13 * 2] = Meshes[Objects[ID_MESHSWAP1].meshIndex + 13 * 2];
|
||||
Meshes[obj->meshIndex + 10] = Meshes[Objects[ID_MESHSWAP1].meshIndex + 10];
|
||||
Meshes[obj->meshIndex + 13] = Meshes[Objects[ID_MESHSWAP1].meshIndex + 13];
|
||||
}
|
||||
|
||||
obj = &Objects[ID_SCIENTIST];
|
||||
|
@ -1345,8 +1347,8 @@ void BaddyObjects()
|
|||
Bones[Objects[69].boneIndex + 6 * 4] |= ROT_X;
|
||||
Bones[Objects[69].boneIndex + 13 * 4] |= ROT_Y;
|
||||
Bones[Objects[69].boneIndex + 13 * 4] |= ROT_X;
|
||||
//Meshes[Objects[69].meshIndex + 10 * 2] = Meshes[Objects[ID_MESHSWAP1].meshIndex + 10 * 2];
|
||||
//Meshes[Objects[69].meshIndex + 13 * 2] = Meshes[Objects[ID_MESHSWAP1].meshIndex + 13 * 2];
|
||||
//Meshes[Objects[69].meshIndex + 10] = Meshes[Objects[ID_MESHSWAP1].meshIndex + 10];
|
||||
//Meshes[Objects[69].meshIndex + 13] = Meshes[Objects[ID_MESHSWAP1].meshIndex + 13];
|
||||
}
|
||||
|
||||
obj = &Objects[ID_GUARD2];
|
||||
|
@ -1379,8 +1381,8 @@ void BaddyObjects()
|
|||
Bones[obj->boneIndex + 6 * 4] |= ROT_X;
|
||||
Bones[obj->boneIndex + 13 * 4] |= ROT_Y;
|
||||
Bones[obj->boneIndex + 13 * 4] |= ROT_X;
|
||||
Meshes[obj->meshIndex + 10 * 2] = Meshes[Objects[405].meshIndex + 10 * 2];
|
||||
Meshes[obj->meshIndex + 13 * 2] = Meshes[Objects[405].meshIndex + 13 * 2];
|
||||
Meshes[obj->meshIndex + 10] = Meshes[Objects[405].meshIndex + 10];
|
||||
Meshes[obj->meshIndex + 13] = Meshes[Objects[405].meshIndex + 13];
|
||||
}
|
||||
|
||||
obj = &Objects[ID_GUARD3];
|
||||
|
@ -1413,8 +1415,8 @@ void BaddyObjects()
|
|||
Bones[obj->boneIndex + 6 * 4] |= ROT_X;
|
||||
Bones[obj->boneIndex + 13 * 4] |= ROT_Y;
|
||||
Bones[obj->boneIndex + 13 * 4] |= ROT_X;
|
||||
Meshes[obj->meshIndex + 10 * 2] = Meshes[Objects[405].meshIndex + 10 * 2];
|
||||
Meshes[obj->meshIndex + 13 * 2] = Meshes[Objects[405].meshIndex + 13 * 2];
|
||||
Meshes[obj->meshIndex + 10] = Meshes[Objects[405].meshIndex + 10];
|
||||
Meshes[obj->meshIndex + 13] = Meshes[Objects[405].meshIndex + 13];
|
||||
}
|
||||
|
||||
obj = &Objects[ID_ATTACK_SUB];
|
||||
|
@ -1545,9 +1547,9 @@ void BaddyObjects()
|
|||
Bones[obj->boneIndex + 13 * 4] |= ROT_Y;
|
||||
Bones[obj->boneIndex + 13 * 4] |= ROT_X;
|
||||
|
||||
/*Meshes[obj->meshIndex + 7 * 2] = Meshes[Objects[ID_MESHSWAP_MAFIA2].meshIndex + 7 * 2];
|
||||
Meshes[obj->meshIndex + 10 * 2] = Meshes[Objects[ID_MESHSWAP_MAFIA2].meshIndex + 10 * 2];
|
||||
Meshes[obj->meshIndex + 13 * 2] = Meshes[Objects[ID_MESHSWAP_MAFIA2].meshIndex + 13 * 2];*/
|
||||
/*Meshes[obj->meshIndex + 7] = Meshes[Objects[ID_MESHSWAP_MAFIA2].meshIndex + 7];
|
||||
Meshes[obj->meshIndex + 10] = Meshes[Objects[ID_MESHSWAP_MAFIA2].meshIndex + 10];
|
||||
Meshes[obj->meshIndex + 13] = Meshes[Objects[ID_MESHSWAP_MAFIA2].meshIndex + 13];*/
|
||||
}
|
||||
|
||||
obj = &Objects[ID_PIERRE];
|
||||
|
@ -1674,7 +1676,7 @@ void BaddyObjects()
|
|||
Bones[obj->boneIndex] |= ROT_X;
|
||||
Bones[obj->boneIndex + 4] |= ROT_Y;
|
||||
Bones[obj->boneIndex + 4] |= ROT_X;
|
||||
Meshes[obj->meshIndex + 10 * 2] = Meshes[Objects[ID_MESHSWAP1].meshIndex + 2 * 2];
|
||||
Meshes[obj->meshIndex + 10] = Meshes[Objects[ID_MESHSWAP1].meshIndex + 2];
|
||||
}
|
||||
|
||||
obj = &Objects[ID_HYDRA];
|
||||
|
@ -1725,7 +1727,7 @@ void BaddyObjects()
|
|||
Bones[obj->meshIndex + 9 * 4] |= ROT_Z;
|
||||
Bones[obj->meshIndex + 9 * 4] |= ROT_X;
|
||||
|
||||
//Meshes[obj->meshIndex + 10 * 2] = Meshes[Objects[ID_MESHSWAP_IMP].meshIndex + 10 * 2];
|
||||
//Meshes[obj->meshIndex + 10] = Meshes[Objects[ID_MESHSWAP_IMP].meshIndex + 10];
|
||||
}
|
||||
|
||||
obj = &Objects[ID_WILLOWISP];
|
||||
|
@ -1882,7 +1884,7 @@ void BaddyObjects()
|
|||
|
||||
for (int i = (obj->nmeshes - 1); i > 0; i--)
|
||||
{
|
||||
Meshes[obj->meshIndex + i * 2] = Meshes[Objects[ID_MESHSWAP1].meshIndex + i * 2];
|
||||
Meshes[obj->meshIndex + i] = Meshes[Objects[ID_MESHSWAP1].meshIndex + i];
|
||||
}
|
||||
/*
|
||||
do
|
||||
|
@ -1921,7 +1923,7 @@ void BaddyObjects()
|
|||
|
||||
/*for (int i = (obj->nmeshes - 1); i > 0; i--)
|
||||
{
|
||||
Meshes[obj->meshIndex + i * 2] = Meshes[Objects[ID_MESHSWAP_ROMAN_GOD].meshIndex + i * 2];
|
||||
Meshes[obj->meshIndex + i] = Meshes[Objects[ID_MESHSWAP_ROMAN_GOD].meshIndex + i];
|
||||
}
|
||||
|
||||
do
|
||||
|
@ -2708,11 +2710,17 @@ void ObjectObjects()
|
|||
obj = &Objects[ID_BUBBLES];
|
||||
if (obj->loaded)
|
||||
{
|
||||
obj->control = ControlEnemyMissile;
|
||||
//obj->drawRoutine = true;
|
||||
obj->control = MissileControl;
|
||||
obj->nmeshes = 0;
|
||||
}
|
||||
|
||||
obj = &Objects[ID_IMP_ROCK];
|
||||
if (obj->loaded)
|
||||
{
|
||||
obj->control = MissileControl;
|
||||
//obj->nmeshes = 0;
|
||||
}
|
||||
|
||||
obj = &Objects[ID_WATERFALLMIST];
|
||||
if (obj->loaded)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue