2020-05-27 09:21:20 +02:00
|
|
|
#include "framework.h"
|
|
|
|
#include "effect.h"
|
2020-06-04 11:00:08 +02:00
|
|
|
#include "effect2.h"
|
2019-12-01 08:13:19 +01:00
|
|
|
#include "Lara.h"
|
2019-12-22 00:20:10 +01:00
|
|
|
#include "lot.h"
|
|
|
|
#include "tomb4fx.h"
|
|
|
|
#include "hair.h"
|
2019-12-01 08:13:19 +01:00
|
|
|
#include "draw.h"
|
|
|
|
#include "sphere.h"
|
2020-01-05 18:48:16 +01:00
|
|
|
#include "footprint.h"
|
2020-05-27 09:21:20 +02:00
|
|
|
#include "level.h"
|
2020-03-27 07:17:05 +01:00
|
|
|
#include "debris.h"
|
2020-05-27 09:21:20 +02:00
|
|
|
#include "setup.h"
|
2020-04-12 06:50:43 +02:00
|
|
|
#include "camera.h"
|
2020-04-24 19:15:05 +02:00
|
|
|
#include "savegame.h"
|
|
|
|
#include "sound.h"
|
2020-05-27 19:07:34 +02:00
|
|
|
#include "tr5_rats_emitter.h"
|
|
|
|
#include "tr5_bats_emitter.h"
|
|
|
|
#include "tr5_spider_emitter.h"
|
2020-12-30 02:12:14 +01:00
|
|
|
#include "tr5_pushableblock.h"
|
2020-06-15 00:32:58 -05:00
|
|
|
#include "pickup.h"
|
2020-08-09 01:24:06 -05:00
|
|
|
#include "puzzles_keys.h"
|
2020-08-09 22:09:14 -03:00
|
|
|
#include "lara_fire.h"
|
2020-08-02 17:56:19 -05:00
|
|
|
|
2020-06-20 23:39:08 +02:00
|
|
|
using std::function;
|
2020-06-10 21:38:25 +02:00
|
|
|
constexpr auto ITEM_RADIUS_YMAX = SECTOR(3);
|
2020-05-28 22:17:55 +02:00
|
|
|
using namespace T5M::Effects::Footprints;
|
|
|
|
|
2020-01-08 13:25:42 +01:00
|
|
|
short FXType;
|
2020-06-21 14:27:12 +02:00
|
|
|
FX_INFO* EffectList;
|
2020-01-08 13:25:42 +01:00
|
|
|
|
2020-06-04 11:00:08 +02:00
|
|
|
function<EffectFunction> effect_routines[59] =
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
2021-06-05 22:15:25 -05:00
|
|
|
turn180_effect, //0
|
|
|
|
floor_shake_effect, //1
|
|
|
|
PoseidonSFX, //2
|
|
|
|
LaraBubbles, //3
|
|
|
|
finish_level_effect, //4
|
|
|
|
ActivateCamera, //5
|
|
|
|
ActivateKey, //6
|
|
|
|
RubbleFX, //7
|
|
|
|
SwapCrowbar, //8
|
|
|
|
pickup, //9
|
|
|
|
SoundFlipEffect, //10
|
|
|
|
ExplosionFX, //11
|
|
|
|
lara_hands_free, //12
|
|
|
|
puzzle, //13
|
|
|
|
draw_right_pistol, //14
|
|
|
|
draw_left_pistol, //15
|
|
|
|
shoot_right_gun, //16
|
|
|
|
shoot_left_gun, //17
|
|
|
|
pushLoop, //18
|
|
|
|
pushEnd, //19
|
|
|
|
void_effect, //20
|
|
|
|
invisibility_on, //21
|
|
|
|
invisibility_off, //22
|
|
|
|
void_effect, //23
|
|
|
|
void_effect, //24
|
|
|
|
void_effect, //25
|
|
|
|
reset_hair, //26
|
|
|
|
void_effect, //27
|
|
|
|
SetFog, //28
|
|
|
|
void_effect, //29
|
|
|
|
LaraLocation, //30
|
|
|
|
ClearSpidersPatch, //31
|
|
|
|
AddFootprint, //32
|
|
|
|
void_effect, //33
|
|
|
|
void_effect, //34
|
|
|
|
void_effect, //35
|
|
|
|
void_effect, //36
|
|
|
|
void_effect, //37
|
|
|
|
void_effect, //38
|
|
|
|
void_effect, //39
|
|
|
|
void_effect, //40
|
|
|
|
void_effect, //41
|
|
|
|
void_effect, //42
|
|
|
|
MeshSwapToPour, //43
|
|
|
|
MeshSwapFromPour, //44
|
|
|
|
LaraLocationPad, //45
|
|
|
|
KillActiveBaddies //46
|
2019-12-22 00:20:10 +01:00
|
|
|
};
|
|
|
|
|
2021-06-05 22:15:25 -05:00
|
|
|
void MeshSwapToPour(ITEM_INFO* item)
|
|
|
|
{
|
|
|
|
Lara.meshPtrs[LM_LHAND] = Objects[item->itemFlags[2]].meshIndex + LM_LHAND;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MeshSwapFromPour(ITEM_INFO* item)
|
|
|
|
{
|
|
|
|
Lara.meshPtrs[LM_LHAND] = Objects[ID_LARA_SKIN].meshIndex + LM_LHAND;
|
|
|
|
}
|
|
|
|
|
2020-06-15 00:32:58 -05:00
|
|
|
void pickup(ITEM_INFO* item)
|
|
|
|
{
|
|
|
|
do_pickup();
|
|
|
|
}
|
|
|
|
|
2020-07-23 15:29:02 -05:00
|
|
|
void puzzle(ITEM_INFO* item)
|
|
|
|
{
|
|
|
|
do_puzzle();
|
|
|
|
}
|
|
|
|
|
2020-05-27 19:07:34 +02:00
|
|
|
// TODO: here are sound for lara footstep too !
|
|
|
|
void AddFootprint(ITEM_INFO* item)
|
|
|
|
{
|
|
|
|
if (item != LaraItem)
|
2020-01-05 18:48:16 +01:00
|
|
|
return;
|
2020-05-27 19:07:34 +02:00
|
|
|
|
|
|
|
FOOTPRINT_STRUCT footprint;
|
2020-01-05 18:48:16 +01:00
|
|
|
PHD_3DPOS footprintPosition;
|
2020-05-27 19:07:34 +02:00
|
|
|
|
|
|
|
if (CheckFootOnFloor(*item, LM_LFOOT, footprintPosition))
|
|
|
|
{
|
|
|
|
if (footprints.size() >= MAX_FOOTPRINTS)
|
2020-01-05 18:48:16 +01:00
|
|
|
footprints.pop_back();
|
2020-05-27 19:07:34 +02:00
|
|
|
|
|
|
|
memset(&footprint, 0, sizeof(FOOTPRINT_STRUCT));
|
2020-01-05 18:48:16 +01:00
|
|
|
footprint.pos = footprintPosition;
|
2020-01-07 16:19:54 +01:00
|
|
|
footprint.lifeStartFading = 30 * 10;
|
2020-01-07 17:07:45 +01:00
|
|
|
footprint.startOpacity = 64;
|
2020-01-05 18:48:16 +01:00
|
|
|
footprint.life = 30 * 20;
|
|
|
|
footprint.active = true;
|
|
|
|
footprints.push_front(footprint);
|
|
|
|
}
|
2020-05-27 19:07:34 +02:00
|
|
|
|
|
|
|
if (CheckFootOnFloor(*item, LM_RFOOT, footprintPosition))
|
|
|
|
{
|
|
|
|
if (footprints.size() >= MAX_FOOTPRINTS)
|
2020-01-05 18:48:16 +01:00
|
|
|
footprints.pop_back();
|
2020-05-27 19:07:34 +02:00
|
|
|
|
|
|
|
memset(&footprint, 0, sizeof(FOOTPRINT_STRUCT));
|
2020-01-05 18:48:16 +01:00
|
|
|
footprint.pos = footprintPosition;
|
2020-01-07 16:19:54 +01:00
|
|
|
footprint.lifeStartFading = 30*10;
|
2020-01-07 17:07:45 +01:00
|
|
|
footprint.startOpacity = 64;
|
2020-01-05 18:48:16 +01:00
|
|
|
footprint.life = 30 * 20;
|
|
|
|
footprint.active = true;
|
|
|
|
footprints.push_front(footprint);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-22 00:20:10 +01:00
|
|
|
void reset_hair(ITEM_INFO* item)
|
|
|
|
{
|
|
|
|
InitialiseHair();
|
|
|
|
}
|
|
|
|
|
|
|
|
void invisibility_off(ITEM_INFO* item)
|
|
|
|
{
|
|
|
|
item->status = ITEM_ACTIVE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void invisibility_on(ITEM_INFO* item)
|
|
|
|
{
|
|
|
|
item->status = ITEM_INVISIBLE;
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void SetFog(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
|
|
|
FlipEffect = -1;
|
|
|
|
}
|
|
|
|
|
2020-08-02 17:56:19 -05:00
|
|
|
void draw_left_pistol(ITEM_INFO* item)
|
|
|
|
{
|
|
|
|
if (Lara.meshPtrs[LM_LHAND] == Objects[ID_LARA_SKIN].meshIndex + LM_LHAND)
|
|
|
|
{
|
|
|
|
Lara.meshPtrs[LM_LHAND] = Objects[WeaponObjectMesh(WEAPON_PISTOLS)].meshIndex + LM_LHAND;
|
|
|
|
Lara.holsterInfo.leftHolster = HOLSTER_SLOT::Empty;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Lara.meshPtrs[LM_LHAND] = Objects[ID_LARA_SKIN].meshIndex + LM_LHAND;
|
|
|
|
Lara.holsterInfo.leftHolster = HolsterSlotForWeapon(static_cast<LARA_WEAPON_TYPE>(WEAPON_PISTOLS));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void draw_right_pistol(ITEM_INFO* item)
|
|
|
|
{
|
|
|
|
if (Lara.meshPtrs[LM_RHAND] == Objects[ID_LARA_SKIN].meshIndex + LM_RHAND)
|
|
|
|
{
|
|
|
|
Lara.meshPtrs[LM_RHAND] = Objects[WeaponObjectMesh(WEAPON_PISTOLS)].meshIndex + LM_RHAND;
|
|
|
|
Lara.holsterInfo.rightHolster = HOLSTER_SLOT::Empty;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Lara.meshPtrs[LM_RHAND] = Objects[ID_LARA_SKIN].meshIndex + LM_RHAND;
|
|
|
|
Lara.holsterInfo.rightHolster = HolsterSlotForWeapon(static_cast<LARA_WEAPON_TYPE>(WEAPON_PISTOLS));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void shoot_left_gun(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
|
|
|
Lara.leftArm.flash_gun = 3;
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void shoot_right_gun(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
|
|
|
Lara.rightArm.flash_gun = 3;
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void lara_hands_free(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
|
|
|
Lara.gunStatus = LG_NO_ARMS;
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void KillActiveBaddies(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
|
|
|
if (NextItemActive != NO_ITEM)
|
|
|
|
{
|
|
|
|
short itemNum = NextItemActive;
|
|
|
|
ITEM_INFO* targetItem;
|
|
|
|
|
|
|
|
do
|
2019-12-01 08:13:19 +01:00
|
|
|
{
|
2020-07-21 09:56:47 +02:00
|
|
|
targetItem = &g_Level.Items[itemNum];
|
2019-12-22 00:20:10 +01:00
|
|
|
|
|
|
|
if (Objects[targetItem->objectNumber].intelligent)
|
2019-12-01 08:13:19 +01:00
|
|
|
{
|
2019-12-22 00:20:10 +01:00
|
|
|
targetItem->status = ITEM_INVISIBLE;
|
|
|
|
|
|
|
|
if (*(int*)&item != 0xABCDEF)
|
2019-12-01 08:13:19 +01:00
|
|
|
{
|
2019-12-22 00:20:10 +01:00
|
|
|
RemoveActiveItem(itemNum);
|
|
|
|
DisableBaddieAI(itemNum);
|
|
|
|
targetItem->flags |= IFLAG_INVISIBLE;
|
2019-12-01 08:13:19 +01:00
|
|
|
}
|
|
|
|
}
|
2019-12-22 00:20:10 +01:00
|
|
|
|
|
|
|
itemNum = targetItem->nextActive;
|
|
|
|
} while (itemNum != NO_ITEM);
|
2019-12-01 08:13:19 +01:00
|
|
|
}
|
2019-12-22 00:20:10 +01:00
|
|
|
|
|
|
|
FlipEffect = -1;
|
2019-12-01 08:13:19 +01:00
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void LaraLocationPad(ITEM_INFO* item)
|
2019-12-01 08:13:19 +01:00
|
|
|
{
|
2019-12-22 00:20:10 +01:00
|
|
|
FlipEffect = -1;
|
|
|
|
|
|
|
|
Lara.location = TriggerTimer;
|
|
|
|
Lara.locationPad = TriggerTimer;
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void LaraLocation(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
|
|
|
FlipEffect = -1;
|
|
|
|
|
|
|
|
Lara.location = TriggerTimer;
|
|
|
|
if (Lara.highestLocation < TriggerTimer)
|
|
|
|
Lara.highestLocation = TriggerTimer;
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void ExplosionFX(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
2021-05-26 06:04:32 +02:00
|
|
|
SoundEffect(SFX_TR4_EXPLOSION1, NULL, 0);
|
2019-12-22 00:20:10 +01:00
|
|
|
Camera.bounce = -75;
|
|
|
|
FlipEffect = -1;
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void SwapCrowbar(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
2020-08-17 15:10:29 -05:00
|
|
|
if (Lara.meshPtrs[LM_RHAND] == Objects[ID_LARA_SKIN].meshIndex + LM_RHAND)
|
2020-07-03 07:05:33 +02:00
|
|
|
Lara.meshPtrs[LM_RHAND] = Objects[ID_LARA_CROWBAR_ANIM].meshIndex + LM_RHAND;
|
2019-12-22 00:20:10 +01:00
|
|
|
else
|
2020-08-17 15:10:29 -05:00
|
|
|
Lara.meshPtrs[LM_RHAND] = Objects[ID_LARA_SKIN].meshIndex + LM_RHAND;
|
2019-12-22 00:20:10 +01:00
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void ActivateKey(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
|
|
|
KeyTriggerActive = 1;
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void ActivateCamera(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
|
|
|
KeyTriggerActive = 2;
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void PoseidonSFX(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
2021-05-26 06:04:32 +02:00
|
|
|
SoundEffect(SFX_TR4_WATER_FLUSHES, NULL, 0);
|
2019-12-22 00:20:10 +01:00
|
|
|
FlipEffect = -1;
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void RubbleFX(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
2021-02-07 17:12:41 -03:00
|
|
|
const auto itemList = FindItem(ID_EARTHQUAKE);
|
2019-12-22 00:20:10 +01:00
|
|
|
|
2021-02-07 17:12:41 -03:00
|
|
|
if (itemList.size() > 0)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
2021-02-07 17:12:41 -03:00
|
|
|
ITEM_INFO* eq = &g_Level.Items[itemList[0]];
|
2019-12-22 00:20:10 +01:00
|
|
|
|
2021-02-07 17:12:41 -03:00
|
|
|
AddActiveItem(itemList[0]);
|
2019-12-22 00:20:10 +01:00
|
|
|
eq->status = ITEM_ACTIVE;
|
|
|
|
eq->flags |= IFLAG_ACTIVATION_MASK;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Camera.bounce = -150;
|
|
|
|
}
|
|
|
|
|
|
|
|
FlipEffect = -1;
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void SoundFlipEffect(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
|
|
|
SoundEffect(TriggerTimer, NULL, 0);
|
|
|
|
FlipEffect = -1;
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void floor_shake_effect(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
|
|
|
int x = abs(item->pos.xPos - Camera.pos.x);
|
|
|
|
int y = abs(item->pos.yPos - Camera.pos.y);
|
|
|
|
int z = abs(item->pos.zPos - Camera.pos.z);
|
|
|
|
|
|
|
|
if (x < SECTOR(16) && y < SECTOR(16) && z < SECTOR(16))
|
|
|
|
{
|
2021-06-29 05:00:15 +02:00
|
|
|
Camera.bounce = 66 * ((SQUARE(x) + SQUARE(y) + SQUARE(z)) / 256 - SQUARE(1024)) / SQUARE(1024);
|
2019-12-22 00:20:10 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void turn180_effect(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
|
|
|
item->pos.yRot -= ANGLE(180);
|
|
|
|
item->pos.xRot = -item->pos.xRot;
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void finish_level_effect(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
|
|
|
LevelComplete = CurrentLevel + 1;
|
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void void_effect(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-12-22 19:01:36 +01:00
|
|
|
void ControlWaterfallMist(short itemNumber) // ControlWaterfallMist
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
2020-07-21 09:56:47 +02:00
|
|
|
ITEM_INFO* item = &g_Level.Items[itemNumber];
|
2019-12-22 00:20:10 +01:00
|
|
|
int x, z;
|
|
|
|
|
2020-10-05 22:24:57 -03:00
|
|
|
x = item->pos.xPos - phd_sin(item->pos.yRot + ANGLE(180)) * 512 + phd_sin(item->pos.yRot - ANGLE(90)) * 256;
|
|
|
|
z = item->pos.zPos - phd_cos(item->pos.yRot + ANGLE(180)) * 512 + phd_cos(item->pos.yRot - ANGLE(90)) * 256;
|
2019-12-22 00:20:10 +01:00
|
|
|
|
|
|
|
TriggerWaterfallMist(x, item->pos.yPos, z, item->pos.yRot + ANGLE(180));
|
2021-05-26 06:04:32 +02:00
|
|
|
SoundEffect(SFX_TR4_WATERFALL_LOOP, &item->pos, 0);
|
2019-12-22 00:20:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
short DoBloodSplat(int x, int y, int z, short a4, short a5, short roomNumber)
|
|
|
|
{
|
2020-06-10 21:38:25 +02:00
|
|
|
short roomNum = roomNumber;
|
|
|
|
GetFloor(x, y, z, &roomNum);
|
2020-07-21 09:56:47 +02:00
|
|
|
if (g_Level.Rooms[roomNum].flags & ENV_FLAG_WATER)
|
2019-12-22 00:20:10 +01:00
|
|
|
TriggerUnderwaterBlood(x, y, z, a4);
|
|
|
|
else
|
2020-10-06 12:44:14 -05:00
|
|
|
TriggerBlood(x, y, z, a5 / 16, a4);
|
2019-12-22 00:20:10 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-06-10 21:38:25 +02:00
|
|
|
static bool ItemCollide(int value, int radius)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
2020-06-10 21:38:25 +02:00
|
|
|
return value >= -radius && value <= radius;
|
|
|
|
}
|
2019-12-22 00:20:10 +01:00
|
|
|
|
2020-06-10 21:38:25 +02:00
|
|
|
static bool ItemInRange(int x, int z, int radius)
|
|
|
|
{
|
|
|
|
return (SQUARE(x) + SQUARE(z)) <= SQUARE(radius);
|
|
|
|
}
|
2019-12-22 00:20:10 +01:00
|
|
|
|
2020-06-10 21:38:25 +02:00
|
|
|
bool ItemNearLara(PHD_3DPOS* pos, int radius)
|
|
|
|
{
|
2020-07-25 18:02:35 +02:00
|
|
|
BOUNDING_BOX* bounds;
|
2020-06-10 21:38:25 +02:00
|
|
|
GAME_VECTOR target;
|
|
|
|
target.x = pos->xPos - LaraItem->pos.xPos;
|
|
|
|
target.y = pos->yPos - LaraItem->pos.yPos;
|
|
|
|
target.z = pos->zPos - LaraItem->pos.zPos;
|
|
|
|
if (!ItemCollide(target.y, ITEM_RADIUS_YMAX))
|
|
|
|
return false;
|
|
|
|
if (!ItemCollide(target.x, radius) || !ItemCollide(target.z, radius))
|
|
|
|
return false;
|
|
|
|
if (!ItemInRange(target.x, target.z, radius))
|
|
|
|
return false;
|
|
|
|
|
2020-07-25 18:02:35 +02:00
|
|
|
bounds = GetBoundsAccurate(LaraItem);
|
|
|
|
if (target.y >= bounds->Y1 && target.y <= (bounds->Y2 + LARA_RAD))
|
2020-06-10 21:38:25 +02:00
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ItemNearTarget(PHD_3DPOS* src, ITEM_INFO* target, int radius)
|
|
|
|
{
|
2020-07-25 18:02:35 +02:00
|
|
|
BOUNDING_BOX* bounds;
|
2020-06-10 21:38:25 +02:00
|
|
|
PHD_VECTOR pos;
|
|
|
|
pos.x = src->xPos - target->pos.xPos;
|
|
|
|
pos.y = src->yPos - target->pos.yPos;
|
|
|
|
pos.z = src->zPos - target->pos.zPos;
|
|
|
|
if (!ItemCollide(pos.y, ITEM_RADIUS_YMAX))
|
|
|
|
return false;
|
|
|
|
if (!ItemCollide(pos.x, radius) || !ItemCollide(pos.z, radius))
|
|
|
|
return false;
|
|
|
|
if (!ItemInRange(pos.x, pos.z, radius))
|
|
|
|
return false;
|
|
|
|
|
2020-07-25 18:02:35 +02:00
|
|
|
bounds = GetBoundsAccurate(target);
|
|
|
|
if (pos.y >= bounds->Y1 && pos.y <= bounds->Y2)
|
2020-06-10 21:38:25 +02:00
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
2019-12-01 08:13:19 +01:00
|
|
|
}
|
2019-12-22 00:20:10 +01:00
|
|
|
|
|
|
|
void Richochet(PHD_3DPOS* pos)
|
|
|
|
{
|
|
|
|
short angle = mGetAngle(pos->zPos, pos->xPos, LaraItem->pos.zPos, LaraItem->pos.xPos);
|
2020-06-10 21:38:25 +02:00
|
|
|
GAME_VECTOR target;
|
|
|
|
target.x = pos->xPos;
|
|
|
|
target.y = pos->yPos;
|
|
|
|
target.z = pos->zPos;
|
|
|
|
TriggerRicochetSpark(&target, angle / 16, 3, 0);
|
2021-05-26 06:04:32 +02:00
|
|
|
SoundEffect(SFX_TR4_LARA_RICOCHET, pos, 0);
|
2019-12-22 00:20:10 +01:00
|
|
|
}
|
|
|
|
|
2020-04-15 18:30:34 +02:00
|
|
|
void DoLotsOfBlood(int x, int y, int z, int speed, short direction, short roomNumber, int count)
|
|
|
|
{
|
2020-06-10 21:38:25 +02:00
|
|
|
for (int i = 0; i < count; i++)
|
|
|
|
{
|
|
|
|
DoBloodSplat(x + 256 - (GetRandomControl() * 512 / 0x8000),
|
|
|
|
y + 256 - (GetRandomControl() * 512 / 0x8000),
|
|
|
|
z + 256 - (GetRandomControl() * 512 / 0x8000),
|
|
|
|
speed, direction, roomNumber);
|
|
|
|
}
|
2020-04-15 18:30:34 +02:00
|
|
|
}
|