This commit is contained in:
Woops 2020-06-04 16:17:22 -05:00
commit ae90f99b6b
32 changed files with 2221 additions and 1509 deletions

View file

@ -359,7 +359,7 @@ void CreatureFloat(short itemNumber)
{
item->pos.yPos = waterLevel;
item->collidable = false;
item->status = ITEM_DESACTIVATED;
item->status = ITEM_DEACTIVATED;
DisableBaddieAI(itemNumber);
RemoveActiveItem(itemNumber);
item->afterDeath = 1;
@ -535,7 +535,7 @@ int CreatureAnimation(short itemNumber, short angle, short tilt)
}
AnimateItem(item);
if (item->status == ITEM_DESACTIVATED)
if (item->status == ITEM_DEACTIVATED)
{
CreatureDie(itemNumber, FALSE);
return FALSE;

View file

@ -2268,7 +2268,7 @@ int GetTargetOnLOS(GAME_VECTOR* src, GAME_VECTOR* dest, int DrawTarget, int firi
}
}
}
if (item->status != ITEM_DESACTIVATED)
if (item->status != ITEM_DEACTIVATED)
{
AddActiveItem(itemNumber);
item->status = ITEM_ACTIVE;
@ -2376,7 +2376,7 @@ int ObjectOnLOS2(GAME_VECTOR* start, GAME_VECTOR* end, PHD_VECTOR* vec, MESH_INF
{
item = &Items[linknum];
if (item->status != ITEM_DESACTIVATED
if (item->status != ITEM_DEACTIVATED
&& item->status != ITEM_INVISIBLE
&& (item->objectNumber != ID_LARA && Objects[item->objectNumber].collision != NULL
|| item->objectNumber == ID_LARA && GetLaraOnLOS))
@ -2769,7 +2769,7 @@ void AnimateItem(ITEM_INFO* item)
case COMMAND_DEACTIVATE:
if (Objects[item->objectNumber].intelligent && !item->afterDeath)
item->afterDeath = 1;
item->status = ITEM_DESACTIVATED;
item->status = ITEM_DEACTIVATED;
break;
case COMMAND_SOUND_FX:
case COMMAND_EFFECT:

View file

@ -17,7 +17,7 @@ typedef enum ItemStatus
{
ITEM_ACTIVE,
ITEM_NOT_ACTIVE,
ITEM_DESACTIVATED,
ITEM_DEACTIVATED,
ITEM_INVISIBLE
};

View file

@ -1797,13 +1797,13 @@ void lara_as_pulley(ITEM_INFO* item, COLL_INFO* coll)//1B288, 1B3BC (F)
if (p->itemFlags[2])
{
p->itemFlags[2] = 0;
p->status = ITEM_DESACTIVATED;
p->status = ITEM_DEACTIVATED;
}
}
else
{
if (!p->itemFlags[1])
p->status = ITEM_DESACTIVATED;
p->status = ITEM_DEACTIVATED;
p->itemFlags[2] = 1;

View file

@ -44,24 +44,22 @@ void FireHarpoon()
if (itemNumber != NO_ITEM)
{
GAME_VECTOR pos;
Vector3 dxPos;
PHD_VECTOR posGet;
ITEM_INFO* item = &Items[itemNumber];
item->shade = 0x4210 | 0x8000;
item->objectNumber = ID_HARPOON;
item->roomNumber = LaraItem->roomNumber;
pos.x = dxPos.x = -2;
pos.y = dxPos.y = 0; // -273 - 100;
pos.z = dxPos.z = 77;
g_Renderer->GetLaraBonePosition(&dxPos, LM_RHAND);
GetLaraJointPosition(&PHD_VECTOR(pos.x, pos.y, pos.z), LM_RHAND);
/*item->pos.xPos = pos.x = dxPos.x;
item->pos.yPos = pos.y = dxPos.y;
item->pos.zPos = pos.z = dxPos.z;*/
pos.x = -2;
pos.y = 0;
pos.z = 77;
posGet.x = pos.x;
posGet.y = pos.y;
posGet.z = pos.z;
GetLaraJointPosition(&posGet, LM_RHAND);
pos.x = posGet.z;
pos.y = posGet.y;
pos.z = posGet.z;
item->pos.xPos = pos.x;
item->pos.yPos = pos.y;
item->pos.zPos = pos.z;
@ -1091,10 +1089,11 @@ void ControlCrossbowBolt(short itemNumber)
if (Rooms[roomNumber].flags & ENV_FLAG_WATER)
{
PHD_VECTOR bubblePos(item->pos.xPos, item->pos.yPos, item->pos.zPos);
if (item->speed > 64)
item->speed -= (item->speed >> 4);
if (GlobalCounter & 1)
CreateBubble(&PHD_VECTOR(item->pos.xPos, item->pos.yPos, item->pos.zPos), roomNumber, 4, 7, 0, 0, 0, 0);
CreateBubble(&bubblePos, roomNumber, 4, 7, 0, 0, 0, 0);
}
else
{
@ -1192,7 +1191,8 @@ void ControlCrossbowBolt(short itemNumber)
}
else if (Objects[currentItem->objectNumber].hitEffect)
{
HitTarget(currentItem, &GAME_VECTOR(item->pos.xPos, item->pos.yPos, item->pos.zPos), Weapons[WEAPON_CROSSBOW].damage, 0);
GAME_VECTOR pos(item->pos.xPos, item->pos.yPos, item->pos.zPos);
HitTarget(currentItem, &pos, Weapons[WEAPON_CROSSBOW].damage, 0);
// Poisoned ammos
if (item->itemFlags[0] == CROSSBOW_POISON && !Objects[currentItem->objectNumber].explodableMeshbits)
@ -1490,7 +1490,7 @@ void undraw_shotgun(int weapon)
AnimateItem(item);
if (item->status == ITEM_DESACTIVATED)
if (item->status == ITEM_DEACTIVATED)
{
Lara.gunStatus = LG_NO_ARMS;
Lara.target = NULL;
@ -1660,7 +1660,7 @@ void FireHK(int mode)
Weapons[WEAPON_HK].damage = 3;
}
if (FireWeapon(WEAPON_HK, Lara.target, LaraItem, angles))
if (FireWeapon(WEAPON_HK, Lara.target, LaraItem, angles) != FW_NOAMMO)
{
SmokeCountL = 12;
SmokeWeapon = WEAPON_HK;
@ -1691,7 +1691,7 @@ void FireShotgun()
loopAngles[0] = angles[0] + value * (GetRandomControl() - 0x4000) / 0x10000;
loopAngles[1] = angles[1] + value * (GetRandomControl() - 0x4000) / 0x10000;
if (FireWeapon(WEAPON_SHOTGUN, Lara.target, LaraItem, loopAngles) == FW_MAYBEHIT)
if (FireWeapon(WEAPON_SHOTGUN, Lara.target, LaraItem, loopAngles) != FW_NOAMMO)
fired = true;
}

View file

@ -690,12 +690,12 @@ void HitTarget(ITEM_INFO* item, GAME_VECTOR* hitPos, int damage, int flag)
ObjectInfo* obj = &Objects[item->objectNumber];
item->hitStatus = true;
if (creature && item != LaraItem)
if (creature != nullptr && item != LaraItem)
creature->hurtByLara = true;
if (hitPos != nullptr)
{
if (obj->hitEffect)
if (obj->hitEffect != HIT_NONE)
{
switch (obj->hitEffect)
{
@ -713,7 +713,7 @@ void HitTarget(ITEM_INFO* item, GAME_VECTOR* hitPos, int damage, int flag)
}
}
if (!obj->undead || flag || item->hitPoints == NOT_TARGETABLE)
if ((!obj->undead || flag) && item->hitPoints != NOT_TARGETABLE)
{
if (item->hitPoints > 0 && item->hitPoints <= damage)
++Savegame.Level.Kills;
@ -721,24 +721,20 @@ void HitTarget(ITEM_INFO* item, GAME_VECTOR* hitPos, int damage, int flag)
}
}
FIREWEAPON_TYPE FireWeapon(int weaponType, ITEM_INFO* target, ITEM_INFO* src, short* angles) // (F) (D)
FireWeaponType FireWeapon(int weaponType, ITEM_INFO* target, ITEM_INFO* src, short* angles) // (F) (D)
{
short* ammo = GetAmmo(weaponType);
if (!*ammo)
if (*ammo == 0)
return FW_NOAMMO;
if (*ammo != -1)
(*ammo)--;
*ammo--;
WEAPON_INFO* weapon = &Weapons[weaponType];
int r;
PHD_VECTOR pos;
pos.x = 0;
pos.y = 0;
pos.z = 0;
GetLaraJointPosition(&pos, LM_RHAND);
pos.x = src->pos.xPos;
pos.y = src->pos.yPos - weapon->gunHeight;
pos.z = src->pos.zPos;
PHD_3DPOS rotation;
rotation.xRot = angles[1] + (GetRandomControl() - 0x4000) * weapon->shotAccuracy / 0x10000;
@ -752,7 +748,7 @@ FIREWEAPON_TYPE FireWeapon(int weaponType, ITEM_INFO* target, ITEM_INFO* src, sh
Vector3 direction = Vector3(x, y, z);
direction.Normalize();
Vector3 source = Vector3(pos.x, pos.y, pos.z);
Vector3 destination = source + direction * float(weapon->targetDist);
Vector3 destination = source + direction * weapon->targetDist;
Ray ray = Ray(source, direction);
int num = GetSpheres(target, CreatureSpheres, SPHERES_SPACE_WORLD, Matrix::Identity);
@ -780,7 +776,6 @@ FIREWEAPON_TYPE FireWeapon(int weaponType, ITEM_INFO* target, ITEM_INFO* src, sh
vSrc.x = pos.x;
vSrc.y = pos.y;
vSrc.z = pos.z;
short roomNumber = src->roomNumber;
GetFloor(pos.x, pos.y, pos.z, &roomNumber);
vSrc.roomNumber = roomNumber;
@ -852,25 +847,25 @@ FIREWEAPON_TYPE FireWeapon(int weaponType, ITEM_INFO* target, ITEM_INFO* src, sh
void find_target_point(ITEM_INFO* item, GAME_VECTOR* target) // (F) (D)
{
ANIM_FRAME* bounds = (ANIM_FRAME*) GetBestFrame(item);
ANIM_FRAME* bounds;
int x, y, z, c, s;
int x = (bounds->MinX + bounds->MaxX) / 2;
int y = bounds->MinY + (bounds->MaxY - bounds->MinY) / 3;
int z = (bounds->MinZ + bounds->MaxZ) / 2;
int c = phd_cos(item->pos.yRot);
int s = phd_sin(item->pos.yRot);
bounds = (ANIM_FRAME*)GetBestFrame(item);
x = (int)(bounds->MinX + bounds->MaxX) / 2;
y = (int) bounds->MinY + (bounds->MaxY - bounds->MinY) / 3;
z = (int)(bounds->MinZ + bounds->MaxZ) / 2;
c = phd_cos(item->pos.yRot);
s = phd_sin(item->pos.yRot);
target->x = item->pos.xPos + ((c * x + s * z) >> W2V_SHIFT);
target->y = item->pos.yPos + y;
target->z = item->pos.zPos + ((c * z - s * x) >> W2V_SHIFT);
target->roomNumber = item->roomNumber;
}
void LaraTargetInfo(WEAPON_INFO* weapon) // (F) (D)
{
if (!Lara.target)
if (Lara.target == nullptr)
{
Lara.rightArm.lock = false;
Lara.leftArm.lock = false;
@ -879,22 +874,14 @@ void LaraTargetInfo(WEAPON_INFO* weapon) // (F) (D)
return;
}
PHD_VECTOR pos;
pos.x = 0;
pos.y = 0;
pos.z = 0;
GetLaraJointPosition(&pos, LM_RHAND);
GAME_VECTOR src, targetPoint;
short angles[2];
GAME_VECTOR src;
src.x = LaraItem->pos.xPos;
src.y = pos.y;
src.y = LaraItem->pos.yPos - weapon->gunHeight;
src.z = LaraItem->pos.zPos;
src.roomNumber = LaraItem->roomNumber;
GAME_VECTOR targetPoint;
find_target_point(Lara.target, &targetPoint);
short angles[2];
phd_GetVectorAngles(targetPoint.x - src.x, targetPoint.y - src.y, targetPoint.z - src.z, angles);
angles[0] -= LaraItem->pos.yRot;
@ -961,7 +948,7 @@ bool CheckForHoldingState(int state) // (F) (D)
void LaraGetNewTarget(WEAPON_INFO* winfo) // (F) (D)
{
GAME_VECTOR source, target;
GAME_VECTOR src, target;
int bestDistance, maxDistance, targets, slot, x, y, z, distance;
ITEM_INFO* bestItem, *item;
short bestYrot, angle[2], match;
@ -972,20 +959,18 @@ void LaraGetNewTarget(WEAPON_INFO* winfo) // (F) (D)
Lara.target = NULL;
return;
}
src.x = LaraItem->pos.xPos;
src.y = LaraItem->pos.yPos - winfo->gunHeight;
src.z = LaraItem->pos.zPos;
src.roomNumber = LaraItem->roomNumber;
bestItem = NULL;
bestYrot = MAXSHORT;
bestDistance = MAXINT;
PHD_VECTOR handpos;
handpos.x = 0;
handpos.y = 0;
handpos.z = 0;
GetLaraJointPosition(&handpos, LM_RHAND);
source.x = LaraItem->pos.xPos;
source.y = LaraItem->pos.yPos - handpos.y;
source.z = LaraItem->pos.zPos;
source.roomNumber = LaraItem->roomNumber;
maxDistance = winfo->targetDist;
targets = 0;
for (slot = 0; slot < NUM_SLOTS; ++slot)
{
if (BaddieSlots[slot].itemNum != NO_ITEM)
@ -993,25 +978,25 @@ void LaraGetNewTarget(WEAPON_INFO* winfo) // (F) (D)
item = &Items[BaddieSlots[slot].itemNum];
if (item->hitPoints > 0)
{
x = item->pos.xPos - source.x;
y = item->pos.yPos - source.y;
z = item->pos.zPos - source.z;
x = item->pos.xPos - src.x;
y = item->pos.yPos - src.y;
z = item->pos.zPos - src.z;
if (abs(x) <= maxDistance && abs(y) <= maxDistance && abs(z) <= maxDistance)
{
distance = SQUARE(x) + SQUARE(y) + SQUARE(z);
if (distance < SQUARE(maxDistance))
{
find_target_point(item, &target);
if (LOS(&source, &target))
if (LOS(&src, &target))
{
phd_GetVectorAngles(target.x - source.x, target.y - source.y, target.z - source.z, angle);
phd_GetVectorAngles(target.x - src.x, target.y - src.y, target.z - src.z, angle);
angle[0] -= LaraItem->pos.yRot + Lara.torsoYrot;
angle[1] -= LaraItem->pos.xRot + Lara.torsoXrot;
if (angle[0] >= winfo->lockAngles[0] && angle[0] <= winfo->lockAngles[1] && angle[1] >= winfo->lockAngles[2] && angle[1] <= winfo->lockAngles[3])
{
TargetList[targets] = item;
++targets;
if (abs(angle[0]) < bestYrot + ANGLE(15) && distance < bestDistance)
if (abs(angle[0]) < bestYrot + ANGLE(15.0f) && distance < bestDistance)
{
bestDistance = distance;
bestYrot = abs(angle[0]);

View file

@ -1,7 +1,7 @@
#pragma once
#include "lara.h"
typedef enum FIREWEAPON_TYPE
typedef enum FireWeaponType
{
FW_MISS = -1,
FW_NOAMMO = 0,
@ -33,7 +33,7 @@ void InitialiseNewWeapon();
int WeaponObjectMesh(int weaponType);
void AimWeapon(WEAPON_INFO* winfo, LARA_ARM* arm);
void HitTarget(ITEM_INFO* item, GAME_VECTOR* hitPos, int damage, int flag);
FIREWEAPON_TYPE FireWeapon(int weaponType, ITEM_INFO* target, ITEM_INFO* src, short* angles);
FireWeaponType FireWeapon(int weaponType, ITEM_INFO* target, ITEM_INFO* src, short* angles);
void find_target_point(ITEM_INFO* item, GAME_VECTOR* target);
void LaraTargetInfo(WEAPON_INFO* weapon);
bool CheckForHoldingState(int state);

File diff suppressed because it is too large Load diff

View file

@ -575,7 +575,7 @@ bool SaveGame::readItem()
m_reader->ReadChunks(&readItemChunks, itemNumber);
DisableBaddieAI(itemNumber);
KillItem(itemNumber);
item->status = ITEM_DESACTIVATED;
item->status = ITEM_DEACTIVATED;
item->flags |= ONESHOT;
item->afterDeath = 128;
}
@ -589,7 +589,7 @@ bool SaveGame::readItem()
}
// Some post-processing things
if (obj->isPuzzleHole && (item->status == ITEM_DESACTIVATED || item->status == ITEM_ACTIVE))
if (obj->isPuzzleHole && (item->status == ITEM_DEACTIVATED || item->status == ITEM_ACTIVE))
item->objectNumber += NUM_PUZZLES;
if (item->objectNumber >= ID_SMASH_OBJECT1 && item->objectNumber <= ID_SMASH_OBJECT8 && (item->flags & ONESHOT))

View file

@ -1228,7 +1228,7 @@ int GetSwitchTrigger(ITEM_INFO* item, short* itemNos, int AttatchedToSwitch)
int SwitchTrigger(short itemNum, short timer)
{
ITEM_INFO* item = &Items[itemNum];
if (item->status == ITEM_DESACTIVATED)
if (item->status == ITEM_DEACTIVATED)
{
if ((!item->currentAnimState && item->objectNumber != ID_JUMP_SWITCH || item->currentAnimState == 1 && item->objectNumber == ID_JUMP_SWITCH) && timer > 0)
{

View file

@ -323,7 +323,7 @@ void CeilingTrapDoorCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll) /
l->pos.yRot += ANGLE(180);
result2 = TestLaraPosition(CeilingTrapDoorBounds, item, l);
l->pos.yRot += ANGLE(180);
if (TrInput & IN_ACTION && item->status != ITEM_DESACTIVATED && l->currentAnimState == STATE_LARA_JUMP_UP && l->gravityStatus && Lara.gunStatus == LG_NO_ARMS && (result || result2))
if (TrInput & IN_ACTION && item->status != ITEM_DEACTIVATED && l->currentAnimState == STATE_LARA_JUMP_UP && l->gravityStatus && Lara.gunStatus == LG_NO_ARMS && (result || result2))
{
AlignLaraPosition(&CeilingTrapDoorPos, item, l);
if (result2)
@ -363,7 +363,7 @@ void FloorTrapDoorCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll) //
ITEM_INFO* item;
item = &Items[itemNumber];
if (TrInput & IN_ACTION && item->status != ITEM_DESACTIVATED && l->currentAnimState == STATE_LARA_STOP && l->animNumber == ANIMATION_LARA_STAY_IDLE && Lara.gunStatus == LG_NO_ARMS
if (TrInput & IN_ACTION && item->status != ITEM_DEACTIVATED && l->currentAnimState == STATE_LARA_STOP && l->animNumber == ANIMATION_LARA_STAY_IDLE && Lara.gunStatus == LG_NO_ARMS
|| Lara.isMoving && Lara.generalPtr == (void *) itemNumber)
{
if (TestLaraPosition(FloorTrapDoorBounds, item, l))

View file

@ -214,7 +214,7 @@ void NatlaEvilControl(short itemNum)
CreatureAnimation(itemNum, 0, 0);
/* Explode on death and set off heavy trigger into the bargain */
if (item->status == ITEM_DESACTIVATED)
if (item->status == ITEM_DEACTIVATED)
{
SoundEffect(171, &item->pos, NULL);
ExplodingDeath(itemNum, 0xffffffff, ABORT_PART_DAMAGE);
@ -224,6 +224,6 @@ void NatlaEvilControl(short itemNum)
TestTriggers(TriggerIndex, TRUE, 0);
KillItem(itemNum);
item->status = ITEM_DESACTIVATED;
item->status = ITEM_DEACTIVATED;
}
}

View file

@ -322,9 +322,9 @@ void DragonControl(short backNum)
// all over
DisableBaddieAI(itemNum);
KillItem(backNum);
back->status = ITEM_DESACTIVATED;
back->status = ITEM_DEACTIVATED;
KillItem(itemNum);
item->status = ITEM_DESACTIVATED;
item->status = ITEM_DEACTIVATED;
return;
}
else if (dragon->flags < -100)

View file

@ -232,7 +232,7 @@ void SkidManControl(short riderNum)
rider->animNumber = item->animNumber + (Objects[ID_SNOWMOBILE_DRIVER].animIndex - Objects[ID_SNOWMOBILE_GUN].animIndex);
rider->frameNumber = item->frameNumber + (Anims[rider->animNumber].frameBase - Anims[item->animNumber].frameBase);
}
else if (rider->status == ITEM_DESACTIVATED && item->speed == 0 && item->fallspeed == 0)
else if (rider->status == ITEM_DEACTIVATED && item->speed == 0 && item->fallspeed == 0)
{
/* If rider has reached end of his death animation, turn his skidoo into one that Lara can ride */
RemoveActiveItem(riderNum);
@ -242,7 +242,7 @@ void SkidManControl(short riderNum)
DisableBaddieAI(item_number);
item->objectNumber = ID_SNOWMOBILE;
item->status = ITEM_DESACTIVATED;
item->status = ITEM_DEACTIVATED;
InitialiseSkidoo(item_number);
((SKIDOO_INFO*)item->data)->armed = true;

View file

@ -196,7 +196,7 @@ static void SkidooExplode(ITEM_INFO* skidoo)
ExplodingDeath(Lara.Vehicle, -1, 256);
KillItem(Lara.Vehicle);
skidoo->status = ITEM_DESACTIVATED;
skidoo->status = ITEM_DEACTIVATED;
SoundEffect(SFX_EXPLOSION1, 0, 0);
SoundEffect(SFX_EXPLOSION2, 0, 0);
Lara.Vehicle = NO_ITEM;

View file

@ -153,7 +153,7 @@ static void QuadbikeExplode(ITEM_INFO* item)
ExplodingDeath(Lara.Vehicle, 0xfffffffe, 1);
KillItem(Lara.Vehicle);
item->status = ITEM_DESACTIVATED;
item->status = ITEM_DEACTIVATED;
SoundEffect(SFX_EXPLOSION1, NULL, 0);
SoundEffect(SFX_EXPLOSION2, NULL, 0);

View file

@ -0,0 +1,658 @@
#include "framework.h"
#include "tr4_baboon.h"
#include "Box.h"
#include "lot.h"
#include "setup.h"
#include "control.h"
#include "misc.h"
#include "Lara.h"
#include "switch.h"
#include "tomb4fx.h"
BaboonRespawnClass BaboonRespawn;
static BITE_INFO baboonBite = { 10, 10, 11, 4 };
enum BABOON_STATE
{
BABOON_NULL,
BABOON_EMPTY,
BABOON_WALK,
BABOON_IDLE,
BABOON_RUN,
BABOON_PICKUP,
BABOON_SIT_IDLE,
BABOON_SIT_EAT,
BABOON_SIT_SCRATCH,
BABOON_RUN_ROLL,
BABOON_HITGROUND,
BABOON_DEATH,
BABOON_ATK1,
BABOON_JUMPATK,
BABOON_SUPERJUMPATK,
/// NOT USED IN TR4:
BABOON_CLIMB_4CLICK,
BABOON_CLIMB_3CLICK,
BABOON_CLIMB_2CLICK,
BABOON_FALL_4CLICK,
BABOON_FALL_3CLICK,
BABOON_FALL_2CLICK,
///!END
BABOON_ACTIVATE_SWITCH
};
constexpr auto NO_BABOON = -1;
constexpr auto NO_BABOON_COUNT = -2;
constexpr auto NO_CROWBAR_SWITCH_FOUND = -1;
#define BABOON_SIT_IDLE_ANIM 2
#define BABOON_IDLE_ANIM 9
#define BABOON_DEATH_ANIM 14
#define BABOON_SWITCH_ANIM 31
#define BABOON_DAMAGE 70
#define BABOON_IDLE_DISTANCE SQUARE(WALL_SIZE)
#define BABOON_ATTACK_ANGLE ANGLE(7.0f)
#define BABOON_ATK_RANGE 0x718E4
#define BABOON_ATK_NORMALRANGE 0x1C639
#define BABOON_JUMP_RANGE 0x718E4
#define BABOON_FOLLOW_RANGE 0x400000
#define BABOON_RUNROLL_RANGE 0x100000
#define BABOON_WALK_ANGLE ANGLE(7.0f)
#define BABOON_RUN_ANGLE ANGLE(11.0f)
/// NOTE (TokyoSU): these touchbits is fixed !
/// now the baboon is a killing machine :D
#define BABOON_RIGHT_TOUCHBITS 814
#define BABOON_JUMP_TOUCHBITS 280
#define BABOON_TOUCHBITS 0x1800
static void TriggerBaboonShockwave(PHD_3DPOS pos, short xRot)
{
short shockwaveID = GetFreeShockwave();
if (shockwaveID != NO_ITEM)
{
SHOCKWAVE_STRUCT* dieEffect = &ShockWaves[shockwaveID];
dieEffect->x = pos.xPos;
dieEffect->y = pos.yPos;
dieEffect->z = pos.zPos;
dieEffect->innerRad = 0x2000280;
dieEffect->outerRad = 0x28802000;
dieEffect->xRot = xRot;
dieEffect->r = 255;
dieEffect->g = 64;
dieEffect->b = 0;
dieEffect->speed = -600;
dieEffect->life = 64;
}
}
void BaboonDieEffect(ITEM_INFO* item)
{
PHD_3DPOS pos = PHD_3DPOS(item->pos.xPos, item->pos.yPos - 128, item->pos.zPos);
// trigger shockwave effect
TriggerBaboonShockwave(pos, ANGLE(0.0f));
TriggerBaboonShockwave(pos, ANGLE(45.0f));
TriggerBaboonShockwave(pos, ANGLE(90.0f));
TriggerBaboonShockwave(pos, ANGLE(135.0f));
// trigger flash screen
FlashFadeR = 255;
FlashFadeG = 64;
FlashFadeB = 0;
FlashFader = 32;
}
static void KillRespawnedBaboon(short itemNumber, bool remove = false)
{
ITEM_INFO* item;
item = &Items[itemNumber];
item->hitPoints = 0;
RemoveActiveItem(itemNumber); // remove it from the active item list
item->flags = IFLAG_CLEAR_BODY;
item->afterDeath = 128; // instant disappear !
item->status = ITEM_DEACTIVATED; // wont triggered again...
if (remove)
item->itemFlags[0] = NO_BABOON;
DisableBaddieAI(itemNumber); // desactivate this AI or you will get crash later...
}
static bool CheckRespawnedBaboon(short itemNumber)
{
ITEM_INFO* item;
BaboonRespawnStruct* baboon;
item = &Items[itemNumber];
if (item->itemFlags[0] == NO_BABOON) // NORMAL/INV for now
{
KillRespawnedBaboon(itemNumber);
return false;
}
baboon = BaboonRespawn.GetBaboonRespawn(item->itemFlags[0]);
if (baboon == nullptr)
return false;
if (baboon->count == baboon->max_count)
{
KillRespawnedBaboon(itemNumber, true);
return false;
}
return true;
}
static void UpdateRespawnedBaboon(short itemNumber)
{
ITEM_INFO* item;
ObjectInfo* obj;
BaboonRespawnStruct* baboon;
item = &Items[itemNumber];
obj = &Objects[item->objectNumber];
baboon = BaboonRespawn.GetBaboonRespawn(item->itemFlags[0]);
if (baboon == nullptr)
return;
item->pos = baboon->pos;
IsRoomOutside(item->pos.xPos, item->pos.yPos, item->pos.zPos);
if (item->roomNumber != IsRoomOutsideNo)
ItemNewRoom(itemNumber, IsRoomOutsideNo);
if (baboon->count < baboon->max_count)
baboon->count++;
item->animNumber = obj->animIndex + BABOON_SIT_IDLE_ANIM;
item->frameNumber = Anims[item->animNumber].frameBase;
item->currentAnimState = BABOON_SIT_IDLE;
item->goalAnimState = BABOON_SIT_IDLE;
item->hitPoints = obj->hitPoints;
RemoveActiveItem(itemNumber);
item->flags = NULL;
item->afterDeath = 0;
item->status = ITEM_INVISIBLE;
DisableBaddieAI(itemNumber);
if (item->objectNumber == ID_BABOON_NORMAL)
{
if (item->triggerFlags == 1)
return;
else
item->collidable = TRUE;
}
else if (item->triggerFlags == 0)
{
item->collidable = TRUE;
}
}
void BaboonRespawnFunction(short itemNumber)
{
ITEM_INFO* item;
item = &Items[itemNumber];
BaboonDieEffect(item);
if (!CheckRespawnedBaboon(itemNumber))
return;
UpdateRespawnedBaboon(itemNumber);
}
void InitialiseBaboon(short itemNumber)
{
ITEM_INFO* item;
InitialiseCreature(itemNumber);
item = &Items[itemNumber];
item->animNumber = Objects[item->objectNumber].animIndex + BABOON_SIT_IDLE_ANIM;
item->frameNumber = Anims[item->animNumber].frameBase;
item->goalAnimState = BABOON_SIT_IDLE;
item->currentAnimState = BABOON_SIT_IDLE;
if (item->objectNumber == ID_BABOON_SILENT)
BaboonRespawn.Add(item, 2);
else
item->itemFlags[0] = NO_BABOON;
}
void BaboonControl(short itemNumber)
{
if (!CreatureActive(itemNumber))
return;
ITEM_INFO* item;
CREATURE_INFO* baboon;
FLOOR_INFO* floor;
AI_INFO info, Lara_info;
short tilt, angle, head_y;
item = &Items[itemNumber];
baboon = GetCreatureInfo(item);
head_y = 0;
tilt = 0;
angle = 0;
if (item->hitPoints <= 0 && item->hitPoints != NOT_TARGETABLE)
{
if (item->currentAnimState == BABOON_DEATH)
{
if (item->frameNumber == Anims[item->animNumber].frameEnd)
BaboonRespawnFunction(itemNumber);
}
else if (item->currentAnimState != BABOON_ACTIVATE_SWITCH)
{
item->animNumber = Objects[item->objectNumber].animIndex + BABOON_DEATH_ANIM;
item->frameNumber = Anims[item->animNumber].frameBase;
item->currentAnimState = BABOON_DEATH;
item->goalAnimState = BABOON_DEATH;
}
}
else
{
GetAITarget(baboon);
CreatureAIInfo(item, &info);
if (!item->hitStatus && item->objectNumber == ID_BABOON_NORMAL)
{
int dx, dz;
dx = LaraItem->pos.xPos - item->pos.xPos;
dz = LaraItem->pos.zPos - item->pos.zPos;
Lara_info.angle = phd_atan(dx, dz) - item->pos.yRot;
Lara_info.distance = SQUARE(dx) + SQUARE(dz);
if (baboon->enemy == nullptr || baboon->enemy == LaraItem)
baboon->enemy = nullptr;
}
else
{
Lara_info.angle = info.angle;
Lara_info.distance = info.distance;
baboon->enemy = LaraItem;
}
GetCreatureMood(item, &info, TRUE);
CreatureMood(item, &info, TRUE);
angle = CreatureTurn(item, baboon->maximumTurn);
if (baboon->enemy != nullptr && baboon->enemy != LaraItem && baboon->enemy->objectNumber == ID_AI_FOLLOW)
{
if (baboon->reachedGoal
&& (abs(item->pos.xPos - baboon->enemy->pos.xPos) < CLICK(1)
&& abs(item->pos.yPos - baboon->enemy->pos.yPos) < CLICK(1)
&& abs(item->pos.zPos - baboon->enemy->pos.zPos) < CLICK(1)))
{
item->pos.xPos = baboon->enemy->pos.xPos;
item->pos.yPos = baboon->enemy->pos.yPos;
item->pos.zPos = baboon->enemy->pos.zPos;
item->pos.yRot = baboon->enemy->pos.yRot;
item->animNumber = Objects[item->objectNumber].animIndex + BABOON_SWITCH_ANIM;
item->frameNumber = Anims[item->animNumber].frameBase;
item->goalAnimState = BABOON_ACTIVATE_SWITCH;
item->currentAnimState = BABOON_ACTIVATE_SWITCH;
item->aiBits &= ~(FOLLOW);
floor = GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &item->roomNumber);
GetFloorHeight(floor, item->pos.xPos, item->pos.yPos, item->pos.zPos);
TestTriggers(TriggerIndex, TRUE, FALSE);
baboon->enemy = nullptr;
}
}
switch (item->currentAnimState)
{
case BABOON_IDLE:
baboon->maximumTurn = 0;
baboon->flags = 0;
if (item->aiBits & GUARD)
{
AIGuard(baboon);
if (!(GetRandomControl() & 0xF))
{
if (GetRandomControl() & 1)
item->goalAnimState = BABOON_HITGROUND;
else
item->goalAnimState = BABOON_SIT_IDLE;
}
}
else if (item->aiBits & PATROL1)
{
item->goalAnimState = BABOON_WALK;
}
else if (baboon->mood == ESCAPE_MOOD)
{
if (info.ahead && Lara.target != item)
item->goalAnimState = BABOON_IDLE;
else
item->goalAnimState = BABOON_RUN;
}
else if (baboon->mood == ATTACK_MOOD)
{
if (!(item->aiBits & FOLLOW) || (!item->gravityStatus && info.distance <= BABOON_RUNROLL_RANGE))
{
if (info.bite && info.distance < BABOON_ATK_NORMALRANGE)
{
if (LaraItem->pos.yPos >= item->pos.yPos)
item->goalAnimState = BABOON_ATK1;
else
item->goalAnimState = BABOON_JUMPATK;
}
else if (info.bite && info.distance < BABOON_JUMP_RANGE)
{
item->goalAnimState = BABOON_SUPERJUMPATK;
}
else if (info.bite && info.distance < BABOON_RUNROLL_RANGE)
{
item->goalAnimState = BABOON_RUN_ROLL;
}
else
{
item->goalAnimState = BABOON_RUN;
}
}
else if (item->requiredAnimState)
{
item->goalAnimState = item->requiredAnimState;
}
else if (GetRandomControl() & 1)
{
item->goalAnimState = BABOON_SIT_IDLE;
}
}
else if (item->requiredAnimState)
{
item->goalAnimState = item->requiredAnimState;
}
else if (!(GetRandomControl() & 3))
{
item->goalAnimState = BABOON_WALK;
}
else if (!(GetRandomControl() & 1))
{
item->goalAnimState = BABOON_RUN_ROLL;
}
else if (GetRandomControl() & 4)
{
item->goalAnimState = BABOON_HITGROUND;
}
break;
case BABOON_SIT_IDLE:
baboon->maximumTurn = 0;
baboon->flags = 0;
if (item->aiBits & GUARD)
{
AIGuard(baboon);
if (GetRandomControl() & 0xF)
item->goalAnimState = BABOON_SIT_EAT;
else if (GetRandomControl() & 0xA)
item->goalAnimState = BABOON_SIT_SCRATCH;
}
else if (item->aiBits & PATROL1)
{
item->goalAnimState = BABOON_WALK;
}
else if (baboon->mood != ESCAPE_MOOD)
{
if (baboon->mood == BORED_MOOD)
{
if (item->requiredAnimState)
{
item->goalAnimState = item->requiredAnimState;
}
// NOTE: it's not the original code, but it's too wreid
// that the baboon repeat the same move so i included the sit_idle with more random number
// (the eat not exist in the bored mood, i added it !)
else if (GetRandomControl() & 0x10)
{
item->goalAnimState = BABOON_SIT_IDLE;
}
else if (GetRandomControl() & 0x500)
{
if (GetRandomControl() & 0x200)
item->goalAnimState = BABOON_SIT_SCRATCH;
else if (GetRandomControl() & 0x250)
item->goalAnimState = BABOON_SIT_EAT;
}
else if (GetRandomControl() & 0x1000 || item->aiBits & FOLLOW)
{
item->goalAnimState = BABOON_WALK;
}
}
else if ((item->aiBits & FOLLOW) && info.distance > BABOON_IDLE_DISTANCE)
{
if (item->requiredAnimState)
item->goalAnimState = item->requiredAnimState;
else
item->goalAnimState = BABOON_WALK;
}
else
{
item->goalAnimState = BABOON_WALK;
}
}
else
{
item->goalAnimState = BABOON_IDLE;
}
break;
case BABOON_WALK:
baboon->maximumTurn = BABOON_WALK_ANGLE;
if (item->aiBits & PATROL1)
{
item->goalAnimState = BABOON_WALK;
}
else if (baboon->mood == BORED_MOOD)
{
if (item->aiBits & FOLLOW)
item->goalAnimState = BABOON_WALK;
else if (GetRandomControl() < 256)
item->goalAnimState = BABOON_SIT_IDLE;
}
else if (baboon->mood == ESCAPE_MOOD)
{
item->goalAnimState = BABOON_RUN;
}
else if (baboon->mood == ATTACK_MOOD)
{
if (info.bite && info.distance < BABOON_ATK_RANGE)
item->goalAnimState = BABOON_IDLE;
}
else if (GetRandomControl() < 256)
{
item->goalAnimState = BABOON_SIT_IDLE;
}
break;
case BABOON_RUN:
baboon->maximumTurn = BABOON_RUN_ANGLE;
tilt = angle / 2;
if (item->aiBits & GUARD)
{
item->goalAnimState = BABOON_IDLE;
}
else if (baboon->mood == ESCAPE_MOOD)
{
if (info.ahead && Lara.target != item)
item->goalAnimState = BABOON_IDLE;
}
else if (item->aiBits & FOLLOW && (item->gravityStatus || info.distance > BABOON_FOLLOW_RANGE))
{
item->goalAnimState = BABOON_IDLE;
}
else if (baboon->mood == ATTACK_MOOD)
{
if (info.distance < BABOON_ATK_RANGE)
item->goalAnimState = BABOON_IDLE;
else if (info.bite && info.distance < BABOON_RUNROLL_RANGE)
item->goalAnimState = BABOON_RUN_ROLL;
}
else
{
item->goalAnimState = BABOON_RUN_ROLL;
}
break;
case BABOON_PICKUP:
baboon->maximumTurn = 0;
// NOTE: baboon not use it ! (only TR3 one)
break;
case BABOON_ACTIVATE_SWITCH:
baboon->maximumTurn = 0;
item->hitPoints = NOT_TARGETABLE;
if (item->frameNumber == Anims[item->animNumber].frameBase + 212)
{
GAME_VECTOR pos;
pos.x = 0;
pos.y = 0;
pos.z = 0;
pos.boxNumber = 0;
pos.roomNumber = NO_ROOM;
switch (item->pos.yRot)
{
case -0x4000: // WEST (OK)
pos.x = item->pos.xPos - SECTOR(1);
pos.z = item->pos.zPos;
break;
case 0x4000: // EAST (OK)
pos.x = item->pos.xPos + SECTOR(1);
pos.z = item->pos.zPos;
break;
case 0: // NORTH (NOP) maybe okay now with TR5Main
pos.x = item->pos.xPos;
pos.z = item->pos.zPos + SECTOR(1);
break;
case -0x8000: // SOUTH (OK)
pos.x = item->pos.xPos;
pos.z = item->pos.zPos - SECTOR(1);
break;
}
pos.y = item->pos.yPos;
pos.roomNumber = item->roomNumber;
floor = GetFloor(pos.x, pos.y, pos.z, &pos.roomNumber);
int height = GetFloorHeight(floor, pos.x, pos.y, pos.z);
item->floor = height;
TestTriggersAtXYZ(pos.x, pos.y, pos.z, pos.roomNumber, TRUE, NULL);
item->triggerFlags = 1;
}
break;
case BABOON_ATK1:
case BABOON_JUMPATK:
case BABOON_SUPERJUMPATK:
if (info.ahead)
head_y = info.angle;
baboon->maximumTurn = 0;
if (abs(info.angle) >= BABOON_ATTACK_ANGLE)
{
if (info.angle >= 0)
item->pos.yRot += BABOON_ATTACK_ANGLE;
else
item->pos.yRot -= BABOON_ATTACK_ANGLE;
}
else
{
item->pos.yRot += info.angle;
}
if ( baboon->flags == 0
&& ((item->touchBits & BABOON_TOUCHBITS)
|| (item->touchBits & BABOON_RIGHT_TOUCHBITS)
|| (item->touchBits & BABOON_JUMP_TOUCHBITS)))
{
LaraItem->hitPoints -= BABOON_DAMAGE;
LaraItem->hitStatus = TRUE;
CreatureEffect2(item, &baboonBite, 10, -1, DoBloodSplat);
baboon->flags = 1;
}
break;
}
}
CreatureTilt(item, tilt);
CreatureJoint(item, 0, head_y);
CreatureAnimation(itemNumber, angle, tilt);
}
void BaboonRespawnClass::Free(void)
{
baboonRespawnArray.clear();
}
void BaboonRespawnClass::Add(ITEM_INFO* item, int max_count)
{
BaboonRespawnStruct toAdd;
toAdd.id = GetBaboonFreePlace();
toAdd.pos = item->pos;
toAdd.count = 0;
toAdd.max_count = max_count;
item->itemFlags[0] = toAdd.id; // conserve the id of baboon respawn position on the array...
baboonRespawnArray.push_back(toAdd);
}
void BaboonRespawnClass::Remove(int id)
{
if (baboonRespawnArray.empty())
return;
for (auto i = baboonRespawnArray.begin(); i != baboonRespawnArray.end(); i++)
{
if (i->id == id)
baboonRespawnArray.erase(i);
}
}
int BaboonRespawnClass::GetBaboonFreePlace()
{
if (baboonRespawnArray.empty())
return 0;
int j = 0;
for (auto i = baboonRespawnArray.begin(); i != baboonRespawnArray.end(); i++, j++)
{
if (i->id == NO_BABOON)
return j;
}
return NO_BABOON;
}
BaboonRespawnStruct* BaboonRespawnClass::GetBaboonRespawn(int id)
{
if (baboonRespawnArray.empty())
return nullptr;
for (auto i = baboonRespawnArray.begin(); i != baboonRespawnArray.end(); i++)
{
if (i->id == id)
return &*i;
}
return nullptr;
}
int BaboonRespawnClass::GetCount(int id)
{
if (baboonRespawnArray.empty())
return NO_BABOON_COUNT;
for (auto i = baboonRespawnArray.begin(); i != baboonRespawnArray.end(); i++)
{
if (i->id == id)
return i->count;
}
return NO_BABOON_COUNT;
}
int BaboonRespawnClass::GetCountMax(int id)
{
if (baboonRespawnArray.empty())
return NO_BABOON_COUNT;
for (auto i = baboonRespawnArray.begin(); i != baboonRespawnArray.end(); i++)
{
if (i->id == id)
return i->max_count;
}
return NO_BABOON_COUNT;
}

View file

@ -0,0 +1,31 @@
#pragma once
#include "phd_global.h"
#include "items.h"
struct BaboonRespawnStruct
{
int id;
PHD_3DPOS pos;
int count;
int max_count; // used to limit the number of respawn !
};
class BaboonRespawnClass
{
private:
vector<BaboonRespawnStruct> baboonRespawnArray;
public:
void Free(void);
void Add(ITEM_INFO* item, int max_count);
void Remove(int id);
int GetBaboonFreePlace(void);
BaboonRespawnStruct* GetBaboonRespawn(int id);
int GetCount(int id);
int GetCountMax(int id);
};
extern BaboonRespawnClass BaboonRespawn;
extern void InitialiseBaboon(short itemNumber);
extern void BaboonControl(short itemNumber);

View file

@ -215,7 +215,7 @@ void SentryGunControl(short itemNum)
KillItem(itemNum);
item->flags |= 1u;
item->status = ITEM_DESACTIVATED;
item->status = ITEM_DEACTIVATED;
RemoveAllItemsInRoom(item->roomNumber, ID_SMOKE_EMITTER_BLACK);

View file

@ -110,7 +110,7 @@ void InitialiseSkeleton(short itemNumber)
item->currentAnimState = 25;
item->animNumber = obj->animIndex;
item->frameNumber = Anims[item->animNumber].frameBase;
item->status = ITEM_DESACTIVATED;
item->status = ITEM_DEACTIVATED;
break;
}

View file

@ -11,7 +11,7 @@ void ControlSpikyCeiling(short itemNumber)
{
ITEM_INFO* item = &Items[itemNumber];
if (TriggerActive(item) && item->status != ITEM_DESACTIVATED)
if (TriggerActive(item) && item->status != ITEM_DEACTIVATED)
{
int y = item->pos.yPos + ((item->itemFlags[0] == 1) ? 10 : 5);
@ -20,7 +20,7 @@ void ControlSpikyCeiling(short itemNumber)
if (GetFloorHeight(floor, item->pos.xPos, y, item->pos.zPos) < y + 1024)
{
item->status = ITEM_DESACTIVATED;
item->status = ITEM_DEACTIVATED;
StopSoundEffect(147);
}
else
@ -45,6 +45,6 @@ void ControlSpikyCeiling(short itemNumber)
SoundEffect(56, &item->pos, 0);
}
if (TriggerActive(item) && item->status != ITEM_DESACTIVATED && item->itemFlags[0] == 1)
if (TriggerActive(item) && item->status != ITEM_DEACTIVATED && item->itemFlags[0] == 1)
AnimateItem(item);
}

View file

@ -12,7 +12,7 @@ void ControlSpikyWall(short itemNum)
ITEM_INFO* item = &Items[itemNum];
/* Move wall */
if (TriggerActive(item) && item->status != ITEM_DESACTIVATED)
if (TriggerActive(item) && item->status != ITEM_DEACTIVATED)
{
int x = item->pos.xPos + phd_sin(item->pos.yRot) >> WALL_SHIFT;
int z = item->pos.zPos + phd_cos(item->pos.yRot) >> WALL_SHIFT;
@ -22,7 +22,7 @@ void ControlSpikyWall(short itemNum)
if (GetFloorHeight(floor, x, item->pos.yPos, z) != item->pos.yPos)
{
item->status = ITEM_DESACTIVATED;
item->status = ITEM_DEACTIVATED;
StopSoundEffect(SFX_ROLLING_BALL);
}
else

View file

@ -609,7 +609,7 @@ static void JeepExplode(ITEM_INFO* item)
ExplodingDeath(Lara.Vehicle, -1, 256);
KillItem(Lara.Vehicle);
item->status = ITEM_DESACTIVATED;
item->status = ITEM_DEACTIVATED;
SoundEffect(SFX_EXPLOSION1, 0, 0);
SoundEffect(SFX_EXPLOSION2, 0, 0);
Lara.Vehicle = NO_ITEM;

View file

@ -22,6 +22,7 @@
#include "tr4_troops.h" // OK
#include "tr4_wildboar.h" // OK
#include "tr4_wraith.h" // OFF
#include "tr4_baboon.h" // OK
/// objects
#include "tr4_sarcophagus.h"
/// puzzle
@ -470,19 +471,61 @@ static void StartBaddy(ObjectInfo* obj)
obj = &Objects[ID_BABOON_NORMAL];
if (obj->loaded)
{
obj->initialise = InitialiseBaboon;
obj->control = BaboonControl;
obj->collision = CreatureCollision;
obj->shadowSize = 128;
obj->hitPoints = 30;
obj->pivotLength = 200;
obj->radius = 256;
obj->intelligent = true;
obj->saveAnim = true;
obj->saveFlags = true;
obj->saveHitpoints = true;
obj->savePosition = true;
obj->hitEffect = HIT_BLOOD;
}
obj = &Objects[ID_BABOON_INV];
if (obj->loaded)
{
obj->initialise = InitialiseBaboon;
obj->control = BaboonControl;
obj->collision = CreatureCollision;
obj->shadowSize = 128;
obj->hitPoints = 30;
obj->pivotLength = 200;
obj->radius = 256;
obj->intelligent = true;
obj->saveAnim = true;
obj->saveFlags = true;
obj->saveHitpoints = true;
obj->savePosition = true;
obj->hitEffect = HIT_BLOOD;
if (Objects[ID_BABOON_NORMAL].loaded)
Objects[ID_BABOON_INV].animIndex = Objects[ID_BABOON_NORMAL].animIndex;
}
obj = &Objects[ID_BABOON_SILENT];
if (obj->loaded)
{
obj->initialise = InitialiseBaboon;
obj->control = BaboonControl;
obj->collision = CreatureCollision;
obj->shadowSize = 128;
obj->hitPoints = 30;
obj->pivotLength = 200;
obj->radius = 256;
obj->intelligent = true;
obj->saveAnim = true;
obj->saveFlags = true;
obj->saveHitpoints = true;
obj->savePosition = true;
obj->hitEffect = HIT_BLOOD;
if (Objects[ID_BABOON_NORMAL].loaded)
Objects[ID_BABOON_SILENT].animIndex = Objects[ID_BABOON_NORMAL].animIndex;
}
}

View file

@ -106,7 +106,7 @@ void LarsonControl(short itemNumber)
item->gravityStatus = false;
item->hitStatus = false;
item->collidable = false;
item->status = ITEM_DESACTIVATED;
item->status = ITEM_DEACTIVATED;
}
else
{

View file

@ -268,14 +268,14 @@ void PushableBlockControl(short itemNumber)
{
item->gravityStatus = false;
item->pos.yPos = height;
item->status = ITEM_DESACTIVATED;
item->status = ITEM_DEACTIVATED;
floor_shake_effect(item);
SoundEffect(SFX_LARA_THUD, &item->pos, 0);
}
if (item->roomNumber != roomNumber)
ItemNewRoom(itemNumber, roomNumber);
if (item->status == ITEM_DESACTIVATED)
if (item->status == ITEM_DEACTIVATED)
{
item->status = ITEM_NOT_ACTIVE;
RemoveActiveItem(itemNumber);

View file

@ -41,7 +41,7 @@ void SmashObject(short itemNumber)
if (item->status == ITEM_ACTIVE)
RemoveActiveItem(itemNumber);
item->status = ITEM_DESACTIVATED;
item->status = ITEM_DEACTIVATED;
}
void SmashObjectControl(short itemNumber)

View file

@ -24,7 +24,7 @@ void FallingCeilingControl(short itemNumber)
AnimateItem(item);
if (item->status == ITEM_DESACTIVATED)
if (item->status == ITEM_DEACTIVATED)
{
RemoveActiveItem(itemNumber);
}

View file

@ -983,6 +983,17 @@ static void StartObject(ObjectInfo* obj)
obj->saveAnim = true;
obj->saveFlags = true;
}
for (int objectNumber = ID_AI_GUARD; objectNumber <= ID_AI_X2; objectNumber++)
{
obj = &Objects[objectNumber];
if (obj->loaded)
{
obj->drawRoutine = nullptr;
obj->collision = AIPickupCollision;
obj->hitPoints = 0;
}
}
}
static void StartTrap(ObjectInfo* obj)

View file

@ -1535,7 +1535,7 @@ void GameScriptItem::EnableItem()
{
if (Objects[NativeItem->objectNumber].intelligent)
{
if (NativeItem->status == ITEM_DESACTIVATED)
if (NativeItem->status == ITEM_DEACTIVATED)
{
NativeItem->touchBits = 0;
NativeItem->status = ITEM_ACTIVE;
@ -1570,7 +1570,7 @@ void GameScriptItem::DisableItem()
if (NativeItem->status == ITEM_ACTIVE)
{
NativeItem->touchBits = 0;
NativeItem->status = ITEM_DESACTIVATED;
NativeItem->status = ITEM_DEACTIVATED;
RemoveActiveItem(NativeItemNumber);
DisableBaddieAI(NativeItemNumber);
}
@ -1579,7 +1579,7 @@ void GameScriptItem::DisableItem()
{
NativeItem->touchBits = 0;
RemoveActiveItem(NativeItemNumber);
NativeItem->status = ITEM_DESACTIVATED;
NativeItem->status = ITEM_DEACTIVATED;
}
}
}

View file

@ -149,6 +149,7 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts"</Command>
<ClInclude Include="Libs\zlib\zlib.h" />
<ClInclude Include="Objects\Effects\tr4_bubbles.h" />
<ClInclude Include="Objects\Effects\tr5_electricity.h" />
<ClInclude Include="Objects\TR4\Entity\tr4_baboon.h" />
<ClInclude Include="Objects\TR4\Object\tr4_laradouble.h" />
<ClInclude Include="Objects\TR4\Object\tr4_sarcophagus.h" />
<ClInclude Include="Objects\TR4\Object\tr4_scales.h" />
@ -389,6 +390,7 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts"</Command>
<ClCompile Include="Game\misc.cpp" />
<ClCompile Include="Game\trmath.cpp" />
<ClCompile Include="Objects\Effects\tr5_electricity.cpp" />
<ClCompile Include="Objects\TR4\Entity\tr4_baboon.cpp" />
<ClCompile Include="Objects\TR4\Object\tr4_laradouble.cpp" />
<ClCompile Include="Objects\TR4\Object\tr4_sarcophagus.cpp" />
<ClCompile Include="Objects\TR4\Object\tr4_scales.cpp" />

View file

@ -774,6 +774,9 @@
<ClInclude Include="Objects\TR5\Object\tr5_rollingball.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="Objects\TR4\Entity\tr4_baboon.h">
<Filter>File di intestazione</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Game\box.cpp">
@ -1415,6 +1418,9 @@
<ClCompile Include="Objects\TR5\Object\tr5_rollingball.cpp">
<Filter>File di origine</Filter>
</ClCompile>
<ClCompile Include="Objects\TR4\Entity\tr4_baboon.cpp">
<Filter>File di origine</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />