Merge branch 'develop' into develop_mirrors

This commit is contained in:
Lwmte 2024-12-08 21:07:44 +01:00
commit 41b16e5696
8 changed files with 28 additions and 35 deletions

View file

@ -202,7 +202,7 @@ Timer = {
str:SetColor(pausedColor)
end
TEN.Strings.ShowString(str, 1)
TEN.Strings.ShowString(str, 1, false)
end
end

View file

@ -157,7 +157,7 @@ GameStatus GamePhase(bool insideMenu)
// Pre-loop script and event handling.
g_GameScript->OnLoop(DELTA_TIME, false); // TODO: Don't use DELTA_TIME constant with high framerate.
HandleAllGlobalEvents(EventType::Loop, (Activator)LaraItem->Index);
HandleAllGlobalEvents(EventType::Loop, (Activator)short(LaraItem->Index));
// Queued input actions are read again after OnLoop, so that remaining control loop can immediately register
// emulated keypresses from the script.
@ -244,7 +244,7 @@ GameStatus GamePhase(bool insideMenu)
// Call post-loop callbacks last time and end level.
g_GameScript->OnLoop(DELTA_TIME, true);
g_GameScript->OnEnd(gameStatus);
HandleAllGlobalEvents(EventType::End, (Activator)LaraItem->Index);
HandleAllGlobalEvents(EventType::End, (Activator)short(LaraItem->Index));
}
else
{
@ -299,7 +299,7 @@ GameStatus FreezePhase()
// Poll controls and call scripting events.
HandleControls(false);
g_GameScript->OnFreeze();
HandleAllGlobalEvents(EventType::Freeze, (Activator)LaraItem->Index);
HandleAllGlobalEvents(EventType::Freeze, (Activator)short(LaraItem->Index));
// Partially update scene if not using full freeze mode.
if (g_GameFlow->LastFreezeMode != FreezeMode::Full)
@ -600,7 +600,7 @@ void InitializeOrLoadGame(bool loadGame)
g_GameFlow->SelectedSaveGame = 0;
g_GameScript->OnLoad();
HandleAllGlobalEvents(EventType::Load, (Activator)LaraItem->Index);
HandleAllGlobalEvents(EventType::Load, (Activator)short(LaraItem->Index));
}
else
{
@ -624,7 +624,7 @@ void InitializeOrLoadGame(bool loadGame)
}
g_GameScript->OnStart();
HandleAllGlobalEvents(EventType::Start, (Activator)LaraItem->Index);
HandleAllGlobalEvents(EventType::Start, (Activator)short(LaraItem->Index));
}
}

View file

@ -841,7 +841,7 @@ void TestTriggers(ItemInfo* item, bool isHeavy, int heavyFlags)
short roomNumber = item->RoomNumber;
auto floor = GetFloor(item->Pose.Position.x, item->Pose.Position.y, item->Pose.Position.z, &roomNumber);
TestTriggers(item->Pose.Position.x, item->Pose.Position.y, item->Pose.Position.z, floor, item->Index, isHeavy, heavyFlags);
TestTriggers(item->Pose.Position.x, item->Pose.Position.y, item->Pose.Position.z, floor, (Activator)short(item->Index), isHeavy, heavyFlags);
}
void TestTriggers(int x, int y, int z, short roomNumber, bool heavy, int heavyFlags)

View file

@ -2040,7 +2040,7 @@ namespace TEN::Gui
// Use item event handling.
g_GameScript->OnUseItem((GAME_OBJECT_ID)InventoryItemChosen);
HandleAllGlobalEvents(EventType::UseItem, (Activator)item.Index);
HandleAllGlobalEvents(EventType::UseItem, (Activator)short(item.Index));
// Quickly discard further processing if chosen item was reset in script.
if (InventoryItemChosen == NO_VALUE)

View file

@ -1574,7 +1574,7 @@ bool SaveGame::Save(int slot)
return false;
g_GameScript->OnSave();
HandleAllGlobalEvents(EventType::Save, (Activator)LaraItem->Index);
HandleAllGlobalEvents(EventType::Save, (Activator)short(LaraItem->Index));
// Savegame infos need to be reloaded so that last savegame counter properly increases.
LoadHeaders();

View file

@ -323,7 +323,7 @@ Possible event type values:
*/
void LogicHandler::HandleEvent(const std::string& name, EventType type, sol::optional<Moveable&> activator)
{
TEN::Control::Volumes::HandleEvent(name, type, activator.has_value() ? (Activator)activator.value().GetIndex() : (Activator)LaraItem->Index);
TEN::Control::Volumes::HandleEvent(name, type, activator.has_value() ? (Activator)activator.value().GetIndex() : (Activator)short(LaraItem->Index));
}
/*** Attempt to find an event set and enable specified event in it.

View file

@ -310,12 +310,13 @@ float DoFogBulbForSky(float3 pos, ShaderFogBulb bulb)
float DoDistanceFogForVertex(float3 pos)
{
float d = length(CamPositionWS.xyz - pos);
float fogRange = FogMaxDistance * 1024 - FogMinDistance * 1024;
float fog = 0.0f;
float fogEnabled = step(0.0f, FogMaxDistance);
float fogFactor = (d - FogMinDistance * 1024) / fogRange;
float fog = saturate(fogFactor) * fogEnabled;
if (FogMaxDistance > 0.0f)
{
float d = length(CamPositionWS.xyz - pos);
fog = clamp((d - FogMinDistance * 1024) / (FogMaxDistance * 1024 - FogMinDistance * 1024), 0, 1);
}
return fog;
}

View file

@ -4,34 +4,26 @@
float Wibble(float3 effect, int hash)
{
if (effect.x > 0.0f || effect.y > 0.0f)
return sin((((Frame + hash) % 256) / WIBBLE_FRAME_PERIOD) * (PI2));
else
return 0.0f; // Don't calculate if not necessary
float shouldWibble = step(0.0f, effect.x + effect.y);
float wibble = sin((((Frame + hash) % 256) / WIBBLE_FRAME_PERIOD) * PI2);
return wibble * shouldWibble;
}
float3 Glow(float3 color, float3 effect, float wibble)
{
float3 col = color;
float shouldGlow = step(0.0f, effect.x);
float intensity = effect.x * lerp(-0.5f, 1.0f, wibble * 0.5f + 0.5f);
float3 glowEffect = float3(intensity, intensity, intensity) * shouldGlow;
if (effect.x > 0.0f)
{
float intensity = effect.x * lerp(-0.5f, 1.0f, wibble * 0.5f + 0.5f);
col = color + float3(intensity, intensity, intensity);
}
return col;
return color + glowEffect;
}
float3 Move(float3 position, float3 effect, float wibble)
{
float3 pos = position;
float weight = effect.z;
float weight = effect.z;
float shouldMove = step(0.0f, effect.y) * step(0.0f, weight);
float offset = wibble * effect.y * weight * 128.0f * shouldMove;
if (effect.y > 0.0f && weight > 0.0f)
{
pos.y += wibble * effect.y * weight * 128.0f; // 128 units offset to top and bottom (256 total)
}
return pos;
return position + float3(0.0f, offset, 0.0f);
}