2020-05-27 09:21:20 +02:00
|
|
|
#include "framework.h"
|
2021-08-26 16:24:43 +03:00
|
|
|
#include "flipeffect.h"
|
2019-12-01 08:13:19 +01:00
|
|
|
#include "Lara.h"
|
2021-09-19 23:41:26 +03:00
|
|
|
#include "control/lot.h"
|
2021-09-08 18:19:06 +03:00
|
|
|
#include "effects\hair.h"
|
2021-09-16 05:06:03 +03:00
|
|
|
#include "animation.h"
|
2019-12-01 08:13:19 +01:00
|
|
|
#include "sphere.h"
|
2020-05-27 09:21:20 +02:00
|
|
|
#include "level.h"
|
|
|
|
#include "setup.h"
|
2020-04-12 06:50:43 +02:00
|
|
|
#include "camera.h"
|
2021-09-13 02:07:42 +03:00
|
|
|
#include "collide.h"
|
2020-04-24 19:15:05 +02:00
|
|
|
#include "savegame.h"
|
2021-09-08 18:19:06 +03:00
|
|
|
#include "Sound\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"
|
2021-09-11 10:13:04 +03: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"
|
2021-09-08 18:07:48 +03:00
|
|
|
#include "effects\effects.h"
|
|
|
|
#include "effects\tomb4fx.h"
|
2021-09-15 14:24:03 +03:00
|
|
|
#include "effects\weather.h"
|
2021-09-08 18:07:48 +03:00
|
|
|
#include "effects\footprint.h"
|
2021-09-13 02:07:42 +03:00
|
|
|
#include "effects\groundfx.h"
|
2021-09-08 18:07:48 +03:00
|
|
|
#include "effects\debris.h"
|
2021-09-24 07:53:42 +02:00
|
|
|
#include "item.h"
|
2021-09-25 11:27:47 +02:00
|
|
|
|
2020-06-20 23:39:08 +02:00
|
|
|
using std::function;
|
2021-08-30 18:03:21 +03:00
|
|
|
using namespace TEN::Effects::Footprints;
|
2021-09-15 14:24:03 +03:00
|
|
|
using namespace TEN::Effects::Environment;
|
2020-05-28 22:17:55 +02:00
|
|
|
|
2021-09-13 02:07:42 +03:00
|
|
|
short FXType;
|
2021-09-15 11:38:55 +03:00
|
|
|
int FlipEffect;
|
2021-09-13 02:07:42 +03:00
|
|
|
|
2021-09-15 14:45:20 +03:00
|
|
|
function<EffectFunction> effect_routines[NUM_FLIPEFFECTS] =
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
2021-08-26 16:11:04 +03:00
|
|
|
Turn180, //0
|
|
|
|
FloorShake, //1
|
2021-06-05 22:15:25 -05:00
|
|
|
PoseidonSFX, //2
|
|
|
|
LaraBubbles, //3
|
2021-08-26 16:11:04 +03:00
|
|
|
FinishLevel, //4
|
2021-06-05 22:15:25 -05:00
|
|
|
ActivateCamera, //5
|
|
|
|
ActivateKey, //6
|
|
|
|
RubbleFX, //7
|
|
|
|
SwapCrowbar, //8
|
2021-08-26 16:11:04 +03:00
|
|
|
Pickup, //9
|
|
|
|
PlaySoundEffect, //10
|
2021-06-05 22:15:25 -05:00
|
|
|
ExplosionFX, //11
|
2021-08-26 16:11:04 +03:00
|
|
|
LaraHandsFree, //12
|
|
|
|
Puzzle, //13
|
|
|
|
DrawRightPistol, //14
|
|
|
|
DrawLeftPistol, //15
|
|
|
|
ShootRightGun, //16
|
|
|
|
ShootLeftGun, //17
|
|
|
|
PushLoop, //18
|
|
|
|
PushEnd, //19
|
2021-09-15 14:24:03 +03:00
|
|
|
FlashOrange, //20
|
2021-08-26 16:11:04 +03:00
|
|
|
InvisibilityOn, //21
|
|
|
|
InvisibilityOff, //22
|
|
|
|
VoidEffect, //23
|
|
|
|
VoidEffect, //24
|
|
|
|
VoidEffect, //25
|
|
|
|
ResetHair, //26
|
|
|
|
VoidEffect, //27
|
2021-06-05 22:15:25 -05:00
|
|
|
SetFog, //28
|
2021-08-26 16:11:04 +03:00
|
|
|
VoidEffect, //29
|
2021-06-05 22:15:25 -05:00
|
|
|
LaraLocation, //30
|
|
|
|
ClearSpidersPatch, //31
|
|
|
|
AddFootprint, //32
|
2021-08-26 16:11:04 +03:00
|
|
|
VoidEffect, //33
|
|
|
|
VoidEffect, //34
|
|
|
|
VoidEffect, //35
|
|
|
|
VoidEffect, //36
|
|
|
|
VoidEffect, //37
|
|
|
|
VoidEffect, //38
|
|
|
|
VoidEffect, //39
|
|
|
|
VoidEffect, //40
|
|
|
|
VoidEffect, //41
|
|
|
|
VoidEffect, //42
|
2021-06-05 22:15:25 -05:00
|
|
|
MeshSwapToPour, //43
|
|
|
|
MeshSwapFromPour, //44
|
|
|
|
LaraLocationPad, //45
|
|
|
|
KillActiveBaddies //46
|
2019-12-22 00:20:10 +01:00
|
|
|
};
|
|
|
|
|
2021-09-15 14:24:03 +03:00
|
|
|
void FlashOrange(ITEM_INFO* item)
|
|
|
|
{
|
|
|
|
FlipEffect = -1;
|
|
|
|
Weather.Flash(255, 128, 0, 0.03f);
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2021-08-26 16:11:04 +03:00
|
|
|
void Pickup(ITEM_INFO* item)
|
2020-06-15 00:32:58 -05:00
|
|
|
{
|
|
|
|
do_pickup();
|
|
|
|
}
|
|
|
|
|
2021-08-26 16:11:04 +03:00
|
|
|
void Puzzle(ITEM_INFO* item)
|
2020-07-23 15:29:02 -05:00
|
|
|
{
|
|
|
|
do_puzzle();
|
|
|
|
}
|
|
|
|
|
2020-05-27 19:07:34 +02:00
|
|
|
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
|
|
|
|
2021-09-13 02:07:42 +03:00
|
|
|
PHD_VECTOR position;
|
|
|
|
if (FXType == SFX_LANDONLY)
|
|
|
|
GetLaraJointPosition(&position, LM_LFOOT);
|
|
|
|
else
|
|
|
|
GetLaraJointPosition(&position, LM_RFOOT);
|
|
|
|
|
|
|
|
auto fx = sound_effects::SFX_TR4_LARA_FEET;
|
|
|
|
auto floor = GetCollisionResult(position.x, position.y, position.z, item->roomNumber).BottomBlock;
|
|
|
|
|
|
|
|
switch (floor->Material)
|
|
|
|
{
|
|
|
|
case GroundMaterial::Concrete:
|
2021-09-20 21:47:42 +03:00
|
|
|
fx = sound_effects::SFX_TR4_LARA_FEET;
|
2021-09-13 02:07:42 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GroundMaterial::Grass:
|
|
|
|
fx = sound_effects::SFX_TR4_FOOTSTEPS_SAND__AND__GRASS;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GroundMaterial::Gravel:
|
|
|
|
fx = sound_effects::SFX_TR4_FOOTSTEPS_GRAVEL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GroundMaterial::Ice:
|
|
|
|
fx = sound_effects::SFX_TR3_FOOTSTEPS_ICE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GroundMaterial::Marble:
|
|
|
|
fx = sound_effects::SFX_TR4_FOOTSTEPS_MARBLE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GroundMaterial::Metal:
|
|
|
|
fx = sound_effects::SFX_TR4_FOOTSTEPS_METAL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GroundMaterial::Mud:
|
|
|
|
fx = sound_effects::SFX_TR4_FOOTSTEPS_MUD;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GroundMaterial::OldMetal:
|
|
|
|
fx = sound_effects::SFX_TR4_FOOTSTEPS_METAL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GroundMaterial::OldWood:
|
|
|
|
fx = sound_effects::SFX_TR4_FOOTSTEPS_WOOD;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GroundMaterial::Sand:
|
|
|
|
fx = sound_effects::SFX_TR4_FOOTSTEPS_SAND__AND__GRASS;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GroundMaterial::Snow:
|
|
|
|
fx = sound_effects::SFX_TR3_FOOTSTEPS_SNOW;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GroundMaterial::Stone:
|
2021-09-20 21:47:42 +03:00
|
|
|
fx = sound_effects::SFX_TR4_LARA_FEET;
|
2021-09-13 02:07:42 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GroundMaterial::Water:
|
|
|
|
fx = sound_effects::SFX_TR4_LARA_WET_FEET;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GroundMaterial::Wood:
|
|
|
|
fx = sound_effects::SFX_TR4_FOOTSTEPS_WOOD;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-09-20 21:47:42 +03:00
|
|
|
// HACK: must be here until reference wad2 is revised
|
|
|
|
if (fx != sound_effects::SFX_TR4_LARA_FEET)
|
|
|
|
SoundEffect(fx, &item->pos, 0);
|
2021-09-13 02:07:42 +03:00
|
|
|
|
2020-05-27 19:07:34 +02:00
|
|
|
FOOTPRINT_STRUCT footprint;
|
2021-09-13 02:31:49 +03:00
|
|
|
|
|
|
|
auto plane = floor->FloorCollision.Planes[floor->SectorPlane(position.x, position.z)];
|
|
|
|
|
|
|
|
auto x = Vector2(plane.x * WALL_SIZE, WALL_SIZE);
|
|
|
|
auto z = Vector2(WALL_SIZE, plane.y * WALL_SIZE);
|
|
|
|
|
|
|
|
auto xRot = FROM_RAD(atan2(0 - x.y, 0 - x.x));
|
|
|
|
auto yRot = item->pos.yRot;
|
|
|
|
auto zRot = FROM_RAD(atan2(0 - z.y, 0 - z.x));
|
|
|
|
|
|
|
|
auto footprintPosition = PHD_3DPOS(position.x, position.y, position.z, xRot, yRot, zRot);
|
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;
|
2021-09-14 01:22:08 +03:00
|
|
|
footprint.foot = 0;
|
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;
|
2021-09-14 01:22:08 +03:00
|
|
|
footprint.foot = 1;
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-26 16:11:04 +03:00
|
|
|
void ResetHair(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
|
|
|
InitialiseHair();
|
|
|
|
}
|
|
|
|
|
2021-08-26 16:11:04 +03:00
|
|
|
void InvisibilityOff(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
|
|
|
item->status = ITEM_ACTIVE;
|
|
|
|
}
|
|
|
|
|
2021-08-26 16:11:04 +03:00
|
|
|
void InvisibilityOn(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2021-08-26 16:11:04 +03:00
|
|
|
void DrawLeftPistol(ITEM_INFO* item)
|
2020-08-02 17:56:19 -05:00
|
|
|
{
|
|
|
|
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));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-26 16:11:04 +03:00
|
|
|
void DrawRightPistol(ITEM_INFO* item)
|
2020-08-02 17:56:19 -05:00
|
|
|
{
|
|
|
|
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-08-26 16:11:04 +03:00
|
|
|
void ShootLeftGun(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
|
|
|
Lara.leftArm.flash_gun = 3;
|
|
|
|
}
|
|
|
|
|
2021-08-26 16:11:04 +03:00
|
|
|
void ShootRightGun(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
|
|
|
Lara.rightArm.flash_gun = 3;
|
|
|
|
}
|
|
|
|
|
2021-08-26 16:11:04 +03:00
|
|
|
void LaraHandsFree(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-09-15 14:24:03 +03:00
|
|
|
const auto itemList = FindAllItems(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-08-26 16:11:04 +03:00
|
|
|
void PlaySoundEffect(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
|
|
|
SoundEffect(TriggerTimer, NULL, 0);
|
|
|
|
FlipEffect = -1;
|
|
|
|
}
|
|
|
|
|
2021-08-26 16:11:04 +03:00
|
|
|
void FloorShake(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-08-26 16:11:04 +03:00
|
|
|
void Turn180(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
|
|
|
item->pos.yRot -= ANGLE(180);
|
|
|
|
item->pos.xRot = -item->pos.xRot;
|
|
|
|
}
|
|
|
|
|
2021-08-26 16:11:04 +03:00
|
|
|
void FinishLevel(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
|
|
|
LevelComplete = CurrentLevel + 1;
|
|
|
|
}
|
|
|
|
|
2021-08-26 16:11:04 +03:00
|
|
|
void VoidEffect(ITEM_INFO* item)
|
2019-12-22 00:20:10 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2021-09-15 17:49:01 +03:00
|
|
|
|
|
|
|
void DoFlipEffect(int number, ITEM_INFO* item)
|
|
|
|
{
|
|
|
|
if (number != -1 && number < NUM_FLIPEFFECTS && effect_routines[number] != nullptr)
|
|
|
|
effect_routines[number](item);
|
|
|
|
}
|