mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-10 20:46:47 +03:00
Merge branch 'master' into scripting
This commit is contained in:
commit
6b16828381
232 changed files with 11849 additions and 9250 deletions
|
@ -14,9 +14,11 @@ Global
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Debug|x64.ActiveCfg = Debug|Win32
|
{15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Debug|x64.ActiveCfg = Debug|Win32
|
||||||
|
{15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Debug|x64.Build.0 = Debug|Win32
|
||||||
{15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Debug|x86.ActiveCfg = Debug|Win32
|
{15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
{15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Debug|x86.Build.0 = Debug|Win32
|
{15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Debug|x86.Build.0 = Debug|Win32
|
||||||
{15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Release|x64.ActiveCfg = Release|Win32
|
{15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Release|x64.ActiveCfg = Release|Win32
|
||||||
|
{15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Release|x64.Build.0 = Release|Win32
|
||||||
{15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Release|x86.ActiveCfg = Release|Win32
|
{15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Release|x86.Build.0 = Release|Win32
|
{15AB0220-541C-4DA1-94EB-ED3C47E4582E}.Release|x86.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
|
|
@ -45,5 +45,4 @@ TARGET_TYPE CalculateTarget(PHD_VECTOR* target, ITEM_INFO* item, LOT_INFO* LOT);
|
||||||
int CreatureAnimation(short itemNumber, short angle, short tilt);
|
int CreatureAnimation(short itemNumber, short angle, short tilt);
|
||||||
void AdjustStopperFlag(ITEM_INFO* item, int dir, int set);
|
void AdjustStopperFlag(ITEM_INFO* item, int dir, int set);
|
||||||
|
|
||||||
void Inject_Box();
|
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
#include "control.h"
|
#include "control.h"
|
||||||
#include "../Specific/setup.h"
|
#include "../Specific/setup.h"
|
||||||
|
#include "../Specific/level.h"
|
||||||
|
|
||||||
int NumberBoxes;
|
int NumberBoxes;
|
||||||
BOX_INFO* Boxes;
|
BOX_INFO* Boxes;
|
||||||
|
@ -19,8 +20,6 @@ int NumberOverlaps;
|
||||||
short* Overlaps;
|
short* Overlaps;
|
||||||
short* Zones[5][2];
|
short* Zones[5][2];
|
||||||
|
|
||||||
extern LaraExtraInfo g_LaraExtra;
|
|
||||||
|
|
||||||
#define ESCAPE_DIST (WALL_SIZE*5)
|
#define ESCAPE_DIST (WALL_SIZE*5)
|
||||||
#define STALK_DIST (WALL_SIZE*3)
|
#define STALK_DIST (WALL_SIZE*3)
|
||||||
#define REACHED_GOAL_RADIUS 640
|
#define REACHED_GOAL_RADIUS 640
|
||||||
|
@ -62,7 +61,7 @@ int MoveCreature3DPos(PHD_3DPOS* srcpos, PHD_3DPOS* destpos, int velocity, short
|
||||||
x = destpos->xPos - srcpos->xPos;
|
x = destpos->xPos - srcpos->xPos;
|
||||||
y = destpos->yPos - srcpos->yPos;
|
y = destpos->yPos - srcpos->yPos;
|
||||||
z = destpos->zPos - srcpos->zPos;
|
z = destpos->zPos - srcpos->zPos;
|
||||||
distance = SQRT_ASM(SQUARE(x) + SQUARE(y) + SQUARE(z));
|
distance = sqrt(SQUARE(x) + SQUARE(y) + SQUARE(z));
|
||||||
|
|
||||||
if (velocity < distance)
|
if (velocity < distance)
|
||||||
{
|
{
|
||||||
|
@ -242,7 +241,7 @@ void CreatureKill(ITEM_INFO* item, int killAnim, int killState, short laraKillSt
|
||||||
|
|
||||||
AnimateItem(LaraItem);
|
AnimateItem(LaraItem);
|
||||||
|
|
||||||
g_LaraExtra.ExtraAnim = 1;
|
Lara.ExtraAnim = 1;
|
||||||
Lara.gunStatus = LG_HANDS_BUSY;
|
Lara.gunStatus = LG_HANDS_BUSY;
|
||||||
Lara.gunType = WEAPON_NONE;
|
Lara.gunType = WEAPON_NONE;
|
||||||
Lara.hitDirection = -1;
|
Lara.hitDirection = -1;
|
||||||
|
@ -256,9 +255,9 @@ void CreatureKill(ITEM_INFO* item, int killAnim, int killState, short laraKillSt
|
||||||
|
|
||||||
// TODO: exist in TR5 but just commented in case.
|
// TODO: exist in TR5 but just commented in case.
|
||||||
/*
|
/*
|
||||||
ForcedFixedCamera.x = item->pos.xPos + (SIN(item->pos.yRot) << 13) >> W2V_SHIFT;
|
ForcedFixedCamera.x = item->pos.xPos + (phd_sin(item->pos.yRot) << 13) >> W2V_SHIFT;
|
||||||
ForcedFixedCamera.y = item->pos.yPos - WALL_SIZE;
|
ForcedFixedCamera.y = item->pos.yPos - WALL_SIZE;
|
||||||
ForcedFixedCamera.z = item->pos.zPos + (COS(item->pos.yRot) << 13) >> W2V_SHIFT;
|
ForcedFixedCamera.z = item->pos.zPos + (phd_cos(item->pos.yRot) << 13) >> W2V_SHIFT;
|
||||||
ForcedFixedCamera.roomNumber = item->roomNumber;
|
ForcedFixedCamera.roomNumber = item->roomNumber;
|
||||||
UseForcedFixedCamera = true;
|
UseForcedFixedCamera = true;
|
||||||
*/
|
*/
|
||||||
|
@ -422,7 +421,7 @@ short CreatureTurn(ITEM_INFO* item, short maximumTurn)
|
||||||
|
|
||||||
x = creature->target.x - item->pos.xPos;
|
x = creature->target.x - item->pos.xPos;
|
||||||
z = creature->target.z - item->pos.zPos;
|
z = creature->target.z - item->pos.zPos;
|
||||||
angle = ATAN(z, x) - item->pos.yRot;
|
angle = phd_atan(z, x) - item->pos.yRot;
|
||||||
range = (item->speed << W2V_SHIFT) / maximumTurn;
|
range = (item->speed << W2V_SHIFT) / maximumTurn;
|
||||||
distance = SQUARE(x) + SQUARE(z);
|
distance = SQUARE(x) + SQUARE(z);
|
||||||
|
|
||||||
|
@ -452,16 +451,16 @@ short CreatureTurn(ITEM_INFO* item, short maximumTurn)
|
||||||
|
|
||||||
|
|
||||||
// "<< 11" is really needed ? it can cause problem i think since it TR3 code the "<< 11" is not there !
|
// "<< 11" is really needed ? it can cause problem i think since it TR3 code the "<< 11" is not there !
|
||||||
xAngle1 = item->pos.xPos + SIN(item->pos.yRot + ANGLE(45)) << 11 >> W2V_SHIFT;
|
xAngle1 = item->pos.xPos + phd_sin(item->pos.yRot + ANGLE(45)) << 11 >> W2V_SHIFT;
|
||||||
zAngle1 = item->pos.zPos + COS(item->pos.yRot + ANGLE(45)) << 11 >> W2V_SHIFT;
|
zAngle1 = item->pos.zPos + phd_cos(item->pos.yRot + ANGLE(45)) << 11 >> W2V_SHIFT;
|
||||||
floorIndex1 = XZ_GET_SECTOR(r, xAngle1 - r->x, zAngle1 - r->z).index;
|
floorIndex1 = XZ_GET_SECTOR(r, xAngle1 - r->x, zAngle1 - r->z).index;
|
||||||
|
|
||||||
xAngle2 = item->pos.xPos + SIN(item->pos.yRot - ANGLE(45)) << 11 >> W2V_SHIFT;
|
xAngle2 = item->pos.xPos + phd_sin(item->pos.yRot - ANGLE(45)) << 11 >> W2V_SHIFT;
|
||||||
zAngle2 = item->pos.zPos + COS(item->pos.yRot - ANGLE(45)) << 11 >> W2V_SHIFT;
|
zAngle2 = item->pos.zPos + phd_cos(item->pos.yRot - ANGLE(45)) << 11 >> W2V_SHIFT;
|
||||||
floorIndex2 = XZ_GET_SECTOR(r, xAngle2 - r->x, zAngle2 - r->z).index;
|
floorIndex2 = XZ_GET_SECTOR(r, xAngle2 - r->x, zAngle2 - r->z).index;
|
||||||
|
|
||||||
xAngle3 = item->pos.xPos + SIN(item->pos.yRot) << 11 >> W2V_SHIFT;
|
xAngle3 = item->pos.xPos + phd_sin(item->pos.yRot) << 11 >> W2V_SHIFT;
|
||||||
zAngle3 = item->pos.zPos + COS(item->pos.yRot) << 11 >> W2V_SHIFT;
|
zAngle3 = item->pos.zPos + phd_cos(item->pos.yRot) << 11 >> W2V_SHIFT;
|
||||||
floorIndex3 = XZ_GET_SECTOR(r, xAngle3 - r->x, zAngle3 - r->z).index;
|
floorIndex3 = XZ_GET_SECTOR(r, xAngle3 - r->x, zAngle3 - r->z).index;
|
||||||
|
|
||||||
if (floorIndex1 && !floorIndex2 && !floorIndex3)
|
if (floorIndex1 && !floorIndex2 && !floorIndex3)
|
||||||
|
@ -485,7 +484,7 @@ short CreatureTurn(ITEM_INFO* item, short maximumTurn)
|
||||||
|
|
||||||
xDist = creature->target.x - item->pos.xPos;
|
xDist = creature->target.x - item->pos.xPos;
|
||||||
zDist = creature->target.z - item->pos.zPos;
|
zDist = creature->target.z - item->pos.zPos;
|
||||||
angle = ATAN(zDist, xDist) - item->pos.yRot;
|
angle = phd_atan(zDist, xDist) - item->pos.yRot;
|
||||||
|
|
||||||
if (angle > FRONT_ARC || angle < -FRONT_ARC)
|
if (angle > FRONT_ARC || angle < -FRONT_ARC)
|
||||||
{
|
{
|
||||||
|
@ -778,7 +777,7 @@ int CreatureAnimation(short itemNumber, short angle, short tilt)
|
||||||
floor = GetFloor(item->pos.xPos, y, item->pos.zPos, &roomNumber);
|
floor = GetFloor(item->pos.xPos, y, item->pos.zPos, &roomNumber);
|
||||||
item->floor = GetFloorHeight(floor, item->pos.xPos, y, item->pos.zPos);
|
item->floor = GetFloorHeight(floor, item->pos.xPos, y, item->pos.zPos);
|
||||||
|
|
||||||
angle = (item->speed) ? ATAN(item->speed, -dy) : 0;
|
angle = (item->speed) ? phd_atan(item->speed, -dy) : 0;
|
||||||
if (angle < -ANGLE(20))
|
if (angle < -ANGLE(20))
|
||||||
angle = -ANGLE(20);
|
angle = -ANGLE(20);
|
||||||
else if (angle > ANGLE(20))
|
else if (angle > ANGLE(20))
|
||||||
|
@ -873,9 +872,9 @@ void CreatureDie(short itemNumber, int explode)
|
||||||
if (explode)
|
if (explode)
|
||||||
{
|
{
|
||||||
if (Objects[item->objectNumber].hitEffect)
|
if (Objects[item->objectNumber].hitEffect)
|
||||||
ExplodingDeath2(itemNumber, ALL_MESHBITS, EXPLODE_HIT_EFFECT);
|
ExplodingDeath(itemNumber, ALL_MESHBITS, EXPLODE_HIT_EFFECT);
|
||||||
else
|
else
|
||||||
ExplodingDeath2(itemNumber, ALL_MESHBITS, EXPLODE_NORMAL);
|
ExplodingDeath(itemNumber, ALL_MESHBITS, EXPLODE_NORMAL);
|
||||||
|
|
||||||
KillItem(itemNumber);
|
KillItem(itemNumber);
|
||||||
}
|
}
|
||||||
|
@ -920,7 +919,7 @@ int BadFloor(int x, int y, int z, int boxHeight, int nextHeight, short roomNumbe
|
||||||
int CreatureCreature(short itemNumber)
|
int CreatureCreature(short itemNumber)
|
||||||
{
|
{
|
||||||
ITEM_INFO* item, *linked;
|
ITEM_INFO* item, *linked;
|
||||||
OBJECT_INFO* obj;
|
ObjectInfo* obj;
|
||||||
ROOM_INFO* r;
|
ROOM_INFO* r;
|
||||||
int x, z, xDistance, zDistance, distance = 0;
|
int x, z, xDistance, zDistance, distance = 0;
|
||||||
short link, radius;
|
short link, radius;
|
||||||
|
@ -948,7 +947,7 @@ int CreatureCreature(short itemNumber)
|
||||||
distance = zDistance + (xDistance >> 1);
|
distance = zDistance + (xDistance >> 1);
|
||||||
|
|
||||||
if (distance < radius + Objects[linked->objectNumber].radius)
|
if (distance < radius + Objects[linked->objectNumber].radius)
|
||||||
return ATAN(linked->pos.zPos - z, linked->pos.xPos - x) - item->pos.yRot;
|
return phd_atan(linked->pos.zPos - z, linked->pos.xPos - x) - item->pos.yRot;
|
||||||
}
|
}
|
||||||
|
|
||||||
link = linked->nextItem;
|
link = linked->nextItem;
|
||||||
|
@ -1450,8 +1449,8 @@ void FindAITargetObject(CREATURE_INFO* creature, short objectNumber)
|
||||||
|
|
||||||
if (!(creature->aiTarget.flags & 0x20))
|
if (!(creature->aiTarget.flags & 0x20))
|
||||||
{
|
{
|
||||||
creature->aiTarget.pos.xPos += SIN(creature->aiTarget.pos.yRot) >> 4;
|
creature->aiTarget.pos.xPos += phd_sin(creature->aiTarget.pos.yRot) >> 4;
|
||||||
creature->aiTarget.pos.zPos += COS(creature->aiTarget.pos.yRot) >> 4;
|
creature->aiTarget.pos.zPos += phd_cos(creature->aiTarget.pos.yRot) >> 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1464,7 +1463,7 @@ void CreatureAIInfo(ITEM_INFO* item, AI_INFO* info)
|
||||||
|
|
||||||
CREATURE_INFO* creature;
|
CREATURE_INFO* creature;
|
||||||
ITEM_INFO* enemy;
|
ITEM_INFO* enemy;
|
||||||
OBJECT_INFO* obj;
|
ObjectInfo* obj;
|
||||||
ROOM_INFO* r;
|
ROOM_INFO* r;
|
||||||
short* zone, angle;
|
short* zone, angle;
|
||||||
int x, y, z;
|
int x, y, z;
|
||||||
|
@ -1499,17 +1498,17 @@ void CreatureAIInfo(ITEM_INFO* item, AI_INFO* info)
|
||||||
|
|
||||||
if (enemy == LaraItem)
|
if (enemy == LaraItem)
|
||||||
{
|
{
|
||||||
x = (enemy->pos.xPos + (enemy->speed * PREDICTIVE_SCALE_FACTOR * SIN(Lara.moveAngle) >> W2V_SHIFT)) - (item->pos.xPos + (obj->pivotLength * SIN(item->pos.yRot) >> W2V_SHIFT));
|
x = (enemy->pos.xPos + (enemy->speed * PREDICTIVE_SCALE_FACTOR * phd_sin(Lara.moveAngle) >> W2V_SHIFT)) - (item->pos.xPos + (obj->pivotLength * phd_sin(item->pos.yRot) >> W2V_SHIFT));
|
||||||
z = (enemy->pos.zPos + (enemy->speed * PREDICTIVE_SCALE_FACTOR * COS(Lara.moveAngle) >> W2V_SHIFT)) - (item->pos.zPos + (obj->pivotLength * COS(item->pos.yRot) >> W2V_SHIFT));
|
z = (enemy->pos.zPos + (enemy->speed * PREDICTIVE_SCALE_FACTOR * phd_cos(Lara.moveAngle) >> W2V_SHIFT)) - (item->pos.zPos + (obj->pivotLength * phd_cos(item->pos.yRot) >> W2V_SHIFT));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
x = (enemy->pos.xPos + (enemy->speed * PREDICTIVE_SCALE_FACTOR * SIN(enemy->pos.yRot) >> W2V_SHIFT)) - (item->pos.xPos + (obj->pivotLength * SIN(item->pos.yRot) >> W2V_SHIFT));
|
x = (enemy->pos.xPos + (enemy->speed * PREDICTIVE_SCALE_FACTOR * phd_sin(enemy->pos.yRot) >> W2V_SHIFT)) - (item->pos.xPos + (obj->pivotLength * phd_sin(item->pos.yRot) >> W2V_SHIFT));
|
||||||
z = (enemy->pos.zPos + (enemy->speed * PREDICTIVE_SCALE_FACTOR * COS(enemy->pos.yRot) >> W2V_SHIFT)) - (item->pos.zPos + (obj->pivotLength * COS(item->pos.yRot) >> W2V_SHIFT));
|
z = (enemy->pos.zPos + (enemy->speed * PREDICTIVE_SCALE_FACTOR * phd_cos(enemy->pos.yRot) >> W2V_SHIFT)) - (item->pos.zPos + (obj->pivotLength * phd_cos(item->pos.yRot) >> W2V_SHIFT));
|
||||||
}
|
}
|
||||||
|
|
||||||
y = item->pos.yPos - enemy->pos.yPos;
|
y = item->pos.yPos - enemy->pos.yPos;
|
||||||
angle = ATAN(z, x);
|
angle = phd_atan(z, x);
|
||||||
|
|
||||||
if (x > 32000 || x < -32000 || z > 32000 || z < -32000)
|
if (x > 32000 || x < -32000 || z > 32000 || z < -32000)
|
||||||
{
|
{
|
||||||
|
@ -1544,9 +1543,9 @@ void CreatureAIInfo(ITEM_INFO* item, AI_INFO* info)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x > z)
|
if (x > z)
|
||||||
info->xAngle = ATAN(x + (z >> 1), y);
|
info->xAngle = phd_atan(x + (z >> 1), y);
|
||||||
else
|
else
|
||||||
info->xAngle = ATAN(z + (x >> 1), y);
|
info->xAngle = phd_atan(z + (x >> 1), y);
|
||||||
|
|
||||||
info->ahead = (info->angle > -FRONT_ARC && info->angle < FRONT_ARC);
|
info->ahead = (info->angle > -FRONT_ARC && info->angle < FRONT_ARC);
|
||||||
info->bite = (info->ahead && enemy->hitPoints > 0 && abs(enemy->pos.yPos - item->pos.yPos) <= (STEP_SIZE*2));
|
info->bite = (info->ahead && enemy->hitPoints > 0 && abs(enemy->pos.yPos - item->pos.yPos) <= (STEP_SIZE*2));
|
||||||
|
@ -1661,7 +1660,7 @@ void CreatureMood(ITEM_INFO* item, AI_INFO* info, int violent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Unk_00EEFB6C = CalculateTarget(&creature->target, item, &creature->LOT);
|
/*Unk_00EEFB6C =*/ CalculateTarget(&creature->target, item, &creature->LOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetCreatureMood(ITEM_INFO* item, AI_INFO* info, int isViolent)
|
void GetCreatureMood(ITEM_INFO* item, AI_INFO* info, int isViolent)
|
||||||
|
@ -2008,49 +2007,13 @@ void AdjustStopperFlag(ITEM_INFO* item, int dir, int set)
|
||||||
FLOOR_INFO* floor = &XZ_GET_SECTOR(r, x - r->x, z - r->z);
|
FLOOR_INFO* floor = &XZ_GET_SECTOR(r, x - r->x, z - r->z);
|
||||||
floor->stopper = set;
|
floor->stopper = set;
|
||||||
|
|
||||||
x = item->pos.xPos + ((1024 * SIN(dir)) >> W2V_SHIFT);
|
x = item->pos.xPos + ((1024 * phd_sin(dir)) >> W2V_SHIFT);
|
||||||
z = item->pos.zPos + ((1024 * COS(dir)) >> W2V_SHIFT);
|
z = item->pos.zPos + ((1024 * phd_cos(dir)) >> W2V_SHIFT);
|
||||||
|
|
||||||
short roomNumber = item->roomNumber;
|
short roomNumber = item->roomNumber;
|
||||||
GetFloor(x, item->pos.yPos, z, &roomNumber);
|
GetFloor(x, item->pos.yPos, z, &roomNumber);
|
||||||
r = &Rooms[roomNumber];
|
r = &Rooms[roomNumber];
|
||||||
|
|
||||||
floor = &XZ_GET_SECTOR(r, x - r->x, z - r->z);
|
floor = &XZ_GET_SECTOR(r, x - r->x, z - r->z);
|
||||||
floor->stopper = set;
|
floor->stopper = set;
|
||||||
}
|
|
||||||
|
|
||||||
void Inject_Box()
|
|
||||||
{
|
|
||||||
INJECT(0x0040B5D0, CreatureVault);
|
|
||||||
INJECT(0x00408FD0, ValidBox);
|
|
||||||
INJECT(0x00408E20, TargetBox);
|
|
||||||
INJECT(0x00409770, StalkBox);
|
|
||||||
INJECT(0x00408EF0, EscapeBox);
|
|
||||||
INJECT(0x0040C2D0, SameZone);
|
|
||||||
INJECT(0x0040B820, CreatureKill);
|
|
||||||
INJECT(0x00409FB0, BadFloor);
|
|
||||||
INJECT(0x0040B550, CreatureEffect2);
|
|
||||||
INJECT(0x0040B4D0, CreatureEffect);
|
|
||||||
INJECT(0x0040C5A0, DropBaddyPickups);
|
|
||||||
INJECT(0x0040A090, CreatureDie);
|
|
||||||
INJECT(0x0040B240, CreatureJoint);
|
|
||||||
INJECT(0x0040B1B0, CreatureTilt);
|
|
||||||
INJECT(0x00409E20, CreatureCreature);
|
|
||||||
INJECT(0x00408630, CreatureActive);
|
|
||||||
//INJECT(0x0040AE90, CreatureTurn);
|
|
||||||
INJECT(0x0040C460, MoveCreature3DPos);
|
|
||||||
INJECT(0x004086C0, CreatureAIInfo);
|
|
||||||
INJECT(0x00409370, CreatureMood);
|
|
||||||
INJECT(0x004090A0, GetCreatureMood);
|
|
||||||
INJECT(0x0040BB10, AlertNearbyGuards);
|
|
||||||
INJECT(0x0040BA70, AlertAllGuards);
|
|
||||||
INJECT(0x00408B00, UpdateLOT);
|
|
||||||
INJECT(0x0040B400, CreatureUnderwater);
|
|
||||||
INJECT(0x0040B2C0, CreatureFloat);
|
|
||||||
INJECT(0x004098B0, CalculateTarget);
|
|
||||||
INJECT(0x0040A1D0, CreatureAnimation);
|
|
||||||
INJECT(0x00408550, InitialiseCreature);
|
|
||||||
INJECT(0x0040C070, FindAITargetObject);
|
|
||||||
INJECT(0x0040BBE0, AIGuard);
|
|
||||||
INJECT(0x0040BCC0, GetAITarget);
|
|
||||||
}
|
}
|
|
@ -1,5 +1,9 @@
|
||||||
#include "bubble.h"
|
#include "bubble.h"
|
||||||
|
#include "../Specific/level.h"
|
||||||
|
#include "control.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
extern vector<BUBBLE_STRUCT> Bubbles = vector<BUBBLE_STRUCT>(MAX_BUBBLES);
|
extern vector<BUBBLE_STRUCT> Bubbles = vector<BUBBLE_STRUCT>(MAX_BUBBLES);
|
||||||
|
|
||||||
void UpdateBubbles()
|
void UpdateBubbles()
|
||||||
|
@ -92,9 +96,3 @@ void CreateBubble(PHD_VECTOR* pos, short roomNum, int unk1, int unk2, int flags,
|
||||||
bubble->roomNumber = roomNum;
|
bubble->roomNumber = roomNum;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inject_Bubble() {
|
|
||||||
INJECT(0x00483540, UpdateBubbles);
|
|
||||||
INJECT(0x004832C0, GetFreeBubble);
|
|
||||||
INJECT(0x00483350, CreateBubble);
|
|
||||||
}
|
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "../Global/types.h"
|
#include "../Global/types.h"
|
||||||
#include "../Global/constants.h"
|
#include "../Global/constants.h"
|
||||||
#include "../Global/vars.h"
|
|
||||||
#include "effect2.h"
|
#include "effect2.h"
|
||||||
constexpr float MAX_BUBBLES = 256;
|
|
||||||
|
|
||||||
|
constexpr float MAX_BUBBLES = 256;
|
||||||
constexpr int BUBBLE_FLAG_BIG_SIZE = 0x1;
|
constexpr int BUBBLE_FLAG_BIG_SIZE = 0x1;
|
||||||
constexpr int BUBBLE_FLAG_CLUMP = 0x2;
|
constexpr int BUBBLE_FLAG_CLUMP = 0x2;
|
||||||
constexpr int BUBBLE_FLAG_HIGH_AMPLITUDE = 0x4;
|
constexpr int BUBBLE_FLAG_HIGH_AMPLITUDE = 0x4;
|
||||||
|
|
||||||
struct BUBBLE_STRUCT
|
struct BUBBLE_STRUCT
|
||||||
{
|
{
|
||||||
DirectX::SimpleMath::Vector4 color;
|
DirectX::SimpleMath::Vector4 color;
|
||||||
|
@ -30,11 +30,9 @@ struct BUBBLE_STRUCT
|
||||||
int age;
|
int age;
|
||||||
bool active;
|
bool active;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern std::vector<BUBBLE_STRUCT> Bubbles;
|
extern std::vector<BUBBLE_STRUCT> Bubbles;
|
||||||
|
|
||||||
void UpdateBubbles();
|
void UpdateBubbles();
|
||||||
|
|
||||||
int GetFreeBubble();//8BEAC(<), 8DEF0(<) (F)
|
int GetFreeBubble();//8BEAC(<), 8DEF0(<) (F)
|
||||||
|
|
||||||
void CreateBubble(PHD_VECTOR* pos, short roomNum, int unk1, int unk2, int flags, int xv, int yv, int zv);//8BF14(<), 8DF58(<) (F)
|
void CreateBubble(PHD_VECTOR* pos, short roomNum, int unk1, int unk2, int flags, int xv, int yv, int zv);//8BF14(<), 8DF58(<) (F)
|
||||||
|
|
||||||
void Inject_Bubble();
|
|
|
@ -10,6 +10,11 @@
|
||||||
#include "lara.h"
|
#include "lara.h"
|
||||||
#include "flmtorch.h"
|
#include "flmtorch.h"
|
||||||
#include "sphere.h"
|
#include "sphere.h"
|
||||||
|
#include "../Specific/level.h"
|
||||||
|
#include "collide.h"
|
||||||
|
#include "sound.h"
|
||||||
|
#include "savegame.h"
|
||||||
|
#include "../Specific/input.h"
|
||||||
|
|
||||||
struct OLD_CAMERA
|
struct OLD_CAMERA
|
||||||
{
|
{
|
||||||
|
@ -24,13 +29,11 @@ struct OLD_CAMERA
|
||||||
PHD_VECTOR target;
|
PHD_VECTOR target;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LfAspectCorrection VAR_U_(0x0055DA30, float)
|
float LfAspectCorrection;
|
||||||
#define LastTarget VAR_U_(0x00EEFA30, GAME_VECTOR)
|
GAME_VECTOR LastTarget;
|
||||||
#define InputBusy VAR_U_(0x00878C94, int)
|
byte SniperCamActive;
|
||||||
#define SniperCamActive VAR_U_(0x0051CA1D, byte)
|
|
||||||
|
|
||||||
extern int KeyTriggerActive;
|
extern int KeyTriggerActive;
|
||||||
extern LaraExtraInfo g_LaraExtra;
|
|
||||||
|
|
||||||
PHD_VECTOR CurrentCameraPosition;
|
PHD_VECTOR CurrentCameraPosition;
|
||||||
SVECTOR CurrentCameraRotation;
|
SVECTOR CurrentCameraRotation;
|
||||||
|
@ -57,6 +60,10 @@ CAMERA_TYPE BinocularOldCamera;
|
||||||
int LaserSight;
|
int LaserSight;
|
||||||
int SniperCount;
|
int SniperCount;
|
||||||
int ExitingBinocular;
|
int ExitingBinocular;
|
||||||
|
int PhdPerspective;
|
||||||
|
short CurrentFOV;
|
||||||
|
int GetLaraOnLOS;
|
||||||
|
int SniperOverlay;
|
||||||
|
|
||||||
void ActivateCamera()
|
void ActivateCamera()
|
||||||
{
|
{
|
||||||
|
@ -68,43 +75,20 @@ void LookAt(int posX, int posY, int posZ, int targetX, int targetY, int targetZ,
|
||||||
Vector3 position = Vector3(posX, posY, posZ);
|
Vector3 position = Vector3(posX, posY, posZ);
|
||||||
Vector3 target = Vector3(targetX, targetY, targetZ);
|
Vector3 target = Vector3(targetX, targetY, targetZ);
|
||||||
Vector3 up = Vector3(0.0f, -1.0f, 0.0f);
|
Vector3 up = Vector3(0.0f, -1.0f, 0.0f);
|
||||||
float fov = TR_ANGLE_TO_RAD(CurrentFOV / 1.333333f);
|
float fov = TO_RAD(CurrentFOV / 1.333333f);
|
||||||
float r = TR_ANGLE_TO_RAD(roll);
|
float r = TO_RAD(roll);
|
||||||
|
|
||||||
// This should not be needed but it seems to solve our issues
|
// This should not be needed but it seems to solve our issues
|
||||||
if (posX == targetX && posY == targetY && posZ == targetZ)
|
if (posX == targetX && posY == targetY && posZ == targetZ)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
short angles[2];
|
|
||||||
phd_GetVectorAngles(targetX - posX, targetY - posY, targetZ - posZ, angles);
|
|
||||||
|
|
||||||
PHD_3DPOS pos;
|
|
||||||
|
|
||||||
pos.xPos = posX;
|
|
||||||
pos.yPos = posY;
|
|
||||||
pos.zPos = posZ;
|
|
||||||
pos.xRot = angles[1];
|
|
||||||
pos.yRot = angles[0];
|
|
||||||
pos.zRot = roll;
|
|
||||||
|
|
||||||
CurrentCameraPosition.x = posX;
|
|
||||||
CurrentCameraPosition.y = posY;
|
|
||||||
CurrentCameraPosition.z = posZ;
|
|
||||||
|
|
||||||
/*CurrentCameraRotation.vx = mGetAngle(0, 0, sqrt(roll), posY - targetY) >> 4;
|
|
||||||
CurrentCameraRotation.vy = mGetAngle(posZ, posX, targetZ, targetX) >> 4;
|
|
||||||
CurrentCameraRotation.vz = 0;*/
|
|
||||||
|
|
||||||
phd_GenerateW2V(&pos);
|
|
||||||
|
|
||||||
g_Renderer->UpdateCameraMatrices(posX, posY, posZ, targetX, targetY, targetZ, r, fov);
|
g_Renderer->UpdateCameraMatrices(posX, posY, posZ, targetX, targetY, targetZ, r, fov);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlterFOV(int value)
|
void AlterFOV(int value)
|
||||||
{
|
{
|
||||||
CurrentFOV = value;
|
CurrentFOV = value;
|
||||||
PhdPerspective = PhdWidth / 2 * COS(CurrentFOV / 2) / SIN(CurrentFOV / 2);
|
PhdPerspective = g_Renderer->ScreenWidth / 2 * phd_cos(CurrentFOV / 2) / phd_sin(CurrentFOV / 2);
|
||||||
LfAspectCorrection = 1.3333334f / (float)(PhdWidth / PhdHeight);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int mgLOS(GAME_VECTOR* start, GAME_VECTOR* target, int push)
|
int mgLOS(GAME_VECTOR* start, GAME_VECTOR* target, int push)
|
||||||
|
@ -364,10 +348,10 @@ void MoveCamera(GAME_VECTOR* ideal, int speed)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
short angle = ATAN(Camera.target.z - Camera.pos.z, Camera.target.x - Camera.pos.x);
|
short angle = phd_atan(Camera.target.z - Camera.pos.z, Camera.target.x - Camera.pos.x);
|
||||||
Camera.mikePos.x = Camera.pos.x + (PhdPerspective * SIN(angle) >> W2V_SHIFT);
|
Camera.mikePos.x = Camera.pos.x + (PhdPerspective * phd_sin(angle) >> W2V_SHIFT);
|
||||||
Camera.mikePos.y = Camera.pos.y;
|
Camera.mikePos.y = Camera.pos.y;
|
||||||
Camera.mikePos.z = Camera.pos.z + (PhdPerspective * COS(angle) >> W2V_SHIFT);
|
Camera.mikePos.z = Camera.pos.z + (PhdPerspective * phd_cos(angle) >> W2V_SHIFT);
|
||||||
Camera.oldType = Camera.type;
|
Camera.oldType = Camera.type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -387,7 +371,7 @@ void ChaseCamera(ITEM_INFO* item)
|
||||||
else if (Camera.actualElevation < -ANGLE(85))
|
else if (Camera.actualElevation < -ANGLE(85))
|
||||||
Camera.actualElevation = -ANGLE(85);
|
Camera.actualElevation = -ANGLE(85);
|
||||||
|
|
||||||
int distance = Camera.targetDistance * COS(Camera.actualElevation) >> W2V_SHIFT;
|
int distance = Camera.targetDistance * phd_cos(Camera.actualElevation) >> W2V_SHIFT;
|
||||||
|
|
||||||
GetFloor(Camera.target.x, Camera.target.y, Camera.target.z, &Camera.target.roomNumber);
|
GetFloor(Camera.target.x, Camera.target.y, Camera.target.z, &Camera.target.roomNumber);
|
||||||
if (Rooms[Camera.target.roomNumber].flags & ENV_FLAG_SWAMP)
|
if (Rooms[Camera.target.roomNumber].flags & ENV_FLAG_SWAMP)
|
||||||
|
@ -417,7 +401,7 @@ void ChaseCamera(ITEM_INFO* item)
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++)
|
for (int i = 0; i < 5; i++)
|
||||||
{
|
{
|
||||||
Ideals[i].y = Camera.target.y + (Camera.targetDistance * SIN(Camera.actualElevation) >> W2V_SHIFT);
|
Ideals[i].y = Camera.target.y + (Camera.targetDistance * phd_sin(Camera.actualElevation) >> W2V_SHIFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
int farthest = 0x7FFFFFFF;
|
int farthest = 0x7FFFFFFF;
|
||||||
|
@ -437,8 +421,8 @@ void ChaseCamera(ITEM_INFO* item)
|
||||||
angle = (i - 1) * ANGLE(90);
|
angle = (i - 1) * ANGLE(90);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ideals[i].x = Camera.target.x - ((distance * SIN(angle)) >> W2V_SHIFT);
|
Ideals[i].x = Camera.target.x - ((distance * phd_sin(angle)) >> W2V_SHIFT);
|
||||||
Ideals[i].z = Camera.target.z - ((distance * COS(angle)) >> W2V_SHIFT);
|
Ideals[i].z = Camera.target.z - ((distance * phd_cos(angle)) >> W2V_SHIFT);
|
||||||
Ideals[i].roomNumber = Camera.target.roomNumber;
|
Ideals[i].roomNumber = Camera.target.roomNumber;
|
||||||
|
|
||||||
if (mgLOS(&Camera.target, &Ideals[i], 200))
|
if (mgLOS(&Camera.target, &Ideals[i], 200))
|
||||||
|
@ -531,7 +515,7 @@ void UpdateCameraElevation()
|
||||||
|
|
||||||
pos.z = pos1.z - pos.z;
|
pos.z = pos1.z - pos.z;
|
||||||
pos.x = pos1.x - pos.x;
|
pos.x = pos1.x - pos.x;
|
||||||
Camera.actualAngle = Camera.targetAngle + ATAN(pos.z, pos.x);
|
Camera.actualAngle = Camera.targetAngle + phd_atan(pos.z, pos.x);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -604,11 +588,11 @@ void CombatCamera(ITEM_INFO* item)
|
||||||
UpdateCameraElevation();
|
UpdateCameraElevation();
|
||||||
|
|
||||||
Camera.targetDistance = 1536;
|
Camera.targetDistance = 1536;
|
||||||
int distance = Camera.targetDistance * COS(Camera.actualElevation) >> W2V_SHIFT;
|
int distance = Camera.targetDistance * phd_cos(Camera.actualElevation) >> W2V_SHIFT;
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++)
|
for (int i = 0; i < 5; i++)
|
||||||
{
|
{
|
||||||
Ideals[i].y = Camera.target.y + (Camera.targetDistance * SIN(Camera.actualElevation) >> W2V_SHIFT);
|
Ideals[i].y = Camera.target.y + (Camera.targetDistance * phd_sin(Camera.actualElevation) >> W2V_SHIFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
int farthest = 0x7FFFFFFF;
|
int farthest = 0x7FFFFFFF;
|
||||||
|
@ -628,8 +612,8 @@ void CombatCamera(ITEM_INFO* item)
|
||||||
angle = (i - 1) * ANGLE(90);
|
angle = (i - 1) * ANGLE(90);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ideals[i].x = Camera.target.x - ((distance * SIN(angle)) >> W2V_SHIFT);
|
Ideals[i].x = Camera.target.x - ((distance * phd_sin(angle)) >> W2V_SHIFT);
|
||||||
Ideals[i].z = Camera.target.z - ((distance * COS(angle)) >> W2V_SHIFT);
|
Ideals[i].z = Camera.target.z - ((distance * phd_cos(angle)) >> W2V_SHIFT);
|
||||||
Ideals[i].roomNumber = Camera.target.roomNumber;
|
Ideals[i].roomNumber = Camera.target.roomNumber;
|
||||||
|
|
||||||
if (mgLOS(&Camera.target, &Ideals[i], 200))
|
if (mgLOS(&Camera.target, &Ideals[i], 200))
|
||||||
|
@ -926,7 +910,7 @@ void LookCamera(ITEM_INFO* item)
|
||||||
pos.x = 0;
|
pos.x = 0;
|
||||||
pos.y = 16;
|
pos.y = 16;
|
||||||
pos.z = 64;
|
pos.z = 64;
|
||||||
GetLaraJointPosition(&pos, LJ_HEAD);
|
GetLaraJointPosition(&pos, LM_HEAD);
|
||||||
|
|
||||||
short roomNumber = LaraItem->roomNumber;
|
short roomNumber = LaraItem->roomNumber;
|
||||||
FLOOR_INFO* floor = GetFloor(pos.x, pos.y, pos.z, &roomNumber);
|
FLOOR_INFO* floor = GetFloor(pos.x, pos.y, pos.z, &roomNumber);
|
||||||
|
@ -937,7 +921,7 @@ void LookCamera(ITEM_INFO* item)
|
||||||
pos.x = 0;
|
pos.x = 0;
|
||||||
pos.y = 16;
|
pos.y = 16;
|
||||||
pos.z = 0;
|
pos.z = 0;
|
||||||
GetLaraJointPosition(&pos, LJ_HEAD);
|
GetLaraJointPosition(&pos, LM_HEAD);
|
||||||
|
|
||||||
roomNumber = LaraItem->roomNumber;
|
roomNumber = LaraItem->roomNumber;
|
||||||
floor = GetFloor(pos.x, pos.y + 256, pos.z, &roomNumber);
|
floor = GetFloor(pos.x, pos.y + 256, pos.z, &roomNumber);
|
||||||
|
@ -956,7 +940,7 @@ void LookCamera(ITEM_INFO* item)
|
||||||
pos.x = 0;
|
pos.x = 0;
|
||||||
pos.y = 16;
|
pos.y = 16;
|
||||||
pos.z = -64;
|
pos.z = -64;
|
||||||
GetLaraJointPosition(&pos, LJ_HEAD);
|
GetLaraJointPosition(&pos, LM_HEAD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -964,13 +948,13 @@ void LookCamera(ITEM_INFO* item)
|
||||||
pos2.x = 0;
|
pos2.x = 0;
|
||||||
pos2.y = 0;
|
pos2.y = 0;
|
||||||
pos2.z = -1024;
|
pos2.z = -1024;
|
||||||
GetLaraJointPosition(&pos2, LJ_HEAD);
|
GetLaraJointPosition(&pos2, LM_HEAD);
|
||||||
|
|
||||||
PHD_VECTOR pos3;
|
PHD_VECTOR pos3;
|
||||||
pos3.x = 0;
|
pos3.x = 0;
|
||||||
pos3.y = 0;
|
pos3.y = 0;
|
||||||
pos3.z = 2048;
|
pos3.z = 2048;
|
||||||
GetLaraJointPosition(&pos3, LJ_HEAD);
|
GetLaraJointPosition(&pos3, LM_HEAD);
|
||||||
|
|
||||||
int dx = (pos2.x - pos.x) >> 3;
|
int dx = (pos2.x - pos.x) >> 3;
|
||||||
int dy = (pos2.y - pos.y) >> 3;
|
int dy = (pos2.y - pos.y) >> 3;
|
||||||
|
@ -1143,9 +1127,9 @@ void LookCamera(ITEM_INFO* item)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Camera.actualAngle = ATAN(Camera.target.z - Camera.pos.z, Camera.target.x - Camera.pos.x);
|
Camera.actualAngle = phd_atan(Camera.target.z - Camera.pos.z, Camera.target.x - Camera.pos.x);
|
||||||
Camera.mikePos.x = Camera.pos.x + ((PhdPerspective * SIN(Camera.actualAngle)) >> W2V_SHIFT);
|
Camera.mikePos.x = Camera.pos.x + ((PhdPerspective * phd_sin(Camera.actualAngle)) >> W2V_SHIFT);
|
||||||
Camera.mikePos.z = Camera.pos.z + ((PhdPerspective * COS(Camera.actualAngle)) >> W2V_SHIFT);
|
Camera.mikePos.z = Camera.pos.z + ((PhdPerspective * phd_cos(Camera.actualAngle)) >> W2V_SHIFT);
|
||||||
Camera.mikePos.y = Camera.pos.y;
|
Camera.mikePos.y = Camera.pos.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1161,7 +1145,7 @@ void BounceCamera(ITEM_INFO* item, short bounce, short maxDistance)
|
||||||
{
|
{
|
||||||
int distance;
|
int distance;
|
||||||
|
|
||||||
distance = SQRT_ASM(SQUARE(item->pos.xPos - Camera.pos.x) + SQUARE(item->pos.yPos - Camera.pos.y) + SQUARE(item->pos.zPos - Camera.pos.z));
|
distance = sqrt(SQUARE(item->pos.xPos - Camera.pos.x) + SQUARE(item->pos.yPos - Camera.pos.y) + SQUARE(item->pos.zPos - Camera.pos.z));
|
||||||
if (distance < maxDistance)
|
if (distance < maxDistance)
|
||||||
{
|
{
|
||||||
if (maxDistance == -1)
|
if (maxDistance == -1)
|
||||||
|
@ -1240,11 +1224,11 @@ void BinocularCamera(ITEM_INFO* item)
|
||||||
Camera.pos.z = z;
|
Camera.pos.z = z;
|
||||||
Camera.pos.roomNumber = roomNumber;
|
Camera.pos.roomNumber = roomNumber;
|
||||||
|
|
||||||
int l = 20736 * COS(headXrot) >> W2V_SHIFT;
|
int l = 20736 * phd_cos(headXrot) >> W2V_SHIFT;
|
||||||
|
|
||||||
int tx = x + (l * SIN(LaraItem->pos.yRot + headYrot) >> W2V_SHIFT);
|
int tx = x + (l * phd_sin(LaraItem->pos.yRot + headYrot) >> W2V_SHIFT);
|
||||||
int ty = y - (20736 * SIN(headXrot) >> W2V_SHIFT);
|
int ty = y - (20736 * phd_sin(headXrot) >> W2V_SHIFT);
|
||||||
int tz = z + (l * COS(LaraItem->pos.yRot + headYrot) >> W2V_SHIFT);
|
int tz = z + (l * phd_cos(LaraItem->pos.yRot + headYrot) >> W2V_SHIFT);
|
||||||
|
|
||||||
if (Camera.oldType == FIXED_CAMERA)
|
if (Camera.oldType == FIXED_CAMERA)
|
||||||
{
|
{
|
||||||
|
@ -1289,9 +1273,9 @@ void BinocularCamera(ITEM_INFO* item)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Camera.actualAngle = ATAN(Camera.target.z - Camera.pos.z, Camera.target.x - Camera.pos.x);
|
Camera.actualAngle = phd_atan(Camera.target.z - Camera.pos.z, Camera.target.x - Camera.pos.x);
|
||||||
Camera.mikePos.x = Camera.pos.x + ((PhdPerspective * SIN(Camera.actualAngle)) >> W2V_SHIFT);
|
Camera.mikePos.x = Camera.pos.x + ((PhdPerspective * phd_sin(Camera.actualAngle)) >> W2V_SHIFT);
|
||||||
Camera.mikePos.z = Camera.pos.z + ((PhdPerspective * COS(Camera.actualAngle)) >> W2V_SHIFT);
|
Camera.mikePos.z = Camera.pos.z + ((PhdPerspective * phd_cos(Camera.actualAngle)) >> W2V_SHIFT);
|
||||||
Camera.mikePos.y = Camera.pos.y;
|
Camera.mikePos.y = Camera.pos.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1370,11 +1354,11 @@ void BinocularCamera(ITEM_INFO* item)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.Weapons[WEAPON_HK].SelectedAmmo == WEAPON_AMMO1)
|
if (Lara.Weapons[WEAPON_HK].SelectedAmmo == WEAPON_AMMO1)
|
||||||
{
|
{
|
||||||
WeaponDelay = 12;
|
WeaponDelay = 12;
|
||||||
firing = 1;
|
firing = 1;
|
||||||
if (g_LaraExtra.Weapons[WEAPON_HK].HasSilencer)
|
if (Lara.Weapons[WEAPON_HK].HasSilencer)
|
||||||
{
|
{
|
||||||
SoundEffect(SFX_HK_SILENCED, 0, 0);
|
SoundEffect(SFX_HK_SILENCED, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -1384,7 +1368,7 @@ void BinocularCamera(ITEM_INFO* item)
|
||||||
SoundEffect(SFX_HK_FIRE, 0, 0);
|
SoundEffect(SFX_HK_FIRE, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (g_LaraExtra.Weapons[WEAPON_HK].SelectedAmmo == WEAPON_AMMO2)
|
else if (Lara.Weapons[WEAPON_HK].SelectedAmmo == WEAPON_AMMO2)
|
||||||
{
|
{
|
||||||
if (!LSHKTimer)
|
if (!LSHKTimer)
|
||||||
{
|
{
|
||||||
|
@ -1395,7 +1379,7 @@ void BinocularCamera(ITEM_INFO* item)
|
||||||
}
|
}
|
||||||
LSHKTimer = 4;
|
LSHKTimer = 4;
|
||||||
firing = 1;
|
firing = 1;
|
||||||
if (g_LaraExtra.Weapons[WEAPON_HK].HasSilencer)
|
if (Lara.Weapons[WEAPON_HK].HasSilencer)
|
||||||
{
|
{
|
||||||
SoundEffect(SFX_HK_SILENCED, 0, 0);
|
SoundEffect(SFX_HK_SILENCED, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -1409,7 +1393,7 @@ void BinocularCamera(ITEM_INFO* item)
|
||||||
{
|
{
|
||||||
Camera.bounce = -16 - (GetRandomControl() & 0x1F);
|
Camera.bounce = -16 - (GetRandomControl() & 0x1F);
|
||||||
|
|
||||||
if (g_LaraExtra.Weapons[WEAPON_HK].HasSilencer)
|
if (Lara.Weapons[WEAPON_HK].HasSilencer)
|
||||||
{
|
{
|
||||||
SoundEffect(SFX_HK_SILENCED, 0, 0);
|
SoundEffect(SFX_HK_SILENCED, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -1424,7 +1408,7 @@ void BinocularCamera(ITEM_INFO* item)
|
||||||
{
|
{
|
||||||
if (LSHKTimer)
|
if (LSHKTimer)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.Weapons[WEAPON_HK].HasSilencer)
|
if (Lara.Weapons[WEAPON_HK].HasSilencer)
|
||||||
{
|
{
|
||||||
SoundEffect(SFX_HK_SILENCED, 0, 0);
|
SoundEffect(SFX_HK_SILENCED, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -1438,7 +1422,7 @@ void BinocularCamera(ITEM_INFO* item)
|
||||||
{
|
{
|
||||||
LSHKTimer = 4;
|
LSHKTimer = 4;
|
||||||
firing = 1;
|
firing = 1;
|
||||||
if (g_LaraExtra.Weapons[WEAPON_HK].HasSilencer)
|
if (Lara.Weapons[WEAPON_HK].HasSilencer)
|
||||||
{
|
{
|
||||||
SoundEffect(SFX_HK_SILENCED, 0, 0);
|
SoundEffect(SFX_HK_SILENCED, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -1491,13 +1475,13 @@ void LaraTorch(PHD_VECTOR* src, PHD_VECTOR* target, int rot, int color)
|
||||||
|
|
||||||
if (!LOS(&pos1, &pos2))
|
if (!LOS(&pos1, &pos2))
|
||||||
{
|
{
|
||||||
int l = SQRT_ASM(SQUARE(pos1.x - pos2.x) + SQUARE(pos1.y - pos2.y) + SQUARE(pos1.z - pos2.z)) >> 8;
|
int l = sqrt(SQUARE(pos1.x - pos2.x) + SQUARE(pos1.y - pos2.y) + SQUARE(pos1.z - pos2.z)) * 256;
|
||||||
|
|
||||||
if (l + 8 > 31)
|
if (l + 8 > 31)
|
||||||
l = 31;
|
l = 31;
|
||||||
|
|
||||||
if (color - l >= 0)
|
if (color - l >= 0)
|
||||||
TriggerDynamicLight(pos2.x, pos2.y, pos2.z, l + 8, color - l, color - l, (color - l) >> 1);
|
TriggerDynamicLight(pos2.x, pos2.y, pos2.z, l + 8, color - l, color - l, (color - l) * 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1508,7 +1492,7 @@ void ConfirmCameraTargetPos()
|
||||||
pos.y = 0;
|
pos.y = 0;
|
||||||
pos.z = 0;
|
pos.z = 0;
|
||||||
|
|
||||||
GetJointAbsPosition(LaraItem, &pos, LJ_LHAND);
|
GetLaraJointPosition(&pos, LM_LHAND);
|
||||||
|
|
||||||
if (Camera.laraNode != -1)
|
if (Camera.laraNode != -1)
|
||||||
{
|
{
|
||||||
|
@ -1543,7 +1527,8 @@ void ConfirmCameraTargetPos()
|
||||||
void CalculateCamera()
|
void CalculateCamera()
|
||||||
{
|
{
|
||||||
SniperOverlay = 0;
|
SniperOverlay = 0;
|
||||||
SniperCamActive = 0;
|
// FIXME
|
||||||
|
//SniperCamActive = 0;
|
||||||
|
|
||||||
CamOldPos.x = Camera.pos.x;
|
CamOldPos.x = Camera.pos.x;
|
||||||
CamOldPos.y = Camera.pos.y;
|
CamOldPos.y = Camera.pos.y;
|
||||||
|
@ -1612,7 +1597,7 @@ void CalculateCamera()
|
||||||
|
|
||||||
if (Camera.type == CINEMATIC_CAMERA)
|
if (Camera.type == CINEMATIC_CAMERA)
|
||||||
{
|
{
|
||||||
Legacy_do_new_cutscene_camera();
|
//Legacy_do_new_cutscene_camera();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1641,9 +1626,9 @@ void CalculateCamera()
|
||||||
{
|
{
|
||||||
int dx = Camera.item->pos.xPos - item->pos.xPos;
|
int dx = Camera.item->pos.xPos - item->pos.xPos;
|
||||||
int dz = Camera.item->pos.zPos - item->pos.zPos;
|
int dz = Camera.item->pos.zPos - item->pos.zPos;
|
||||||
int shift = SQRT_ASM(SQUARE(dx) + SQUARE(dz));
|
int shift = sqrt(SQUARE(dx) + SQUARE(dz));
|
||||||
short angle = ATAN(dz, dx) - item->pos.yRot;
|
short angle = phd_atan(dz, dx) - item->pos.yRot;
|
||||||
short tilt = ATAN(shift, y - (bounds[2] + bounds[3]) / 2 - Camera.item->pos.yPos);
|
short tilt = phd_atan(shift, y - (bounds[2] + bounds[3]) / 2 - Camera.item->pos.yPos);
|
||||||
bounds = GetBoundsAccurate(Camera.item);
|
bounds = GetBoundsAccurate(Camera.item);
|
||||||
angle >>= 1;
|
angle >>= 1;
|
||||||
tilt >>= 1;
|
tilt >>= 1;
|
||||||
|
@ -1721,7 +1706,7 @@ void CalculateCamera()
|
||||||
pos.x = 0;
|
pos.x = 0;
|
||||||
pos.y = 0;
|
pos.y = 0;
|
||||||
pos.z = 0;
|
pos.z = 0;
|
||||||
GetLaraJointPosition(&pos, LJ_TORSO);
|
GetLaraJointPosition(&pos, LM_TORSO);
|
||||||
|
|
||||||
x = pos.x;
|
x = pos.x;
|
||||||
y = pos.y;
|
y = pos.y;
|
||||||
|
@ -1734,8 +1719,8 @@ void CalculateCamera()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int shift = (bounds[0] + bounds[1] + bounds[4] + bounds[5]) >> 2;
|
int shift = (bounds[0] + bounds[1] + bounds[4] + bounds[5]) >> 2;
|
||||||
x = item->pos.xPos + (shift * SIN(item->pos.yRot) >> W2V_SHIFT);
|
x = item->pos.xPos + (shift * phd_sin(item->pos.yRot) >> W2V_SHIFT);
|
||||||
z = item->pos.zPos + (shift * COS(item->pos.yRot) >> W2V_SHIFT);
|
z = item->pos.zPos + (shift * phd_cos(item->pos.yRot) >> W2V_SHIFT);
|
||||||
|
|
||||||
Camera.target.x = x;
|
Camera.target.x = x;
|
||||||
Camera.target.z = z;
|
Camera.target.z = z;
|
||||||
|
@ -1809,21 +1794,4 @@ void CalculateCamera()
|
||||||
Camera.flags = 0;
|
Camera.flags = 0;
|
||||||
Camera.laraNode = -1;
|
Camera.laraNode = -1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void Inject_Camera()
|
|
||||||
{
|
|
||||||
INJECT(0x0048EDC0, AlterFOV);
|
|
||||||
INJECT(0x0048F760, LookAt);
|
|
||||||
INJECT(0x0040FA70, mgLOS);
|
|
||||||
INJECT(0x0040C7A0, MoveCamera);
|
|
||||||
INJECT(0x0040C690, InitialiseCamera);
|
|
||||||
INJECT(0x004107C0, UpdateCameraElevation);
|
|
||||||
INJECT(0x0040D150, ChaseCamera);
|
|
||||||
INJECT(0x0040D640, CombatCamera);
|
|
||||||
INJECT(0x0040F5C0, CameraCollisionBounds);
|
|
||||||
INJECT(0x0040E890, FixedCamera);
|
|
||||||
INJECT(0x0040DC10, LookCamera);
|
|
||||||
INJECT(0x0040FC20, BinocularCamera);
|
|
||||||
INJECT(0x0040ED30, CalculateCamera);
|
|
||||||
}
|
}
|
|
@ -15,6 +15,10 @@ extern CAMERA_TYPE BinocularOldCamera;
|
||||||
extern int LaserSight;
|
extern int LaserSight;
|
||||||
extern int SniperCount;
|
extern int SniperCount;
|
||||||
extern int ExitingBinocular;
|
extern int ExitingBinocular;
|
||||||
|
extern int PhdPerspective;
|
||||||
|
extern short CurrentFOV;
|
||||||
|
extern int GetLaraOnLOS;
|
||||||
|
extern int SniperOverlay;
|
||||||
|
|
||||||
void ActivateCamera();
|
void ActivateCamera();
|
||||||
void LookAt(int posX, int posY, int posZ, int targetX, int targetY, int targetZ, short roll);
|
void LookAt(int posX, int posY, int posZ, int targetX, int targetY, int targetZ, short roll);
|
||||||
|
@ -32,6 +36,4 @@ void BounceCamera(ITEM_INFO* item, short bounce, short maxDistance);
|
||||||
void BinocularCamera(ITEM_INFO* item);
|
void BinocularCamera(ITEM_INFO* item);
|
||||||
void LaraTorch(PHD_VECTOR* src, PHD_VECTOR* target, int rot, int color);
|
void LaraTorch(PHD_VECTOR* src, PHD_VECTOR* target, int rot, int color);
|
||||||
void ConfirmCameraTargetPos();
|
void ConfirmCameraTargetPos();
|
||||||
void CalculateCamera();
|
void CalculateCamera();
|
||||||
|
|
||||||
void Inject_Camera();
|
|
|
@ -10,6 +10,8 @@
|
||||||
#include "sphere.h"
|
#include "sphere.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "../Specific/setup.h"
|
#include "../Specific/setup.h"
|
||||||
|
#include "../Specific/level.h"
|
||||||
|
#include "sound.h"
|
||||||
|
|
||||||
char LM[] = {
|
char LM[] = {
|
||||||
LJ_HIPS,
|
LJ_HIPS,
|
||||||
|
@ -31,6 +33,8 @@ char LM[] = {
|
||||||
|
|
||||||
int XFront, ZFront;
|
int XFront, ZFront;
|
||||||
BOUNDING_BOX GlobalCollisionBounds;
|
BOUNDING_BOX GlobalCollisionBounds;
|
||||||
|
ITEM_INFO* CollidedItems[1024];
|
||||||
|
MESH_INFO* CollidedMeshes[1024];
|
||||||
|
|
||||||
int CollideStaticObjects(COLL_INFO* coll, int x, int y, int z, short roomNumber, int hite)
|
int CollideStaticObjects(COLL_INFO* coll, int x, int y, int z, short roomNumber, int hite)
|
||||||
{
|
{
|
||||||
|
@ -145,8 +149,8 @@ int GetCollidedObjects(ITEM_INFO* collidingItem, int radius, int onlyVisible, IT
|
||||||
{
|
{
|
||||||
if (collidingItem->pos.yPos <= mesh->y + staticMesh->yMaxc)
|
if (collidingItem->pos.yPos <= mesh->y + staticMesh->yMaxc)
|
||||||
{
|
{
|
||||||
s = SIN(mesh->yRot);
|
s = phd_sin(mesh->yRot);
|
||||||
c = COS(mesh->yRot);
|
c = phd_cos(mesh->yRot);
|
||||||
rx = ((collidingItem->pos.xPos - mesh->x) * c - s * (collidingItem->pos.zPos - mesh->z)) >> W2V_SHIFT;
|
rx = ((collidingItem->pos.xPos - mesh->x) * c - s * (collidingItem->pos.zPos - mesh->z)) >> W2V_SHIFT;
|
||||||
rz = ((collidingItem->pos.zPos - mesh->z) * c + s * (collidingItem->pos.xPos - mesh->x)) >> W2V_SHIFT;
|
rz = ((collidingItem->pos.zPos - mesh->z) * c + s * (collidingItem->pos.xPos - mesh->x)) >> W2V_SHIFT;
|
||||||
|
|
||||||
|
@ -220,8 +224,8 @@ int GetCollidedObjects(ITEM_INFO* collidingItem, int radius, int onlyVisible, IT
|
||||||
&& collidingItem->pos.yPos + radius + 128 >= item->pos.yPos + framePtr[2]
|
&& collidingItem->pos.yPos + radius + 128 >= item->pos.yPos + framePtr[2]
|
||||||
&& collidingItem->pos.yPos - radius - 128 <= item->pos.yPos + framePtr[3])
|
&& collidingItem->pos.yPos - radius - 128 <= item->pos.yPos + framePtr[3])
|
||||||
{
|
{
|
||||||
int s = SIN(item->pos.yRot);
|
int s = phd_sin(item->pos.yRot);
|
||||||
int c = COS(item->pos.yRot);
|
int c = phd_cos(item->pos.yRot);
|
||||||
|
|
||||||
int rx = (dx * c - s * dz) >> W2V_SHIFT;
|
int rx = (dx * c - s * dz) >> W2V_SHIFT;
|
||||||
int rz = (dz * c + s * dx) >> W2V_SHIFT;
|
int rz = (dz * c + s * dx) >> W2V_SHIFT;
|
||||||
|
@ -269,8 +273,8 @@ int TestWithGlobalCollisionBounds(ITEM_INFO* item, ITEM_INFO* lara, COLL_INFO* c
|
||||||
if (item->pos.yPos + GlobalCollisionBounds.Y1 >= framePtr[4])
|
if (item->pos.yPos + GlobalCollisionBounds.Y1 >= framePtr[4])
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int s = SIN(item->pos.yRot);
|
int s = phd_sin(item->pos.yRot);
|
||||||
int c = COS(item->pos.yRot);
|
int c = phd_cos(item->pos.yRot);
|
||||||
|
|
||||||
int dx = lara->pos.xPos - item->pos.xPos;
|
int dx = lara->pos.xPos - item->pos.xPos;
|
||||||
int dz = lara->pos.zPos - item->pos.zPos;
|
int dz = lara->pos.zPos - item->pos.zPos;
|
||||||
|
@ -314,14 +318,14 @@ void TestForObjectOnLedge(ITEM_INFO* item, COLL_INFO* coll)//2A940(<), 2AB68(<)
|
||||||
s.y = -256;
|
s.y = -256;
|
||||||
s.z = 0;
|
s.z = 0;
|
||||||
|
|
||||||
GetLaraJointPosition((PHD_VECTOR*)&s, LJ_HEAD);
|
GetLaraJointPosition((PHD_VECTOR*)&s, LM_HEAD);
|
||||||
s.roomNumber = LaraItem->roomNumber;
|
s.roomNumber = LaraItem->roomNumber;
|
||||||
|
|
||||||
GAME_VECTOR d;
|
GAME_VECTOR d;
|
||||||
d.x = 0;
|
d.x = 0;
|
||||||
d.x = (s.x + ((SIN(LaraItem->pos.yRot) << 1) + SIN(LaraItem->pos.yRot))) >> 4;
|
d.x = (s.x + ((phd_sin(LaraItem->pos.yRot) << 1) + phd_sin(LaraItem->pos.yRot))) >> 4;
|
||||||
d.y = s.y;
|
d.y = s.y;
|
||||||
d.z = (s.z + ((COS(LaraItem->pos.yRot) << 1) + COS(LaraItem->pos.yRot))) >> 4;
|
d.z = (s.z + ((phd_cos(LaraItem->pos.yRot) << 1) + phd_cos(LaraItem->pos.yRot))) >> 4;
|
||||||
|
|
||||||
LOS(&s, &d);
|
LOS(&s, &d);
|
||||||
|
|
||||||
|
@ -460,8 +464,8 @@ int TestBoundsCollideStatic(short* bounds, PHD_3DPOS* pos, int radius)
|
||||||
int c, s;
|
int c, s;
|
||||||
int x, z, dx, dz;
|
int x, z, dx, dz;
|
||||||
|
|
||||||
c = COS(pos->yRot);
|
c = phd_cos(pos->yRot);
|
||||||
s = SIN(pos->yRot);
|
s = phd_sin(pos->yRot);
|
||||||
x = LaraItem->pos.xPos - pos->xPos;
|
x = LaraItem->pos.xPos - pos->xPos;
|
||||||
z = LaraItem->pos.zPos - pos->zPos;
|
z = LaraItem->pos.zPos - pos->zPos;
|
||||||
dx = (c * x - s * z) >> W2V_SHIFT;
|
dx = (c * x - s * z) >> W2V_SHIFT;
|
||||||
|
@ -487,8 +491,8 @@ int ItemPushLaraStatic(ITEM_INFO* item, short* bounds, PHD_3DPOS* pos, COLL_INFO
|
||||||
int left, right, top, bottom;
|
int left, right, top, bottom;
|
||||||
short oldFacing;
|
short oldFacing;
|
||||||
|
|
||||||
c = COS(pos->yRot);
|
c = phd_cos(pos->yRot);
|
||||||
s = SIN(pos->yRot);
|
s = phd_sin(pos->yRot);
|
||||||
dx = LaraItem->pos.xPos - pos->xPos;
|
dx = LaraItem->pos.xPos - pos->xPos;
|
||||||
dz = LaraItem->pos.zPos - pos->zPos;
|
dz = LaraItem->pos.zPos - pos->zPos;
|
||||||
rx = (c * dx - s * dz) >> W2V_SHIFT;
|
rx = (c * dx - s * dz) >> W2V_SHIFT;
|
||||||
|
@ -528,7 +532,7 @@ int ItemPushLaraStatic(ITEM_INFO* item, short* bounds, PHD_3DPOS* pos, COLL_INFO
|
||||||
coll->badCeiling = 0;
|
coll->badCeiling = 0;
|
||||||
|
|
||||||
oldFacing = coll->facing;
|
oldFacing = coll->facing;
|
||||||
coll->facing = ATAN(item->pos.zPos - coll->old.z, item->pos.xPos - coll->old.x);
|
coll->facing = phd_atan(item->pos.zPos - coll->old.z, item->pos.xPos - coll->old.x);
|
||||||
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE);
|
GetCollisionInfo(coll, item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, LARA_HITE);
|
||||||
coll->facing = oldFacing;
|
coll->facing = oldFacing;
|
||||||
|
|
||||||
|
@ -563,8 +567,8 @@ int ItemPushLara(ITEM_INFO* item, ITEM_INFO* l, COLL_INFO* coll, int spazon, cha
|
||||||
short* bounds;
|
short* bounds;
|
||||||
short facing;
|
short facing;
|
||||||
|
|
||||||
c = COS(item->pos.yRot);
|
c = phd_cos(item->pos.yRot);
|
||||||
s = SIN(item->pos.yRot);
|
s = phd_sin(item->pos.yRot);
|
||||||
dx = LaraItem->pos.xPos - item->pos.xPos;
|
dx = LaraItem->pos.xPos - item->pos.xPos;
|
||||||
dz = LaraItem->pos.zPos - item->pos.zPos;
|
dz = LaraItem->pos.zPos - item->pos.zPos;
|
||||||
rx = (c * dx - s * dz) >> W2V_SHIFT;
|
rx = (c * dx - s * dz) >> W2V_SHIFT;
|
||||||
|
@ -621,7 +625,7 @@ int ItemPushLara(ITEM_INFO* item, ITEM_INFO* l, COLL_INFO* coll, int spazon, cha
|
||||||
dx -= (c * rx + s * rz) >> W2V_SHIFT;
|
dx -= (c * rx + s * rz) >> W2V_SHIFT;
|
||||||
dz -= (c * rz - s * rx) >> W2V_SHIFT;
|
dz -= (c * rz - s * rx) >> W2V_SHIFT;
|
||||||
|
|
||||||
Lara.hitDirection = (l->pos.yRot - ATAN(dz, dz) - ANGLE(135)) >> W2V_SHIFT;
|
Lara.hitDirection = (l->pos.yRot - phd_atan(dz, dz) - ANGLE(135)) >> W2V_SHIFT;
|
||||||
|
|
||||||
if (!Lara.hitFrame)
|
if (!Lara.hitFrame)
|
||||||
SoundEffect(SFX_LARA_INJURY_RND, &l->pos, 0);
|
SoundEffect(SFX_LARA_INJURY_RND, &l->pos, 0);
|
||||||
|
@ -636,7 +640,7 @@ int ItemPushLara(ITEM_INFO* item, ITEM_INFO* l, COLL_INFO* coll, int spazon, cha
|
||||||
coll->badCeiling = 0;
|
coll->badCeiling = 0;
|
||||||
|
|
||||||
facing = coll->facing;
|
facing = coll->facing;
|
||||||
coll->facing = ATAN(l->pos.zPos - coll->old.z, l->pos.xPos - coll->old.x);
|
coll->facing = phd_atan(l->pos.zPos - coll->old.z, l->pos.xPos - coll->old.x);
|
||||||
GetCollisionInfo(coll, l->pos.xPos, l->pos.yPos, l->pos.zPos, l->roomNumber, LARA_HITE);
|
GetCollisionInfo(coll, l->pos.xPos, l->pos.yPos, l->pos.zPos, l->roomNumber, LARA_HITE);
|
||||||
coll->facing = facing;
|
coll->facing = facing;
|
||||||
|
|
||||||
|
@ -692,18 +696,17 @@ void AlignLaraPosition(PHD_VECTOR* vec, ITEM_INFO* item, ITEM_INFO* l)
|
||||||
l->pos.yRot = item->pos.yRot;
|
l->pos.yRot = item->pos.yRot;
|
||||||
l->pos.zRot = item->pos.zRot;
|
l->pos.zRot = item->pos.zRot;
|
||||||
|
|
||||||
phd_PushUnitMatrix();
|
Matrix matrix = Matrix::CreateFromYawPitchRoll(
|
||||||
phd_RotYXZ(item->pos.yRot, item->pos.xRot, item->pos.zRot);
|
TO_RAD(item->pos.yRot),
|
||||||
|
TO_RAD(item->pos.xRot),
|
||||||
x = item->pos.xPos + ((MatrixPtr[M00] * vec->x + MatrixPtr[M01] * vec->y + MatrixPtr[M02] * vec->z) >> W2V_SHIFT);
|
TO_RAD(item->pos.zRot)
|
||||||
y = item->pos.yPos + ((MatrixPtr[M10] * vec->x + MatrixPtr[M11] * vec->y + MatrixPtr[M12] * vec->z) >> W2V_SHIFT);
|
);
|
||||||
z = item->pos.zPos + ((MatrixPtr[M20] * vec->x + MatrixPtr[M21] * vec->y + MatrixPtr[M22] * vec->z) >> W2V_SHIFT);
|
|
||||||
|
|
||||||
phd_PopMatrix();
|
Vector3 pos = Vector3::Transform(Vector3(vec->x, vec->y, vec->z), matrix);
|
||||||
|
|
||||||
l->pos.xPos = x;
|
l->pos.xPos = item->pos.xPos + pos.x;
|
||||||
l->pos.yPos = y;
|
l->pos.yPos = item->pos.yPos + pos.y;
|
||||||
l->pos.zPos = z;
|
l->pos.zPos = item->pos.zPos + pos.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TriggerLaraBlood()
|
void TriggerLaraBlood()
|
||||||
|
@ -749,19 +752,21 @@ int TestLaraPosition(short* bounds, ITEM_INFO* item, ITEM_INFO* l)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (zRotRel > bounds[11])
|
if (zRotRel > bounds[11])
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
Vector3 pos = Vector3(l->pos.xPos - item->pos.xPos, l->pos.yPos - item->pos.yPos, l->pos.zPos - item->pos.zPos);
|
||||||
|
|
||||||
|
Matrix matrix = Matrix::CreateFromYawPitchRoll(
|
||||||
|
TO_RAD(item->pos.yRot),
|
||||||
|
TO_RAD(item->pos.xRot),
|
||||||
|
TO_RAD(item->pos.zRot)
|
||||||
|
);
|
||||||
|
|
||||||
|
pos = Vector3::Transform(pos, matrix);
|
||||||
|
|
||||||
|
rx = pos.x;
|
||||||
|
ry = pos.y;
|
||||||
|
rz = pos.z;
|
||||||
|
|
||||||
phd_PushUnitMatrix();
|
|
||||||
phd_RotYXZ(item->pos.yRot, item->pos.xRot, item->pos.zRot);
|
|
||||||
|
|
||||||
x = l->pos.xPos - item->pos.xPos;
|
|
||||||
y = l->pos.yPos - item->pos.yPos;
|
|
||||||
z = l->pos.zPos - item->pos.zPos;
|
|
||||||
rx = (x * MatrixPtr[M00] + y * MatrixPtr[M10] + z * MatrixPtr[M20]) >> W2V_SHIFT;
|
|
||||||
ry = (x * MatrixPtr[M01] + y * MatrixPtr[M11] + z * MatrixPtr[M21]) >> W2V_SHIFT;
|
|
||||||
rz = (x * MatrixPtr[M02] + y * MatrixPtr[M12] + z * MatrixPtr[M22]) >> W2V_SHIFT;
|
|
||||||
|
|
||||||
phd_PopMatrix();
|
|
||||||
|
|
||||||
if (rx < bounds[0] || rx > bounds[1] || ry < bounds[2] || ry > bounds[3] || rz < bounds[4] || rz > bounds[5])
|
if (rx < bounds[0] || rx > bounds[1] || ry < bounds[2] || ry > bounds[3] || rz < bounds[4] || rz > bounds[5])
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -777,7 +782,7 @@ int Move3DPosTo3DPos(PHD_3DPOS* src, PHD_3DPOS* dest, int velocity, short angAdd
|
||||||
x = dest->xPos - src->xPos;
|
x = dest->xPos - src->xPos;
|
||||||
y = dest->yPos - src->yPos;
|
y = dest->yPos - src->yPos;
|
||||||
z = dest->zPos - src->zPos;
|
z = dest->zPos - src->zPos;
|
||||||
distance = SQRT_ASM(SQUARE(x) + SQUARE(y) + SQUARE(z));
|
distance = sqrt(SQUARE(x) + SQUARE(y) + SQUARE(z));
|
||||||
|
|
||||||
if (velocity < distance)
|
if (velocity < distance)
|
||||||
{
|
{
|
||||||
|
@ -895,15 +900,20 @@ int MoveLaraPosition(PHD_VECTOR* vec, ITEM_INFO* item, ITEM_INFO* l)
|
||||||
dest.xRot = item->pos.xRot;
|
dest.xRot = item->pos.xRot;
|
||||||
dest.yRot = item->pos.yRot;
|
dest.yRot = item->pos.yRot;
|
||||||
dest.zRot = item->pos.zRot;
|
dest.zRot = item->pos.zRot;
|
||||||
|
|
||||||
|
Vector3 pos = Vector3(vec->x, vec->y, vec->z);
|
||||||
|
|
||||||
|
Matrix matrix = Matrix::CreateFromYawPitchRoll(
|
||||||
|
TO_RAD(item->pos.yRot),
|
||||||
|
TO_RAD(item->pos.xRot),
|
||||||
|
TO_RAD(item->pos.zRot)
|
||||||
|
);
|
||||||
|
|
||||||
|
pos = Vector3::Transform(pos, matrix);
|
||||||
|
|
||||||
phd_PushUnitMatrix();
|
dest.xPos = item->pos.xPos + pos.x;
|
||||||
phd_RotYXZ(item->pos.yRot, item->pos.xRot, item->pos.zRot);
|
dest.yPos = item->pos.yPos + pos.y;
|
||||||
|
dest.zPos = item->pos.zPos + pos.z;
|
||||||
dest.xPos = item->pos.xPos + ((MatrixPtr[M00] * vec->x + MatrixPtr[M01] * vec->y + MatrixPtr[M02] * vec->z) >> W2V_SHIFT);
|
|
||||||
dest.yPos = item->pos.yPos + ((MatrixPtr[M10] * vec->x + MatrixPtr[M11] * vec->y + MatrixPtr[M12] * vec->z) >> W2V_SHIFT);
|
|
||||||
dest.zPos = item->pos.zPos + ((MatrixPtr[M20] * vec->x + MatrixPtr[M21] * vec->y + MatrixPtr[M22] * vec->z) >> W2V_SHIFT);
|
|
||||||
|
|
||||||
phd_PopMatrix();
|
|
||||||
|
|
||||||
if (item->objectNumber != ID_FLARE_ITEM && item->objectNumber != ID_BURNING_TORCH_ITEM)
|
if (item->objectNumber != ID_FLARE_ITEM && item->objectNumber != ID_BURNING_TORCH_ITEM)
|
||||||
return Move3DPosTo3DPos(&l->pos, &dest, LARA_VELOCITY, ANGLE(2));
|
return Move3DPosTo3DPos(&l->pos, &dest, LARA_VELOCITY, ANGLE(2));
|
||||||
|
@ -914,7 +924,7 @@ int MoveLaraPosition(PHD_VECTOR* vec, ITEM_INFO* item, ITEM_INFO* l)
|
||||||
|
|
||||||
if (abs(height - l->pos.yPos) <= CLICK(2))
|
if (abs(height - l->pos.yPos) <= CLICK(2))
|
||||||
{
|
{
|
||||||
if (SQRT_ASM(SQUARE(dest.xPos - l->pos.xPos) + SQUARE(dest.yPos - l->pos.yPos) + SQUARE(dest.zPos - l->pos.zPos)) < (STEP_SIZE/2))
|
if (sqrt(SQUARE(dest.xPos - l->pos.xPos) + SQUARE(dest.yPos - l->pos.yPos) + SQUARE(dest.zPos - l->pos.zPos)) < (STEP_SIZE/2))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
return Move3DPosTo3DPos(&l->pos, &dest, LARA_VELOCITY, ANGLE(2));
|
return Move3DPosTo3DPos(&l->pos, &dest, LARA_VELOCITY, ANGLE(2));
|
||||||
|
@ -944,8 +954,8 @@ int TestBoundsCollide(ITEM_INFO* item, ITEM_INFO* l, int radius)
|
||||||
{
|
{
|
||||||
if (item->pos.yPos + bounds[2] < l->pos.yPos + laraBounds[3])
|
if (item->pos.yPos + bounds[2] < l->pos.yPos + laraBounds[3])
|
||||||
{
|
{
|
||||||
c = COS(item->pos.yRot);
|
c = phd_cos(item->pos.yRot);
|
||||||
s = SIN(item->pos.yRot);
|
s = phd_sin(item->pos.yRot);
|
||||||
x = l->pos.xPos - item->pos.xPos;
|
x = l->pos.xPos - item->pos.xPos;
|
||||||
z = l->pos.zPos - item->pos.zPos;
|
z = l->pos.zPos - item->pos.zPos;
|
||||||
dx = (c * x - s * z) >> W2V_SHIFT;
|
dx = (c * x - s * z) >> W2V_SHIFT;
|
||||||
|
@ -985,15 +995,15 @@ void CreatureCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)
|
||||||
{
|
{
|
||||||
x = l->pos.xPos - item->pos.xPos;
|
x = l->pos.xPos - item->pos.xPos;
|
||||||
z = l->pos.zPos - item->pos.zPos;
|
z = l->pos.zPos - item->pos.zPos;
|
||||||
c = COS(item->pos.yRot);
|
c = phd_cos(item->pos.yRot);
|
||||||
s = SIN(item->pos.yRot);
|
s = phd_sin(item->pos.yRot);
|
||||||
frame = GetBestFrame(item);
|
frame = GetBestFrame(item);
|
||||||
rx = (frame[0] + frame[1]) / 2;
|
rx = (frame[0] + frame[1]) / 2;
|
||||||
rz = (frame[4] + frame[5]) / 2;
|
rz = (frame[4] + frame[5]) / 2;
|
||||||
|
|
||||||
if (frame[3] - frame[2] > STEP_SIZE)
|
if (frame[3] - frame[2] > STEP_SIZE)
|
||||||
{
|
{
|
||||||
int angle = (l->pos.yRot - ATAN(z - ((c * rx - s * rz) >> W2V_SHIFT), x - ((c * rx + s * rz) >> W2V_SHIFT)) - ANGLE(135)) >> W2V_SHIFT;
|
int angle = (l->pos.yRot - phd_atan(z - ((c * rx - s * rz) >> W2V_SHIFT), x - ((c * rx + s * rz) >> W2V_SHIFT)) - ANGLE(135)) >> W2V_SHIFT;
|
||||||
Lara.hitDirection = (short)angle;
|
Lara.hitDirection = (short)angle;
|
||||||
// TODO: check if a second Lara.hitFrame++; is required there !
|
// TODO: check if a second Lara.hitFrame++; is required there !
|
||||||
Lara.hitFrame++;
|
Lara.hitFrame++;
|
||||||
|
@ -1056,7 +1066,7 @@ void GetCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int roomNum
|
||||||
switch (coll->quadrant)
|
switch (coll->quadrant)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
XFront = (SIN(coll->facing) * coll->radius) >> (W2V_SHIFT);
|
XFront = (phd_sin(coll->facing) * coll->radius) >> (W2V_SHIFT);
|
||||||
ZFront = coll->radius;
|
ZFront = coll->radius;
|
||||||
xleft = -(coll->radius);
|
xleft = -(coll->radius);
|
||||||
zleft = coll->radius;
|
zleft = coll->radius;
|
||||||
|
@ -1066,7 +1076,7 @@ void GetCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int roomNum
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
XFront = coll->radius;
|
XFront = coll->radius;
|
||||||
ZFront = (COS(coll->facing) * coll->radius) >> (W2V_SHIFT);
|
ZFront = (phd_cos(coll->facing) * coll->radius) >> (W2V_SHIFT);
|
||||||
xleft = coll->radius;
|
xleft = coll->radius;
|
||||||
zleft = coll->radius;
|
zleft = coll->radius;
|
||||||
xright = coll->radius;
|
xright = coll->radius;
|
||||||
|
@ -1074,7 +1084,7 @@ void GetCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int roomNum
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
XFront = (SIN(coll->facing) * coll->radius) >> (W2V_SHIFT);
|
XFront = (phd_sin(coll->facing) * coll->radius) >> (W2V_SHIFT);
|
||||||
ZFront = -coll->radius;
|
ZFront = -coll->radius;
|
||||||
xleft = coll->radius;
|
xleft = coll->radius;
|
||||||
zleft = -(coll->radius);
|
zleft = -(coll->radius);
|
||||||
|
@ -1084,7 +1094,7 @@ void GetCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int roomNum
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
XFront = -(coll->radius);
|
XFront = -(coll->radius);
|
||||||
ZFront = (COS(coll->facing) * coll->radius) >> (W2V_SHIFT);
|
ZFront = (phd_cos(coll->facing) * coll->radius) >> (W2V_SHIFT);
|
||||||
xleft = -(coll->radius);
|
xleft = -(coll->radius);
|
||||||
zleft = -(coll->radius);
|
zleft = -(coll->radius);
|
||||||
xright = -(coll->radius);
|
xright = -(coll->radius);
|
||||||
|
@ -1364,7 +1374,7 @@ void GetCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int roomNum
|
||||||
void LaraBaddieCollision(ITEM_INFO* l, COLL_INFO* coll)
|
void LaraBaddieCollision(ITEM_INFO* l, COLL_INFO* coll)
|
||||||
{
|
{
|
||||||
ITEM_INFO* item;
|
ITEM_INFO* item;
|
||||||
OBJECT_INFO* obj;
|
ObjectInfo* obj;
|
||||||
|
|
||||||
l->hitStatus = false;
|
l->hitStatus = false;
|
||||||
Lara.hitDirection = -1;
|
Lara.hitDirection = -1;
|
||||||
|
@ -1460,10 +1470,10 @@ void GenericSphereBoxCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)
|
||||||
short oldRot = item->pos.yRot;
|
short oldRot = item->pos.yRot;
|
||||||
|
|
||||||
item->pos.yRot = 0;
|
item->pos.yRot = 0;
|
||||||
GetSpheres(item, BaddieSpheres, 1);
|
GetSpheres(item, CreatureSpheres, SPHERES_SPACE_WORLD, Matrix::Identity);
|
||||||
item->pos.yRot = oldRot;
|
item->pos.yRot = oldRot;
|
||||||
|
|
||||||
SPHERE* sphere = &BaddieSpheres[0];
|
SPHERE* sphere = &CreatureSpheres[0];
|
||||||
while (collided)
|
while (collided)
|
||||||
{
|
{
|
||||||
if (collided & 1)
|
if (collided & 1)
|
||||||
|
@ -1508,12 +1518,4 @@ void GenericSphereBoxCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void Inject_Collide()
|
|
||||||
{
|
|
||||||
INJECT(0x00411DB0, CollideStaticObjects);
|
|
||||||
INJECT(0x00413CF0, GetCollidedObjects);
|
|
||||||
INJECT(0x00410EF0, GetTiltType);
|
|
||||||
INJECT(0x00411100, GetCollisionInfo);
|
|
||||||
}
|
}
|
|
@ -8,6 +8,8 @@
|
||||||
#define NO_BAD_NEG NO_HEIGHT
|
#define NO_BAD_NEG NO_HEIGHT
|
||||||
|
|
||||||
extern BOUNDING_BOX GlobalCollisionBounds;
|
extern BOUNDING_BOX GlobalCollisionBounds;
|
||||||
|
extern ITEM_INFO* CollidedItems[1024];
|
||||||
|
extern MESH_INFO* CollidedMeshes[1024];
|
||||||
|
|
||||||
void GenericSphereBoxCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll);
|
void GenericSphereBoxCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll);
|
||||||
int CollideStaticObjects(COLL_INFO* coll, int x, int y, int z, short roomNumber, int hite);
|
int CollideStaticObjects(COLL_INFO* coll, int x, int y, int z, short roomNumber, int hite);
|
||||||
|
@ -33,5 +35,3 @@ int TestBoundsCollide(ITEM_INFO* item, ITEM_INFO* l, int radius);
|
||||||
void CreatureCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll);
|
void CreatureCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll);
|
||||||
void GetCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int roomNumber, int objectHeight);
|
void GetCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int roomNumber, int objectHeight);
|
||||||
void LaraBaddieCollision(ITEM_INFO* item, COLL_INFO* coll);
|
void LaraBaddieCollision(ITEM_INFO* item, COLL_INFO* coll);
|
||||||
|
|
||||||
void Inject_Collide();
|
|
File diff suppressed because it is too large
Load diff
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
#include "..\Global\global.h"
|
#include "..\Global\global.h"
|
||||||
|
|
||||||
#define DoRayBox_sub_401523 ((int (__cdecl*)(PHD_VECTOR*, PHD_VECTOR*, PHD_VECTOR*, PHD_VECTOR*, PHD_VECTOR*)) 0x00401523)
|
|
||||||
|
|
||||||
#define TRIG_BITS(T) ((T & 0x3fff) >> 10)
|
#define TRIG_BITS(T) ((T & 0x3fff) >> 10)
|
||||||
|
|
||||||
extern int KeyTriggerActive;
|
extern int KeyTriggerActive;
|
||||||
|
@ -19,6 +17,65 @@ extern short NextFxFree;
|
||||||
extern short NextItemActive;
|
extern short NextItemActive;
|
||||||
extern short NextItemFree;
|
extern short NextItemFree;
|
||||||
extern short* TriggerIndex;
|
extern short* TriggerIndex;
|
||||||
|
extern int DisableLaraControl;
|
||||||
|
extern int WeatherType;
|
||||||
|
extern int LaraDrawType;
|
||||||
|
extern int NumberSoundSources;
|
||||||
|
extern OBJECT_VECTOR* SoundSources;
|
||||||
|
extern int NumAnimatedTextures;
|
||||||
|
extern short* AnimTextureRanges;
|
||||||
|
extern int nAnimUVRanges;
|
||||||
|
extern int Wibble;
|
||||||
|
extern int SetDebounce;
|
||||||
|
extern int CurrentAtmosphere;
|
||||||
|
extern short ShatterSounds[18][10];
|
||||||
|
extern int CurrentAtmosphere;
|
||||||
|
extern short CurrentRoom;
|
||||||
|
extern int GameTimer;
|
||||||
|
extern short GlobalCounter;
|
||||||
|
extern byte LevelComplete;
|
||||||
|
extern short DelCutSeqPlayer;
|
||||||
|
extern int LastInventoryItem;
|
||||||
|
extern int TrackCameraInit;
|
||||||
|
extern short TorchRoom;
|
||||||
|
extern int InitialiseGame;
|
||||||
|
extern int RequiredStartPos;
|
||||||
|
extern int WeaponDelay;
|
||||||
|
extern int WeaponEnemyTimer;
|
||||||
|
extern int HeightType;
|
||||||
|
extern int HeavyTriggered;
|
||||||
|
extern short SkyPos1;
|
||||||
|
extern short SkyPos2;
|
||||||
|
extern signed char SkyVelocity1;
|
||||||
|
extern signed char SkyVelocity2;
|
||||||
|
extern CVECTOR SkyColor1;
|
||||||
|
extern CVECTOR SkyColor2;
|
||||||
|
extern int CutSeqNum;
|
||||||
|
extern int CutSeqTriggered;
|
||||||
|
extern int GlobalPlayingCutscene;
|
||||||
|
extern int CurrentLevel;
|
||||||
|
extern int SoundActive;
|
||||||
|
extern int DoTheGame;
|
||||||
|
extern int Unk_876C48;
|
||||||
|
extern int OnFloor;
|
||||||
|
extern int SmokeWindX;
|
||||||
|
extern int SmokeWindZ;
|
||||||
|
extern int OnObject;
|
||||||
|
extern int KillEverythingFlag;
|
||||||
|
extern int FlipTimer;
|
||||||
|
extern int FlipEffect;
|
||||||
|
extern int TriggerTimer;
|
||||||
|
extern int JustLoaded;
|
||||||
|
extern int PoisonFlags;
|
||||||
|
extern int OldLaraBusy;
|
||||||
|
extern int Infrared;
|
||||||
|
extern short FlashFadeR;
|
||||||
|
extern short FlashFadeG;
|
||||||
|
extern short FlashFadeB;
|
||||||
|
extern short FlashFader;
|
||||||
|
extern short IsRoomOutsideNo;
|
||||||
|
extern int TiltXOffset;
|
||||||
|
extern int TiltYOffset;
|
||||||
|
|
||||||
GAME_STATUS DoTitle(int index);
|
GAME_STATUS DoTitle(int index);
|
||||||
GAME_STATUS DoLevel(int index, int ambient, bool loadFromSavegame);
|
GAME_STATUS DoLevel(int index, int ambient, bool loadFromSavegame);
|
||||||
|
@ -63,6 +120,6 @@ int TriggerActive(ITEM_INFO* item);
|
||||||
int GetWaterHeight(int x, int y, int z, short roomNumber);
|
int GetWaterHeight(int x, int y, int z, short roomNumber);
|
||||||
int is_object_in_room(short roomNumber, short objectNumber);
|
int is_object_in_room(short roomNumber, short objectNumber);
|
||||||
void InterpolateAngle(short angle, short* rotation, short* outAngle, int shift);
|
void InterpolateAngle(short angle, short* rotation, short* outAngle, int shift);
|
||||||
|
int IsRoomOutside(int x, int y, int z);
|
||||||
|
|
||||||
unsigned __stdcall GameMain(void*);
|
unsigned __stdcall GameMain(void*);
|
||||||
void Inject_Control();
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "debris.h"
|
#include "debris.h"
|
||||||
#include "../Specific/roomload.h"
|
#include "../Specific/level.h"
|
||||||
#include "../Specific/setup.h"
|
#include "../Specific/setup.h"
|
||||||
|
#include "control.h"
|
||||||
|
|
||||||
ShatterImpactInfo ShatterImpactData;
|
ShatterImpactInfo ShatterImpactData;
|
||||||
SHATTER_ITEM ShatterItem;
|
SHATTER_ITEM ShatterItem;
|
||||||
|
@ -18,11 +19,6 @@ DebrisFragment* GetFreeDebrisFragment()
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inject_Debris()
|
|
||||||
{
|
|
||||||
//INJECT(0x0041D6B0, ShatterObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
extern Renderer11* g_Renderer;
|
extern Renderer11* g_Renderer;
|
||||||
|
@ -51,7 +47,7 @@ void ShatterObject(SHATTER_ITEM* item, MESH_INFO* mesh, int num,short roomNumber
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!fragment->active) {
|
if (!fragment->active) {
|
||||||
Matrix rotationMatrix = Matrix::CreateFromYawPitchRoll(TR_ANGLE_TO_RAD(yRot), 0, 0);
|
Matrix rotationMatrix = Matrix::CreateFromYawPitchRoll(TO_RAD(yRot), 0, 0);
|
||||||
RendererVertex vtx0 = meshVertices->at(fragmentsMesh->Buckets[bucket].Indices[i]);
|
RendererVertex vtx0 = meshVertices->at(fragmentsMesh->Buckets[bucket].Indices[i]);
|
||||||
RendererVertex vtx1 = meshVertices->at(fragmentsMesh->Buckets[bucket].Indices[i + 1]);
|
RendererVertex vtx1 = meshVertices->at(fragmentsMesh->Buckets[bucket].Indices[i + 1]);
|
||||||
RendererVertex vtx2 = meshVertices->at(fragmentsMesh->Buckets[bucket].Indices[i + 2]);
|
RendererVertex vtx2 = meshVertices->at(fragmentsMesh->Buckets[bucket].Indices[i + 2]);
|
||||||
|
|
|
@ -39,5 +39,4 @@ extern short SmashedMeshRoom[32];
|
||||||
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);
|
||||||
DebrisFragment* GetFreeDebrisFragment();
|
DebrisFragment* GetFreeDebrisFragment();
|
||||||
Vector3 CalculateFragmentImpactVelocity(Vector3 fragmentWorldPosition, Vector3 impactDirection, Vector3 impactLocation);
|
Vector3 CalculateFragmentImpactVelocity(Vector3 fragmentWorldPosition, Vector3 impactDirection, Vector3 impactLocation);
|
||||||
void UpdateDebris();
|
void UpdateDebris();
|
||||||
void Inject_Debris();
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "deltapak.h"
|
#include "deltapak.h"
|
||||||
#include "..\Global\global.h"
|
#include "..\Global\global.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "../Specific/level.h"
|
||||||
|
|
||||||
ITEM_INFO* FindItem(short objectNumber)
|
ITEM_INFO* FindItem(short objectNumber)
|
||||||
{
|
{
|
||||||
|
@ -8,7 +9,7 @@ ITEM_INFO* FindItem(short objectNumber)
|
||||||
printf("Called FindItem()\n");
|
printf("Called FindItem()\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DB_Log(0, "FindItem - DLL");
|
//DB_Log(0, "FindItem - DLL");
|
||||||
|
|
||||||
if (LevelItems > 0)
|
if (LevelItems > 0)
|
||||||
{
|
{
|
||||||
|
@ -21,8 +22,3 @@ ITEM_INFO* FindItem(short objectNumber)
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inject_DeltaPak()
|
|
||||||
{
|
|
||||||
INJECT(0x00423470, FindItem);
|
|
||||||
}
|
|
|
@ -1,5 +1,3 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "..\Global\global.h"
|
#include "..\Global\global.h"
|
||||||
|
|
||||||
void Inject_DeltaPak();
|
|
|
@ -10,6 +10,9 @@
|
||||||
#include "switch.h"
|
#include "switch.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "Box.h"
|
#include "Box.h"
|
||||||
|
#include "../Specific/level.h"
|
||||||
|
#include "../Specific/input.h"
|
||||||
|
#include "sound.h"
|
||||||
|
|
||||||
PHD_VECTOR DoubleDoorPos = { 0, 0, 220 };
|
PHD_VECTOR DoubleDoorPos = { 0, 0, 220 };
|
||||||
PHD_VECTOR PullDoorPos = { -201, 0, 322 };
|
PHD_VECTOR PullDoorPos = { -201, 0, 322 };
|
||||||
|
@ -35,6 +38,7 @@ static short CrowbarDoorBounds[12] =
|
||||||
|
|
||||||
ITEM_INFO* ClosedDoors[32];
|
ITEM_INFO* ClosedDoors[32];
|
||||||
byte LiftDoor;
|
byte LiftDoor;
|
||||||
|
int DontUnlockBox;
|
||||||
|
|
||||||
extern byte SequenceUsed[6];
|
extern byte SequenceUsed[6];
|
||||||
extern byte SequenceResults[3][3][3];
|
extern byte SequenceResults[3][3][3];
|
||||||
|
@ -709,7 +713,7 @@ void InitialiseDoor(short itemNumber)
|
||||||
if (item->objectNumber == ID_LIFT_DOORS1 || item->objectNumber == ID_LIFT_DOORS2)
|
if (item->objectNumber == ID_LIFT_DOORS1 || item->objectNumber == ID_LIFT_DOORS2)
|
||||||
item->itemFlags[0] = 4096;
|
item->itemFlags[0] = 4096;
|
||||||
|
|
||||||
DOOR_DATA * door = (DOOR_DATA*)GameMalloc(sizeof(DOOR_DATA));
|
DOOR_DATA * door = (DOOR_DATA*)game_malloc(sizeof(DOOR_DATA));
|
||||||
|
|
||||||
item->data = door;
|
item->data = door;
|
||||||
door->opened = false;
|
door->opened = false;
|
||||||
|
@ -966,7 +970,7 @@ void ProcessClosedDoors()
|
||||||
{
|
{
|
||||||
if (!(item->inDrawRoom))
|
if (!(item->inDrawRoom))
|
||||||
{
|
{
|
||||||
ItemNewRoom((item - Items) / sizeof(ITEM_INFO), item->drawRoom);
|
ItemNewRoom(item - Items, item->drawRoom);
|
||||||
item->roomNumber = roomNumber;
|
item->roomNumber = roomNumber;
|
||||||
item->inDrawRoom = true;
|
item->inDrawRoom = true;
|
||||||
}
|
}
|
||||||
|
@ -974,7 +978,7 @@ void ProcessClosedDoors()
|
||||||
else if (item->inDrawRoom)
|
else if (item->inDrawRoom)
|
||||||
{
|
{
|
||||||
item->roomNumber = item->drawRoom;
|
item->roomNumber = item->drawRoom;
|
||||||
ItemNewRoom((item - Items) / sizeof(ITEM_INFO), roomNumber);
|
ItemNewRoom(item - Items, roomNumber);
|
||||||
item->inDrawRoom = false;
|
item->inDrawRoom = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1016,16 +1020,3 @@ void SteelDoorCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inject_Door()
|
|
||||||
{
|
|
||||||
INJECT(0x00429EC0, SequenceDoorControl);
|
|
||||||
INJECT(0x00429CF0, UnderwaterDoorCollision);
|
|
||||||
INJECT(0x00429B30, DoubleDoorCollision);
|
|
||||||
INJECT(0x004298D0, PushPullKickDoorCollision);
|
|
||||||
INJECT(0x00429840, PushPullKickDoorControl);
|
|
||||||
INJECT(0x00429550, DoorCollision);
|
|
||||||
INJECT(0x00429140, DoorControl);
|
|
||||||
INJECT(0x00428FD0, OpenThatDoor);
|
|
||||||
INJECT(0x00428EF0, ShutThatDoor);
|
|
||||||
}
|
|
|
@ -19,5 +19,3 @@ void InitialiseClosedDoors();
|
||||||
void ProcessClosedDoors();
|
void ProcessClosedDoors();
|
||||||
void GetClosedDoorNormal(ROOM_INFO* room, short** dptr, byte* n, int z, int x, int absX, int absZ);
|
void GetClosedDoorNormal(ROOM_INFO* room, short** dptr, byte* n, int z, int x, int absX, int absZ);
|
||||||
void FillDoorPointers(DOOR_DATA* doorData, ITEM_INFO* item, short roomNumber, int dz, int dx);
|
void FillDoorPointers(DOOR_DATA* doorData, ITEM_INFO* item, short roomNumber, int dz, int dx);
|
||||||
|
|
||||||
void Inject_Door();
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "Lara.h"
|
#include "Lara.h"
|
||||||
#include "..\Renderer\Renderer11.h"
|
#include "..\Renderer\Renderer11.h"
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
|
#include "../Specific/level.h"
|
||||||
|
|
||||||
BITE_INFO EnemyBites[9] =
|
BITE_INFO EnemyBites[9] =
|
||||||
{
|
{
|
||||||
|
@ -28,21 +29,12 @@ short InterpolatedBounds[6];
|
||||||
LARGE_INTEGER PerformanceCount;
|
LARGE_INTEGER PerformanceCount;
|
||||||
double LdFreq;
|
double LdFreq;
|
||||||
double LdSync;
|
double LdSync;
|
||||||
|
int GnFrameCounter;
|
||||||
|
|
||||||
int DrawPhaseGame()
|
int DrawPhaseGame()
|
||||||
{
|
{
|
||||||
// Control routines uses joints calculated here for getting Lara joint positions
|
|
||||||
CalcLaraMatrices(0);
|
|
||||||
phd_PushUnitMatrix();
|
|
||||||
CalcLaraMatrices(1);
|
|
||||||
|
|
||||||
// Calls my new rock & roll renderer :)
|
|
||||||
g_Renderer->Draw();
|
g_Renderer->Draw();
|
||||||
Camera.numberFrames = g_Renderer->SyncRenderer();
|
Camera.numberFrames = g_Renderer->SyncRenderer();
|
||||||
|
|
||||||
// We need to pop the matrix stack or the game will crash
|
|
||||||
phd_PopMatrix();
|
|
||||||
|
|
||||||
return Camera.numberFrames;
|
return Camera.numberFrames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +155,6 @@ bool TIME_Init()
|
||||||
|
|
||||||
int Sync()
|
int Sync()
|
||||||
{
|
{
|
||||||
int nFrames;
|
|
||||||
LARGE_INTEGER ct;
|
LARGE_INTEGER ct;
|
||||||
double dCounter;
|
double dCounter;
|
||||||
|
|
||||||
|
@ -172,7 +163,7 @@ int Sync()
|
||||||
dCounter = (double)ct.LowPart + (double)ct.HighPart * (double)0xFFFFFFFF;
|
dCounter = (double)ct.LowPart + (double)ct.HighPart * (double)0xFFFFFFFF;
|
||||||
dCounter /= LdFreq;
|
dCounter /= LdFreq;
|
||||||
|
|
||||||
nFrames = long(dCounter) - long(LdSync);
|
long nFrames = long(dCounter) - long(LdSync);
|
||||||
|
|
||||||
LdSync = dCounter;
|
LdSync = dCounter;
|
||||||
|
|
||||||
|
@ -182,136 +173,18 @@ int Sync()
|
||||||
void DrawAnimatingItem(ITEM_INFO* item)
|
void DrawAnimatingItem(ITEM_INFO* item)
|
||||||
{
|
{
|
||||||
// TODO: to refactor
|
// TODO: to refactor
|
||||||
// Empty stub because actually we disable items draing when drawRoutine pointer is NULL in OBJECT_INFO
|
// Empty stub because actually we disable items drawing when drawRoutine pointer is NULL in ObjectInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
void _InitInterpolate(void)
|
void GetLaraJointPosition(PHD_VECTOR* pos, int joint)
|
||||||
{
|
{
|
||||||
}
|
if (joint > 14)
|
||||||
|
joint = 14;
|
||||||
|
|
||||||
void _phd_PushMatrix(void)
|
Vector3 p = Vector3(pos->x, pos->y, pos->z);
|
||||||
{
|
g_Renderer->GetLaraAbsBonePosition(&p, joint);
|
||||||
}
|
|
||||||
|
|
||||||
void _phd_PushMatrix_I(void)
|
pos->x = p.x;
|
||||||
{
|
pos->y = p.y;
|
||||||
|
pos->z = p.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _phd_PushUnitMatrix(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void _phd_RotYXZ(short ry, short rx, short rz)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void _phd_RotY(short ry)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void _phd_RotY_I(short ry)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void _phd_RotX(short rx)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void _phd_RotX_I(short rx)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void _phd_RotZ(short rz)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void _phd_RotZ_I(short rz)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void _phd_PutPolygons(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void _phd_PutPolygons_I(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void _phd_TranslateRel(int x, int y, int z)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void _phd_TranslateRel_I(int x, int y, int z)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void _phd_TranslateRel_ID(int x1, int y1, int z1, int x2, int y2, int z2)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void _phd_TranslateAbs(int x, int y, int z)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void _phd_RotYXZpack(short ry, short rx, short rz)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void _gar_RotYXZsuperpack(short** pproc, int skip)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void _gar_RotYXZsuperpack_I(short** pproc1, short** pproc2, int skip)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void _phd_ClipBoundingBox(short* frames)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void _phd_DxTranslateRel(int x, int y, int z)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void _phd_DxTranslateAbs(int x, int y, int z)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void _phd_DxRotY(short ry)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void _phd_DxRotX(short rx)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void _phd_DxRotZ(short rz)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void _phd_DxRotYXZ(short ry, short rx, short rz)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void _phd_DxRotYXZpack(int rangle)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void phd_PopMatrix(void)
|
|
||||||
{
|
|
||||||
MatrixPtr -= 12;
|
|
||||||
DxMatrixPtr -= 48;
|
|
||||||
}
|
|
||||||
|
|
||||||
void _phd_PopMatrix_I(void)
|
|
||||||
{
|
|
||||||
MatrixPtr -= 12;
|
|
||||||
DxMatrixPtr -= 48;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Inject_Draw()
|
|
||||||
{
|
|
||||||
/*INJECT(GetBoundsAccurate, 0x0042CF80);
|
|
||||||
INJECT(GetBestFrame, 0x0042D020);
|
|
||||||
INJECT(Sync, 0x004D1A40);*/
|
|
||||||
}
|
|
|
@ -2,56 +2,15 @@
|
||||||
|
|
||||||
#include "..\Global\global.h"
|
#include "..\Global\global.h"
|
||||||
|
|
||||||
//#define GetBoundsAccurate ((short* (__cdecl*)(ITEM_INFO*)) 0x0042CF80)
|
extern Renderer11* g_Renderer;
|
||||||
//#define GetBestFrame ((short* (__cdecl*)(ITEM_INFO*)) 0x0042D020)
|
extern BITE_INFO EnemyBites[9];
|
||||||
#define CalcLaraMatrices ((void (__cdecl*)(int)) 0x0041E120)
|
|
||||||
//#define Sync ((int (__cdecl*)()) 0x004D1A40)
|
|
||||||
#define IsRoomOutside ((int (__cdecl*)(int, int, int)) 0x00418E90)
|
|
||||||
#define sub_42B4C0 ((void (__cdecl*)(ITEM_INFO*,short*)) 0x0042B4C0)
|
|
||||||
|
|
||||||
#define InitInterpolate ((void(__cdecl*)(int,int)) 0x0042BE90)
|
|
||||||
#define phd_PushMatrix ((void(__cdecl*)(void)) 0x0048F9C0)
|
|
||||||
#define phd_PushMatrix_I ((void(__cdecl*)(void)) 0x0042BF50)
|
|
||||||
#define phd_PushUnitMatrix ((void (__cdecl*)()) 0x0048FA90)
|
|
||||||
#define phd_GetVectorAngles ((void(__cdecl*)(int, int, int, short*)) 0x004904B0)
|
|
||||||
#define phd_RotYXZ ((void(__cdecl*)(short, short, short)) 0x00490150)
|
|
||||||
#define phd_PutPolygons ((void(__cdecl*)(short*)) 0x004B3F00)
|
|
||||||
#define phd_PutPolygons_I ((void(__cdecl*)(short*)) 0x0042C3F0)
|
|
||||||
#define phd_TranslateRel ((void(__cdecl*)(int, int, int)) 0x0048FB20)
|
|
||||||
#define phd_TranslateRel_I ((void(__cdecl*)(int, int, int)) 0x0042C110)
|
|
||||||
#define phd_TranslateRel_ID ((void(__cdecl*)(int,int,int,int,int,int)) 0x0042C190)
|
|
||||||
#define phd_TranslateAbs ((void(__cdecl*)(int, int, int)) 0x004903F0)
|
|
||||||
#define phd_RotYXZpack ((void(__cdecl*)(int)) 0x0048FEB0)
|
|
||||||
#define gar_RotYXZsuperpack ((void(__cdecl*)(short**,int)) 0x0042C310)
|
|
||||||
#define gar_RotYXZsuperpack_I ((void(__cdecl*)(short**,short**,int)) 0x0042C290)
|
|
||||||
#define phd_ClipBoundingBox ((int(__cdecl*)(short*)) 0x004B7EB0) // int S_GetObjectBounds(frames[0])
|
|
||||||
#define phd_PopMatrix_I ((void(__cdecl*)(void)) 0x0042BF00)
|
|
||||||
#define phd_RotY ((void(__cdecl*)(short)) 0x0048FCD0)
|
|
||||||
#define phd_RotX ((void(__cdecl*)(short)) 0x0048FBE0)
|
|
||||||
#define phd_RotZ ((void(__cdecl*)(short)) 0x0048FDC0)
|
|
||||||
#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)
|
|
||||||
#define phd_DxRotX ((void(__cdecl*)(short)) 0x00490810)
|
|
||||||
#define phd_DxRotY ((void(__cdecl*)(short)) 0x004908E0)
|
|
||||||
#define phd_DxRotZ ((void(__cdecl*)(short)) 0x004909B0)
|
|
||||||
#define phd_DxRotYXZ ((void(__cdecl*)(int, int, int)) 0x00490AF0)
|
|
||||||
#define phd_DxRotYXZpack ((void(__cdecl*)(int)) 0x00490A80)
|
|
||||||
|
|
||||||
#define mGetAngle ((int(__cdecl*)(int, int, int, int)) 0x0048F290)
|
|
||||||
#define phd_GenerateW2V ((void(__cdecl*)(PHD_3DPOS*)) 0x0048F330)
|
|
||||||
|
|
||||||
extern int LightningCount;
|
extern int LightningCount;
|
||||||
extern int LightningRand;
|
extern int LightningRand;
|
||||||
extern int StormTimer;
|
extern int StormTimer;
|
||||||
extern int dLightningRand;
|
extern int dLightningRand;
|
||||||
extern byte SkyStormColor[3];
|
extern byte SkyStormColor[3];
|
||||||
extern byte SkyStormColor2[3];
|
extern byte SkyStormColor2[3];
|
||||||
|
extern int GnFrameCounter;
|
||||||
|
|
||||||
int DrawPhaseGame();
|
int DrawPhaseGame();
|
||||||
int GetFrame_D2(ITEM_INFO* item, short* framePtr[], int* rate);
|
int GetFrame_D2(ITEM_INFO* item, short* framePtr[], int* rate);
|
||||||
|
@ -62,44 +21,4 @@ int Sync();
|
||||||
bool TIME_Init();
|
bool TIME_Init();
|
||||||
bool TIME_Reset();
|
bool TIME_Reset();
|
||||||
void DrawAnimatingItem(ITEM_INFO* item);
|
void DrawAnimatingItem(ITEM_INFO* item);
|
||||||
|
void GetLaraJointPosition(PHD_VECTOR* pos, int joint);
|
||||||
/* phd function (DX11 version) */
|
|
||||||
// TODO: phd_XX function after this lign is used with DX11 one, when it's finished, delete the #define one and delete this sign: "_" at the beginning of the new function. (delete the unused if needed)
|
|
||||||
|
|
||||||
void _InitInterpolate(void);
|
|
||||||
void _phd_PushMatrix(void);
|
|
||||||
void _phd_PushMatrix_I(void);
|
|
||||||
void _phd_PushUnitMatrix(void);
|
|
||||||
void _phd_RotYXZ(short ry, short rx, short rz);
|
|
||||||
void _phd_RotY(short ry);
|
|
||||||
void _phd_RotY_I(short ry);
|
|
||||||
void _phd_RotX(short rx);
|
|
||||||
void _phd_RotX_I(short rx);
|
|
||||||
void _phd_RotZ(short rz);
|
|
||||||
void _phd_RotZ_I(short rz);
|
|
||||||
void _phd_PutPolygons(void);
|
|
||||||
void _phd_PutPolygons_I(void);
|
|
||||||
void _phd_TranslateRel(int x, int y, int z);
|
|
||||||
void _phd_TranslateRel_I(int x, int y, int z);
|
|
||||||
void _phd_TranslateRel_ID(int x1, int y1, int z1, int x2, int y2, int z2);
|
|
||||||
void _phd_TranslateAbs(int x, int y, int z);
|
|
||||||
void _phd_RotYXZpack(short ry, short rx, short rz);
|
|
||||||
void _gar_RotYXZsuperpack(short** pproc, int skip);
|
|
||||||
void _gar_RotYXZsuperpack_I(short** pproc1, short** pproc2, int skip);
|
|
||||||
void _phd_ClipBoundingBox(short* frames);
|
|
||||||
|
|
||||||
void _phd_DxTranslateRel(int x, int y, int z);
|
|
||||||
void _phd_DxTranslateAbs(int x, int y, int z);
|
|
||||||
void _phd_DxRotY(short ry);
|
|
||||||
void _phd_DxRotX(short rx);
|
|
||||||
void _phd_DxRotZ(short rz);
|
|
||||||
void _phd_DxRotYXZ(short ry, short rx, short rz);
|
|
||||||
void _phd_DxRotYXZpack(int rangle);
|
|
||||||
|
|
||||||
void phd_PopMatrix(void);
|
|
||||||
void _phd_PopMatrix_I(void);
|
|
||||||
|
|
||||||
extern Renderer11* g_Renderer;
|
|
||||||
extern BITE_INFO EnemyBites[9];
|
|
||||||
|
|
||||||
void Inject_Draw();
|
|
|
@ -3,8 +3,12 @@
|
||||||
#include "tomb4fx.h"
|
#include "tomb4fx.h"
|
||||||
#include "traps.h"
|
#include "traps.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
|
#include "lara.h"
|
||||||
|
#include "effects.h"
|
||||||
|
#include "sound.h"
|
||||||
#include "..\Scripting\GameFlowScript.h"
|
#include "..\Scripting\GameFlowScript.h"
|
||||||
#include "../Specific/setup.h"
|
#include "../Specific/setup.h"
|
||||||
|
#include "../Specific/level.h"
|
||||||
|
|
||||||
//long wibble;
|
//long wibble;
|
||||||
//long SplashCount;
|
//long SplashCount;
|
||||||
|
@ -1246,9 +1250,9 @@ void TriggerWaterfallMist(int x, int y, int z, int angle)
|
||||||
spark->life = spark->sLife = (GetRandomControl() & 3) + 6;
|
spark->life = spark->sLife = (GetRandomControl() & 3) + 6;
|
||||||
spark->fadeToBlack = spark->life - 4;
|
spark->fadeToBlack = spark->life - 4;
|
||||||
dl = ((dh + (GlobalCounter << 6)) % 1536) + (GetRandomControl() & 0x3F) - 32;
|
dl = ((dh + (GlobalCounter << 6)) % 1536) + (GetRandomControl() & 0x3F) - 32;
|
||||||
spark->x = dl * SIN(ang1) >> W2V_SHIFT + (GetRandomControl() & 0xF) + x - 8;
|
spark->x = dl * phd_sin(ang1) >> W2V_SHIFT + (GetRandomControl() & 0xF) + x - 8;
|
||||||
spark->y = (GetRandomControl() & 0xF) + y - 8;
|
spark->y = (GetRandomControl() & 0xF) + y - 8;
|
||||||
spark->z = dl * COS(ang1) >> W2V_SHIFT + (GetRandomControl() & 0xF) + z - 8;
|
spark->z = dl * phd_cos(ang1) >> W2V_SHIFT + (GetRandomControl() & 0xF) + z - 8;
|
||||||
spark->xVel = 0;
|
spark->xVel = 0;
|
||||||
spark->zVel = 0;
|
spark->zVel = 0;
|
||||||
spark->friction = 0;
|
spark->friction = 0;
|
||||||
|
@ -1280,11 +1284,11 @@ void TriggerWaterfallMist(int x, int y, int z, int angle)
|
||||||
spark->life = spark->sLife = (GetRandomControl() & 3) + 6;
|
spark->life = spark->sLife = (GetRandomControl() & 3) + 6;
|
||||||
spark->fadeToBlack = spark->life - 1;
|
spark->fadeToBlack = spark->life - 1;
|
||||||
dl = GetRandomControl() % 1408 + 64;
|
dl = GetRandomControl() % 1408 + 64;
|
||||||
spark->x = dl * SIN(ang1) >> W2V_SHIFT + (GetRandomControl() & 0x1F) + x - 16;
|
spark->x = dl * phd_sin(ang1) >> W2V_SHIFT + (GetRandomControl() & 0x1F) + x - 16;
|
||||||
spark->y = (GetRandomControl() & 0xF) + y - 8;
|
spark->y = (GetRandomControl() & 0xF) + y - 8;
|
||||||
spark->xVel = 0;
|
spark->xVel = 0;
|
||||||
spark->zVel = 0;
|
spark->zVel = 0;
|
||||||
spark->z = dl * COS(ang1) >> W2V_SHIFT + (GetRandomControl() & 0x1F) + z - 16;
|
spark->z = dl * phd_cos(ang1) >> W2V_SHIFT + (GetRandomControl() & 0x1F) + z - 16;
|
||||||
spark->friction = 0;
|
spark->friction = 0;
|
||||||
spark->flags = 10;
|
spark->flags = 10;
|
||||||
spark->yVel = GetRandomControl() & 0x100 + (GetRandomControl() & 0x7F) + 128;
|
spark->yVel = GetRandomControl() & 0x100 + (GetRandomControl() & 0x7F) + 128;
|
||||||
|
@ -1949,31 +1953,4 @@ void TriggerMetalSparks(int x, int y, int z, int xv, int yv, int zv, int additio
|
||||||
void KillEverything()//338AC(<), 33DAC(<) (F)
|
void KillEverything()//338AC(<), 33DAC(<) (F)
|
||||||
{
|
{
|
||||||
KillEverythingFlag = 0;
|
KillEverythingFlag = 0;
|
||||||
}
|
|
||||||
|
|
||||||
void Inject_Effect2()
|
|
||||||
{
|
|
||||||
INJECT(0x00431240, TriggerDynamicLight);
|
|
||||||
INJECT(0x004820A0, TriggerGunSmoke);
|
|
||||||
INJECT(0x0042E6A0, DetatchSpark);
|
|
||||||
INJECT(0x0042E790, GetFreeSpark);
|
|
||||||
INJECT(0x0042E8B0, UpdateSparks);
|
|
||||||
INJECT(0x0042F060, TriggerRicochetSpark);
|
|
||||||
INJECT(0x0042F460, TriggerCyborgSpark);
|
|
||||||
INJECT(0x0042F610, TriggerExplosionSparks);
|
|
||||||
INJECT(0x0042FA10, TriggerExplosionSmokeEnd);
|
|
||||||
INJECT(0x0042FC20, TriggerExplosionSmoke);
|
|
||||||
INJECT(0x0042FE20, TriggerFireFlame);
|
|
||||||
INJECT(0x00430350, TriggerSuperJetFlame);
|
|
||||||
INJECT(0x00430620, SetupSplash);
|
|
||||||
INJECT(0x00430710, UpdateSplashes);
|
|
||||||
INJECT(0x00430910, SetupRipple);
|
|
||||||
INJECT(0x004309B0, TriggerUnderwaterBlood);
|
|
||||||
INJECT(0x00430A40, TriggerWaterfallMist);
|
|
||||||
INJECT(0x00430D90, TriggerDartSmoke);
|
|
||||||
INJECT(0x00431030, KillAllCurrentItems);
|
|
||||||
INJECT(0x00431240, TriggerDynamicLight);
|
|
||||||
INJECT(0x00431530, ClearDynamicLights);
|
|
||||||
INJECT(0x00432A30, WadeSplash);
|
|
||||||
INJECT(0x00432900, Splash);
|
|
||||||
}
|
}
|
|
@ -2,8 +2,6 @@
|
||||||
#include <d3d11.h>
|
#include <d3d11.h>
|
||||||
#include "..\Global\global.h"
|
#include "..\Global\global.h"
|
||||||
|
|
||||||
#define ExplodingDeath ((void (__cdecl*)(short, int, int)) 0x00484080)
|
|
||||||
#define DrawLensFlare ((void (__cdecl*)(ITEM_INFO*)) 0x00485290)
|
|
||||||
#define RIPPLE_FLAG_BLOOD 0x80
|
#define RIPPLE_FLAG_BLOOD 0x80
|
||||||
#define RIPPLE_FLAG_RAND_POS 0x40
|
#define RIPPLE_FLAG_RAND_POS 0x40
|
||||||
#define RIPPLE_FLAG_RAND_ROT 0x20
|
#define RIPPLE_FLAG_RAND_ROT 0x20
|
||||||
|
@ -70,5 +68,4 @@ void GrenadeLauncherSpecialEffect1(int x, int y, int z, int flag1, int flag2);
|
||||||
void GrenadeExplosionEffects(int x, int y, int z, short roomNumber);
|
void GrenadeExplosionEffects(int x, int y, int z, short roomNumber);
|
||||||
void TriggerMetalSparks(int x, int y, int z, int xv, int yv, int zv, int additional);
|
void TriggerMetalSparks(int x, int y, int z, int xv, int yv, int zv, int additional);
|
||||||
void WadeSplash(ITEM_INFO* item, int wh, int wd);
|
void WadeSplash(ITEM_INFO* item, int wh, int wd);
|
||||||
void Splash(ITEM_INFO* item);
|
void Splash(ITEM_INFO* item);
|
||||||
void Inject_Effect2();
|
|
|
@ -10,15 +10,18 @@
|
||||||
#include "sphere.h"
|
#include "sphere.h"
|
||||||
#include "footprint.h"
|
#include "footprint.h"
|
||||||
#include "..\Objects\oldobjects.h"
|
#include "..\Objects\oldobjects.h"
|
||||||
#include "..\Specific\roomload.h"
|
#include "..\Specific\level.h"
|
||||||
#include "debris.h"
|
#include "debris.h"
|
||||||
#include "../Specific/setup.h"
|
#include "../Specific/setup.h"
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
|
#include "savegame.h"
|
||||||
|
#include "sound.h"
|
||||||
|
|
||||||
int wf = 256;
|
int wf = 256;
|
||||||
extern std::deque<FOOTPRINT_STRUCT> footprints;
|
extern std::deque<FOOTPRINT_STRUCT> footprints;
|
||||||
|
|
||||||
short FXType;
|
short FXType;
|
||||||
|
FX_INFO* Effects;
|
||||||
|
|
||||||
void(*effect_routines[59])(ITEM_INFO* item) =
|
void(*effect_routines[59])(ITEM_INFO* item) =
|
||||||
{
|
{
|
||||||
|
@ -448,14 +451,14 @@ void ControlWaterfallMist(short itemNumber) // ControlWaterfallMist
|
||||||
|
|
||||||
if (item->pos.yRot == -ANGLE(180))
|
if (item->pos.yRot == -ANGLE(180))
|
||||||
{
|
{
|
||||||
x = item->pos.xPos - (SIN(item->pos.yRot + ANGLE(180)) >> 3) + ((rcossin_tbl[2048] * wf) >> W2V_SHIFT);
|
x = item->pos.xPos - (phd_sin(item->pos.yRot + ANGLE(180)) >> 3) + ((rcossin_tbl[2048] * wf) >> W2V_SHIFT);
|
||||||
z = item->pos.zPos - (COS(item->pos.yRot + ANGLE(180)) >> 3) + ((rcossin_tbl[2049] * wf) >> W2V_SHIFT);
|
z = item->pos.zPos - (phd_cos(item->pos.yRot + ANGLE(180)) >> 3) + ((rcossin_tbl[2049] * wf) >> W2V_SHIFT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//3934C
|
//3934C
|
||||||
x = item->pos.xPos - (SIN(item->pos.yRot + ANGLE(180)) >> 3) + ((SIN(item->pos.yRot + ANGLE(90)) * wf) >> W2V_SHIFT);
|
x = item->pos.xPos - (phd_sin(item->pos.yRot + ANGLE(180)) >> 3) + ((phd_sin(item->pos.yRot + ANGLE(90)) * wf) >> W2V_SHIFT);
|
||||||
z = item->pos.zPos - (COS(item->pos.yRot + ANGLE(180)) >> 3) + ((COS(item->pos.yRot + ANGLE(90)) * wf) >> W2V_SHIFT);
|
z = item->pos.zPos - (phd_cos(item->pos.yRot + ANGLE(180)) >> 3) + ((phd_cos(item->pos.yRot + ANGLE(90)) * wf) >> W2V_SHIFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
//393A0
|
//393A0
|
||||||
|
@ -503,11 +506,13 @@ void Richochet(PHD_3DPOS* pos)
|
||||||
SoundEffect(SFX_LARA_RICOCHET, pos, 0);
|
SoundEffect(SFX_LARA_RICOCHET, pos, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inject_Effects()
|
void DoLotsOfBlood(int x, int y, int z, int speed, short direction, short roomNumber, int count)
|
||||||
{
|
{
|
||||||
INJECT(0x00432580, ItemNearLara);
|
for (int i = 0; i < count; i++)
|
||||||
INJECT(0x00478FE0, StopSoundEffect);
|
{
|
||||||
INJECT(0x00432760, DoBloodSplat);
|
DoBloodSplat(x + 256 - (GetRandomControl() * 512 / 0x8000),
|
||||||
INJECT(0x00402FB3, ClearSpidersPatch);
|
y + 256 - (GetRandomControl() * 512 / 0x8000),
|
||||||
INJECT(0x00432710, Richochet);
|
z + 256 - (GetRandomControl() * 512 / 0x8000),
|
||||||
}
|
speed, direction, roomNumber);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
#include "..\Global\global.h"
|
#include "..\Global\global.h"
|
||||||
#include "control.h"
|
#include "control.h"
|
||||||
|
|
||||||
#define DoLotsOfBlood ((void (__cdecl*)(int, int, int, short, short, short, int)) 0x00432800)
|
extern FX_INFO* Effects;
|
||||||
#define SoundEffects ((void (__cdecl*)()) 0x00432640)
|
|
||||||
|
|
||||||
int ItemNearLara(PHD_3DPOS* pos, int radius);
|
int ItemNearLara(PHD_3DPOS* pos, int radius);
|
||||||
void StopSoundEffect(short sampleIndex);
|
void StopSoundEffect(short sampleIndex);
|
||||||
|
@ -47,6 +46,4 @@ void TL_10(ITEM_INFO* item);
|
||||||
void TL_11(ITEM_INFO* item);
|
void TL_11(ITEM_INFO* item);
|
||||||
void TL_12(ITEM_INFO* item);
|
void TL_12(ITEM_INFO* item);
|
||||||
void Richochet(PHD_3DPOS* pos);
|
void Richochet(PHD_3DPOS* pos);
|
||||||
|
void DoLotsOfBlood(int x, int y, int z, int speed, short direction, short roomNumber, int count);
|
||||||
void Inject_Effects();
|
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,12 @@
|
||||||
#include "collide.h"
|
#include "collide.h"
|
||||||
#include "laramisc.h"
|
#include "laramisc.h"
|
||||||
#include "switch.h"
|
#include "switch.h"
|
||||||
|
#include "draw.h"
|
||||||
#include "items.h"
|
#include "items.h"
|
||||||
#include "..\Specific\roomload.h"
|
#include "..\Specific\level.h"
|
||||||
#include "../Specific/setup.h"
|
#include "../Specific/setup.h"
|
||||||
|
#include "../Specific/input.h"
|
||||||
|
#include "sound.h"
|
||||||
|
|
||||||
short FireBounds[12] =
|
short FireBounds[12] =
|
||||||
{
|
{
|
||||||
|
@ -158,7 +161,7 @@ void DoFlameTorch() // (F) (D)
|
||||||
pos.y = 64;
|
pos.y = 64;
|
||||||
pos.z = 256;
|
pos.z = 256;
|
||||||
|
|
||||||
GetLaraJointPosition(&pos, LJ_LHAND);
|
GetLaraJointPosition(&pos, LM_LHAND);
|
||||||
|
|
||||||
TriggerDynamicLight(pos.x, pos.y, pos.z, 12 - (GetRandomControl() & 1), (GetRandomControl() & 0x3F) + 192, (GetRandomControl() & 0x1F) + 96, 0);
|
TriggerDynamicLight(pos.x, pos.y, pos.z, 12 - (GetRandomControl() & 1), (GetRandomControl() & 0x3F) + 192, (GetRandomControl() & 0x1F) + 96, 0);
|
||||||
|
|
||||||
|
@ -203,8 +206,8 @@ void TorchControl(short itemNumber) // (F) (D)
|
||||||
item->pos.zRot = 0;
|
item->pos.zRot = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int xv = item->speed * SIN(item->pos.yRot) >> W2V_SHIFT;
|
int xv = item->speed * phd_sin(item->pos.yRot) >> W2V_SHIFT;
|
||||||
int zv = item->speed * COS(item->pos.yRot) >> W2V_SHIFT;
|
int zv = item->speed * phd_cos(item->pos.yRot) >> W2V_SHIFT;
|
||||||
|
|
||||||
item->pos.xPos += xv;
|
item->pos.xPos += xv;
|
||||||
item->pos.zPos += zv;
|
item->pos.zPos += zv;
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
#include "footprint.h"
|
#include "footprint.h"
|
||||||
#include "control.h"
|
#include "control.h"
|
||||||
#include "lara.h"
|
#include "lara.h"
|
||||||
|
#include "draw.h"
|
||||||
#include "groundfx.h"
|
#include "groundfx.h"
|
||||||
|
#include "../Specific/level.h"
|
||||||
|
|
||||||
std::deque<FOOTPRINT_STRUCT> footprints = deque<FOOTPRINT_STRUCT>();
|
std::deque<FOOTPRINT_STRUCT> footprints = deque<FOOTPRINT_STRUCT>();
|
||||||
|
|
||||||
bool CheckFootOnFloor(ITEM_INFO& const item, int mesh, PHD_3DPOS& outFootprintPosition){
|
bool CheckFootOnFloor(ITEM_INFO& const item, int mesh, PHD_3DPOS& outFootprintPosition){
|
||||||
int x = item.pos.xPos;
|
int x = item.pos.xPos;
|
||||||
int y = item.pos.yPos;
|
int y = item.pos.yPos;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include "..\Specific\input.h"
|
#include "..\Specific\input.h"
|
||||||
#include "..\Global\global.h"
|
#include "..\Global\global.h"
|
||||||
|
#include "../Specific/level.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,12 @@
|
||||||
#include "..\Global\global.h"
|
#include "..\Global\global.h"
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
#include "laramisc.h"
|
#include "laramisc.h"
|
||||||
|
#include "lara.h"
|
||||||
|
#include "control.h"
|
||||||
#include "..\Scripting\GameFlowScript.h"
|
#include "..\Scripting\GameFlowScript.h"
|
||||||
#include "../Specific/setup.h"
|
#include "../Specific/setup.h"
|
||||||
|
#include "sphere.h"
|
||||||
|
#include "../Specific/level.h"
|
||||||
|
|
||||||
int FirstHair[2];
|
int FirstHair[2];
|
||||||
HAIR_STRUCT Hairs[2][7];
|
HAIR_STRUCT Hairs[2][7];
|
||||||
|
@ -41,7 +45,7 @@ void InitialiseHair()
|
||||||
void HairControl(int cutscene, int ponytail, short* framePtr)
|
void HairControl(int cutscene, int ponytail, short* framePtr)
|
||||||
{
|
{
|
||||||
SPHERE sphere[5];
|
SPHERE sphere[5];
|
||||||
OBJECT_INFO* object = &Objects[ID_LARA];
|
ObjectInfo* object = &Objects[ID_LARA];
|
||||||
short* frame;
|
short* frame;
|
||||||
int spaz;
|
int spaz;
|
||||||
bool youngLara = g_GameFlow->GetLevel(CurrentLevel)->LaraType == LARA_YOUNG;
|
bool youngLara = g_GameFlow->GetLevel(CurrentLevel)->LaraType == LARA_YOUNG;
|
||||||
|
@ -94,85 +98,48 @@ void HairControl(int cutscene, int ponytail, short* framePtr)
|
||||||
frame = framePtr;
|
frame = framePtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
phd_PushUnitMatrix();
|
// Get Lara's spheres in absolute coords, for head, torso, hips and upper arms
|
||||||
|
|
||||||
*(MatrixPtr + M03) = LaraItem->pos.xPos << W2V_SHIFT;
|
|
||||||
*(MatrixPtr + M13) = LaraItem->pos.yPos << W2V_SHIFT;
|
|
||||||
*(MatrixPtr + M23) = LaraItem->pos.zPos << W2V_SHIFT;
|
|
||||||
phd_RotYXZ(LaraItem->pos.yRot, LaraItem->pos.xRot, LaraItem->pos.zRot);
|
|
||||||
|
|
||||||
short* rotation = frame + 9;
|
|
||||||
int* bone = Bones + object->boneIndex;
|
|
||||||
|
|
||||||
phd_TranslateRel((int) * (frame + 6), (int) * (frame + 7), (int) * (frame + 8));
|
|
||||||
gar_RotYXZsuperpack(&rotation, 0);
|
|
||||||
|
|
||||||
// Hips
|
|
||||||
phd_PushMatrix();
|
|
||||||
short* objptr = Lara.meshPtrs[LM_HIPS];
|
short* objptr = Lara.meshPtrs[LM_HIPS];
|
||||||
phd_TranslateRel(*objptr, *(objptr + 1), *(objptr + 2));
|
PHD_VECTOR pos = { objptr[0], objptr[1], objptr[2] };
|
||||||
sphere[0].x = *(MatrixPtr + M03) >> W2V_SHIFT;
|
GetLaraJointPosition(&pos, LM_HIPS);
|
||||||
sphere[0].y = *(MatrixPtr + M13) >> W2V_SHIFT;
|
sphere[0].x = pos.x;
|
||||||
sphere[0].z = *(MatrixPtr + M23) >> W2V_SHIFT;
|
sphere[0].y = pos.y;
|
||||||
sphere[0].r = (int) * (objptr + 3);
|
sphere[0].z = pos.z;
|
||||||
phd_PopMatrix();
|
sphere[0].r = (int) *(objptr + 3);
|
||||||
|
|
||||||
phd_TranslateRel(*(bone + 1 + 24), *(bone + 2 + 24), *(bone + 3 + 24));
|
|
||||||
|
|
||||||
gar_RotYXZsuperpack(&rotation, 6);
|
|
||||||
phd_RotYXZ(Lara.torsoYrot, Lara.torsoXrot, Lara.torsoZrot);
|
|
||||||
|
|
||||||
// Torso
|
|
||||||
phd_PushMatrix();
|
|
||||||
objptr = Lara.meshPtrs[LM_TORSO];
|
objptr = Lara.meshPtrs[LM_TORSO];
|
||||||
phd_TranslateRel(*objptr, *(objptr + 1), *(objptr + 2));
|
pos = { objptr[0], objptr[1], objptr[2] };
|
||||||
sphere[1].x = *(MatrixPtr + M03) >> W2V_SHIFT;
|
GetLaraJointPosition(&pos, LM_TORSO);
|
||||||
sphere[1].y = *(MatrixPtr + M13) >> W2V_SHIFT;
|
sphere[1].x = pos.x;
|
||||||
sphere[1].z = *(MatrixPtr + M23) >> W2V_SHIFT;
|
sphere[1].y = pos.y;
|
||||||
|
sphere[1].z = pos.z;
|
||||||
sphere[1].r = (int) * (objptr + 3);
|
sphere[1].r = (int) * (objptr + 3);
|
||||||
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));
|
||||||
phd_PopMatrix();
|
|
||||||
|
|
||||||
phd_PushMatrix();
|
|
||||||
phd_TranslateRel(*(bone + 1 + 28), *(bone + 2 + 28), *(bone + 3 + 28));
|
|
||||||
gar_RotYXZsuperpack(&rotation, 0);
|
|
||||||
|
|
||||||
// Right arm
|
|
||||||
objptr = Lara.meshPtrs[LM_RINARM];
|
|
||||||
phd_TranslateRel(*objptr, *(objptr + 1), *(objptr + 2));
|
|
||||||
sphere[3].x = *(MatrixPtr + M03) >> W2V_SHIFT;
|
|
||||||
sphere[3].y = *(MatrixPtr + M13) >> W2V_SHIFT;
|
|
||||||
sphere[3].z = *(MatrixPtr + M23) >> W2V_SHIFT;
|
|
||||||
sphere[3].r = (int) * (objptr + 3) * 3 / 2; // 1.5 times sphere size gives better result
|
|
||||||
phd_PopMatrix();
|
|
||||||
|
|
||||||
phd_PushMatrix();
|
|
||||||
phd_TranslateRel(*(bone + 1 + 40), *(bone + 2 + 40), *(bone + 3 + 40));
|
|
||||||
gar_RotYXZsuperpack(&rotation, 2);
|
|
||||||
|
|
||||||
// Left arm
|
|
||||||
objptr = Lara.meshPtrs[LM_LINARM];
|
|
||||||
phd_TranslateRel(*objptr, *(objptr + 1), *(objptr + 2));
|
|
||||||
sphere[4].x = *(MatrixPtr + M03) >> W2V_SHIFT;
|
|
||||||
sphere[4].y = *(MatrixPtr + M13) >> W2V_SHIFT;
|
|
||||||
sphere[4].z = *(MatrixPtr + M23) >> W2V_SHIFT;
|
|
||||||
sphere[4].r = (int) * (objptr + 3) * 3 / 2;
|
|
||||||
phd_PopMatrix();
|
|
||||||
|
|
||||||
phd_TranslateRel(*(bone + 1 + 52), *(bone + 2 + 52), *(bone + 3 + 52));
|
|
||||||
gar_RotYXZsuperpack(&rotation, 2);
|
|
||||||
phd_RotYXZ(Lara.headYrot, Lara.headXrot, Lara.headZrot);
|
|
||||||
|
|
||||||
// Head
|
|
||||||
phd_PushMatrix();
|
|
||||||
objptr = Lara.meshPtrs[LM_HEAD];
|
objptr = Lara.meshPtrs[LM_HEAD];
|
||||||
phd_TranslateRel(*objptr, *(objptr + 1), *(objptr + 2));
|
pos = { objptr[0], objptr[1], objptr[2] };
|
||||||
sphere[2].x = *(MatrixPtr + M03) >> W2V_SHIFT;
|
GetLaraJointPosition(&pos, LM_HEAD);
|
||||||
sphere[2].y = *(MatrixPtr + M13) >> W2V_SHIFT;
|
sphere[2].x = pos.x;
|
||||||
sphere[2].z = *(MatrixPtr + M23) >> W2V_SHIFT;
|
sphere[2].y = pos.y;
|
||||||
|
sphere[2].z = pos.z;
|
||||||
sphere[2].r = (int) * (objptr + 3);
|
sphere[2].r = (int) * (objptr + 3);
|
||||||
phd_PopMatrix();
|
|
||||||
|
objptr = Lara.meshPtrs[LM_RINARM];
|
||||||
|
pos = { objptr[0], objptr[1], objptr[2] };
|
||||||
|
GetLaraJointPosition(&pos, LM_RINARM);
|
||||||
|
sphere[3].x = pos.x;
|
||||||
|
sphere[3].y = pos.y;
|
||||||
|
sphere[3].z = pos.z;
|
||||||
|
sphere[3].r = (int) * (objptr + 3) * 3 / 2;
|
||||||
|
|
||||||
|
objptr = Lara.meshPtrs[LM_LINARM];
|
||||||
|
pos = { objptr[0], objptr[1], objptr[2] };
|
||||||
|
GetLaraJointPosition(&pos, LM_LINARM);
|
||||||
|
sphere[4].x = pos.x;
|
||||||
|
sphere[4].y = pos.y;
|
||||||
|
sphere[4].z = pos.z;
|
||||||
|
sphere[4].r = (int) * (objptr + 3) * 3 / 2;
|
||||||
|
|
||||||
if (youngLara)
|
if (youngLara)
|
||||||
{
|
{
|
||||||
|
@ -180,28 +147,28 @@ void HairControl(int cutscene, int ponytail, short* framePtr)
|
||||||
sphere[1].y = (sphere[1].y + sphere[2].y) / 2;
|
sphere[1].y = (sphere[1].y + sphere[2].y) / 2;
|
||||||
sphere[1].z = (sphere[1].z + sphere[2].z) / 2;
|
sphere[1].z = (sphere[1].z + sphere[2].z) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Matrix world;
|
||||||
|
g_Renderer->GetBoneMatrix(Lara.itemNumber, LM_HEAD, &world);
|
||||||
|
|
||||||
if (ponytail)
|
if (ponytail)
|
||||||
{
|
{
|
||||||
phd_TranslateRel(44, -48, -50);
|
world = Matrix::CreateTranslation(44, -48, -50) * world;
|
||||||
}
|
}
|
||||||
else if (youngLara)
|
else if (youngLara)
|
||||||
{
|
{
|
||||||
phd_TranslateRel(-52, -48, -50);
|
world = Matrix::CreateTranslation(-52, -48, -50) * world;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
phd_TranslateRel(-4, -48, -48);
|
world = Matrix::CreateTranslation(-4, -48, -48) * world;
|
||||||
}
|
}
|
||||||
|
|
||||||
PHD_VECTOR pos;
|
pos.x = world.Translation().x;
|
||||||
pos.x = *(MatrixPtr + M03) >> W2V_SHIFT;
|
pos.y = world.Translation().y;
|
||||||
pos.y = *(MatrixPtr + M13) >> W2V_SHIFT;
|
pos.z = world.Translation().z;
|
||||||
pos.z = *(MatrixPtr + M23) >> W2V_SHIFT;
|
|
||||||
|
|
||||||
phd_PopMatrix();
|
int* bone = Bones + Objects[ID_LARA_HAIR].boneIndex;
|
||||||
|
|
||||||
bone = bone + Objects[ID_LARA_HAIR].boneIndex;
|
|
||||||
|
|
||||||
if (FirstHair[ponytail])
|
if (FirstHair[ponytail])
|
||||||
{
|
{
|
||||||
|
@ -213,20 +180,13 @@ void HairControl(int cutscene, int ponytail, short* framePtr)
|
||||||
|
|
||||||
for (int i = 0; i < HAIR_SEGMENTS - 1; i++, bone += 4)
|
for (int i = 0; i < HAIR_SEGMENTS - 1; i++, bone += 4)
|
||||||
{
|
{
|
||||||
phd_PushUnitMatrix();
|
world = Matrix::CreateTranslation(Hairs[ponytail][i].pos.xPos, Hairs[ponytail][i].pos.yPos, Hairs[ponytail][i].pos.zPos);
|
||||||
|
world = Matrix::CreateFromYawPitchRoll(TO_RAD(Hairs[ponytail][i].pos.yRot), TO_RAD(Hairs[ponytail][i].pos.xRot), 0) * world;
|
||||||
|
world = Matrix::CreateTranslation(*(bone + 1), *(bone + 2), *(bone + 3)) * world;
|
||||||
|
|
||||||
*(MatrixPtr + M03) = Hairs[ponytail][i].pos.xPos << W2V_SHIFT;
|
Hairs[ponytail][i + 1].pos.xPos = world.Translation().x;
|
||||||
*(MatrixPtr + M13) = Hairs[ponytail][i].pos.yPos << W2V_SHIFT;
|
Hairs[ponytail][i + 1].pos.yPos = world.Translation().y;
|
||||||
*(MatrixPtr + M23) = Hairs[ponytail][i].pos.zPos << W2V_SHIFT;
|
Hairs[ponytail][i + 1].pos.zPos = world.Translation().z;
|
||||||
|
|
||||||
phd_RotYXZ(Hairs[ponytail][i].pos.yRot, Hairs[ponytail][i].pos.xRot, 0);
|
|
||||||
phd_TranslateRel(*(bone + 1), *(bone + 2), *(bone + 3));
|
|
||||||
|
|
||||||
Hairs[ponytail][i + 1].pos.xPos = *(MatrixPtr + M03) >> W2V_SHIFT;
|
|
||||||
Hairs[ponytail][i + 1].pos.yPos = *(MatrixPtr + M13) >> W2V_SHIFT;
|
|
||||||
Hairs[ponytail][i + 1].pos.zPos = *(MatrixPtr + M23) >> W2V_SHIFT;
|
|
||||||
|
|
||||||
phd_PopMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Wind = SmokeWindX = SmokeWindZ = 0;
|
Wind = SmokeWindX = SmokeWindZ = 0;
|
||||||
|
@ -331,7 +291,7 @@ void HairControl(int cutscene, int ponytail, short* framePtr)
|
||||||
|
|
||||||
if (distance < SQUARE(sphere[j].r))
|
if (distance < SQUARE(sphere[j].r))
|
||||||
{
|
{
|
||||||
distance = SQRT_ASM(distance);
|
distance = sqrt(distance);
|
||||||
|
|
||||||
if (distance == 0)
|
if (distance == 0)
|
||||||
distance = 1;
|
distance = 1;
|
||||||
|
@ -342,36 +302,25 @@ void HairControl(int cutscene, int ponytail, short* framePtr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int distance = SQRT_ASM(SQUARE(Hairs[ponytail][i].pos.zPos - Hairs[ponytail][i - 1].pos.zPos) + SQUARE(Hairs[ponytail][i].pos.xPos - Hairs[ponytail][i - 1].pos.xPos));
|
int distance = sqrt(SQUARE(Hairs[ponytail][i].pos.zPos - Hairs[ponytail][i - 1].pos.zPos) + SQUARE(Hairs[ponytail][i].pos.xPos - Hairs[ponytail][i - 1].pos.xPos));
|
||||||
Hairs[ponytail][i - 1].pos.yRot = ATAN((Hairs[ponytail][i].pos.zPos - Hairs[ponytail][i - 1].pos.zPos), (Hairs[ponytail][i].pos.xPos - Hairs[ponytail][i - 1].pos.xPos));
|
Hairs[ponytail][i - 1].pos.yRot = phd_atan((Hairs[ponytail][i].pos.zPos - Hairs[ponytail][i - 1].pos.zPos), (Hairs[ponytail][i].pos.xPos - Hairs[ponytail][i - 1].pos.xPos));
|
||||||
Hairs[ponytail][i - 1].pos.xRot = -ATAN(distance, Hairs[ponytail][i].pos.yPos - Hairs[ponytail][i - 1].pos.yPos);
|
Hairs[ponytail][i - 1].pos.xRot = -phd_atan(distance, Hairs[ponytail][i].pos.yPos - Hairs[ponytail][i - 1].pos.yPos);
|
||||||
|
|
||||||
phd_PushUnitMatrix();
|
world = Matrix::CreateTranslation(Hairs[ponytail][i - 1].pos.xPos, Hairs[ponytail][i - 1].pos.yPos, Hairs[ponytail][i - 1].pos.zPos);
|
||||||
|
world = Matrix::CreateFromYawPitchRoll(TO_RAD(Hairs[ponytail][i - 1].pos.yRot), TO_RAD(Hairs[ponytail][i - 1].pos.xRot), 0) * world;
|
||||||
*(MatrixPtr + M03) = Hairs[ponytail][i - 1].pos.xPos << W2V_SHIFT;
|
|
||||||
*(MatrixPtr + M13) = Hairs[ponytail][i - 1].pos.yPos << W2V_SHIFT;
|
|
||||||
*(MatrixPtr + M23) = Hairs[ponytail][i - 1].pos.zPos << W2V_SHIFT;
|
|
||||||
phd_RotYXZ(Hairs[ponytail][i - 1].pos.yRot, Hairs[ponytail][i - 1].pos.xRot, 0);
|
|
||||||
|
|
||||||
if (i == HAIR_SEGMENTS - 1)
|
if (i == HAIR_SEGMENTS - 1)
|
||||||
phd_TranslateRel(*(bone - 3), *(bone - 2), *(bone - 1));
|
world = Matrix::CreateTranslation(*(bone - 3), *(bone - 2), *(bone - 1)) * world;
|
||||||
else
|
else
|
||||||
phd_TranslateRel(*(bone + 1), *(bone + 2), *(bone + 3));
|
world = Matrix::CreateTranslation(*(bone + 1), *(bone + 2), *(bone + 3)) * world;
|
||||||
|
|
||||||
Hairs[ponytail][i].pos.xPos = *(MatrixPtr + M03) >> W2V_SHIFT;
|
Hairs[ponytail][i].pos.xPos = world.Translation().x;
|
||||||
Hairs[ponytail][i].pos.yPos = *(MatrixPtr + M13) >> W2V_SHIFT;
|
Hairs[ponytail][i].pos.yPos = world.Translation().y;
|
||||||
Hairs[ponytail][i].pos.zPos = *(MatrixPtr + M23) >> W2V_SHIFT;
|
Hairs[ponytail][i].pos.zPos = world.Translation().z;
|
||||||
|
|
||||||
Hairs[ponytail][i].hvel.x = Hairs[ponytail][i].pos.xPos - Hairs[ponytail][0].hvel.x;
|
Hairs[ponytail][i].hvel.x = Hairs[ponytail][i].pos.xPos - Hairs[ponytail][0].hvel.x;
|
||||||
Hairs[ponytail][i].hvel.y = Hairs[ponytail][i].pos.yPos - Hairs[ponytail][0].hvel.y;
|
Hairs[ponytail][i].hvel.y = Hairs[ponytail][i].pos.yPos - Hairs[ponytail][0].hvel.y;
|
||||||
Hairs[ponytail][i].hvel.z = Hairs[ponytail][i].pos.zPos - Hairs[ponytail][0].hvel.z;
|
Hairs[ponytail][i].hvel.z = Hairs[ponytail][i].pos.zPos - Hairs[ponytail][0].hvel.z;
|
||||||
|
|
||||||
phd_PopMatrix();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inject_Hair()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
|
@ -6,5 +6,3 @@ extern HAIR_STRUCT Hairs[2][7];
|
||||||
|
|
||||||
void InitialiseHair();
|
void InitialiseHair();
|
||||||
void HairControl(int cutscene, int ponytail, short* framePtr);
|
void HairControl(int cutscene, int ponytail, short* framePtr);
|
||||||
|
|
||||||
void Inject_Hair();
|
|
|
@ -3,6 +3,8 @@
|
||||||
#include "pickup.h"
|
#include "pickup.h"
|
||||||
#include "lara.h"
|
#include "lara.h"
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
|
#include "../Specific/level.h"
|
||||||
|
#include "control.h"
|
||||||
|
|
||||||
short PickupX;
|
short PickupX;
|
||||||
short PickupY;
|
short PickupY;
|
||||||
|
@ -18,7 +20,6 @@ int DashTimer = 0;
|
||||||
extern RendererHUDBar* g_HealthBar;
|
extern RendererHUDBar* g_HealthBar;
|
||||||
extern RendererHUDBar* g_DashBar;
|
extern RendererHUDBar* g_DashBar;
|
||||||
extern RendererHUDBar* g_AirBar;
|
extern RendererHUDBar* g_AirBar;
|
||||||
extern LaraExtraInfo g_LaraExtra;
|
|
||||||
|
|
||||||
void DrawHealthBarOverlay(int value)
|
void DrawHealthBarOverlay(int value)
|
||||||
{
|
{
|
||||||
|
@ -113,8 +114,8 @@ void UpdateAirBar(int flash)
|
||||||
if (Lara.air == 1800 || LaraItem->hitPoints <= 0)
|
if (Lara.air == 1800 || LaraItem->hitPoints <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((g_LaraExtra.Vehicle == NO_ITEM)
|
if ((Lara.Vehicle == NO_ITEM)
|
||||||
|| (Items[g_LaraExtra.Vehicle].objectNumber != ID_UPV))
|
|| (Items[Lara.Vehicle].objectNumber != ID_UPV))
|
||||||
{
|
{
|
||||||
if ((Lara.waterStatus != LW_UNDERWATER)
|
if ((Lara.waterStatus != LW_UNDERWATER)
|
||||||
&& (Lara.waterStatus != LW_SURFACE)
|
&& (Lara.waterStatus != LW_SURFACE)
|
||||||
|
@ -248,8 +249,3 @@ int FlashIt()
|
||||||
}
|
}
|
||||||
return FlashState;
|
return FlashState;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inject_Healt()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -25,6 +25,3 @@ extern int HealtBarTimer;
|
||||||
extern int FlashState;
|
extern int FlashState;
|
||||||
extern int PoisonFlag;
|
extern int PoisonFlag;
|
||||||
extern int DashTimer;
|
extern int DashTimer;
|
||||||
|
|
||||||
void Inject_Healt();
|
|
||||||
|
|
||||||
|
|
|
@ -8,29 +8,31 @@
|
||||||
#include "savegame.h"
|
#include "savegame.h"
|
||||||
#include "Lara.h"
|
#include "Lara.h"
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
|
#include "spotcam.h"
|
||||||
#include "..\Global\global.h"
|
#include "..\Global\global.h"
|
||||||
#include "..\Specific\input.h"
|
#include "..\Specific\input.h"
|
||||||
#include "..\Specific\configuration.h"
|
#include "..\Specific\configuration.h"
|
||||||
#include "lara1gun.h"
|
#include "lara1gun.h"
|
||||||
#include "lara2gun.h"
|
#include "lara2gun.h"
|
||||||
|
#include "../Specific/level.h"
|
||||||
|
#include "../Specific/input.h"
|
||||||
|
|
||||||
Inventory* g_Inventory;
|
Inventory* g_Inventory;
|
||||||
extern GameFlow* g_GameFlow;
|
extern GameFlow* g_GameFlow;
|
||||||
extern LaraExtraInfo g_LaraExtra;
|
|
||||||
|
|
||||||
void CombinePuzzle(int action, short object)
|
void CombinePuzzle(int action, short object)
|
||||||
{
|
{
|
||||||
if (action == INV_COMBINE_COMBINE)
|
if (action == INV_COMBINE_COMBINE)
|
||||||
{
|
{
|
||||||
g_LaraExtra.Puzzles[object - INV_OBJECT_PUZZLE1]++;
|
Lara.Puzzles[object - INV_OBJECT_PUZZLE1]++;
|
||||||
g_LaraExtra.PuzzlesCombo[object - INV_OBJECT_PUZZLE1_COMBO1]--;
|
Lara.PuzzlesCombo[object - INV_OBJECT_PUZZLE1_COMBO1]--;
|
||||||
g_LaraExtra.PuzzlesCombo[object - INV_OBJECT_PUZZLE1_COMBO1 + 1]--;
|
Lara.PuzzlesCombo[object - INV_OBJECT_PUZZLE1_COMBO1 + 1]--;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_LaraExtra.Puzzles[object - INV_OBJECT_PUZZLE1]--;
|
Lara.Puzzles[object - INV_OBJECT_PUZZLE1]--;
|
||||||
g_LaraExtra.PuzzlesCombo[object - INV_OBJECT_PUZZLE1_COMBO1]++;
|
Lara.PuzzlesCombo[object - INV_OBJECT_PUZZLE1_COMBO1]++;
|
||||||
g_LaraExtra.PuzzlesCombo[object - INV_OBJECT_PUZZLE1_COMBO1 + 1]++;
|
Lara.PuzzlesCombo[object - INV_OBJECT_PUZZLE1_COMBO1 + 1]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,15 +40,15 @@ void CombineKey(int action, short object)
|
||||||
{
|
{
|
||||||
if (action == INV_COMBINE_COMBINE)
|
if (action == INV_COMBINE_COMBINE)
|
||||||
{
|
{
|
||||||
g_LaraExtra.Keys[object - INV_OBJECT_KEY1]++;
|
Lara.Keys[object - INV_OBJECT_KEY1]++;
|
||||||
g_LaraExtra.KeysCombo[object - INV_OBJECT_KEY1_COMBO1]--;
|
Lara.KeysCombo[object - INV_OBJECT_KEY1_COMBO1]--;
|
||||||
g_LaraExtra.KeysCombo[object - INV_OBJECT_KEY1_COMBO1 + 1]--;
|
Lara.KeysCombo[object - INV_OBJECT_KEY1_COMBO1 + 1]--;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_LaraExtra.Keys[object - INV_OBJECT_KEY1]--;
|
Lara.Keys[object - INV_OBJECT_KEY1]--;
|
||||||
g_LaraExtra.KeysCombo[object - INV_OBJECT_KEY1_COMBO1]++;
|
Lara.KeysCombo[object - INV_OBJECT_KEY1_COMBO1]++;
|
||||||
g_LaraExtra.KeysCombo[object - INV_OBJECT_KEY1_COMBO1 + 1]++;
|
Lara.KeysCombo[object - INV_OBJECT_KEY1_COMBO1 + 1]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,15 +56,15 @@ void CombinePickup(int action, short object)
|
||||||
{
|
{
|
||||||
if (action == INV_COMBINE_COMBINE)
|
if (action == INV_COMBINE_COMBINE)
|
||||||
{
|
{
|
||||||
g_LaraExtra.Pickups[object - INV_OBJECT_PICKUP1]++;
|
Lara.Pickups[object - INV_OBJECT_PICKUP1]++;
|
||||||
g_LaraExtra.PickupsCombo[object - INV_OBJECT_PICKUP1_COMBO1]--;
|
Lara.PickupsCombo[object - INV_OBJECT_PICKUP1_COMBO1]--;
|
||||||
g_LaraExtra.PickupsCombo[object - INV_OBJECT_PICKUP1_COMBO1 + 1] = false;
|
Lara.PickupsCombo[object - INV_OBJECT_PICKUP1_COMBO1 + 1] = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_LaraExtra.Pickups[object - INV_OBJECT_PICKUP1]--;
|
Lara.Pickups[object - INV_OBJECT_PICKUP1]--;
|
||||||
g_LaraExtra.PickupsCombo[object - INV_OBJECT_PICKUP1_COMBO1]++;
|
Lara.PickupsCombo[object - INV_OBJECT_PICKUP1_COMBO1]++;
|
||||||
g_LaraExtra.PickupsCombo[object - INV_OBJECT_PICKUP1_COMBO1 + 1]++;
|
Lara.PickupsCombo[object - INV_OBJECT_PICKUP1_COMBO1 + 1]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,15 +72,15 @@ void CombineExamine(int action, short object)
|
||||||
{
|
{
|
||||||
if (action == INV_COMBINE_COMBINE)
|
if (action == INV_COMBINE_COMBINE)
|
||||||
{
|
{
|
||||||
g_LaraExtra.Examines[object - INV_OBJECT_EXAMINE1]++;
|
Lara.Examines[object - INV_OBJECT_EXAMINE1]++;
|
||||||
g_LaraExtra.ExaminesCombo[object - INV_OBJECT_EXAMINE1_COMBO1]--;
|
Lara.ExaminesCombo[object - INV_OBJECT_EXAMINE1_COMBO1]--;
|
||||||
g_LaraExtra.ExaminesCombo[object - INV_OBJECT_EXAMINE1_COMBO1 + 1]--;
|
Lara.ExaminesCombo[object - INV_OBJECT_EXAMINE1_COMBO1 + 1]--;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_LaraExtra.Examines[object - INV_OBJECT_EXAMINE1]--;
|
Lara.Examines[object - INV_OBJECT_EXAMINE1]--;
|
||||||
g_LaraExtra.ExaminesCombo[object - INV_OBJECT_EXAMINE1_COMBO1]++;
|
Lara.ExaminesCombo[object - INV_OBJECT_EXAMINE1_COMBO1]++;
|
||||||
g_LaraExtra.ExaminesCombo[object - INV_OBJECT_EXAMINE1_COMBO1 + 1]++;
|
Lara.ExaminesCombo[object - INV_OBJECT_EXAMINE1_COMBO1 + 1]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,13 +88,13 @@ void CombineRevolverLasersight(int action, short object)
|
||||||
{
|
{
|
||||||
if (action == INV_COMBINE_COMBINE)
|
if (action == INV_COMBINE_COMBINE)
|
||||||
{
|
{
|
||||||
g_LaraExtra.Lasersight = false;
|
Lara.Lasersight = false;
|
||||||
g_LaraExtra.Weapons[WEAPON_REVOLVER].HasLasersight = true;
|
Lara.Weapons[WEAPON_REVOLVER].HasLasersight = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_LaraExtra.Lasersight = true;
|
Lara.Lasersight = true;
|
||||||
g_LaraExtra.Weapons[WEAPON_REVOLVER].HasLasersight = false;
|
Lara.Weapons[WEAPON_REVOLVER].HasLasersight = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Lara.gunStatus && Lara.gunType == WEAPON_REVOLVER)
|
if (Lara.gunStatus && Lara.gunType == WEAPON_REVOLVER)
|
||||||
|
@ -106,13 +108,13 @@ void CombineCrossbowLasersight(int action, short object)
|
||||||
{
|
{
|
||||||
if (action == INV_COMBINE_COMBINE)
|
if (action == INV_COMBINE_COMBINE)
|
||||||
{
|
{
|
||||||
g_LaraExtra.Lasersight = false;
|
Lara.Lasersight = false;
|
||||||
g_LaraExtra.Weapons[WEAPON_CROSSBOW].HasLasersight = true;
|
Lara.Weapons[WEAPON_CROSSBOW].HasLasersight = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_LaraExtra.Lasersight = true;
|
Lara.Lasersight = true;
|
||||||
g_LaraExtra.Weapons[WEAPON_CROSSBOW].HasLasersight = false;
|
Lara.Weapons[WEAPON_CROSSBOW].HasLasersight = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Lara.gunStatus && Lara.gunType == WEAPON_CROSSBOW)
|
if (Lara.gunStatus && Lara.gunType == WEAPON_CROSSBOW)
|
||||||
|
@ -122,11 +124,6 @@ void CombineCrossbowLasersight(int action, short object)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inject_Inventory()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Inventory::Inventory()
|
Inventory::Inventory()
|
||||||
{
|
{
|
||||||
ZeroMemory(&m_objectsTable[0], sizeof(InventoryObjectDefinition) * INVENTORY_TABLE_SIZE);
|
ZeroMemory(&m_objectsTable[0], sizeof(InventoryObjectDefinition) * INVENTORY_TABLE_SIZE);
|
||||||
|
@ -270,65 +267,65 @@ void Inventory::LoadObjects(bool isReload)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*g_LaraExtra.Weapons[WEAPON_REVOLVER].Present = true;
|
/*Lara.Weapons[WEAPON_REVOLVER].Present = true;
|
||||||
g_LaraExtra.Weapons[WEAPON_REVOLVER].Ammo[0] = 1000;
|
Lara.Weapons[WEAPON_REVOLVER].Ammo[0] = 1000;
|
||||||
g_LaraExtra.Weapons[WEAPON_REVOLVER].SelectedAmmo = WEAPON_AMMO1;
|
Lara.Weapons[WEAPON_REVOLVER].SelectedAmmo = WEAPON_AMMO1;
|
||||||
g_LaraExtra.Weapons[WEAPON_REVOLVER].HasLasersight = true;
|
Lara.Weapons[WEAPON_REVOLVER].HasLasersight = true;
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
{
|
{
|
||||||
/*g_LaraExtra.Weapons[WEAPON_SHOTGUN].Present = true;
|
/*Lara.Weapons[WEAPON_SHOTGUN].Present = true;
|
||||||
g_LaraExtra.Weapons[WEAPON_SHOTGUN].Ammo[0] = 1000;
|
Lara.Weapons[WEAPON_SHOTGUN].Ammo[0] = 1000;
|
||||||
g_LaraExtra.Weapons[WEAPON_SHOTGUN].Ammo[1] = 1000;
|
Lara.Weapons[WEAPON_SHOTGUN].Ammo[1] = 1000;
|
||||||
g_LaraExtra.Weapons[WEAPON_SHOTGUN].SelectedAmmo = WEAPON_AMMO1;
|
Lara.Weapons[WEAPON_SHOTGUN].SelectedAmmo = WEAPON_AMMO1;
|
||||||
|
|
||||||
g_LaraExtra.Weapons[WEAPON_REVOLVER].Present = true;
|
Lara.Weapons[WEAPON_REVOLVER].Present = true;
|
||||||
g_LaraExtra.Weapons[WEAPON_REVOLVER].Ammo[0] = 1000;
|
Lara.Weapons[WEAPON_REVOLVER].Ammo[0] = 1000;
|
||||||
g_LaraExtra.Weapons[WEAPON_REVOLVER].SelectedAmmo = WEAPON_AMMO1;
|
Lara.Weapons[WEAPON_REVOLVER].SelectedAmmo = WEAPON_AMMO1;
|
||||||
|
|
||||||
Lara.laserSight = true;
|
Lara.laserSight = true;
|
||||||
|
|
||||||
/*g_LaraExtra.Weapons[WEAPON_CROSSBOW].Present = true;
|
/*Lara.Weapons[WEAPON_CROSSBOW].Present = true;
|
||||||
g_LaraExtra.Weapons[WEAPON_CROSSBOW].Ammo[0] = 1000;
|
Lara.Weapons[WEAPON_CROSSBOW].Ammo[0] = 1000;
|
||||||
g_LaraExtra.Weapons[WEAPON_CROSSBOW].SelectedAmmo = WEAPON_AMMO1;
|
Lara.Weapons[WEAPON_CROSSBOW].SelectedAmmo = WEAPON_AMMO1;
|
||||||
|
|
||||||
g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Present = true;
|
Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Present = true;
|
||||||
g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[0] = 1000;
|
Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[0] = 1000;
|
||||||
g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].SelectedAmmo = WEAPON_AMMO1;
|
Lara.Weapons[WEAPON_GRENADE_LAUNCHER].SelectedAmmo = WEAPON_AMMO1;
|
||||||
|
|
||||||
g_LaraExtra.Weapons[WEAPON_HARPOON_GUN].Present = true;
|
Lara.Weapons[WEAPON_HARPOON_GUN].Present = true;
|
||||||
g_LaraExtra.Weapons[WEAPON_HARPOON_GUN].Ammo[0] = 1000;
|
Lara.Weapons[WEAPON_HARPOON_GUN].Ammo[0] = 1000;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
// Now fill the rings
|
// Now fill the rings
|
||||||
if (g_GameFlow->GetLevel(CurrentLevel)->LaraType != LARA_YOUNG)
|
if (g_GameFlow->GetLevel(CurrentLevel)->LaraType != LARA_YOUNG)
|
||||||
{
|
{
|
||||||
// Pistols
|
// Pistols
|
||||||
if (g_LaraExtra.Weapons[WEAPON_PISTOLS].Present)
|
if (Lara.Weapons[WEAPON_PISTOLS].Present)
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_PISTOLS);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_PISTOLS);
|
||||||
|
|
||||||
// Uzi
|
// Uzi
|
||||||
if (g_LaraExtra.Weapons[WEAPON_UZI].Present)
|
if (Lara.Weapons[WEAPON_UZI].Present)
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_UZIS);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_UZIS);
|
||||||
else if (g_LaraExtra.Weapons[WEAPON_UZI].Ammo[0])
|
else if (Lara.Weapons[WEAPON_UZI].Ammo[0])
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_UZI_AMMO);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_UZI_AMMO);
|
||||||
|
|
||||||
// Revolver
|
// Revolver
|
||||||
if (g_LaraExtra.Weapons[WEAPON_REVOLVER].Present)
|
if (Lara.Weapons[WEAPON_REVOLVER].Present)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.Weapons[WEAPON_REVOLVER].HasLasersight)
|
if (Lara.Weapons[WEAPON_REVOLVER].HasLasersight)
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_REVOLVER_LASER);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_REVOLVER_LASER);
|
||||||
else
|
else
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_REVOLVER);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_REVOLVER);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.Weapons[WEAPON_REVOLVER].Ammo[0])
|
if (Lara.Weapons[WEAPON_REVOLVER].Ammo[0])
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_REVOLVER_AMMO);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_REVOLVER_AMMO);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shotgun
|
// Shotgun
|
||||||
if (g_LaraExtra.Weapons[WEAPON_SHOTGUN].Present)
|
if (Lara.Weapons[WEAPON_SHOTGUN].Present)
|
||||||
{
|
{
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_SHOTGUN);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_SHOTGUN);
|
||||||
//if (Lara.shotgunTypeCarried & 0x10)
|
//if (Lara.shotgunTypeCarried & 0x10)
|
||||||
|
@ -336,138 +333,138 @@ void Inventory::LoadObjects(bool isReload)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.Weapons[WEAPON_SHOTGUN].Ammo[0])
|
if (Lara.Weapons[WEAPON_SHOTGUN].Ammo[0])
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_SHOTGUN_AMMO1);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_SHOTGUN_AMMO1);
|
||||||
if (g_LaraExtra.Weapons[WEAPON_SHOTGUN].Ammo[1])
|
if (Lara.Weapons[WEAPON_SHOTGUN].Ammo[1])
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_SHOTGUN_AMMO2);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_SHOTGUN_AMMO2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// HK
|
// HK
|
||||||
if (g_LaraExtra.Weapons[WEAPON_HK].Present)
|
if (Lara.Weapons[WEAPON_HK].Present)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.Weapons[WEAPON_HK].HasSilencer)
|
if (Lara.Weapons[WEAPON_HK].HasSilencer)
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_HK_LASER);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_HK_LASER);
|
||||||
else
|
else
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_HK);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_HK);
|
||||||
}
|
}
|
||||||
else if (g_LaraExtra.Weapons[WEAPON_HK].Ammo[0])
|
else if (Lara.Weapons[WEAPON_HK].Ammo[0])
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_HK_AMMO1);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_HK_AMMO1);
|
||||||
|
|
||||||
// Crossbow
|
// Crossbow
|
||||||
if (g_LaraExtra.Weapons[WEAPON_CROSSBOW].Present)
|
if (Lara.Weapons[WEAPON_CROSSBOW].Present)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.Weapons[WEAPON_CROSSBOW].HasLasersight)
|
if (Lara.Weapons[WEAPON_CROSSBOW].HasLasersight)
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_CROSSBOW_LASER);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_CROSSBOW_LASER);
|
||||||
else
|
else
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_CROSSBOW);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_CROSSBOW);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.Weapons[WEAPON_CROSSBOW].Ammo[0])
|
if (Lara.Weapons[WEAPON_CROSSBOW].Ammo[0])
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_CROSSBOW_AMMO1);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_CROSSBOW_AMMO1);
|
||||||
if (g_LaraExtra.Weapons[WEAPON_CROSSBOW].Ammo[1])
|
if (Lara.Weapons[WEAPON_CROSSBOW].Ammo[1])
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_CROSSBOW_AMMO2);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_CROSSBOW_AMMO2);
|
||||||
if (g_LaraExtra.Weapons[WEAPON_CROSSBOW].Ammo[2])
|
if (Lara.Weapons[WEAPON_CROSSBOW].Ammo[2])
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_CROSSBOW_AMMO3);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_CROSSBOW_AMMO3);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grenade launcher
|
// Grenade launcher
|
||||||
if (g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Present)
|
if (Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Present)
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_GRENADE_LAUNCHER);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_GRENADE_LAUNCHER);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[0])
|
if (Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[0])
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_GRENADE_AMMO1);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_GRENADE_AMMO1);
|
||||||
if (g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[1])
|
if (Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[1])
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_GRENADE_AMMO2);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_GRENADE_AMMO2);
|
||||||
if (g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[2])
|
if (Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[2])
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_GRENADE_AMMO3);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_GRENADE_AMMO3);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Harpoon
|
// Harpoon
|
||||||
if (g_LaraExtra.Weapons[WEAPON_HARPOON_GUN].Present)
|
if (Lara.Weapons[WEAPON_HARPOON_GUN].Present)
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_HARPOON_GUN);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_HARPOON_GUN);
|
||||||
else if (g_LaraExtra.Weapons[WEAPON_HARPOON_GUN].Ammo[0])
|
else if (Lara.Weapons[WEAPON_HARPOON_GUN].Ammo[0])
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_HARPOON_AMMO);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_HARPOON_AMMO);
|
||||||
|
|
||||||
// Rocket launcher
|
// Rocket launcher
|
||||||
if (g_LaraExtra.Weapons[WEAPON_ROCKET_LAUNCHER].Present)
|
if (Lara.Weapons[WEAPON_ROCKET_LAUNCHER].Present)
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_ROCKET_LAUNCHER);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_ROCKET_LAUNCHER);
|
||||||
else if (g_LaraExtra.Weapons[WEAPON_ROCKET_LAUNCHER].Ammo[0])
|
else if (Lara.Weapons[WEAPON_ROCKET_LAUNCHER].Ammo[0])
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_ROCKET_AMMO);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_ROCKET_AMMO);
|
||||||
|
|
||||||
// Lasersight
|
// Lasersight
|
||||||
if (g_LaraExtra.Lasersight)
|
if (Lara.Lasersight)
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_LASERSIGHT);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_LASERSIGHT);
|
||||||
|
|
||||||
// Silencer
|
// Silencer
|
||||||
if (g_LaraExtra.Silencer)
|
if (Lara.Silencer)
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_SILENCER);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_SILENCER);
|
||||||
|
|
||||||
// Binoculars
|
// Binoculars
|
||||||
if (g_LaraExtra.Binoculars)
|
if (Lara.Binoculars)
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_BINOCULARS);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_BINOCULARS);
|
||||||
|
|
||||||
// Flares
|
// Flares
|
||||||
if (g_LaraExtra.NumFlares)
|
if (Lara.NumFlares)
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_FLARES);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_FLARES);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_LaraExtra.NumSmallMedipacks)
|
if (Lara.NumSmallMedipacks)
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_SMALL_MEDIPACK);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_SMALL_MEDIPACK);
|
||||||
|
|
||||||
if (g_LaraExtra.NumLargeMedipacks)
|
if (Lara.NumLargeMedipacks)
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_LARGE_MEDIPACK);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_LARGE_MEDIPACK);
|
||||||
|
|
||||||
if (g_LaraExtra.Crowbar)
|
if (Lara.Crowbar)
|
||||||
InsertObject(INV_RING_WEAPONS, INV_OBJECT_CROWBAR);
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_CROWBAR);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < NUM_PUZZLES; i++)
|
for (i = 0; i < NUM_PUZZLES; i++)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.Puzzles[i])
|
if (Lara.Puzzles[i])
|
||||||
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_PUZZLE1);
|
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_PUZZLE1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < NUM_PUZZLES * 2; i++)
|
for (i = 0; i < NUM_PUZZLES * 2; i++)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.PuzzlesCombo[i])
|
if (Lara.PuzzlesCombo[i])
|
||||||
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_PUZZLE1_COMBO1);
|
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_PUZZLE1_COMBO1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < NUM_KEYS; i++)
|
for (i = 0; i < NUM_KEYS; i++)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.Keys[i])
|
if (Lara.Keys[i])
|
||||||
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_KEY1);
|
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_KEY1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < NUM_KEYS * 2; i++)
|
for (i = 0; i < NUM_KEYS * 2; i++)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.KeysCombo[i])
|
if (Lara.KeysCombo[i])
|
||||||
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_KEY1_COMBO1);
|
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_KEY1_COMBO1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < NUM_PICKUPS; i++)
|
for (i = 0; i < NUM_PICKUPS; i++)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.Pickups[i])
|
if (Lara.Pickups[i])
|
||||||
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_PICKUP1);
|
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_PICKUP1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < NUM_PICKUPS * 2; i++)
|
for (i = 0; i < NUM_PICKUPS * 2; i++)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.PickupsCombo[i])
|
if (Lara.PickupsCombo[i])
|
||||||
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_PICKUP1_COMBO1);
|
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_PICKUP1_COMBO1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < NUM_EXAMINES; i++)
|
for (i = 0; i < NUM_EXAMINES; i++)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.Examines[i])
|
if (Lara.Examines[i])
|
||||||
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_EXAMINE1);
|
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_EXAMINE1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < NUM_EXAMINES * 2; i++)
|
for (i = 0; i < NUM_EXAMINES * 2; i++)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.ExaminesCombo[i])
|
if (Lara.ExaminesCombo[i])
|
||||||
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_EXAMINE1_COMBO1);
|
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_EXAMINE1_COMBO1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -480,10 +477,10 @@ void Inventory::LoadObjects(bool isReload)
|
||||||
if (Lara.bottle)
|
if (Lara.bottle)
|
||||||
InsertObject(INV_RING_PUZZLES, INV_OBJECT_BOTTLE);
|
InsertObject(INV_RING_PUZZLES, INV_OBJECT_BOTTLE);
|
||||||
|
|
||||||
if (g_LaraExtra.Waterskin1.Present)
|
if (Lara.Waterskin1.Present)
|
||||||
InsertObject(INV_RING_PUZZLES, INV_OBJECT_WATERSKIN1);
|
InsertObject(INV_RING_PUZZLES, INV_OBJECT_WATERSKIN1);
|
||||||
|
|
||||||
if (g_LaraExtra.Waterskin2.Present)
|
if (Lara.Waterskin2.Present)
|
||||||
InsertObject(INV_RING_PUZZLES, INV_OBJECT_WATERSKIN2);
|
InsertObject(INV_RING_PUZZLES, INV_OBJECT_WATERSKIN2);
|
||||||
|
|
||||||
InventoryRing* ring = &m_rings[INV_RING_OPTIONS];
|
InventoryRing* ring = &m_rings[INV_RING_OPTIONS];
|
||||||
|
@ -623,7 +620,7 @@ int Inventory::DoInventory()
|
||||||
|
|
||||||
OpenRing(m_activeRing, true);
|
OpenRing(m_activeRing, true);
|
||||||
|
|
||||||
while (!ResetFlag)
|
while (true /*!ResetFlag*/)
|
||||||
{
|
{
|
||||||
SetDebounce = true;
|
SetDebounce = true;
|
||||||
S_UpdateInput();
|
S_UpdateInput();
|
||||||
|
@ -1285,34 +1282,34 @@ void Inventory::DoSelectAmmo()
|
||||||
switch (ring->objects[ring->currentObject].inventoryObject)
|
switch (ring->objects[ring->currentObject].inventoryObject)
|
||||||
{
|
{
|
||||||
case INV_OBJECT_SHOTGUN:
|
case INV_OBJECT_SHOTGUN:
|
||||||
if (g_LaraExtra.Weapons[WEAPON_SHOTGUN].Ammo[0] != 0)
|
if (Lara.Weapons[WEAPON_SHOTGUN].Ammo[0] != 0)
|
||||||
ammoRing->objects[ammoRing->numObjects++].inventoryObject = INV_OBJECT_SHOTGUN_AMMO1;
|
ammoRing->objects[ammoRing->numObjects++].inventoryObject = INV_OBJECT_SHOTGUN_AMMO1;
|
||||||
if (g_LaraExtra.Weapons[WEAPON_SHOTGUN].Ammo[1] != 0)
|
if (Lara.Weapons[WEAPON_SHOTGUN].Ammo[1] != 0)
|
||||||
ammoRing->objects[ammoRing->numObjects++].inventoryObject = INV_OBJECT_SHOTGUN_AMMO2;
|
ammoRing->objects[ammoRing->numObjects++].inventoryObject = INV_OBJECT_SHOTGUN_AMMO2;
|
||||||
ammoRing->selectedIndex = g_LaraExtra.Weapons[WEAPON_SHOTGUN].SelectedAmmo;
|
ammoRing->selectedIndex = Lara.Weapons[WEAPON_SHOTGUN].SelectedAmmo;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case INV_OBJECT_GRENADE_LAUNCHER:
|
case INV_OBJECT_GRENADE_LAUNCHER:
|
||||||
if (g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[0] != 0)
|
if (Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[0] != 0)
|
||||||
ammoRing->objects[ammoRing->numObjects++].inventoryObject = INV_OBJECT_GRENADE_AMMO1;
|
ammoRing->objects[ammoRing->numObjects++].inventoryObject = INV_OBJECT_GRENADE_AMMO1;
|
||||||
if (g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[1] != 0)
|
if (Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[1] != 0)
|
||||||
ammoRing->objects[ammoRing->numObjects++].inventoryObject = INV_OBJECT_GRENADE_AMMO2;
|
ammoRing->objects[ammoRing->numObjects++].inventoryObject = INV_OBJECT_GRENADE_AMMO2;
|
||||||
if (g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[2] != 0)
|
if (Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[2] != 0)
|
||||||
ammoRing->objects[ammoRing->numObjects++].inventoryObject = INV_OBJECT_GRENADE_AMMO3;
|
ammoRing->objects[ammoRing->numObjects++].inventoryObject = INV_OBJECT_GRENADE_AMMO3;
|
||||||
ammoRing->selectedIndex = g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].SelectedAmmo;
|
ammoRing->selectedIndex = Lara.Weapons[WEAPON_GRENADE_LAUNCHER].SelectedAmmo;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case INV_OBJECT_CROSSBOW:
|
case INV_OBJECT_CROSSBOW:
|
||||||
case INV_OBJECT_CROSSBOW_LASER:
|
case INV_OBJECT_CROSSBOW_LASER:
|
||||||
if (g_LaraExtra.Weapons[WEAPON_CROSSBOW].Ammo[0] != 0)
|
if (Lara.Weapons[WEAPON_CROSSBOW].Ammo[0] != 0)
|
||||||
ammoRing->objects[ammoRing->numObjects++].inventoryObject = INV_OBJECT_CROSSBOW_AMMO1;
|
ammoRing->objects[ammoRing->numObjects++].inventoryObject = INV_OBJECT_CROSSBOW_AMMO1;
|
||||||
if (g_LaraExtra.Weapons[WEAPON_CROSSBOW].Ammo[1] != 0)
|
if (Lara.Weapons[WEAPON_CROSSBOW].Ammo[1] != 0)
|
||||||
ammoRing->objects[ammoRing->numObjects++].inventoryObject = INV_OBJECT_CROSSBOW_AMMO2;
|
ammoRing->objects[ammoRing->numObjects++].inventoryObject = INV_OBJECT_CROSSBOW_AMMO2;
|
||||||
if (g_LaraExtra.Weapons[WEAPON_CROSSBOW].Ammo[2] != 0)
|
if (Lara.Weapons[WEAPON_CROSSBOW].Ammo[2] != 0)
|
||||||
ammoRing->objects[ammoRing->numObjects++].inventoryObject = INV_OBJECT_CROSSBOW_AMMO3;
|
ammoRing->objects[ammoRing->numObjects++].inventoryObject = INV_OBJECT_CROSSBOW_AMMO3;
|
||||||
ammoRing->selectedIndex = g_LaraExtra.Weapons[WEAPON_CROSSBOW].SelectedAmmo;
|
ammoRing->selectedIndex = Lara.Weapons[WEAPON_CROSSBOW].SelectedAmmo;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1396,16 +1393,16 @@ void Inventory::DoSelectAmmo()
|
||||||
switch (ring->objects[ring->currentObject].inventoryObject)
|
switch (ring->objects[ring->currentObject].inventoryObject)
|
||||||
{
|
{
|
||||||
case INV_OBJECT_SHOTGUN:
|
case INV_OBJECT_SHOTGUN:
|
||||||
g_LaraExtra.Weapons[WEAPON_SHOTGUN].SelectedAmmo = ring->selectedIndex;
|
Lara.Weapons[WEAPON_SHOTGUN].SelectedAmmo = ring->selectedIndex;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case INV_OBJECT_GRENADE_LAUNCHER:
|
case INV_OBJECT_GRENADE_LAUNCHER:
|
||||||
g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].SelectedAmmo = ring->selectedIndex;
|
Lara.Weapons[WEAPON_GRENADE_LAUNCHER].SelectedAmmo = ring->selectedIndex;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case INV_OBJECT_CROSSBOW:
|
case INV_OBJECT_CROSSBOW:
|
||||||
case INV_OBJECT_CROSSBOW_LASER:
|
case INV_OBJECT_CROSSBOW_LASER:
|
||||||
g_LaraExtra.Weapons[WEAPON_CROSSBOW].SelectedAmmo = ring->selectedIndex;
|
Lara.Weapons[WEAPON_CROSSBOW].SelectedAmmo = ring->selectedIndex;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1446,8 +1443,8 @@ void Inventory::UseCurrentItem()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_LaraExtra.NumSmallMedipacks != -1)
|
if (Lara.NumSmallMedipacks != -1)
|
||||||
g_LaraExtra.NumSmallMedipacks--;
|
Lara.NumSmallMedipacks--;
|
||||||
|
|
||||||
Lara.dpoisoned = 0;
|
Lara.dpoisoned = 0;
|
||||||
LaraItem->hitPoints += 500;
|
LaraItem->hitPoints += 500;
|
||||||
|
@ -1471,8 +1468,8 @@ void Inventory::UseCurrentItem()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_LaraExtra.NumLargeMedipacks != -1)
|
if (Lara.NumLargeMedipacks != -1)
|
||||||
g_LaraExtra.NumLargeMedipacks--;
|
Lara.NumLargeMedipacks--;
|
||||||
|
|
||||||
Lara.dpoisoned = 0;
|
Lara.dpoisoned = 0;
|
||||||
LaraItem->hitPoints += 1000;
|
LaraItem->hitPoints += 1000;
|
||||||
|
@ -1792,19 +1789,10 @@ bool Inventory::UpdateSceneAndDrawInventory()
|
||||||
|
|
||||||
if (CurrentLevel == 0 && g_GameFlow->TitleType == TITLE_FLYBY)
|
if (CurrentLevel == 0 && g_GameFlow->TitleType == TITLE_FLYBY)
|
||||||
{
|
{
|
||||||
// Control routines uses joints calculated here for getting Lara joint positions
|
|
||||||
CalcLaraMatrices(0);
|
|
||||||
phd_PushUnitMatrix();
|
|
||||||
CalcLaraMatrices(1);
|
|
||||||
|
|
||||||
// Calls my new rock & roll renderer :)
|
|
||||||
g_Renderer->DumpGameScene();
|
g_Renderer->DumpGameScene();
|
||||||
g_Renderer->DrawInventory();
|
g_Renderer->DrawInventory();
|
||||||
Camera.numberFrames = g_Renderer->SyncRenderer();
|
Camera.numberFrames = g_Renderer->SyncRenderer();
|
||||||
|
|
||||||
// We need to pop the matrix stack or the game will crash
|
|
||||||
phd_PopMatrix();
|
|
||||||
|
|
||||||
nframes = Camera.numberFrames;
|
nframes = Camera.numberFrames;
|
||||||
ControlPhase(nframes, 0);
|
ControlPhase(nframes, 0);
|
||||||
}
|
}
|
||||||
|
@ -1843,9 +1831,10 @@ int Inventory::DoTitleInventory()
|
||||||
|
|
||||||
int result = INV_RESULT_NONE;
|
int result = INV_RESULT_NONE;
|
||||||
|
|
||||||
while (!ResetFlag)
|
while (true /*!ResetFlag*/)
|
||||||
{
|
{
|
||||||
SetDebounce = true;
|
SetDebounce = true;
|
||||||
|
|
||||||
S_UpdateInput();
|
S_UpdateInput();
|
||||||
SetDebounce = false;
|
SetDebounce = false;
|
||||||
|
|
||||||
|
@ -2511,7 +2500,7 @@ void Inventory::DoControlsSettings()
|
||||||
bool closeObject = false;
|
bool closeObject = false;
|
||||||
|
|
||||||
// Copy configuration to a temporary object
|
// Copy configuration to a temporary object
|
||||||
memcpy(&ring->Configuration.KeyboardLayout, &KeyboardLayout1, NUM_CONTROLS);
|
memcpy(&ring->Configuration.KeyboardLayout, &KeyboardLayout[1], NUM_CONTROLS);
|
||||||
|
|
||||||
// Do the passport
|
// Do the passport
|
||||||
while (true)
|
while (true)
|
||||||
|
@ -2555,7 +2544,7 @@ void Inventory::DoControlsSettings()
|
||||||
|
|
||||||
if (ring->selectedIndex == NUM_CONTROLS)
|
if (ring->selectedIndex == NUM_CONTROLS)
|
||||||
{
|
{
|
||||||
memcpy(KeyboardLayout1, ring->Configuration.KeyboardLayout, NUM_CONTROLS);
|
memcpy(KeyboardLayout[1], ring->Configuration.KeyboardLayout, NUM_CONTROLS);
|
||||||
SaveConfiguration();
|
SaveConfiguration();
|
||||||
|
|
||||||
closeObject = true;
|
closeObject = true;
|
||||||
|
@ -2575,7 +2564,7 @@ void Inventory::DoControlsSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
// If RETURN is pressed, then wait for a new key
|
// If RETURN is pressed, then wait for a new key
|
||||||
if (KeyMap[TR_KEY_RETURN] & 0x80)
|
if (KeyMap[DIK_RETURN] & 0x80)
|
||||||
{
|
{
|
||||||
SoundEffect(SFX_MENU_SELECT, NULL, 0);
|
SoundEffect(SFX_MENU_SELECT, NULL, 0);
|
||||||
|
|
||||||
|
@ -2608,13 +2597,13 @@ void Inventory::DoControlsSettings()
|
||||||
if (selectedKey && g_KeyNames[selectedKey])
|
if (selectedKey && g_KeyNames[selectedKey])
|
||||||
{
|
{
|
||||||
// Can't rededefine special keys or the inventory will be not usable
|
// Can't rededefine special keys or the inventory will be not usable
|
||||||
if (!(selectedKey == TR_KEY_RETURN || selectedKey == TR_KEY_LEFT || selectedKey == TR_KEY_RIGHT ||
|
if (!(selectedKey == DIK_RETURN || selectedKey == DIK_LEFT || selectedKey == DIK_RIGHT ||
|
||||||
selectedKey == TR_KEY_UP || selectedKey == TR_KEY_DOWN))
|
selectedKey == DIK_UP || selectedKey == DIK_DOWN))
|
||||||
{
|
{
|
||||||
if (selectedKey != TR_KEY_ESCAPE)
|
if (selectedKey != DIK_ESCAPE)
|
||||||
{
|
{
|
||||||
KeyboardLayout1[ring->selectedIndex] = selectedKey;
|
KeyboardLayout[1][ring->selectedIndex] = selectedKey;
|
||||||
CheckKeyConflicts();
|
DefaultConflict();
|
||||||
ring->waitingForKey = false;
|
ring->waitingForKey = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
#include "effect2.h"
|
#include "effect2.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "../Specific/setup.h"
|
#include "../Specific/setup.h"
|
||||||
|
#include "../Specific/level.h"
|
||||||
|
#include "lara.h"
|
||||||
|
#include "effects.h"
|
||||||
|
|
||||||
void ClearItem(short itemNum)
|
void ClearItem(short itemNum)
|
||||||
{
|
{
|
||||||
|
@ -272,7 +275,7 @@ short CreateNewEffect(short roomNum)
|
||||||
void InitialiseFXArray(int allocmem)
|
void InitialiseFXArray(int allocmem)
|
||||||
{
|
{
|
||||||
if (allocmem)
|
if (allocmem)
|
||||||
Effects = (FX_INFO*)GameMalloc(NUM_EFFECTS * sizeof(FX_INFO));
|
Effects = (FX_INFO*)game_malloc(NUM_EFFECTS * sizeof(FX_INFO));
|
||||||
|
|
||||||
FX_INFO* fx = Effects;
|
FX_INFO* fx = Effects;
|
||||||
NextFxActive = NO_ITEM;
|
NextFxActive = NO_ITEM;
|
||||||
|
@ -375,13 +378,14 @@ void InitialiseItem(short itemNum)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
item->meshBits = 0xFFFFFFFF;
|
item->meshBits = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
item->touchBits = 0;
|
item->touchBits = 0;
|
||||||
item->afterDeath = false;
|
item->afterDeath = false;
|
||||||
item->firedWeapon = 0;
|
item->firedWeapon = 0;
|
||||||
item->data = NULL;
|
item->data = NULL;
|
||||||
|
item->swapMeshFlags = 0;
|
||||||
|
|
||||||
if (item->flags & IFLAG_INVISIBLE)
|
if (item->flags & IFLAG_INVISIBLE)
|
||||||
{
|
{
|
||||||
|
@ -506,20 +510,3 @@ int FindItem(short objectNum)
|
||||||
|
|
||||||
return NO_ITEM;
|
return NO_ITEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inject_Items()
|
|
||||||
{
|
|
||||||
INJECT(0x00440840, CreateItem);
|
|
||||||
INJECT(0x00440D10, AddActiveItem);
|
|
||||||
INJECT(0x00440620, KillItem);
|
|
||||||
INJECT(0x00440DA0, ItemNewRoom);
|
|
||||||
INJECT(0x004412F0, EffectNewRoom);
|
|
||||||
INJECT(0x00441180, KillEffect);
|
|
||||||
INJECT(0x00441080, InitialiseFXArray);
|
|
||||||
INJECT(0x004410F0, CreateNewEffect);
|
|
||||||
INJECT(0x00440B60, RemoveActiveItem);
|
|
||||||
INJECT(0x00440C40, RemoveDrawnItem);
|
|
||||||
INJECT(0x004408B0, InitialiseItem);
|
|
||||||
INJECT(0x00408550, ClearItem);
|
|
||||||
INJECT(0x00440590, InitialiseItemArray);
|
|
||||||
}
|
|
||||||
|
|
|
@ -21,5 +21,3 @@ void InitialiseItemArray(int numitems);
|
||||||
void KillItem(short itemNum);
|
void KillItem(short itemNum);
|
||||||
ITEM_INFO* find_a_fucking_item(short objectNum);
|
ITEM_INFO* find_a_fucking_item(short objectNum);
|
||||||
int FindItem(short objectNum);
|
int FindItem(short objectNum);
|
||||||
|
|
||||||
void Inject_Items();
|
|
|
@ -21,6 +21,9 @@
|
||||||
|
|
||||||
#include "..\Objects\newobjects.h"
|
#include "..\Objects\newobjects.h"
|
||||||
#include "..\Global\global.h"
|
#include "..\Global\global.h"
|
||||||
|
#include "../Specific/level.h"
|
||||||
|
#include "../Specific/input.h"
|
||||||
|
#include "sound.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
@ -39,8 +42,10 @@ extern Inventory* g_Inventory;
|
||||||
short elevation = 57346;
|
short elevation = 57346;
|
||||||
bool doJump = false;
|
bool doJump = false;
|
||||||
short OldAngle = 1;
|
short OldAngle = 1;
|
||||||
LaraExtraInfo g_LaraExtra;
|
|
||||||
int RopeSwing = 0;
|
int RopeSwing = 0;
|
||||||
|
LaraInfo Lara;
|
||||||
|
ITEM_INFO* LaraItem;
|
||||||
|
byte LaraNodeUnderwater[15];
|
||||||
|
|
||||||
void(*lara_control_routines[NUM_LARA_STATES + 1])(ITEM_INFO* item, COLL_INFO* coll) =
|
void(*lara_control_routines[NUM_LARA_STATES + 1])(ITEM_INFO* item, COLL_INFO* coll) =
|
||||||
{
|
{
|
||||||
|
@ -344,7 +349,7 @@ void LaraAboveWater(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
coll->radius = 100;
|
coll->radius = 100;
|
||||||
coll->trigger = 0;
|
coll->trigger = 0;
|
||||||
|
|
||||||
if ((TrInput & IN_LOOK) && g_LaraExtra.ExtraAnim == 0 && Lara.look)
|
if ((TrInput & IN_LOOK) && Lara.ExtraAnim == 0 && Lara.look)
|
||||||
LookLeftRight();
|
LookLeftRight();
|
||||||
else
|
else
|
||||||
ResetLook();
|
ResetLook();
|
||||||
|
@ -352,9 +357,9 @@ void LaraAboveWater(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
Lara.look = true;
|
Lara.look = true;
|
||||||
|
|
||||||
// Process Vehicles
|
// Process Vehicles
|
||||||
if (g_LaraExtra.Vehicle != NO_ITEM)
|
if (Lara.Vehicle != NO_ITEM)
|
||||||
{
|
{
|
||||||
switch (Items[g_LaraExtra.Vehicle].objectNumber)
|
switch (Items[Lara.Vehicle].objectNumber)
|
||||||
{
|
{
|
||||||
case ID_QUAD:
|
case ID_QUAD:
|
||||||
if (QuadBikeControl())
|
if (QuadBikeControl())
|
||||||
|
@ -412,13 +417,13 @@ void LaraAboveWater(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
// Animate Lara
|
// Animate Lara
|
||||||
AnimateLara(item);
|
AnimateLara(item);
|
||||||
|
|
||||||
if (g_LaraExtra.ExtraAnim == 0)
|
if (Lara.ExtraAnim == 0)
|
||||||
{
|
{
|
||||||
// Check for collision with items
|
// Check for collision with items
|
||||||
LaraBaddieCollision(item, coll);
|
LaraBaddieCollision(item, coll);
|
||||||
|
|
||||||
// Handle Lara collision
|
// Handle Lara collision
|
||||||
if (g_LaraExtra.Vehicle == NO_ITEM)
|
if (Lara.Vehicle == NO_ITEM)
|
||||||
(*lara_collision_routines[item->currentAnimState])(item, coll);
|
(*lara_collision_routines[item->currentAnimState])(item, coll);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,9 +453,9 @@ int UseSpecialItem(ITEM_INFO* item)
|
||||||
if (selectedObject != ID_WATERSKIN1_3 && selectedObject != ID_WATERSKIN2_5)
|
if (selectedObject != ID_WATERSKIN1_3 && selectedObject != ID_WATERSKIN2_5)
|
||||||
{
|
{
|
||||||
if (selectedObject >= ID_WATERSKIN2_EMPTY)
|
if (selectedObject >= ID_WATERSKIN2_EMPTY)
|
||||||
g_LaraExtra.Waterskin2.Quantity = 5;
|
Lara.Waterskin2.Quantity = 5;
|
||||||
else
|
else
|
||||||
g_LaraExtra.Waterskin1.Quantity = 3;
|
Lara.Waterskin1.Quantity = 3;
|
||||||
|
|
||||||
item->animNumber = ANIMATION_LARA_WATERSKIN_FILL;
|
item->animNumber = ANIMATION_LARA_WATERSKIN_FILL;
|
||||||
}
|
}
|
||||||
|
@ -458,13 +463,13 @@ int UseSpecialItem(ITEM_INFO* item)
|
||||||
{
|
{
|
||||||
if (selectedObject >= ID_WATERSKIN2_EMPTY)
|
if (selectedObject >= ID_WATERSKIN2_EMPTY)
|
||||||
{
|
{
|
||||||
item->itemFlags[3] = g_LaraExtra.Waterskin2.Quantity;
|
item->itemFlags[3] = Lara.Waterskin2.Quantity;
|
||||||
g_LaraExtra.Waterskin2.Quantity = 1;
|
Lara.Waterskin2.Quantity = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
item->itemFlags[3] = g_LaraExtra.Waterskin1.Quantity;
|
item->itemFlags[3] = Lara.Waterskin1.Quantity;
|
||||||
g_LaraExtra.Waterskin1.Quantity = 1;
|
Lara.Waterskin1.Quantity = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
item->animNumber = ANIMATION_LARA_WATERSKIN_EMPTY;
|
item->animNumber = ANIMATION_LARA_WATERSKIN_EMPTY;
|
||||||
|
@ -713,9 +718,9 @@ void lara_as_pbleapoff(ITEM_INFO* item, COLL_INFO* coll)//1D244, 1D3D8 (F)
|
||||||
|
|
||||||
if (item->frameNumber == Anims[item->animNumber].frameEnd)
|
if (item->frameNumber == Anims[item->animNumber].frameEnd)
|
||||||
{
|
{
|
||||||
item->pos.xPos += 700 * SIN(item->pos.yRot) >> W2V_SHIFT;
|
item->pos.xPos += 700 * phd_sin(item->pos.yRot) >> W2V_SHIFT;
|
||||||
item->pos.yPos -= 361;
|
item->pos.yPos -= 361;
|
||||||
item->pos.zPos += 700 * COS(item->pos.yRot) >> W2V_SHIFT;
|
item->pos.zPos += 700 * phd_cos(item->pos.yRot) >> W2V_SHIFT;
|
||||||
|
|
||||||
item->animNumber = ANIMATION_LARA_TRY_HANG_SOLID;
|
item->animNumber = ANIMATION_LARA_TRY_HANG_SOLID;
|
||||||
item->frameNumber = Anims[item->animNumber].frameBase;
|
item->frameNumber = Anims[item->animNumber].frameBase;
|
||||||
|
@ -744,7 +749,7 @@ void lara_as_trfall(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
pos.y = 0;
|
pos.y = 0;
|
||||||
pos.z = 0;
|
pos.z = 0;
|
||||||
|
|
||||||
GetLaraJointPosition(&pos, LJ_RFOOT);
|
GetLaraJointPosition(&pos, LM_RFOOT);
|
||||||
|
|
||||||
item->pos.xPos = pos.x;
|
item->pos.xPos = pos.x;
|
||||||
item->pos.yPos = pos.y + 75;
|
item->pos.yPos = pos.y + 75;
|
||||||
|
@ -3826,8 +3831,8 @@ void lara_col_polestat(ITEM_INFO* item, COLL_INFO* coll)//16DFC, 16F30 (F)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
item->pos.xPos -= (SIN(item->pos.yRot)) << 6 >> W2V_SHIFT;
|
item->pos.xPos -= (phd_sin(item->pos.yRot)) << 6 >> W2V_SHIFT;
|
||||||
item->pos.zPos -= (COS(item->pos.yRot)) << 6 >> W2V_SHIFT;
|
item->pos.zPos -= (phd_cos(item->pos.yRot)) << 6 >> W2V_SHIFT;
|
||||||
item->goalAnimState = STATE_LARA_FREEFALL;
|
item->goalAnimState = STATE_LARA_FREEFALL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4885,13 +4890,13 @@ void lara_col_all4s(ITEM_INFO* item, COLL_INFO* coll)//14B40, 14C74 (F)
|
||||||
int x = item->pos.xPos;
|
int x = item->pos.xPos;
|
||||||
int z = item->pos.zPos;
|
int z = item->pos.zPos;
|
||||||
|
|
||||||
item->pos.xPos += 128 * SIN(item->pos.yRot - ANGLE(90)) >> W2V_SHIFT;
|
item->pos.xPos += 128 * phd_sin(item->pos.yRot - ANGLE(90)) >> W2V_SHIFT;
|
||||||
item->pos.zPos += 128 * COS(item->pos.yRot - ANGLE(90)) >> W2V_SHIFT;
|
item->pos.zPos += 128 * phd_cos(item->pos.yRot - ANGLE(90)) >> W2V_SHIFT;
|
||||||
|
|
||||||
heightl = LaraFloorFront(item, item->pos.yRot, -300);
|
heightl = LaraFloorFront(item, item->pos.yRot, -300);
|
||||||
|
|
||||||
item->pos.xPos += 256 * SIN(item->pos.yRot + ANGLE(90)) >> W2V_SHIFT;
|
item->pos.xPos += 256 * phd_sin(item->pos.yRot + ANGLE(90)) >> W2V_SHIFT;
|
||||||
item->pos.zPos += 256 * COS(item->pos.yRot + ANGLE(90)) >> W2V_SHIFT;
|
item->pos.zPos += 256 * phd_cos(item->pos.yRot + ANGLE(90)) >> W2V_SHIFT;
|
||||||
|
|
||||||
heightr = LaraFloorFront(item, item->pos.yRot, -300);
|
heightr = LaraFloorFront(item, item->pos.yRot, -300);
|
||||||
|
|
||||||
|
@ -4916,8 +4921,8 @@ void lara_col_all4s(ITEM_INFO* item, COLL_INFO* coll)//14B40, 14C74 (F)
|
||||||
int x = item->pos.xPos;
|
int x = item->pos.xPos;
|
||||||
int z = item->pos.zPos;
|
int z = item->pos.zPos;
|
||||||
|
|
||||||
item->pos.xPos -= 100 * SIN(coll->facing) >> W2V_SHIFT;
|
item->pos.xPos -= 100 * phd_sin(coll->facing) >> W2V_SHIFT;
|
||||||
item->pos.zPos -= 100 * COS(coll->facing) >> W2V_SHIFT;
|
item->pos.zPos -= 100 * phd_cos(coll->facing) >> W2V_SHIFT;
|
||||||
|
|
||||||
//tmp = GetCollidedObjects(item, 100, 1, wat, wat, 0);
|
//tmp = GetCollidedObjects(item, 100, 1, wat, wat, 0);
|
||||||
//S_Warn("[lara_col_all4s] - Warning: Core Design function call shittery\n");
|
//S_Warn("[lara_col_all4s] - Warning: Core Design function call shittery\n");
|
||||||
|
@ -5006,9 +5011,9 @@ void lara_as_all4s(ITEM_INFO* item, COLL_INFO* coll)//14970, 14A78 (F)
|
||||||
s.z = LaraItem->pos.zPos;
|
s.z = LaraItem->pos.zPos;
|
||||||
s.roomNumber = LaraItem->roomNumber;
|
s.roomNumber = LaraItem->roomNumber;
|
||||||
|
|
||||||
d.x = s.x + (768 * SIN(LaraItem->pos.yRot) >> W2V_SHIFT);
|
d.x = s.x + (768 * phd_sin(LaraItem->pos.yRot) >> W2V_SHIFT);
|
||||||
d.y = s.y + 160;
|
d.y = s.y + 160;
|
||||||
d.z = s.z + (768 * COS(LaraItem->pos.yRot) >> W2V_SHIFT);
|
d.z = s.z + (768 * phd_cos(LaraItem->pos.yRot) >> W2V_SHIFT);
|
||||||
|
|
||||||
if (LOS(&s, &d))
|
if (LOS(&s, &d))
|
||||||
{
|
{
|
||||||
|
@ -5682,8 +5687,8 @@ void LaraSlideEdgeJump(ITEM_INFO* item, COLL_INFO* coll)//12B18, 12BC8 (F)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_CLAMP:
|
case CT_CLAMP:
|
||||||
item->pos.zPos -= (400 * COS(coll->facing)) >> W2V_SHIFT;
|
item->pos.zPos -= (400 * phd_cos(coll->facing)) >> W2V_SHIFT;
|
||||||
item->pos.xPos -= (400 * SIN(coll->facing)) >> W2V_SHIFT;
|
item->pos.xPos -= (400 * phd_sin(coll->facing)) >> W2V_SHIFT;
|
||||||
|
|
||||||
item->speed = 0;
|
item->speed = 0;
|
||||||
|
|
||||||
|
@ -5746,8 +5751,8 @@ void LaraDeflectEdgeJump(ITEM_INFO* item, COLL_INFO* coll)//12904, 129B4 (F)
|
||||||
item->pos.yRot -= ANGLE(5);
|
item->pos.yRot -= ANGLE(5);
|
||||||
break;
|
break;
|
||||||
case CT_CLAMP:
|
case CT_CLAMP:
|
||||||
item->pos.xPos -= (100 * 4 * SIN(coll->facing)) >> W2V_SHIFT;
|
item->pos.xPos -= (100 * 4 * phd_sin(coll->facing)) >> W2V_SHIFT;
|
||||||
item->pos.zPos -= (100 * 4 * COS(coll->facing)) >> W2V_SHIFT;
|
item->pos.zPos -= (100 * 4 * phd_cos(coll->facing)) >> W2V_SHIFT;
|
||||||
|
|
||||||
item->speed = 0;
|
item->speed = 0;
|
||||||
coll->midFloor = 0;
|
coll->midFloor = 0;
|
||||||
|
@ -6087,9 +6092,9 @@ short LaraCeilingFront(ITEM_INFO* item, short ang, int dist, int h) // (F) (D)
|
||||||
{
|
{
|
||||||
short room = item->roomNumber;
|
short room = item->roomNumber;
|
||||||
|
|
||||||
int x = item->pos.xPos + ((dist * SIN(ang)) >> W2V_SHIFT);
|
int x = item->pos.xPos + ((dist * phd_sin(ang)) >> W2V_SHIFT);
|
||||||
int y = item->pos.yPos - h;
|
int y = item->pos.yPos - h;
|
||||||
int z = item->pos.zPos + ((dist * COS(ang)) >> W2V_SHIFT);
|
int z = item->pos.zPos + ((dist * phd_cos(ang)) >> W2V_SHIFT);
|
||||||
|
|
||||||
int height = GetCeiling(GetFloor(x, y, z, &room), x, y, z);
|
int height = GetCeiling(GetFloor(x, y, z, &room), x, y, z);
|
||||||
|
|
||||||
|
@ -6103,9 +6108,9 @@ short LaraFloorFront(ITEM_INFO* item, short ang, int dist) // (F) (D)
|
||||||
{
|
{
|
||||||
short room = item->roomNumber;
|
short room = item->roomNumber;
|
||||||
|
|
||||||
int x = item->pos.xPos + ((dist * SIN(ang)) >> W2V_SHIFT);
|
int x = item->pos.xPos + ((dist * phd_sin(ang)) >> W2V_SHIFT);
|
||||||
int y = item->pos.yPos - 762;
|
int y = item->pos.yPos - 762;
|
||||||
int z = item->pos.zPos + ((dist * COS(ang)) >> W2V_SHIFT);
|
int z = item->pos.zPos + ((dist * phd_cos(ang)) >> W2V_SHIFT);
|
||||||
|
|
||||||
int height = GetFloorHeight(GetFloor(x, y, z, &room), x, y, z);
|
int height = GetFloorHeight(GetFloor(x, y, z, &room), x, y, z);
|
||||||
|
|
||||||
|
@ -6202,7 +6207,7 @@ int TestLaraVault(ITEM_INFO* item, COLL_INFO* coll) // (F) (D)
|
||||||
item->frameNumber = Anims[item->animNumber].frameBase;
|
item->frameNumber = Anims[item->animNumber].frameBase;
|
||||||
item->goalAnimState = STATE_LARA_JUMP_UP;
|
item->goalAnimState = STATE_LARA_JUMP_UP;
|
||||||
item->currentAnimState = STATE_LARA_STOP;
|
item->currentAnimState = STATE_LARA_STOP;
|
||||||
Lara.calcFallSpeed = -3 - SQRT_ASM(-9600 - 12 * coll->frontFloor);
|
Lara.calcFallSpeed = -3 - sqrt(-9600 - 12 * coll->frontFloor);
|
||||||
AnimateLara(item);
|
AnimateLara(item);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -6646,9 +6651,3 @@ int LaraHangTest(ITEM_INFO* item, COLL_INFO* coll) // (F) (D)
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inject_Lara()
|
|
||||||
{
|
|
||||||
//INJECT(0x00448010, lara_as_stop);
|
|
||||||
//INJECT(0x00442E70, LaraAboveWater);
|
|
||||||
}
|
|
|
@ -15,12 +15,106 @@ typedef struct DiaryInfo {
|
||||||
bool Present;
|
bool Present;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct WaterskinInfo {
|
struct WaterskinInfo {
|
||||||
bool Present;
|
bool Present;
|
||||||
int Quantity;
|
int Quantity;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct LaraExtraInfo {
|
struct LaraInfo {
|
||||||
|
short itemNumber;
|
||||||
|
short gunStatus;
|
||||||
|
short gunType;
|
||||||
|
short requestGunType;
|
||||||
|
short lastGunType;
|
||||||
|
short calcFallSpeed;
|
||||||
|
short waterStatus;
|
||||||
|
short climbStatus;
|
||||||
|
short poseCount;
|
||||||
|
short hitFrame;
|
||||||
|
short hitDirection;
|
||||||
|
short air;
|
||||||
|
short diveCount;
|
||||||
|
short deathCount;
|
||||||
|
short currentActive;
|
||||||
|
short currentXvel;
|
||||||
|
short currentYvel;
|
||||||
|
short currentZvel;
|
||||||
|
short spazEffectCount;
|
||||||
|
short flareAge;
|
||||||
|
short burnCount;
|
||||||
|
short weaponItem;
|
||||||
|
short backGun;
|
||||||
|
short flareFrame;
|
||||||
|
short poisoned;
|
||||||
|
short dpoisoned;
|
||||||
|
byte anxiety;
|
||||||
|
byte wet[15];
|
||||||
|
bool flareControlLeft;
|
||||||
|
bool unused1;
|
||||||
|
bool look;
|
||||||
|
bool burn;
|
||||||
|
bool keepDucked;
|
||||||
|
bool isMoving;
|
||||||
|
bool canMonkeySwing;
|
||||||
|
byte burnBlue;
|
||||||
|
bool gassed;
|
||||||
|
bool burnSmoke;
|
||||||
|
bool isDucked;
|
||||||
|
bool hasFired;
|
||||||
|
bool busy;
|
||||||
|
bool litTorch;
|
||||||
|
bool isClimbing;
|
||||||
|
bool fired;
|
||||||
|
int waterSurfaceDist;
|
||||||
|
PHD_VECTOR lastPos;
|
||||||
|
FX_INFO* spazEffect;
|
||||||
|
int meshEffects;
|
||||||
|
short* meshPtrs[15];
|
||||||
|
ITEM_INFO* target;
|
||||||
|
short targetAngles[2];
|
||||||
|
short turnRate;
|
||||||
|
short moveAngle;
|
||||||
|
short headYrot;
|
||||||
|
short headXrot;
|
||||||
|
short headZrot;
|
||||||
|
short torsoYrot;
|
||||||
|
short torsoXrot;
|
||||||
|
short torsoZrot;
|
||||||
|
LARA_ARM leftArm;
|
||||||
|
LARA_ARM rightArm;
|
||||||
|
unsigned short holster;
|
||||||
|
CREATURE_INFO* creature;
|
||||||
|
int cornerX;
|
||||||
|
int cornerZ;
|
||||||
|
byte ropeSegment;
|
||||||
|
byte ropeDirection;
|
||||||
|
short ropeArcFront;
|
||||||
|
short ropeArcBack;
|
||||||
|
short ropeLastX;
|
||||||
|
short ropeMaxXForward;
|
||||||
|
short ropeMaxXBackward;
|
||||||
|
int ropeDFrame;
|
||||||
|
int ropeFrame;
|
||||||
|
unsigned short ropeFrameRate;
|
||||||
|
unsigned short ropeY;
|
||||||
|
int ropePtr;
|
||||||
|
void* generalPtr;
|
||||||
|
int ropeOffset;
|
||||||
|
int ropeDownVel;
|
||||||
|
byte ropeFlag;
|
||||||
|
byte moveCount;
|
||||||
|
int ropeCount;
|
||||||
|
byte skelebob;
|
||||||
|
byte wetcloth;
|
||||||
|
byte bottle;
|
||||||
|
byte location;
|
||||||
|
byte highestLocation;
|
||||||
|
byte locationPad;
|
||||||
|
byte tightRopeOnCount;
|
||||||
|
byte tightRopeOff;
|
||||||
|
byte tightRopeFall;
|
||||||
|
byte chaffTimer;
|
||||||
|
|
||||||
short Vehicle;
|
short Vehicle;
|
||||||
short ExtraAnim;
|
short ExtraAnim;
|
||||||
bool mineL;
|
bool mineL;
|
||||||
|
@ -49,9 +143,9 @@ typedef struct LaraExtraInfo {
|
||||||
int NumFlares;
|
int NumFlares;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern LaraExtraInfo g_LaraExtra;
|
extern LaraInfo Lara;
|
||||||
|
extern ITEM_INFO* LaraItem;
|
||||||
#define GetLaraJointPosition ((void (__cdecl*)(PHD_VECTOR*, int)) 0x0041E2A0)
|
extern byte LaraNodeUnderwater[15];
|
||||||
|
|
||||||
extern void(*lara_control_routines[NUM_LARA_STATES + 1])(ITEM_INFO* item, COLL_INFO* coll);
|
extern void(*lara_control_routines[NUM_LARA_STATES + 1])(ITEM_INFO* item, COLL_INFO* coll);
|
||||||
extern void(*lara_collision_routines[NUM_LARA_STATES + 1])(ITEM_INFO* item, COLL_INFO* coll);
|
extern void(*lara_collision_routines[NUM_LARA_STATES + 1])(ITEM_INFO* item, COLL_INFO* coll);
|
||||||
|
@ -234,11 +328,3 @@ void GetLaraCollisionInfo(ITEM_INFO* item, COLL_INFO* coll);
|
||||||
int TestLaraVault(ITEM_INFO* item, COLL_INFO* coll);
|
int TestLaraVault(ITEM_INFO* item, COLL_INFO* coll);
|
||||||
int TestLaraSlide(ITEM_INFO* item, COLL_INFO* coll);
|
int TestLaraSlide(ITEM_INFO* item, COLL_INFO* coll);
|
||||||
void LaraClimbRope(ITEM_INFO* item, COLL_INFO* coll);
|
void LaraClimbRope(ITEM_INFO* item, COLL_INFO* coll);
|
||||||
|
|
||||||
//int GetLaraJointPos(PHD_VECTOR* pos, int joint);
|
|
||||||
//void SetLaraUnderwaterNodes();
|
|
||||||
//void FireChaff();
|
|
||||||
//void GetLaraJointPosRot(PHD_VECTOR* pos, int a2, int a3, SVECTOR* a4);
|
|
||||||
//void DoSubsuitStuff();
|
|
||||||
|
|
||||||
void Inject_Lara();
|
|
|
@ -20,19 +20,25 @@
|
||||||
|
|
||||||
#include "..\Global\global.h"
|
#include "..\Global\global.h"
|
||||||
#include "..\Scripting\GameFlowScript.h"
|
#include "..\Scripting\GameFlowScript.h"
|
||||||
#include "..\Specific\roomload.h"
|
#include "..\Specific\level.h"
|
||||||
#include "../Specific/setup.h"
|
#include "../Specific/setup.h"
|
||||||
|
#include "../Specific/input.h"
|
||||||
|
#include "savegame.h"
|
||||||
|
#include "sound.h"
|
||||||
|
|
||||||
#include "bubble.h"
|
#include "bubble.h"
|
||||||
|
|
||||||
extern LaraExtraInfo g_LaraExtra;
|
|
||||||
extern GameFlow* g_GameFlow;
|
extern GameFlow* g_GameFlow;
|
||||||
|
|
||||||
int HKCounter = 0;
|
int HKCounter = 0;
|
||||||
|
int HKTimer = 0;
|
||||||
|
int HKFlag = 0;
|
||||||
|
byte HKFlag2 = 0;
|
||||||
|
|
||||||
void FireHarpoon()
|
void FireHarpoon()
|
||||||
{
|
{
|
||||||
// If no ammo then exit
|
// If no ammo then exit
|
||||||
//if (g_LaraExtra.numHarpoonAmmos <= 0)
|
//if (Lara.numHarpoonAmmos <= 0)
|
||||||
// return;
|
// return;
|
||||||
|
|
||||||
// Create a new item for harpoon
|
// Create a new item for harpoon
|
||||||
|
@ -52,7 +58,7 @@ void FireHarpoon()
|
||||||
pos.z = dxPos.z = 77;
|
pos.z = dxPos.z = 77;
|
||||||
|
|
||||||
g_Renderer->GetLaraBonePosition(&dxPos, LM_RHAND);
|
g_Renderer->GetLaraBonePosition(&dxPos, LM_RHAND);
|
||||||
GetLaraJointPosition((PHD_VECTOR*)&pos, LJ_RHAND);
|
GetLaraJointPosition((PHD_VECTOR*)&pos, LM_RHAND);
|
||||||
|
|
||||||
/*item->pos.xPos = pos.x = dxPos.x;
|
/*item->pos.xPos = pos.x = dxPos.x;
|
||||||
item->pos.yPos = pos.y = dxPos.y;
|
item->pos.yPos = pos.y = dxPos.y;
|
||||||
|
@ -68,9 +74,9 @@ void FireHarpoon()
|
||||||
{
|
{
|
||||||
find_target_point(Lara.target, &pos);
|
find_target_point(Lara.target, &pos);
|
||||||
|
|
||||||
item->pos.yRot = ATAN(pos.z - item->pos.zPos, pos.x - item->pos.xPos);
|
item->pos.yRot = phd_atan(pos.z - item->pos.zPos, pos.x - item->pos.xPos);
|
||||||
int distance = SQRT_ASM(SQUARE(pos.z - item->pos.zPos) + SQUARE(pos.x - item->pos.xPos));
|
int distance = sqrt(SQUARE(pos.z - item->pos.zPos) + SQUARE(pos.x - item->pos.xPos));
|
||||||
item->pos.xRot = -ATAN(distance, pos.y - item->pos.yPos);
|
item->pos.xRot = -phd_atan(distance, pos.y - item->pos.yPos);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -80,8 +86,8 @@ void FireHarpoon()
|
||||||
|
|
||||||
item->pos.zRot = 0;
|
item->pos.zRot = 0;
|
||||||
|
|
||||||
item->fallspeed = (short)(-HARPOON_SPEED * SIN(item->pos.xRot) >> W2V_SHIFT);
|
item->fallspeed = (short)(-HARPOON_SPEED * phd_sin(item->pos.xRot) >> W2V_SHIFT);
|
||||||
item->speed = (short)(HARPOON_SPEED * COS(item->pos.xRot) >> W2V_SHIFT);
|
item->speed = (short)(HARPOON_SPEED * phd_cos(item->pos.xRot) >> W2V_SHIFT);
|
||||||
item->hitPoints = HARPOON_TIME;
|
item->hitPoints = HARPOON_TIME;
|
||||||
|
|
||||||
AddActiveItem(itemNumber);
|
AddActiveItem(itemNumber);
|
||||||
|
@ -100,9 +106,9 @@ void ControlHarpoonBolt(short itemNumber)
|
||||||
int oldZ = item->pos.zPos;
|
int oldZ = item->pos.zPos;
|
||||||
short oldRoom = item->roomNumber;
|
short oldRoom = item->roomNumber;
|
||||||
|
|
||||||
item->pos.xPos += item->speed * SIN(item->pos.yRot) >> W2V_SHIFT;
|
item->pos.xPos += item->speed * phd_sin(item->pos.yRot) >> W2V_SHIFT;
|
||||||
item->pos.yPos += item->fallspeed;
|
item->pos.yPos += item->fallspeed;
|
||||||
item->pos.zPos += item->speed * COS(item->pos.yRot) >> W2V_SHIFT;
|
item->pos.zPos += item->speed * phd_cos(item->pos.yRot) >> W2V_SHIFT;
|
||||||
|
|
||||||
short roomNumber = item->roomNumber;
|
short roomNumber = item->roomNumber;
|
||||||
FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber);
|
FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber);
|
||||||
|
@ -134,8 +140,8 @@ void ControlHarpoonBolt(short itemNumber)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// get vector from target to bolt and check against x,z bounds
|
// get vector from target to bolt and check against x,z bounds
|
||||||
short c = COS(target->pos.yRot);
|
short c = phd_cos(target->pos.yRot);
|
||||||
short s = SIN(target->pos.yRot);
|
short s = phd_sin(target->pos.yRot);
|
||||||
|
|
||||||
int x = item->pos.xPos - target->pos.xPos;
|
int x = item->pos.xPos - target->pos.xPos;
|
||||||
int z = item->pos.zPos - target->pos.zPos;
|
int z = item->pos.zPos - target->pos.zPos;
|
||||||
|
@ -220,8 +226,8 @@ void ControlHarpoonBolt(short itemNumber)
|
||||||
item->pos.xRot -= ANGLE(1);
|
item->pos.xRot -= ANGLE(1);
|
||||||
if (item->pos.xRot < -16384)
|
if (item->pos.xRot < -16384)
|
||||||
item->pos.xRot = -16384;
|
item->pos.xRot = -16384;
|
||||||
item->fallspeed = (short)(-HARPOON_SPEED * SIN(item->pos.xRot) >> W2V_SHIFT);
|
item->fallspeed = (short)(-HARPOON_SPEED * phd_sin(item->pos.xRot) >> W2V_SHIFT);
|
||||||
item->speed = (short)(HARPOON_SPEED * COS(item->pos.xRot) >> W2V_SHIFT);
|
item->speed = (short)(HARPOON_SPEED * phd_cos(item->pos.xRot) >> W2V_SHIFT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -229,8 +235,8 @@ void ControlHarpoonBolt(short itemNumber)
|
||||||
if ((Wibble & 15) == 0)
|
if ((Wibble & 15) == 0)
|
||||||
CreateBubble((PHD_VECTOR*)&item->pos, item->roomNumber, 0, 0,BUBBLE_FLAG_CLUMP | BUBBLE_FLAG_HIGH_AMPLITUDE, 0, 0, 0); // CHECK
|
CreateBubble((PHD_VECTOR*)&item->pos, item->roomNumber, 0, 0,BUBBLE_FLAG_CLUMP | BUBBLE_FLAG_HIGH_AMPLITUDE, 0, 0, 0); // CHECK
|
||||||
//TriggerRocketSmoke(item->pos.xPos, item->pos.yPos, item->pos.zPos, 64);
|
//TriggerRocketSmoke(item->pos.xPos, item->pos.yPos, item->pos.zPos, 64);
|
||||||
item->fallspeed = (short)(-(HARPOON_SPEED >> 1) * SIN(item->pos.xRot) >> W2V_SHIFT);
|
item->fallspeed = (short)(-(HARPOON_SPEED >> 1) * phd_sin(item->pos.xRot) >> W2V_SHIFT);
|
||||||
item->speed = (short)((HARPOON_SPEED >> 1) * COS(item->pos.xRot) >> W2V_SHIFT);
|
item->speed = (short)((HARPOON_SPEED >> 1) * phd_cos(item->pos.xRot) >> W2V_SHIFT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,7 +275,7 @@ void FireGrenade()
|
||||||
jointPos.y = 276;
|
jointPos.y = 276;
|
||||||
jointPos.z = 80;
|
jointPos.z = 80;
|
||||||
|
|
||||||
GetLaraJointPosition(&jointPos, LJ_RHAND);
|
GetLaraJointPosition(&jointPos, LM_RHAND);
|
||||||
|
|
||||||
item->pos.xPos = x = jointPos.x;
|
item->pos.xPos = x = jointPos.x;
|
||||||
item->pos.yPos = y = jointPos.y;
|
item->pos.yPos = y = jointPos.y;
|
||||||
|
@ -289,7 +295,7 @@ void FireGrenade()
|
||||||
jointPos.y = 1204;
|
jointPos.y = 1204;
|
||||||
jointPos.z = 5;
|
jointPos.z = 5;
|
||||||
|
|
||||||
GetLaraJointPosition(&jointPos, LJ_RHAND);
|
GetLaraJointPosition(&jointPos, LM_RHAND);
|
||||||
|
|
||||||
SmokeCountL = 32;
|
SmokeCountL = 32;
|
||||||
SmokeWeapon = WEAPON_GRENADE_LAUNCHER;
|
SmokeWeapon = WEAPON_GRENADE_LAUNCHER;
|
||||||
|
@ -314,7 +320,7 @@ void FireGrenade()
|
||||||
}
|
}
|
||||||
|
|
||||||
item->speed = GRENADE_SPEED;
|
item->speed = GRENADE_SPEED;
|
||||||
item->fallspeed = (-512 * SIN(item->pos.xRot)) >> W2V_SHIFT;
|
item->fallspeed = (-512 * phd_sin(item->pos.xRot)) >> W2V_SHIFT;
|
||||||
item->currentAnimState = item->pos.xRot;
|
item->currentAnimState = item->pos.xRot;
|
||||||
item->goalAnimState = item->pos.yRot;
|
item->goalAnimState = item->pos.yRot;
|
||||||
item->requiredAnimState = 0;
|
item->requiredAnimState = 0;
|
||||||
|
@ -326,7 +332,7 @@ void FireGrenade()
|
||||||
if (*ammo != -1)
|
if (*ammo != -1)
|
||||||
(*ammo)--;
|
(*ammo)--;
|
||||||
|
|
||||||
item->itemFlags[0] = g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].SelectedAmmo;
|
item->itemFlags[0] = Lara.Weapons[WEAPON_GRENADE_LAUNCHER].SelectedAmmo;
|
||||||
|
|
||||||
Savegame.Level.AmmoUsed++;
|
Savegame.Level.AmmoUsed++;
|
||||||
Savegame.Game.AmmoUsed++;
|
Savegame.Game.AmmoUsed++;
|
||||||
|
@ -393,7 +399,7 @@ void ControlGrenade(short itemNumber)
|
||||||
newGrenade->pos.yRot = GetRandomControl() * 2;
|
newGrenade->pos.yRot = GetRandomControl() * 2;
|
||||||
newGrenade->pos.zRot = 0;
|
newGrenade->pos.zRot = 0;
|
||||||
newGrenade->speed = 64;
|
newGrenade->speed = 64;
|
||||||
newGrenade->fallspeed = -64 * SIN(newGrenade->pos.xRot) >> W2V_SHIFT;
|
newGrenade->fallspeed = -64 * phd_sin(newGrenade->pos.xRot) >> W2V_SHIFT;
|
||||||
newGrenade->currentAnimState = newGrenade->pos.xRot;
|
newGrenade->currentAnimState = newGrenade->pos.xRot;
|
||||||
newGrenade->goalAnimState = newGrenade->pos.yRot;
|
newGrenade->goalAnimState = newGrenade->pos.yRot;
|
||||||
newGrenade->requiredAnimState = 0;
|
newGrenade->requiredAnimState = 0;
|
||||||
|
@ -458,8 +464,19 @@ void ControlGrenade(short itemNumber)
|
||||||
|
|
||||||
if (item->speed && aboveWater)
|
if (item->speed && aboveWater)
|
||||||
{
|
{
|
||||||
|
Matrix world = Matrix::CreateFromYawPitchRoll(
|
||||||
|
TO_RAD(item->pos.yRot - ANGLE(180)),
|
||||||
|
TO_RAD(item->pos.xRot),
|
||||||
|
TO_RAD(item->pos.zRot)
|
||||||
|
) * Matrix::CreateTranslation(0, 0, -64);
|
||||||
|
|
||||||
|
int wx = world.Translation().x;
|
||||||
|
int wy = world.Translation().y;
|
||||||
|
int wz = world.Translation().z;
|
||||||
|
|
||||||
// For now keep this legacy math
|
// For now keep this legacy math
|
||||||
phd_PushUnitMatrix();
|
// PHD_MATH
|
||||||
|
/*phd_PushUnitMatrix();
|
||||||
|
|
||||||
MatrixPtr[M03] = 0;
|
MatrixPtr[M03] = 0;
|
||||||
MatrixPtr[M13] = 0;
|
MatrixPtr[M13] = 0;
|
||||||
|
@ -472,7 +489,7 @@ void ControlGrenade(short itemNumber)
|
||||||
int wy = (MatrixPtr[M13] >> W2V_SHIFT);
|
int wy = (MatrixPtr[M13] >> W2V_SHIFT);
|
||||||
int wz = (MatrixPtr[M23] >> W2V_SHIFT);
|
int wz = (MatrixPtr[M23] >> W2V_SHIFT);
|
||||||
|
|
||||||
phd_PopMatrix();
|
phd_PopMatrix();*/
|
||||||
|
|
||||||
TriggerRocketSmoke(wx + item->pos.xPos, wy + item->pos.yPos, wz + item->pos.zPos, -1);
|
TriggerRocketSmoke(wx + item->pos.xPos, wy + item->pos.yPos, wz + item->pos.zPos, -1);
|
||||||
}
|
}
|
||||||
|
@ -481,8 +498,8 @@ void ControlGrenade(short itemNumber)
|
||||||
XMMATRIX translation;
|
XMMATRIX translation;
|
||||||
XMMATRIX rotation;
|
XMMATRIX rotation;
|
||||||
|
|
||||||
XMMATRIXRotationYawPitchRoll(&rotation, TR_ANGLE_TO_RAD(item->pos.yRot), TR_ANGLE_TO_RAD(item->pos.xRot),
|
XMMATRIXRotationYawPitchRoll(&rotation, TO_RAD(item->pos.yRot), TO_RAD(item->pos.xRot),
|
||||||
TR_ANGLE_TO_RAD(item->pos.zRot));
|
TO_RAD(item->pos.zRot));
|
||||||
XMMATRIXTranslation(&translation, 0, 0, -64);
|
XMMATRIXTranslation(&translation, 0, 0, -64);
|
||||||
XMMATRIXMultiply(&transform, &rotation, &translation);
|
XMMATRIXMultiply(&transform, &rotation, &translation);
|
||||||
|
|
||||||
|
@ -494,9 +511,9 @@ void ControlGrenade(short itemNumber)
|
||||||
TriggerRocketSmoke(wx + item->pos.xPos, wy + item->pos.yPos, wz + item->pos.zPos, -1);
|
TriggerRocketSmoke(wx + item->pos.xPos, wy + item->pos.yPos, wz + item->pos.zPos, -1);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
xv = ((item->speed * SIN(item->goalAnimState)) >> W2V_SHIFT);
|
xv = ((item->speed * phd_sin(item->goalAnimState)) >> W2V_SHIFT);
|
||||||
yv = item->fallspeed;
|
yv = item->fallspeed;
|
||||||
zv = ((item->speed * COS(item->goalAnimState)) >> W2V_SHIFT);
|
zv = ((item->speed * phd_cos(item->goalAnimState)) >> W2V_SHIFT);
|
||||||
|
|
||||||
item->pos.xPos += xv;
|
item->pos.xPos += xv;
|
||||||
item->pos.yPos += yv;
|
item->pos.yPos += yv;
|
||||||
|
@ -651,7 +668,7 @@ void ControlGrenade(short itemNumber)
|
||||||
ExplodeItemNode(currentItem, Objects[ID_SHOOT_SWITCH1].nmeshes - 1, 0, 64);
|
ExplodeItemNode(currentItem, Objects[ID_SHOOT_SWITCH1].nmeshes - 1, 0, 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
AddActiveItem((currentItem - Items) / sizeof(ITEM_INFO));
|
AddActiveItem((currentItem - Items));
|
||||||
currentItem->status = ITEM_ACTIVE;
|
currentItem->status = ITEM_ACTIVE;
|
||||||
currentItem->triggerFlags |= 0x3E40;
|
currentItem->triggerFlags |= 0x3E40;
|
||||||
}
|
}
|
||||||
|
@ -662,7 +679,7 @@ void ControlGrenade(short itemNumber)
|
||||||
TriggerShockwave(¤tItem->pos, 48, 304, 64, 0, 96, 128, 24, 0, 0); // CHECK
|
TriggerShockwave(¤tItem->pos, 48, 304, 64, 0, 96, 128, 24, 0, 0); // CHECK
|
||||||
currentItem->pos.yPos += 128;
|
currentItem->pos.yPos += 128;
|
||||||
ExplodeItemNode(currentItem, 0, 0, 128);
|
ExplodeItemNode(currentItem, 0, 0, 128);
|
||||||
short currentItemNumber = (currentItem - Items) / sizeof(ITEM_INFO);
|
short currentItemNumber = (currentItem - Items);
|
||||||
SmashObject(currentItemNumber);
|
SmashObject(currentItemNumber);
|
||||||
KillItem(currentItemNumber);
|
KillItem(currentItemNumber);
|
||||||
}
|
}
|
||||||
|
@ -852,7 +869,7 @@ void AnimateShotgun(int weaponType)
|
||||||
pos.z = 72;
|
pos.z = 72;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetLaraJointPosition(&pos, LJ_LOUTARM);
|
GetLaraJointPosition(&pos, LM_LOUTARM);
|
||||||
|
|
||||||
if (LaraItem->meshBits)
|
if (LaraItem->meshBits)
|
||||||
TriggerGunSmoke(pos.x, pos.y, pos.z, 0, 0, 0, 0, SmokeWeapon, SmokeCountL);
|
TriggerGunSmoke(pos.x, pos.y, pos.z, 0, 0, 0, 0, SmokeWeapon, SmokeCountL);
|
||||||
|
@ -906,7 +923,7 @@ void AnimateShotgun(int weaponType)
|
||||||
if (weaponType == WEAPON_HARPOON_GUN)
|
if (weaponType == WEAPON_HARPOON_GUN)
|
||||||
{
|
{
|
||||||
FireHarpoon();
|
FireHarpoon();
|
||||||
if (!(g_LaraExtra.Weapons[WEAPON_HARPOON_GUN].Ammo[0] & 3))
|
if (!(Lara.Weapons[WEAPON_HARPOON_GUN].Ammo[0] & 3))
|
||||||
harpoonFired = true;
|
harpoonFired = true;
|
||||||
}
|
}
|
||||||
else if (weaponType == WEAPON_ROCKET_LAUNCHER)
|
else if (weaponType == WEAPON_ROCKET_LAUNCHER)
|
||||||
|
@ -926,7 +943,7 @@ void AnimateShotgun(int weaponType)
|
||||||
FireHK(0);
|
FireHK(0);
|
||||||
HKFlag = 1;
|
HKFlag = 1;
|
||||||
|
|
||||||
if (g_LaraExtra.Weapons[WEAPON_HK].HasSilencer)
|
if (Lara.Weapons[WEAPON_HK].HasSilencer)
|
||||||
{
|
{
|
||||||
SoundEffect(14, 0, 0);
|
SoundEffect(14, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -945,7 +962,7 @@ void AnimateShotgun(int weaponType)
|
||||||
item->goalAnimState = 0;
|
item->goalAnimState = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->goalAnimState != 2 && HKFlag && !(g_LaraExtra.Weapons[WEAPON_HK].HasSilencer))
|
if (item->goalAnimState != 2 && HKFlag && !(Lara.Weapons[WEAPON_HK].HasSilencer))
|
||||||
{
|
{
|
||||||
StopSoundEffect(68);
|
StopSoundEffect(68);
|
||||||
SoundEffect(69, &LaraItem->pos, 0);
|
SoundEffect(69, &LaraItem->pos, 0);
|
||||||
|
@ -954,7 +971,7 @@ void AnimateShotgun(int weaponType)
|
||||||
}
|
}
|
||||||
else if (HKFlag)
|
else if (HKFlag)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.Weapons[WEAPON_HK].HasSilencer)
|
if (Lara.Weapons[WEAPON_HK].HasSilencer)
|
||||||
{
|
{
|
||||||
SoundEffect(14, 0, 0);
|
SoundEffect(14, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -985,7 +1002,7 @@ void AnimateShotgun(int weaponType)
|
||||||
if (weaponType == WEAPON_HARPOON_GUN)
|
if (weaponType == WEAPON_HARPOON_GUN)
|
||||||
{
|
{
|
||||||
FireHarpoon();
|
FireHarpoon();
|
||||||
if (!(g_LaraExtra.Weapons[WEAPON_HARPOON_GUN].Ammo[0] & 3))
|
if (!(Lara.Weapons[WEAPON_HARPOON_GUN].Ammo[0] & 3))
|
||||||
harpoonFired = true;
|
harpoonFired = true;
|
||||||
}
|
}
|
||||||
else if (weaponType == WEAPON_HK && (/*!(Lara.HKtypeCarried & 0x18) || */!HKTimer))
|
else if (weaponType == WEAPON_HK && (/*!(Lara.HKtypeCarried & 0x18) || */!HKTimer))
|
||||||
|
@ -993,7 +1010,7 @@ void AnimateShotgun(int weaponType)
|
||||||
FireHK(1);
|
FireHK(1);
|
||||||
HKFlag = 1;
|
HKFlag = 1;
|
||||||
item->goalAnimState = 8;
|
item->goalAnimState = 8;
|
||||||
if (g_LaraExtra.Weapons[WEAPON_HK].HasSilencer)
|
if (Lara.Weapons[WEAPON_HK].HasSilencer)
|
||||||
{
|
{
|
||||||
SoundEffect(14, 0, 0);
|
SoundEffect(14, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -1013,7 +1030,7 @@ void AnimateShotgun(int weaponType)
|
||||||
else if (Lara.leftArm.lock)
|
else if (Lara.leftArm.lock)
|
||||||
item->goalAnimState = 6;
|
item->goalAnimState = 6;
|
||||||
}
|
}
|
||||||
else if (item->goalAnimState != 8 && HKFlag && !(g_LaraExtra.Weapons[WEAPON_HK].HasSilencer))
|
else if (item->goalAnimState != 8 && HKFlag && !(Lara.Weapons[WEAPON_HK].HasSilencer))
|
||||||
{
|
{
|
||||||
StopSoundEffect(68);
|
StopSoundEffect(68);
|
||||||
SoundEffect(69, &LaraItem->pos, 0);
|
SoundEffect(69, &LaraItem->pos, 0);
|
||||||
|
@ -1021,7 +1038,7 @@ void AnimateShotgun(int weaponType)
|
||||||
}
|
}
|
||||||
else if (HKFlag)
|
else if (HKFlag)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.Weapons[WEAPON_HK].HasSilencer)
|
if (Lara.Weapons[WEAPON_HK].HasSilencer)
|
||||||
{
|
{
|
||||||
SoundEffect(14, 0, 0);
|
SoundEffect(14, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -1070,9 +1087,9 @@ void ControlCrossbowBolt(short itemNumber)
|
||||||
land = true;
|
land = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
item->pos.xPos += ((item->speed * COS(item->pos.xRot) >> W2V_SHIFT) * SIN(item->pos.yRot)) >> W2V_SHIFT;
|
item->pos.xPos += ((item->speed * phd_cos(item->pos.xRot) >> W2V_SHIFT) * phd_sin(item->pos.yRot)) >> W2V_SHIFT;
|
||||||
item->pos.yPos += item->speed * SIN(-item->pos.xRot) >> W2V_SHIFT;
|
item->pos.yPos += item->speed * phd_sin(-item->pos.xRot) >> W2V_SHIFT;
|
||||||
item->pos.zPos += ((item->speed * COS(item->pos.xRot) >> W2V_SHIFT) * COS(item->pos.yRot)) >> W2V_SHIFT;
|
item->pos.zPos += ((item->speed * phd_cos(item->pos.xRot) >> W2V_SHIFT) * phd_cos(item->pos.yRot)) >> W2V_SHIFT;
|
||||||
|
|
||||||
roomNumber = item->roomNumber;
|
roomNumber = item->roomNumber;
|
||||||
FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber);
|
FLOOR_INFO* floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber);
|
||||||
|
@ -1149,7 +1166,7 @@ void ControlCrossbowBolt(short itemNumber)
|
||||||
TriggerShockwave(¤tItem->pos, 48, 304, 96, 0, 96, 128, 24, 0, 0);
|
TriggerShockwave(¤tItem->pos, 48, 304, 96, 0, 96, 128, 24, 0, 0);
|
||||||
currentItem->pos.yPos += 128;
|
currentItem->pos.yPos += 128;
|
||||||
ExplodeItemNode(currentItem, 0, 0, 128);
|
ExplodeItemNode(currentItem, 0, 0, 128);
|
||||||
short currentItemNumber = (currentItem - CollidedItems[0]) / sizeof(ITEM_INFO);
|
short currentItemNumber = (currentItem - CollidedItems[0]);
|
||||||
SmashObject(currentItemNumber);
|
SmashObject(currentItemNumber);
|
||||||
KillItem(currentItemNumber);
|
KillItem(currentItemNumber);
|
||||||
}
|
}
|
||||||
|
@ -1280,9 +1297,9 @@ void RifleHandler(int weaponType)
|
||||||
if (weaponType == WEAPON_SHOTGUN || weaponType == WEAPON_HK)
|
if (weaponType == WEAPON_SHOTGUN || weaponType == WEAPON_HK)
|
||||||
{
|
{
|
||||||
TriggerDynamicLight(
|
TriggerDynamicLight(
|
||||||
LaraItem->pos.xPos + (SIN(LaraItem->pos.yRot) >> 4) + (byte)GetRandomControl() - 128,
|
LaraItem->pos.xPos + (phd_sin(LaraItem->pos.yRot) >> 4) + (byte)GetRandomControl() - 128,
|
||||||
LaraItem->pos.yPos + (GetRandomControl() & 0x7F) - 575,
|
LaraItem->pos.yPos + (GetRandomControl() & 0x7F) - 575,
|
||||||
LaraItem->pos.zPos + (COS(LaraItem->pos.yRot) >> 4) + (byte)GetRandomControl() - 128,
|
LaraItem->pos.zPos + (phd_cos(LaraItem->pos.yRot) >> 4) + (byte)GetRandomControl() - 128,
|
||||||
12,
|
12,
|
||||||
(GetRandomControl() & 0x3F) + 192,
|
(GetRandomControl() & 0x3F) + 192,
|
||||||
(GetRandomControl() & 0x1F) + 128,
|
(GetRandomControl() & 0x1F) + 128,
|
||||||
|
@ -1297,7 +1314,7 @@ void RifleHandler(int weaponType)
|
||||||
pos.y = (GetRandomControl() & 0x7F) - 63;
|
pos.y = (GetRandomControl() & 0x7F) - 63;
|
||||||
pos.z = GetRandomControl() - 128;
|
pos.z = GetRandomControl() - 128;
|
||||||
|
|
||||||
GetLaraJointPosition(&pos, LJ_RHAND);
|
GetLaraJointPosition(&pos, LM_RHAND);
|
||||||
|
|
||||||
TriggerDynamicLight(pos.x, pos.y, pos.z, 12,
|
TriggerDynamicLight(pos.x, pos.y, pos.z, 12,
|
||||||
(GetRandomControl() & 0x3F) + 192,
|
(GetRandomControl() & 0x3F) + 192,
|
||||||
|
@ -1344,7 +1361,7 @@ void FireCrossbow(PHD_3DPOS* pos)
|
||||||
jointPos.y = 228;
|
jointPos.y = 228;
|
||||||
jointPos.z = 32;
|
jointPos.z = 32;
|
||||||
|
|
||||||
GetLaraJointPosition(&jointPos, LJ_RHAND);
|
GetLaraJointPosition(&jointPos, LM_RHAND);
|
||||||
|
|
||||||
item->roomNumber = LaraItem->roomNumber;
|
item->roomNumber = LaraItem->roomNumber;
|
||||||
|
|
||||||
|
@ -1382,7 +1399,7 @@ void FireCrossbow(PHD_3DPOS* pos)
|
||||||
|
|
||||||
AddActiveItem(itemNumber);
|
AddActiveItem(itemNumber);
|
||||||
|
|
||||||
item->itemFlags[0] = g_LaraExtra.Weapons[WEAPON_CROSSBOW].SelectedAmmo;
|
item->itemFlags[0] = Lara.Weapons[WEAPON_CROSSBOW].SelectedAmmo;
|
||||||
|
|
||||||
SoundEffect(235, 0, 0);
|
SoundEffect(235, 0, 0);
|
||||||
|
|
||||||
|
@ -1401,7 +1418,7 @@ void DoGrenadeDamageOnBaddie(ITEM_INFO* dest, ITEM_INFO* src)
|
||||||
{
|
{
|
||||||
dest->hitStatus = true;
|
dest->hitStatus = true;
|
||||||
|
|
||||||
OBJECT_INFO* obj = &Objects[dest->objectNumber];
|
ObjectInfo* obj = &Objects[dest->objectNumber];
|
||||||
if (!obj->undead)
|
if (!obj->undead)
|
||||||
{
|
{
|
||||||
HitTarget(dest, 0, 30, 1);
|
HitTarget(dest, 0, 30, 1);
|
||||||
|
@ -1411,7 +1428,7 @@ void DoGrenadeDamageOnBaddie(ITEM_INFO* dest, ITEM_INFO* src)
|
||||||
if (src->hitPoints <= 0)
|
if (src->hitPoints <= 0)
|
||||||
{
|
{
|
||||||
++Savegame.Level.Kills;
|
++Savegame.Level.Kills;
|
||||||
CreatureDie((dest - Items) / sizeof(ITEM_INFO), 1);
|
CreatureDie((dest - Items), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1505,13 +1522,13 @@ void CrossbowHitSwitchType78(ITEM_INFO* item1, ITEM_INFO* item2, signed int sear
|
||||||
{
|
{
|
||||||
if (search)
|
if (search)
|
||||||
{
|
{
|
||||||
int numSpheres = GetSpheres(item2, SphereList, 1);
|
int numSpheres = GetSpheres(item2, CreatureSpheres, 1, Matrix::Identity);
|
||||||
int best = -1;
|
int best = -1;
|
||||||
int bestDistance = 0x7FFFFFFF;
|
int bestDistance = 0x7FFFFFFF;
|
||||||
|
|
||||||
for (int i = 0; i < numSpheres; i++)
|
for (int i = 0; i < numSpheres; i++)
|
||||||
{
|
{
|
||||||
SPHERE* sphere = &SphereList[i];
|
SPHERE* sphere = &CreatureSpheres[i];
|
||||||
|
|
||||||
int dx = sphere->x - item1->pos.xPos;
|
int dx = sphere->x - item1->pos.xPos;
|
||||||
int dy = sphere->y - item1->pos.yPos;
|
int dy = sphere->y - item1->pos.yPos;
|
||||||
|
@ -1585,7 +1602,7 @@ void CrossbowHitSwitchType78(ITEM_INFO* item1, ITEM_INFO* item2, signed int sear
|
||||||
if (item2->objectNumber == ID_SHOOT_SWITCH1)
|
if (item2->objectNumber == ID_SHOOT_SWITCH1)
|
||||||
ExplodeItemNode(item2, Objects[ID_SHOOT_SWITCH1].nmeshes - 1, 0, 64);
|
ExplodeItemNode(item2, Objects[ID_SHOOT_SWITCH1].nmeshes - 1, 0, 64);
|
||||||
|
|
||||||
AddActiveItem((item2 - Items) / sizeof(ITEM_INFO));
|
AddActiveItem((item2 - Items));
|
||||||
item2->flags |= 0x3E40;
|
item2->flags |= 0x3E40;
|
||||||
item2->status = ITEM_ACTIVE;
|
item2->status = ITEM_ACTIVE;
|
||||||
}
|
}
|
||||||
|
@ -1594,11 +1611,11 @@ void CrossbowHitSwitchType78(ITEM_INFO* item1, ITEM_INFO* item2, signed int sear
|
||||||
|
|
||||||
void FireHK(int mode)
|
void FireHK(int mode)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.Weapons[WEAPON_HK].SelectedAmmo == WEAPON_AMMO1)
|
if (Lara.Weapons[WEAPON_HK].SelectedAmmo == WEAPON_AMMO1)
|
||||||
{
|
{
|
||||||
HKTimer = 12;
|
HKTimer = 12;
|
||||||
}
|
}
|
||||||
else if (g_LaraExtra.Weapons[WEAPON_HK].SelectedAmmo == WEAPON_AMMO2)
|
else if (Lara.Weapons[WEAPON_HK].SelectedAmmo == WEAPON_AMMO2)
|
||||||
{
|
{
|
||||||
HKCounter++;
|
HKCounter++;
|
||||||
if (HKCounter == 5)
|
if (HKCounter == 5)
|
||||||
|
@ -1654,7 +1671,7 @@ void FireShotgun()
|
||||||
|
|
||||||
short loopAngles[2];
|
short loopAngles[2];
|
||||||
bool fired = false;
|
bool fired = false;
|
||||||
int value = (g_LaraExtra.Weapons[WEAPON_SHOTGUN].SelectedAmmo == WEAPON_AMMO1 ? 1820 : 5460);
|
int value = (Lara.Weapons[WEAPON_SHOTGUN].SelectedAmmo == WEAPON_AMMO1 ? 1820 : 5460);
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
|
@ -1673,7 +1690,7 @@ void FireShotgun()
|
||||||
pos.y = 228;
|
pos.y = 228;
|
||||||
pos.z = 32;
|
pos.z = 32;
|
||||||
|
|
||||||
GetLaraJointPosition(&pos, LJ_RHAND);
|
GetLaraJointPosition(&pos, LM_RHAND);
|
||||||
|
|
||||||
PHD_VECTOR pos2;
|
PHD_VECTOR pos2;
|
||||||
|
|
||||||
|
@ -1685,7 +1702,7 @@ void FireShotgun()
|
||||||
pos.y = 1508;
|
pos.y = 1508;
|
||||||
pos.z = 32;
|
pos.z = 32;
|
||||||
|
|
||||||
GetLaraJointPosition(&pos, LJ_RHAND);
|
GetLaraJointPosition(&pos, LM_RHAND);
|
||||||
|
|
||||||
SmokeCountL = 32;
|
SmokeCountL = 32;
|
||||||
SmokeWeapon = WEAPON_SHOTGUN;
|
SmokeWeapon = WEAPON_SHOTGUN;
|
||||||
|
@ -1724,8 +1741,3 @@ void ready_shotgun(int weaponType)
|
||||||
Lara.rightArm.frameBase = Objects[WeaponObject(weaponType)].frameBase;
|
Lara.rightArm.frameBase = Objects[WeaponObject(weaponType)].frameBase;
|
||||||
Lara.leftArm.frameBase = Objects[WeaponObject(weaponType)].frameBase;
|
Lara.leftArm.frameBase = Objects[WeaponObject(weaponType)].frameBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inject_Lara1Gun()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
|
@ -41,5 +41,3 @@ void FireHK(int mode);
|
||||||
void FireShotgun();
|
void FireShotgun();
|
||||||
void CrossbowHitSwitchType78(ITEM_INFO* item1, ITEM_INFO* item2, signed int search);
|
void CrossbowHitSwitchType78(ITEM_INFO* item1, ITEM_INFO* item2, signed int search);
|
||||||
void ready_shotgun(int weaponType);
|
void ready_shotgun(int weaponType);
|
||||||
|
|
||||||
void Inject_Lara1Gun();
|
|
||||||
|
|
|
@ -3,10 +3,14 @@
|
||||||
#include "larafire.h"
|
#include "larafire.h"
|
||||||
#include "lara.h"
|
#include "lara.h"
|
||||||
#include "effect2.h"
|
#include "effect2.h"
|
||||||
|
#include "draw.h"
|
||||||
#include "tomb4fx.h"
|
#include "tomb4fx.h"
|
||||||
#include "..\Specific\roomload.h"
|
#include "..\Specific\level.h"
|
||||||
#include "..\Specific\setup.h"
|
#include "..\Specific\setup.h"
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
|
#include "../Specific/input.h"
|
||||||
|
#include "sound.h"
|
||||||
|
#include "savegame.h"
|
||||||
|
|
||||||
PISTOL_DEF PistolsTable[4] =
|
PISTOL_DEF PistolsTable[4] =
|
||||||
{
|
{
|
||||||
|
@ -51,7 +55,7 @@ void AnimatePistols(int weaponType)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetLaraJointPosition(&pos, LJ_LHAND);
|
GetLaraJointPosition(&pos, LM_LHAND);
|
||||||
TriggerGunSmoke(pos.x, pos.y, pos.z, 0, 0, 0, (byte)0, SmokeWeapon, SmokeCountL);
|
TriggerGunSmoke(pos.x, pos.y, pos.z, 0, 0, 0, (byte)0, SmokeWeapon, SmokeCountL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +82,7 @@ void AnimatePistols(int weaponType)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetLaraJointPosition(&pos, LJ_RHAND);
|
GetLaraJointPosition(&pos, LM_RHAND);
|
||||||
TriggerGunSmoke(pos.x, pos.y, pos.z, 0, 0, 0, (byte)0, SmokeWeapon, SmokeCountR);
|
TriggerGunSmoke(pos.x, pos.y, pos.z, 0, 0, 0, (byte)0, SmokeWeapon, SmokeCountR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -290,7 +294,7 @@ void PistolHandler(int weaponType)
|
||||||
pos.y = (GetRandomControl() & 0x7F) - 63;
|
pos.y = (GetRandomControl() & 0x7F) - 63;
|
||||||
pos.z = (byte)GetRandomControl() - 128;
|
pos.z = (byte)GetRandomControl() - 128;
|
||||||
|
|
||||||
GetLaraJointPosition(&pos, Lara.leftArm.flash_gun != 0 ? LJ_LHAND : LJ_RHAND);
|
GetLaraJointPosition(&pos, Lara.leftArm.flash_gun != 0 ? LM_LHAND : LM_RHAND);
|
||||||
/*if (gfLevelFlags & 0x2000 && LaraItem->roomNumber == gfMirrorRoom)
|
/*if (gfLevelFlags & 0x2000 && LaraItem->roomNumber == gfMirrorRoom)
|
||||||
{
|
{
|
||||||
v8 = GetRandomControl() & 0x3F;
|
v8 = GetRandomControl() & 0x3F;
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#include "sphere.h"
|
#include "sphere.h"
|
||||||
#include "laramisc.h"
|
#include "laramisc.h"
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
|
#include "..\Specific\level.h"
|
||||||
|
#include "../Specific/input.h"
|
||||||
|
|
||||||
short LeftIntRightExtTab[4] = // offset 0xA0B7C
|
short LeftIntRightExtTab[4] = // offset 0xA0B7C
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,9 +14,12 @@
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
#include "effect2.h"
|
#include "effect2.h"
|
||||||
#include "flmtorch.h"
|
#include "flmtorch.h"
|
||||||
#include "..\Specific\roomload.h"
|
#include "..\Specific\level.h"
|
||||||
#include "lot.h"
|
#include "lot.h"
|
||||||
#include "../Specific/setup.h"
|
#include "../Specific/setup.h"
|
||||||
|
#include "../Specific/input.h"
|
||||||
|
#include "sound.h"
|
||||||
|
#include "savegame.h"
|
||||||
|
|
||||||
WEAPON_INFO Weapons[NUM_WEAPONS] =
|
WEAPON_INFO Weapons[NUM_WEAPONS] =
|
||||||
{
|
{
|
||||||
|
@ -239,7 +242,6 @@ short HoldStates[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
extern GameFlow* g_GameFlow;
|
extern GameFlow* g_GameFlow;
|
||||||
extern LaraExtraInfo g_LaraExtra;
|
|
||||||
bool MonksAttackLara;
|
bool MonksAttackLara;
|
||||||
ITEM_INFO* LastTargets[8];
|
ITEM_INFO* LastTargets[8];
|
||||||
ITEM_INFO* TargetList[8];
|
ITEM_INFO* TargetList[8];
|
||||||
|
@ -356,10 +358,10 @@ void LaraGun() // (F) (D)
|
||||||
Lara.gunStatus = LG_UNDRAW_GUNS;
|
Lara.gunStatus = LG_UNDRAW_GUNS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (g_LaraExtra.NumFlares)
|
else if (Lara.NumFlares)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.NumFlares != -1)
|
if (Lara.NumFlares != -1)
|
||||||
g_LaraExtra.NumFlares--;
|
Lara.NumFlares--;
|
||||||
Lara.requestGunType = WEAPON_FLARE;
|
Lara.requestGunType = WEAPON_FLARE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -383,7 +385,7 @@ void LaraGun() // (F) (D)
|
||||||
}
|
}
|
||||||
else if (Lara.requestGunType == WEAPON_FLARE
|
else if (Lara.requestGunType == WEAPON_FLARE
|
||||||
#if 0
|
#if 0
|
||||||
|| g_LaraExtra.Vehicle == NO_ITEM
|
|| Lara.Vehicle == NO_ITEM
|
||||||
&& (Lara.requestGunType == WEAPON_HARPOON_GUN
|
&& (Lara.requestGunType == WEAPON_HARPOON_GUN
|
||||||
#endif
|
#endif
|
||||||
|| Lara.waterStatus == LW_ABOVE_WATER
|
|| Lara.waterStatus == LW_ABOVE_WATER
|
||||||
|
@ -550,7 +552,7 @@ void LaraGun() // (F) (D)
|
||||||
#if 1
|
#if 1
|
||||||
if (CheckForHoldingState(LaraItem->currentAnimState))
|
if (CheckForHoldingState(LaraItem->currentAnimState))
|
||||||
#else
|
#else
|
||||||
if (g_LaraExtra.Vehicle != NO_ITEM || CheckForHoldingState(LaraItem->currentAnimState))
|
if (Lara.Vehicle != NO_ITEM || CheckForHoldingState(LaraItem->currentAnimState))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (Lara.flareControlLeft)
|
if (Lara.flareControlLeft)
|
||||||
|
@ -583,7 +585,7 @@ void LaraGun() // (F) (D)
|
||||||
if (CHECK_LARA_MESHES(ID_LARA_FLARE_ANIM, LM_LHAND))
|
if (CHECK_LARA_MESHES(ID_LARA_FLARE_ANIM, LM_LHAND))
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
Lara.flareControlLeft = (g_LaraExtra.Vehicle != NO_ITEM || CheckForHoldingState(LaraItem->currentAnimState));
|
Lara.flareControlLeft = (Lara.Vehicle != NO_ITEM || CheckForHoldingState(LaraItem->currentAnimState));
|
||||||
#else
|
#else
|
||||||
Lara.flareControlLeft = CheckForHoldingState(LaraItem->currentAnimState);
|
Lara.flareControlLeft = CheckForHoldingState(LaraItem->currentAnimState);
|
||||||
#endif
|
#endif
|
||||||
|
@ -597,7 +599,7 @@ void LaraGun() // (F) (D)
|
||||||
|
|
||||||
short* GetAmmo(int weaponType)
|
short* GetAmmo(int weaponType)
|
||||||
{
|
{
|
||||||
return &g_LaraExtra.Weapons[weaponType].Ammo[g_LaraExtra.Weapons[weaponType].SelectedAmmo];
|
return &Lara.Weapons[weaponType].Ammo[Lara.Weapons[weaponType].SelectedAmmo];
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitialiseNewWeapon()
|
void InitialiseNewWeapon()
|
||||||
|
@ -657,7 +659,7 @@ int WeaponObjectMesh(int weaponType)
|
||||||
switch (weaponType)
|
switch (weaponType)
|
||||||
{
|
{
|
||||||
case WEAPON_REVOLVER:
|
case WEAPON_REVOLVER:
|
||||||
return (g_LaraExtra.Weapons[WEAPON_REVOLVER].HasLasersight == true ? ID_LARA_REVOLVER_LASER : ID_REVOLVER_ANIM);
|
return (Lara.Weapons[WEAPON_REVOLVER].HasLasersight == true ? ID_LARA_REVOLVER_LASER : ID_REVOLVER_ANIM);
|
||||||
|
|
||||||
case WEAPON_UZI:
|
case WEAPON_UZI:
|
||||||
return ID_UZI_ANIM;
|
return ID_UZI_ANIM;
|
||||||
|
@ -669,7 +671,7 @@ int WeaponObjectMesh(int weaponType)
|
||||||
return ID_HK_ANIM;
|
return ID_HK_ANIM;
|
||||||
|
|
||||||
case WEAPON_CROSSBOW:
|
case WEAPON_CROSSBOW:
|
||||||
return (g_LaraExtra.Weapons[WEAPON_CROSSBOW].HasLasersight == true ? ID_LARA_CROSSBOW_LASER : ID_CROSSBOW_ANIM);
|
return (Lara.Weapons[WEAPON_CROSSBOW].HasLasersight == true ? ID_LARA_CROSSBOW_LASER : ID_CROSSBOW_ANIM);
|
||||||
|
|
||||||
case WEAPON_GRENADE_LAUNCHER:
|
case WEAPON_GRENADE_LAUNCHER:
|
||||||
return ID_GRENADE_ANIM;
|
return ID_GRENADE_ANIM;
|
||||||
|
@ -689,7 +691,7 @@ int WeaponObjectMesh(int weaponType)
|
||||||
void HitTarget(ITEM_INFO* item, GAME_VECTOR* hitPos, int damage, int flag)
|
void HitTarget(ITEM_INFO* item, GAME_VECTOR* hitPos, int damage, int flag)
|
||||||
{
|
{
|
||||||
CREATURE_INFO* creature = (CREATURE_INFO*)item->data;
|
CREATURE_INFO* creature = (CREATURE_INFO*)item->data;
|
||||||
OBJECT_INFO* obj = &Objects[item->objectNumber];
|
ObjectInfo* obj = &Objects[item->objectNumber];
|
||||||
|
|
||||||
item->hitStatus = true;
|
item->hitStatus = true;
|
||||||
if (creature && item != LaraItem)
|
if (creature && item != LaraItem)
|
||||||
|
@ -745,7 +747,7 @@ int FireWeapon(int weaponType, ITEM_INFO* target, ITEM_INFO* src, short* angles)
|
||||||
pos.xPos = 0;
|
pos.xPos = 0;
|
||||||
pos.yPos = 0;
|
pos.yPos = 0;
|
||||||
pos.zPos = 0;
|
pos.zPos = 0;
|
||||||
GetLaraJointPosition((PHD_VECTOR*)&pos, LJ_RHAND);
|
GetLaraJointPosition((PHD_VECTOR*)&pos, LM_RHAND);
|
||||||
|
|
||||||
pos.xPos = src->pos.xPos;
|
pos.xPos = src->pos.xPos;
|
||||||
pos.zPos = src->pos.zPos;
|
pos.zPos = src->pos.zPos;
|
||||||
|
@ -754,23 +756,30 @@ int FireWeapon(int weaponType, ITEM_INFO* target, ITEM_INFO* src, short* angles)
|
||||||
pos.yRot = angles[0] + (GetRandomControl() - 16384) * weapon->shotAccuracy / 65536;
|
pos.yRot = angles[0] + (GetRandomControl() - 16384) * weapon->shotAccuracy / 65536;
|
||||||
pos.zRot = 0;
|
pos.zRot = 0;
|
||||||
|
|
||||||
phd_GenerateW2V(&pos);
|
// Calculate ray from rotation angles
|
||||||
|
float x = sin(TO_RAD(pos.yRot)) * cos(TO_RAD(pos.xRot));
|
||||||
int num = GetSpheres(target, SphereList, 0);
|
float y = -sin(TO_RAD(pos.xRot));
|
||||||
|
float z = cos(TO_RAD(pos.yRot)) * cos(TO_RAD(pos.xRot));
|
||||||
|
Vector3 direction = Vector3(x, y, z);
|
||||||
|
direction.Normalize();
|
||||||
|
Vector3 source = Vector3(pos.xPos, pos.yPos, pos.zPos);
|
||||||
|
Vector3 destination = source + direction * 1024.0f;
|
||||||
|
Ray ray = Ray(source, direction);
|
||||||
|
|
||||||
|
int num = GetSpheres(target, CreatureSpheres, SPHERES_SPACE_WORLD, Matrix::Identity);
|
||||||
int best = -1;
|
int best = -1;
|
||||||
int bestDistance = 0x7FFFFFFF;
|
float bestDistance = FLT_MAX;
|
||||||
|
|
||||||
for (int i = 0; i < num; i++)
|
for (int i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
SPHERE* sphere = &SphereList[i];
|
BoundingSphere sphere = BoundingSphere(Vector3(CreatureSpheres[i].x, CreatureSpheres[i].y, CreatureSpheres[i].z), CreatureSpheres[i].r);
|
||||||
|
float distance;
|
||||||
r = sphere->r;
|
if (ray.Intersects(sphere, distance))
|
||||||
if ((abs(sphere->x)) < r && (abs(sphere->y)) < r && sphere->z > r && SQUARE(sphere->x) + SQUARE(sphere->y) <= SQUARE(r))
|
|
||||||
{
|
{
|
||||||
if (sphere->z - r < bestDistance)
|
if (distance < bestDistance)
|
||||||
{
|
{
|
||||||
bestDistance = sphere->z - r;
|
bestDistance = distance;
|
||||||
best = i;
|
best = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -790,9 +799,13 @@ int FireWeapon(int weaponType, ITEM_INFO* target, ITEM_INFO* src, short* angles)
|
||||||
if (best < 0)
|
if (best < 0)
|
||||||
{
|
{
|
||||||
GAME_VECTOR vDest;
|
GAME_VECTOR vDest;
|
||||||
vDest.x = vSrc.x + (MatrixPtr[M20] * 5 >> 2);
|
/*vDest.x = vSrc.x + (MatrixPtr[M20] * 5 >> 2);
|
||||||
vDest.y = vSrc.y + (MatrixPtr[M21] * 5 >> 2);
|
vDest.y = vSrc.y + (MatrixPtr[M21] * 5 >> 2);
|
||||||
vDest.z = vSrc.z + (MatrixPtr[M22] * 5 >> 2);
|
vDest.z = vSrc.z + (MatrixPtr[M22] * 5 >> 2);*/
|
||||||
|
|
||||||
|
vDest.x = destination.x;
|
||||||
|
vDest.y = destination.y;
|
||||||
|
vDest.z = destination.z;
|
||||||
|
|
||||||
GetTargetOnLOS(&vSrc, &vDest, 0, 1);
|
GetTargetOnLOS(&vSrc, &vDest, 0, 1);
|
||||||
|
|
||||||
|
@ -803,9 +816,12 @@ int FireWeapon(int weaponType, ITEM_INFO* target, ITEM_INFO* src, short* angles)
|
||||||
Savegame.Game.AmmoHits++;
|
Savegame.Game.AmmoHits++;
|
||||||
|
|
||||||
GAME_VECTOR vDest;
|
GAME_VECTOR vDest;
|
||||||
vDest.x = vSrc.x + ((MatrixPtr[M20] * bestDistance) >> W2V_SHIFT);
|
|
||||||
vDest.y = vSrc.y + ((MatrixPtr[M21] * bestDistance) >> W2V_SHIFT);
|
destination = source + direction * bestDistance;
|
||||||
vDest.z = vSrc.z + ((MatrixPtr[M22] * bestDistance) >> W2V_SHIFT);
|
|
||||||
|
vDest.x = destination.x;
|
||||||
|
vDest.y = destination.y;
|
||||||
|
vDest.z = destination.z;
|
||||||
|
|
||||||
// TODO: enable it when the slot is created !
|
// TODO: enable it when the slot is created !
|
||||||
/*
|
/*
|
||||||
|
@ -831,7 +847,7 @@ int FireWeapon(int weaponType, ITEM_INFO* target, ITEM_INFO* src, short* angles)
|
||||||
{
|
{
|
||||||
z = target->pos.zPos - lara_item->pos.zPos;
|
z = target->pos.zPos - lara_item->pos.zPos;
|
||||||
x = target->pos.xPos - lara_item->pos.xPos;
|
x = target->pos.xPos - lara_item->pos.xPos;
|
||||||
angle = 0x8000 + ATAN(z, x) - target->pos.yRot;
|
angle = 0x8000 + phd_atan(z, x) - target->pos.yRot;
|
||||||
|
|
||||||
if ((target->currentAnimState > 1 && target->currentAnimState < 5) && angle < 0x4000 && angle > -0x4000)
|
if ((target->currentAnimState > 1 && target->currentAnimState < 5) && angle < 0x4000 && angle > -0x4000)
|
||||||
{
|
{
|
||||||
|
@ -861,8 +877,8 @@ void find_target_point(ITEM_INFO* item, GAME_VECTOR* target) // (F) (D)
|
||||||
int y = bounds->MinY + (bounds->MaxY - bounds->MinY) / 3;
|
int y = bounds->MinY + (bounds->MaxY - bounds->MinY) / 3;
|
||||||
int z = (bounds->MinZ + bounds->MaxZ) / 2;
|
int z = (bounds->MinZ + bounds->MaxZ) / 2;
|
||||||
|
|
||||||
int c = COS(item->pos.yRot);
|
int c = phd_cos(item->pos.yRot);
|
||||||
int s = SIN(item->pos.yRot);
|
int s = phd_sin(item->pos.yRot);
|
||||||
|
|
||||||
target->x = item->pos.xPos + ((c * x + s * z) >> W2V_SHIFT);
|
target->x = item->pos.xPos + ((c * x + s * z) >> W2V_SHIFT);
|
||||||
target->y = item->pos.yPos + y;
|
target->y = item->pos.yPos + y;
|
||||||
|
@ -887,7 +903,7 @@ void LaraTargetInfo(WEAPON_INFO* weapon) // (F) (D)
|
||||||
pos.x = 0;
|
pos.x = 0;
|
||||||
pos.y = 0;
|
pos.y = 0;
|
||||||
pos.z = 0;
|
pos.z = 0;
|
||||||
GetLaraJointPosition((PHD_VECTOR*)&pos, LJ_RHAND);
|
GetLaraJointPosition((PHD_VECTOR*)&pos, LM_RHAND);
|
||||||
|
|
||||||
pos.x = LaraItem->pos.xPos;
|
pos.x = LaraItem->pos.xPos;
|
||||||
pos.z = LaraItem->pos.zPos;
|
pos.z = LaraItem->pos.zPos;
|
||||||
|
@ -948,7 +964,7 @@ int CheckForHoldingState(int state) // (F) (D)
|
||||||
short* holdState = HoldStates;
|
short* holdState = HoldStates;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (g_LaraExtra.ExtraAnim)
|
if (Lara.ExtraAnim)
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1083,13 +1099,500 @@ void LaraGetNewTarget(WEAPON_INFO* winfo) // (F) (D)
|
||||||
LaraTargetInfo(winfo);
|
LaraTargetInfo(winfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inject_LaraFire()
|
void DoProperDetection(short itemNumber, int x, int y, int z, int xv, int yv, int zv)
|
||||||
{
|
{
|
||||||
INJECT(0x00453490, AimWeapon);
|
int ceiling, height, oldtype, oldonobj, oldheight;
|
||||||
INJECT(0x00453AE0, WeaponObject);
|
int bs, yang;
|
||||||
INJECT(0x00452430, LaraGun);
|
|
||||||
INJECT(0x004546C0, GetAmmo);
|
ITEM_INFO* item = &Items[itemNumber];
|
||||||
INJECT(0x00452B30, InitialiseNewWeapon);
|
|
||||||
INJECT(0x00453B50, WeaponObjectMesh);
|
short roomNumber = item->roomNumber;
|
||||||
//INJECT(0x00453A90, SmashItem);
|
FLOOR_INFO* floor = GetFloor(x, y, z, &roomNumber);
|
||||||
|
oldheight = GetFloorHeight(floor, x, y, z);
|
||||||
|
oldonobj = OnObject;
|
||||||
|
oldtype = HeightType;
|
||||||
|
|
||||||
|
roomNumber = item->roomNumber;
|
||||||
|
floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber);
|
||||||
|
height = GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos);
|
||||||
|
if (item->pos.yPos >= height)
|
||||||
|
{
|
||||||
|
bs = 0;
|
||||||
|
|
||||||
|
if ((HeightType == BIG_SLOPE || HeightType == DIAGONAL) && oldheight < height)
|
||||||
|
{
|
||||||
|
yang = (long)((unsigned short)item->pos.yRot);
|
||||||
|
if (TiltYOffset < 0)
|
||||||
|
{
|
||||||
|
if (yang >= 0x8000)
|
||||||
|
bs = 1;
|
||||||
|
}
|
||||||
|
else if (TiltYOffset > 0)
|
||||||
|
{
|
||||||
|
if (yang <= 0x8000)
|
||||||
|
bs = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TiltXOffset < 0)
|
||||||
|
{
|
||||||
|
if (yang >= 0x4000 && yang <= 0xc000)
|
||||||
|
bs = 1;
|
||||||
|
}
|
||||||
|
else if (TiltXOffset > 0)
|
||||||
|
{
|
||||||
|
if (yang <= 0x4000 || yang >= 0xc000)
|
||||||
|
bs = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If last position of item was also below this floor height, we've hit a wall, else we've hit a floor */
|
||||||
|
|
||||||
|
if (y > (height + 32) && bs == 0 &&
|
||||||
|
(((x >> WALL_SHIFT) != (item->pos.xPos >> WALL_SHIFT)) ||
|
||||||
|
((z >> WALL_SHIFT) != (item->pos.zPos >> WALL_SHIFT))))
|
||||||
|
{
|
||||||
|
// Need to know which direction the wall is.
|
||||||
|
|
||||||
|
long xs;
|
||||||
|
|
||||||
|
if ((x & (~(WALL_SIZE - 1))) != (item->pos.xPos & (~(WALL_SIZE - 1))) && // X crossed boundary?
|
||||||
|
(z & (~(WALL_SIZE - 1))) != (item->pos.zPos & (~(WALL_SIZE - 1)))) // Z crossed boundary as well?
|
||||||
|
{
|
||||||
|
if (abs(x - item->pos.xPos) < abs(z - item->pos.zPos))
|
||||||
|
xs = 1; // X has travelled the shortest, so (maybe) hit first. (Seems to work ok).
|
||||||
|
else
|
||||||
|
xs = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
xs = 1;
|
||||||
|
|
||||||
|
if ((x & (~(WALL_SIZE - 1))) != (item->pos.xPos & (~(WALL_SIZE - 1))) && xs) // X crossed boundary?
|
||||||
|
{
|
||||||
|
if (xv <= 0) // Hit angle = 0xc000.
|
||||||
|
item->pos.yRot = 0x4000 + (0xc000 - item->pos.yRot);
|
||||||
|
else // Hit angle = 0x4000.
|
||||||
|
item->pos.yRot = 0xc000 + (0x4000 - item->pos.yRot);
|
||||||
|
}
|
||||||
|
else // Z crossed boundary.
|
||||||
|
item->pos.yRot = 0x8000 - item->pos.yRot;
|
||||||
|
|
||||||
|
item->speed >>= 1;
|
||||||
|
|
||||||
|
/* Put item back in its last position */
|
||||||
|
item->pos.xPos = x;
|
||||||
|
item->pos.yPos = y;
|
||||||
|
item->pos.zPos = z;
|
||||||
|
}
|
||||||
|
else if (HeightType == BIG_SLOPE || HeightType == DIAGONAL) // Hit a steep slope?
|
||||||
|
{
|
||||||
|
// Need to know which direction the slope is.
|
||||||
|
|
||||||
|
item->speed -= item->speed >> 2;
|
||||||
|
|
||||||
|
if (TiltYOffset < 0 && ((abs(TiltYOffset)) - (abs(TiltXOffset)) >= 2)) // Hit angle = 0x4000
|
||||||
|
{
|
||||||
|
if (((unsigned short)item->pos.yRot) > 0x8000)
|
||||||
|
{
|
||||||
|
item->pos.yRot = 0x4000 + (0xc000 - (unsigned short)item->pos.yRot - 1);
|
||||||
|
if (item->fallspeed > 0)
|
||||||
|
item->fallspeed = -(item->fallspeed >> 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (item->speed < 32)
|
||||||
|
{
|
||||||
|
item->speed -= TiltYOffset << 1;
|
||||||
|
if ((unsigned short)item->pos.yRot > 0x4000 && (unsigned short)item->pos.yRot < 0xc000)
|
||||||
|
{
|
||||||
|
item->pos.yRot -= 4096;
|
||||||
|
if ((unsigned short)item->pos.yRot < 0x4000)
|
||||||
|
item->pos.yRot = 0x4000;
|
||||||
|
}
|
||||||
|
else if ((unsigned short)item->pos.yRot < 0x4000)
|
||||||
|
{
|
||||||
|
item->pos.yRot += 4096;
|
||||||
|
if ((unsigned short)item->pos.yRot > 0x4000)
|
||||||
|
item->pos.yRot = 0x4000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item->fallspeed > 0)
|
||||||
|
item->fallspeed = -(item->fallspeed >> 1);
|
||||||
|
else
|
||||||
|
item->fallspeed = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (TiltYOffset > 0 && ((abs(TiltYOffset)) - (abs(TiltXOffset)) >= 2)) // Hit angle = 0xc000
|
||||||
|
{
|
||||||
|
if (((unsigned short)item->pos.yRot) < 0x8000)
|
||||||
|
{
|
||||||
|
item->pos.yRot = 0xc000 + (0x4000 - (unsigned short)item->pos.yRot - 1);
|
||||||
|
if (item->fallspeed > 0)
|
||||||
|
item->fallspeed = -(item->fallspeed >> 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (item->speed < 32)
|
||||||
|
{
|
||||||
|
item->speed += TiltYOffset << 1;
|
||||||
|
if ((unsigned short)item->pos.yRot > 0xc000 || (unsigned short)item->pos.yRot < 0x4000)
|
||||||
|
{
|
||||||
|
item->pos.yRot -= 4096;
|
||||||
|
if ((unsigned short)item->pos.yRot < 0xc000)
|
||||||
|
item->pos.yRot = 0xc000;
|
||||||
|
}
|
||||||
|
else if ((unsigned short)item->pos.yRot < 0xc000)
|
||||||
|
{
|
||||||
|
item->pos.yRot += 4096;
|
||||||
|
if ((unsigned short)item->pos.yRot > 0xc000)
|
||||||
|
item->pos.yRot = 0xc000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item->fallspeed > 0)
|
||||||
|
item->fallspeed = -(item->fallspeed >> 1);
|
||||||
|
else
|
||||||
|
item->fallspeed = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (TiltXOffset < 0 && ((abs(TiltXOffset)) - (abs(TiltYOffset)) >= 2)) // Hit angle = 0
|
||||||
|
{
|
||||||
|
if (((unsigned short)item->pos.yRot) > 0x4000 && ((unsigned short)item->pos.yRot) < 0xc000)
|
||||||
|
{
|
||||||
|
item->pos.yRot = (0x8000 - item->pos.yRot - 1);
|
||||||
|
if (item->fallspeed > 0)
|
||||||
|
item->fallspeed = -(item->fallspeed >> 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (item->speed < 32)
|
||||||
|
{
|
||||||
|
item->speed -= TiltXOffset << 1;
|
||||||
|
|
||||||
|
if ((unsigned short)item->pos.yRot < 0x8000)
|
||||||
|
{
|
||||||
|
item->pos.yRot -= 4096;
|
||||||
|
if ((unsigned short)item->pos.yRot > 0xf000)
|
||||||
|
item->pos.yRot = 0;
|
||||||
|
}
|
||||||
|
else if ((unsigned short)item->pos.yRot >= 0x8000)
|
||||||
|
{
|
||||||
|
item->pos.yRot += 4096;
|
||||||
|
if ((unsigned short)item->pos.yRot < 0x1000)
|
||||||
|
item->pos.yRot = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item->fallspeed > 0)
|
||||||
|
item->fallspeed = -(item->fallspeed >> 1);
|
||||||
|
else
|
||||||
|
item->fallspeed = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (TiltXOffset > 0 && ((abs(TiltXOffset)) - (abs(TiltYOffset)) >= 2)) // Hit angle = 0x8000
|
||||||
|
{
|
||||||
|
if (((unsigned short)item->pos.yRot) > 0xc000 || ((unsigned short)item->pos.yRot) < 0x4000)
|
||||||
|
{
|
||||||
|
item->pos.yRot = (0x8000 - item->pos.yRot - 1);
|
||||||
|
if (item->fallspeed > 0)
|
||||||
|
item->fallspeed = -(item->fallspeed >> 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (item->speed < 32)
|
||||||
|
{
|
||||||
|
item->speed += TiltXOffset << 1;
|
||||||
|
|
||||||
|
if ((unsigned short)item->pos.yRot > 0x8000)
|
||||||
|
{
|
||||||
|
item->pos.yRot -= 4096;
|
||||||
|
if ((unsigned short)item->pos.yRot < 0x8000)
|
||||||
|
item->pos.yRot = 0x8000;
|
||||||
|
}
|
||||||
|
else if ((unsigned short)item->pos.yRot < 0x8000)
|
||||||
|
{
|
||||||
|
item->pos.yRot += 4096;
|
||||||
|
if ((unsigned short)item->pos.yRot > 0x8000)
|
||||||
|
item->pos.yRot = 0x8000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item->fallspeed > 0)
|
||||||
|
item->fallspeed = -(item->fallspeed >> 1);
|
||||||
|
else
|
||||||
|
item->fallspeed = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (TiltYOffset < 0 && TiltXOffset < 0) // Hit angle = 0x2000
|
||||||
|
{
|
||||||
|
if (((unsigned short)item->pos.yRot) > 0x6000 && ((unsigned short)item->pos.yRot) < 0xe000)
|
||||||
|
{
|
||||||
|
item->pos.yRot = 0x2000 + (0xa000 - (unsigned short)item->pos.yRot - 1);
|
||||||
|
if (item->fallspeed > 0)
|
||||||
|
item->fallspeed = -(item->fallspeed >> 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (item->speed < 32)
|
||||||
|
{
|
||||||
|
item->speed += (-TiltYOffset) + (-TiltXOffset);
|
||||||
|
if ((unsigned short)item->pos.yRot > 0x2000 && (unsigned short)item->pos.yRot < 0xa000)
|
||||||
|
{
|
||||||
|
item->pos.yRot -= 4096;
|
||||||
|
if ((unsigned short)item->pos.yRot < 0x2000)
|
||||||
|
item->pos.yRot = 0x2000;
|
||||||
|
}
|
||||||
|
else if ((unsigned short)item->pos.yRot != 0x2000)
|
||||||
|
{
|
||||||
|
item->pos.yRot += 4096;
|
||||||
|
if ((unsigned short)item->pos.yRot > 0x2000)
|
||||||
|
item->pos.yRot = 0x2000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item->fallspeed > 0)
|
||||||
|
item->fallspeed = -(item->fallspeed >> 1);
|
||||||
|
else
|
||||||
|
item->fallspeed = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (TiltYOffset < 0 && TiltXOffset > 0) // Hit angle = 0x6000
|
||||||
|
{
|
||||||
|
if (((unsigned short)item->pos.yRot) > 0xa000 || ((unsigned short)item->pos.yRot) < 0x2000)
|
||||||
|
{
|
||||||
|
item->pos.yRot = 0x6000 + (0xe000 - (unsigned short)item->pos.yRot - 1);
|
||||||
|
if (item->fallspeed > 0)
|
||||||
|
item->fallspeed = -(item->fallspeed >> 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (item->speed < 32)
|
||||||
|
{
|
||||||
|
item->speed += (-TiltYOffset) + TiltXOffset;
|
||||||
|
if ((unsigned short)item->pos.yRot < 0xe000 && (unsigned short)item->pos.yRot > 0x6000)
|
||||||
|
{
|
||||||
|
item->pos.yRot -= 4096;
|
||||||
|
if ((unsigned short)item->pos.yRot < 0x6000)
|
||||||
|
item->pos.yRot = 0x6000;
|
||||||
|
}
|
||||||
|
else if ((unsigned short)item->pos.yRot != 0x6000)
|
||||||
|
{
|
||||||
|
item->pos.yRot += 4096;
|
||||||
|
if ((unsigned short)item->pos.yRot > 0x6000)
|
||||||
|
item->pos.yRot = 0x6000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item->fallspeed > 0)
|
||||||
|
item->fallspeed = -(item->fallspeed >> 1);
|
||||||
|
else
|
||||||
|
item->fallspeed = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (TiltYOffset > 0 && TiltXOffset > 0) // Hit angle = 0xa000
|
||||||
|
{
|
||||||
|
if (((unsigned short)item->pos.yRot) > 0xe000 || ((unsigned short)item->pos.yRot) < 0x6000)
|
||||||
|
{
|
||||||
|
item->pos.yRot = 0xa000 + (0x2000 - (unsigned short)item->pos.yRot - 1);
|
||||||
|
if (item->fallspeed > 0)
|
||||||
|
item->fallspeed = -(item->fallspeed >> 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (item->speed < 32)
|
||||||
|
{
|
||||||
|
item->speed += TiltYOffset + TiltXOffset;
|
||||||
|
if ((unsigned short)item->pos.yRot < 0x2000 || (unsigned short)item->pos.yRot > 0xa000)
|
||||||
|
{
|
||||||
|
item->pos.yRot -= 4096;
|
||||||
|
if ((unsigned short)item->pos.yRot < 0xa000)
|
||||||
|
item->pos.yRot = 0xa000;
|
||||||
|
}
|
||||||
|
else if ((unsigned short)item->pos.yRot != 0xa000)
|
||||||
|
{
|
||||||
|
item->pos.yRot += 4096;
|
||||||
|
if ((unsigned short)item->pos.yRot > 0xa000)
|
||||||
|
item->pos.yRot = 0xa000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item->fallspeed > 0)
|
||||||
|
item->fallspeed = -(item->fallspeed >> 1);
|
||||||
|
else
|
||||||
|
item->fallspeed = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (TiltYOffset > 0 && TiltXOffset < 0) // Hit angle = 0xe000
|
||||||
|
{
|
||||||
|
if (((unsigned short)item->pos.yRot) > 0x2000 && ((unsigned short)item->pos.yRot) < 0xa000)
|
||||||
|
{
|
||||||
|
item->pos.yRot = 0xe000 + (0x6000 - (unsigned short)item->pos.yRot - 1);
|
||||||
|
if (item->fallspeed > 0)
|
||||||
|
item->fallspeed = -(item->fallspeed >> 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (item->speed < 32)
|
||||||
|
{
|
||||||
|
item->speed += TiltYOffset + (-TiltXOffset);
|
||||||
|
if ((unsigned short)item->pos.yRot < 0x6000 || (unsigned short)item->pos.yRot > 0xe000)
|
||||||
|
{
|
||||||
|
item->pos.yRot -= 4096;
|
||||||
|
if ((unsigned short)item->pos.yRot < 0xe000)
|
||||||
|
item->pos.yRot = 0xe000;
|
||||||
|
}
|
||||||
|
else if ((unsigned short)item->pos.yRot != 0xe000)
|
||||||
|
{
|
||||||
|
item->pos.yRot += 4096;
|
||||||
|
if ((unsigned short)item->pos.yRot > 0xe000)
|
||||||
|
item->pos.yRot = 0xe000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item->fallspeed > 0)
|
||||||
|
item->fallspeed = -(item->fallspeed >> 1);
|
||||||
|
else
|
||||||
|
item->fallspeed = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Put item back in its last position */
|
||||||
|
item->pos.xPos = x;
|
||||||
|
item->pos.yPos = y;
|
||||||
|
item->pos.zPos = z;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Hit the floor; bounce and slow down */
|
||||||
|
if (item->fallspeed > 0)
|
||||||
|
{
|
||||||
|
if (item->fallspeed > 16)
|
||||||
|
{
|
||||||
|
if (item->objectNumber == ID_GRENADE)
|
||||||
|
item->fallspeed = -(item->fallspeed - (item->fallspeed >> 1));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
item->fallspeed = -(item->fallspeed >> 2);
|
||||||
|
if (item->fallspeed < -100)
|
||||||
|
item->fallspeed = -100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Roll on floor */
|
||||||
|
item->fallspeed = 0;
|
||||||
|
if (item->objectNumber == ID_GRENADE)
|
||||||
|
{
|
||||||
|
item->requiredAnimState = 1;
|
||||||
|
item->pos.xRot = 0;
|
||||||
|
item->speed--;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
item->speed -= 3;
|
||||||
|
|
||||||
|
if (item->speed < 0)
|
||||||
|
item->speed = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
item->pos.yPos = height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // Check for on top of object.
|
||||||
|
{
|
||||||
|
if (yv >= 0)
|
||||||
|
{
|
||||||
|
roomNumber = item->roomNumber;
|
||||||
|
floor = GetFloor(item->pos.xPos, y, item->pos.zPos, &roomNumber);
|
||||||
|
oldheight = GetFloorHeight(floor, item->pos.xPos, y, item->pos.zPos);
|
||||||
|
oldonobj = OnObject;
|
||||||
|
roomNumber = item->roomNumber;
|
||||||
|
floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber);
|
||||||
|
GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos);
|
||||||
|
|
||||||
|
/* Bounce off floor */
|
||||||
|
if (item->pos.yPos >= oldheight && oldonobj) // If old and new pos above object then detect.
|
||||||
|
{
|
||||||
|
/* Hit the floor; bounce and slow down */
|
||||||
|
if (item->fallspeed > 0)
|
||||||
|
{
|
||||||
|
if (item->fallspeed > 16)
|
||||||
|
{
|
||||||
|
if (item->objectNumber == ID_GRENADE)
|
||||||
|
item->fallspeed = -(item->fallspeed - (item->fallspeed >> 1));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
item->fallspeed = -(item->fallspeed >> 2);
|
||||||
|
if (item->fallspeed < -100)
|
||||||
|
item->fallspeed = -100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Roll on floor */
|
||||||
|
item->fallspeed = 0;
|
||||||
|
if (item->objectNumber == ID_GRENADE)
|
||||||
|
{
|
||||||
|
item->requiredAnimState = 1;
|
||||||
|
item->pos.xRot = 0;
|
||||||
|
item->speed--;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
item->speed -= 3;
|
||||||
|
|
||||||
|
if (item->speed < 0)
|
||||||
|
item->speed = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
item->pos.yPos = oldheight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// else
|
||||||
|
{
|
||||||
|
/* Bounce off ceiling */
|
||||||
|
roomNumber = item->roomNumber;
|
||||||
|
floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber);
|
||||||
|
ceiling = GetCeiling(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos);
|
||||||
|
if (item->pos.yPos < ceiling)
|
||||||
|
{
|
||||||
|
if (y < ceiling &&
|
||||||
|
(((x >> WALL_SHIFT) != (item->pos.xPos >> WALL_SHIFT)) ||
|
||||||
|
((z >> WALL_SHIFT) != (item->pos.zPos >> WALL_SHIFT))))
|
||||||
|
{
|
||||||
|
// Need to know which direction the wall is.
|
||||||
|
|
||||||
|
if ((x & (~(WALL_SIZE - 1))) != (item->pos.xPos & (~(WALL_SIZE - 1)))) // X crossed boundary?
|
||||||
|
{
|
||||||
|
if (xv <= 0) // Hit angle = 0xc000.
|
||||||
|
item->pos.yRot = 0x4000 + (0xc000 - item->pos.yRot);
|
||||||
|
else // Hit angle = 0x4000.
|
||||||
|
item->pos.yRot = 0xc000 + (0x4000 - item->pos.yRot);
|
||||||
|
}
|
||||||
|
else // Z crossed boundary.
|
||||||
|
{
|
||||||
|
item->pos.yRot = 0x8000 - item->pos.yRot;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item->objectNumber == ID_GRENADE)
|
||||||
|
item->speed -= item->speed >> 3;
|
||||||
|
else
|
||||||
|
item->speed >>= 1;
|
||||||
|
|
||||||
|
/* Put item back in its last position */
|
||||||
|
item->pos.xPos = x;
|
||||||
|
item->pos.yPos = y;
|
||||||
|
item->pos.zPos = z;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
item->pos.yPos = ceiling;
|
||||||
|
|
||||||
|
if (item->fallspeed < 0)
|
||||||
|
item->fallspeed = -item->fallspeed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
roomNumber = item->roomNumber;
|
||||||
|
floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNumber);
|
||||||
|
if (roomNumber != item->roomNumber)
|
||||||
|
ItemNewRoom(itemNumber, roomNumber);
|
||||||
}
|
}
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
#include "..\Global\global.h"
|
#include "..\Global\global.h"
|
||||||
|
|
||||||
#define DoProperDetection ((void (__cdecl*)(short, int, int, int, int, int, int)) 0x00453BE0)
|
|
||||||
|
|
||||||
extern WEAPON_INFO Weapons[NUM_WEAPONS];
|
extern WEAPON_INFO Weapons[NUM_WEAPONS];
|
||||||
|
|
||||||
void SmashItem(short itemNum);
|
void SmashItem(short itemNum);
|
||||||
|
@ -19,5 +17,4 @@ void find_target_point(ITEM_INFO* item, GAME_VECTOR* target);
|
||||||
void LaraTargetInfo(WEAPON_INFO* weapon);
|
void LaraTargetInfo(WEAPON_INFO* weapon);
|
||||||
int CheckForHoldingState(int state);
|
int CheckForHoldingState(int state);
|
||||||
void LaraGetNewTarget(WEAPON_INFO* winfo);
|
void LaraGetNewTarget(WEAPON_INFO* winfo);
|
||||||
|
void DoProperDetection(short itemNumber, int x, int y, int z, int xv, int yv, int zv);
|
||||||
void Inject_LaraFire();
|
|
|
@ -1,8 +1,9 @@
|
||||||
#include "laraflar.h"
|
#include "laraflar.h"
|
||||||
|
|
||||||
#include "..\Global\global.h"
|
#include "..\Global\global.h"
|
||||||
#include "..\Specific\roomload.h"
|
#include "..\Specific\level.h"
|
||||||
#include "..\Specific\setup.h"
|
#include "..\Specific\setup.h"
|
||||||
|
#include "sound.h"
|
||||||
|
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
#include "items.h"
|
#include "items.h"
|
||||||
|
@ -12,19 +13,15 @@
|
||||||
#include "collide.h"
|
#include "collide.h"
|
||||||
#include "effect2.h"
|
#include "effect2.h"
|
||||||
|
|
||||||
extern LaraExtraInfo g_LaraExtra;
|
|
||||||
|
|
||||||
void FlareControl(short itemNumber) // (AF) (D)
|
void FlareControl(short itemNumber) // (AF) (D)
|
||||||
{
|
{
|
||||||
ITEM_INFO* item = &Items[itemNumber];
|
ITEM_INFO* item = &Items[itemNumber];
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP)
|
if (Rooms[item->roomNumber].flags & ENV_FLAG_SWAMP)
|
||||||
{
|
{
|
||||||
KillItem(itemNumber);
|
KillItem(itemNumber);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (item->fallspeed)
|
if (item->fallspeed)
|
||||||
{
|
{
|
||||||
|
@ -41,8 +38,8 @@ void FlareControl(short itemNumber) // (AF) (D)
|
||||||
int oldY = item->pos.yPos;
|
int oldY = item->pos.yPos;
|
||||||
int oldZ = item->pos.zPos;
|
int oldZ = item->pos.zPos;
|
||||||
|
|
||||||
int xv = item->speed * SIN(item->pos.yRot) >> W2V_SHIFT;
|
int xv = item->speed * phd_sin(item->pos.yRot) >> W2V_SHIFT;
|
||||||
int zv = item->speed * COS(item->pos.yRot) >> W2V_SHIFT;
|
int zv = item->speed * phd_cos(item->pos.yRot) >> W2V_SHIFT;
|
||||||
|
|
||||||
item->pos.xPos += xv;
|
item->pos.xPos += xv;
|
||||||
item->pos.zPos += zv;
|
item->pos.zPos += zv;
|
||||||
|
@ -117,7 +114,7 @@ void undraw_flare() // (F) (D)
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (LaraItem->goalAnimState == STATE_LARA_STOP &&
|
if (LaraItem->goalAnimState == STATE_LARA_STOP &&
|
||||||
g_LaraExtra.Vehicle == NO_ITEM)
|
Lara.Vehicle == NO_ITEM)
|
||||||
#else
|
#else
|
||||||
if (LaraItem->goalAnimState == STATE_LARA_STOP)
|
if (LaraItem->goalAnimState == STATE_LARA_STOP)
|
||||||
#endif
|
#endif
|
||||||
|
@ -314,7 +311,7 @@ void CreateFlare(short objectNum, int thrown) // (F) (D)
|
||||||
pos.y = 32;
|
pos.y = 32;
|
||||||
pos.z = 42;
|
pos.z = 42;
|
||||||
|
|
||||||
GetLaraJointPosition(&pos, LJ_LHAND);
|
GetLaraJointPosition(&pos, LM_LHAND);
|
||||||
|
|
||||||
item->pos.xPos = pos.x;
|
item->pos.xPos = pos.x;
|
||||||
item->pos.yPos = pos.y;
|
item->pos.yPos = pos.y;
|
||||||
|
@ -327,8 +324,8 @@ void CreateFlare(short objectNum, int thrown) // (F) (D)
|
||||||
{
|
{
|
||||||
flag = true;
|
flag = true;
|
||||||
item->pos.yRot = LaraItem->pos.yRot + ANGLE(180);
|
item->pos.yRot = LaraItem->pos.yRot + ANGLE(180);
|
||||||
item->pos.xPos = LaraItem->pos.xPos + (320 * SIN(item->pos.yRot) >> W2V_SHIFT);
|
item->pos.xPos = LaraItem->pos.xPos + (320 * phd_sin(item->pos.yRot) >> W2V_SHIFT);
|
||||||
item->pos.zPos = LaraItem->pos.zPos + (320 * COS(item->pos.yRot) >> W2V_SHIFT);
|
item->pos.zPos = LaraItem->pos.zPos + (320 * phd_cos(item->pos.yRot) >> W2V_SHIFT);
|
||||||
item->roomNumber = LaraItem->roomNumber;
|
item->roomNumber = LaraItem->roomNumber;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -385,7 +382,7 @@ void DoFlareInHand(int flare_age) // (AF) (D)
|
||||||
pos.y = 32;
|
pos.y = 32;
|
||||||
pos.z = 41;
|
pos.z = 41;
|
||||||
|
|
||||||
GetLaraJointPosition(&pos, LJ_LHAND);
|
GetLaraJointPosition(&pos, LM_LHAND);
|
||||||
DoFlareLight(&pos, flare_age);
|
DoFlareLight(&pos, flare_age);
|
||||||
|
|
||||||
/* Hardcoded code */
|
/* Hardcoded code */
|
||||||
|
@ -475,8 +472,3 @@ int DoFlareLight(PHD_VECTOR* pos, int age)//49708, 49B6C (F)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inject_LaraFlar()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -12,5 +12,3 @@ void CreateFlare(short object, int thrown);
|
||||||
void DrawFlareInAir(ITEM_INFO* item);
|
void DrawFlareInAir(ITEM_INFO* item);
|
||||||
void DoFlareInHand(int flare_age);
|
void DoFlareInHand(int flare_age);
|
||||||
int DoFlareLight(PHD_VECTOR* pos, int flare_age);
|
int DoFlareLight(PHD_VECTOR* pos, int flare_age);
|
||||||
|
|
||||||
void Inject_LaraFlar();
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "laramisc.h"
|
#include "laramisc.h"
|
||||||
#include "..\Global\global.h"
|
#include "..\Global\global.h"
|
||||||
#include "..\Specific\roomload.h"
|
#include "..\Specific\level.h"
|
||||||
#include "../Specific/setup.h"
|
#include "../Specific/setup.h"
|
||||||
#include "..\Scripting\GameFlowScript.h"
|
#include "..\Scripting\GameFlowScript.h"
|
||||||
#include "effects.h"
|
#include "effects.h"
|
||||||
|
@ -12,11 +12,15 @@
|
||||||
#include "healt.h"
|
#include "healt.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "rope.h"
|
#include "rope.h"
|
||||||
|
#include "rope.h"
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
|
#include "savegame.h"
|
||||||
#include "inventory.h"
|
#include "inventory.h"
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
|
#include "../Specific/input.h"
|
||||||
|
#include "sound.h"
|
||||||
|
|
||||||
|
|
||||||
extern LaraExtraInfo g_LaraExtra;
|
|
||||||
extern GameFlow* g_GameFlow;
|
extern GameFlow* g_GameFlow;
|
||||||
extern void(*effect_routines[59])(ITEM_INFO* item);
|
extern void(*effect_routines[59])(ITEM_INFO* item);
|
||||||
extern short FXType;
|
extern short FXType;
|
||||||
|
@ -31,11 +35,7 @@ void GetLaraDeadlyBounds() // (F) (D)
|
||||||
short tbounds[6];
|
short tbounds[6];
|
||||||
|
|
||||||
bounds = GetBoundsAccurate(LaraItem);
|
bounds = GetBoundsAccurate(LaraItem);
|
||||||
phd_PushUnitMatrix();
|
phd_RotBoundingBoxNoPersp(&LaraItem->pos, bounds, tbounds);
|
||||||
phd_RotYXZ(LaraItem->pos.yRot, LaraItem->pos.xRot, LaraItem->pos.zRot);
|
|
||||||
phd_SetTrans(0, 0, 0);
|
|
||||||
phd_RotBoundingBoxNoPersp(bounds, tbounds);
|
|
||||||
phd_PopMatrix();
|
|
||||||
|
|
||||||
DeadlyBounds[0] = LaraItem->pos.xPos + tbounds[0];
|
DeadlyBounds[0] = LaraItem->pos.xPos + tbounds[0];
|
||||||
DeadlyBounds[1] = LaraItem->pos.xPos + tbounds[1];
|
DeadlyBounds[1] = LaraItem->pos.xPos + tbounds[1];
|
||||||
|
@ -77,27 +77,27 @@ void DelsGiveLaraItemsCheat() // (AF) (D)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (Objects[ID_CROWBAR_ITEM].loaded)
|
if (Objects[ID_CROWBAR_ITEM].loaded)
|
||||||
g_LaraExtra.Crowbar = true;
|
Lara.Crowbar = true;
|
||||||
for (i = 0; i < 8; ++i)
|
for (i = 0; i < 8; ++i)
|
||||||
{
|
{
|
||||||
if (Objects[ID_PUZZLE_ITEM1 + i].loaded)
|
if (Objects[ID_PUZZLE_ITEM1 + i].loaded)
|
||||||
g_LaraExtra.Puzzles[i] = 1;
|
Lara.Puzzles[i] = 1;
|
||||||
g_LaraExtra.PuzzlesCombo[2 * i] = false;
|
Lara.PuzzlesCombo[2 * i] = false;
|
||||||
g_LaraExtra.PuzzlesCombo[2 * i + 1] = false;
|
Lara.PuzzlesCombo[2 * i + 1] = false;
|
||||||
}
|
}
|
||||||
for (i = 0; i < 8; ++i)
|
for (i = 0; i < 8; ++i)
|
||||||
{
|
{
|
||||||
if (Objects[ID_KEY_ITEM1 + i].loaded)
|
if (Objects[ID_KEY_ITEM1 + i].loaded)
|
||||||
g_LaraExtra.Keys[i] = 1;
|
Lara.Keys[i] = 1;
|
||||||
g_LaraExtra.KeysCombo[2 * i] = false;
|
Lara.KeysCombo[2 * i] = false;
|
||||||
g_LaraExtra.KeysCombo[2 * i + 1] = false;
|
Lara.KeysCombo[2 * i + 1] = false;
|
||||||
}
|
}
|
||||||
for (i = 0; i < 3; ++i)
|
for (i = 0; i < 3; ++i)
|
||||||
{
|
{
|
||||||
if (Objects[ID_PICKUP_ITEM1 + i].loaded)
|
if (Objects[ID_PICKUP_ITEM1 + i].loaded)
|
||||||
g_LaraExtra.Pickups[i] = 1;
|
Lara.Pickups[i] = 1;
|
||||||
g_LaraExtra.PickupsCombo[2 * i] = false;
|
Lara.PickupsCombo[2 * i] = false;
|
||||||
g_LaraExtra.PickupsCombo[2 * i + 1] = false;
|
Lara.PickupsCombo[2 * i + 1] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_Inventory->LoadObjects(false);
|
g_Inventory->LoadObjects(false);
|
||||||
|
@ -107,27 +107,27 @@ void DelsGiveLaraItemsCheat() // (AF) (D)
|
||||||
|
|
||||||
void LaraCheatGetStuff() // (F) (D)
|
void LaraCheatGetStuff() // (F) (D)
|
||||||
{
|
{
|
||||||
g_LaraExtra.NumFlares = -1;
|
Lara.NumFlares = -1;
|
||||||
g_LaraExtra.NumSmallMedipacks = -1;
|
Lara.NumSmallMedipacks = -1;
|
||||||
g_LaraExtra.NumLargeMedipacks = -1;
|
Lara.NumLargeMedipacks = -1;
|
||||||
if (Objects[ID_CROWBAR_ITEM].loaded)
|
if (Objects[ID_CROWBAR_ITEM].loaded)
|
||||||
g_LaraExtra.Crowbar = true;
|
Lara.Crowbar = true;
|
||||||
g_LaraExtra.Lasersight = true;
|
Lara.Lasersight = true;
|
||||||
g_LaraExtra.Weapons[WEAPON_REVOLVER].Present = true;
|
Lara.Weapons[WEAPON_REVOLVER].Present = true;
|
||||||
g_LaraExtra.Weapons[WEAPON_REVOLVER].SelectedAmmo = WEAPON_AMMO1;
|
Lara.Weapons[WEAPON_REVOLVER].SelectedAmmo = WEAPON_AMMO1;
|
||||||
g_LaraExtra.Weapons[WEAPON_REVOLVER].HasLasersight = false;
|
Lara.Weapons[WEAPON_REVOLVER].HasLasersight = false;
|
||||||
g_LaraExtra.Weapons[WEAPON_REVOLVER].HasSilencer = false;
|
Lara.Weapons[WEAPON_REVOLVER].HasSilencer = false;
|
||||||
g_LaraExtra.Weapons[WEAPON_REVOLVER].Ammo[WEAPON_AMMO1] = -1;
|
Lara.Weapons[WEAPON_REVOLVER].Ammo[WEAPON_AMMO1] = -1;
|
||||||
g_LaraExtra.Weapons[WEAPON_UZI].Present = true;
|
Lara.Weapons[WEAPON_UZI].Present = true;
|
||||||
g_LaraExtra.Weapons[WEAPON_UZI].SelectedAmmo = WEAPON_AMMO1;
|
Lara.Weapons[WEAPON_UZI].SelectedAmmo = WEAPON_AMMO1;
|
||||||
g_LaraExtra.Weapons[WEAPON_UZI].HasLasersight = false;
|
Lara.Weapons[WEAPON_UZI].HasLasersight = false;
|
||||||
g_LaraExtra.Weapons[WEAPON_UZI].HasSilencer = false;
|
Lara.Weapons[WEAPON_UZI].HasSilencer = false;
|
||||||
g_LaraExtra.Weapons[WEAPON_UZI].Ammo[WEAPON_AMMO1] = -1;
|
Lara.Weapons[WEAPON_UZI].Ammo[WEAPON_AMMO1] = -1;
|
||||||
g_LaraExtra.Weapons[WEAPON_SHOTGUN].Present = true;
|
Lara.Weapons[WEAPON_SHOTGUN].Present = true;
|
||||||
g_LaraExtra.Weapons[WEAPON_SHOTGUN].SelectedAmmo = WEAPON_AMMO1;
|
Lara.Weapons[WEAPON_SHOTGUN].SelectedAmmo = WEAPON_AMMO1;
|
||||||
g_LaraExtra.Weapons[WEAPON_SHOTGUN].HasLasersight = false;
|
Lara.Weapons[WEAPON_SHOTGUN].HasLasersight = false;
|
||||||
g_LaraExtra.Weapons[WEAPON_SHOTGUN].HasSilencer = false;
|
Lara.Weapons[WEAPON_SHOTGUN].HasSilencer = false;
|
||||||
g_LaraExtra.Weapons[WEAPON_SHOTGUN].Ammo[WEAPON_AMMO1] = -1;
|
Lara.Weapons[WEAPON_SHOTGUN].Ammo[WEAPON_AMMO1] = -1;
|
||||||
|
|
||||||
g_Inventory->LoadObjects(false);
|
g_Inventory->LoadObjects(false);
|
||||||
}
|
}
|
||||||
|
@ -230,14 +230,14 @@ void LaraControl(short itemNumber) // (AF) (D)
|
||||||
Lara.waterSurfaceDist = -hfw;
|
Lara.waterSurfaceDist = -hfw;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (g_LaraExtra.Vehicle == NO_ITEM)
|
if (Lara.Vehicle == NO_ITEM)
|
||||||
#endif
|
#endif
|
||||||
WadeSplash(item, wh, wd);
|
WadeSplash(item, wh, wd);
|
||||||
|
|
||||||
short roomNumber;
|
short roomNumber;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (g_LaraExtra.Vehicle == NO_ITEM && g_LaraExtra.ExtraAnim == 0)
|
if (Lara.Vehicle == NO_ITEM && Lara.ExtraAnim == 0)
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
switch (Lara.waterStatus)
|
switch (Lara.waterStatus)
|
||||||
|
@ -601,7 +601,7 @@ void LaraControl(short itemNumber) // (AF) (D)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
/* lara is not equipped with any vehicle */
|
/* lara is not equipped with any vehicle */
|
||||||
if (g_LaraExtra.Vehicle == NO_ITEM) // only for the upv !!
|
if (Lara.Vehicle == NO_ITEM) // only for the upv !!
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
Lara.air += 10;
|
Lara.air += 10;
|
||||||
|
@ -651,7 +651,7 @@ void LaraControl(short itemNumber) // (AF) (D)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Savegame.Game.Distance += SQRT_ASM(
|
Savegame.Game.Distance += sqrt(
|
||||||
SQUARE(item->pos.xPos - oldX) +
|
SQUARE(item->pos.xPos - oldX) +
|
||||||
SQUARE(item->pos.yPos - oldY) +
|
SQUARE(item->pos.yPos - oldY) +
|
||||||
SQUARE(item->pos.zPos - oldZ));
|
SQUARE(item->pos.zPos - oldZ));
|
||||||
|
@ -693,9 +693,9 @@ void LaraInitialiseMeshes() // (AF) (D)
|
||||||
{
|
{
|
||||||
Lara.backGun = WEAPON_HK;
|
Lara.backGun = WEAPON_HK;
|
||||||
}
|
}
|
||||||
else if (!g_LaraExtra.Weapons[WEAPON_SHOTGUN].Present)
|
else if (!Lara.Weapons[WEAPON_SHOTGUN].Present)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.Weapons[WEAPON_HK].Present)
|
if (Lara.Weapons[WEAPON_HK].Present)
|
||||||
Lara.backGun = WEAPON_HK;
|
Lara.backGun = WEAPON_HK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -723,18 +723,15 @@ void InitialiseLara(int restore)
|
||||||
|
|
||||||
if (restore)
|
if (restore)
|
||||||
{
|
{
|
||||||
LARA_INFO backup;
|
LaraInfo backup;
|
||||||
memcpy(&backup, &Lara, sizeof(LARA_INFO));
|
memcpy(&backup, &Lara, sizeof(LaraInfo));
|
||||||
ZeroMemory(&Lara, sizeof(LARA_INFO));
|
ZeroMemory(&Lara, sizeof(LaraInfo));
|
||||||
memcpy(&Lara.Legacy_pistolsTypeCarried, &backup.Legacy_pistolsTypeCarried, 59);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ZeroMemory(&Lara, sizeof(LARA_INFO));
|
ZeroMemory(&Lara, sizeof(LaraInfo));
|
||||||
ZeroMemory(&g_LaraExtra, sizeof(LaraExtraInfo));
|
Lara.ExtraAnim = 0;
|
||||||
|
Lara.Vehicle = NO_ITEM;
|
||||||
g_LaraExtra.ExtraAnim = 0;
|
|
||||||
g_LaraExtra.Vehicle = NO_ITEM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Lara.look = true;
|
Lara.look = true;
|
||||||
|
@ -768,24 +765,24 @@ void InitialiseLara(int restore)
|
||||||
|
|
||||||
if (gun == WEAPON_PISTOLS)
|
if (gun == WEAPON_PISTOLS)
|
||||||
{
|
{
|
||||||
g_LaraExtra.Weapons[WEAPON_PISTOLS].Present = true;
|
Lara.Weapons[WEAPON_PISTOLS].Present = true;
|
||||||
g_LaraExtra.Weapons[WEAPON_PISTOLS].Ammo[WEAPON_AMMO1] = -1;
|
Lara.Weapons[WEAPON_PISTOLS].Ammo[WEAPON_AMMO1] = -1;
|
||||||
}
|
}
|
||||||
else if (gun == WEAPON_HK)
|
else if (gun == WEAPON_HK)
|
||||||
{
|
{
|
||||||
g_LaraExtra.Weapons[WEAPON_HK].Present = true;
|
Lara.Weapons[WEAPON_HK].Present = true;
|
||||||
g_LaraExtra.Weapons[WEAPON_HK].Ammo[WEAPON_AMMO1] = 100;
|
Lara.Weapons[WEAPON_HK].Ammo[WEAPON_AMMO1] = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_LaraExtra.Binoculars = true;
|
Lara.Binoculars = true;
|
||||||
|
|
||||||
if (!restore)
|
if (!restore)
|
||||||
{
|
{
|
||||||
if (Objects[ID_FLARE_INV_ITEM].loaded)
|
if (Objects[ID_FLARE_INV_ITEM].loaded)
|
||||||
g_LaraExtra.NumFlares = 3;
|
Lara.NumFlares = 3;
|
||||||
|
|
||||||
g_LaraExtra.NumSmallMedipacks = 3;
|
Lara.NumSmallMedipacks = 3;
|
||||||
g_LaraExtra.NumLargeMedipacks = 1;
|
Lara.NumLargeMedipacks = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
InitialiseLaraAnims(LaraItem);
|
InitialiseLaraAnims(LaraItem);
|
||||||
|
@ -967,12 +964,15 @@ void AnimateLara(ITEM_INFO* item)
|
||||||
|
|
||||||
if (!Lara.isMoving) // TokyoSU: i dont know why but it's wreid, in TR3 only the 2 first line there is used and worked fine !
|
if (!Lara.isMoving) // TokyoSU: i dont know why but it's wreid, in TR3 only the 2 first line there is used and worked fine !
|
||||||
{
|
{
|
||||||
item->pos.xPos += item->speed * SIN(Lara.moveAngle) >> W2V_SHIFT;
|
item->pos.xPos += item->speed * phd_sin(Lara.moveAngle) >> W2V_SHIFT;
|
||||||
item->pos.zPos += item->speed * COS(Lara.moveAngle) >> W2V_SHIFT;
|
item->pos.zPos += item->speed * phd_cos(Lara.moveAngle) >> W2V_SHIFT;
|
||||||
|
|
||||||
item->pos.xPos += lateral * SIN(Lara.moveAngle + ANGLE(90)) >> W2V_SHIFT;
|
item->pos.xPos += lateral * phd_sin(Lara.moveAngle + ANGLE(90)) >> W2V_SHIFT;
|
||||||
item->pos.zPos += lateral * COS(Lara.moveAngle + ANGLE(90)) >> W2V_SHIFT;
|
item->pos.zPos += lateral * phd_cos(Lara.moveAngle + ANGLE(90)) >> W2V_SHIFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update matrices
|
||||||
|
g_Renderer->UpdateLaraAnimations(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DelAlignLaraToRope(ITEM_INFO* item) // (F) (D)
|
void DelAlignLaraToRope(ITEM_INFO* item) // (F) (D)
|
||||||
|
@ -1012,11 +1012,11 @@ void DelAlignLaraToRope(ITEM_INFO* item) // (F) (D)
|
||||||
diff2.x = diff.x;
|
diff2.x = diff.x;
|
||||||
diff2.y = diff.y;
|
diff2.y = diff.y;
|
||||||
diff2.z = diff.z;
|
diff2.z = diff.z;
|
||||||
ScaleVector(&vec3, COS(ropeY), &vec3);
|
ScaleVector(&vec3, phd_cos(ropeY), &vec3);
|
||||||
ScaleVector(&diff2, DotProduct(&diff2, &vec2), &diff2);
|
ScaleVector(&diff2, DotProduct(&diff2, &vec2), &diff2);
|
||||||
ScaleVector(&diff2, 4096 - COS(ropeY), &diff2);
|
ScaleVector(&diff2, 4096 - phd_cos(ropeY), &diff2);
|
||||||
CrossProduct(&diff, &vec2, &vec4);
|
CrossProduct(&diff, &vec2, &vec4);
|
||||||
ScaleVector(&vec4, SIN(ropeY), &vec4);
|
ScaleVector(&vec4, phd_sin(ropeY), &vec4);
|
||||||
diff2.x += vec3.x;
|
diff2.x += vec3.x;
|
||||||
diff2.y += vec3.y;
|
diff2.y += vec3.y;
|
||||||
diff2.z += vec3.z;
|
diff2.z += vec3.z;
|
||||||
|
@ -1048,12 +1048,18 @@ void DelAlignLaraToRope(ITEM_INFO* item) // (F) (D)
|
||||||
item->pos.xPos = rope->position.x + (rope->meshSegment[Lara.ropeSegment].x >> 16);
|
item->pos.xPos = rope->position.x + (rope->meshSegment[Lara.ropeSegment].x >> 16);
|
||||||
item->pos.yPos = rope->position.y + (rope->meshSegment[Lara.ropeSegment].y >> 16) + Lara.ropeOffset;
|
item->pos.yPos = rope->position.y + (rope->meshSegment[Lara.ropeSegment].y >> 16) + Lara.ropeOffset;
|
||||||
item->pos.zPos = rope->position.z + (rope->meshSegment[Lara.ropeSegment].z >> 16);
|
item->pos.zPos = rope->position.z + (rope->meshSegment[Lara.ropeSegment].z >> 16);
|
||||||
phd_PushUnitMatrix();
|
|
||||||
phd_RotYXZ(angle[1], angle[0], angle[2]);
|
Matrix rotMatrix = Matrix::CreateFromYawPitchRoll(
|
||||||
item->pos.xPos += -112 * MatrixPtr[M02] >> W2V_SHIFT;
|
TO_DEGREES(angle[1]),
|
||||||
item->pos.yPos += -112 * MatrixPtr[M12] >> W2V_SHIFT;
|
TO_DEGREES(angle[0]),
|
||||||
item->pos.zPos += -112 * MatrixPtr[M22] >> W2V_SHIFT;
|
TO_DEGREES(angle[2])
|
||||||
phd_PopMatrix();
|
);
|
||||||
|
|
||||||
|
// PHD_MATH!
|
||||||
|
item->pos.xPos += -112 * rotMatrix.m[0][2]; // MatrixPtr[M02] >> W2V_SHIFT;
|
||||||
|
item->pos.yPos += -112 * rotMatrix.m[1][2]; // MatrixPtr[M12] >> W2V_SHIFT;
|
||||||
|
item->pos.zPos += -112 * rotMatrix.m[2][2]; // MatrixPtr[M22] >> W2V_SHIFT;
|
||||||
|
|
||||||
item->pos.xRot = angle[0];
|
item->pos.xRot = angle[0];
|
||||||
item->pos.yRot = angle[1];
|
item->pos.yRot = angle[1];
|
||||||
item->pos.zRot = angle[2];
|
item->pos.zRot = angle[2];
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#include "laraswim.h"
|
#include "laraswim.h"
|
||||||
#include "larafire.h"
|
#include "larafire.h"
|
||||||
#include "laramisc.h"
|
#include "laramisc.h"
|
||||||
|
#include "..\Specific\level.h"
|
||||||
|
#include "../Specific/input.h"
|
||||||
|
|
||||||
extern void(*lara_control_routines[NUM_LARA_STATES + 1])(ITEM_INFO* item, COLL_INFO* coll);
|
extern void(*lara_control_routines[NUM_LARA_STATES + 1])(ITEM_INFO* item, COLL_INFO* coll);
|
||||||
extern void(*lara_collision_routines[NUM_LARA_STATES + 1])(ITEM_INFO* item, COLL_INFO* coll);
|
extern void(*lara_collision_routines[NUM_LARA_STATES + 1])(ITEM_INFO* item, COLL_INFO* coll);
|
||||||
|
@ -270,8 +272,8 @@ void LaraSurface(ITEM_INFO* item, COLL_INFO* coll)//4D684, 4DAE8 (F)
|
||||||
|
|
||||||
AnimateLara(item);
|
AnimateLara(item);
|
||||||
|
|
||||||
item->pos.xPos += item->fallspeed * SIN(Lara.moveAngle) >> (W2V_SHIFT + 2);
|
item->pos.xPos += item->fallspeed * phd_sin(Lara.moveAngle) >> (W2V_SHIFT + 2);
|
||||||
item->pos.zPos += item->fallspeed * COS(Lara.moveAngle) >> (W2V_SHIFT + 2);
|
item->pos.zPos += item->fallspeed * phd_cos(Lara.moveAngle) >> (W2V_SHIFT + 2);
|
||||||
|
|
||||||
LaraBaddieCollision(item, coll);
|
LaraBaddieCollision(item, coll);
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,11 @@
|
||||||
#include "laramisc.h"
|
#include "laramisc.h"
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
|
#include "..\Specific\level.h"
|
||||||
|
#include "../Specific/input.h"
|
||||||
|
#include "sound.h"
|
||||||
|
|
||||||
|
|
||||||
extern LaraExtraInfo g_LaraExtra;
|
|
||||||
|
|
||||||
SUBSUIT_INFO Subsuit;
|
SUBSUIT_INFO Subsuit;
|
||||||
byte SubHitCount = 0;
|
byte SubHitCount = 0;
|
||||||
|
@ -28,8 +31,8 @@ void LaraWaterCurrent(COLL_INFO* coll) // (F) (D)
|
||||||
OBJECT_VECTOR* sink = &Camera.fixed[Lara.currentActive - 1];
|
OBJECT_VECTOR* sink = &Camera.fixed[Lara.currentActive - 1];
|
||||||
|
|
||||||
short angle = mGetAngle(sink->x, sink->z, LaraItem->pos.xPos, LaraItem->pos.zPos);
|
short angle = mGetAngle(sink->x, sink->z, LaraItem->pos.xPos, LaraItem->pos.zPos);
|
||||||
Lara.currentXvel += ((sink->data * (SIN(angle - ANGLE(90)) / 4) >> 2) - Lara.currentXvel) >> 4;
|
Lara.currentXvel += ((sink->data * (phd_sin(angle - ANGLE(90)) / 4) >> 2) - Lara.currentXvel) >> 4;
|
||||||
Lara.currentZvel += ((sink->data * (COS(angle - ANGLE(90)) / 4) >> 2) - Lara.currentZvel) >> 4;
|
Lara.currentZvel += ((sink->data * (phd_cos(angle - ANGLE(90)) / 4) >> 2) - Lara.currentZvel) >> 4;
|
||||||
|
|
||||||
LaraItem->pos.yPos += (sink->y - LaraItem->pos.yPos) >> 4;
|
LaraItem->pos.yPos += (sink->y - LaraItem->pos.yPos) >> 4;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +66,7 @@ void LaraWaterCurrent(COLL_INFO* coll) // (F) (D)
|
||||||
LaraItem->pos.zPos += Lara.currentZvel >> 8;
|
LaraItem->pos.zPos += Lara.currentZvel >> 8;
|
||||||
Lara.currentActive = 0;
|
Lara.currentActive = 0;
|
||||||
|
|
||||||
coll->facing = ATAN(LaraItem->pos.zPos - coll->old.z, LaraItem->pos.xPos - coll->old.x);
|
coll->facing = phd_atan(LaraItem->pos.zPos - coll->old.z, LaraItem->pos.xPos - coll->old.x);
|
||||||
|
|
||||||
GetCollisionInfo(coll, LaraItem->pos.xPos, LaraItem->pos.yPos + 200, LaraItem->pos.zPos, LaraItem->roomNumber, 400);
|
GetCollisionInfo(coll, LaraItem->pos.xPos, LaraItem->pos.yPos + 200, LaraItem->pos.zPos, LaraItem->roomNumber, 400);
|
||||||
|
|
||||||
|
@ -507,9 +510,9 @@ void LaraUnderWater(ITEM_INFO* item, COLL_INFO* coll)//4BFB4, 4C418 (F)
|
||||||
|
|
||||||
AnimateLara(item);
|
AnimateLara(item);
|
||||||
|
|
||||||
item->pos.xPos += COS(item->pos.xRot) * (item->fallspeed * SIN(item->pos.yRot) >> (W2V_SHIFT + 2)) >> W2V_SHIFT;
|
item->pos.xPos += phd_cos(item->pos.xRot) * (item->fallspeed * phd_sin(item->pos.yRot) >> (W2V_SHIFT + 2)) >> W2V_SHIFT;
|
||||||
item->pos.yPos -= item->fallspeed * SIN(item->pos.xRot) >> (W2V_SHIFT + 2);
|
item->pos.yPos -= item->fallspeed * phd_sin(item->pos.xRot) >> (W2V_SHIFT + 2);
|
||||||
item->pos.zPos += COS(item->pos.xRot) * (item->fallspeed * COS(item->pos.yRot) >> (W2V_SHIFT + 2)) >> W2V_SHIFT;
|
item->pos.zPos += phd_cos(item->pos.xRot) * (item->fallspeed * phd_cos(item->pos.yRot) >> (W2V_SHIFT + 2)) >> W2V_SHIFT;
|
||||||
|
|
||||||
LaraBaddieCollision(item, coll);
|
LaraBaddieCollision(item, coll);
|
||||||
|
|
||||||
|
@ -679,7 +682,7 @@ void LaraSwimCollision(ITEM_INFO* item, COLL_INFO* coll)//4B608, 4BA6C
|
||||||
coll->facing = item->pos.yRot;
|
coll->facing = item->pos.yRot;
|
||||||
}
|
}
|
||||||
|
|
||||||
short height = 762 * SIN(item->pos.xRot) >> W2V_SHIFT;
|
short height = 762 * phd_sin(item->pos.xRot) >> W2V_SHIFT;
|
||||||
height = abs(height);
|
height = abs(height);
|
||||||
|
|
||||||
if (height < ((LaraDrawType == LARA_DIVESUIT) << 6) + 200)
|
if (height < ((LaraDrawType == LARA_DIVESUIT) << 6) + 200)
|
||||||
|
@ -820,7 +823,7 @@ void LaraSwimCollision(ITEM_INFO* item, COLL_INFO* coll)//4B608, 4BA6C
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Lara.waterStatus != LW_FLYCHEAT && g_LaraExtra.ExtraAnim == 0)
|
if (Lara.waterStatus != LW_FLYCHEAT && Lara.ExtraAnim == 0)
|
||||||
LaraTestWaterDepth(item, coll);
|
LaraTestWaterDepth(item, coll);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "../Specific/setup.h"
|
#include "../Specific/setup.h"
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
|
#include "lara.h"
|
||||||
|
#include "..\Specific\level.h"
|
||||||
|
|
||||||
#define DEFAULT_FLY_UPDOWN_SPEED 16
|
#define DEFAULT_FLY_UPDOWN_SPEED 16
|
||||||
#define DEFAULT_SWIM_UPDOWN_SPEED 32
|
#define DEFAULT_SWIM_UPDOWN_SPEED 32
|
||||||
|
@ -13,16 +15,16 @@ CREATURE_INFO* BaddieSlots;
|
||||||
|
|
||||||
void InitialiseLOTarray(int allocMem)
|
void InitialiseLOTarray(int allocMem)
|
||||||
{
|
{
|
||||||
DB_Log(0, "InitialiseLOTarray - DLL");
|
//DB_Log(0, "InitialiseLOTarray - DLL");
|
||||||
|
|
||||||
if (allocMem)
|
if (allocMem)
|
||||||
BaddieSlots = (CREATURE_INFO*)GameMalloc(sizeof(CREATURE_INFO) * NUM_SLOTS);
|
BaddieSlots = (CREATURE_INFO*)game_malloc(sizeof(CREATURE_INFO) * NUM_SLOTS);
|
||||||
|
|
||||||
CREATURE_INFO* creature = BaddieSlots;
|
CREATURE_INFO* creature = BaddieSlots;
|
||||||
for (int i = 0; i < NUM_SLOTS; i++, creature++)
|
for (int i = 0; i < NUM_SLOTS; i++, creature++)
|
||||||
{
|
{
|
||||||
creature->itemNum = NO_ITEM;
|
creature->itemNum = NO_ITEM;
|
||||||
creature->LOT.node = (BOX_NODE*)GameMalloc(sizeof(BOX_NODE) * NumberBoxes);
|
creature->LOT.node = (BOX_NODE*)game_malloc(sizeof(BOX_NODE) * NumberBoxes);
|
||||||
}
|
}
|
||||||
|
|
||||||
SlotsUsed = 0;
|
SlotsUsed = 0;
|
||||||
|
@ -107,7 +109,7 @@ void DisableBaddieAI(short itemNumber)
|
||||||
void InitialiseSlot(short itemNum, short slot)
|
void InitialiseSlot(short itemNum, short slot)
|
||||||
{
|
{
|
||||||
ITEM_INFO* item = &Items[itemNum];
|
ITEM_INFO* item = &Items[itemNum];
|
||||||
OBJECT_INFO* obj = &Objects[item->objectNumber];
|
ObjectInfo* obj = &Objects[item->objectNumber];
|
||||||
CREATURE_INFO* creature = &BaddieSlots[slot];
|
CREATURE_INFO* creature = &BaddieSlots[slot];
|
||||||
|
|
||||||
item->data = creature;
|
item->data = creature;
|
||||||
|
@ -310,12 +312,3 @@ void CreateZone(ITEM_INFO* item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inject_Lot()
|
|
||||||
{
|
|
||||||
INJECT(0x0045B0C0, InitialiseLOTarray);
|
|
||||||
INJECT(0x0045B1A0, EnableBaddieAI);
|
|
||||||
INJECT(0x0045B150, DisableBaddieAI);
|
|
||||||
INJECT(0x0045B740, ClearLOT);
|
|
||||||
INJECT(0x0045B5E0, CreateZone);
|
|
||||||
}
|
|
|
@ -11,5 +11,3 @@ void InitialiseSlot(short itemNum, short slot);
|
||||||
void DisableBaddieAI(short itemNumber);
|
void DisableBaddieAI(short itemNumber);
|
||||||
void ClearLOT(LOT_INFO* LOT);
|
void ClearLOT(LOT_INFO* LOT);
|
||||||
void CreateZone(ITEM_INFO* item);
|
void CreateZone(ITEM_INFO* item);
|
||||||
|
|
||||||
void Inject_Lot();
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "../Specific/setup.h"
|
#include "../Specific/setup.h"
|
||||||
|
#include "..\Specific\level.h"
|
||||||
|
|
||||||
#define CHK_ANY(var, flag) (var & flag) != 0
|
#define CHK_ANY(var, flag) (var & flag) != 0
|
||||||
#define CHK_NOP(var, flag) !(var & flag)
|
#define CHK_NOP(var, flag) !(var & flag)
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "../Global/global.h"
|
#include "../Global/global.h"
|
||||||
|
|
||||||
#define cutseq_givelara_pistols ((void(__cdecl*)()) 0x00422680)
|
|
||||||
#define cutseq_removelara_pistols ((void(__cdecl*)()) 0x004226B0)
|
|
||||||
#define cutseq_givelara_hk ((void(__cdecl*)()) 0x004226E0)
|
|
||||||
#define cutseq_removelara_hk ((void(__cdecl*)()) 0x00422700)
|
|
||||||
|
|
||||||
enum LARA_MESH_MASK
|
enum LARA_MESH_MASK
|
||||||
{
|
{
|
||||||
LARA_ONLY_LEGS = (0 << 1),
|
LARA_ONLY_LEGS = (0 << 1),
|
||||||
|
|
|
@ -8,8 +8,9 @@
|
||||||
#include "..\Game\tomb4fx.h"
|
#include "..\Game\tomb4fx.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "debris.h"
|
#include "debris.h"
|
||||||
#include "../Specific/roomload.h"
|
#include "../Specific/level.h"
|
||||||
#include "../Specific/setup.h"
|
#include "../Specific/setup.h"
|
||||||
|
#include "lara.h"
|
||||||
|
|
||||||
#define SHARD_DAMAGE 30
|
#define SHARD_DAMAGE 30
|
||||||
#define ROCKET_DAMAGE 100
|
#define ROCKET_DAMAGE 100
|
||||||
|
@ -31,9 +32,9 @@ void ShootAtLara(FX_INFO *fx)
|
||||||
bounds = GetBoundsAccurate(LaraItem);
|
bounds = GetBoundsAccurate(LaraItem);
|
||||||
y += bounds[3] + (bounds[2] - bounds[3]) * 3 / 4;
|
y += bounds[3] + (bounds[2] - bounds[3]) * 3 / 4;
|
||||||
|
|
||||||
distance = SQRT_ASM(SQUARE(x) + SQUARE(z));
|
distance = sqrt(SQUARE(x) + SQUARE(z));
|
||||||
fx->pos.xRot = -ATAN(distance, y);
|
fx->pos.xRot = -phd_atan(distance, y);
|
||||||
fx->pos.yRot = ATAN(z, x);
|
fx->pos.yRot = phd_atan(z, x);
|
||||||
|
|
||||||
/* Random scatter (only a little bit else it's too hard to avoid) */
|
/* Random scatter (only a little bit else it's too hard to avoid) */
|
||||||
fx->pos.xRot += (GetRandomControl() - 0x4000) / 0x40;
|
fx->pos.xRot += (GetRandomControl() - 0x4000) / 0x40;
|
||||||
|
@ -53,10 +54,10 @@ void ControlMissile(short fxNumber)
|
||||||
if (fx->objectNumber == ID_SCUBA_HARPOON && !(Rooms[fx->roomNumber].flags & 1) && fx->pos.xRot > -0x3000)
|
if (fx->objectNumber == ID_SCUBA_HARPOON && !(Rooms[fx->roomNumber].flags & 1) && fx->pos.xRot > -0x3000)
|
||||||
fx->pos.xRot -= ONE_DEGREE;
|
fx->pos.xRot -= ONE_DEGREE;
|
||||||
|
|
||||||
fx->pos.yPos += (fx->speed * SIN(-fx->pos.xRot) >> W2V_SHIFT);
|
fx->pos.yPos += (fx->speed * phd_sin(-fx->pos.xRot) >> W2V_SHIFT);
|
||||||
speed = fx->speed * COS(fx->pos.xRot) >> W2V_SHIFT;
|
speed = fx->speed * phd_cos(fx->pos.xRot) >> W2V_SHIFT;
|
||||||
fx->pos.zPos += (speed * COS(fx->pos.yRot) >> W2V_SHIFT);
|
fx->pos.zPos += (speed * phd_cos(fx->pos.yRot) >> W2V_SHIFT);
|
||||||
fx->pos.xPos += (speed * SIN(fx->pos.yRot) >> W2V_SHIFT);
|
fx->pos.xPos += (speed * phd_sin(fx->pos.yRot) >> W2V_SHIFT);
|
||||||
roomNumber = fx->roomNumber;
|
roomNumber = fx->roomNumber;
|
||||||
floor = GetFloor(fx->pos.xPos, fx->pos.yPos, fx->pos.zPos, &roomNumber);
|
floor = GetFloor(fx->pos.xPos, fx->pos.yPos, fx->pos.zPos, &roomNumber);
|
||||||
|
|
||||||
|
@ -132,7 +133,7 @@ void ControlMissile(short fxNumber)
|
||||||
void ControlNatlaGun(short fx_number)
|
void ControlNatlaGun(short fx_number)
|
||||||
{
|
{
|
||||||
FX_INFO* fx, *newfx;
|
FX_INFO* fx, *newfx;
|
||||||
OBJECT_INFO* object;
|
ObjectInfo* object;
|
||||||
FLOOR_INFO* floor;
|
FLOOR_INFO* floor;
|
||||||
short roomNumber;
|
short roomNumber;
|
||||||
int x, y, z;
|
int x, y, z;
|
||||||
|
@ -146,8 +147,8 @@ void ControlNatlaGun(short fx_number)
|
||||||
/* If first frame, then start another explosion at next position */
|
/* If first frame, then start another explosion at next position */
|
||||||
if (fx->frameNumber == -1)
|
if (fx->frameNumber == -1)
|
||||||
{
|
{
|
||||||
z = fx->pos.zPos + (fx->speed * COS(fx->pos.yRot) >> W2V_SHIFT);
|
z = fx->pos.zPos + (fx->speed * phd_cos(fx->pos.yRot) >> W2V_SHIFT);
|
||||||
x = fx->pos.xPos + (fx->speed * SIN(fx->pos.yRot) >> W2V_SHIFT);
|
x = fx->pos.xPos + (fx->speed * phd_sin(fx->pos.yRot) >> W2V_SHIFT);
|
||||||
y = fx->pos.yPos;
|
y = fx->pos.yPos;
|
||||||
roomNumber = fx->roomNumber;
|
roomNumber = fx->roomNumber;
|
||||||
floor = GetFloor(x, y, z, &roomNumber);
|
floor = GetFloor(x, y, z, &roomNumber);
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
|
|
||||||
#include "..\Global\global.h"
|
#include "..\Global\global.h"
|
||||||
|
|
||||||
//#define TorpedoControl ((void (__cdecl*)(short)) 0x0045C9F0)
|
|
||||||
#define ControlEnemyMissile ((void (__cdecl*)(short)) 0x00431E70)
|
|
||||||
|
|
||||||
void ShootAtLara(FX_INFO* fx);
|
void ShootAtLara(FX_INFO* fx);
|
||||||
void ControlMissile(short fxNumber);
|
void ControlMissile(short fxNumber);
|
||||||
void ControlNatlaGun(short fx_number);
|
void ControlNatlaGun(short fx_number);
|
||||||
|
|
|
@ -12,7 +12,13 @@
|
||||||
#include "switch.h"
|
#include "switch.h"
|
||||||
#include "box.h"
|
#include "box.h"
|
||||||
#include "../Specific/setup.h"
|
#include "../Specific/setup.h"
|
||||||
|
#include "tomb4fx.h"
|
||||||
|
#include "..\Specific\level.h"
|
||||||
|
#include "../Specific/input.h"
|
||||||
|
#include "sound.h"
|
||||||
|
|
||||||
|
OBJECT_TEXTURE* WaterfallTextures[6];
|
||||||
|
float WaterfallY[6];
|
||||||
int lastWaterfallY = 0;
|
int lastWaterfallY = 0;
|
||||||
short TightRopeBounds[12] =
|
short TightRopeBounds[12] =
|
||||||
{
|
{
|
||||||
|
@ -34,7 +40,7 @@ short PoleBounds[12] = // offset 0xA1250
|
||||||
0xF8E4, 0x071C
|
0xF8E4, 0x071C
|
||||||
};
|
};
|
||||||
|
|
||||||
extern LaraExtraInfo g_LaraExtra;
|
|
||||||
|
|
||||||
void InitialiseSmashObject(short itemNumber)
|
void InitialiseSmashObject(short itemNumber)
|
||||||
{
|
{
|
||||||
|
@ -64,7 +70,7 @@ void SmashObject(short itemNumber)
|
||||||
item->collidable = 0;
|
item->collidable = 0;
|
||||||
item->meshBits = 0xFFFE;
|
item->meshBits = 0xFFFE;
|
||||||
|
|
||||||
ExplodingDeath(itemNumber, -1, 257); //ExplodingDeath2
|
ExplodingDeath(itemNumber, -1, 257);
|
||||||
|
|
||||||
item->flags |= IFLAG_INVISIBLE;
|
item->flags |= IFLAG_INVISIBLE;
|
||||||
|
|
||||||
|
@ -443,8 +449,8 @@ void ParallelBarsCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll)
|
||||||
pos2.y = -128;
|
pos2.y = -128;
|
||||||
pos2.z = 512;
|
pos2.z = 512;
|
||||||
|
|
||||||
GetLaraJointPosition(&pos1, LJ_LHAND);
|
GetLaraJointPosition(&pos1, LM_LHAND);
|
||||||
GetLaraJointPosition(&pos2, LJ_RHAND);
|
GetLaraJointPosition(&pos2, LM_RHAND);
|
||||||
|
|
||||||
if (l->pos.yRot & 0x4000)
|
if (l->pos.yRot & 0x4000)
|
||||||
l->pos.xPos += item->pos.xPos - ((pos1.x + pos2.x) >> 1);
|
l->pos.xPos += item->pos.xPos - ((pos1.x + pos2.x) >> 1);
|
||||||
|
@ -489,7 +495,7 @@ void ControlXRayMachine(short itemNumber)
|
||||||
|
|
||||||
if (Lara.skelebob)
|
if (Lara.skelebob)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.Weapons[WEAPON_HK].Present)
|
if (Lara.Weapons[WEAPON_HK].Present)
|
||||||
{
|
{
|
||||||
TestTriggersAtXYZ(item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, 1, 0);
|
TestTriggersAtXYZ(item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber, 1, 0);
|
||||||
item->itemFlags[0] = 666;
|
item->itemFlags[0] = 666;
|
||||||
|
@ -600,7 +606,7 @@ void CutsceneRopeControl(short itemNumber)
|
||||||
dy = (pos2.y - pos1.y) * (pos2.y - pos1.y);
|
dy = (pos2.y - pos1.y) * (pos2.y - pos1.y);
|
||||||
dz = (pos2.z - pos1.z) * (pos2.z - pos1.z);
|
dz = (pos2.z - pos1.z) * (pos2.z - pos1.z);
|
||||||
|
|
||||||
item->itemFlags[1] = ((SQRT_ASM(dx + dy + dz) << 1) + SQRT_ASM(dx + dy + dz)) << 1;
|
item->itemFlags[1] = ((sqrt(dx + dy + dz) * 2) + sqrt(dx + dy + dz)) * 2;
|
||||||
item->pos.xRot = -4869;
|
item->pos.xRot = -4869;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -645,26 +651,90 @@ void InitialiseTightRope(short itemNumber)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inject_Objects()
|
void InitialiseAnimating(short itemNumber)
|
||||||
{
|
{
|
||||||
INJECT(0x00465FE0, TightRopeCollision);
|
ITEM_INFO* item = &Items[itemNumber];
|
||||||
INJECT(0x00465200, SmashObject);
|
item->currentAnimState = 0;
|
||||||
|
item->animNumber = Objects[item->objectNumber].animIndex;
|
||||||
|
item->frameNumber = Anims[item->animNumber].frameBase;
|
||||||
|
}
|
||||||
|
|
||||||
/*INJECT(0x00465200, SmashObject);
|
void AnimatingControl(short itemNumber)
|
||||||
INJECT(0x00465330, SmashObjectControl);
|
{
|
||||||
INJECT(0x00465350, BridgeFlatFloor);
|
ITEM_INFO* item = &Items[itemNumber];
|
||||||
INJECT(0x00465390, BridgeFlatCeiling);
|
|
||||||
INJECT(0x00465410, BridgeTilt1Floor);
|
if (!TriggerActive(item))
|
||||||
INJECT(0x00465480, BridgeTilt1Ceiling);
|
return;
|
||||||
INJECT(0x004654D0, BridgeTilt2Floor);
|
|
||||||
INJECT(0x00465540, BridgeTilt2Ceiling);
|
item->status = ITEM_ACTIVE;
|
||||||
//INJECT(0x00465590, AnimatingControl);
|
|
||||||
INJECT(0x00465A30, PoleCollision);
|
AnimateItem(item);
|
||||||
INJECT(0x00465D00, ControlTriggerTriggerer);
|
|
||||||
INJECT(0x00465DF0, AnimateWaterfalls);
|
if (item->frameNumber >= Anims[item->animNumber].frameEnd)
|
||||||
INJECT(0x00465F10, ControlWaterfall);
|
{
|
||||||
INJECT(0x004661C0, ParallelBarsCollision);
|
item->frameNumber = Anims[item->animNumber].frameBase;
|
||||||
INJECT(0x00466420, ControlXRayMachine);
|
RemoveActiveItem(itemNumber);
|
||||||
INJECT(0x00466720, CutsceneRopeControl);
|
item->aiBits = 0;
|
||||||
INJECT(0x00466AA0, HybridCollision);*/
|
item->status = ITEM_INACTIVE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HighObject2Control(short itemNumber)
|
||||||
|
{
|
||||||
|
ITEM_INFO* item = &Items[itemNumber];
|
||||||
|
|
||||||
|
if (!TriggerActive(item))
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
if (!item->itemFlags[2])
|
||||||
|
{
|
||||||
|
int div = item->triggerFlags % 10 << 10;
|
||||||
|
int mod = item->triggerFlags / 10 << 10;
|
||||||
|
item->itemFlags[0] = GetRandomControl() % div;
|
||||||
|
item->itemFlags[1] = GetRandomControl() % mod;
|
||||||
|
item->itemFlags[2] = (GetRandomControl() & 0xF) + 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (--item->itemFlags[2] < 15)
|
||||||
|
{
|
||||||
|
SPARKS* spark = &Sparks[GetFreeSpark()];
|
||||||
|
spark->on = 1;
|
||||||
|
spark->sR = -1;
|
||||||
|
spark->sB = 16;
|
||||||
|
spark->sG = (GetRandomControl() & 0x1F) + 48;
|
||||||
|
spark->dR = (GetRandomControl() & 0x3F) - 64;
|
||||||
|
spark->dB = 0;
|
||||||
|
spark->dG = (GetRandomControl() & 0x3F) + -128;
|
||||||
|
spark->fadeToBlack = 4;
|
||||||
|
spark->colFadeSpeed = (GetRandomControl() & 3) + 4;
|
||||||
|
spark->transType = COLADD;
|
||||||
|
spark->life = spark->sLife = (GetRandomControl() & 3) + 24;
|
||||||
|
spark->x = item->itemFlags[1] + (GetRandomControl() & 0x3F) + item->pos.xPos - 544;
|
||||||
|
spark->y = item->pos.yPos;
|
||||||
|
spark->z = item->itemFlags[0] + (GetRandomControl() & 0x3F) + item->pos.zPos - 544;
|
||||||
|
spark->xVel = (GetRandomControl() & 0x1FF) - 256;
|
||||||
|
spark->friction = 6;
|
||||||
|
spark->zVel = (GetRandomControl() & 0x1FF) - 256;
|
||||||
|
spark->rotAng = GetRandomControl() & 0xFFF;
|
||||||
|
spark->rotAdd = (GetRandomControl() & 0x3F) - 32;
|
||||||
|
spark->maxYvel = 0;
|
||||||
|
spark->yVel = -512 - (GetRandomControl() & 0x3FF);
|
||||||
|
spark->sSize = spark->size = (GetRandomControl() & 0xF) + 32;
|
||||||
|
spark->dSize = spark->size >> 2;
|
||||||
|
|
||||||
|
if (GetRandomControl() & 3)
|
||||||
|
{
|
||||||
|
spark->flags = SP_ROTATE | SP_DEF | SP_SCALE | SP_EXPDEF;
|
||||||
|
spark->scalar = 3;
|
||||||
|
spark->gravity = (GetRandomControl() & 0x3F) + 32;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
spark->flags = SP_ROTATE | SP_DEF | SP_SCALE;
|
||||||
|
spark->def = Objects[ID_DEFAULT_SPRITES].meshIndex + SPR_UNDERWATERDUST;
|
||||||
|
spark->scalar = 1;
|
||||||
|
spark->gravity = (GetRandomControl() & 0xF) + 64;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "..\Global\global.h"
|
#include "..\Global\global.h"
|
||||||
|
|
||||||
#define InitialiseAnimating ((void (__cdecl*)(short)) 0x00440100)
|
extern OBJECT_TEXTURE* WaterfallTextures[6];
|
||||||
#define AnimatingControl ((void (__cdecl*)(short)) 0x00465590)
|
extern float WaterfallY[6];
|
||||||
|
|
||||||
//#define InitialiseSmashObject ((void (__cdecl*)(short)) 0x0043D7F0)
|
|
||||||
void SmashObject(short itemNumber);
|
void SmashObject(short itemNumber);
|
||||||
void SmashObjectControl(short itemNumber);
|
void SmashObjectControl(short itemNumber);
|
||||||
void BridgeFlatFloor(ITEM_INFO* item, int x, int y, int z, int* height);
|
void BridgeFlatFloor(ITEM_INFO* item, int x, int y, int z, int* height);
|
||||||
|
@ -19,19 +18,13 @@ void PoleCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll);
|
||||||
void ControlTriggerTriggerer(short itemNumber);
|
void ControlTriggerTriggerer(short itemNumber);
|
||||||
void AnimateWaterfalls();
|
void AnimateWaterfalls();
|
||||||
void ControlWaterfall(short itemNumber);
|
void ControlWaterfall(short itemNumber);
|
||||||
//#define InitialiseTightRope ((void (__cdecl*)(short)) 0x0043ED30)
|
|
||||||
void TightRopeCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll);
|
void TightRopeCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll);
|
||||||
void ParallelBarsCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll);
|
void ParallelBarsCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll);
|
||||||
#define InitialiseXRayMachine ((void (__cdecl*)(short)) 0x0043FA20)
|
|
||||||
void ControlXRayMachine(short itemNumber);
|
void ControlXRayMachine(short itemNumber);
|
||||||
void CutsceneRopeControl(short itemNumber);
|
void CutsceneRopeControl(short itemNumber);
|
||||||
void HybridCollision(short itemNum, ITEM_INFO* laraitem, COLL_INFO* coll);
|
void HybridCollision(short itemNum, ITEM_INFO* laraitem, COLL_INFO* coll);
|
||||||
//#define InitialiseRaisingBlock ((void (__cdecl*)(short)) 0x0043D730)
|
|
||||||
//#define RaisingBlockControl ((void (__cdecl*)(short)) 0x0048C3D0)
|
|
||||||
//#define InitialiseRaisingCog ((void (__cdecl*)(short)) 0x00440320)
|
|
||||||
//#define RaisingCogControl ((void (__cdecl*)(short)) 0x00406040)
|
|
||||||
#define HighObject2Control ((void (__cdecl*)(short)) 0x004070D0)
|
|
||||||
void InitialiseSmashObject(short itemNumber);
|
void InitialiseSmashObject(short itemNumber);
|
||||||
void InitialiseTightRope(short itemNumber);
|
void InitialiseTightRope(short itemNumber);
|
||||||
|
void InitialiseAnimating(short itemNumber);
|
||||||
void Inject_Objects();
|
void AnimatingControl(short itemNumber);
|
||||||
|
void HighObject2Control(short itemNumber);
|
||||||
|
|
|
@ -11,9 +11,9 @@ void TriggerAlertLight(int x, int y, int z, int r, int g, int b, int angle, shor
|
||||||
source.z = z;
|
source.z = z;
|
||||||
GetFloor(x, y, z, &room);
|
GetFloor(x, y, z, &room);
|
||||||
source.roomNumber = room;
|
source.roomNumber = room;
|
||||||
target.x = x + SIN(16 * angle);
|
target.x = x + phd_sin(16 * angle);
|
||||||
target.y = y;
|
target.y = y;
|
||||||
target.z = z + COS(16 * angle);
|
target.z = z + phd_cos(16 * angle);
|
||||||
if (!LOS(&source, &target))
|
if (!LOS(&source, &target))
|
||||||
TriggerDynamicLight(target.x, target.y, target.z, falloff, r, g, b);
|
TriggerDynamicLight(target.x, target.y, target.z, falloff, r, g, b);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#include "control.h"
|
#include "control.h"
|
||||||
#include "sphere.h"
|
#include "sphere.h"
|
||||||
#include "debris.h"
|
#include "debris.h"
|
||||||
|
#include "lara.h"
|
||||||
|
#include "sound.h"
|
||||||
#include "box.h"
|
#include "box.h"
|
||||||
|
|
||||||
int ShotLara(ITEM_INFO* item, AI_INFO* info, BITE_INFO* gun, short extra_rotation, int damage)
|
int ShotLara(ITEM_INFO* item, AI_INFO* info, BITE_INFO* gun, short extra_rotation, int damage)
|
||||||
|
@ -18,7 +20,7 @@ int ShotLara(ITEM_INFO* item, AI_INFO* info, BITE_INFO* gun, short extra_rotatio
|
||||||
|
|
||||||
if (info->distance <= SQUARE(8192) && Targetable(item, info))
|
if (info->distance <= SQUARE(8192) && Targetable(item, info))
|
||||||
{
|
{
|
||||||
int distance = SIN(info->enemyFacing) * enemy->speed >> W2V_SHIFT * SQUARE(8192) / 300;
|
int distance = phd_sin(info->enemyFacing) * enemy->speed >> W2V_SHIFT * SQUARE(8192) / 300;
|
||||||
distance = info->distance + SQUARE(distance);
|
distance = info->distance + SQUARE(distance);
|
||||||
if (distance <= SQUARE(8192))
|
if (distance <= SQUARE(8192))
|
||||||
{
|
{
|
||||||
|
@ -102,7 +104,7 @@ short GunHit(int x, int y, int z, short speed, short yrot, short roomNumber)
|
||||||
pos.y = 0;
|
pos.y = 0;
|
||||||
pos.z = 0;
|
pos.z = 0;
|
||||||
|
|
||||||
GetJointAbsPosition(LaraItem, &pos, (25 * GetRandomControl()) >> 15);
|
GetLaraJointPosition(&pos, (25 * GetRandomControl()) >> 15);
|
||||||
|
|
||||||
DoBloodSplat(pos.x, pos.y, pos.z, (GetRandomControl() & 3) + 3, LaraItem->pos.yRot, LaraItem->roomNumber);
|
DoBloodSplat(pos.x, pos.y, pos.z, (GetRandomControl() & 3) + 3, LaraItem->pos.yRot, LaraItem->roomNumber);
|
||||||
SoundEffect(SFX_LARA_INJURY_RND, &LaraItem->pos, 0);
|
SoundEffect(SFX_LARA_INJURY_RND, &LaraItem->pos, 0);
|
||||||
|
@ -173,14 +175,4 @@ int TargetVisible(ITEM_INFO* item, AI_INFO* info)
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
void Inject_People()
|
|
||||||
{
|
|
||||||
INJECT(0x00467610, ShotLara);
|
|
||||||
INJECT(0x00467530, GunMiss);
|
|
||||||
INJECT(0x004673D1, GunHit);
|
|
||||||
INJECT(0x00467420, GunShot);
|
|
||||||
INJECT(0x004672F0, Targetable);
|
|
||||||
INJECT(0x004671E0, TargetVisible);
|
|
||||||
}
|
}
|
|
@ -8,5 +8,3 @@ short GunHit(int x, int y, int z, short speed, short yrot, short roomNumber);
|
||||||
short GunShot(int x, int y, int z, short speed, short yrot, short roomNumber);
|
short GunShot(int x, int y, int z, short speed, short yrot, short roomNumber);
|
||||||
int Targetable(ITEM_INFO* item, AI_INFO* info);
|
int Targetable(ITEM_INFO* item, AI_INFO* info);
|
||||||
int TargetVisible(ITEM_INFO* item, AI_INFO* info);
|
int TargetVisible(ITEM_INFO* item, AI_INFO* info);
|
||||||
|
|
||||||
void Inject_People();
|
|
|
@ -19,6 +19,10 @@
|
||||||
#include "flmtorch.h"
|
#include "flmtorch.h"
|
||||||
#include "../Specific/setup.h"
|
#include "../Specific/setup.h"
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
|
#include "..\Specific\level.h"
|
||||||
|
#include "../Specific/input.h"
|
||||||
|
#include "sound.h"
|
||||||
|
#include "savegame.h"
|
||||||
|
|
||||||
#include "..\Global\global.h"
|
#include "..\Global\global.h"
|
||||||
|
|
||||||
|
@ -98,7 +102,7 @@ short RPickups[16];
|
||||||
PHD_VECTOR OldPickupPos;
|
PHD_VECTOR OldPickupPos;
|
||||||
|
|
||||||
extern int KeyTriggerActive;
|
extern int KeyTriggerActive;
|
||||||
extern LaraExtraInfo g_LaraExtra;
|
|
||||||
extern Inventory* g_Inventory;
|
extern Inventory* g_Inventory;
|
||||||
|
|
||||||
void PickedUpObject(short objectNumber)
|
void PickedUpObject(short objectNumber)
|
||||||
|
@ -106,273 +110,273 @@ void PickedUpObject(short objectNumber)
|
||||||
switch (objectNumber)
|
switch (objectNumber)
|
||||||
{
|
{
|
||||||
case ID_UZI_ITEM:
|
case ID_UZI_ITEM:
|
||||||
if (!(g_LaraExtra.Weapons[WEAPON_UZI].Present))
|
if (!(Lara.Weapons[WEAPON_UZI].Present))
|
||||||
{
|
{
|
||||||
g_LaraExtra.Weapons[WEAPON_UZI].Present = true;
|
Lara.Weapons[WEAPON_UZI].Present = true;
|
||||||
g_LaraExtra.Weapons[WEAPON_UZI].SelectedAmmo = 0;
|
Lara.Weapons[WEAPON_UZI].SelectedAmmo = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_LaraExtra.Weapons[WEAPON_UZI].Ammo[0] != -1)
|
if (Lara.Weapons[WEAPON_UZI].Ammo[0] != -1)
|
||||||
g_LaraExtra.Weapons[WEAPON_UZI].Ammo[0] += 30;
|
Lara.Weapons[WEAPON_UZI].Ammo[0] += 30;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_PISTOLS_ITEM:
|
case ID_PISTOLS_ITEM:
|
||||||
if (!(g_LaraExtra.Weapons[WEAPON_PISTOLS].Present))
|
if (!(Lara.Weapons[WEAPON_PISTOLS].Present))
|
||||||
{
|
{
|
||||||
g_LaraExtra.Weapons[WEAPON_PISTOLS].Present = true;
|
Lara.Weapons[WEAPON_PISTOLS].Present = true;
|
||||||
g_LaraExtra.Weapons[WEAPON_PISTOLS].SelectedAmmo = 0;
|
Lara.Weapons[WEAPON_PISTOLS].SelectedAmmo = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_LaraExtra.Weapons[WEAPON_PISTOLS].Ammo[0] = -1;
|
Lara.Weapons[WEAPON_PISTOLS].Ammo[0] = -1;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_SHOTGUN_ITEM:
|
case ID_SHOTGUN_ITEM:
|
||||||
if (!(g_LaraExtra.Weapons[WEAPON_SHOTGUN].Present))
|
if (!(Lara.Weapons[WEAPON_SHOTGUN].Present))
|
||||||
{
|
{
|
||||||
g_LaraExtra.Weapons[WEAPON_SHOTGUN].Present = true;
|
Lara.Weapons[WEAPON_SHOTGUN].Present = true;
|
||||||
g_LaraExtra.Weapons[WEAPON_SHOTGUN].SelectedAmmo = 0;
|
Lara.Weapons[WEAPON_SHOTGUN].SelectedAmmo = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_LaraExtra.Weapons[WEAPON_SHOTGUN].Ammo[0] != -1)
|
if (Lara.Weapons[WEAPON_SHOTGUN].Ammo[0] != -1)
|
||||||
g_LaraExtra.Weapons[WEAPON_SHOTGUN].Ammo[0] += 36;
|
Lara.Weapons[WEAPON_SHOTGUN].Ammo[0] += 36;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_REVOLVER_ITEM:
|
case ID_REVOLVER_ITEM:
|
||||||
if (!(g_LaraExtra.Weapons[WEAPON_REVOLVER].Present))
|
if (!(Lara.Weapons[WEAPON_REVOLVER].Present))
|
||||||
{
|
{
|
||||||
g_LaraExtra.Weapons[WEAPON_REVOLVER].Present = true;
|
Lara.Weapons[WEAPON_REVOLVER].Present = true;
|
||||||
g_LaraExtra.Weapons[WEAPON_REVOLVER].SelectedAmmo = 0;
|
Lara.Weapons[WEAPON_REVOLVER].SelectedAmmo = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_LaraExtra.Weapons[WEAPON_REVOLVER].Ammo[0] != -1)
|
if (Lara.Weapons[WEAPON_REVOLVER].Ammo[0] != -1)
|
||||||
g_LaraExtra.Weapons[WEAPON_REVOLVER].Ammo[0] += 6;
|
Lara.Weapons[WEAPON_REVOLVER].Ammo[0] += 6;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_CROSSBOW_ITEM:
|
case ID_CROSSBOW_ITEM:
|
||||||
if (!(g_LaraExtra.Weapons[WEAPON_CROSSBOW].Present))
|
if (!(Lara.Weapons[WEAPON_CROSSBOW].Present))
|
||||||
{
|
{
|
||||||
g_LaraExtra.Weapons[WEAPON_CROSSBOW].Present = true;
|
Lara.Weapons[WEAPON_CROSSBOW].Present = true;
|
||||||
g_LaraExtra.Weapons[WEAPON_CROSSBOW].SelectedAmmo = 0;
|
Lara.Weapons[WEAPON_CROSSBOW].SelectedAmmo = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_LaraExtra.Weapons[WEAPON_CROSSBOW].Ammo[0] != -1)
|
if (Lara.Weapons[WEAPON_CROSSBOW].Ammo[0] != -1)
|
||||||
g_LaraExtra.Weapons[WEAPON_CROSSBOW].Ammo[0] += 10;
|
Lara.Weapons[WEAPON_CROSSBOW].Ammo[0] += 10;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_HK_ITEM:
|
case ID_HK_ITEM:
|
||||||
if (!(g_LaraExtra.Weapons[WEAPON_CROSSBOW].Present))
|
if (!(Lara.Weapons[WEAPON_CROSSBOW].Present))
|
||||||
{
|
{
|
||||||
g_LaraExtra.Weapons[WEAPON_HK].Present = true;
|
Lara.Weapons[WEAPON_HK].Present = true;
|
||||||
g_LaraExtra.Weapons[WEAPON_HK].SelectedAmmo = 0;
|
Lara.Weapons[WEAPON_HK].SelectedAmmo = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_LaraExtra.Weapons[WEAPON_HK].Ammo[0] != -1)
|
if (Lara.Weapons[WEAPON_HK].Ammo[0] != -1)
|
||||||
g_LaraExtra.Weapons[WEAPON_HK].Ammo[0] += 30;
|
Lara.Weapons[WEAPON_HK].Ammo[0] += 30;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_HARPOON_ITEM:
|
case ID_HARPOON_ITEM:
|
||||||
if (!(g_LaraExtra.Weapons[WEAPON_HARPOON_GUN].Present))
|
if (!(Lara.Weapons[WEAPON_HARPOON_GUN].Present))
|
||||||
{
|
{
|
||||||
g_LaraExtra.Weapons[WEAPON_HARPOON_GUN].Present = true;
|
Lara.Weapons[WEAPON_HARPOON_GUN].Present = true;
|
||||||
g_LaraExtra.Weapons[WEAPON_HARPOON_GUN].SelectedAmmo = 0;
|
Lara.Weapons[WEAPON_HARPOON_GUN].SelectedAmmo = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_LaraExtra.Weapons[WEAPON_HARPOON_GUN].Ammo[0] != -1)
|
if (Lara.Weapons[WEAPON_HARPOON_GUN].Ammo[0] != -1)
|
||||||
g_LaraExtra.Weapons[WEAPON_HARPOON_GUN].Ammo[0] += 10;
|
Lara.Weapons[WEAPON_HARPOON_GUN].Ammo[0] += 10;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_GRENADE_GUN_ITEM:
|
case ID_GRENADE_GUN_ITEM:
|
||||||
if (!(g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Present))
|
if (!(Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Present))
|
||||||
{
|
{
|
||||||
g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Present = true;
|
Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Present = true;
|
||||||
g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].SelectedAmmo = 0;
|
Lara.Weapons[WEAPON_GRENADE_LAUNCHER].SelectedAmmo = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[0] != -1)
|
if (Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[0] != -1)
|
||||||
g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[0] += 10;
|
Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[0] += 10;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_ROCKET_LAUNCHER_ITEM:
|
case ID_ROCKET_LAUNCHER_ITEM:
|
||||||
if (!(g_LaraExtra.Weapons[WEAPON_ROCKET_LAUNCHER].Present))
|
if (!(Lara.Weapons[WEAPON_ROCKET_LAUNCHER].Present))
|
||||||
{
|
{
|
||||||
g_LaraExtra.Weapons[WEAPON_ROCKET_LAUNCHER].Present = true;
|
Lara.Weapons[WEAPON_ROCKET_LAUNCHER].Present = true;
|
||||||
g_LaraExtra.Weapons[WEAPON_ROCKET_LAUNCHER].SelectedAmmo = 0;
|
Lara.Weapons[WEAPON_ROCKET_LAUNCHER].SelectedAmmo = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_LaraExtra.Weapons[WEAPON_ROCKET_LAUNCHER].Ammo[0] != -1)
|
if (Lara.Weapons[WEAPON_ROCKET_LAUNCHER].Ammo[0] != -1)
|
||||||
g_LaraExtra.Weapons[WEAPON_ROCKET_LAUNCHER].Ammo[0] += 10;
|
Lara.Weapons[WEAPON_ROCKET_LAUNCHER].Ammo[0] += 10;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_SHOTGUN_AMMO1_ITEM:
|
case ID_SHOTGUN_AMMO1_ITEM:
|
||||||
if (g_LaraExtra.Weapons[WEAPON_SHOTGUN].Ammo[0] != -1)
|
if (Lara.Weapons[WEAPON_SHOTGUN].Ammo[0] != -1)
|
||||||
g_LaraExtra.Weapons[WEAPON_SHOTGUN].Ammo[0] += 36;
|
Lara.Weapons[WEAPON_SHOTGUN].Ammo[0] += 36;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_SHOTGUN_AMMO2_ITEM:
|
case ID_SHOTGUN_AMMO2_ITEM:
|
||||||
if (g_LaraExtra.Weapons[WEAPON_SHOTGUN].Ammo[1] != -1)
|
if (Lara.Weapons[WEAPON_SHOTGUN].Ammo[1] != -1)
|
||||||
g_LaraExtra.Weapons[WEAPON_SHOTGUN].Ammo[1] += 36;
|
Lara.Weapons[WEAPON_SHOTGUN].Ammo[1] += 36;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_HK_AMMO_ITEM:
|
case ID_HK_AMMO_ITEM:
|
||||||
if (g_LaraExtra.Weapons[WEAPON_HK].Ammo[0] != -1)
|
if (Lara.Weapons[WEAPON_HK].Ammo[0] != -1)
|
||||||
g_LaraExtra.Weapons[WEAPON_HK].Ammo[0] += 30;
|
Lara.Weapons[WEAPON_HK].Ammo[0] += 30;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_CROSSBOW_AMMO1_ITEM:
|
case ID_CROSSBOW_AMMO1_ITEM:
|
||||||
if (g_LaraExtra.Weapons[WEAPON_CROSSBOW].Ammo[0] != -1)
|
if (Lara.Weapons[WEAPON_CROSSBOW].Ammo[0] != -1)
|
||||||
g_LaraExtra.Weapons[WEAPON_CROSSBOW].Ammo[0] += 10;
|
Lara.Weapons[WEAPON_CROSSBOW].Ammo[0] += 10;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_CROSSBOW_AMMO2_ITEM:
|
case ID_CROSSBOW_AMMO2_ITEM:
|
||||||
if (g_LaraExtra.Weapons[WEAPON_CROSSBOW].Ammo[1] != -1)
|
if (Lara.Weapons[WEAPON_CROSSBOW].Ammo[1] != -1)
|
||||||
g_LaraExtra.Weapons[WEAPON_CROSSBOW].Ammo[1] += 10;
|
Lara.Weapons[WEAPON_CROSSBOW].Ammo[1] += 10;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_CROSSBOW_AMMO3_ITEM:
|
case ID_CROSSBOW_AMMO3_ITEM:
|
||||||
if (g_LaraExtra.Weapons[WEAPON_CROSSBOW].Ammo[2] != -1)
|
if (Lara.Weapons[WEAPON_CROSSBOW].Ammo[2] != -1)
|
||||||
g_LaraExtra.Weapons[WEAPON_CROSSBOW].Ammo[2] += 10;
|
Lara.Weapons[WEAPON_CROSSBOW].Ammo[2] += 10;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_GRENADE_AMMO1_ITEM:
|
case ID_GRENADE_AMMO1_ITEM:
|
||||||
if (g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[0] != -1)
|
if (Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[0] != -1)
|
||||||
g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[0] += 10;
|
Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[0] += 10;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_GRENADE_AMMO2_ITEM:
|
case ID_GRENADE_AMMO2_ITEM:
|
||||||
if (g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[1] != -1)
|
if (Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[1] != -1)
|
||||||
g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[1] += 10;
|
Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[1] += 10;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_GRENADE_AMMO3_ITEM:
|
case ID_GRENADE_AMMO3_ITEM:
|
||||||
if (g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[2] != -1)
|
if (Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[2] != -1)
|
||||||
g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[2] += 10;
|
Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[2] += 10;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_REVOLVER_AMMO_ITEM:
|
case ID_REVOLVER_AMMO_ITEM:
|
||||||
if (g_LaraExtra.Weapons[WEAPON_REVOLVER].Ammo[0] != -1)
|
if (Lara.Weapons[WEAPON_REVOLVER].Ammo[0] != -1)
|
||||||
g_LaraExtra.Weapons[WEAPON_REVOLVER].Ammo[0] += 6;
|
Lara.Weapons[WEAPON_REVOLVER].Ammo[0] += 6;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_ROCKET_LAUNCHER_AMMO_ITEM:
|
case ID_ROCKET_LAUNCHER_AMMO_ITEM:
|
||||||
if (g_LaraExtra.Weapons[WEAPON_ROCKET_LAUNCHER].Ammo[0] != -1)
|
if (Lara.Weapons[WEAPON_ROCKET_LAUNCHER].Ammo[0] != -1)
|
||||||
g_LaraExtra.Weapons[WEAPON_ROCKET_LAUNCHER].Ammo[0] += 10;
|
Lara.Weapons[WEAPON_ROCKET_LAUNCHER].Ammo[0] += 10;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_HARPOON_AMMO_ITEM:
|
case ID_HARPOON_AMMO_ITEM:
|
||||||
if (g_LaraExtra.Weapons[WEAPON_HARPOON_GUN].Ammo[0] != -1)
|
if (Lara.Weapons[WEAPON_HARPOON_GUN].Ammo[0] != -1)
|
||||||
g_LaraExtra.Weapons[WEAPON_HARPOON_GUN].Ammo[0] += 10;
|
Lara.Weapons[WEAPON_HARPOON_GUN].Ammo[0] += 10;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_UZI_AMMO_ITEM:
|
case ID_UZI_AMMO_ITEM:
|
||||||
if (g_LaraExtra.Weapons[WEAPON_UZI].Ammo[0] != -1)
|
if (Lara.Weapons[WEAPON_UZI].Ammo[0] != -1)
|
||||||
g_LaraExtra.Weapons[WEAPON_UZI].Ammo[0] += 30;
|
Lara.Weapons[WEAPON_UZI].Ammo[0] += 30;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_FLARE_INV_ITEM:
|
case ID_FLARE_INV_ITEM:
|
||||||
if (g_LaraExtra.NumFlares != -1)
|
if (Lara.NumFlares != -1)
|
||||||
g_LaraExtra.NumFlares += 12;
|
Lara.NumFlares += 12;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_SILENCER_ITEM:
|
case ID_SILENCER_ITEM:
|
||||||
if (!(g_LaraExtra.Weapons[WEAPON_UZI].HasSilencer || g_LaraExtra.Weapons[WEAPON_PISTOLS].HasSilencer ||
|
if (!(Lara.Weapons[WEAPON_UZI].HasSilencer || Lara.Weapons[WEAPON_PISTOLS].HasSilencer ||
|
||||||
g_LaraExtra.Weapons[WEAPON_SHOTGUN].HasSilencer || g_LaraExtra.Weapons[WEAPON_REVOLVER].HasSilencer ||
|
Lara.Weapons[WEAPON_SHOTGUN].HasSilencer || Lara.Weapons[WEAPON_REVOLVER].HasSilencer ||
|
||||||
g_LaraExtra.Weapons[WEAPON_CROSSBOW].HasSilencer || g_LaraExtra.Weapons[WEAPON_HK].HasSilencer))
|
Lara.Weapons[WEAPON_CROSSBOW].HasSilencer || Lara.Weapons[WEAPON_HK].HasSilencer))
|
||||||
g_LaraExtra.Silencer = true;
|
Lara.Silencer = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_LASERSIGHT_ITEM:
|
case ID_LASERSIGHT_ITEM:
|
||||||
if (!(g_LaraExtra.Weapons[WEAPON_UZI].HasSilencer || g_LaraExtra.Weapons[WEAPON_PISTOLS].HasSilencer ||
|
if (!(Lara.Weapons[WEAPON_UZI].HasSilencer || Lara.Weapons[WEAPON_PISTOLS].HasSilencer ||
|
||||||
g_LaraExtra.Weapons[WEAPON_SHOTGUN].HasSilencer || g_LaraExtra.Weapons[WEAPON_REVOLVER].HasSilencer ||
|
Lara.Weapons[WEAPON_SHOTGUN].HasSilencer || Lara.Weapons[WEAPON_REVOLVER].HasSilencer ||
|
||||||
g_LaraExtra.Weapons[WEAPON_CROSSBOW].HasSilencer || g_LaraExtra.Weapons[WEAPON_HK].HasSilencer))
|
Lara.Weapons[WEAPON_CROSSBOW].HasSilencer || Lara.Weapons[WEAPON_HK].HasSilencer))
|
||||||
g_LaraExtra.Lasersight = true;
|
Lara.Lasersight = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_BIGMEDI_ITEM:
|
case ID_BIGMEDI_ITEM:
|
||||||
if (g_LaraExtra.NumLargeMedipacks != -1)
|
if (Lara.NumLargeMedipacks != -1)
|
||||||
g_LaraExtra.NumLargeMedipacks++;
|
Lara.NumLargeMedipacks++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_SMALLMEDI_ITEM:
|
case ID_SMALLMEDI_ITEM:
|
||||||
if (g_LaraExtra.NumSmallMedipacks != -1)
|
if (Lara.NumSmallMedipacks != -1)
|
||||||
g_LaraExtra.NumSmallMedipacks++;
|
Lara.NumSmallMedipacks++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_BINOCULARS_ITEM:
|
case ID_BINOCULARS_ITEM:
|
||||||
g_LaraExtra.Binoculars = true;
|
Lara.Binoculars = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_WATERSKIN1_EMPTY:
|
case ID_WATERSKIN1_EMPTY:
|
||||||
g_LaraExtra.Waterskin1.Present = true;
|
Lara.Waterskin1.Present = true;
|
||||||
g_LaraExtra.Waterskin1.Quantity = 0;
|
Lara.Waterskin1.Quantity = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_WATERSKIN2_EMPTY:
|
case ID_WATERSKIN2_EMPTY:
|
||||||
g_LaraExtra.Waterskin2.Present = true;
|
Lara.Waterskin2.Present = true;
|
||||||
g_LaraExtra.Waterskin2.Quantity = 0;
|
Lara.Waterskin2.Quantity = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_GOLDROSE_ITEM:
|
case ID_GOLDROSE_ITEM:
|
||||||
IsAtmospherePlaying = 0;
|
IsAtmospherePlaying = 0;
|
||||||
S_CDPlay(6, 0);
|
S_CDPlay(6, 0);
|
||||||
g_LaraExtra.Secrets++;
|
Lara.Secrets++;
|
||||||
Savegame.Level.Secrets++;
|
Savegame.Level.Secrets++;
|
||||||
Savegame.Game.Secrets++;
|
Savegame.Game.Secrets++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_CROWBAR_ITEM:
|
case ID_CROWBAR_ITEM:
|
||||||
g_LaraExtra.Crowbar = true;
|
Lara.Crowbar = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_DIARY_ITEM:
|
case ID_DIARY_ITEM:
|
||||||
g_LaraExtra.Diary.Present = true;
|
Lara.Diary.Present = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (objectNumber >= ID_PUZZLE_ITEM1 && objectNumber <= ID_PUZZLE_ITEM8)
|
if (objectNumber >= ID_PUZZLE_ITEM1 && objectNumber <= ID_PUZZLE_ITEM8)
|
||||||
g_LaraExtra.Puzzles[objectNumber - ID_PUZZLE_ITEM1]++;
|
Lara.Puzzles[objectNumber - ID_PUZZLE_ITEM1]++;
|
||||||
|
|
||||||
else if (objectNumber >= ID_PUZZLE_ITEM1_COMBO1 && objectNumber <= ID_PUZZLE_ITEM8_COMBO2)
|
else if (objectNumber >= ID_PUZZLE_ITEM1_COMBO1 && objectNumber <= ID_PUZZLE_ITEM8_COMBO2)
|
||||||
g_LaraExtra.PuzzlesCombo[objectNumber - ID_PUZZLE_ITEM1_COMBO1]++;
|
Lara.PuzzlesCombo[objectNumber - ID_PUZZLE_ITEM1_COMBO1]++;
|
||||||
|
|
||||||
else if (objectNumber >= ID_KEY_ITEM1 && objectNumber <= ID_KEY_ITEM8)
|
else if (objectNumber >= ID_KEY_ITEM1 && objectNumber <= ID_KEY_ITEM8)
|
||||||
g_LaraExtra.Keys[objectNumber - ID_KEY_ITEM1]++;
|
Lara.Keys[objectNumber - ID_KEY_ITEM1]++;
|
||||||
|
|
||||||
else if (objectNumber >= ID_KEY_ITEM1_COMBO1 && objectNumber <= ID_KEY_ITEM8_COMBO2)
|
else if (objectNumber >= ID_KEY_ITEM1_COMBO1 && objectNumber <= ID_KEY_ITEM8_COMBO2)
|
||||||
g_LaraExtra.KeysCombo[objectNumber - ID_KEY_ITEM1_COMBO1]++;
|
Lara.KeysCombo[objectNumber - ID_KEY_ITEM1_COMBO1]++;
|
||||||
|
|
||||||
else if (objectNumber >= ID_PICKUP_ITEM1 && objectNumber <= ID_PICKUP_ITEM4)
|
else if (objectNumber >= ID_PICKUP_ITEM1 && objectNumber <= ID_PICKUP_ITEM4)
|
||||||
g_LaraExtra.Pickups[objectNumber - ID_PICKUP_ITEM1]++;
|
Lara.Pickups[objectNumber - ID_PICKUP_ITEM1]++;
|
||||||
|
|
||||||
else if (objectNumber >= ID_PICKUP_ITEM1_COMBO1 && objectNumber <= ID_PICKUP_ITEM4_COMBO2)
|
else if (objectNumber >= ID_PICKUP_ITEM1_COMBO1 && objectNumber <= ID_PICKUP_ITEM4_COMBO2)
|
||||||
g_LaraExtra.PickupsCombo[objectNumber - ID_PICKUP_ITEM1_COMBO1]++;
|
Lara.PickupsCombo[objectNumber - ID_PICKUP_ITEM1_COMBO1]++;
|
||||||
|
|
||||||
else if (objectNumber >= ID_EXAMINE1 && objectNumber <= ID_EXAMINE3)
|
else if (objectNumber >= ID_EXAMINE1 && objectNumber <= ID_EXAMINE3)
|
||||||
g_LaraExtra.Examines[objectNumber - ID_EXAMINE1] = 1;
|
Lara.Examines[objectNumber - ID_EXAMINE1] = 1;
|
||||||
|
|
||||||
else if (objectNumber >= ID_EXAMINE1_COMBO1 && objectNumber <= ID_EXAMINE3_COMBO2)
|
else if (objectNumber >= ID_EXAMINE1_COMBO1 && objectNumber <= ID_EXAMINE3_COMBO2)
|
||||||
g_LaraExtra.ExaminesCombo[objectNumber - ID_EXAMINE1_COMBO1] = 1;
|
Lara.ExaminesCombo[objectNumber - ID_EXAMINE1_COMBO1] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_Inventory->LoadObjects(false);
|
g_Inventory->LoadObjects(false);
|
||||||
|
@ -381,28 +385,28 @@ void PickedUpObject(short objectNumber)
|
||||||
void RemoveObjectFromInventory(short objectNumber, int count)
|
void RemoveObjectFromInventory(short objectNumber, int count)
|
||||||
{
|
{
|
||||||
if (objectNumber >= ID_PUZZLE_ITEM1 && objectNumber <= ID_PUZZLE_ITEM8)
|
if (objectNumber >= ID_PUZZLE_ITEM1 && objectNumber <= ID_PUZZLE_ITEM8)
|
||||||
g_LaraExtra.Puzzles[objectNumber - ID_PUZZLE_ITEM1] -= min(count, g_LaraExtra.Puzzles[objectNumber - ID_PUZZLE_ITEM1]);
|
Lara.Puzzles[objectNumber - ID_PUZZLE_ITEM1] -= min(count, Lara.Puzzles[objectNumber - ID_PUZZLE_ITEM1]);
|
||||||
|
|
||||||
else if (objectNumber >= ID_PUZZLE_ITEM1_COMBO1 && objectNumber <= ID_PUZZLE_ITEM8_COMBO2)
|
else if (objectNumber >= ID_PUZZLE_ITEM1_COMBO1 && objectNumber <= ID_PUZZLE_ITEM8_COMBO2)
|
||||||
g_LaraExtra.PuzzlesCombo[objectNumber - ID_PUZZLE_ITEM1_COMBO1] -= min(count, g_LaraExtra.PuzzlesCombo[objectNumber - ID_PUZZLE_ITEM1_COMBO1]);
|
Lara.PuzzlesCombo[objectNumber - ID_PUZZLE_ITEM1_COMBO1] -= min(count, Lara.PuzzlesCombo[objectNumber - ID_PUZZLE_ITEM1_COMBO1]);
|
||||||
|
|
||||||
else if (objectNumber >= ID_KEY_ITEM1 && objectNumber <= ID_KEY_ITEM8)
|
else if (objectNumber >= ID_KEY_ITEM1 && objectNumber <= ID_KEY_ITEM8)
|
||||||
g_LaraExtra.Keys[objectNumber - ID_KEY_ITEM1] -= min(count, g_LaraExtra.Keys[objectNumber - ID_KEY_ITEM1]);
|
Lara.Keys[objectNumber - ID_KEY_ITEM1] -= min(count, Lara.Keys[objectNumber - ID_KEY_ITEM1]);
|
||||||
|
|
||||||
else if (objectNumber >= ID_KEY_ITEM1_COMBO1 && objectNumber <= ID_KEY_ITEM8_COMBO2)
|
else if (objectNumber >= ID_KEY_ITEM1_COMBO1 && objectNumber <= ID_KEY_ITEM8_COMBO2)
|
||||||
g_LaraExtra.KeysCombo[objectNumber - ID_KEY_ITEM1_COMBO1] -= min(count, g_LaraExtra.KeysCombo[objectNumber - ID_KEY_ITEM1_COMBO1]);
|
Lara.KeysCombo[objectNumber - ID_KEY_ITEM1_COMBO1] -= min(count, Lara.KeysCombo[objectNumber - ID_KEY_ITEM1_COMBO1]);
|
||||||
|
|
||||||
else if (objectNumber >= ID_PICKUP_ITEM1 && objectNumber <= ID_PICKUP_ITEM4)
|
else if (objectNumber >= ID_PICKUP_ITEM1 && objectNumber <= ID_PICKUP_ITEM4)
|
||||||
g_LaraExtra.Pickups[objectNumber - ID_PICKUP_ITEM1] -= min(count, g_LaraExtra.Pickups[objectNumber - ID_PICKUP_ITEM1]);
|
Lara.Pickups[objectNumber - ID_PICKUP_ITEM1] -= min(count, Lara.Pickups[objectNumber - ID_PICKUP_ITEM1]);
|
||||||
|
|
||||||
else if (objectNumber >= ID_PICKUP_ITEM1_COMBO1 && objectNumber <= ID_PICKUP_ITEM4_COMBO2)
|
else if (objectNumber >= ID_PICKUP_ITEM1_COMBO1 && objectNumber <= ID_PICKUP_ITEM4_COMBO2)
|
||||||
g_LaraExtra.PickupsCombo[objectNumber - ID_PICKUP_ITEM1_COMBO1] -= min(count, g_LaraExtra.PickupsCombo[objectNumber - ID_PICKUP_ITEM1_COMBO1]);
|
Lara.PickupsCombo[objectNumber - ID_PICKUP_ITEM1_COMBO1] -= min(count, Lara.PickupsCombo[objectNumber - ID_PICKUP_ITEM1_COMBO1]);
|
||||||
|
|
||||||
else if (objectNumber >= ID_EXAMINE1 && objectNumber <= ID_EXAMINE3)
|
else if (objectNumber >= ID_EXAMINE1 && objectNumber <= ID_EXAMINE3)
|
||||||
g_LaraExtra.Examines[objectNumber - ID_EXAMINE1] = 0;
|
Lara.Examines[objectNumber - ID_EXAMINE1] = 0;
|
||||||
|
|
||||||
else if (objectNumber >= ID_EXAMINE1_COMBO1 && objectNumber <= ID_EXAMINE3_COMBO2)
|
else if (objectNumber >= ID_EXAMINE1_COMBO1 && objectNumber <= ID_EXAMINE3_COMBO2)
|
||||||
g_LaraExtra.PickupsCombo[objectNumber - ID_EXAMINE1_COMBO1] = 0;
|
Lara.PickupsCombo[objectNumber - ID_EXAMINE1_COMBO1] = 0;
|
||||||
|
|
||||||
g_Inventory->LoadObjects(false);
|
g_Inventory->LoadObjects(false);
|
||||||
}
|
}
|
||||||
|
@ -1238,38 +1242,38 @@ void RegeneratePickups()
|
||||||
short ammo = 0;
|
short ammo = 0;
|
||||||
|
|
||||||
if (item->objectNumber == ID_CROSSBOW_AMMO1_ITEM)
|
if (item->objectNumber == ID_CROSSBOW_AMMO1_ITEM)
|
||||||
ammo = g_LaraExtra.Weapons[WEAPON_CROSSBOW].Ammo[WEAPON_AMMO1];
|
ammo = Lara.Weapons[WEAPON_CROSSBOW].Ammo[WEAPON_AMMO1];
|
||||||
else if (item->objectNumber == ID_CROSSBOW_AMMO2_ITEM)
|
else if (item->objectNumber == ID_CROSSBOW_AMMO2_ITEM)
|
||||||
ammo = g_LaraExtra.Weapons[WEAPON_CROSSBOW].Ammo[WEAPON_AMMO2];
|
ammo = Lara.Weapons[WEAPON_CROSSBOW].Ammo[WEAPON_AMMO2];
|
||||||
else if (item->objectNumber == ID_CROSSBOW_AMMO3_ITEM)
|
else if (item->objectNumber == ID_CROSSBOW_AMMO3_ITEM)
|
||||||
ammo = g_LaraExtra.Weapons[WEAPON_CROSSBOW].Ammo[WEAPON_AMMO3];
|
ammo = Lara.Weapons[WEAPON_CROSSBOW].Ammo[WEAPON_AMMO3];
|
||||||
|
|
||||||
else if(item->objectNumber == ID_GRENADE_AMMO1_ITEM)
|
else if(item->objectNumber == ID_GRENADE_AMMO1_ITEM)
|
||||||
ammo = g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[WEAPON_AMMO1];
|
ammo = Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[WEAPON_AMMO1];
|
||||||
else if (item->objectNumber == ID_GRENADE_AMMO2_ITEM)
|
else if (item->objectNumber == ID_GRENADE_AMMO2_ITEM)
|
||||||
ammo = g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[WEAPON_AMMO2];
|
ammo = Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[WEAPON_AMMO2];
|
||||||
else if (item->objectNumber == ID_GRENADE_AMMO3_ITEM)
|
else if (item->objectNumber == ID_GRENADE_AMMO3_ITEM)
|
||||||
ammo = g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[WEAPON_AMMO3];
|
ammo = Lara.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[WEAPON_AMMO3];
|
||||||
|
|
||||||
else if (item->objectNumber == ID_HK_AMMO_ITEM)
|
else if (item->objectNumber == ID_HK_AMMO_ITEM)
|
||||||
ammo = g_LaraExtra.Weapons[WEAPON_HK].Ammo[WEAPON_AMMO1];
|
ammo = Lara.Weapons[WEAPON_HK].Ammo[WEAPON_AMMO1];
|
||||||
|
|
||||||
else if (item->objectNumber == ID_UZI_AMMO_ITEM)
|
else if (item->objectNumber == ID_UZI_AMMO_ITEM)
|
||||||
ammo = g_LaraExtra.Weapons[WEAPON_UZI].Ammo[WEAPON_AMMO1];
|
ammo = Lara.Weapons[WEAPON_UZI].Ammo[WEAPON_AMMO1];
|
||||||
|
|
||||||
else if (item->objectNumber == ID_HARPOON_AMMO_ITEM)
|
else if (item->objectNumber == ID_HARPOON_AMMO_ITEM)
|
||||||
ammo = g_LaraExtra.Weapons[WEAPON_HARPOON_GUN].Ammo[WEAPON_AMMO1];
|
ammo = Lara.Weapons[WEAPON_HARPOON_GUN].Ammo[WEAPON_AMMO1];
|
||||||
|
|
||||||
else if (item->objectNumber == ID_ROCKET_LAUNCHER_AMMO_ITEM)
|
else if (item->objectNumber == ID_ROCKET_LAUNCHER_AMMO_ITEM)
|
||||||
ammo = g_LaraExtra.Weapons[WEAPON_ROCKET_LAUNCHER].Ammo[WEAPON_AMMO1];
|
ammo = Lara.Weapons[WEAPON_ROCKET_LAUNCHER].Ammo[WEAPON_AMMO1];
|
||||||
|
|
||||||
else if (item->objectNumber == ID_REVOLVER_AMMO_ITEM)
|
else if (item->objectNumber == ID_REVOLVER_AMMO_ITEM)
|
||||||
ammo = g_LaraExtra.Weapons[WEAPON_REVOLVER].Ammo[WEAPON_AMMO1];
|
ammo = Lara.Weapons[WEAPON_REVOLVER].Ammo[WEAPON_AMMO1];
|
||||||
|
|
||||||
else if (item->objectNumber == ID_SHOTGUN_AMMO1_ITEM)
|
else if (item->objectNumber == ID_SHOTGUN_AMMO1_ITEM)
|
||||||
ammo = g_LaraExtra.Weapons[WEAPON_SHOTGUN].Ammo[WEAPON_AMMO1];
|
ammo = Lara.Weapons[WEAPON_SHOTGUN].Ammo[WEAPON_AMMO1];
|
||||||
else if (item->objectNumber == ID_SHOTGUN_AMMO1_ITEM)
|
else if (item->objectNumber == ID_SHOTGUN_AMMO1_ITEM)
|
||||||
ammo = g_LaraExtra.Weapons[WEAPON_SHOTGUN].Ammo[WEAPON_AMMO2];
|
ammo = Lara.Weapons[WEAPON_SHOTGUN].Ammo[WEAPON_AMMO2];
|
||||||
|
|
||||||
if (ammo == 0)
|
if (ammo == 0)
|
||||||
{
|
{
|
||||||
|
@ -1648,21 +1652,4 @@ void SearchObjectControl(short itemNumber)
|
||||||
item->status = ITEM_INACTIVE;
|
item->status = ITEM_INACTIVE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void Inject_Pickup()
|
|
||||||
{
|
|
||||||
INJECT(0x0043A130, DrawAllPickups);
|
|
||||||
INJECT(0x00463B60, PickedUpObject);
|
|
||||||
INJECT(0x0043E260, InitialisePickup);
|
|
||||||
INJECT(0x004679D0, PickupControl);
|
|
||||||
INJECT(0x00467AF0, RegeneratePickups);
|
|
||||||
INJECT(0x00467C00, PickupCollision);
|
|
||||||
INJECT(0x00468770, FindPlinth);
|
|
||||||
INJECT(0x00468930, KeyHoleCollision);
|
|
||||||
INJECT(0x00468C00, PuzzleDoneCollision);
|
|
||||||
INJECT(0x00468C70, PuzzleHoleCollision);
|
|
||||||
INJECT(0x004693A0, PuzzleDone);
|
|
||||||
INJECT(0x00469550, KeyTrigger);
|
|
||||||
INJECT(0x004695E0, PickupTrigger);
|
|
||||||
}
|
}
|
|
@ -2,10 +2,6 @@
|
||||||
|
|
||||||
#include "..\Global\global.h"
|
#include "..\Global\global.h"
|
||||||
|
|
||||||
//#define PickupCollision ((void (__cdecl*)(short, ITEM_INFO*, COLL_INFO*)) 0x00467C00)
|
|
||||||
//#define InitialisePickup ((void (__cdecl*)(short)) 0x0043E260)
|
|
||||||
//#define PickupControl ((void (__cdecl*)(short)) 0x004679D0)
|
|
||||||
|
|
||||||
void InitialisePickup(short itemNumber);
|
void InitialisePickup(short itemNumber);
|
||||||
void PickedUpObject(short objectNumber);
|
void PickedUpObject(short objectNumber);
|
||||||
void RemoveObjectFromInventory(short objectNumber, int count);
|
void RemoveObjectFromInventory(short objectNumber, int count);
|
||||||
|
@ -24,6 +20,3 @@ void PickupControl(short itemNum);
|
||||||
void InitialiseSearchObject(short itemNumber);
|
void InitialiseSearchObject(short itemNumber);
|
||||||
void SearchObjectCollision(short itemNumber, ITEM_INFO* laraitem, COLL_INFO* laracoll);
|
void SearchObjectCollision(short itemNumber, ITEM_INFO* laraitem, COLL_INFO* laracoll);
|
||||||
void SearchObjectControl(short itemNumber);
|
void SearchObjectControl(short itemNumber);
|
||||||
|
|
||||||
void Inject_Pickup();
|
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
#include "rat.h"
|
|
|
@ -1,6 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "..\Global\global.h"
|
|
||||||
|
|
||||||
//#define InitialiseLittleRats ((void (__cdecl*)(short)) 0x0046B220)
|
|
||||||
//#define ControlLittleRats ((void (__cdecl*)(short)) 0x0046AB30)
|
|
|
@ -2,9 +2,15 @@
|
||||||
#include "..\Global\global.h"
|
#include "..\Global\global.h"
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
#include "laramisc.h"
|
#include "laramisc.h"
|
||||||
|
#include "lara.h"
|
||||||
|
#include "..\Specific\level.h"
|
||||||
|
#include "../Specific/input.h"
|
||||||
|
#include "control.h"
|
||||||
|
|
||||||
PENDULUM CurrentPendulum;
|
PENDULUM CurrentPendulum;
|
||||||
PENDULUM AlternatePendulum;
|
PENDULUM AlternatePendulum;
|
||||||
|
ROPE_STRUCT Ropes[12];
|
||||||
|
int NumRopes;
|
||||||
|
|
||||||
void InitialiseRope(short itemNumber) // (F) (D)
|
void InitialiseRope(short itemNumber) // (F) (D)
|
||||||
{
|
{
|
||||||
|
@ -94,7 +100,7 @@ PHD_VECTOR* NormaliseRopeVector(PHD_VECTOR* vec) // (F) (D)
|
||||||
if (length < 0)
|
if (length < 0)
|
||||||
length = -length;
|
length = -length;
|
||||||
|
|
||||||
length = 65536 / SQRT_ASM(length);
|
length = 65536 / sqrt(length);
|
||||||
|
|
||||||
vec->x = (int64_t) length * vec->x >> 16;
|
vec->x = (int64_t) length * vec->x >> 16;
|
||||||
vec->y = (int64_t) length * vec->y >> 16;
|
vec->y = (int64_t) length * vec->y >> 16;
|
||||||
|
@ -135,11 +141,11 @@ void CrossProduct(PHD_VECTOR* u, PHD_VECTOR* v, PHD_VECTOR* destination) // (F)
|
||||||
|
|
||||||
void _0x0046D420(int* matrix, short* angle) // (F) (D)
|
void _0x0046D420(int* matrix, short* angle) // (F) (D)
|
||||||
{
|
{
|
||||||
angle[0] = ATAN(SQRT_ASM(SQUARE(matrix[M22]) + SQUARE(matrix[M02])), matrix[M12]);
|
angle[0] = phd_atan(sqrt(SQUARE(matrix[M22]) + SQUARE(matrix[M02])), matrix[M12]);
|
||||||
if (matrix[M12] >= 0 && angle[0] > 0 || matrix[M12] < 0 && angle[0] < 0)
|
if (matrix[M12] >= 0 && angle[0] > 0 || matrix[M12] < 0 && angle[0] < 0)
|
||||||
angle[0] = -angle[0];
|
angle[0] = -angle[0];
|
||||||
angle[1] = ATAN(matrix[M22], matrix[M02]);
|
angle[1] = phd_atan(matrix[M22], matrix[M02]);
|
||||||
angle[2] = ATAN(matrix[M00] * COS(angle[1]) - matrix[M20] * SIN(angle[1]), matrix[M21] * SIN(angle[1]) - matrix[M01] * COS(angle[1]));
|
angle[2] = phd_atan(matrix[M00] * phd_cos(angle[1]) - matrix[M20] * phd_sin(angle[1]), matrix[M21] * phd_sin(angle[1]) - matrix[M01] * phd_cos(angle[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RopeControl(short itemNumber) // (F) (D)
|
void RopeControl(short itemNumber) // (F) (D)
|
||||||
|
@ -172,7 +178,7 @@ void RopeCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll) // (F) (D)
|
||||||
if (TrInput & IN_ACTION && Lara.gunStatus == LG_NO_ARMS && (l->currentAnimState == STATE_LARA_REACH || l->currentAnimState == STATE_LARA_JUMP_UP) && l->gravityStatus && l->fallspeed > 0 && rope->active)
|
if (TrInput & IN_ACTION && Lara.gunStatus == LG_NO_ARMS && (l->currentAnimState == STATE_LARA_REACH || l->currentAnimState == STATE_LARA_JUMP_UP) && l->gravityStatus && l->fallspeed > 0 && rope->active)
|
||||||
{
|
{
|
||||||
frame = (ANIM_FRAME*) GetBoundsAccurate(l);
|
frame = (ANIM_FRAME*) GetBoundsAccurate(l);
|
||||||
segment = _0x0046D200(rope, l->pos.xPos, l->pos.yPos + frame->MinY + 512, l->pos.zPos + (frame->MaxZ * COS(l->pos.yRot) >> W2V_SHIFT), l->currentAnimState == STATE_LARA_REACH ? 128 : 320);
|
segment = _0x0046D200(rope, l->pos.xPos, l->pos.yPos + frame->MinY + 512, l->pos.zPos + (frame->MaxZ * phd_cos(l->pos.yRot) >> W2V_SHIFT), l->currentAnimState == STATE_LARA_REACH ? 128 : 320);
|
||||||
if (segment >= 0)
|
if (segment >= 0)
|
||||||
{
|
{
|
||||||
if (l->currentAnimState == STATE_LARA_REACH)
|
if (l->currentAnimState == STATE_LARA_REACH)
|
||||||
|
@ -384,9 +390,9 @@ int _0x0046D200(ROPE_STRUCT* rope, int x, int y, int z, int radius) // (F) (D)
|
||||||
void ApplyVelocityToRope(int node, short angle, short n) // (F) (D)
|
void ApplyVelocityToRope(int node, short angle, short n) // (F) (D)
|
||||||
{
|
{
|
||||||
SetPendulumVelocity(
|
SetPendulumVelocity(
|
||||||
(unsigned short) n * SIN(angle) >> 2,
|
(unsigned short) n * phd_sin(angle) >> 2,
|
||||||
0,
|
0,
|
||||||
(unsigned short) n * COS(angle) >> 2); /* @ORIGINAL_BUG: casting n to unsigned short results in the rope glitch */
|
(unsigned short) n * phd_cos(angle) >> 2); /* @ORIGINAL_BUG: casting n to unsigned short results in the rope glitch */
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetPendulumVelocity(int x, int y, int z) // (F) (D)
|
void SetPendulumVelocity(int x, int y, int z) // (F) (D)
|
||||||
|
@ -431,7 +437,7 @@ void _0x0046E080(ROPE_STRUCT* rope, PENDULUM* pendulumPointer, PHD_VECTOR* ropeV
|
||||||
vec.x = pendulumPointer->Position.x + pendulumVelocity->x - rope->segment[0].x;
|
vec.x = pendulumPointer->Position.x + pendulumVelocity->x - rope->segment[0].x;
|
||||||
vec.y = pendulumPointer->Position.y + pendulumVelocity->y - rope->segment[0].y;
|
vec.y = pendulumPointer->Position.y + pendulumVelocity->y - rope->segment[0].y;
|
||||||
vec.z = pendulumPointer->Position.z + pendulumVelocity->z - rope->segment[0].z;
|
vec.z = pendulumPointer->Position.z + pendulumVelocity->z - rope->segment[0].z;
|
||||||
result = 65536 * SQRT_ASM(abs(SQUARE(vec.x >> 16) + SQUARE(vec.y >> 16) + SQUARE(vec.z >> 16))) - value;
|
result = 65536 * sqrt(abs(SQUARE(vec.x >> 16) + SQUARE(vec.y >> 16) + SQUARE(vec.z >> 16))) - value;
|
||||||
NormaliseRopeVector(&vec);
|
NormaliseRopeVector(&vec);
|
||||||
pendulumVelocity->x -= (int64_t) result * vec.x >> 16;
|
pendulumVelocity->x -= (int64_t) result * vec.x >> 16;
|
||||||
pendulumVelocity->y -= (int64_t) result * vec.y >> 16;
|
pendulumVelocity->y -= (int64_t) result * vec.y >> 16;
|
||||||
|
@ -446,7 +452,7 @@ void _0x0046DF00(PHD_VECTOR* segment, PHD_VECTOR* nextSegment, PHD_VECTOR* veloc
|
||||||
vec.x = nextSegment->x + nextVelocity->x - segment->x - velocity->x;
|
vec.x = nextSegment->x + nextVelocity->x - segment->x - velocity->x;
|
||||||
vec.y = nextSegment->y + nextVelocity->y - segment->y - velocity->y;
|
vec.y = nextSegment->y + nextVelocity->y - segment->y - velocity->y;
|
||||||
vec.z = nextSegment->z + nextVelocity->z - segment->z - velocity->z;
|
vec.z = nextSegment->z + nextVelocity->z - segment->z - velocity->z;
|
||||||
result = 65536 * SQRT_ASM(abs(SQUARE(vec.x >> 16) + SQUARE(vec.y >> 16) + SQUARE(vec.z >> 16))) - length >> 1;
|
result = (65536 * sqrt(abs(SQUARE(vec.x >> 16) + SQUARE(vec.y >> 16) + SQUARE(vec.z >> 16))) - length) / 2;
|
||||||
NormaliseRopeVector(&vec);
|
NormaliseRopeVector(&vec);
|
||||||
vec.x = (int64_t) result * vec.x >> 16;
|
vec.x = (int64_t) result * vec.x >> 16;
|
||||||
vec.y = (int64_t) result * vec.y >> 16;
|
vec.y = (int64_t) result * vec.y >> 16;
|
||||||
|
|
|
@ -24,8 +24,8 @@ struct PENDULUM
|
||||||
};
|
};
|
||||||
|
|
||||||
extern PENDULUM CurrentPendulum;
|
extern PENDULUM CurrentPendulum;
|
||||||
|
extern ROPE_STRUCT Ropes[12];
|
||||||
#define CalculateRopePoints ((void (__cdecl*)(ROPE_STRUCT*)) 0x0046EC70)
|
extern int NumRopes;
|
||||||
|
|
||||||
void InitialiseRope(short itemNumber);
|
void InitialiseRope(short itemNumber);
|
||||||
void PrepareRope(ROPE_STRUCT* rope, PHD_VECTOR* pos1, PHD_VECTOR* pos2, int length, ITEM_INFO* item);
|
void PrepareRope(ROPE_STRUCT* rope, PHD_VECTOR* pos1, PHD_VECTOR* pos2, int length, ITEM_INFO* item);
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include "..\Objects\newobjects.h"
|
#include "..\Objects\newobjects.h"
|
||||||
#include "..\Objects\oldobjects.h"
|
#include "..\Objects\oldobjects.h"
|
||||||
#include "..\Game\sound.h"
|
#include "..\Game\sound.h"
|
||||||
#include "..\Specific\roomload.h"
|
#include "..\Specific\level.h"
|
||||||
#include "../Specific/setup.h"
|
#include "../Specific/setup.h"
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ ChunkReader* SaveGame::m_reader;
|
||||||
ChunkWriter* SaveGame::m_writer;
|
ChunkWriter* SaveGame::m_writer;
|
||||||
vector<LuaVariable> SaveGame::m_luaVariables;
|
vector<LuaVariable> SaveGame::m_luaVariables;
|
||||||
int SaveGame::LastSaveGame;
|
int SaveGame::LastSaveGame;
|
||||||
|
SAVEGAME_INFO Savegame;
|
||||||
|
|
||||||
ChunkId* SaveGame::m_chunkGameStatus;
|
ChunkId* SaveGame::m_chunkGameStatus;
|
||||||
ChunkId* SaveGame::m_chunkItems;
|
ChunkId* SaveGame::m_chunkItems;
|
||||||
|
@ -118,7 +119,7 @@ void SaveGame::saveItems()
|
||||||
void SaveGame::saveItem(int itemNumber, int runtimeItem)
|
void SaveGame::saveItem(int itemNumber, int runtimeItem)
|
||||||
{
|
{
|
||||||
ITEM_INFO* item = &Items[itemNumber];
|
ITEM_INFO* item = &Items[itemNumber];
|
||||||
OBJECT_INFO* obj = &Objects[item->objectNumber];
|
ObjectInfo* obj = &Objects[item->objectNumber];
|
||||||
|
|
||||||
LEB128::Write(m_stream, itemNumber);
|
LEB128::Write(m_stream, itemNumber);
|
||||||
LEB128::Write(m_stream, runtimeItem);
|
LEB128::Write(m_stream, runtimeItem);
|
||||||
|
@ -211,7 +212,7 @@ void SaveGame::saveGameStatus(int arg1, int arg2)
|
||||||
void SaveGame::saveLara(int arg1, int arg2)
|
void SaveGame::saveLara(int arg1, int arg2)
|
||||||
{
|
{
|
||||||
// LARA_INFO struct dumped to savegame
|
// LARA_INFO struct dumped to savegame
|
||||||
LARA_INFO lara;
|
LaraInfo lara;
|
||||||
memcpy(&lara, &Lara, sizeof(Lara));
|
memcpy(&lara, &Lara, sizeof(Lara));
|
||||||
|
|
||||||
for (int i = 0; i < 15; i++)
|
for (int i = 0; i < 15; i++)
|
||||||
|
@ -219,7 +220,7 @@ void SaveGame::saveLara(int arg1, int arg2)
|
||||||
|
|
||||||
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)MallocBuffer;
|
lara.generalPtr = (char *)lara.generalPtr - (ptrdiff_t)malloc_buffer;
|
||||||
|
|
||||||
m_stream->Write(reinterpret_cast<char*>(&lara), sizeof(Lara));
|
m_stream->Write(reinterpret_cast<char*>(&lara), sizeof(Lara));
|
||||||
|
|
||||||
|
@ -239,50 +240,50 @@ void SaveGame::saveLara(int arg1, int arg2)
|
||||||
// Save carried puzzles, keys, pickups and examines
|
// Save carried puzzles, keys, pickups and examines
|
||||||
for (int i = 0; i < NUM_PUZZLES; i++)
|
for (int i = 0; i < NUM_PUZZLES; i++)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.Puzzles[i] > 0)
|
if (Lara.Puzzles[i] > 0)
|
||||||
m_writer->WriteChunk(m_chunkPuzzle, &savePuzzle, i, g_LaraExtra.Puzzles[i]);
|
m_writer->WriteChunk(m_chunkPuzzle, &savePuzzle, i, Lara.Puzzles[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < NUM_PUZZLES * 2; i++)
|
for (int i = 0; i < NUM_PUZZLES * 2; i++)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.PuzzlesCombo[i] > 0)
|
if (Lara.PuzzlesCombo[i] > 0)
|
||||||
m_writer->WriteChunk(m_chunkPuzzleCombo, &savePuzzle, i, g_LaraExtra.PuzzlesCombo[i]);
|
m_writer->WriteChunk(m_chunkPuzzleCombo, &savePuzzle, i, Lara.PuzzlesCombo[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < NUM_KEYS; i++)
|
for (int i = 0; i < NUM_KEYS; i++)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.Keys[i] > 0)
|
if (Lara.Keys[i] > 0)
|
||||||
m_writer->WriteChunk(m_chunkKey, &savePuzzle, i, g_LaraExtra.Keys[i]);
|
m_writer->WriteChunk(m_chunkKey, &savePuzzle, i, Lara.Keys[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < NUM_KEYS * 2; i++)
|
for (int i = 0; i < NUM_KEYS * 2; i++)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.KeysCombo[i] > 0)
|
if (Lara.KeysCombo[i] > 0)
|
||||||
m_writer->WriteChunk(m_chunkKeyCombo, &savePuzzle, i, g_LaraExtra.KeysCombo[i]);
|
m_writer->WriteChunk(m_chunkKeyCombo, &savePuzzle, i, Lara.KeysCombo[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < NUM_PICKUPS; i++)
|
for (int i = 0; i < NUM_PICKUPS; i++)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.Pickups[i] > 0)
|
if (Lara.Pickups[i] > 0)
|
||||||
m_writer->WriteChunk(m_chunkPickup, &savePuzzle, i, g_LaraExtra.Pickups[i]);
|
m_writer->WriteChunk(m_chunkPickup, &savePuzzle, i, Lara.Pickups[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < NUM_PICKUPS * 2; i++)
|
for (int i = 0; i < NUM_PICKUPS * 2; i++)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.PickupsCombo[i] > 0)
|
if (Lara.PickupsCombo[i] > 0)
|
||||||
m_writer->WriteChunk(m_chunkPickupCombo, &savePuzzle, i, g_LaraExtra.PickupsCombo[i]);
|
m_writer->WriteChunk(m_chunkPickupCombo, &savePuzzle, i, Lara.PickupsCombo[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < NUM_EXAMINES; i++)
|
for (int i = 0; i < NUM_EXAMINES; i++)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.Examines[i] > 0)
|
if (Lara.Examines[i] > 0)
|
||||||
m_writer->WriteChunk(m_chunkExamine, &savePuzzle, i, g_LaraExtra.Examines[i]);
|
m_writer->WriteChunk(m_chunkExamine, &savePuzzle, i, Lara.Examines[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < NUM_EXAMINES * 2; i++)
|
for (int i = 0; i < NUM_EXAMINES * 2; i++)
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.ExaminesCombo[i] > 0)
|
if (Lara.ExaminesCombo[i] > 0)
|
||||||
m_writer->WriteChunk(m_chunkExamineCombo, &savePuzzle, i, g_LaraExtra.ExaminesCombo[i]);
|
m_writer->WriteChunk(m_chunkExamineCombo, &savePuzzle, i, Lara.ExaminesCombo[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,19 +301,19 @@ void SaveGame::saveWeaponItem(int arg1, int arg2)
|
||||||
|
|
||||||
void SaveGame::saveLaraExtraInfo(int arg1, int arg2)
|
void SaveGame::saveLaraExtraInfo(int arg1, int arg2)
|
||||||
{
|
{
|
||||||
LEB128::Write(m_stream, (g_LaraExtra.Binoculars ? 1 : 0));
|
LEB128::Write(m_stream, (Lara.Binoculars ? 1 : 0));
|
||||||
LEB128::Write(m_stream, (g_LaraExtra.Lasersight ? 1 : 0));
|
LEB128::Write(m_stream, (Lara.Lasersight ? 1 : 0));
|
||||||
LEB128::Write(m_stream, (g_LaraExtra.Crowbar ? 1 : 0));
|
LEB128::Write(m_stream, (Lara.Crowbar ? 1 : 0));
|
||||||
LEB128::Write(m_stream, (g_LaraExtra.Silencer ? 1 : 0));
|
LEB128::Write(m_stream, (Lara.Silencer ? 1 : 0));
|
||||||
LEB128::Write(m_stream, (g_LaraExtra.Torch ? 1 : 0));
|
LEB128::Write(m_stream, (Lara.Torch ? 1 : 0));
|
||||||
LEB128::Write(m_stream, g_LaraExtra.Secrets);
|
LEB128::Write(m_stream, Lara.Secrets);
|
||||||
LEB128::Write(m_stream, g_LaraExtra.ExtraAnim);
|
LEB128::Write(m_stream, Lara.ExtraAnim);
|
||||||
LEB128::Write(m_stream, g_LaraExtra.Vehicle);
|
LEB128::Write(m_stream, Lara.Vehicle);
|
||||||
LEB128::Write(m_stream, g_LaraExtra.mineL);
|
LEB128::Write(m_stream, Lara.mineL);
|
||||||
LEB128::Write(m_stream, g_LaraExtra.mineR);
|
LEB128::Write(m_stream, Lara.mineR);
|
||||||
LEB128::Write(m_stream, g_LaraExtra.NumFlares);
|
LEB128::Write(m_stream, Lara.NumFlares);
|
||||||
LEB128::Write(m_stream, g_LaraExtra.NumLargeMedipacks);
|
LEB128::Write(m_stream, Lara.NumLargeMedipacks);
|
||||||
LEB128::Write(m_stream, g_LaraExtra.NumSmallMedipacks);
|
LEB128::Write(m_stream, Lara.NumSmallMedipacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveGame::savePuzzle(int arg1, int arg2)
|
void SaveGame::savePuzzle(int arg1, int arg2)
|
||||||
|
@ -323,7 +324,7 @@ void SaveGame::savePuzzle(int arg1, int arg2)
|
||||||
|
|
||||||
void SaveGame::saveWeaponInfo(int arg1, int arg2)
|
void SaveGame::saveWeaponInfo(int arg1, int arg2)
|
||||||
{
|
{
|
||||||
CarriedWeaponInfo* weapon = &g_LaraExtra.Weapons[arg1];
|
CarriedWeaponInfo* weapon = &Lara.Weapons[arg1];
|
||||||
|
|
||||||
LEB128::Write(m_stream, arg1);
|
LEB128::Write(m_stream, arg1);
|
||||||
LEB128::Write(m_stream, weapon->Present);
|
LEB128::Write(m_stream, weapon->Present);
|
||||||
|
@ -505,10 +506,10 @@ bool SaveGame::readGameStatus()
|
||||||
bool SaveGame::readLara()
|
bool SaveGame::readLara()
|
||||||
{
|
{
|
||||||
// Read dumped LARA_INFO struct
|
// Read dumped LARA_INFO struct
|
||||||
char* buffer = (char*)malloc(sizeof(LARA_INFO));
|
char* buffer = (char*)malloc(sizeof(LaraInfo));
|
||||||
m_stream->Read(buffer, sizeof(LARA_INFO));
|
m_stream->Read(buffer, sizeof(LaraInfo));
|
||||||
LARA_INFO* lara = reinterpret_cast<LARA_INFO*>(buffer);
|
LaraInfo* lara = reinterpret_cast<LaraInfo*>(buffer);
|
||||||
memcpy(&Lara, lara, sizeof(LARA_INFO));
|
memcpy(&Lara, lara, sizeof(LaraInfo));
|
||||||
free(buffer);
|
free(buffer);
|
||||||
|
|
||||||
for (int i = 0; i < 15; i++)
|
for (int i = 0; i < 15; i++)
|
||||||
|
@ -522,7 +523,7 @@ bool SaveGame::readLara()
|
||||||
|
|
||||||
Lara.target = NULL;
|
Lara.target = NULL;
|
||||||
Lara.spazEffect = NULL;
|
Lara.spazEffect = NULL;
|
||||||
Lara.generalPtr = ADD_PTR(Lara.generalPtr, char, MallocBuffer);
|
Lara.generalPtr = ADD_PTR(Lara.generalPtr, char, malloc_buffer);
|
||||||
Lara.weaponItem = NO_ITEM;
|
Lara.weaponItem = NO_ITEM;
|
||||||
|
|
||||||
// Is Lara burning?
|
// Is Lara burning?
|
||||||
|
@ -559,7 +560,7 @@ bool SaveGame::readItem()
|
||||||
ITEM_INFO* item = &Items[itemNumber];
|
ITEM_INFO* item = &Items[itemNumber];
|
||||||
item->objectNumber = LEB128::ReadInt16(m_stream);
|
item->objectNumber = LEB128::ReadInt16(m_stream);
|
||||||
|
|
||||||
OBJECT_INFO* obj = &Objects[item->objectNumber];
|
ObjectInfo* obj = &Objects[item->objectNumber];
|
||||||
|
|
||||||
// Runtime items must be initialised
|
// Runtime items must be initialised
|
||||||
// TODO: test test test!!!
|
// TODO: test test test!!!
|
||||||
|
@ -750,19 +751,19 @@ bool SaveGame::readLaraChunks(ChunkId* chunkId, int maxSize, int arg)
|
||||||
{
|
{
|
||||||
if (chunkId->EqualsTo(m_chunkLaraExtraInfo))
|
if (chunkId->EqualsTo(m_chunkLaraExtraInfo))
|
||||||
{
|
{
|
||||||
g_LaraExtra.Binoculars = LEB128::ReadByte(m_stream);
|
Lara.Binoculars = LEB128::ReadByte(m_stream);
|
||||||
g_LaraExtra.Lasersight = LEB128::ReadByte(m_stream);
|
Lara.Lasersight = LEB128::ReadByte(m_stream);
|
||||||
g_LaraExtra.Crowbar = LEB128::ReadByte(m_stream);
|
Lara.Crowbar = LEB128::ReadByte(m_stream);
|
||||||
g_LaraExtra.Silencer = LEB128::ReadByte(m_stream);
|
Lara.Silencer = LEB128::ReadByte(m_stream);
|
||||||
g_LaraExtra.Torch = LEB128::ReadByte(m_stream);
|
Lara.Torch = LEB128::ReadByte(m_stream);
|
||||||
g_LaraExtra.Secrets = LEB128::ReadInt32(m_stream);
|
Lara.Secrets = LEB128::ReadInt32(m_stream);
|
||||||
g_LaraExtra.ExtraAnim = LEB128::ReadInt16(m_stream);
|
Lara.ExtraAnim = LEB128::ReadInt16(m_stream);
|
||||||
g_LaraExtra.Vehicle = LEB128::ReadInt16(m_stream);
|
Lara.Vehicle = LEB128::ReadInt16(m_stream);
|
||||||
g_LaraExtra.mineL = LEB128::ReadByte(m_stream);
|
Lara.mineL = LEB128::ReadByte(m_stream);
|
||||||
g_LaraExtra.mineR = LEB128::ReadByte(m_stream);
|
Lara.mineR = LEB128::ReadByte(m_stream);
|
||||||
g_LaraExtra.NumFlares = LEB128::ReadInt32(m_stream);
|
Lara.NumFlares = LEB128::ReadInt32(m_stream);
|
||||||
g_LaraExtra.NumLargeMedipacks = LEB128::ReadInt32(m_stream);
|
Lara.NumLargeMedipacks = LEB128::ReadInt32(m_stream);
|
||||||
g_LaraExtra.NumSmallMedipacks = LEB128::ReadInt32(m_stream);
|
Lara.NumSmallMedipacks = LEB128::ReadInt32(m_stream);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -770,7 +771,7 @@ bool SaveGame::readLaraChunks(ChunkId* chunkId, int maxSize, int arg)
|
||||||
{
|
{
|
||||||
int id = LEB128::ReadInt32(m_stream);
|
int id = LEB128::ReadInt32(m_stream);
|
||||||
|
|
||||||
CarriedWeaponInfo* weapon = &g_LaraExtra.Weapons[id];
|
CarriedWeaponInfo* weapon = &Lara.Weapons[id];
|
||||||
|
|
||||||
weapon->Present = LEB128::ReadByte(m_stream);
|
weapon->Present = LEB128::ReadByte(m_stream);
|
||||||
weapon->SelectedAmmo = LEB128::ReadByte(m_stream);
|
weapon->SelectedAmmo = LEB128::ReadByte(m_stream);
|
||||||
|
@ -784,49 +785,49 @@ bool SaveGame::readLaraChunks(ChunkId* chunkId, int maxSize, int arg)
|
||||||
{
|
{
|
||||||
int id = LEB128::ReadInt32(m_stream);
|
int id = LEB128::ReadInt32(m_stream);
|
||||||
int quantity = LEB128::ReadInt32(m_stream);
|
int quantity = LEB128::ReadInt32(m_stream);
|
||||||
g_LaraExtra.Puzzles[id] = quantity;
|
Lara.Puzzles[id] = quantity;
|
||||||
}
|
}
|
||||||
else if (chunkId->EqualsTo(m_chunkPuzzleCombo))
|
else if (chunkId->EqualsTo(m_chunkPuzzleCombo))
|
||||||
{
|
{
|
||||||
int id = LEB128::ReadInt32(m_stream);
|
int id = LEB128::ReadInt32(m_stream);
|
||||||
int quantity = LEB128::ReadInt32(m_stream);
|
int quantity = LEB128::ReadInt32(m_stream);
|
||||||
g_LaraExtra.PuzzlesCombo[id] = quantity;
|
Lara.PuzzlesCombo[id] = quantity;
|
||||||
}
|
}
|
||||||
else if (chunkId->EqualsTo(m_chunkKey))
|
else if (chunkId->EqualsTo(m_chunkKey))
|
||||||
{
|
{
|
||||||
int id = LEB128::ReadInt32(m_stream);
|
int id = LEB128::ReadInt32(m_stream);
|
||||||
int quantity = LEB128::ReadInt32(m_stream);
|
int quantity = LEB128::ReadInt32(m_stream);
|
||||||
g_LaraExtra.Keys[id] = quantity;
|
Lara.Keys[id] = quantity;
|
||||||
}
|
}
|
||||||
else if (chunkId->EqualsTo(m_chunkKeyCombo))
|
else if (chunkId->EqualsTo(m_chunkKeyCombo))
|
||||||
{
|
{
|
||||||
int id = LEB128::ReadInt32(m_stream);
|
int id = LEB128::ReadInt32(m_stream);
|
||||||
int quantity = LEB128::ReadInt32(m_stream);
|
int quantity = LEB128::ReadInt32(m_stream);
|
||||||
g_LaraExtra.KeysCombo[id] = quantity;
|
Lara.KeysCombo[id] = quantity;
|
||||||
}
|
}
|
||||||
else if (chunkId->EqualsTo(m_chunkPickup))
|
else if (chunkId->EqualsTo(m_chunkPickup))
|
||||||
{
|
{
|
||||||
int id = LEB128::ReadInt32(m_stream);
|
int id = LEB128::ReadInt32(m_stream);
|
||||||
int quantity = LEB128::ReadInt32(m_stream);
|
int quantity = LEB128::ReadInt32(m_stream);
|
||||||
g_LaraExtra.Pickups[id] = quantity;
|
Lara.Pickups[id] = quantity;
|
||||||
}
|
}
|
||||||
else if (chunkId->EqualsTo(m_chunkPickupCombo))
|
else if (chunkId->EqualsTo(m_chunkPickupCombo))
|
||||||
{
|
{
|
||||||
int id = LEB128::ReadInt32(m_stream);
|
int id = LEB128::ReadInt32(m_stream);
|
||||||
int quantity = LEB128::ReadInt32(m_stream);
|
int quantity = LEB128::ReadInt32(m_stream);
|
||||||
g_LaraExtra.PickupsCombo[id] = quantity;
|
Lara.PickupsCombo[id] = quantity;
|
||||||
}
|
}
|
||||||
else if (chunkId->EqualsTo(m_chunkExamine))
|
else if (chunkId->EqualsTo(m_chunkExamine))
|
||||||
{
|
{
|
||||||
int id = LEB128::ReadInt32(m_stream);
|
int id = LEB128::ReadInt32(m_stream);
|
||||||
int quantity = LEB128::ReadInt32(m_stream);
|
int quantity = LEB128::ReadInt32(m_stream);
|
||||||
g_LaraExtra.Examines[id] = quantity;
|
Lara.Examines[id] = quantity;
|
||||||
}
|
}
|
||||||
else if (chunkId->EqualsTo(m_chunkExamineCombo))
|
else if (chunkId->EqualsTo(m_chunkExamineCombo))
|
||||||
{
|
{
|
||||||
int id = LEB128::ReadInt32(m_stream);
|
int id = LEB128::ReadInt32(m_stream);
|
||||||
int quantity = LEB128::ReadInt32(m_stream);
|
int quantity = LEB128::ReadInt32(m_stream);
|
||||||
g_LaraExtra.ExaminesCombo[id] = quantity;
|
Lara.ExaminesCombo[id] = quantity;
|
||||||
}
|
}
|
||||||
else if (chunkId->EqualsTo(m_chunkWeaponItem))
|
else if (chunkId->EqualsTo(m_chunkWeaponItem))
|
||||||
{
|
{
|
||||||
|
@ -1025,7 +1026,7 @@ bool SaveGame::readItemChunks(ChunkId* chunkId, int maxSize, int itemNumber)
|
||||||
{
|
{
|
||||||
EnableBaddieAI(itemNumber, 1);
|
EnableBaddieAI(itemNumber, 1);
|
||||||
|
|
||||||
OBJECT_INFO* obj = &Objects[item->objectNumber];
|
ObjectInfo* obj = &Objects[item->objectNumber];
|
||||||
CREATURE_INFO* creature = (CREATURE_INFO*)item->data;
|
CREATURE_INFO* creature = (CREATURE_INFO*)item->data;
|
||||||
|
|
||||||
creature->jointRotation[0] = LEB128::ReadInt16(m_stream);
|
creature->jointRotation[0] = LEB128::ReadInt16(m_stream);
|
||||||
|
@ -1045,7 +1046,7 @@ bool SaveGame::readItemChunks(ChunkId* chunkId, int maxSize, int itemNumber)
|
||||||
creature->mood = (MOOD_TYPE)LEB128::ReadInt32(m_stream);
|
creature->mood = (MOOD_TYPE)LEB128::ReadInt32(m_stream);
|
||||||
|
|
||||||
ITEM_INFO* enemy = (ITEM_INFO*)LEB128::ReadLong(m_stream);
|
ITEM_INFO* enemy = (ITEM_INFO*)LEB128::ReadLong(m_stream);
|
||||||
creature->enemy = ADD_PTR(enemy, ITEM_INFO, MallocBuffer);
|
creature->enemy = ADD_PTR(enemy, ITEM_INFO, malloc_buffer);
|
||||||
|
|
||||||
creature->aiTarget.objectNumber = LEB128::ReadInt16(m_stream);
|
creature->aiTarget.objectNumber = LEB128::ReadInt16(m_stream);
|
||||||
creature->aiTarget.roomNumber = LEB128::ReadInt16(m_stream);
|
creature->aiTarget.roomNumber = LEB128::ReadInt16(m_stream);
|
||||||
|
@ -1068,7 +1069,7 @@ bool SaveGame::readItemChunks(ChunkId* chunkId, int maxSize, int itemNumber)
|
||||||
}
|
}
|
||||||
else if (chunkId->EqualsTo(m_chunkItemQuadInfo))
|
else if (chunkId->EqualsTo(m_chunkItemQuadInfo))
|
||||||
{
|
{
|
||||||
QUAD_INFO* quadInfo = (QUAD_INFO*)GameMalloc(sizeof(QUAD_INFO));
|
QUAD_INFO* quadInfo = (QUAD_INFO*)game_malloc(sizeof(QUAD_INFO));
|
||||||
m_stream->ReadBytes(reinterpret_cast<byte*>(quadInfo), sizeof(QUAD_INFO));
|
m_stream->ReadBytes(reinterpret_cast<byte*>(quadInfo), sizeof(QUAD_INFO));
|
||||||
if (item->objectNumber == ID_QUAD)
|
if (item->objectNumber == ID_QUAD)
|
||||||
item->data = (void*)quadInfo;
|
item->data = (void*)quadInfo;
|
||||||
|
@ -1129,7 +1130,7 @@ bool SaveGame::readStatistics()
|
||||||
void SaveGame::saveItemFlags(int arg1, int arg2)
|
void SaveGame::saveItemFlags(int arg1, int arg2)
|
||||||
{
|
{
|
||||||
ITEM_INFO* item = &Items[arg1];
|
ITEM_INFO* item = &Items[arg1];
|
||||||
OBJECT_INFO* obj = &Objects[item->objectNumber];
|
ObjectInfo* obj = &Objects[item->objectNumber];
|
||||||
|
|
||||||
LEB128::Write(m_stream, item->flags);
|
LEB128::Write(m_stream, item->flags);
|
||||||
LEB128::Write(m_stream, item->active);
|
LEB128::Write(m_stream, item->active);
|
||||||
|
@ -1153,10 +1154,10 @@ void SaveGame::saveItemFlags(int arg1, int arg2)
|
||||||
void SaveGame::saveItemIntelligentData(int arg1, int arg2)
|
void SaveGame::saveItemIntelligentData(int arg1, int arg2)
|
||||||
{
|
{
|
||||||
ITEM_INFO* item = &Items[arg1];
|
ITEM_INFO* item = &Items[arg1];
|
||||||
OBJECT_INFO* obj = &Objects[item->objectNumber];
|
ObjectInfo* obj = &Objects[item->objectNumber];
|
||||||
CREATURE_INFO* creature = (CREATURE_INFO*)item->data;
|
CREATURE_INFO* creature = (CREATURE_INFO*)item->data;
|
||||||
|
|
||||||
ITEM_INFO* enemy = (ITEM_INFO*)((char*)creature->enemy - (ptrdiff_t)MallocBuffer);
|
ITEM_INFO* enemy = (ITEM_INFO*)((char*)creature->enemy - (ptrdiff_t)malloc_buffer);
|
||||||
|
|
||||||
LEB128::Write(m_stream, creature->jointRotation[0]);
|
LEB128::Write(m_stream, creature->jointRotation[0]);
|
||||||
LEB128::Write(m_stream, creature->jointRotation[1]);
|
LEB128::Write(m_stream, creature->jointRotation[1]);
|
||||||
|
|
|
@ -7,17 +7,13 @@
|
||||||
#include "..\Specific\IO\LEB128.h"
|
#include "..\Specific\IO\LEB128.h"
|
||||||
#include "..\Specific\IO\Streams.h"
|
#include "..\Specific\IO\Streams.h"
|
||||||
#include "..\Scripting\GameFlowScript.h"
|
#include "..\Scripting\GameFlowScript.h"
|
||||||
#include "..\Scripting\GameLogicScript.h"
|
#include "..\Scripting\GameLogicScript.h"
|
||||||
|
|
||||||
#define RestoreGame ((int (__cdecl*)()) 0x00472060)
|
|
||||||
#define ReadSavegame ((int (__cdecl*)(int)) 0x004A8E10)
|
|
||||||
#define CreateSavegame ((void (__cdecl*)()) 0x00470FA0)
|
|
||||||
#define WriteSavegame ((int (__cdecl*)(int)) 0x004A8BC0)
|
|
||||||
|
|
||||||
#define SAVEGAME_BUFFER_SIZE 1048576
|
#define SAVEGAME_BUFFER_SIZE 1048576
|
||||||
|
|
||||||
extern GameFlow* g_GameFlow;
|
extern GameFlow* g_GameFlow;
|
||||||
extern GameScript* g_GameScript;
|
extern GameScript* g_GameScript;
|
||||||
|
extern SAVEGAME_INFO Savegame;
|
||||||
|
|
||||||
typedef struct SaveGameHeader
|
typedef struct SaveGameHeader
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
|
#include "lara.h"
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
#include "..\Specific\configuration.h"
|
#include "..\Specific\configuration.h"
|
||||||
|
#include "..\Specific\level.h""
|
||||||
|
#include "..\Specific\winmain.h"
|
||||||
|
|
||||||
HSTREAM BASS_3D_Mixdown;
|
HSTREAM BASS_3D_Mixdown;
|
||||||
HFX BASS_FXHandler[NUM_SOUND_FILTERS];
|
HFX BASS_FXHandler[NUM_SOUND_FILTERS];
|
||||||
SoundTrackSlot BASS_Soundtrack[NUM_SOUND_TRACK_TYPES];
|
SoundTrackSlot BASS_Soundtrack[NUM_SOUND_TRACK_TYPES];
|
||||||
|
HSAMPLE SamplePointer[SOUND_MAX_SAMPLES];
|
||||||
|
SoundEffectSlot SoundSlot[SOUND_MAX_CHANNELS];
|
||||||
|
char TrackNamePrefix;
|
||||||
|
|
||||||
const BASS_BFX_FREEVERB BASS_ReverbTypes[NUM_REVERB_TYPES] = // Reverb presets
|
const BASS_BFX_FREEVERB BASS_ReverbTypes[NUM_REVERB_TYPES] = // Reverb presets
|
||||||
|
|
||||||
|
@ -21,6 +27,8 @@ short SampleLUT[SOUND_NEW_SOUNDMAP_MAX_SIZE];
|
||||||
short SoundMapSize;
|
short SoundMapSize;
|
||||||
int NumSamplesInfos;
|
int NumSamplesInfos;
|
||||||
SAMPLE_INFO* SampleInfo;
|
SAMPLE_INFO* SampleInfo;
|
||||||
|
int GlobalMusicVolume;
|
||||||
|
int GlobalFXVolume;
|
||||||
|
|
||||||
bool Sound_LoadSample(char *pointer, int compSize, int uncompSize, int index) // Replaces DXCreateSampleADPCM()
|
bool Sound_LoadSample(char *pointer, int compSize, int uncompSize, int index) // Replaces DXCreateSampleADPCM()
|
||||||
{
|
{
|
||||||
|
@ -695,29 +703,7 @@ bool Sound_CheckBASSError(const char* message, bool verbose, ...)
|
||||||
return bassError != 0;
|
return bassError != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inject_Sound()
|
void SayNo()
|
||||||
{
|
{
|
||||||
INJECT(0x00479060, SOUND_Stop);
|
|
||||||
INJECT(0x004790A0, SOUND_Stop); // Seems no difference from SOUND_Stop
|
|
||||||
INJECT(0x00478FE0, StopSoundEffect);
|
|
||||||
INJECT(0x00478570, SoundEffect);
|
|
||||||
INJECT(0x004A3510, Sound_LoadSample); // DXCreateSampleADPCM
|
|
||||||
INJECT(0x004A3AA0, Sound_FreeSamples); // ReleaseDXSoundBuffers
|
|
||||||
|
|
||||||
INJECT(0x00492990, S_CDPlay); // Not really S_CDPlay, but parent singleton function
|
|
||||||
INJECT(0x00418BC0, S_CDPlayEx); // "S_CDPlayEx" called by CD trigger events
|
|
||||||
INJECT(0x004929E0, S_CDStop); // S_CDStop
|
|
||||||
|
|
||||||
//INJECT(0x004A3100, EmptySoundProc); // DXDSCreate
|
|
||||||
//INJECT(0x004A3190, EmptySoundProc); // DXCreateSample
|
|
||||||
//INJECT(0x004A3030, EmptySoundProc); // DXSetOutputFormat
|
|
||||||
//INJECT(0x004A2E30, EmptySoundProc); // SetSoundOutputFormat
|
|
||||||
//INJECT(0x004A3300, EmptySoundProc); // StreamOpen
|
|
||||||
//INJECT(0x004A3470, EmptySoundProc); // StreamClose
|
|
||||||
//INJECT(0x004931A0, EmptySoundProc); // ACMClose
|
|
||||||
//INJECT(0x00493490, EmptySoundProc); // ACMStream
|
|
||||||
//INJECT(0x00492DA0, EmptySoundProc); // ACMInit
|
|
||||||
//INJECT(0x00492C20, EmptySoundProc); // SetupNotifications
|
|
||||||
//INJECT(0x00493990, EmptySoundProc); // StartAddress
|
|
||||||
//INJECT(0x00492B60, EmptySoundProc); // fnCallback
|
|
||||||
}
|
}
|
|
@ -2040,8 +2040,8 @@ extern short SampleLUT[SOUND_NEW_SOUNDMAP_MAX_SIZE];
|
||||||
extern short SoundMapSize;
|
extern short SoundMapSize;
|
||||||
extern int NumSamplesInfos;
|
extern int NumSamplesInfos;
|
||||||
extern SAMPLE_INFO* SampleInfo;
|
extern SAMPLE_INFO* SampleInfo;
|
||||||
|
extern int GlobalMusicVolume;
|
||||||
#define SayNo ((void (__cdecl*)()) 0x004790E0)
|
extern int GlobalFXVolume;
|
||||||
|
|
||||||
long SoundEffect(int effectID, PHD_3DPOS* position, int env_flags);
|
long SoundEffect(int effectID, PHD_3DPOS* position, int env_flags);
|
||||||
void StopSoundEffect(short effectID);
|
void StopSoundEffect(short effectID);
|
||||||
|
@ -2051,6 +2051,7 @@ void SOUND_Stop();
|
||||||
void S_CDPlay(short index, unsigned int mode);
|
void S_CDPlay(short index, unsigned int mode);
|
||||||
void S_CDPlayEx(short index, DWORD mask, DWORD unknown);
|
void S_CDPlayEx(short index, DWORD mask, DWORD unknown);
|
||||||
void S_CDStop();
|
void S_CDStop();
|
||||||
|
void SayNo();
|
||||||
|
|
||||||
static void CALLBACK Sound_FinishOneshotTrack(HSYNC handle, DWORD channel, DWORD data, void* userData);
|
static void CALLBACK Sound_FinishOneshotTrack(HSYNC handle, DWORD channel, DWORD data, void* userData);
|
||||||
|
|
||||||
|
@ -2066,5 +2067,3 @@ float Sound_DistanceToListener(PHD_3DPOS *position);
|
||||||
float Sound_DistanceToListener(Vector3 position);
|
float Sound_DistanceToListener(Vector3 position);
|
||||||
float Sound_Attenuate(float gain, float distance, float radius);
|
float Sound_Attenuate(float gain, float distance, float radius);
|
||||||
bool Sound_UpdateEffectPosition(int index, PHD_3DPOS *position, bool force = false);
|
bool Sound_UpdateEffectPosition(int index, PHD_3DPOS *position, bool force = false);
|
||||||
|
|
||||||
void Inject_Sound();
|
|
|
@ -1,114 +1,40 @@
|
||||||
#include "sphere.h"
|
#include "sphere.h"
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
#include "../Specific/roomload.h"
|
#include "lara.h"
|
||||||
|
#include "../Specific/level.h"
|
||||||
#include "../Specific/setup.h"
|
#include "../Specific/setup.h"
|
||||||
|
|
||||||
int NumLaraSpheres;
|
int NumLaraSpheres;
|
||||||
bool GotLaraSpheres;
|
bool GotLaraSpheres;
|
||||||
SPHERE LaraSpheres[34];
|
SPHERE LaraSpheres[MAX_SPHERES];
|
||||||
SPHERE BaddieSpheres[34];
|
SPHERE CreatureSpheres[MAX_SPHERES];
|
||||||
|
|
||||||
int GetSpheres(ITEM_INFO* item, SPHERE* ptr, char worldSpace)
|
int GetSpheres(ITEM_INFO* item, SPHERE* ptr, int worldSpace, Matrix local)
|
||||||
{
|
{
|
||||||
int x, y, z;
|
|
||||||
|
|
||||||
if (!item)
|
if (!item)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (worldSpace & 1)
|
BoundingSphere spheres[MAX_SPHERES];
|
||||||
|
short itemNumber = (item - Items);
|
||||||
|
|
||||||
|
int num = g_Renderer->GetSpheres(itemNumber, spheres, worldSpace, local);
|
||||||
|
|
||||||
|
for (int i = 0; i < MAX_SPHERES; i++)
|
||||||
{
|
{
|
||||||
x = item->pos.xPos;
|
ptr[i].x = spheres[i].Center.x;
|
||||||
y = item->pos.yPos;
|
ptr[i].y = spheres[i].Center.y;
|
||||||
z = item->pos.zPos;
|
ptr[i].z = spheres[i].Center.z;
|
||||||
|
ptr[i].r = spheres[i].Radius;
|
||||||
phd_PushUnitMatrix();
|
|
||||||
|
|
||||||
MatrixPtr[M03] = 0;
|
|
||||||
MatrixPtr[M13] = 0;
|
|
||||||
MatrixPtr[M23] = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
x = 0;
|
|
||||||
y = 0;
|
|
||||||
z = 0;
|
|
||||||
|
|
||||||
phd_PushMatrix();
|
|
||||||
phd_TranslateAbs(item->pos.xPos, item->pos.yPos, item->pos.zPos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
phd_RotYXZ(item->pos.yRot, item->pos.xRot, item->pos.zRot);
|
return num;
|
||||||
|
|
||||||
short* frame = GetBestFrame(item);
|
|
||||||
phd_TranslateRel(frame[6], frame[7], frame[8]);
|
|
||||||
short* rotation = frame + 9;
|
|
||||||
gar_RotYXZsuperpack(&rotation, 0);
|
|
||||||
|
|
||||||
OBJECT_INFO* obj = &Objects[item->objectNumber];
|
|
||||||
short** meshPtr = &Meshes[obj->meshIndex];
|
|
||||||
int* bone = &Bones[obj->boneIndex];
|
|
||||||
|
|
||||||
phd_PushMatrix();
|
|
||||||
|
|
||||||
short* objPtr = *(meshPtr++);
|
|
||||||
|
|
||||||
if (!(worldSpace & 2))
|
|
||||||
phd_TranslateRel(objPtr[0], objPtr[1], objPtr[2]);
|
|
||||||
|
|
||||||
ptr->x = x + (MatrixPtr[M03] >> W2V_SHIFT);
|
|
||||||
ptr->y = y + (MatrixPtr[M13] >> W2V_SHIFT);
|
|
||||||
ptr->z = z + (MatrixPtr[M23] >> W2V_SHIFT);
|
|
||||||
ptr->r = (int)objPtr[3];
|
|
||||||
ptr++;
|
|
||||||
|
|
||||||
phd_PopMatrix();
|
|
||||||
|
|
||||||
short* extraRotation = (short*)item->data;
|
|
||||||
|
|
||||||
for (int i = obj->nmeshes - 1; i > 0; i--, bone += 3)
|
|
||||||
{
|
|
||||||
int poppush = *(bone++);
|
|
||||||
if (poppush & 1)
|
|
||||||
phd_PopMatrix();
|
|
||||||
if (poppush & 2)
|
|
||||||
phd_PushMatrix();
|
|
||||||
|
|
||||||
phd_TranslateRel(*(bone), *(bone + 1), *(bone + 2));
|
|
||||||
gar_RotYXZsuperpack(&rotation, 0);
|
|
||||||
|
|
||||||
if ((poppush & (ROT_X | ROT_Y | ROT_Z)) && extraRotation)
|
|
||||||
{
|
|
||||||
if (poppush & ROT_Y)
|
|
||||||
phd_RotY(*(extraRotation++));
|
|
||||||
if (poppush & ROT_X)
|
|
||||||
phd_RotX(*(extraRotation++));
|
|
||||||
if (poppush & ROT_Z)
|
|
||||||
phd_RotZ(*(extraRotation++));
|
|
||||||
}
|
|
||||||
|
|
||||||
objPtr = *(meshPtr++);
|
|
||||||
|
|
||||||
phd_PushMatrix();
|
|
||||||
if (!(worldSpace & 2))
|
|
||||||
phd_TranslateRel(objPtr[0], objPtr[1], objPtr[2]);
|
|
||||||
|
|
||||||
ptr->x = x + (MatrixPtr[M03] >> W2V_SHIFT);
|
|
||||||
ptr->y = y + (MatrixPtr[M13] >> W2V_SHIFT);
|
|
||||||
ptr->z = z + (MatrixPtr[M23] >> W2V_SHIFT);
|
|
||||||
ptr->r = (int)objPtr[3];
|
|
||||||
ptr++;
|
|
||||||
phd_PopMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
phd_PopMatrix();
|
|
||||||
return obj->nmeshes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int TestCollision(ITEM_INFO* item, ITEM_INFO* l)
|
int TestCollision(ITEM_INFO* item, ITEM_INFO* l)
|
||||||
{
|
{
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
|
|
||||||
int num1 = GetSpheres(item, SphereList, 1);
|
int num1 = GetSpheres(item, CreatureSpheres, SPHERES_SPACE_WORLD, Matrix::Identity);
|
||||||
int num2 = 0;
|
int num2 = 0;
|
||||||
|
|
||||||
if (l == LaraItem)
|
if (l == LaraItem)
|
||||||
|
@ -119,7 +45,7 @@ int TestCollision(ITEM_INFO* item, ITEM_INFO* l)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
num2 = GetSpheres(l, LaraSpheres, 1);
|
num2 = GetSpheres(l, LaraSpheres, SPHERES_SPACE_WORLD, Matrix::Identity);
|
||||||
NumLaraSpheres = num2;
|
NumLaraSpheres = num2;
|
||||||
if (l == LaraItem)
|
if (l == LaraItem)
|
||||||
GotLaraSpheres = true;
|
GotLaraSpheres = true;
|
||||||
|
@ -129,7 +55,7 @@ int TestCollision(ITEM_INFO* item, ITEM_INFO* l)
|
||||||
{
|
{
|
||||||
GotLaraSpheres = false;
|
GotLaraSpheres = false;
|
||||||
|
|
||||||
num2 = GetSpheres(l, LaraSpheres, 1);
|
num2 = GetSpheres(l, LaraSpheres, SPHERES_SPACE_WORLD, Matrix::Identity);
|
||||||
NumLaraSpheres = num2;
|
NumLaraSpheres = num2;
|
||||||
if (l == LaraItem)
|
if (l == LaraItem)
|
||||||
GotLaraSpheres = true;
|
GotLaraSpheres = true;
|
||||||
|
@ -146,11 +72,11 @@ int TestCollision(ITEM_INFO* item, ITEM_INFO* l)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < num1; i++)
|
for (int i = 0; i < num1; i++)
|
||||||
{
|
{
|
||||||
SPHERE* ptr1 = &SphereList[i];
|
SPHERE* ptr1 = &CreatureSpheres[i];
|
||||||
|
|
||||||
int x1 = ptr1->x;
|
int x1 = item->pos.xPos + ptr1->x;
|
||||||
int y1 = ptr1->y;
|
int y1 = item->pos.yPos + ptr1->y;
|
||||||
int z1 = ptr1->z;
|
int z1 = item->pos.zPos + ptr1->z;
|
||||||
int r1 = ptr1->r;
|
int r1 = ptr1->r;
|
||||||
|
|
||||||
if (r1 > 0)
|
if (r1 > 0)
|
||||||
|
@ -159,9 +85,9 @@ int TestCollision(ITEM_INFO* item, ITEM_INFO* l)
|
||||||
{
|
{
|
||||||
SPHERE* ptr2 = &LaraSpheres[j];
|
SPHERE* ptr2 = &LaraSpheres[j];
|
||||||
|
|
||||||
int x2 = ptr2->x;
|
int x2 = item->pos.xPos + ptr2->x;
|
||||||
int y2 = ptr2->y;
|
int y2 = item->pos.yPos + ptr2->y;
|
||||||
int z2 = ptr2->z;
|
int z2 = item->pos.zPos + ptr2->z;
|
||||||
int r2 = ptr2->r;
|
int r2 = ptr2->r;
|
||||||
|
|
||||||
if (r2 > 0)
|
if (r2 > 0)
|
||||||
|
@ -188,118 +114,63 @@ int TestCollision(ITEM_INFO* item, ITEM_INFO* l)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetJointAbsPosition(ITEM_INFO* item, PHD_VECTOR* vec, int joint)
|
void GetMatrixFromTrAngle(Matrix* matrix, short* frameptr, int index)
|
||||||
{
|
{
|
||||||
int* MatrixStash = MatrixPtr;
|
short* ptr = &frameptr[0];
|
||||||
int* IMStash = IMptr;
|
|
||||||
byte* DxMatrixStash = DxMatrixPtr;
|
|
||||||
|
|
||||||
OBJECT_INFO* obj = &Objects[item->objectNumber];
|
ptr += 9;
|
||||||
|
for (int i = 0; i < index; i++)
|
||||||
int rate;
|
|
||||||
short* frmptr[2];
|
|
||||||
int frac = GetFrame_D2(item, frmptr, &rate);
|
|
||||||
|
|
||||||
phd_PushUnitMatrix();
|
|
||||||
phd_SetTrans(0, 0, 0);
|
|
||||||
phd_RotYXZ(item->pos.yRot, item->pos.xRot, item->pos.zRot);
|
|
||||||
|
|
||||||
short* extraRotation;
|
|
||||||
if (item->data)
|
|
||||||
extraRotation = (short*)item->data;
|
|
||||||
else
|
|
||||||
extraRotation = NullRotations;
|
|
||||||
|
|
||||||
int* bone = &Bones[obj->boneIndex];
|
|
||||||
|
|
||||||
if (!frac)
|
|
||||||
{
|
{
|
||||||
phd_TranslateRel((int) * (frmptr[0] + 6), (int) * (frmptr[0] + 7), (int) * (frmptr[0] + 8));
|
ptr += ((*ptr & 0xc000) == 0 ? 2 : 1);
|
||||||
short* rotation1 = frmptr[0] + 9;
|
|
||||||
gar_RotYXZsuperpack(&rotation1, 0);
|
|
||||||
|
|
||||||
for (int i = 0; i < joint; i++, bone += 4)
|
|
||||||
{
|
|
||||||
int poppush = bone[0];
|
|
||||||
|
|
||||||
if (poppush & 1)
|
|
||||||
phd_PopMatrix();
|
|
||||||
|
|
||||||
if (poppush & 2)
|
|
||||||
phd_PushMatrix();
|
|
||||||
|
|
||||||
phd_TranslateRel(bone[1], bone[2], bone[3]);
|
|
||||||
gar_RotYXZsuperpack(&rotation1, 0);
|
|
||||||
|
|
||||||
if (poppush & (ROT_X | ROT_Y | ROT_Z))
|
|
||||||
{
|
|
||||||
if (poppush & ROT_Y)
|
|
||||||
phd_RotY(*(extraRotation++));
|
|
||||||
|
|
||||||
if (poppush & ROT_X)
|
|
||||||
phd_RotX(*(extraRotation++));
|
|
||||||
|
|
||||||
if (poppush & ROT_Z)
|
|
||||||
phd_RotZ(*(extraRotation++));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
phd_TranslateRel(vec->x, vec->y, vec->z);
|
|
||||||
|
|
||||||
vec->x = (MatrixPtr[M03] >> W2V_SHIFT) + item->pos.xPos;
|
|
||||||
vec->y = (MatrixPtr[M13] >> W2V_SHIFT) + item->pos.yPos;
|
|
||||||
vec->z = (MatrixPtr[M23] >> W2V_SHIFT) + item->pos.zPos;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
InitInterpolate2(frac, rate);
|
|
||||||
short* rotation1 = frmptr[0] + 9;
|
|
||||||
short* rotation2 = frmptr[1] + 9;
|
|
||||||
phd_TranslateRel_ID((int) * (frmptr[0] + 6), (int) * (frmptr[0] + 7), (int) * (frmptr[0] + 8),
|
|
||||||
(int) * (frmptr[1] + 6), (int) * (frmptr[1] + 7), (int) * (frmptr[1] + 8));
|
|
||||||
gar_RotYXZsuperpack_I(&rotation1, &rotation2, 0);
|
|
||||||
|
|
||||||
for (int i = 0; i < joint; i++, bone += 4)
|
|
||||||
{
|
|
||||||
int poppush = bone[0];
|
|
||||||
|
|
||||||
if (poppush & 1)
|
|
||||||
phd_PopMatrix_I();
|
|
||||||
if (poppush & 2)
|
|
||||||
phd_PushMatrix_I();
|
|
||||||
|
|
||||||
phd_TranslateRel_I(bone[1], bone[2], bone[3]);
|
|
||||||
gar_RotYXZsuperpack_I(&rotation1, &rotation2, 0);
|
|
||||||
|
|
||||||
if (poppush & (ROT_X | ROT_Y | ROT_Z))
|
|
||||||
{
|
|
||||||
if (poppush & ROT_Y)
|
|
||||||
phd_RotY_I(*(extraRotation++));
|
|
||||||
|
|
||||||
if (poppush & ROT_X)
|
|
||||||
phd_RotX_I(*(extraRotation++));
|
|
||||||
|
|
||||||
if (poppush & ROT_Z)
|
|
||||||
phd_RotZ_I(*(extraRotation++));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
phd_TranslateRel_I(vec->x, vec->y, vec->z);
|
|
||||||
InterpolateMatrix();
|
|
||||||
|
|
||||||
vec->x = (MatrixPtr[M03] >> W2V_SHIFT) + item->pos.xPos;
|
|
||||||
vec->y = (MatrixPtr[M13] >> W2V_SHIFT) + item->pos.yPos;
|
|
||||||
vec->z = (MatrixPtr[M23] >> W2V_SHIFT) + item->pos.zPos;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MatrixPtr = MatrixStash;
|
int rot0 = *ptr++;
|
||||||
IMptr = IMStash;
|
int frameMode = (rot0 & 0xc000);
|
||||||
DxMatrixPtr = DxMatrixStash;
|
|
||||||
|
int rot1;
|
||||||
|
int rotX;
|
||||||
|
int rotY;
|
||||||
|
int rotZ;
|
||||||
|
|
||||||
|
switch (frameMode)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
rot1 = *ptr++;
|
||||||
|
rotX = ((rot0 & 0x3ff0) >> 4);
|
||||||
|
rotY = (((rot1 & 0xfc00) >> 10) | ((rot0 & 0xf) << 6) & 0x3ff);
|
||||||
|
rotZ = ((rot1) & 0x3ff);
|
||||||
|
|
||||||
|
*matrix = Matrix::CreateFromYawPitchRoll(rotY * (360.0f / 1024.0f) * RADIAN,
|
||||||
|
rotX * (360.0f / 1024.0f) * RADIAN,
|
||||||
|
rotZ * (360.0f / 1024.0f) * RADIAN);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x4000:
|
||||||
|
*matrix = Matrix::CreateRotationX((rot0 & 0xfff) * (360.0f / 4096.0f) * RADIAN);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x8000:
|
||||||
|
*matrix = Matrix::CreateRotationY((rot0 & 0xfff) * (360.0f / 4096.0f) * RADIAN);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0xc000:
|
||||||
|
*matrix = Matrix::CreateRotationZ((rot0 & 0xfff) * (360.0f / 4096.0f) * RADIAN);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GetJointAbsPosition(ITEM_INFO* item, PHD_VECTOR* vec, int joint)
|
||||||
void Inject_Sphere()
|
|
||||||
{
|
{
|
||||||
INJECT(0x00479380, GetSpheres);
|
// Get the real item number
|
||||||
INJECT(0x00479170, TestCollision);
|
short itemNumber = item - Items;
|
||||||
}
|
|
||||||
|
// Use matrices done in the renderer and transform the input vector
|
||||||
|
Vector3 p = Vector3(vec->x, vec->y, vec->z);
|
||||||
|
g_Renderer->GetItemAbsBonePosition(itemNumber, &p, joint);
|
||||||
|
|
||||||
|
// Store the result
|
||||||
|
vec->x = p.x;
|
||||||
|
vec->y = p.y;
|
||||||
|
vec->z = p.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,18 +2,17 @@
|
||||||
|
|
||||||
#include "..\Global\global.h"
|
#include "..\Global\global.h"
|
||||||
|
|
||||||
//#define TestCollision ((int (__cdecl*)(ITEM_INFO*, ITEM_INFO*)) 0x00479170)
|
#define SPHERES_SPACE_LOCAL 0
|
||||||
//#define GetJointAbsPosition ((int (__cdecl*)(ITEM_INFO*, PHD_VECTOR*, int)) 0x00479780)
|
#define SPHERES_SPACE_WORLD 1
|
||||||
//#define GetSpheres ((int (__cdecl*)(ITEM_INFO*, SPHERE*, int)) 0x00479380)
|
#define SPHERES_SPACE_BONE_ORIGIN 2
|
||||||
|
#define MAX_SPHERES 34
|
||||||
#define InterpolateMatrix ((int (__cdecl*)()) 0x0042C8F0)
|
|
||||||
#define InitInterpolate2 ((int (__cdecl*)(int, int)) 0x00479BB0)
|
|
||||||
|
|
||||||
|
extern int NumLaraSpheres;
|
||||||
extern bool GotLaraSpheres;
|
extern bool GotLaraSpheres;
|
||||||
extern SPHERE BaddieSpheres[34];
|
extern SPHERE LaraSpheres[MAX_SPHERES];
|
||||||
|
extern SPHERE CreatureSpheres[MAX_SPHERES];
|
||||||
|
|
||||||
int TestCollision(ITEM_INFO* item, ITEM_INFO* l);
|
int TestCollision(ITEM_INFO* item, ITEM_INFO* l);
|
||||||
int GetSpheres(ITEM_INFO* item, SPHERE* ptr, char worldSpace);
|
int GetSpheres(ITEM_INFO* item, SPHERE* ptr, int worldSpace, Matrix local);
|
||||||
void GetJointAbsPosition(ITEM_INFO* item, PHD_VECTOR* vec, int joint);
|
void GetJointAbsPosition(ITEM_INFO* item, PHD_VECTOR* vec, int joint);
|
||||||
|
void GetMatrixFromTrAngle(Matrix* matrix, short* frameptr, int index);
|
||||||
void Inject_Sphere();
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "..\Global\global.h"
|
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
#include "tomb4fx.h"
|
#include "tomb4fx.h"
|
||||||
#include "switch.h"
|
#include "switch.h"
|
||||||
|
#include "lara.h"
|
||||||
|
#include "../Specific/input.h"
|
||||||
|
|
||||||
int LastSequence;
|
int LastSequence;
|
||||||
int SpotcamTimer;
|
int SpotcamTimer;
|
||||||
|
@ -42,6 +44,11 @@ int LaraAir;
|
||||||
int CurrentSpotcamSequence;
|
int CurrentSpotcamSequence;
|
||||||
SPOTCAM SpotCam[64];
|
SPOTCAM SpotCam[64];
|
||||||
int NumberSpotcams;
|
int NumberSpotcams;
|
||||||
|
int CheckTrigger = 0;
|
||||||
|
int UseSpotCam = 0;
|
||||||
|
int SlowMotion;
|
||||||
|
int SpotcamDontDrawLara;
|
||||||
|
int SpotcamOverlay;
|
||||||
|
|
||||||
extern Renderer11* g_Renderer;
|
extern Renderer11* g_Renderer;
|
||||||
|
|
||||||
|
@ -467,7 +474,7 @@ void CalculateSpotCameras()
|
||||||
dy = SQUARE(cy - ly);
|
dy = SQUARE(cy - ly);
|
||||||
dz = SQUARE(cz - lz);
|
dz = SQUARE(cz - lz);
|
||||||
|
|
||||||
tlen = SQRT_ASM(dx + dy + dz);
|
tlen = sqrt(dx + dy + dz);
|
||||||
|
|
||||||
if (tlen <= clen)
|
if (tlen <= clen)
|
||||||
{
|
{
|
||||||
|
@ -553,7 +560,7 @@ void CalculateSpotCameras()
|
||||||
dy = (Camera.pos.y - QuakeCam.epos.y);
|
dy = (Camera.pos.y - QuakeCam.epos.y);
|
||||||
dz = (Camera.pos.z - QuakeCam.epos.z);
|
dz = (Camera.pos.z - QuakeCam.epos.z);
|
||||||
|
|
||||||
if (SQRT_ASM(SQUARE(dx) * SQUARE(dy) * SQUARE(dz)) < QuakeCam.epos.boxNumber)
|
if (sqrt(SQUARE(dx) * SQUARE(dy) * SQUARE(dz)) < QuakeCam.epos.boxNumber)
|
||||||
{
|
{
|
||||||
dz = QuakeCam.spos.roomNumber + (((QuakeCam.epos.roomNumber - QuakeCam.spos.roomNumber) * -QuakeCam.epos.boxNumber) / QuakeCam.epos.boxNumber) >> 1;
|
dz = QuakeCam.spos.roomNumber + (((QuakeCam.epos.roomNumber - QuakeCam.spos.roomNumber) * -QuakeCam.epos.boxNumber) / QuakeCam.epos.boxNumber) >> 1;
|
||||||
dy = QuakeCam.spos.roomNumber + (((QuakeCam.epos.roomNumber - QuakeCam.spos.roomNumber) * -QuakeCam.epos.boxNumber) / QuakeCam.epos.boxNumber);
|
dy = QuakeCam.spos.roomNumber + (((QuakeCam.epos.roomNumber - QuakeCam.spos.roomNumber) * -QuakeCam.epos.boxNumber) / QuakeCam.epos.boxNumber);
|
||||||
|
@ -639,7 +646,7 @@ void CalculateSpotCameras()
|
||||||
QuakeCam.epos.roomNumber = 0;
|
QuakeCam.epos.roomNumber = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QuakeCam.epos.boxNumber = SQRT_ASM(((QuakeCam.spos.x - QuakeCam.epos.x) * (QuakeCam.spos.x - QuakeCam.epos.x)) + ((QuakeCam.spos.y - QuakeCam.epos.y) * (QuakeCam.spos.y - QuakeCam.epos.y) + ((QuakeCam.spos.z - QuakeCam.epos.z) * (QuakeCam.spos.z - QuakeCam.epos.z))));
|
QuakeCam.epos.boxNumber = sqrt(((QuakeCam.spos.x - QuakeCam.epos.x) * (QuakeCam.spos.x - QuakeCam.epos.x)) + ((QuakeCam.spos.y - QuakeCam.epos.y) * (QuakeCam.spos.y - QuakeCam.epos.y) + ((QuakeCam.spos.z - QuakeCam.epos.z) * (QuakeCam.spos.z - QuakeCam.epos.z))));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -899,9 +906,32 @@ void CalculateSpotCameras()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inject_Spotcam()
|
// It just works (tm)!
|
||||||
|
int Spline(int x, int* knots, int nk)
|
||||||
{
|
{
|
||||||
INJECT(0x0047A800, InitSpotCamSequences);
|
int64_t v3 = x * (int64_t)(nk - 3) << 16 >> 16;
|
||||||
INJECT(0x0047A9D0, InitialiseSpotCam);
|
int32_t v4 = (int32_t)v3 >> 16;
|
||||||
INJECT(0x0047B280, CalculateSpotCameras);
|
if ((int32_t)v3 >> 16 >= nk - 3)
|
||||||
}
|
v4 = nk - 4;
|
||||||
|
int32_t v5 = knots[v4];
|
||||||
|
int32_t v6 = knots[v4 + 2];
|
||||||
|
int32_t nka = knots[v4 + 3] >> 1;
|
||||||
|
int32_t v7 = knots[v4 + 1];
|
||||||
|
return (int32_t)(v7
|
||||||
|
+ (int64_t)(uint64_t)((int32_t)((~v5 >> 1)
|
||||||
|
+ (v6 >> 1)
|
||||||
|
+ (int64_t)(uint64_t)((int32_t)(v5
|
||||||
|
+ (int64_t)(uint64_t)(((~v5 >> 1)
|
||||||
|
+ nka
|
||||||
|
+ v7
|
||||||
|
+ (v7 >> 1)
|
||||||
|
- (v6 >> 1)
|
||||||
|
- v6)
|
||||||
|
* (int64_t)((int32_t)v3 - (v4 << 16)) >> 16)
|
||||||
|
- 2 * v7
|
||||||
|
+ 2 * v6
|
||||||
|
- (v7 >> 1)
|
||||||
|
- nka)
|
||||||
|
* (int64_t)((int32_t)v3 - (v4 << 16)) >> 16))
|
||||||
|
* (int64_t)((int32_t)v3 - (v4 << 16)) >> 16));
|
||||||
|
}
|
||||||
|
|
|
@ -22,20 +22,16 @@ enum spotcam_flags
|
||||||
SCF_CAMERA_ONE_SHOT = (1 << 15), // 0x8000
|
SCF_CAMERA_ONE_SHOT = (1 << 15), // 0x8000
|
||||||
};
|
};
|
||||||
|
|
||||||
//#define InitSpotCamSequences ((void (__cdecl*)()) 0x0047A800)
|
|
||||||
//#define CalculateSpotCameras ((void (__cdecl*)()) 0x0047B280)
|
|
||||||
//#define InitialiseSpotCam ((void (__cdecl*)(short)) 0x0047A9D0)
|
|
||||||
#define TriggerTitleSpotcam ((void (__cdecl*)(int)) 0x004284A0)
|
|
||||||
#define Spline ((int (__cdecl*)(int, int*, int)) 0x0047A890)
|
|
||||||
|
|
||||||
extern byte SpotCamRemap[16];
|
extern byte SpotCamRemap[16];
|
||||||
extern byte CameraCnt[16];
|
extern byte CameraCnt[16];
|
||||||
extern int LastSpotCam;
|
extern int LastSpotCam;
|
||||||
extern SPOTCAM SpotCam[64];
|
extern SPOTCAM SpotCam[64];
|
||||||
extern int NumberSpotcams;
|
extern int NumberSpotcams;
|
||||||
|
extern int UseSpotCam;
|
||||||
|
extern int SpotcamDontDrawLara;
|
||||||
|
extern int SpotcamOverlay;
|
||||||
|
|
||||||
void InitSpotCamSequences();
|
void InitSpotCamSequences();
|
||||||
void InitialiseSpotCam(short sequence);
|
void InitialiseSpotCam(short sequence);
|
||||||
void CalculateSpotCameras();
|
void CalculateSpotCameras();
|
||||||
|
int Spline(int x, int* knots, int nk);
|
||||||
void Inject_Spotcam();
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -11,6 +11,9 @@
|
||||||
#include "sphere.h"
|
#include "sphere.h"
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
#include "../Specific/setup.h"
|
#include "../Specific/setup.h"
|
||||||
|
#include "..\Specific\level.h"
|
||||||
|
#include "../Specific/input.h"
|
||||||
|
#include "sound.h"
|
||||||
|
|
||||||
byte SequenceUsed[6];
|
byte SequenceUsed[6];
|
||||||
byte SequenceResults[3][3][3];
|
byte SequenceResults[3][3][3];
|
||||||
|
@ -258,7 +261,7 @@ void CogSwitchCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)
|
||||||
item->status = ITEM_ACTIVE;
|
item->status = ITEM_ACTIVE;
|
||||||
if (!door->opened)
|
if (!door->opened)
|
||||||
{
|
{
|
||||||
AddActiveItem((target - Items) / sizeof(ITEM_INFO));
|
AddActiveItem((target - Items));
|
||||||
target->itemFlags[2] = target->pos.yPos;
|
target->itemFlags[2] = target->pos.yPos;
|
||||||
target->status = ITEM_ACTIVE;
|
target->status = ITEM_ACTIVE;
|
||||||
}
|
}
|
||||||
|
@ -469,7 +472,7 @@ void CrowbarSwitchCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)
|
||||||
|
|
||||||
if (!(Lara.isMoving && g_Inventory->GetSelectedObject() != ID_CROWBAR_ITEM))
|
if (!(Lara.isMoving && g_Inventory->GetSelectedObject() != ID_CROWBAR_ITEM))
|
||||||
{
|
{
|
||||||
if (g_LaraExtra.Crowbar)
|
if (Lara.Crowbar)
|
||||||
g_Inventory->SetEnterObject(ID_CROWBAR_ITEM);
|
g_Inventory->SetEnterObject(ID_CROWBAR_ITEM);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -523,7 +526,7 @@ void CrowbarSwitchCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_LaraExtra.Crowbar)
|
if (Lara.Crowbar)
|
||||||
g_Inventory->SetEnterObject(ID_CROWBAR_ITEM);
|
g_Inventory->SetEnterObject(ID_CROWBAR_ITEM);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -701,8 +704,8 @@ void TurnSwitchCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)
|
||||||
item->animNumber = Objects[item->objectNumber].animIndex + 4;
|
item->animNumber = Objects[item->objectNumber].animIndex + 4;
|
||||||
item->frameNumber = Anims[item->animNumber].frameBase;
|
item->frameNumber = Anims[item->animNumber].frameBase;
|
||||||
item->itemFlags[0] = 1;
|
item->itemFlags[0] = 1;
|
||||||
ForcedFixedCamera.x = item->pos.xPos - (1024 * SIN(item->pos.yRot) >> W2V_SHIFT);
|
ForcedFixedCamera.x = item->pos.xPos - (1024 * phd_sin(item->pos.yRot) >> W2V_SHIFT);
|
||||||
ForcedFixedCamera.z = item->pos.zPos - (1024 * COS(item->pos.yRot) >> W2V_SHIFT);
|
ForcedFixedCamera.z = item->pos.zPos - (1024 * phd_cos(item->pos.yRot) >> W2V_SHIFT);
|
||||||
Lara.isMoving = 0;
|
Lara.isMoving = 0;
|
||||||
Lara.headYrot = 0;
|
Lara.headYrot = 0;
|
||||||
Lara.headXrot = 0;
|
Lara.headXrot = 0;
|
||||||
|
@ -743,8 +746,8 @@ void TurnSwitchCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)
|
||||||
flag = 1;
|
flag = 1;
|
||||||
l->frameNumber = Anims[319].frameBase;
|
l->frameNumber = Anims[319].frameBase;
|
||||||
item->itemFlags[0] = 2;
|
item->itemFlags[0] = 2;
|
||||||
ForcedFixedCamera.x = item->pos.xPos + (1024 * SIN(item->pos.yRot) >> W2V_SHIFT);
|
ForcedFixedCamera.x = item->pos.xPos + (1024 * phd_sin(item->pos.yRot) >> W2V_SHIFT);
|
||||||
ForcedFixedCamera.z = item->pos.zPos + (1024 * COS(item->pos.yRot) >> W2V_SHIFT);
|
ForcedFixedCamera.z = item->pos.zPos + (1024 * phd_cos(item->pos.yRot) >> W2V_SHIFT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -971,9 +974,9 @@ void UnderwaterSwitchCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)
|
||||||
|
|
||||||
AddActiveItem(itemNum);
|
AddActiveItem(itemNum);
|
||||||
|
|
||||||
ForcedFixedCamera.x = item->pos.xPos - 1024 * SIN(item->pos.yRot + ANGLE(90)) >> W2V_SHIFT;
|
ForcedFixedCamera.x = item->pos.xPos - 1024 * phd_sin(item->pos.yRot + ANGLE(90)) >> W2V_SHIFT;
|
||||||
ForcedFixedCamera.y = item->pos.yPos - 1024;
|
ForcedFixedCamera.y = item->pos.yPos - 1024;
|
||||||
ForcedFixedCamera.z = item->pos.zPos - 1024 * COS(item->pos.yRot + ANGLE(90)) >> W2V_SHIFT;
|
ForcedFixedCamera.z = item->pos.zPos - 1024 * phd_cos(item->pos.yRot + ANGLE(90)) >> W2V_SHIFT;
|
||||||
ForcedFixedCamera.roomNumber = item->roomNumber;
|
ForcedFixedCamera.roomNumber = item->roomNumber;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -1002,9 +1005,9 @@ void UnderwaterSwitchCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)
|
||||||
|
|
||||||
AddActiveItem(itemNum);
|
AddActiveItem(itemNum);
|
||||||
|
|
||||||
ForcedFixedCamera.x = item->pos.xPos - 1024 * SIN(item->pos.yRot + ANGLE(90)) >> W2V_SHIFT;
|
ForcedFixedCamera.x = item->pos.xPos - 1024 * phd_sin(item->pos.yRot + ANGLE(90)) >> W2V_SHIFT;
|
||||||
ForcedFixedCamera.y = item->pos.yPos - 1024;
|
ForcedFixedCamera.y = item->pos.yPos - 1024;
|
||||||
ForcedFixedCamera.z = item->pos.zPos - 1024 * COS(item->pos.yRot + ANGLE(90)) >> W2V_SHIFT;
|
ForcedFixedCamera.z = item->pos.zPos - 1024 * phd_cos(item->pos.yRot + ANGLE(90)) >> W2V_SHIFT;
|
||||||
ForcedFixedCamera.roomNumber = item->roomNumber;
|
ForcedFixedCamera.roomNumber = item->roomNumber;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1424,26 +1427,3 @@ void ShootSwitchCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll)
|
||||||
if (item->objectNumber == ID_SHOOT_SWITCH1 && !(item->meshBits & 1))
|
if (item->objectNumber == ID_SHOOT_SWITCH1 && !(item->meshBits & 1))
|
||||||
item->status = ITEM_INVISIBLE;
|
item->status = ITEM_INVISIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inject_Switch()
|
|
||||||
{
|
|
||||||
INJECT(0x0047FD20, CrowDoveSwitchCollision);
|
|
||||||
INJECT(0x0047FC80, CrowDoveSwitchControl);
|
|
||||||
INJECT(0x0047F990, CogSwitchCollision);
|
|
||||||
INJECT(0x0047F810, CogSwitchControl);
|
|
||||||
INJECT(0x0047F610, FullBlockSwitchCollision);
|
|
||||||
INJECT(0x0047F520, FullBlockSwitchControl);
|
|
||||||
INJECT(0x0047F190, CrowbarSwitchCollision);
|
|
||||||
INJECT(0x0047F050, JumpSwitchCollision);
|
|
||||||
INJECT(0x0047EE00, RailSwitchCollision);
|
|
||||||
INJECT(0x0047E950, TurnSwitchCollision);
|
|
||||||
INJECT(0x0047E650, TurnSwitchControl);
|
|
||||||
INJECT(0x0047E450, PulleyCollision);
|
|
||||||
INJECT(0x0047E220, UnderwaterSwitchCollision);
|
|
||||||
INJECT(0x0047E0C0, SwitchCollision2);
|
|
||||||
INJECT(0x0047DC70, SwitchCollision);
|
|
||||||
INJECT(0x0047D9D0, TestTriggersAtXYZ);
|
|
||||||
INJECT(0x0047D8C0, GetKeyTrigger);
|
|
||||||
INJECT(0x0047D7B0, GetSwitchTrigger);
|
|
||||||
INJECT(0x0047D670, SwitchTrigger);
|
|
||||||
}
|
|
|
@ -1,12 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "..\Global\global.h"
|
#include "..\Global\global.h"
|
||||||
|
|
||||||
//#define InitialiseSwitch ((void (__cdecl*)(short)) 0x00440070)
|
|
||||||
//#define SequenceControl ((void (__cdecl*)(short)) 0x0047F520)
|
|
||||||
//#define SequenceCollision ((void (__cdecl*)(short,ITEM_INFO*,COLL_INFO*)) 0x0047F610)
|
|
||||||
//#define LeverSwitchCollision ((void (__cdecl*)(short,ITEM_INFO*,COLL_INFO*)) 0x0047EE00)
|
|
||||||
//#define InitialisePulleySwitch ((void (__cdecl*)(short)) 0x0043E1F0)
|
|
||||||
//#define InitialiseCrowDoveSwitch ((void (__cdecl*)(short)) 0x0043ECF0)
|
|
||||||
void CrowDoveSwitchCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll);
|
void CrowDoveSwitchCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll);
|
||||||
void CrowDoveSwitchControl(short itemNumber);
|
void CrowDoveSwitchControl(short itemNumber);
|
||||||
void CogSwitchCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll);
|
void CogSwitchCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll);
|
||||||
|
@ -35,5 +29,3 @@ void InitialiseShootSwitch(short itemNumber);
|
||||||
void ShootSwitchCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll);
|
void ShootSwitchCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll);
|
||||||
|
|
||||||
extern int PulleyItemNumber;
|
extern int PulleyItemNumber;
|
||||||
|
|
||||||
void Inject_Switch();
|
|
|
@ -5,8 +5,3 @@ void PrintString(int x, int y, int unk1, char* string, int unk2)
|
||||||
{
|
{
|
||||||
g_Renderer->PrintString(x, y, string, 0xFFFFFFFF, 0);
|
g_Renderer->PrintString(x, y, string, 0xFFFFFFFF, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inject_Text()
|
|
||||||
{
|
|
||||||
INJECT(0x00480BC0, PrintString);
|
|
||||||
}
|
|
|
@ -2,5 +2,3 @@
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
|
|
||||||
void PrintString(int x, int y, int unk1, char* string, int unk2);
|
void PrintString(int x, int y, int unk1, char* string, int unk2);
|
||||||
|
|
||||||
void Inject_Text();
|
|
|
@ -5,6 +5,8 @@
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
#include "items.h"
|
#include "items.h"
|
||||||
#include "../Specific/setup.h"
|
#include "../Specific/setup.h"
|
||||||
|
#include "..\Specific\level.h"
|
||||||
|
#include "sound.h"
|
||||||
#include "bubble.h"
|
#include "bubble.h"
|
||||||
|
|
||||||
char FlareTable[121] =
|
char FlareTable[121] =
|
||||||
|
@ -834,7 +836,7 @@ void TriggerGunShell(short hand, short objNum, int weaponType)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetLaraJointPosition(&pos, LJ_RHAND);
|
GetLaraJointPosition(&pos, LM_RHAND);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -844,7 +846,7 @@ void TriggerGunShell(short hand, short objNum, int weaponType)
|
||||||
pos.y = 48;
|
pos.y = 48;
|
||||||
pos.z = 40;
|
pos.z = 40;
|
||||||
|
|
||||||
GetLaraJointPosition(&pos, LJ_LHAND);
|
GetLaraJointPosition(&pos, LM_LHAND);
|
||||||
}
|
}
|
||||||
else if (weaponType == WEAPON_UZI)
|
else if (weaponType == WEAPON_UZI)
|
||||||
{
|
{
|
||||||
|
@ -852,7 +854,7 @@ void TriggerGunShell(short hand, short objNum, int weaponType)
|
||||||
pos.y = 35;
|
pos.y = 35;
|
||||||
pos.z = 48;
|
pos.z = 48;
|
||||||
|
|
||||||
GetLaraJointPosition(&pos, LJ_LHAND);
|
GetLaraJointPosition(&pos, LM_LHAND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -949,9 +951,9 @@ void UpdateGunShells()
|
||||||
gs->pos.yRot += gs->speed * ANGLE(1);
|
gs->pos.yRot += gs->speed * ANGLE(1);
|
||||||
gs->pos.zRot += ANGLE(23);
|
gs->pos.zRot += ANGLE(23);
|
||||||
|
|
||||||
gs->pos.xPos += gs->speed * SIN(gs->dirXrot) >> W2V_SHIFT;
|
gs->pos.xPos += gs->speed * phd_sin(gs->dirXrot) >> W2V_SHIFT;
|
||||||
gs->pos.yPos += gs->fallspeed;
|
gs->pos.yPos += gs->fallspeed;
|
||||||
gs->pos.zPos += gs->speed * COS(gs->dirXrot) >> W2V_SHIFT;
|
gs->pos.zPos += gs->speed * phd_cos(gs->dirXrot) >> W2V_SHIFT;
|
||||||
|
|
||||||
FLOOR_INFO* floor = GetFloor(gs->pos.xPos, gs->pos.yPos, gs->pos.zPos, &gs->roomNumber);
|
FLOOR_INFO* floor = GetFloor(gs->pos.xPos, gs->pos.yPos, gs->pos.zPos, &gs->roomNumber);
|
||||||
if (Rooms[gs->roomNumber].flags & ENV_FLAG_WATER
|
if (Rooms[gs->roomNumber].flags & ENV_FLAG_WATER
|
||||||
|
@ -1057,14 +1059,14 @@ void LaraBubbles(ITEM_INFO* item)// (F)
|
||||||
pos.y = -192;
|
pos.y = -192;
|
||||||
pos.z = -160;
|
pos.z = -160;
|
||||||
|
|
||||||
GetLaraJointPosition(&pos, LJ_TORSO);
|
GetLaraJointPosition(&pos, LM_TORSO);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pos.y = -4;
|
pos.y = -4;
|
||||||
pos.z = 64;
|
pos.z = 64;
|
||||||
|
|
||||||
GetLaraJointPosition(&pos, LJ_HEAD);
|
GetLaraJointPosition(&pos, LM_HEAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
num = (GetRandomControl() & 1) + 2;
|
num = (GetRandomControl() & 1) + 2;
|
||||||
|
@ -1199,20 +1201,27 @@ void TriggerLaraDrips()// (F)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int ExplodingDeath2(short itemNumber, int meshBits, short damage)
|
int ExplodingDeath(short itemNumber, int meshBits, short damage)
|
||||||
{
|
{
|
||||||
ITEM_INFO* item = &Items[itemNumber];
|
ITEM_INFO* item = &Items[itemNumber];
|
||||||
OBJECT_INFO* obj = &Objects[item->objectNumber];
|
ObjectInfo* obj = &Objects[item->objectNumber];
|
||||||
|
|
||||||
short* frame = GetBestFrame(item);
|
short* frame = GetBestFrame(item);
|
||||||
|
|
||||||
phd_PushUnitMatrix();
|
Matrix world = Matrix::CreateFromYawPitchRoll(
|
||||||
|
TO_RAD(item->pos.yRot),
|
||||||
|
TO_RAD(item->pos.xRot),
|
||||||
|
TO_RAD(item->pos.zRot)
|
||||||
|
);
|
||||||
|
|
||||||
|
// PHD_MATH:
|
||||||
|
/*phd_PushUnitMatrix();
|
||||||
|
|
||||||
MatrixPtr[M03] = 0;
|
MatrixPtr[M03] = 0;
|
||||||
MatrixPtr[M13] = 0;
|
MatrixPtr[M13] = 0;
|
||||||
MatrixPtr[M23] = 0;
|
MatrixPtr[M23] = 0;
|
||||||
|
|
||||||
phd_RotYXZ(item->pos.yPos, item->pos.xRot, item->pos.zRot);
|
phd_RotYXZ(item->pos.yRot, item->pos.xRot, item->pos.zRot);
|
||||||
phd_TranslateRel(frame[6], frame[7], frame[8]);
|
phd_TranslateRel(frame[6], frame[7], frame[8]);
|
||||||
|
|
||||||
short* rotation = &frame[9];
|
short* rotation = &frame[9];
|
||||||
|
@ -1227,13 +1236,15 @@ int ExplodingDeath2(short itemNumber, int meshBits, short damage)
|
||||||
{
|
{
|
||||||
if (damage & 0x100 || !(GetRandomControl() & 3))
|
if (damage & 0x100 || !(GetRandomControl() & 3))
|
||||||
{
|
{
|
||||||
|
Matrix boneMatrix = g_Renderer->GetBoneMatrix(item, 0);
|
||||||
|
|
||||||
int fxNumber = CreateNewEffect(item->roomNumber);
|
int fxNumber = CreateNewEffect(item->roomNumber);
|
||||||
if (fxNumber != NO_ITEM)
|
if (fxNumber != NO_ITEM)
|
||||||
{
|
{
|
||||||
FX_INFO* fx = &Effects[fxNumber];
|
FX_INFO* fx = &Effects[fxNumber];
|
||||||
fx->pos.xPos = item->pos.xPos + (MatrixPtr[M03] >> W2V_SHIFT);
|
fx->pos.xPos = item->pos.xPos + boneMatrix.Translation().x; // (MatrixPtr[M03] >> W2V_SHIFT);
|
||||||
fx->pos.yPos = item->pos.yPos + (MatrixPtr[M13] >> W2V_SHIFT);
|
fx->pos.yPos = item->pos.yPos + boneMatrix.Translation().y; // (MatrixPtr[M13] >> W2V_SHIFT);
|
||||||
fx->pos.zPos = item->pos.zPos + (MatrixPtr[M23] >> W2V_SHIFT);
|
fx->pos.zPos = item->pos.zPos + boneMatrix.Translation().z; // (MatrixPtr[M23] >> W2V_SHIFT);
|
||||||
fx->roomNumber = item->roomNumber;
|
fx->roomNumber = item->roomNumber;
|
||||||
fx->pos.yRot = 0;
|
fx->pos.yRot = 0;
|
||||||
fx->pos.zRot = 0;
|
fx->pos.zRot = 0;
|
||||||
|
@ -1285,42 +1296,20 @@ int ExplodingDeath2(short itemNumber, int meshBits, short damage)
|
||||||
|
|
||||||
for (int i = 1; i < obj->nmeshes; i++, bone += 3)
|
for (int i = 1; i < obj->nmeshes; i++, bone += 3)
|
||||||
{
|
{
|
||||||
short popPush = *(bone++);
|
|
||||||
|
|
||||||
if (popPush & 1)
|
|
||||||
{
|
|
||||||
MatrixPtr -= 12;
|
|
||||||
DxMatrixPtr -= 48;
|
|
||||||
}
|
|
||||||
else if (popPush & 2)
|
|
||||||
{
|
|
||||||
phd_PushMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
phd_TranslateRel(bone[0], bone[1], bone[2]);
|
|
||||||
gar_RotYXZsuperpack(&rotation, 0);
|
|
||||||
|
|
||||||
if (popPush & (ROT_X | ROT_Y | ROT_Z))
|
|
||||||
{
|
|
||||||
if (popPush & ROT_Y)
|
|
||||||
phd_RotY(*(extraRotation++));
|
|
||||||
if (popPush & ROT_X)
|
|
||||||
phd_RotX(*(extraRotation++));
|
|
||||||
if (popPush & ROT_Z)
|
|
||||||
phd_RotZ(*(extraRotation++));
|
|
||||||
}
|
|
||||||
|
|
||||||
bits <<= 1;
|
bits <<= 1;
|
||||||
|
|
||||||
if (bits & meshBits && bits & item->meshBits && (damage & 0x100 || !(GetRandomControl() & 3)))
|
if (bits & meshBits && bits & item->meshBits && (damage & 0x100 || !(GetRandomControl() & 3)))
|
||||||
{
|
{
|
||||||
|
Matrix boneMatrix = g_Renderer->GetBoneMatrix(item, i);
|
||||||
|
Matrix matrix = boneMatrix * world;
|
||||||
|
|
||||||
int fxNumber = CreateNewEffect(item->roomNumber);
|
int fxNumber = CreateNewEffect(item->roomNumber);
|
||||||
if (fxNumber != NO_ITEM)
|
if (fxNumber != NO_ITEM)
|
||||||
{
|
{
|
||||||
FX_INFO* fx = &Effects[fxNumber];
|
FX_INFO* fx = &Effects[fxNumber];
|
||||||
fx->pos.xPos = item->pos.xPos + (MatrixPtr[3] >> 14);
|
fx->pos.xPos = item->pos.xPos + matrix.Translation().x; // (MatrixPtr[3] >> 14);
|
||||||
fx->pos.yPos = item->pos.yPos + (MatrixPtr[7] >> 14);
|
fx->pos.yPos = item->pos.yPos + matrix.Translation().y; // (MatrixPtr[7] >> 14);
|
||||||
fx->pos.zPos = item->pos.zPos + (MatrixPtr[11] >> 14);
|
fx->pos.zPos = item->pos.zPos + matrix.Translation().z; // (MatrixPtr[11] >> 14);
|
||||||
fx->roomNumber = item->roomNumber;
|
fx->roomNumber = item->roomNumber;
|
||||||
fx->pos.yRot = 0;
|
fx->pos.yRot = 0;
|
||||||
fx->pos.zRot = 0;
|
fx->pos.zRot = 0;
|
||||||
|
@ -1367,10 +1356,7 @@ int ExplodingDeath2(short itemNumber, int meshBits, short damage)
|
||||||
|
|
||||||
item->meshBits -= bits;
|
item->meshBits -= bits;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
MatrixPtr -= 12;
|
|
||||||
DxMatrixPtr = (DxMatrixPtr - 48);
|
|
||||||
|
|
||||||
return (item->meshBits == 0);
|
return (item->meshBits == 0);
|
||||||
}
|
}
|
||||||
|
@ -1433,9 +1419,9 @@ void TriggerShockwaveHitEffect(int x, int y, int z, byte r, byte g, byte b, shor
|
||||||
spark->life = spark->sLife = (GetRandomControl() & 3) + 16;
|
spark->life = spark->sLife = (GetRandomControl() & 3) + 16;
|
||||||
|
|
||||||
int speed = (GetRandomControl() & 0xF) + vel;
|
int speed = (GetRandomControl() & 0xF) + vel;
|
||||||
spark->xVel = speed * 16 * SIN(rot) >> W2V_SHIFT;
|
spark->xVel = speed * 16 * phd_sin(rot) >> W2V_SHIFT;
|
||||||
spark->yVel = -512 - (GetRandomControl() & 0x1FF);
|
spark->yVel = -512 - (GetRandomControl() & 0x1FF);
|
||||||
spark->zVel = speed * 16 * COS(rot) >> W2V_SHIFT;
|
spark->zVel = speed * 16 * phd_cos(rot) >> W2V_SHIFT;
|
||||||
|
|
||||||
short angle;
|
short angle;
|
||||||
if (GetRandomControl() & 1)
|
if (GetRandomControl() & 1)
|
||||||
|
@ -1444,8 +1430,8 @@ void TriggerShockwaveHitEffect(int x, int y, int z, byte r, byte g, byte b, shor
|
||||||
angle = rot - ANGLE(90);
|
angle = rot - ANGLE(90);
|
||||||
|
|
||||||
int shift = (GetRandomControl() & 0x1FF) - 256;
|
int shift = (GetRandomControl() & 0x1FF) - 256;
|
||||||
x += (shift * SIN(angle) >> W2V_SHIFT);
|
x += (shift * phd_sin(angle) >> W2V_SHIFT);
|
||||||
z += (shift * COS(angle) >> W2V_SHIFT);
|
z += (shift * phd_cos(angle) >> W2V_SHIFT);
|
||||||
|
|
||||||
spark->x = (GetRandomControl() & 0x1F) + x - 16;
|
spark->x = (GetRandomControl() & 0x1F) + x - 16;
|
||||||
spark->y = (GetRandomControl() & 0x1F) + y - 16;
|
spark->y = (GetRandomControl() & 0x1F) + y - 16;
|
||||||
|
@ -1491,7 +1477,7 @@ void UpdateShockwaves()
|
||||||
|
|
||||||
int dx = LaraItem->pos.xPos - sw->x;
|
int dx = LaraItem->pos.xPos - sw->x;
|
||||||
int dz = LaraItem->pos.zPos - sw->z;
|
int dz = LaraItem->pos.zPos - sw->z;
|
||||||
int distance = SQRT_ASM(SQUARE(dx) + SQUARE(dz));
|
int distance = sqrt(SQUARE(dx) + SQUARE(dz));
|
||||||
|
|
||||||
if (sw->y <= LaraItem->pos.yPos + frame[2]
|
if (sw->y <= LaraItem->pos.yPos + frame[2]
|
||||||
|| sw->y >= LaraItem->pos.yPos + frame[3] + 256
|
|| sw->y >= LaraItem->pos.yPos + frame[3] + 256
|
||||||
|
@ -1502,7 +1488,7 @@ void UpdateShockwaves()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
short angle = ATAN(dz, dx);
|
short angle = phd_atan(dz, dx);
|
||||||
TriggerShockwaveHitEffect(LaraItem->pos.xPos,
|
TriggerShockwaveHitEffect(LaraItem->pos.xPos,
|
||||||
sw->y,
|
sw->y,
|
||||||
LaraItem->pos.zPos,
|
LaraItem->pos.zPos,
|
||||||
|
@ -1748,9 +1734,9 @@ void TriggerSmallSplash(int x, int y, int z, int num)
|
||||||
|
|
||||||
angle = GetRandomControl() << 3;
|
angle = GetRandomControl() << 3;
|
||||||
|
|
||||||
sptr->xVel = -SIN(angle) >> 5;
|
sptr->xVel = -phd_sin(angle) >> 5;
|
||||||
sptr->yVel = -640 - (GetRandomControl() & 0xFF);
|
sptr->yVel = -640 - (GetRandomControl() & 0xFF);
|
||||||
sptr->zVel = COS(angle) >> 5;
|
sptr->zVel = phd_cos(angle) >> 5;
|
||||||
|
|
||||||
sptr->friction = 5;
|
sptr->friction = 5;
|
||||||
sptr->flags = 0;
|
sptr->flags = 0;
|
||||||
|
@ -1801,35 +1787,3 @@ ENERGY_ARC* TriggerEnergyArc(PHD_VECTOR* start, PHD_VECTOR* end, byte r, byte g,
|
||||||
|
|
||||||
return arc;
|
return arc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inject_Tomb4FX()
|
|
||||||
{
|
|
||||||
INJECT(0x004827E0, TriggerBlood);
|
|
||||||
INJECT(0x00431070, TriggerExplosionBubble);
|
|
||||||
INJECT(0x004812B0, GetFreeFireSpark);
|
|
||||||
INJECT(0x00481A00, TriggerGlobalStaticFlame);
|
|
||||||
INJECT(0x004816B0, TriggerGlobalFireSmoke);
|
|
||||||
INJECT(0x00481840, TriggerGlobalFireFlame);
|
|
||||||
INJECT(0x00481370, keep_those_fires_burning);
|
|
||||||
INJECT(0x00481B10, ClearFires);
|
|
||||||
INJECT(0x00481B10, AddFire);
|
|
||||||
INJECT(0x004813B0, UpdateFireSparks);
|
|
||||||
INJECT(0x00481D40, GetFreeSmokeSpark);
|
|
||||||
INJECT(0x00481DD0, UpdateSmoke);
|
|
||||||
INJECT(0x004820A0, TriggerGunSmoke);
|
|
||||||
INJECT(0x004823A0, TriggerShatterSmoke);
|
|
||||||
INJECT(0x00482580, GetFreeBlood);
|
|
||||||
INJECT(0x00482610, UpdateBlood);
|
|
||||||
INJECT(0x004829A0, GetFreeGunshell);
|
|
||||||
INJECT(0x00482A60, TriggerGunShell);
|
|
||||||
INJECT(0x00482D80, UpdateGunShells);
|
|
||||||
INJECT(0x00483180, AddWaterSparks);
|
|
||||||
INJECT(0x00483470, LaraBubbles);
|
|
||||||
INJECT(0x00483D00, GetFreeDrip);
|
|
||||||
INJECT(0x00483D90, UpdateDrips);
|
|
||||||
INJECT(0x00483F00, TriggerLaraDrips);
|
|
||||||
INJECT(0x00484080, ExplodingDeath2);
|
|
||||||
INJECT(0x00484640, GetFreeShockwave);
|
|
||||||
INJECT(0x00484670, TriggerShockwave);
|
|
||||||
INJECT(0x004849A0, UpdateShockwaves);
|
|
||||||
}
|
|
|
@ -73,7 +73,7 @@ void UpdateBubbles();
|
||||||
int GetFreeDrip();
|
int GetFreeDrip();
|
||||||
void UpdateDrips();
|
void UpdateDrips();
|
||||||
void TriggerLaraDrips();
|
void TriggerLaraDrips();
|
||||||
int ExplodingDeath2(short itemNumber, int meshBits, short damage);
|
int ExplodingDeath(short itemNumber, int meshBits, short damage);
|
||||||
int GetFreeShockwave();
|
int GetFreeShockwave();
|
||||||
void TriggerShockwave(PHD_3DPOS* pos, short innerRad, short outerRad, int speed, char r, char g, char b, char life, short angle, short flags);
|
void TriggerShockwave(PHD_3DPOS* pos, short innerRad, short outerRad, int speed, char r, char g, char b, char life, short angle, short flags);
|
||||||
void TriggerShockwaveHitEffect(int x, int y, int z, int color, short rot, int vel);
|
void TriggerShockwaveHitEffect(int x, int y, int z, int color, short rot, int vel);
|
||||||
|
@ -83,5 +83,3 @@ void SetFadeClip(short height, short speed);
|
||||||
void TriggerLightningGlow(int x, int y, int z, byte size, byte r, byte g, byte b);
|
void TriggerLightningGlow(int x, int y, int z, byte size, byte r, byte g, byte b);
|
||||||
ENERGY_ARC* TriggerEnergyArc(PHD_VECTOR* start, PHD_VECTOR* end, byte r, byte g, byte b, short segmentSize, short life, short amplitude, byte flags, byte type);
|
ENERGY_ARC* TriggerEnergyArc(PHD_VECTOR* start, PHD_VECTOR* end, byte r, byte g, byte b, short segmentSize, short life, short amplitude, byte flags, byte type);
|
||||||
void UpdateEnergyArcs();
|
void UpdateEnergyArcs();
|
||||||
|
|
||||||
void Inject_Tomb4FX();
|
|
|
@ -10,12 +10,19 @@
|
||||||
#include "sphere.h"
|
#include "sphere.h"
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
#include "objlight.h"
|
#include "objlight.h"
|
||||||
|
#include "draw.h"
|
||||||
|
#include "..\Specific\level.h"
|
||||||
|
#include "../Specific/input.h"
|
||||||
|
#include "sound.h"
|
||||||
|
|
||||||
static short CeilingTrapDoorBounds[12] = {-256, 256, 0, 900, -768, -256, -1820, 1820, -5460, 5460, -1820, 1820};
|
static short CeilingTrapDoorBounds[12] = {-256, 256, 0, 900, -768, -256, -1820, 1820, -5460, 5460, -1820, 1820};
|
||||||
static PHD_VECTOR CeilingTrapDoorPos = {0, 1056, -480};
|
static PHD_VECTOR CeilingTrapDoorPos = {0, 1056, -480};
|
||||||
static short FloorTrapDoorBounds[12] = {-256, 256, 0, 0, -1024, -256, -1820, 1820, -5460, 5460, -1820, 1820};
|
static short FloorTrapDoorBounds[12] = {-256, 256, 0, 0, -1024, -256, -1820, 1820, -5460, 5460, -1820, 1820};
|
||||||
static PHD_VECTOR FloorTrapDoorPos = {0, 0, -655};
|
static PHD_VECTOR FloorTrapDoorPos = {0, 0, -655};
|
||||||
static short WreckingBallData[2] = {0, 0};
|
static short WreckingBallData[2] = {0, 0};
|
||||||
|
ITEM_INFO* WBItem;
|
||||||
|
short WBRoom;
|
||||||
|
|
||||||
byte Flame3xzoffs[16][2] =
|
byte Flame3xzoffs[16][2] =
|
||||||
{
|
{
|
||||||
{ 0x09, 0x09 },
|
{ 0x09, 0x09 },
|
||||||
|
@ -218,10 +225,10 @@ void FlameControl(short fxNumber)
|
||||||
|
|
||||||
GetLaraJointPosition((PHD_VECTOR*)&fx->pos, i);
|
GetLaraJointPosition((PHD_VECTOR*)&fx->pos, i);
|
||||||
|
|
||||||
if (Lara.BurnCount)
|
if (Lara.burnCount)
|
||||||
{
|
{
|
||||||
Lara.BurnCount--;
|
Lara.burnCount--;
|
||||||
if (!Lara.BurnCount)
|
if (!Lara.burnCount)
|
||||||
Lara.burnSmoke = true;
|
Lara.burnSmoke = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,9 +342,9 @@ void CeilingTrapDoorCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll) /
|
||||||
item->goalAnimState = 1;
|
item->goalAnimState = 1;
|
||||||
|
|
||||||
UseForcedFixedCamera = 1;
|
UseForcedFixedCamera = 1;
|
||||||
ForcedFixedCamera.x = item->pos.xPos - SIN(item->pos.yRot) / 16;
|
ForcedFixedCamera.x = item->pos.xPos - phd_sin(item->pos.yRot) / 16;
|
||||||
ForcedFixedCamera.y = item->pos.yPos + 1024;
|
ForcedFixedCamera.y = item->pos.yPos + 1024;
|
||||||
ForcedFixedCamera.z = item->pos.zPos - COS(item->pos.yRot) / 16;
|
ForcedFixedCamera.z = item->pos.zPos - phd_cos(item->pos.yRot) / 16;
|
||||||
ForcedFixedCamera.roomNumber = item->roomNumber;
|
ForcedFixedCamera.roomNumber = item->roomNumber;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -376,11 +383,11 @@ void FloorTrapDoorCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll) //
|
||||||
item->goalAnimState = 1;
|
item->goalAnimState = 1;
|
||||||
|
|
||||||
UseForcedFixedCamera = 1;
|
UseForcedFixedCamera = 1;
|
||||||
ForcedFixedCamera.x = item->pos.xPos - SIN(item->pos.yRot) / 8;
|
ForcedFixedCamera.x = item->pos.xPos - phd_sin(item->pos.yRot) / 8;
|
||||||
ForcedFixedCamera.y = item->pos.yPos - 2048;
|
ForcedFixedCamera.y = item->pos.yPos - 2048;
|
||||||
if (ForcedFixedCamera.y < Rooms[item->roomNumber].maxceiling)
|
if (ForcedFixedCamera.y < Rooms[item->roomNumber].maxceiling)
|
||||||
ForcedFixedCamera.y = Rooms[item->roomNumber].maxceiling;
|
ForcedFixedCamera.y = Rooms[item->roomNumber].maxceiling;
|
||||||
ForcedFixedCamera.z = item->pos.zPos - COS(item->pos.yRot) / 8;
|
ForcedFixedCamera.z = item->pos.zPos - phd_cos(item->pos.yRot) / 8;
|
||||||
ForcedFixedCamera.roomNumber = item->roomNumber;
|
ForcedFixedCamera.roomNumber = item->roomNumber;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -555,7 +562,7 @@ void FallingBlockControl(short itemNumber)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
item->meshBits = -2;
|
item->meshBits = -2;
|
||||||
ExplodingDeath2(itemNumber, -1, 15265);
|
ExplodingDeath(itemNumber, -1, 15265);
|
||||||
item->itemFlags[0]++;
|
item->itemFlags[0]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1110,9 +1117,9 @@ void FlameEmitter3Control(short itemNumber)
|
||||||
{
|
{
|
||||||
if (item->triggerFlags == 2 || item->triggerFlags == 4)
|
if (item->triggerFlags == 2 || item->triggerFlags == 4)
|
||||||
{
|
{
|
||||||
dest.x = item->pos.xPos + 2048 * SIN(item->pos.yRot - ANGLE(180)) >> W2V_SHIFT;
|
dest.x = item->pos.xPos + 2048 * phd_sin(item->pos.yRot - ANGLE(180)) >> W2V_SHIFT;
|
||||||
dest.y = item->pos.yPos;
|
dest.y = item->pos.yPos;
|
||||||
dest.z = item->pos.zPos + 2048 * COS(item->pos.yRot - ANGLE(180)) >> W2V_SHIFT;
|
dest.z = item->pos.zPos + 2048 * phd_cos(item->pos.yRot - ANGLE(180)) >> W2V_SHIFT;
|
||||||
|
|
||||||
if (GetRandomControl() & 3)
|
if (GetRandomControl() & 3)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,60 +2,8 @@
|
||||||
|
|
||||||
#include "..\Global\global.h"
|
#include "..\Global\global.h"
|
||||||
|
|
||||||
//#define ElectricityWiresControl ((void (__cdecl*)(short)) 0x00442610)
|
extern ITEM_INFO* WBItem;
|
||||||
//#define InitialiseRomeHammer ((void (__cdecl*)(short)) 0x0043ECB0)
|
extern short WBRoom;
|
||||||
//#define InitialiseDeathSlide ((void (__cdecl*)(short)) 0x0041CC70)
|
|
||||||
//#define DeathSlideCollision ((void (__cdecl*)(short,ITEM_INFO*,COLL_INFO*)) 0x0041CCE0)
|
|
||||||
//#define DeathSlideControl ((void (__cdecl*)(short)) 0x0041CE00)
|
|
||||||
//#define RollingBallCollision ((void (__cdecl*)(short,ITEM_INFO*,COLL_INFO*)) 0x0048B6D0)
|
|
||||||
//#define RollingBallControl ((void (__cdecl*)(short)) 0x0048AE60)
|
|
||||||
//#define InitialiseTwoBlocksPlatform ((void (__cdecl*)(short)) 0x0043D5D0)
|
|
||||||
//#define TwoBlocksPlatformControl ((void (__cdecl*)(short)) 0x0048BBB0)
|
|
||||||
//#define TwoBlocksPlatformFloor ((void (__cdecl*)(ITEM_INFO*,int,int,int,int*)) 0x0048B9E0)
|
|
||||||
//#define TwoBlocksPlatformCeiling ((void (__cdecl*)(ITEM_INFO*,int,int,int,int*)) 0x0048BA50)
|
|
||||||
//#define KillAllTriggersControl ((void (__cdecl*)(short)) 0x00431030)
|
|
||||||
//#define FallingCeilingCollision ((void (__cdecl*)(short,ITEM_INFO*,COLL_INFO*)) 0x004127C0)
|
|
||||||
//#define FallingCeilingControl ((void (__cdecl*)(short)) 0x004899D0)
|
|
||||||
//#define InitialiseFallingBlock ((void (__cdecl*)(short)) 0x0043D330)
|
|
||||||
//#define FallingBlockCollision ((void (__cdecl*)(short,ITEM_INFO*,COLL_INFO*)) 0x00489750)
|
|
||||||
//#define FallingBlockControl ((void (__cdecl*)(short)) 0x00489820)
|
|
||||||
//#define FallingBlockFloor ((void (__cdecl*)(ITEM_INFO*,int,int,int,int*)) 0x00489910)
|
|
||||||
//#define FallingBlockCeiling ((void (__cdecl*)(ITEM_INFO*,int,int,int,int*)) 0x00489980)
|
|
||||||
//#define InitialisePushableBlock ((void (__cdecl*)(short)) 0x0045E720)
|
|
||||||
//#define PushableBlockControl ((void (__cdecl*)(short)) 0x0045EA30)
|
|
||||||
//#define PushableBlockCollision ((void (__cdecl*)(short,ITEM_INFO*,COLL_INFO*)) 0x0045F570)
|
|
||||||
//#define DartEmitterControl ((void (__cdecl*)(short)) 0x00489B30)
|
|
||||||
#define DrawDart ((void (__cdecl*)(ITEM_INFO*)) 0x004CBB10)
|
|
||||||
//#define DartControl ((void (__cdecl*)(short)) 0x00489D60)
|
|
||||||
//#define InitialiseFlameEmitter ((void (__cdecl*)(short)) 0x0043D370)
|
|
||||||
//#define FlameEmitterCollision ((void (__cdecl*)(short,ITEM_INFO*,COLL_INFO*)) 0x00433B40)
|
|
||||||
//#define FlameEmitterControl ((void (__cdecl*)(short)) 0x00489F70)
|
|
||||||
//#define InitialiseFlameEmitter2 ((void (__cdecl*)(short)) 0x0043D4E0)
|
|
||||||
//#define FlameEmitter2Control ((void (__cdecl*)(short)) 0x0048A3B0)
|
|
||||||
//#define FlameEmitter3Control ((void (__cdecl*)(short)) 0x0048A570)
|
|
||||||
//#define FlameControl ((void (__cdecl*)(short)) 0x0048AB80)
|
|
||||||
#define InitialiseRopeTrap ((void (__cdecl*)()) 0x0046EE40)
|
|
||||||
//#define GenSlot1Control ((void (__cdecl*)(short)) 0x00406580)
|
|
||||||
#define InitialiseGenSlot2 ((void (__cdecl*)(short)) 0x0043FD70)
|
|
||||||
#define GenSlot2Control ((void (__cdecl*)(short)) 0x00488710)
|
|
||||||
#define DrawGenSlot2 ((void (__cdecl*)(ITEM_INFO*)) 0x004CFF80)
|
|
||||||
//#define InitialiseGenSlot3 ((void (__cdecl*)(short)) 0x004402E0)
|
|
||||||
//#define InitialiseGenSlot4 ((void (__cdecl*)(short)) 0x00440440)
|
|
||||||
#define GenSlot4Control ((void (__cdecl*)(short)) 0x00486450)
|
|
||||||
//#define InitialiseHighObject1 ((void (__cdecl*)(short)) 0x0043FC30)
|
|
||||||
//#define HighObject1Control ((void (__cdecl*)(short)) 0x004067E0)
|
|
||||||
#define InitialisePortal ((void (__cdecl*)(short)) 0x0043FAA0)
|
|
||||||
#define PortalControl ((void (__cdecl*)(short)) 0x00401AEB)
|
|
||||||
#define DrawPortal ((void (__cdecl*)(ITEM_INFO*)) 0x004CFF80)
|
|
||||||
//#define InitialiseWreckingBall ((void (__cdecl*)(short)) 0x0043EF20)
|
|
||||||
//#define WreckingBallCollision ((void (__cdecl*)(short,ITEM_INFO*,COLL_INFO*)) 0x00441D50)
|
|
||||||
//#define WreckingBallControl ((void (__cdecl*)(short)) 0x00441410)
|
|
||||||
#define DrawWreckingBall ((void (__cdecl*)(ITEM_INFO*)) 0x00441F50)
|
|
||||||
//#define InitialiseVentilator ((void (__cdecl*)(short)) 0x0043F3D0)
|
|
||||||
//#define VentilatorControl ((void (__cdecl*)(short)) 0x00405610)
|
|
||||||
//#define InitialiseTeethSpike ((void (__cdecl*)(short)) 0x0043FBC0)
|
|
||||||
//#define TeethSpikeControl ((void (__cdecl*)(short)) 0x0043FBC0)
|
|
||||||
//#define DrawScaledSpike ((void (__cdecl*)(ITEM_INFO*)) 0x0043FBC0)
|
|
||||||
|
|
||||||
void LaraBurn();
|
void LaraBurn();
|
||||||
void LavaBurn(ITEM_INFO* item);
|
void LavaBurn(ITEM_INFO* item);
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
#include "twogun.h"
|
|
|
@ -1 +0,0 @@
|
||||||
#pragma once
|
|
|
@ -38,7 +38,7 @@
|
||||||
#define ROT_Y 8
|
#define ROT_Y 8
|
||||||
#define ROT_Z 16
|
#define ROT_Z 16
|
||||||
|
|
||||||
// ExplodingDeath2() last argument flags
|
// ExplodingDeath() last argument flags
|
||||||
#define EXPLODE_HIT_EFFECT 258
|
#define EXPLODE_HIT_EFFECT 258
|
||||||
#define EXPLODE_NORMAL 256
|
#define EXPLODE_NORMAL 256
|
||||||
|
|
||||||
|
|
|
@ -11,19 +11,13 @@ using namespace DirectX::SimpleMath;
|
||||||
#include "enums.h"
|
#include "enums.h"
|
||||||
#include "objectslist.h"
|
#include "objectslist.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "vars.h"
|
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
#include "malloc.h"
|
#include "malloc.h"
|
||||||
#include "legacyfunctions.h"
|
|
||||||
|
|
||||||
#include "..\Scripting\GameLogicScript.h"
|
#include "..\Scripting\GameLogicScript.h"
|
||||||
#include "..\Scripting\GameFlowScript.h"
|
#include "..\Scripting\GameFlowScript.h"
|
||||||
|
|
||||||
#include "..\Renderer\Renderer11.h"
|
#include "..\Renderer\Renderer11.h"
|
||||||
|
|
||||||
#define DB_Log ((HWND (__cdecl*)(short, const char*)) 0x004DEB10)
|
|
||||||
|
|
||||||
#pragma warning(disable:4996)
|
#pragma warning(disable:4996)
|
||||||
|
|
||||||
extern HMODULE g_DllHandle;
|
|
|
@ -1,151 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "types.h"
|
|
||||||
|
|
||||||
// BOX.CPP
|
|
||||||
#define Legacy_CreatureActive ((int (__cdecl*)(short)) 0x00408630)
|
|
||||||
#define Legacy_CreatureUnderwater ((void (__cdecl*)(ITEM_INFO*, int)) 0x0040B400)
|
|
||||||
#define Legacy_CreatureFloat ((int (__cdecl*)(short)) 0x0040B2C0)
|
|
||||||
#define Legacy_CreatureDie ((void (__cdecl*)(short, int)) 0x0040A090)
|
|
||||||
#define Legacy_CreatureAIInfo ((void (__cdecl*)(ITEM_INFO*, AI_INFO*)) 0x004086C0)
|
|
||||||
#define Legacy_CreatureMood ((void (__cdecl*)(ITEM_INFO*, AI_INFO*, int)) 0x00409370)
|
|
||||||
#define Legacy_GetCreatureMood ((void (__cdecl*)(ITEM_INFO*, AI_INFO*, int)) 0x004090A0)
|
|
||||||
#define Legacy_CreatureEffect ((short (__cdecl*)(ITEM_INFO*, BITE_INFO*, short(*)(int, int, int, short, short, short))) 0x0040B4D0)
|
|
||||||
#define Legacy_CreatureEffect2 ((short (__cdecl*)(ITEM_INFO*, BITE_INFO*, short, short, short(*)(int, int, int, short, short, short))) 0x0040B550)
|
|
||||||
#define Legacy_CreatureTilt ((void (__cdecl*)(ITEM_INFO*, short)) 0x0040B1B0)
|
|
||||||
#define Legacy_CreatureJoint ((void (__cdecl*)(ITEM_INFO*, short, short)) 0x0040B240)
|
|
||||||
#define Legacy_CreatureAnimation ((void (__cdecl*)(short, short, short)) 0x0040A1D0)
|
|
||||||
#define Legacy_InitialiseCreature ((void (__cdecl*)(short)) 0x00408550)
|
|
||||||
#define Legacy_CreatureKill ((void (__cdecl*)(ITEM_INFO*, int, int, int)) 0x0040B820)
|
|
||||||
#define Legacy_AlertAllGuards ((void (__cdecl*)(short)) 0x0040BA70)
|
|
||||||
#define Legacy_AlertNearbyGuards ((void (__cdecl*)(ITEM_INFO*)) 0x0040BB10)
|
|
||||||
#define Legacy_MoveCreature3DPos ((int(__cdecl*)(PHD_3DPOS*, PHD_3DPOS*, int, short, short)) 0x0040C460)
|
|
||||||
#define Legacy_CalculateTarget ((int(__cdecl*)(PHD_VECTOR*, ITEM_INFO*, LOT_INFO*)) 0x004098B0)
|
|
||||||
#define Legacy_ValidBox ((int(__cdecl*)(ITEM_INFO*, short, short)) 0x00408FD0)
|
|
||||||
#define Legacy_StalkBox ((int(__cdecl*)(ITEM_INFO*, ITEM_INFO*, short)) 0x00409770)
|
|
||||||
#define Legacy_TargetBox ((int(__cdecl*)(LOT_INFO*, short)) 0x00408E20)
|
|
||||||
#define Legacy_EscapeBox ((int(__cdecl*)(ITEM_INFO*, ITEM_INFO*, short)) 0x00408EF0)
|
|
||||||
#define Legacy_BadFloor ((int(__cdecl*)(int, int, int, int, int, short, LOT_INFO*)) 0x00409FB0)
|
|
||||||
#define Legacy_CreatureCreature ((int(__cdecl*)(short)) 0x00409E20)
|
|
||||||
#define Legacy_DropBaddyPickups ((int(__cdecl*)(ITEM_INFO*)) 0x0040C5A0)
|
|
||||||
#define Legacy_CreatureCollision ((void (__cdecl*)(short, ITEM_INFO*, COLL_INFO*)) 0x004124E0)
|
|
||||||
#define Legacy_CreatureTurn ((short (__cdecl*)(ITEM_INFO*, short)) 0x0040AE90)
|
|
||||||
#define Legacy_AIGuard ((short(__cdecl*)(CREATURE_INFO*)) 0x0040BBE0)
|
|
||||||
#define Legacy_GetAITarget ((void(__cdecl*)(CREATURE_INFO*)) 0x0040BCC0)
|
|
||||||
#define Legacy_FindAIObject ((int(__cdecl*)(CREATURE_INFO*,short)) 0x0040C070)
|
|
||||||
#define Legacy_SameZoneAIObject ((int(__cdecl*)(CREATURE_INFO*,short)) 0x0040C460)
|
|
||||||
|
|
||||||
// CAMERA.CPP
|
|
||||||
#define Legacy_InitialiseCamera ((void (__cdecl*)()) 0x0040C690)
|
|
||||||
#define Legacy_MoveCamera ((int(__cdecl*)(GAME_VECTOR*,int)) 0x0040C7A0)
|
|
||||||
#define Legacy_ChaseCamera ((int(__cdecl*)(ITEM_INFO*)) 0x0040D150)
|
|
||||||
#define Legacy_CombatCamera ((int(__cdecl*)(ITEM_INFO*)) 0x0040D640)
|
|
||||||
#define Legacy_LookCamera ((void(__cdecl*)(ITEM_INFO*)) 0x0040DC10)
|
|
||||||
#define Legacy_FixedCamera ((void(__cdecl*)()) 0x0040E890)
|
|
||||||
#define Legacy_CalculateCamera ((void(__cdecl*)()) 0x0040ED30)
|
|
||||||
#define Legacy_BinocularCamera ((void(__cdecl*)()) 0x0040FC20)
|
|
||||||
#define Legacy_RefreshCamera ((void(__cdecl*)(short,short*)) 0x004165E0)
|
|
||||||
#define Legacy_CameraCollisionBounds ((int (__cdecl*)(GAME_VECTOR*,int,int)) 0x0040F5C0)
|
|
||||||
#define Legacy_do_new_cutscene_camera ((void(__cdecl*)()) 0x00421480)
|
|
||||||
#define Legacy_SaveD3DCameraMatrix ((void(__cdecl*)()) 0x00497280)
|
|
||||||
#define Legacy_UnknownCamera ((void(__cdecl*)()) 0x004975D0)
|
|
||||||
|
|
||||||
// COLLIDE.CPP
|
|
||||||
#define Legacy_GenericSphereBoxCollision ((void (__cdecl*)(short, ITEM_INFO*, COLL_INFO*)) 0x00413A90)
|
|
||||||
|
|
||||||
// CONTROL.CPP
|
|
||||||
#define Legacy_GetCeiling ((int (__cdecl*)(FLOOR_INFO*, int, int, int)) 0x00417640)
|
|
||||||
#define Legacy_GetRandomControl ((int (__cdecl*)()) 0x004A7C10)
|
|
||||||
#define Legacy_AnimateItem ((void (__cdecl*)(ITEM_INFO*)) 0x00415300)
|
|
||||||
#define Legacy_GetChange ((int (__cdecl*)(ITEM_INFO*, ANIM_STRUCT*)) 0x00415890)
|
|
||||||
#define Legacy_KillMoveItems ((void (__cdecl*)()) 0x00414620)
|
|
||||||
#define Legacy_KillMoveEffects ((void (__cdecl*)()) 0x004146A0)
|
|
||||||
#define Legacy_ClearDynamics ((void (__cdecl*)()) 0x00431530)
|
|
||||||
#define Legacy_ClearFires ((void (__cdecl*)()) 0x00481B10)
|
|
||||||
#define Legacy_UpdateSparks ((void (__cdecl*)()) 0x0042E8B0)
|
|
||||||
#define Legacy_UpdateFireSparks ((void (__cdecl*)()) 0x004813B0)
|
|
||||||
#define Legacy_UpdateSmoke ((void (__cdecl*)()) 0x00481DD0)
|
|
||||||
#define Legacy_UpdateBlood ((void (__cdecl*)()) 0x00482610)
|
|
||||||
#define Legacy_UpdateBubbles ((void (__cdecl*)()) 0x00483540)
|
|
||||||
#define Legacy_UpdateSplashes ((void (__cdecl*)()) 0x00430710)
|
|
||||||
#define Legacy_UpdateDebris ((void (__cdecl*)()) 0x0041D500)
|
|
||||||
#define Legacy_UpdateDrips ((void (__cdecl*)()) 0x00483D90)
|
|
||||||
#define Legacy_UpdateGunShells ((void (__cdecl*)()) 0x00482D80)
|
|
||||||
#define Legacy_UpdateBats ((void (__cdecl*)()) 0x00407FD0)
|
|
||||||
#define Legacy_UpdateRats ((void (__cdecl*)()) 0x0046AC70)
|
|
||||||
#define Legacy_LavaBurn ((void (__cdecl*)(ITEM_INFO*)) 0x0048ADD0)
|
|
||||||
#define Legacy_RefreshCamera ((void (__cdecl*)(short, short*)) 0x004165E0)
|
|
||||||
#define Legacy_DoFlipMap ((void (__cdecl*)(short)) 0x00418910)
|
|
||||||
#define Legacy_PlaySoundTrack ((void (__cdecl*)(short, short)) 0x00418B90)
|
|
||||||
#define Legacy_AlterFloorHeight ((void (__cdecl*)(ITEM_INFO*, int)) 0x004159F0)
|
|
||||||
#define Legacy_ObjectOnLOS2 ((int (__cdecl*)(GAME_VECTOR*, GAME_VECTOR*, PHD_VECTOR*, BITE_INFO*)) 0x00419110)
|
|
||||||
#define Legacy_LOS ((int (__cdecl*)(GAME_VECTOR*, GAME_VECTOR*)) 0x00417CF0)
|
|
||||||
#define Legacy_GetTargetOnLOS ((int (__cdecl*)(GAME_VECTOR*, GAME_VECTOR*, int, int)) 0x0041A170)
|
|
||||||
#define Legacy_RumbleScreen ((void (__cdecl*)()) 0x00442C90)
|
|
||||||
#define Legacy_UpdateShockwaves ((void (__cdecl*)()) 0x004849A0)
|
|
||||||
#define Legacy_GetFloor ((FLOOR_INFO* (__cdecl*)(int, int, int, short*)) 0x00415B20)
|
|
||||||
#define Legacy_GetFloorHeight ((int (__cdecl*)(FLOOR_INFO*, int, int, int)) 0x00415FB0)
|
|
||||||
#define Legacy_GetWaterHeight ((int (__cdecl*)(int, int, int, short)) 0x00415DA0)
|
|
||||||
#define Legacy_UpdateSpiders ((void (__cdecl*)()) 0x0047A340)
|
|
||||||
#define Legacy_UpdateLightning ((void (__cdecl*)()) 0x00484CB0)
|
|
||||||
|
|
||||||
// DOOR.CPP
|
|
||||||
#define Legacy_InitialiseDoor ((void (__cdecl*)(short)) 0x0043DB60)
|
|
||||||
#define Legacy_DrawLiftDoor ((void (__cdecl*)(ITEM_INFO*)) 0x0045AAF0)
|
|
||||||
#define Legacy_DoubleDoorControl ((void (__cdecl*)(short)) 0x00429840)
|
|
||||||
#define Legacy_InitialiseSteelDoor ((void (__cdecl*)(short)) 0x0043F180)
|
|
||||||
#define Legacy_SteelDoorControl ((void (__cdecl*)(short)) 0x00486BE0)
|
|
||||||
#define Legacy_SteelDoorCollision ((void (__cdecl*)(short,ITEM_INFO*,COLL_INFO*)) 0x00487AD0)
|
|
||||||
|
|
||||||
// DRAW.CPP
|
|
||||||
#define Legacy_UpdateStorm ((void (__cdecl*)()) 0x0042A310)
|
|
||||||
|
|
||||||
// EFFECT2.CPP
|
|
||||||
#define Legacy_DetatchSpark ((SPARKS* (__cdecl*)(int, int)) 0x0042E6A0)
|
|
||||||
#define Legacy_AddWaterSparks ((void (__cdecl*)(int, int, int, int)) 0x00483180)
|
|
||||||
#define Legacy_TriggerUnderwaterExplosion ((void (__cdecl*)(ITEM_INFO*)) 0x0044F500)
|
|
||||||
#define Legacy_TriggerExplosionSparks ((void (__cdecl*)(int, int, int, int, int, int, short)) 0x0042F610)
|
|
||||||
#define Legacy_GetFreeSpark ((short (__cdecl*)()) 0x0042E790)
|
|
||||||
#define Legacy_GetFreeDrip ((short (__cdecl*)()) 0x00483D00)
|
|
||||||
#define Legacy_GetFreeSmokeSpark ((short (__cdecl*)()) 0x00481D40)
|
|
||||||
#define Legacy_TriggerDartSmoke ((void (__cdecl*)(int, int, int, int, int, int)) 0x00430D90)
|
|
||||||
#define Legacy_TriggerGunShell ((void (__cdecl*)(short, int, int)) 0x00482A60)
|
|
||||||
#define Legacy_TriggerLaraDrips ((void (__cdecl*)()) 0x00483F00)
|
|
||||||
#define Legacy_SetupRipple ((void (__cdecl*)(int, int, int, int, int)) 0x00430910)
|
|
||||||
#define Legacy_TriggerShockwave ((void (__cdecl*)(PHD_3DPOS*, int, int, int, int, int)) 0x00484670)
|
|
||||||
#define Legacy_TriggerExplosionBubbles ((void (__cdecl*)(int, int, int, short)) 0x00431070)
|
|
||||||
#define Legacy_AddFire ((void (__cdecl*)(int, int, int, byte, short, int)) 0x00481B40)
|
|
||||||
#define Legacy_ControlWaterfallMist ((void (__cdecl*)(short)) 0x00432CA0)
|
|
||||||
#define Legacy_TriggerRicochetSparks ((void (__cdecl*)(GAME_VECTOR*, short, int, int)) 0x0042F060)
|
|
||||||
|
|
||||||
// EFFECTS.CPP
|
|
||||||
#define Legacy_DoBloodSplat ((short (__cdecl*)(int, int, int, short, short, short)) 0x00432760)
|
|
||||||
#define Legacy_CreateBubble ((short (__cdecl*)(PHD_3DPOS*, short, int)) 0x0043C6C0);
|
|
||||||
#define Legacy_SetupRipple ((void (__cdecl*)(int, int, int, byte, byte)) 0x00430910);
|
|
||||||
|
|
||||||
// EFFECT2.CPP
|
|
||||||
#define Legacy_InitialiseSmokeEmitter ((void (__cdecl*)(short)) 0x0043D9D0)
|
|
||||||
#define Legacy_SmokeEmitterControl ((void (__cdecl*)(short)) 0x00431560)
|
|
||||||
|
|
||||||
// HEALT.CPP
|
|
||||||
#define Legacy_FlashIt ((int (__cdecl*)()) 0x00439C10)
|
|
||||||
#define Legacy_UpdateHealtBar ((void (__cdecl*)(int)) 0x00439E50)
|
|
||||||
#define Legacy_UpdateAirBar ((void (__cdecl*)(int)) 0x00439FC0)
|
|
||||||
|
|
||||||
// ITEMS.CPP
|
|
||||||
#define Legacy_ItemNewRoom ((void (__cdecl*)(short, short)) 0x00440DA0)
|
|
||||||
#define Legacy_EffectNewRoom ((void (__cdecl*)(short, short)) 0x004412F0)
|
|
||||||
#define Legacy_KillEffect ((void (__cdecl*)(short)) 0x00441180)
|
|
||||||
#define Legacy_CreateNewEffect ((short (__cdecl*)(short)) 0x004410F0)
|
|
||||||
#define Legacy_InitialiseFXArray ((void (__cdecl*)(int)) 0x00441080)
|
|
||||||
#define Legacy_AddActiveItem ((void (__cdecl*)(short)) 0x00440D10)
|
|
||||||
#define Legacy_RemoveActiveItem ((void (__cdecl*)(short)) 0x00440B60)
|
|
||||||
#define Legacy_RemoveDrawnItem ((void (__cdecl*)(short)) 0x00440C40)
|
|
||||||
#define Legacy_InitialiseItem ((void (__cdecl*)(short)) 0x004408B0)
|
|
||||||
#define Legacy_CreateItem ((short (__cdecl*)()) 0x00440840)
|
|
||||||
#define Legacy_KillItem ((void (__cdecl*)(short)) 0x00440620)
|
|
||||||
#define Legacy_ItemNearLara ((int (__cdecl*)(PHD_3DPOS*, int)) 0x00432580)
|
|
||||||
#define Legacy_TranslateItem ((void (__cdecl*)(ITEM_INFO*, int, int, int)) 0x00415960)
|
|
||||||
|
|
||||||
// LARA.CPP
|
|
||||||
#define Legacy_AnimateLara ((int (__cdecl*)(ITEM_INFO*)) 0x004563F0)
|
|
|
@ -2,66 +2,42 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "..\Global\global.h"
|
#include "..\Global\global.h"
|
||||||
|
|
||||||
char* GameMalloc(int size)
|
char* malloc_buffer;
|
||||||
{
|
int malloc_size;
|
||||||
//printf("Size: %d, MallocFree: %d\n", size, MallocFree);
|
char* malloc_ptr;
|
||||||
return GameMallocReal(size);
|
int malloc_free;
|
||||||
}
|
int malloc_used;
|
||||||
|
|
||||||
/*
|
char* game_malloc(int size)
|
||||||
void InitGameMalloc()
|
|
||||||
{
|
{
|
||||||
char* buffer = (char*)malloc(GAME_BUFFER_SIZE);
|
char* ptr;
|
||||||
MallocBuffer = buffer;
|
|
||||||
MallocSize = GAME_BUFFER_SIZE;
|
|
||||||
MallocPtr = buffer;
|
|
||||||
MallocFree = GAME_BUFFER_SIZE;
|
|
||||||
MallocUsed = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
char* GameMalloc(int size)
|
size = (size + 3) & 0xfffffffc;
|
||||||
{
|
if (size <= malloc_free)
|
||||||
int memSize = (size + 3) & -4;
|
|
||||||
if (memSize > MallocFree)
|
|
||||||
{
|
{
|
||||||
DB_Log(0, "Out of memory");
|
ptr = malloc_ptr;
|
||||||
return NULL;
|
malloc_free -= size;
|
||||||
}
|
malloc_used += size;
|
||||||
else
|
malloc_ptr += size;
|
||||||
{
|
|
||||||
char* ptr = MallocPtr;
|
|
||||||
MallocFree -= memSize;
|
|
||||||
MallocUsed += memSize;
|
|
||||||
MallocPtr += memSize;
|
|
||||||
memset(ptr, 0, 4 * (memSize >> 2));
|
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameFree(int size)
|
void init_game_malloc()
|
||||||
{
|
{
|
||||||
int memSize = (size + 3) & -4;
|
malloc_size = 1048576 * 128;
|
||||||
MallocPtr -= memSize;
|
malloc_buffer = (char*)malloc(malloc_size);
|
||||||
MallocFree += memSize;
|
malloc_ptr = malloc_buffer;
|
||||||
MallocUsed -= memSize;
|
malloc_free = malloc_size;
|
||||||
|
malloc_used = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* Malloc(int size)
|
void game_free(int size, int type)
|
||||||
{
|
{
|
||||||
return malloc(size);
|
size = (size + 3) & (~3);
|
||||||
}
|
malloc_ptr -= size;
|
||||||
|
malloc_free += size;
|
||||||
void Free(void* ptr)
|
malloc_used -= size;
|
||||||
{
|
|
||||||
free(ptr);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
void Inject_Malloc()
|
|
||||||
{
|
|
||||||
INJECT(0x0040101E, GameMalloc);
|
|
||||||
/*INJECT(0x004A7CB0, InitGameMalloc);
|
|
||||||
INJECT(0x0040101E, GameMalloc);
|
|
||||||
INJECT(0x00403116, GameFree);
|
|
||||||
INJECT(0x004E2220, Malloc);
|
|
||||||
INJECT(0x004E2C90, Free);*/
|
|
||||||
}
|
}
|
|
@ -1,14 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define MallocBuffer VAR_U_(0x00E4B10C, char*)
|
extern char* malloc_buffer;
|
||||||
#define MallocSize VAR_U_(0x00E4B058, int)
|
extern int malloc_size;
|
||||||
#define MallocPtr VAR_U_(0x00E4B0DC, char*)
|
extern char* malloc_ptr;
|
||||||
#define MallocFree VAR_U_(0x00E4B0F4, int)
|
extern int malloc_free;
|
||||||
#define MallocUsed VAR_U_(0x00E4B0F0, int)
|
extern int malloc_used;
|
||||||
|
|
||||||
#define InitGameMalloc ((void (__cdecl*)()) 0x004A7CB0)
|
char* game_malloc(int size);
|
||||||
#define GameMallocReal ((char* (__cdecl*)(int)) 0x004A7D00)
|
void init_game_malloc();
|
||||||
|
void game_free(int size, int type);
|
||||||
char* GameMalloc(int size);
|
|
||||||
|
|
||||||
void Inject_Malloc();
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,32 +1,40 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "vodoo.h"
|
#include "vodoo.h"
|
||||||
|
#include "types.h"
|
||||||
#define PI 3.14159265358979323846f
|
|
||||||
#define RADIAN 0.01745329252f
|
#define PI 3.14159265358979323846f
|
||||||
|
#define RADIAN 0.01745329252f
|
||||||
#define rcossin_tbl ARRAY_(0x0050B46C, short, [8192])
|
#define SQUARE(x) ((x)*(x))
|
||||||
|
#define CLAMP(x, a, b) ((x)<(a)?(a):((x)>(b)?(b):(x)))
|
||||||
#define SQUARE(x) ((x)*(x))
|
#define SIGN(x) ((0 < (x)) - ((x) < 0))
|
||||||
#define CLAMP(x, a, b) ((x)<(a)?(a):((x)>(b)?(b):(x)))
|
#define CLAMPADD(x, a, b) ((x)<(a)?((x)+(a)):((x)>(b)?((x)-(b)):0))
|
||||||
#define SIGN(x) ((0 < (x)) - ((x) < 0))
|
#define ONE_DEGREE 182
|
||||||
#define CLAMPADD(x, a, b) ((x)<(a)?((x)+(a)):((x)>(b)?((x)-(b)):0))
|
#define CLICK(x) ((x) * STEP_SIZE)
|
||||||
|
#define SECTOR(x) ((x) * WALL_SIZE)
|
||||||
#define ONE_DEGREE 182
|
|
||||||
#define CLICK(x) ((x) * STEP_SIZE)
|
#define TO_DEGREES(x) ((x) / 65536.0f * 360.0f)
|
||||||
#define SECTOR(x) ((x) * WALL_SIZE)
|
#define TO_RAD(x) ((x) / 65536.0f * 360.0f * RADIAN)
|
||||||
|
|
||||||
#define SQRT_ASM ((int(__cdecl*)(int)) 0x0048F980)
|
//#define ATAN ((int(__cdecl*)(int, int)) 0x0048F8A0)
|
||||||
#define ATAN ((int(__cdecl*)(int, int)) 0x0048F8A0)
|
|
||||||
#define SIN(x) (4 * rcossin_tbl[(int(x) >> 3) & 8190])
|
|
||||||
#define COS(x) (4 * rcossin_tbl[((int(x) >> 3) & 8190) + 1])
|
short ANGLE(float angle);
|
||||||
|
|
||||||
short ANGLE(float angle);
|
float TR_ANGLE_TO_DEGREES(short angle);
|
||||||
float TR_ANGLE_TO_DEGREES(short angle);
|
float TR_ANGLE_TO_RAD(short angle);
|
||||||
float TR_ANGLE_TO_RAD(short angle);
|
|
||||||
// returns a float between 0-1
|
extern short rcossin_tbl[8192];
|
||||||
const float frand();
|
|
||||||
|
int phd_sin(short a);
|
||||||
const float frandMinMax(float min, float max);
|
int phd_cos(short a);
|
||||||
|
float ANGLEF(short angle);
|
||||||
const float lerp(float v0, float v1, float t);
|
|
||||||
|
// returns a float between 0-1
|
||||||
|
const float frand();
|
||||||
|
const float frandMinMax(float min, float max);
|
||||||
|
const float lerp(float v0, float v1, float t);
|
||||||
|
int mGetAngle(int x1, int y1, int x2, int y2);
|
||||||
|
int phd_atan(int dz, int dx);
|
||||||
|
void phd_GetVectorAngles(int x, int y, int z, short* angles);
|
||||||
|
void phd_RotBoundingBoxNoPersp(PHD_3DPOS* pos, short* bounds, short* tbounds);
|
|
@ -1,7 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include "enums.h"
|
#include "enums.h"
|
||||||
#include <fixed_point.h>
|
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
typedef struct vector_t
|
typedef struct vector_t
|
||||||
|
@ -283,132 +282,6 @@ typedef struct fx_info_t
|
||||||
short flag2; // size=0, offset=40
|
short flag2; // size=0, offset=40
|
||||||
} FX_INFO;
|
} FX_INFO;
|
||||||
|
|
||||||
typedef struct lara_info_t {
|
|
||||||
short itemNumber; // size=0, offset=0
|
|
||||||
short gunStatus; // size=0, offset=2
|
|
||||||
short gunType; // size=0, offset=4
|
|
||||||
short requestGunType; // size=0, offset=6
|
|
||||||
short lastGunType; // size=0, offset=8
|
|
||||||
short calcFallSpeed; // size=0, offset=10
|
|
||||||
short waterStatus; // size=0, offset=12
|
|
||||||
short climbStatus; // size=0, offset=14
|
|
||||||
short poseCount; // size=0, offset=16
|
|
||||||
short hitFrame; // size=0, offset=18
|
|
||||||
short hitDirection; // size=0, offset=20
|
|
||||||
short air; // size=0, offset=22
|
|
||||||
short diveCount; // size=0, offset=24
|
|
||||||
short deathCount; // size=0, offset=26
|
|
||||||
short currentActive; // size=0, offset=28
|
|
||||||
short currentXvel; // size=0, offset=30
|
|
||||||
short currentYvel; // size=0, offset=32
|
|
||||||
short currentZvel; // size=0, offset=34
|
|
||||||
short spazEffectCount; // size=0, offset=36
|
|
||||||
short flareAge; // size=0, offset=38
|
|
||||||
short BurnCount; // size=0, offset=40
|
|
||||||
short weaponItem; // size=0, offset=42
|
|
||||||
short backGun; // size=0, offset=44
|
|
||||||
short flareFrame; // size=0, offset=46
|
|
||||||
short poisoned; // size=0, offset=48
|
|
||||||
short dpoisoned; // size=0, offset=50
|
|
||||||
unsigned char anxiety; // size=0, offset=52
|
|
||||||
unsigned char wet[15]; // size=15, offset=53
|
|
||||||
unsigned short flareControlLeft : 1; // offset=68.0
|
|
||||||
unsigned short unused1 : 1; // offset=68.1
|
|
||||||
unsigned short look : 1; // offset=68.2
|
|
||||||
unsigned short burn : 1; // offset=68.3
|
|
||||||
unsigned short keepDucked : 1; // offset=68.4
|
|
||||||
unsigned short isMoving : 1; // offset=68.5
|
|
||||||
unsigned short canMonkeySwing : 1; // offset=68.6
|
|
||||||
unsigned short burnBlue : 2; // offset=68.7
|
|
||||||
unsigned short gassed : 1; // offset=69.1
|
|
||||||
unsigned short burnSmoke : 1; // offset=69.2
|
|
||||||
unsigned short isDucked : 1; // offset=69.3
|
|
||||||
unsigned short hasFired : 1; // offset=69.4
|
|
||||||
unsigned short busy : 1; // offset=69.5
|
|
||||||
unsigned short litTorch : 1; // offset=69.6
|
|
||||||
unsigned short isClimbing : 1; // offset=69.7
|
|
||||||
unsigned short fired : 1; // offset=70.0
|
|
||||||
int waterSurfaceDist; // size=0, offset=72
|
|
||||||
PHD_VECTOR lastPos; // size=12, offset=76
|
|
||||||
FX_INFO* spazEffect; // size=44, offset=88
|
|
||||||
int meshEffects; // size=0, offset=92
|
|
||||||
short* meshPtrs[15]; // size=60, offset=96
|
|
||||||
ITEM_INFO* target; // size=144, offset=156
|
|
||||||
short targetAngles[2]; // size=4, offset=160
|
|
||||||
short turnRate; // size=0, offset=164
|
|
||||||
short moveAngle; // size=0, offset=166
|
|
||||||
short headYrot; // size=0, offset=168
|
|
||||||
short headXrot; // size=0, offset=170
|
|
||||||
short headZrot; // size=0, offset=172
|
|
||||||
short torsoYrot; // size=0, offset=174
|
|
||||||
short torsoXrot; // size=0, offset=176
|
|
||||||
short torsoZrot; // size=0, offset=178
|
|
||||||
LARA_ARM leftArm; // size=20, offset=180
|
|
||||||
LARA_ARM rightArm; // size=20, offset=200
|
|
||||||
unsigned short holster; // size=0, offset=220
|
|
||||||
CREATURE_INFO* creature; // size=228, offset=224
|
|
||||||
int cornerX; // size=0, offset=228
|
|
||||||
int cornerZ; // size=0, offset=232
|
|
||||||
byte ropeSegment; // size=0, offset=236
|
|
||||||
byte ropeDirection; // size=0, offset=237
|
|
||||||
short ropeArcFront; // size=0, offset=238
|
|
||||||
short ropeArcBack; // size=0, offset=240
|
|
||||||
short ropeLastX; // size=0, offset=242
|
|
||||||
short ropeMaxXForward; // size=0, offset=244
|
|
||||||
short ropeMaxXBackward; // size=0, offset=246
|
|
||||||
int ropeDFrame; // size=0, offset=248
|
|
||||||
int ropeFrame; // size=0, offset=252
|
|
||||||
unsigned short ropeFrameRate; // size=0, offset=256
|
|
||||||
unsigned short ropeY; // size=0, offset=258
|
|
||||||
int ropePtr; // size=0, offset=260
|
|
||||||
void* generalPtr; // size=0, offset=264
|
|
||||||
int ropeOffset; // size=0, offset=268
|
|
||||||
int ropeDownVel; // size=0, offset=272
|
|
||||||
byte ropeFlag; // size=0, offset=276
|
|
||||||
byte moveCount; // size=0, offset=277
|
|
||||||
int ropeCount; // size=0, offset=280
|
|
||||||
byte skelebob; // size=0, offset=284
|
|
||||||
byte Legacy_pistolsTypeCarried; // size=0, offset=285
|
|
||||||
byte Legacy_uzisTypeCarried; // size=0, offset=286
|
|
||||||
byte Legacy_shotgunTypeCarried; // size=0, offset=287
|
|
||||||
byte Legacy_crossbowTypeCarried; // size=0, offset=288
|
|
||||||
byte Legacy_HKtypeCarried; // size=0, offset=289
|
|
||||||
byte Legacy_sixshooterTypeCarried; // size=0, offset=290
|
|
||||||
byte Legacy_laserSight; // size=0, offset=291
|
|
||||||
byte Legacy_silencer; // size=0, offset=292
|
|
||||||
byte Legacy_binoculars; // size=0, offset=293
|
|
||||||
byte Legacy_crowbar; // size=0, offset=294
|
|
||||||
byte Legacy_examine1; // size=0, offset=295
|
|
||||||
byte Legacy_examine2; // size=0, offset=296
|
|
||||||
byte Legacy_examine3; // size=0, offset=297
|
|
||||||
byte wetcloth; // size=0, offset=298
|
|
||||||
byte bottle; // size=0, offset=299
|
|
||||||
byte Legacy_puzzleItems[12]; // size=12, offset=300
|
|
||||||
unsigned short Legacy_puzzleItemsCombo; // size=0, offset=312
|
|
||||||
unsigned short Legacy_keyItems; // size=0, offset=314
|
|
||||||
unsigned short Legacy_keyItemsCombo; // size=0, offset=316
|
|
||||||
unsigned short Legacy_pickupItems; // size=0, offset=318
|
|
||||||
unsigned short Legacy_pickupItemsCombo; // size=0, offset=320
|
|
||||||
short Legacy_numSmallMedipack; // size=0, offset=322
|
|
||||||
short Legacy_numLargeMedipack; // size=0, offset=324
|
|
||||||
short Legacy_numFlares; // size=0, offset=326
|
|
||||||
short Legacy_numPistolsAmmo; // size=0, offset=328
|
|
||||||
short Legacy_numUziAmmo; // size=0, offset=330
|
|
||||||
short Legacy_numRevolverAmmo; // size=0, offset=332
|
|
||||||
short Legacy_numShotgunAmmo1; // size=0, offset=334
|
|
||||||
short Legacy_numShotgunAmmo2; // size=0, offset=336
|
|
||||||
short Legacy_numHKammo1; // size=0, offset=338
|
|
||||||
short Legacy_numCrossbowAmmo1; // size=0, offset=340
|
|
||||||
short Legacy_numCrossbowAmmo2; // size=0, offset=342
|
|
||||||
byte location; // size=0, offset=344
|
|
||||||
byte highestLocation; // size=0, offset=345
|
|
||||||
byte locationPad; // size=0, offset=346
|
|
||||||
unsigned char tightRopeOnCount; // size=0, offset=347
|
|
||||||
unsigned char tightRopeOff; // size=0, offset=348
|
|
||||||
unsigned char tightRopeFall; // size=0, offset=349
|
|
||||||
unsigned char chaffTimer; // size=0, offset=350
|
|
||||||
} LARA_INFO;
|
|
||||||
|
|
||||||
typedef struct coll_info_t
|
typedef struct coll_info_t
|
||||||
{
|
{
|
||||||
int midFloor; // size=0, offset=0
|
int midFloor; // size=0, offset=0
|
||||||
|
@ -467,43 +340,6 @@ typedef struct aiobject_t
|
||||||
short boxNumber; // size=0, offset=22
|
short boxNumber; // size=0, offset=22
|
||||||
} AIOBJECT;
|
} AIOBJECT;
|
||||||
|
|
||||||
typedef struct object_info_t {
|
|
||||||
short nmeshes; // size=0, offset=0
|
|
||||||
short meshIndex; // size=0, offset=2
|
|
||||||
int boneIndex; // size=0, offset=4
|
|
||||||
short* frameBase; // size=0, offset=8
|
|
||||||
void(*initialise)(short itemNumber); // size=0, offset=12
|
|
||||||
void(*control)(short itemNumber); // size=0, offset=16
|
|
||||||
void(*floor)(ITEM_INFO* item, int x, int y, int z, int* height); // size=0, offset=20
|
|
||||||
void(*ceiling)(ITEM_INFO* item, int x, int y, int z, int* height); // size=0, offset=24
|
|
||||||
void(*drawRoutine)(ITEM_INFO* item); // size=0, offset=28
|
|
||||||
void(*collision)(short item_num, ITEM_INFO* laraitem, COLL_INFO* coll); // size=0, offset=32
|
|
||||||
short zoneType; // size=0, offset=36
|
|
||||||
short animIndex; // size=0, offset=38
|
|
||||||
short hitPoints; // size=0, offset=40
|
|
||||||
short pivotLength; // size=0, offset=42
|
|
||||||
short radius; // size=0, offset=44
|
|
||||||
short shadowSize; // size=0, offset=46
|
|
||||||
short biteOffset; // size=0, offset=48
|
|
||||||
unsigned short loaded : 1; // offset=50.0
|
|
||||||
unsigned short intelligent : 1; // offset=50.1
|
|
||||||
unsigned short nonLot : 1; // offset=50.2
|
|
||||||
unsigned short savePosition : 1; // offset=50.3
|
|
||||||
unsigned short saveHitpoints : 1; // offset=50.4
|
|
||||||
unsigned short saveFlags : 1; // offset=50.5
|
|
||||||
unsigned short saveAnim : 1; // offset=50.6
|
|
||||||
unsigned short semiTransparent : 1; // offset=50.7
|
|
||||||
unsigned short waterCreature : 1; // offset=51.0
|
|
||||||
unsigned short usingDrawAnimatingItem : 1; // offset=51.1
|
|
||||||
unsigned short hitEffect : 2; // offset=51.2
|
|
||||||
unsigned short undead : 1; // offset=51.4
|
|
||||||
unsigned short saveMesh : 1; // offset=51.5
|
|
||||||
unsigned short unknown : 2; // offset=51.6
|
|
||||||
void(*drawRoutineExtra)(ITEM_INFO* item); // size=0, offset=52
|
|
||||||
unsigned int explodableMeshbits; // size=0, offset=56
|
|
||||||
int meshSwapSlot;
|
|
||||||
} OBJECT_INFO;
|
|
||||||
|
|
||||||
typedef struct tr5_room_layer_t // 56 bytes
|
typedef struct tr5_room_layer_t // 56 bytes
|
||||||
{
|
{
|
||||||
unsigned int NumLayerVertices; // Number of vertices in this layer (4 bytes)
|
unsigned int NumLayerVertices; // Number of vertices in this layer (4 bytes)
|
||||||
|
@ -915,7 +751,6 @@ typedef struct savegame_info
|
||||||
unsigned char ControlOption; // size=0, offset=10
|
unsigned char ControlOption; // size=0, offset=10
|
||||||
unsigned char VibrateOn; // size=0, offset=11
|
unsigned char VibrateOn; // size=0, offset=11
|
||||||
unsigned char AutoTarget; // size=0, offset=12
|
unsigned char AutoTarget; // size=0, offset=12
|
||||||
LARA_INFO Lara; // size=352, offset=16
|
|
||||||
STATS Level; // size=20, offset=368
|
STATS Level; // size=20, offset=368
|
||||||
STATS Game; // size=20, offset=388
|
STATS Game; // size=20, offset=388
|
||||||
short WeaponObject; // size=0, offset=408
|
short WeaponObject; // size=0, offset=408
|
||||||
|
|
|
@ -1,209 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "..\Game\sound.h"
|
|
||||||
|
|
||||||
//#define Camera VAR_U_(0x00EEF940, CAMERA_INFO)
|
|
||||||
//#define ForcedFixedCamera VAR_U_(0x00EEFA20, GAME_VECTOR)
|
|
||||||
//#define UseForcedFixedCamera VAR_U_(0x00EEFA50, char)
|
|
||||||
#define MallocBuffer VAR_U_(0x00E4B10C, char*)
|
|
||||||
#define MallocSize VAR_U_(0x00E4B058, int)
|
|
||||||
#define MallocPtr VAR_U_(0x00E4B0DC, char*)
|
|
||||||
#define MallocFree VAR_U_(0x00E4B0F4, int)
|
|
||||||
#define MallocUsed VAR_U_(0x00E4B0F0, int)
|
|
||||||
#define Items VAR_U_(0x00EEEFF0, ITEM_INFO*)
|
|
||||||
#define Effects VAR_U_(0x00E5C5E0, FX_INFO*)
|
|
||||||
#define nAIObjects VAR_U_(0x00E5B842, short)
|
|
||||||
#define LevelItems VAR_U_(0x0051CEB8, int)
|
|
||||||
#define AIObjects VAR_U_(0x00E5B844, AIOBJECT*)
|
|
||||||
#define Rooms VAR_U_(0x00875154, ROOM_INFO*)
|
|
||||||
#define Anims VAR_U_(0x00875158, ANIM_STRUCT*)
|
|
||||||
#define Bones VAR_U_(0x00875178, int*)
|
|
||||||
#define Changes VAR_U_(0x0087515C, CHANGE_STRUCT*)
|
|
||||||
#define Ranges VAR_U_(0x00875160, RANGE_STRUCT*)
|
|
||||||
#define Frames VAR_U_(0x00875174, short*)
|
|
||||||
#define Commands VAR_U_(0x0087517C, short*)
|
|
||||||
#define MeshesCount VAR_U_(0x00875140, int)
|
|
||||||
#define AnimationsCount VAR_U_(0x00875150, int)
|
|
||||||
#define FloorData VAR_U_(0x00875168, short*)
|
|
||||||
#define ObjectTextures VAR_U_(0x008751B0, OBJECT_TEXTURE*)
|
|
||||||
#define RoomLightsCount VAR_U_(0x0087B0EC, int)
|
|
||||||
#define NumberRooms VAR_U_(0x0087514C, short)
|
|
||||||
#define nAnimUVRanges VAR_U_(0x0087495C, int)
|
|
||||||
#define LevelFilePtr VAR_U_(0x00875164, FILE*)
|
|
||||||
//#define NumberCameras VAR_U_(0x00EEFAC0, int)
|
|
||||||
//#define Cameras VAR_U_(0x00EEF9A2, OBJECT_VECTOR*)
|
|
||||||
#define LaraItem VAR_U_(0x00E5BF08, ITEM_INFO*)
|
|
||||||
#define Lara VAR_U_(0x00E5BD60, LARA_INFO)
|
|
||||||
#define LaraDrawType VAR_U_(0x00EEEAD0, char)
|
|
||||||
#define Frames VAR_U_(0x00875174, short*)
|
|
||||||
#define SetDebounce VAR_U_(0x00EEEA38, int)
|
|
||||||
#define WindowsHandle VAR_U_(0x00D9AB3C, HWND)
|
|
||||||
#define SoundActive VAR_U_(0x0051D004, int)
|
|
||||||
#define DoTheGame VAR_U_(0x00876C40, int)
|
|
||||||
#define CurrentLevel VAR_U_(0x00E5C2D0, char)
|
|
||||||
#define CutSeqNum VAR_U_(0x0051CAA8, int)
|
|
||||||
#define CutSeqTriggered VAR_U_(0x0051CAAC, int)
|
|
||||||
#define GlobalPlayingCutscene VAR_U_(0x0051CAB0, int)
|
|
||||||
#define Wibble VAR_U_(0x0051CDF0, int)
|
|
||||||
#define DbInput VAR_U_(0x00878DAC, int)
|
|
||||||
#define TrInput VAR_U_(0x00878D98, int)
|
|
||||||
#define MatrixStack ARRAY_(0x0055D66C, int, [480])
|
|
||||||
#define MatrixPtr VAR_U_(0x00E4B0F8, int*)
|
|
||||||
#define IMptr VAR_U_(0x00E6D834, int*)
|
|
||||||
#define DxMatrixPtr VAR_U_(0x0055DA2C, byte*)
|
|
||||||
#define W2VMatrix ARRAY_(0x0055D26C, int, [16])
|
|
||||||
#define Unk_876C48 VAR_U_(0x00876C48, int)
|
|
||||||
#define Unk_007E7FE8 VAR_U_(0x007E7FE8, int)
|
|
||||||
#define SamplePointer ARRAY_(0x0086BEF0, HSAMPLE, [SOUND_MAX_SAMPLES])
|
|
||||||
#define SoundSlot ARRAY_(0x00E52430, SoundEffectSlot, [SOUND_MAX_CHANNELS])
|
|
||||||
#define TrackNamePrefix VAR_U_(0x00511828, char)
|
|
||||||
#define CurrentAtmosphere VAR_U_(0x00EEEB90, byte)
|
|
||||||
#define GlobalMusicVolume VAR_U_(0x00517B68, unsigned int)
|
|
||||||
#define GlobalFXVolume VAR_U_(0x00517B6C, unsigned int)
|
|
||||||
#define gfFilenameOffset VAR_U_(0x00E5C34C, short*)
|
|
||||||
#define gfFilenameWad VAR_U_(0x00E5C2CC, char*)
|
|
||||||
#define AllStrings VAR_U_(0x00E5C310, char*)
|
|
||||||
#define AllStringsOffsets VAR_U_(0x00E5C2B8, short*)
|
|
||||||
#define RenderLoadBar VAR_U_(0x008FBDC0, int)
|
|
||||||
#define WeatherType VAR_U_(0x00EEF4A0, byte)
|
|
||||||
#define CreditsDone VAR_U_(0x00E6D838, byte)
|
|
||||||
#define CanLoad VAR_U_(0x0051CE54, byte)
|
|
||||||
#define Savegame VAR_U_(0x00E52EB3, SAVEGAME_INFO)
|
|
||||||
#define LastInventoryItem VAR_U_(0x00508E14, int)
|
|
||||||
#define DelCutSeqPlayer VAR_U_(0x0051CE2C, short)
|
|
||||||
#define TitleControlsLockedOut VAR_U_(0x00E5C2A8, byte)
|
|
||||||
#define TrackCameraInit VAR_U_(0x0051D010, int)
|
|
||||||
#define CheckTrigger VAR_U_(0x0051D014, int)
|
|
||||||
#define UseSpotCam VAR_U_(0x0051D018, int)
|
|
||||||
#define DisableLaraControl VAR_U_(0x0051D01C, byte)
|
|
||||||
#define FramesCount VAR_U_(0x0051CA78, int)
|
|
||||||
#define GlobalCounter VAR_U_(0x0051CA58, short)
|
|
||||||
#define LevelComplete VAR_U_(0x00E5C2F0, byte)
|
|
||||||
#define ResetFlag VAR_U_(0x0051CA6C, int)
|
|
||||||
#define LegacyGameFlow VAR_U_(0x00E5C2BC, GAMEFLOW*)
|
|
||||||
#define GameMode VAR_U_(0x005082C0, byte)
|
|
||||||
#define nFrames VAR_U_(0x005082C4, int)
|
|
||||||
#define GameStatus VAR_U_(0x00E5C2B0, int)
|
|
||||||
#define EffectRoutines ARRAY_(0x00507964, EFFECT_ROUTINE, [MAX_EFFECTS])
|
|
||||||
#define CurrentFOV VAR_U_(0x00E4F504, short)
|
|
||||||
#define GameTimer VAR_U_(0x00E5C27C, int)
|
|
||||||
#define InventoryObjectsList ARRAY_(0x00508E38, INVOBJ, [100])
|
|
||||||
#define Friggrimmer VAR_U_(0x00E598F4, byte)
|
|
||||||
#define InventoryRings ARRAY_(0x00E59900, INVENTORYRING*, [2])
|
|
||||||
#define GnFrameCounter VAR_U_(0x00E4B0FC, int)
|
|
||||||
#define gfLevelFlags VAR_U_(0x00E5C2A0, int)
|
|
||||||
#define OptionAutoTarget VAR_U_(0x00D9AC30, int)
|
|
||||||
#define PhdLeft VAR_U_(0x0055D20C, int)
|
|
||||||
#define PhdTop VAR_U_(0x0051D0A8, int)
|
|
||||||
#define PhdRight VAR_U_(0x0055DA3C, int)
|
|
||||||
#define PhdBottom VAR_U_(0x0055D204, int)
|
|
||||||
#define PhdCentreX VAR_U_(0x0055D22C, int)
|
|
||||||
#define PhdCentreY VAR_U_(0x0055D230, int)
|
|
||||||
#define PhdZNear VAR_U_(0x0055D21C, int)
|
|
||||||
#define PhdZFar VAR_U_(0x0055D1F4, int)
|
|
||||||
#define PhdWindowPosX VAR_U_(0x0055D234, short)
|
|
||||||
#define PhdWindowPosY VAR_U_(0x0055D1E8, short)
|
|
||||||
#define PhdWindowXmax VAR_U_(0x0055D218, short)
|
|
||||||
#define PhdWindowYmax VAR_U_(0x0055D240, short)
|
|
||||||
#define CurrentRoom VAR_U_(0x00E6D754, short)
|
|
||||||
#define Unknown_00E6CAE8 VAR_U_(0x00E6CAE8, int)
|
|
||||||
#define Sprites VAR_U_(0x008751B4, SPRITE*)
|
|
||||||
#define GunFlashes ARRAY_(0x00E4D660, GUNFLASH_STRUCT, [MAX_GUNFLASH])
|
|
||||||
#define WBItem VAR_U_(0x00EEEACC, ITEM_INFO*)
|
|
||||||
#define WBRoom VAR_U_(0x00EEF044, short)
|
|
||||||
#define SkyPos1 VAR_U_(0x00E6E4B0, short)
|
|
||||||
#define SkyPos2 VAR_U_(0x00E6D73E, short)
|
|
||||||
#define SkyVelocity1 VAR_U_(0x00E5C276, signed char)
|
|
||||||
#define SkyVelocity2 VAR_U_(0x00E5C275, signed char)
|
|
||||||
#define SkyColor1 VAR_U_(0x00E5C2A4, CVECTOR)
|
|
||||||
#define SkyColor2 VAR_U_(0x00E5C280, CVECTOR)
|
|
||||||
//#define SkyStormColor ARRAY_(0x00E6CAF0, short, [3])
|
|
||||||
//#define SkyStormColor2 ARRAY_(0x00E6E4B8, short, [3])
|
|
||||||
//#define StormTimer VAR_U_(0x0051CD5C, short)
|
|
||||||
//#define Unk_00E6D74C VAR_U_(0x00E6D74C, short)
|
|
||||||
//#define Unk_00E6D73C VAR_U_(0x00E6D73C, short)
|
|
||||||
//#define Unk_00E6D74C VAR_U_(0x00E6D74C, short)
|
|
||||||
//#define Unk_00E6E4DC VAR_U_(0x00E6E4DC, short)
|
|
||||||
#define CurrentAtmosphere VAR_U_(0x00EEEB90, byte)
|
|
||||||
#define WeaponDelay VAR_U_(0x0051CA52, byte)
|
|
||||||
#define AnimatedTextureRanges VAR_U_(0x00D9ADA0, short*)
|
|
||||||
#define RequiredStartPos VAR_U_(0x00E5C2B4, byte)
|
|
||||||
#define InitialiseGame VAR_U_(0x005082C1, byte)
|
|
||||||
#define TorchRoom VAR_U_(0x00507AB0, short)
|
|
||||||
#define WeaponEnemyTimer VAR_U_(0x0080E016, byte)
|
|
||||||
#define HeightType VAR_U_(0x00EEEFF4, int)
|
|
||||||
#define HeavyTriggered VAR_U_(0x00EEEA34, byte)
|
|
||||||
#define FlipEffect VAR_U_(0x00506C60, int)
|
|
||||||
#define FlipTimer VAR_U_(0x0051CA68, int)
|
|
||||||
#define Unknown_00EEF99A VAR_U_(0x00EEF99A, byte)
|
|
||||||
#define TriggerTimer VAR_U_(0x0051CA5A, byte)
|
|
||||||
#define JustLoaded VAR_U_(0x0051D001, byte)
|
|
||||||
#define HKTimer VAR_U_(0x0051CEC9, int)
|
|
||||||
#define HKFlag VAR_U_(0x0051CECC, int)
|
|
||||||
#define HKFlag2 VAR_U_(0x0051CEC8, byte)
|
|
||||||
#define Ropes ARRAY_(0x00E54CC0, ROPE_STRUCT, [12])
|
|
||||||
#define NumRopes VAR_U_(0x0051CA60, int)
|
|
||||||
#define PhdWidth VAR_U_(0x0055D29C, int)
|
|
||||||
#define PhdHeight VAR_U_(0x0055D164, int)
|
|
||||||
#define PhdPerspective VAR_U_(0x0055D208, int)
|
|
||||||
#define PoisonFlags VAR_U_(0x00E5BF3E, byte)
|
|
||||||
//#define SniperCameraActive VAR_U_(0x0051CA1D, byte)
|
|
||||||
//#define BinocularRange VAR_U_(0x0051CA30, int)
|
|
||||||
//#define BinocularOn VAR_U_(0x0051CA34, int)
|
|
||||||
//#define BinocularOldCamera VAR_U_(0x0051CA38, CAMERA_TYPE)
|
|
||||||
//#define LaserSight VAR_U_(0x0051CA3C, int)
|
|
||||||
//#define SniperCount VAR_U_(0x0051CA1C, byte)
|
|
||||||
//#define ExitingBinocular VAR_U_(00051CA20, int)
|
|
||||||
#define OldLaraBusy VAR_U_(0x00E59898, byte)
|
|
||||||
#define Infrared VAR_U_(0x0051CA40, int)
|
|
||||||
#define SpotcamOverlay VAR_U_(0x0051D020, byte)
|
|
||||||
#define SpotcamDontDrawLara VAR_U_(0x0051D021, byte)
|
|
||||||
#define SniperOverlay VAR_U_(0x0051D022, byte)
|
|
||||||
#define TargetGraphicsMeshPointer VAR_U_(0x00E6E460, short*)
|
|
||||||
#define BinocularGraphicsMeshPtr VAR_U_(0x00E6D744, short*)
|
|
||||||
#define CollidedItems ARRAY_(0x00E88EA0, ITEM_INFO*, [1024])
|
|
||||||
#define CollidedMeshes ARRAY_(0x00E89EA0, MESH_INFO*, [1024])
|
|
||||||
#define FlashFadeR VAR_U_(0x0051D07A, short)
|
|
||||||
#define FlashFadeG VAR_U_(0x0051D07C, short)
|
|
||||||
#define FlashFadeB VAR_U_(0x0051D07E, short)
|
|
||||||
#define FlashFader VAR_U_(0x0051D080, short)
|
|
||||||
//#define GlobalCollisionBounds VAR_U_(0x00EEF910, BOUNDING_BOX)
|
|
||||||
#define SphereList ARRAY_(0x00E51FE0, SPHERE, [34])
|
|
||||||
#define IsRoomOutsideNo VAR_U_(0x007FE6C2, short)
|
|
||||||
#define App_Unk00D9AC2B VAR_U_(0x00D9AC2B, byte)
|
|
||||||
#define App_Unk00D9AC19 VAR_U_(0x00D9AC19, byte)
|
|
||||||
#define App_Unk00D9ABFD VAR_U_(0x00D9ABFD, int)
|
|
||||||
#define WaterfallTextures ARRAY_(0x00E59720, OBJECT_TEXTURE*, [6])
|
|
||||||
#define WaterfallY ARRAY_(0x00E59760, float, [6])
|
|
||||||
#define KeyboardLayout0 ARRAY_(0x00516C3C, short, [18])
|
|
||||||
#define KeyboardLayout1 ARRAY_(0x00516C60, short, [18])
|
|
||||||
#define KeyMap ARRAY_(0x0086BB8C, byte, [256])
|
|
||||||
#define ConflictingKeys ARRAY_(0x00878C4C, byte, [256])
|
|
||||||
#define NullRotations ARRAY_(0x0051CD68, short, [12])
|
|
||||||
// JeepBaddieCollision
|
|
||||||
#define Unk_0080DE1A VAR_U_(0x0080DE1A, short)
|
|
||||||
#define Unk_0080DDE8 VAR_U_(0x0080DDE8, int)
|
|
||||||
#define Unk_0080DE24 VAR_U_(0x0080DE24, short)
|
|
||||||
// End
|
|
||||||
#define Unk_00EEFB6C VAR_U_(0x00EEFB6C, short)
|
|
||||||
#define OnObject VAR_U_(0x00EEEAC8, int)
|
|
||||||
#define DontUnlockBox VAR_U_(0x0051CB40, byte)
|
|
||||||
#define TiltXOffset VAR_U_(0x00EEEAD4, int)
|
|
||||||
#define TiltYOffset VAR_U_(0x00EEEADC, int)
|
|
||||||
#define KillEverythingFlag VAR_U_(0x0051CDF4, int)
|
|
||||||
#define SmokeWindX VAR_U_(0x00E6C9E0, int)
|
|
||||||
#define SmokeWindZ VAR_U_(0x00E6C9E4, int)
|
|
||||||
#define LaraNodeUnderwater ARRAY_(0x00E862FE, byte, [15])
|
|
||||||
#define OnFloor VAR_U_(0x00EEEAC8, int)
|
|
||||||
#define SlowMotion VAR_U_(0x0051CA50, short)
|
|
||||||
#define ShatterSounds ARRAY_(0x00506BAC, unsigned char, [18][10])
|
|
||||||
#define TargetMesh VAR_U_(0x00EEFAF8, int)
|
|
||||||
#define WeaponsArray ARRAY_(0x005085B0, WEAPON_INFO, [9])
|
|
||||||
#define GetLaraOnLOS VAR_U_(0x0051CA64, char)
|
|
||||||
#define DebrisFlags VAR_U_(0x0051CA88, int)
|
|
||||||
|
|
||||||
extern bool MonksAttackLara;
|
|
||||||
|
|
||||||
// Remapped variables
|
|
||||||
extern int dword_874254;
|
|
||||||
extern int unk_87435C;
|
|
BIN
TR5Main/Libs/zlib/dll16/zlib16.lib
Normal file
BIN
TR5Main/Libs/zlib/dll16/zlib16.lib
Normal file
Binary file not shown.
BIN
TR5Main/Libs/zlib/dll32/zlib.lib
Normal file
BIN
TR5Main/Libs/zlib/dll32/zlib.lib
Normal file
Binary file not shown.
BIN
TR5Main/Libs/zlib/dll32/zlib_bor.lib
Normal file
BIN
TR5Main/Libs/zlib/dll32/zlib_bor.lib
Normal file
Binary file not shown.
64
TR5Main/Libs/zlib/ioapi.h
Normal file
64
TR5Main/Libs/zlib/ioapi.h
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
/* ioapi.h -- IO base function header for compress/uncompress .zip
|
||||||
|
files using zlib + zip or unzip API
|
||||||
|
|
||||||
|
Version 0.18 beta, Feb 26th, 2002
|
||||||
|
|
||||||
|
Copyright (C) 1998-2002 Gilles Vollant
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ZLIBIOAPI_H
|
||||||
|
#define _ZLIBIOAPI_H
|
||||||
|
|
||||||
|
|
||||||
|
#define ZLIB_FILEFUNC_SEEK_CUR (1)
|
||||||
|
#define ZLIB_FILEFUNC_SEEK_END (2)
|
||||||
|
#define ZLIB_FILEFUNC_SEEK_SET (0)
|
||||||
|
|
||||||
|
#define ZLIB_FILEFUNC_MODE_READ (1)
|
||||||
|
#define ZLIB_FILEFUNC_MODE_WRITE (2)
|
||||||
|
#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
|
||||||
|
|
||||||
|
#define ZLIB_FILEFUNC_MODE_EXISTING (4)
|
||||||
|
#define ZLIB_FILEFUNC_MODE_CREATE (8)
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef ZCALLBACK
|
||||||
|
|
||||||
|
#if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK)
|
||||||
|
#define ZCALLBACK CALLBACK
|
||||||
|
#else
|
||||||
|
#define ZCALLBACK
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
|
||||||
|
typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
|
||||||
|
typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
|
||||||
|
typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
|
||||||
|
typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
|
||||||
|
typedef long (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
|
||||||
|
typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
|
||||||
|
|
||||||
|
typedef struct zlib_filefunc_def_s
|
||||||
|
{
|
||||||
|
open_file_func zopen_file;
|
||||||
|
read_file_func zread_file;
|
||||||
|
write_file_func zwrite_file;
|
||||||
|
tell_file_func ztell_file;
|
||||||
|
seek_file_func zseek_file;
|
||||||
|
close_file_func zclose_file;
|
||||||
|
testerror_file_func zerror_file;
|
||||||
|
voidpf opaque;
|
||||||
|
} zlib_filefunc_def;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
|
||||||
|
|
||||||
|
#define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size))
|
||||||
|
#define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size))
|
||||||
|
#define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream))
|
||||||
|
#define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode))
|
||||||
|
#define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream))
|
||||||
|
#define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream))
|
||||||
|
#endif
|
11
TR5Main/Libs/zlib/readme.txt
Normal file
11
TR5Main/Libs/zlib/readme.txt
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
dll16\zlib16.dll : The 16 bits DLL of ZLib 1.14
|
||||||
|
dll16\zlib16.lib : The 16 bits import library for the DLL of ZLib 1.14
|
||||||
|
dll32\zlib.dll : The 32 bits DLL of ZLib 1.14
|
||||||
|
dll32\zlib.lib : The 32 bits import library for the DLL of ZLib 1.14
|
||||||
|
static32\zlibstat.lib : The 32 bits statis library of zLib 1.14 for Visual C++
|
||||||
|
dll32\zlib_bor.lib : The 32 bits import library for the DLL of ZLib 1.14 for Borland C++
|
||||||
|
|
||||||
|
I also include a version of zconf.h which must replace the version from zlib114.zip
|
||||||
|
The zlib.h included is the same version than in zlib114.zip
|
||||||
|
|
||||||
|
I've also added unzip.h and zip.h (please visit http://www.winimage.com/zLibDll/unzip.html )
|
BIN
TR5Main/Libs/zlib/static32/zlibstat.lib
Normal file
BIN
TR5Main/Libs/zlib/static32/zlibstat.lib
Normal file
Binary file not shown.
300
TR5Main/Libs/zlib/unzip.h
Normal file
300
TR5Main/Libs/zlib/unzip.h
Normal file
|
@ -0,0 +1,300 @@
|
||||||
|
/* unzip.h -- IO for uncompress .zip files using zlib
|
||||||
|
Version 0.18 beta, Feb 26th, 2002
|
||||||
|
|
||||||
|
Copyright (C) 1998-2002 Gilles Vollant
|
||||||
|
|
||||||
|
This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g
|
||||||
|
WinZip, InfoZip tools and compatible.
|
||||||
|
Encryption and multi volume ZipFile (span) are not supported.
|
||||||
|
Old compressions used by old PKZip 1.x are not supported
|
||||||
|
|
||||||
|
THIS IS AN ALPHA VERSION. AT THIS STAGE OF DEVELOPPEMENT, SOMES API OR STRUCTURE
|
||||||
|
CAN CHANGE IN FUTURE VERSION !!
|
||||||
|
I WAIT FEEDBACK at mail info@winimage.com
|
||||||
|
Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution
|
||||||
|
|
||||||
|
Condition of use and distribution are the same than zlib :
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* for more info about .ZIP format, see
|
||||||
|
http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip
|
||||||
|
http://www.info-zip.org/pub/infozip/doc/
|
||||||
|
PkWare has also a specification at :
|
||||||
|
ftp://ftp.pkware.com/probdesc.zip
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _unz_H
|
||||||
|
#define _unz_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _ZLIB_H
|
||||||
|
#include "zlib.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _ZLIBIOAPI_H
|
||||||
|
#include "ioapi.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
|
||||||
|
/* like the STRICT of WIN32, we define a pointer that cannot be converted
|
||||||
|
from (void*) without cast */
|
||||||
|
typedef struct TagunzFile__ { int unused; } unzFile__;
|
||||||
|
typedef unzFile__ *unzFile;
|
||||||
|
#else
|
||||||
|
typedef voidp unzFile;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#define UNZ_OK (0)
|
||||||
|
#define UNZ_END_OF_LIST_OF_FILE (-100)
|
||||||
|
#define UNZ_ERRNO (Z_ERRNO)
|
||||||
|
#define UNZ_EOF (0)
|
||||||
|
#define UNZ_PARAMERROR (-102)
|
||||||
|
#define UNZ_BADZIPFILE (-103)
|
||||||
|
#define UNZ_INTERNALERROR (-104)
|
||||||
|
#define UNZ_CRCERROR (-105)
|
||||||
|
|
||||||
|
/* tm_unz contain date/time info */
|
||||||
|
typedef struct tm_unz_s
|
||||||
|
{
|
||||||
|
uInt tm_sec; /* seconds after the minute - [0,59] */
|
||||||
|
uInt tm_min; /* minutes after the hour - [0,59] */
|
||||||
|
uInt tm_hour; /* hours since midnight - [0,23] */
|
||||||
|
uInt tm_mday; /* day of the month - [1,31] */
|
||||||
|
uInt tm_mon; /* months since January - [0,11] */
|
||||||
|
uInt tm_year; /* years - [1980..2044] */
|
||||||
|
} tm_unz;
|
||||||
|
|
||||||
|
/* unz_global_info structure contain global data about the ZIPfile
|
||||||
|
These data comes from the end of central dir */
|
||||||
|
typedef struct unz_global_info_s
|
||||||
|
{
|
||||||
|
uLong number_entry; /* total number of entries in
|
||||||
|
the central dir on this disk */
|
||||||
|
uLong size_comment; /* size of the global comment of the zipfile */
|
||||||
|
} unz_global_info;
|
||||||
|
|
||||||
|
|
||||||
|
/* unz_file_info contain information about a file in the zipfile */
|
||||||
|
typedef struct unz_file_info_s
|
||||||
|
{
|
||||||
|
uLong version; /* version made by 2 bytes */
|
||||||
|
uLong version_needed; /* version needed to extract 2 bytes */
|
||||||
|
uLong flag; /* general purpose bit flag 2 bytes */
|
||||||
|
uLong compression_method; /* compression method 2 bytes */
|
||||||
|
uLong dosDate; /* last mod file date in Dos fmt 4 bytes */
|
||||||
|
uLong crc; /* crc-32 4 bytes */
|
||||||
|
uLong compressed_size; /* compressed size 4 bytes */
|
||||||
|
uLong uncompressed_size; /* uncompressed size 4 bytes */
|
||||||
|
uLong size_filename; /* filename length 2 bytes */
|
||||||
|
uLong size_file_extra; /* extra field length 2 bytes */
|
||||||
|
uLong size_file_comment; /* file comment length 2 bytes */
|
||||||
|
|
||||||
|
uLong disk_num_start; /* disk number start 2 bytes */
|
||||||
|
uLong internal_fa; /* internal file attributes 2 bytes */
|
||||||
|
uLong external_fa; /* external file attributes 4 bytes */
|
||||||
|
|
||||||
|
tm_unz tmu_date;
|
||||||
|
} unz_file_info;
|
||||||
|
|
||||||
|
extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
|
||||||
|
const char* fileName2,
|
||||||
|
int iCaseSensitivity));
|
||||||
|
/*
|
||||||
|
Compare two filename (fileName1,fileName2).
|
||||||
|
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
|
||||||
|
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
|
||||||
|
or strcasecmp)
|
||||||
|
If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
|
||||||
|
(like 1 on Unix, 2 on Windows)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
extern unzFile ZEXPORT unzOpen OF((const char *path));
|
||||||
|
/*
|
||||||
|
Open a Zip file. path contain the full pathname (by example,
|
||||||
|
on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
|
||||||
|
"zlib/zlib113.zip".
|
||||||
|
If the zipfile cannot be opened (file don't exist or in not valid), the
|
||||||
|
return value is NULL.
|
||||||
|
Else, the return value is a unzFile Handle, usable with other function
|
||||||
|
of this unzip package.
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern unzFile ZEXPORT unzOpen2 OF((const char *path,
|
||||||
|
zlib_filefunc_def* pzlib_filefunc_def));
|
||||||
|
/*
|
||||||
|
Open a Zip file, like unzOpen, but provide a set of file low level API
|
||||||
|
for read/write the zip file (see ioapi.h)
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzClose OF((unzFile file));
|
||||||
|
/*
|
||||||
|
Close a ZipFile opened with unzipOpen.
|
||||||
|
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
|
||||||
|
these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
|
||||||
|
return UNZ_OK if there is no problem. */
|
||||||
|
|
||||||
|
extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
|
||||||
|
unz_global_info *pglobal_info));
|
||||||
|
/*
|
||||||
|
Write info about the ZipFile in the *pglobal_info structure.
|
||||||
|
No preparation of the structure is needed
|
||||||
|
return UNZ_OK if there is no problem. */
|
||||||
|
|
||||||
|
|
||||||
|
extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
|
||||||
|
char *szComment,
|
||||||
|
uLong uSizeBuf));
|
||||||
|
/*
|
||||||
|
Get the global comment string of the ZipFile, in the szComment buffer.
|
||||||
|
uSizeBuf is the size of the szComment buffer.
|
||||||
|
return the number of byte copied or an error code <0
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************/
|
||||||
|
/* Unzip package allow you browse the directory of the zipfile */
|
||||||
|
|
||||||
|
extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
|
||||||
|
/*
|
||||||
|
Set the current file of the zipfile to the first file.
|
||||||
|
return UNZ_OK if there is no problem
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzGoToNextFile OF((unzFile file));
|
||||||
|
/*
|
||||||
|
Set the current file of the zipfile to the next file.
|
||||||
|
return UNZ_OK if there is no problem
|
||||||
|
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzLocateFile OF((unzFile file,
|
||||||
|
const char *szFileName,
|
||||||
|
int iCaseSensitivity));
|
||||||
|
/*
|
||||||
|
Try locate the file szFileName in the zipfile.
|
||||||
|
For the iCaseSensitivity signification, see unzStringFileNameCompare
|
||||||
|
|
||||||
|
return value :
|
||||||
|
UNZ_OK if the file is found. It becomes the current file.
|
||||||
|
UNZ_END_OF_LIST_OF_FILE if the file is not found
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
|
||||||
|
unz_file_info *pfile_info,
|
||||||
|
char *szFileName,
|
||||||
|
uLong fileNameBufferSize,
|
||||||
|
void *extraField,
|
||||||
|
uLong extraFieldBufferSize,
|
||||||
|
char *szComment,
|
||||||
|
uLong commentBufferSize));
|
||||||
|
/*
|
||||||
|
Get Info about the current file
|
||||||
|
if pfile_info!=NULL, the *pfile_info structure will contain somes info about
|
||||||
|
the current file
|
||||||
|
if szFileName!=NULL, the filemane string will be copied in szFileName
|
||||||
|
(fileNameBufferSize is the size of the buffer)
|
||||||
|
if extraField!=NULL, the extra field information will be copied in extraField
|
||||||
|
(extraFieldBufferSize is the size of the buffer).
|
||||||
|
This is the Central-header version of the extra field
|
||||||
|
if szComment!=NULL, the comment string of the file will be copied in szComment
|
||||||
|
(commentBufferSize is the size of the buffer)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/***************************************************************************/
|
||||||
|
/* for reading the content of the current zipfile, you can open it, read data
|
||||||
|
from it, and close it (you can close it before reading all the file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
|
||||||
|
/*
|
||||||
|
Open for reading data the current file in the zipfile.
|
||||||
|
If there is no error, the return value is UNZ_OK.
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
|
||||||
|
int* method,
|
||||||
|
int* level,
|
||||||
|
int raw));
|
||||||
|
/*
|
||||||
|
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
|
||||||
|
*method will receive method of compression, *level will receive level of
|
||||||
|
compression
|
||||||
|
note : you can set level parameter as NULL (if you did not want known level,
|
||||||
|
but you CANNOT set method parameter as NULL
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
|
||||||
|
/*
|
||||||
|
Close the file in zip opened with unzOpenCurrentFile
|
||||||
|
Return UNZ_CRCERROR if all the file was read but the CRC is not good
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
|
||||||
|
voidp buf,
|
||||||
|
unsigned len));
|
||||||
|
/*
|
||||||
|
Read bytes from the current file (opened by unzOpenCurrentFile)
|
||||||
|
buf contain buffer where data must be copied
|
||||||
|
len the size of buf.
|
||||||
|
|
||||||
|
return the number of byte copied if somes bytes are copied
|
||||||
|
return 0 if the end of file was reached
|
||||||
|
return <0 with error code if there is an error
|
||||||
|
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern z_off_t ZEXPORT unztell OF((unzFile file));
|
||||||
|
/*
|
||||||
|
Give the current position in uncompressed data
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzeof OF((unzFile file));
|
||||||
|
/*
|
||||||
|
return 1 if the end of file was reached, 0 elsewhere
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
|
||||||
|
voidp buf,
|
||||||
|
unsigned len));
|
||||||
|
/*
|
||||||
|
Read extra field from the current file (opened by unzOpenCurrentFile)
|
||||||
|
This is the local-header version of the extra field (sometimes, there is
|
||||||
|
more info in the local-header version than in the central-header)
|
||||||
|
|
||||||
|
if buf==NULL, it return the size of the local extra field
|
||||||
|
|
||||||
|
if buf!=NULL, len is the size of the buffer, the extra header is copied in
|
||||||
|
buf.
|
||||||
|
the return value is the number of bytes copied in buf, or (if <0)
|
||||||
|
the error code
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _unz_H */
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue