#include "framework.h" #include "control/control.h" #include "lara.h" #include "animation.h" #include "effects/groundfx.h" #include "effects/footprint.h" #include "level.h" #include "items.h" namespace TEN { namespace Effects { namespace Footprints { std::deque footprints = std::deque(); bool CheckFootOnFloor(ITEM_INFO const & item, int mesh, Vector3& 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->Material == GroundMaterial::Sand || floor->Material == GroundMaterial::Snow || floor->Material == GroundMaterial::Gravel || floor->Material == GroundMaterial::Mud)) { return false; } PHD_VECTOR pos; pos.x = pos.z = 0; pos.y = FOOT_HEIGHT_OFFSET; GetLaraJointPosition(&pos, mesh); int height = GetFloorHeight(floor, pos.x, pos.y - STEP_SIZE, pos.z); outFootprintPosition.x = pos.x; outFootprintPosition.y = height - 8; outFootprintPosition.z = pos.z; 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(); } } } } }