Revert "Merge branch 'develop' into renderer_refactor"

This reverts commit 4706f46982, reversing
changes made to bd413d00b2.
This commit is contained in:
Kubsy 2023-12-10 11:04:15 +00:00
parent 4706f46982
commit 536c555b2d
14 changed files with 0 additions and 143 deletions

View file

@ -18,7 +18,6 @@ Version 1.3
* Allow walking on slopes when wading in water (similar to quicksand rooms). * Allow walking on slopes when wading in water (similar to quicksand rooms).
* Allow Lara to pull certain levers with both hands whilst holding a flare. * Allow Lara to pull certain levers with both hands whilst holding a flare.
* Port twin auto gun from TR3. * Port twin auto gun from TR3.
* Add speedometer for vehicles such as: motorbike, Jeep.
* Accurately rotate display sprites around their pivot. * Accurately rotate display sprites around their pivot.
* Slightly revise keyhole OCB to account for either keeping or losing the key: * Slightly revise keyhole OCB to account for either keeping or losing the key:
- Positive OCB - play anim number and keep key in inventory. - Positive OCB - play anim number and keep key in inventory.

View file

@ -14,7 +14,6 @@ namespace TEN::Hud
void HudController::Update(const ItemInfo& playerItem) void HudController::Update(const ItemInfo& playerItem)
{ {
TargetHighlighter.Update(playerItem); TargetHighlighter.Update(playerItem);
Speedometer.Update();
PickupSummary.Update(); PickupSummary.Update();
StatusBars.Update(playerItem); StatusBars.Update(playerItem);
} }
@ -22,7 +21,6 @@ namespace TEN::Hud
void HudController::Draw(const ItemInfo& playerItem) const void HudController::Draw(const ItemInfo& playerItem) const
{ {
TargetHighlighter.Draw(); TargetHighlighter.Draw();
Speedometer.Draw();
PickupSummary.Draw(); PickupSummary.Draw();
StatusBars.Draw(playerItem); StatusBars.Draw(playerItem);
} }
@ -30,7 +28,6 @@ namespace TEN::Hud
void HudController::Clear() void HudController::Clear()
{ {
TargetHighlighter.Clear(); TargetHighlighter.Clear();
Speedometer.Clear();
PickupSummary.Clear(); PickupSummary.Clear();
StatusBars.Clear(); StatusBars.Clear();
} }

View file

@ -1,6 +1,5 @@
#pragma once #pragma once
#include "Game/Hud/PickupSummary.h" #include "Game/Hud/PickupSummary.h"
#include "Game/Hud/Speedometer.h"
#include "Game/Hud/StatusBars.h" #include "Game/Hud/StatusBars.h"
#include "Game/Hud/TargetHighlighter.h" #include "Game/Hud/TargetHighlighter.h"
@ -14,7 +13,6 @@ namespace TEN::Hud
// Members // Members
StatusBarsController StatusBars = {}; StatusBarsController StatusBars = {};
PickupSummaryController PickupSummary = {}; PickupSummaryController PickupSummary = {};
SpeedometerController Speedometer = {};
TargetHighlighterController TargetHighlighter = {}; TargetHighlighterController TargetHighlighter = {};
// Utilities // Utilities

View file

