Add option to draw Lara in title flyby (#890)

* Add option to draw Lara in title flyby
* Update Changes.txt
This commit is contained in:
Anatoly 2022-12-06 15:40:38 +02:00 committed by GitHub
parent 015bd844f9
commit 557b25d9fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 45 additions and 5 deletions

View file

@ -32,7 +32,8 @@ Lua API changes:
* Add new Lara functions: GetTarget and GetVehicle.
* Remove Lara functions: SetOnFire and GetOnFire (replaced with GetEffect and SetEffect).
* Add Flow.EnableMassPickup option in Gameflow.lua to enable/disable mass pickups.
* Add level secrets property to display level-specific secret count.
* Add Flow.EnableLaraInTitle option in Gameflow.lua to enable/disable Lara in title flyby.
* Add level.secrets property to display level-specific secret count.
* Fix action key script functions not fully working in some cases.
* Fix mounted vehicles ignoring Disable, Shatter and Explode script commands.

View file

@ -24,6 +24,10 @@ Flow.EnableFlyCheat(true)
Flow.EnableMassPickup(true)
-- Disable/enable Lara drawing in title level
Flow.EnableLaraInTitle(false)
--------------------------------------------------
-- Title level

View file

@ -244,6 +244,11 @@ GameStatus ControlPhase(int numFrames, bool demoMode)
HairControl(LaraItem, level->GetLaraType() == LaraType::Young);
ProcessEffects(LaraItem);
}
else if (g_GameFlow->IsLaraInTitleEnabled())
{
AnimateLara(LaraItem);
HairControl(LaraItem, level->GetLaraType() == LaraType::Young);
}
if (UseSpotCam)
{

View file

@ -1,6 +1,7 @@
#include "framework.h"
#include "Renderer/Renderer11.h"
#include "Flow/ScriptInterfaceFlowHandler.h"
#include "Game/animation.h"
#include "Game/camera.h"
#include "Game/collision/sphere.h"
@ -352,7 +353,10 @@ namespace TEN::Renderer
if (item->Status == ITEM_INVISIBLE)
continue;
if (item->ObjectNumber == ID_LARA && (BinocularRange || SpotcamOverlay || SpotcamDontDrawLara || CurrentLevel == 0))
if (item->ObjectNumber == ID_LARA && (BinocularRange || SpotcamOverlay || SpotcamDontDrawLara))
continue;
if (item->ObjectNumber == ID_LARA && CurrentLevel == 0 && !g_GameFlow->IsLaraInTitleEnabled())
continue;
if (!m_moveableObjects[item->ObjectNumber].has_value())

View file

@ -252,7 +252,11 @@ void Renderer11::UpdateLaraAnimations(bool force)
void TEN::Renderer::Renderer11::DrawLara(RenderView& view, bool transparent)
{
// Don't draw Lara if binoculars or sniper
if (BinocularRange || SpotcamDontDrawLara || CurrentLevel == 0)
if (BinocularRange || SpotcamDontDrawLara)
return;
// Don't draw Lara if title level and disabled
if (CurrentLevel == 0 && !g_GameFlow->IsLaraInTitleEnabled())
return;
RendererItem* item = &m_items[Lara.ItemNumber];

View file

@ -26,6 +26,7 @@ public:
virtual char const* GetString(const char* id) const = 0;
virtual bool IsFlyCheatEnabled() const = 0;
virtual bool IsMassPickupEnabled() const = 0;
virtual bool IsLaraInTitleEnabled() const = 0;
virtual bool HasCrawlExtended() const = 0;
virtual bool HasCrouchRoll() const = 0;
virtual bool HasCrawlspaceDive() const = 0;

View file

@ -129,6 +129,7 @@ static constexpr char ScriptReserved_SetTotalSecretCount[] = "SetTotalSecretCou
static constexpr char ScriptReserved_AddSecret[] = "AddSecret";
static constexpr char ScriptReserved_EnableFlyCheat[] = "EnableFlyCheat";
static constexpr char ScriptReserved_EnableMassPickup[] = "EnableMassPickup";
static constexpr char ScriptReserved_EnableLaraInTitle[] = "EnableLaraInTitle";
// Flow Functions
static constexpr char ScriptReserved_SetStrings[] = "SetStrings";

View file

@ -127,6 +127,13 @@ Must be true or false
*/
table_flow.set_function(ScriptReserved_EnableMassPickup, &FlowHandler::EnableMassPickup, this);
/*** Enable or disable Lara drawing in title flyby.
Must be true or false
@function EnableLaraInTitle
@tparam bool true or false
*/
table_flow.set_function(ScriptReserved_EnableLaraInTitle, &FlowHandler::EnableLaraInTitle, this);
/*** settings.lua.
These functions are called in settings.lua, a file which holds your local settings.
settings.lua shouldn't be bundled with any finished levels/games.
@ -350,6 +357,16 @@ void FlowHandler::EnableMassPickup(bool massPickup)
MassPickup = massPickup;
}
bool FlowHandler::IsLaraInTitleEnabled() const
{
return LaraInTitle;
}
void FlowHandler::EnableLaraInTitle(bool laraInTitle)
{
LaraInTitle = laraInTitle;
}
bool FlowHandler::DoFlow()
{
// We start with the title level, if no other index is specified

View file

@ -26,7 +26,8 @@ public:
int FogOutDistance{ 0 };
bool PlayAnyLevel{ true };
bool FlyCheat{ true };
bool MassPickup{ true };
bool MassPickup{ true };
bool LaraInTitle{ false };
bool DebugMode{ false };
// New animation flag table
@ -59,8 +60,10 @@ public:
void SetTotalSecretCount(int secretsNumber);
bool IsFlyCheatEnabled() const;
void EnableFlyCheat(bool flyCheat);
bool IsMassPickupEnabled() const;
bool IsMassPickupEnabled() const;
void EnableMassPickup(bool massPickup);
bool IsLaraInTitleEnabled() const;
void EnableLaraInTitle(bool laraInTitle);
bool CanPlayAnyLevel() const;
bool HasCrawlExtended() const override { return Anims.HasCrawlExtended; }