Implement basic flash, fix func names

This commit is contained in:
Lwmte 2021-09-15 14:24:03 +03:00
parent 194fb5516e
commit 1284d34f68
10 changed files with 37 additions and 16 deletions

View file

@ -33,17 +33,16 @@ namespace Environment
// Clear flash vars
FlashProgress = 0.0f;
FlashColorBase = Vector4::Zero;
FlashColorBase = Vector3::Zero;
}
void EnvironmentController::Flash(int r, int g, int b, float speed)
{
FlashProgress = 1.0f;
FlashSpeed = std::clamp(speed, 0.005f, 1.0f);
FlashColorBase = Vector4(std::clamp(r, 0, UCHAR_MAX) / (float)UCHAR_MAX,
FlashColorBase = Vector3(std::clamp(r, 0, UCHAR_MAX) / (float)UCHAR_MAX,
std::clamp(g, 0, UCHAR_MAX) / (float)UCHAR_MAX,
std::clamp(b, 0, UCHAR_MAX) / (float)UCHAR_MAX,
1.0f);
std::clamp(b, 0, UCHAR_MAX) / (float)UCHAR_MAX);
}
void EnvironmentController::UpdateSky(GameScriptLevel* level)
@ -163,5 +162,8 @@ namespace Environment
if (FlashProgress < 0.0f)
FlashProgress = 0.0f;
}
if (FlashProgress == 0.0f)
FlashColorBase = Vector3::Zero;
}
}}}

View file

@ -10,7 +10,7 @@ namespace Environment
{
public:
Vector3 Wind() { return Vector3(WindFinalX / 2.0f, 0, WindFinalZ / 2.0f); }
Vector4 FlashColor() { return FlashColorBase * sin(FlashProgress * PI / 2.0f); }
Vector3 FlashColor() { return FlashColorBase * sin(FlashProgress * PI / 2.0f); }
Vector4 SkyColor() { return SkyCurrentColor; }
short SkyLayer1Position() { return SkyPosition1; }
short SkyLayer2Position() { return SkyPosition2; }
@ -33,7 +33,7 @@ namespace Environment
int WindCurrent;
// Flash fader
Vector4 FlashColorBase = {};
Vector3 FlashColorBase = Vector3::Zero;
float FlashSpeed = 1.0f;
float FlashProgress = 0.0f;

View file

@ -20,12 +20,14 @@
#include "lara_fire.h"
#include "effects\effects.h"
#include "effects\tomb4fx.h"
#include "effects\weather.h"
#include "effects\footprint.h"
#include "effects\groundfx.h"
#include "effects\debris.h"
using std::function;
using namespace TEN::Effects::Footprints;
using namespace TEN::Effects::Environment;
short FXType;
int FlipEffect;
@ -52,7 +54,7 @@ function<EffectFunction> effect_routines[59] =
ShootLeftGun, //17
PushLoop, //18
PushEnd, //19
VoidEffect, //20
FlashOrange, //20
InvisibilityOn, //21
InvisibilityOff, //22
VoidEffect, //23
@ -81,6 +83,12 @@ function<EffectFunction> effect_routines[59] =
KillActiveBaddies //46
};
void FlashOrange(ITEM_INFO* item)
{
FlipEffect = -1;
Weather.Flash(255, 128, 0, 0.03f);
}
void MeshSwapToPour(ITEM_INFO* item)
{
Lara.meshPtrs[LM_LHAND] = Objects[item->itemFlags[2]].meshIndex + LM_LHAND;
@ -363,7 +371,7 @@ void PoseidonSFX(ITEM_INFO* item)
void RubbleFX(ITEM_INFO* item)
{
const auto itemList = FindItem(ID_EARTHQUAKE);
const auto itemList = FindAllItems(ID_EARTHQUAKE);
if (itemList.size() > 0)
{

View file

@ -37,3 +37,4 @@ void DrawRightPistol(ITEM_INFO* item);
void DrawLeftPistol(ITEM_INFO* item);
void MeshSwapToPour(ITEM_INFO* item);
void MeshSwapFromPour(ITEM_INFO* item);
void FlashOrange(ITEM_INFO* item);

View file

@ -488,7 +488,7 @@ int GlobalItemReplace(short search, GAME_OBJECT_ID replace)
return changed;
}
std::vector<int> FindItem(short objectNumber)
std::vector<int> FindAllItems(short objectNumber)
{
std::vector<int> itemList;
@ -501,7 +501,7 @@ std::vector<int> FindItem(short objectNumber)
return itemList;
}
ITEM_INFO* find_a_fucking_item(int object_number)
ITEM_INFO* FindItem(int object_number)
{
ITEM_INFO* item;

View file

@ -60,5 +60,5 @@ void KillEffect(short fxNumber);
void InitialiseItem(short itemNum);
void InitialiseItemArray(int numItems);
void KillItem(short itemNum);
std::vector<int> FindItem(short objectNumber);
ITEM_INFO* find_a_fucking_item(int object_number);
std::vector<int> FindAllItems(short objectNumber);
ITEM_INFO* FindItem(int object_number);

View file

@ -477,7 +477,7 @@ void InitialiseWreckingBall(short itemNumber)
short room;
item = &g_Level.Items[itemNumber];
item->itemFlags[3] = FindItem(ID_ANIMATING16)[0];
item->itemFlags[3] = FindAllItems(ID_ANIMATING16)[0];
room = item->roomNumber;
item->pos.yPos = GetCeiling(GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &room), item->pos.xPos, item->pos.yPos, item->pos.zPos) + 1644;
GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &room);

View file

@ -135,7 +135,7 @@ void ObeliskControl(short itemNumber)
TriggerExplosionSparks(pos.xPos, pos.yPos, pos.zPos, 3, -1, 0, item2->roomNumber);
item->itemFlags[2] = NO_ITEM;
item2 = find_a_fucking_item(ID_PUZZLE_ITEM1_COMBO1);
item2 = FindItem(ID_PUZZLE_ITEM1_COMBO1);
item2->status = ITEM_NOT_ACTIVE;
SoundEffect(SFX_TR4_EXPLOSION1, &item2->pos, 0);

View file

@ -17,7 +17,7 @@ void InitialiseTeleporter(short itemNumber)
if (item->triggerFlags == 512)
{
ITEM_INFO* puzzleHoleItem = find_a_fucking_item(ID_PUZZLE_HOLE2);
ITEM_INFO* puzzleHoleItem = FindItem(ID_PUZZLE_HOLE2);
v4 = (signed int)((unsigned __int64)(391146079i64 * ((char*)v3 - (char*)items)) >> 32) >> 9;
result = (unsigned int)((unsigned __int64)(391146079i64 * ((char*)v3 - (char*)items)) >> 32) >> 31;
item->itemFlags[1] = result + v4;

View file

@ -4,6 +4,9 @@
#include "spotcam.h"
#include "lara.h"
#include "control.h"
#include "effects\weather.h"
using namespace TEN::Effects::Environment;
TEN::Renderer::RendererHUDBar* g_HealthBar;
TEN::Renderer::RendererHUDBar* g_AirBar;
@ -126,6 +129,13 @@ namespace TEN::Renderer {
void Renderer11::drawOverlays(RenderView& view)
{
auto flashColor = Weather.FlashColor();
if (flashColor != Vector3::Zero)
{
m_context->OMSetBlendState(m_states->Additive(), NULL, 0xFFFFFFFF);
drawFullScreenQuad(m_whiteTexture.ShaderResourceView.Get(), flashColor, false);
}
if (CurrentLevel == 0)
return;