@ -1,89 +0,0 @@
#include "framework.h"
#include "Game/Hud/Speedometer.h"
#include "Game/effects/DisplaySprite.h"
#include "Math/Math.h"
#include "Renderer/Renderer11.h"
#include "Specific/clock.h"
using namespace TEN::Effects::DisplaySprite;
using namespace TEN::Math;
using TEN::Renderer::g_Renderer;
namespace TEN::Hud
{
void SpeedometerController::UpdateValue(float value)
{
_value = std::clamp(value, 0.0f, 1.0f);
_hasValueUpdated = true;
}
void SpeedometerController::Update()
{
constexpr auto DIAL_ANGLE_MAX = ANGLE(120.0f);
constexpr auto DIAL_ANGLE_LERP_ALPHA = 0.25f;
constexpr auto FADE_TIME = 0.2f;
if (!_hasValueUpdated && _life <= 0.0f &&
_value <= 0.0f && _pointerAngle <= 0.0f)
{
return;
}
// Update life and updated value status.
_life = std::clamp(_life + (_hasValueUpdated ? 1.0f : -1.0f), 0.0f, LIFE_MAX * FPS);
_hasValueUpdated = false;
// Ensure value resets to 0.
if (_life <= 0.0f)
_value = 0.0f;
// Update appearance.
_pointerAngle = Lerp(_pointerAngle, DIAL_ANGLE_MAX * _value, DIAL_ANGLE_LERP_ALPHA);
_opacity = std::clamp(_life / std::round(FADE_TIME * FPS), 0.0f, 1.0f);
}
void SpeedometerController::Draw() const
{
constexpr auto POS = Vector2(DISPLAY_SPACE_RES.x - (DISPLAY_SPACE_RES.x / 6), DISPLAY_SPACE_RES.y - (DISPLAY_SPACE_RES.y / 10));
constexpr auto ORIENT_OFFSET = ANGLE(90.0f);
constexpr auto SCALE = Vector2(0.35f);
constexpr auto DIAL_ELEMENT_SPRITE_ID = 0;
constexpr auto POINTER_ELEMENT_SPRITE_ID = 1;
constexpr auto DIAL_PRIORITY = 0;
constexpr auto POINTER_PRIORITY = 1;
//DrawDebug();
if (_life <= 0.0f)
return;
auto color = Color(1.0f, 1.0f, 1.0f, _opacity);
// Draw dial.
AddDisplaySprite(
ID_SPEEDOMETER, DIAL_ELEMENT_SPRITE_ID,
POS, 0, SCALE, color,
DIAL_PRIORITY, DisplaySpriteAlignMode::Center, DisplaySpriteScaleMode::Fit, BLEND_MODES::BLENDMODE_ALPHABLEND);
// Draw pointer.
AddDisplaySprite(
ID_SPEEDOMETER, POINTER_ELEMENT_SPRITE_ID,
POS, _pointerAngle + ORIENT_OFFSET, SCALE, color,
POINTER_PRIORITY, DisplaySpriteAlignMode::Center, DisplaySpriteScaleMode::Fit, BLEND_MODES::BLENDMODE_ALPHABLEND);
}
void SpeedometerController::Clear()
{
*this = {};
}
void SpeedometerController::DrawDebug() const
{
g_Renderer.PrintDebugMessage("SPEEDOMETER DEBUG");
g_Renderer.PrintDebugMessage("Value: %.3f", _value);
g_Renderer.PrintDebugMessage("Pointer angle: %.3f", _pointerAngle);
g_Renderer.PrintDebugMessage("Opacity: %.3f", _opacity);
g_Renderer.PrintDebugMessage("Life: %.3f", _life / FPS);
}
}

View file

@ -1,29 +0,0 @@
#pragma once
namespace TEN::Hud
{
class SpeedometerController
{
private:
// Constants
static constexpr auto LIFE_MAX = 0.75f;
// Members
bool _hasValueUpdated = false;
float _value = 0.0f;
short _pointerAngle = 0;
float _opacity = 0.0f;
float _life = 0.0f;
public:
// Utilities
void UpdateValue(float value);
void Update();
void Draw() const;
void Clear();
void DrawDebug() const;
};
}

View file

@ -324,7 +324,6 @@ namespace TEN::Entities::Vehicles
default: default:
drive = SkidooUserControl(skidooItem, laraItem, height, &pitch); drive = SkidooUserControl(skidooItem, laraItem, height, &pitch);
HandleVehicleSpeedometer(skidooItem->Animation.Velocity.z, SKIDOO_FAST_VELOCITY_MAX);
break; break;
} }
} }

View file

@ -842,7 +842,6 @@ namespace TEN::Entities::Vehicles
default: default:
drive = true; drive = true;
noTurn = SpeedboatUserControl(speedboatItem, laraItem); noTurn = SpeedboatUserControl(speedboatItem, laraItem);
HandleVehicleSpeedometer(speedboatItem->Animation.Velocity.z, SPEEDBOAT_FAST_VELOCITY_MAX);
break; break;
} }
} }

View file

@ -1130,7 +1130,6 @@ namespace TEN::Entities::Vehicles
default: default:
drive = QuadUserControl(quadBikeItem, probe.Position.Floor, &pitch); drive = QuadUserControl(quadBikeItem, probe.Position.Floor, &pitch);
HandleVehicleSpeedometer(quadBikeItem->Animation.Velocity.z, MAX_VELOCITY / (float)VEHICLE_VELOCITY_SCALE);
break; break;
} }
} }

View file

