2020-05-27 09:21:20 +02:00
|
|
|
#include "framework.h"
|
2020-01-05 18:48:16 +01:00
|
|
|
#include "footprint.h"
|
|
|
|
#include "control.h"
|
|
|
|
#include "lara.h"
|
2020-04-20 07:14:54 +02:00
|
|
|
#include "draw.h"
|
2020-01-07 17:07:45 +01:00
|
|
|
#include "groundfx.h"
|
2020-05-27 09:21:20 +02:00
|
|
|
#include "level.h"
|
2020-05-28 22:17:55 +02:00
|
|
|
#include "items.h"
|
|
|
|
namespace T5M {
|
|
|
|
namespace Effects {
|
|
|
|
namespace Footprints {
|
2020-06-20 23:39:08 +02:00
|
|
|
using std::deque;
|
2020-05-28 22:17:55 +02:00
|
|
|
std::deque<FOOTPRINT_STRUCT> footprints = deque<FOOTPRINT_STRUCT>();
|
2020-01-05 18:48:16 +01:00
|
|
|
|
2020-05-28 22:17:55 +02:00
|
|
|
bool CheckFootOnFloor(ITEM_INFO& const item, int mesh, PHD_3DPOS& outFootprintPosition) {
|
|
|
|
int x = item.pos.xPos;
|
|
|
|
int y = item.pos.yPos;
|
|
|
|
int z = item.pos.zPos;
|
|
|
|
short roomNumber = item.roomNumber;
|
|
|
|
FLOOR_INFO* floor = GetFloor(x, y, z, &roomNumber);
|
|
|
|
if (!(floor->fx == GroundMaterial::Ice || floor->fx == GroundMaterial::Sand || floor->fx == GroundMaterial::Mud)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
int height = GetFloorHeight(floor, x, y, z);
|
|
|
|
int diff;
|
|
|
|
PHD_VECTOR pos;
|
|
|
|
pos.x = pos.z = 0;
|
|
|
|
pos.y = FOOT_HEIGHT_OFFSET;
|
|
|
|
GetLaraJointPosition(&pos, mesh);
|
|
|
|
outFootprintPosition.xPos = pos.x;
|
|
|
|
outFootprintPosition.zPos = pos.z;
|
|
|
|
outFootprintPosition.yPos = height - 1;
|
|
|
|
outFootprintPosition.yRot = item.pos.yRot;
|
|
|
|
return abs(pos.y - height) < 32;
|
|
|
|
}
|
|
|
|
void updateFootprints()
|
|
|
|
{
|
|
|
|
if (footprints.size() == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
int numInvalidFootprints = 0;
|
|
|
|
for (auto i = footprints.begin(); i != footprints.end(); i++) {
|
|
|
|
FOOTPRINT_STRUCT& footprint = *i;
|
|
|
|
footprint.life--;
|
|
|
|
if (footprint.life <= 0) {
|
|
|
|
numInvalidFootprints++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (footprint.life > footprint.lifeStartFading) {
|
|
|
|
footprint.opacity = footprint.startOpacity;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
float opacity = lerp(0, footprint.startOpacity, fmax(0, fmin(1, footprint.life / (float)footprint.lifeStartFading)));
|
|
|
|
footprint.opacity = opacity;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (int i = 0; i < numInvalidFootprints; i++) {
|
|
|
|
footprints.pop_back();
|
|
|
|
}
|
|
|
|
}
|
2020-04-22 14:12:10 +02:00
|
|
|
|
2020-01-05 18:48:16 +01:00
|
|
|
}
|
2020-01-06 19:44:18 +01:00
|
|
|
}
|
2020-05-28 22:17:55 +02:00
|
|
|
}
|