@ -1324,10 +1324,7 @@ namespace TEN::Entities::Vehicles
collide = 0; collide = 0;
} }
else else
{
drive = JeepUserControl(jeepItem, laraItem, floorHeight, &pitch); drive = JeepUserControl(jeepItem, laraItem, floorHeight, &pitch);
HandleVehicleSpeedometer(jeepItem->Animation.Velocity.z, JEEP_VELOCITY_MAX / (float)VEHICLE_VELOCITY_SCALE);
}
if (jeep->Velocity || jeep->Revs) if (jeep->Velocity || jeep->Revs)
{ {

View file

@ -1188,7 +1188,6 @@ namespace TEN::Entities::Vehicles
motorbikeItem->MeshBits.Set(MotorbikeHeadLightJoints); motorbikeItem->MeshBits.Set(MotorbikeHeadLightJoints);
drive = MotorbikeUserControl(motorbikeItem, laraItem, probe.Position.Floor, &pitch); drive = MotorbikeUserControl(motorbikeItem, laraItem, probe.Position.Floor, &pitch);
HandleVehicleSpeedometer(motorbikeItem->Animation.Velocity.z, MOTORBIKE_ACCEL_MAX / (float)VEHICLE_VELOCITY_SCALE);
} }
else else
{ {

View file

@ -6,7 +6,6 @@
#include "Game/effects/simple_particle.h" #include "Game/effects/simple_particle.h"
#include "Game/effects/Streamer.h" #include "Game/effects/Streamer.h"
#include "Game/effects/tomb4fx.h" #include "Game/effects/tomb4fx.h"
#include "Game/Hud/Hud.h"
#include "Game/Lara/lara_flare.h" #include "Game/Lara/lara_flare.h"
#include "Game/Lara/lara_helpers.h" #include "Game/Lara/lara_helpers.h"
#include "Game/Lara/lara_struct.h" #include "Game/Lara/lara_struct.h"
@ -16,7 +15,6 @@
#include "Specific/Input/Input.h" #include "Specific/Input/Input.h"
using namespace TEN::Effects::Streamer; using namespace TEN::Effects::Streamer;
using namespace TEN::Hud;
using namespace TEN::Input; using namespace TEN::Input;
using namespace TEN::Math; using namespace TEN::Math;
@ -389,10 +387,4 @@ namespace TEN::Entities::Vehicles
positions.second, direction, orient2D, COLOR, positions.second, direction, orient2D, COLOR,
0.0f, life, vel, scaleRate, 0, (int)StreamerFlags::FadeRight); 0.0f, life, vel, scaleRate, 0, (int)StreamerFlags::FadeRight);
} }
void HandleVehicleSpeedometer(float vel, float velMax)
{
float value = abs(vel / velMax);
g_Hud.Speedometer.UpdateValue(value);
}
} }

View file

@ -45,5 +45,4 @@ namespace TEN::Entities::Vehicles
void ResetVehicleLean(ItemInfo* vehicleItem, float rate); void ResetVehicleLean(ItemInfo* vehicleItem, float rate);
void SpawnVehicleWake(const ItemInfo& vehicleItem, const Vector3& relOffset, int waterHeight, bool isUnderwater = false); void SpawnVehicleWake(const ItemInfo& vehicleItem, const Vector3& relOffset, int waterHeight, bool isUnderwater = false);
void HandleVehicleSpeedometer(float vel, float velMax);
} }

View file

@ -996,7 +996,6 @@ enum GAME_OBJECT_ID : short
ID_SFX_BAR_TEXTURE, ID_SFX_BAR_TEXTURE,
// NOTE: 1378 - 1379 reserved for blood effects. -- Sezz 2023.05.29 // NOTE: 1378 - 1379 reserved for blood effects. -- Sezz 2023.05.29
ID_CROSSHAIR = 1380, ID_CROSSHAIR = 1380,
ID_SPEEDOMETER,
ID_PANEL_BORDER = 1400, ID_PANEL_BORDER = 1400,
ID_PANEL_MIDDLE, ID_PANEL_MIDDLE,

View file

@ -328,7 +328,6 @@ xcopy /Y "$(SolutionDir)Libs\zlib\x64\*.dll" "$(TargetDir)"</Command>
<ClInclude Include="Game\GuiObjects.h" /> <ClInclude Include="Game\GuiObjects.h" />
<ClInclude Include="Game\Hud\Hud.h" /> <ClInclude Include="Game\Hud\Hud.h" />
<ClInclude Include="Game\Hud\PickupSummary.h" /> <ClInclude Include="Game\Hud\PickupSummary.h" />
<ClInclude Include="Game\Hud\Speedometer.h" />
<ClInclude Include="Game\Hud\StatusBars.h" /> <ClInclude Include="Game\Hud\StatusBars.h" />
<ClInclude Include="Game\Hud\TargetHighlighter.h" /> <ClInclude Include="Game\Hud\TargetHighlighter.h" />
<ClInclude Include="Game\Lara\lara.h" /> <ClInclude Include="Game\Lara\lara.h" />
@ -868,7 +867,6 @@ xcopy /Y "$(SolutionDir)Libs\zlib\x64\*.dll" "$(TargetDir)"</Command>
<ClCompile Include="Game\GuiObjects.cpp" /> <ClCompile Include="Game\GuiObjects.cpp" />
<ClCompile Include="Game\Hud\Hud.cpp" /> <ClCompile Include="Game\Hud\Hud.cpp" />
<ClCompile Include="Game\Hud\PickupSummary.cpp" /> <ClCompile Include="Game\Hud\PickupSummary.cpp" />
<ClCompile Include="Game\Hud\Speedometer.cpp" />
<ClCompile Include="Game\Hud\StatusBars.cpp" /> <ClCompile Include="Game\Hud\StatusBars.cpp" />
<ClCompile Include="Game\Hud\TargetHighlighter.cpp" /> <ClCompile Include="Game\Hud\TargetHighlighter.cpp" />
<ClCompile Include="Game\itemdata\creature_info.cpp" /> <ClCompile Include="Game\itemdata\creature_info.cpp" />