mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-09 03:58:19 +03:00
Partially integrate ScriptInterfaceFlow and replace instances of direct access to Animations members.
This commit is contained in:
parent
4429bd8aa2
commit
2a9175f5fb
9 changed files with 37 additions and 22 deletions
|
@ -8,6 +8,7 @@
|
||||||
#include "GameScriptAudioTrack.h"
|
#include "GameScriptAudioTrack.h"
|
||||||
#include "GameScriptAnimations.h"
|
#include "GameScriptAnimations.h"
|
||||||
#include "ScriptInterfaceGame.h"
|
#include "ScriptInterfaceGame.h"
|
||||||
|
#include "ScriptInterfaceFlow.h"
|
||||||
|
|
||||||
enum class TITLE_TYPE
|
enum class TITLE_TYPE
|
||||||
{
|
{
|
||||||
|
@ -15,7 +16,7 @@ enum class TITLE_TYPE
|
||||||
BACKGROUND
|
BACKGROUND
|
||||||
};
|
};
|
||||||
|
|
||||||
class GameFlow : public LuaHandler
|
class GameFlow : public LuaHandler, public ScriptInterfaceFlow
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
GameScriptSettings m_settings;
|
GameScriptSettings m_settings;
|
||||||
|
@ -63,7 +64,16 @@ public:
|
||||||
void SetIntroImagePath(std::string const& path);
|
void SetIntroImagePath(std::string const& path);
|
||||||
void SetTitleScreenImagePath(std::string const& path);
|
void SetTitleScreenImagePath(std::string const& path);
|
||||||
void SetGameFarView(byte val);
|
void SetGameFarView(byte val);
|
||||||
|
bool IsFlyCheatEnabled() const;
|
||||||
|
|
||||||
|
bool HasCrawlExtended() const { return Animations.CrawlExtended; }
|
||||||
|
bool HasCrouchRoll() const { return Animations.CrouchRoll; }
|
||||||
|
bool HasCrawlspaceSwandive() const { return Animations.CrawlspaceSwandive; }
|
||||||
|
bool HasMonkeyTurn180() const { return Animations.MonkeyTurn180; }
|
||||||
|
bool HasMonkeyAutoJump() const { return Animations.MonkeyAutoJump; }
|
||||||
|
bool HasOscillateHang() const { return Animations.OscillateHang; }
|
||||||
|
bool HasAFKPose() const { return Animations.Pose; }
|
||||||
};
|
};
|
||||||
|
|
||||||
extern GameFlow* g_GameFlow;
|
extern ScriptInterfaceFlow* g_GameFlow;
|
||||||
extern ScriptInterfaceGame * g_GameScript;
|
extern ScriptInterfaceGame* g_GameScript;
|
||||||
|
|
|
@ -16,7 +16,7 @@ using std::string;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::unordered_map;
|
using std::unordered_map;
|
||||||
|
|
||||||
GameFlow* g_GameFlow;
|
ScriptInterfaceFlow* g_GameFlow;
|
||||||
ScriptInterfaceGame* g_GameScript;
|
ScriptInterfaceGame* g_GameScript;
|
||||||
|
|
||||||
GameFlow::GameFlow(sol::state* lua) : LuaHandler{ lua }
|
GameFlow::GameFlow(sol::state* lua) : LuaHandler{ lua }
|
||||||
|
@ -231,6 +231,11 @@ int GameFlow::GetNumLevels() const
|
||||||
return Levels.size();
|
return Levels.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GameFlow::IsFlyCheatEnabled() const
|
||||||
|
{
|
||||||
|
return FlyCheat;
|
||||||
|
}
|
||||||
|
|
||||||
bool GameFlow::DoGameflow()
|
bool GameFlow::DoGameflow()
|
||||||
{
|
{
|
||||||
// We start with the title level
|
// We start with the title level
|
||||||
|
|
|
@ -492,7 +492,7 @@ void lara_as_idle(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
// movement lock will be rather obnoxious.
|
// movement lock will be rather obnoxious.
|
||||||
// Adding some idle breathing would also be nice. @Sezz 2021.10.31
|
// Adding some idle breathing would also be nice. @Sezz 2021.10.31
|
||||||
if (info->poseCount >= LARA_POSE_TIME && TestLaraPose(item, coll) &&
|
if (info->poseCount >= LARA_POSE_TIME && TestLaraPose(item, coll) &&
|
||||||
g_GameFlow->Animations.Pose)
|
g_GameFlow->HasAFKPose())
|
||||||
{
|
{
|
||||||
item->goalAnimState = LS_POSE;
|
item->goalAnimState = LS_POSE;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -67,7 +67,7 @@ void lara_as_swimcheat(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
|
|
||||||
void LaraCheatyBits()
|
void LaraCheatyBits()
|
||||||
{
|
{
|
||||||
if (g_GameFlow->FlyCheat)
|
if (g_GameFlow->IsFlyCheatEnabled())
|
||||||
{
|
{
|
||||||
if (KeyMap[DIK_O])
|
if (KeyMap[DIK_O])
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,7 +63,7 @@ void lara_as_crouch_idle(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
{
|
{
|
||||||
if (TrInput & IN_SPRINT && TestLaraCrouchRoll(item, coll) &&
|
if (TrInput & IN_SPRINT && TestLaraCrouchRoll(item, coll) &&
|
||||||
info->gunStatus == LG_HANDS_FREE &&
|
info->gunStatus == LG_HANDS_FREE &&
|
||||||
g_GameFlow->Animations.CrouchRoll)
|
g_GameFlow->HasCrouchRoll())
|
||||||
{
|
{
|
||||||
item->goalAnimState = LS_CROUCH_ROLL;
|
item->goalAnimState = LS_CROUCH_ROLL;
|
||||||
return;
|
return;
|
||||||
|
@ -242,7 +242,7 @@ void lara_as_crouch_turn_left(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
info->waterStatus != LW_WADE)
|
info->waterStatus != LW_WADE)
|
||||||
{
|
{
|
||||||
if (TrInput & IN_SPRINT && TestLaraCrouchRoll(item, coll) &&
|
if (TrInput & IN_SPRINT && TestLaraCrouchRoll(item, coll) &&
|
||||||
g_GameFlow->Animations.CrouchRoll)
|
g_GameFlow->HasCrouchRoll())
|
||||||
{
|
{
|
||||||
item->goalAnimState = LS_CROUCH_ROLL;
|
item->goalAnimState = LS_CROUCH_ROLL;
|
||||||
return;
|
return;
|
||||||
|
@ -298,7 +298,7 @@ void lara_as_crouch_turn_right(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
info->waterStatus != LW_WADE)
|
info->waterStatus != LW_WADE)
|
||||||
{
|
{
|
||||||
if (TrInput & IN_SPRINT && TestLaraCrouchRoll(item, coll) &&
|
if (TrInput & IN_SPRINT && TestLaraCrouchRoll(item, coll) &&
|
||||||
g_GameFlow->Animations.CrouchRoll)
|
g_GameFlow->HasCrouchRoll())
|
||||||
{
|
{
|
||||||
item->goalAnimState = LS_CROUCH_ROLL;
|
item->goalAnimState = LS_CROUCH_ROLL;
|
||||||
return;
|
return;
|
||||||
|
@ -380,7 +380,7 @@ void lara_as_crawl_idle(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
if (TrInput & IN_FORWARD)
|
if (TrInput & IN_FORWARD)
|
||||||
{
|
{
|
||||||
if (TrInput & (IN_ACTION | IN_JUMP) && TestLaraCrawlVault(item, coll) &&
|
if (TrInput & (IN_ACTION | IN_JUMP) && TestLaraCrawlVault(item, coll) &&
|
||||||
g_GameFlow->Animations.CrawlExtended)
|
g_GameFlow->HasCrawlExtended())
|
||||||
{
|
{
|
||||||
DoLaraCrawlVault(item, coll);
|
DoLaraCrawlVault(item, coll);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -218,7 +218,7 @@ void HandleLaraMovementParameters(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
if (info->poseCount < LARA_POSE_TIME &&
|
if (info->poseCount < LARA_POSE_TIME &&
|
||||||
TestLaraPose(item, coll) &&
|
TestLaraPose(item, coll) &&
|
||||||
!(TrInput & (IN_WAKE | IN_LOOK)) &&
|
!(TrInput & (IN_WAKE | IN_LOOK)) &&
|
||||||
g_GameFlow->Animations.Pose)
|
g_GameFlow->HasAFKPose())
|
||||||
{
|
{
|
||||||
info->poseCount++;
|
info->poseCount++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -601,7 +601,7 @@ void lara_col_swandive(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
;
|
;
|
||||||
else if (info->keepCrouched ||
|
else if (info->keepCrouched ||
|
||||||
abs(probe.Position.Ceiling - probe.Position.Floor) < LARA_HEIGHT &&
|
abs(probe.Position.Ceiling - probe.Position.Floor) < LARA_HEIGHT &&
|
||||||
g_GameFlow->Animations.CrawlspaceSwandive)
|
g_GameFlow->HasCrawlspaceSwandive())
|
||||||
{
|
{
|
||||||
SetAnimation(item, LA_SPRINT_TO_CROUCH_LEFT, 10);
|
SetAnimation(item, LA_SPRINT_TO_CROUCH_LEFT, 10);
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ void lara_col_monkey_idle(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
{
|
{
|
||||||
item->goalAnimState = LS_MONKEYSWING_TURN_RIGHT;
|
item->goalAnimState = LS_MONKEYSWING_TURN_RIGHT;
|
||||||
}
|
}
|
||||||
else if (TrInput & IN_ROLL && g_GameFlow->Animations.MonkeyTurn180)
|
else if (TrInput & IN_ROLL && g_GameFlow->HasMonkeyTurn180())
|
||||||
{
|
{
|
||||||
item->goalAnimState = LS_MONKEYSWING_TURN_180;
|
item->goalAnimState = LS_MONKEYSWING_TURN_180;
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@ bool TestLaraVault(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
// Vault to crouch up one step.
|
// Vault to crouch up one step.
|
||||||
if (coll->Front.Floor < 0 && // Lower floor bound.
|
if (coll->Front.Floor < 0 && // Lower floor bound.
|
||||||
coll->Front.Floor > -STEPUP_HEIGHT && // Upper floor bound.
|
coll->Front.Floor > -STEPUP_HEIGHT && // Upper floor bound.
|
||||||
g_GameFlow->Animations.CrawlExtended)
|
g_GameFlow->HasCrawlExtended())
|
||||||
{
|
{
|
||||||
if (abs((coll->Front.Ceiling - coll->Setup.Height) - coll->Front.Floor) > LARA_HEIGHT_CRAWL) // Front clamp buffer. Presumably, nothing more is necessary, but tend to this in the future. @Sezz 2021.11.06
|
if (abs((coll->Front.Ceiling - coll->Setup.Height) - coll->Front.Floor) > LARA_HEIGHT_CRAWL) // Front clamp buffer. Presumably, nothing more is necessary, but tend to this in the future. @Sezz 2021.11.06
|
||||||
{
|
{
|
||||||
|
@ -153,7 +153,7 @@ bool TestLaraVault(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
else if (abs((coll->Front.Ceiling - coll->Setup.Height) - coll->Front.Floor) > LARA_HEIGHT_CRAWL && // Front clamp buffer.
|
else if (abs((coll->Front.Ceiling - coll->Setup.Height) - coll->Front.Floor) > LARA_HEIGHT_CRAWL && // Front clamp buffer.
|
||||||
abs((coll->FrontLeft.Ceiling - coll->Setup.Height) - coll->FrontLeft.Floor) > LARA_HEIGHT_CRAWL && // Left clamp buffer.
|
abs((coll->FrontLeft.Ceiling - coll->Setup.Height) - coll->FrontLeft.Floor) > LARA_HEIGHT_CRAWL && // Left clamp buffer.
|
||||||
abs((coll->FrontRight.Ceiling - coll->Setup.Height) - coll->FrontRight.Floor) > LARA_HEIGHT_CRAWL && // Right clamp buffer.
|
abs((coll->FrontRight.Ceiling - coll->Setup.Height) - coll->FrontRight.Floor) > LARA_HEIGHT_CRAWL && // Right clamp buffer.
|
||||||
g_GameFlow->Animations.CrawlExtended)
|
g_GameFlow->HasCrawlExtended())
|
||||||
{
|
{
|
||||||
item->animNumber = LA_VAULT_TO_CROUCH_2CLICK;
|
item->animNumber = LA_VAULT_TO_CROUCH_2CLICK;
|
||||||
item->frameNumber = GetFrameNumber(item, 0);
|
item->frameNumber = GetFrameNumber(item, 0);
|
||||||
|
@ -183,7 +183,7 @@ bool TestLaraVault(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
else if (abs((coll->Front.Ceiling - coll->Setup.Height) - coll->Front.Floor) > LARA_HEIGHT_CRAWL && // Front clamp buffer.
|
else if (abs((coll->Front.Ceiling - coll->Setup.Height) - coll->Front.Floor) > LARA_HEIGHT_CRAWL && // Front clamp buffer.
|
||||||
abs((coll->FrontLeft.Ceiling - coll->Setup.Height) - coll->FrontLeft.Floor) > LARA_HEIGHT_CRAWL && // Left clamp buffer.
|
abs((coll->FrontLeft.Ceiling - coll->Setup.Height) - coll->FrontLeft.Floor) > LARA_HEIGHT_CRAWL && // Left clamp buffer.
|
||||||
abs((coll->FrontRight.Ceiling - coll->Setup.Height) - coll->FrontRight.Floor) > LARA_HEIGHT_CRAWL && // Right clamp buffer.
|
abs((coll->FrontRight.Ceiling - coll->Setup.Height) - coll->FrontRight.Floor) > LARA_HEIGHT_CRAWL && // Right clamp buffer.
|
||||||
g_GameFlow->Animations.CrawlExtended)
|
g_GameFlow->HasCrawlExtended())
|
||||||
{
|
{
|
||||||
item->animNumber = LA_VAULT_TO_CROUCH_3CLICK;
|
item->animNumber = LA_VAULT_TO_CROUCH_3CLICK;
|
||||||
item->frameNumber = GetFrameNumber(item, 0);
|
item->frameNumber = GetFrameNumber(item, 0);
|
||||||
|
@ -266,7 +266,7 @@ bool TestLaraVault(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
// Auto jump to monkey swing.
|
// Auto jump to monkey swing.
|
||||||
if (info->canMonkeySwing &&
|
if (info->canMonkeySwing &&
|
||||||
!TestLaraSwamp(item) &&
|
!TestLaraSwamp(item) &&
|
||||||
g_GameFlow->Animations.MonkeyAutoJump)
|
g_GameFlow->HasMonkeyAutoJump())
|
||||||
{
|
{
|
||||||
short roomNum = item->roomNumber;
|
short roomNum = item->roomNumber;
|
||||||
int ceiling = (GetCeiling(GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNum),
|
int ceiling = (GetCeiling(GetFloor(item->pos.xPos, item->pos.yPos, item->pos.zPos, &roomNum),
|
||||||
|
@ -545,7 +545,7 @@ bool TestLaraHangJump(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
|
|
||||||
if (TestHangSwingIn(item, angle))
|
if (TestHangSwingIn(item, angle))
|
||||||
{
|
{
|
||||||
if (g_GameFlow->Animations.OscillateHang)
|
if (g_GameFlow->HasOscillateHang())
|
||||||
{
|
{
|
||||||
ResetLaraFlex(item);
|
ResetLaraFlex(item);
|
||||||
SetAnimation(item, LA_REACH_TO_HANG_OSCILLATE);
|
SetAnimation(item, LA_REACH_TO_HANG_OSCILLATE);
|
||||||
|
@ -1107,7 +1107,7 @@ bool TestHangSwingIn(ITEM_INFO* item, short angle)
|
||||||
|
|
||||||
if (floorHeight != NO_HEIGHT)
|
if (floorHeight != NO_HEIGHT)
|
||||||
{
|
{
|
||||||
if (g_GameFlow->Animations.OscillateHang)
|
if (g_GameFlow->HasOscillateHang())
|
||||||
{
|
{
|
||||||
if (floorHeight - y > 0 && ceilingHeight - y < -400)
|
if (floorHeight - y > 0 && ceilingHeight - y < -400)
|
||||||
return true;
|
return true;
|
||||||
|
@ -1370,7 +1370,7 @@ bool TestLaraWaterClimbOut(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
{
|
{
|
||||||
if (headroom < LARA_HEIGHT)
|
if (headroom < LARA_HEIGHT)
|
||||||
{
|
{
|
||||||
if (g_GameFlow->Animations.CrawlExtended)
|
if (g_GameFlow->HasCrawlExtended())
|
||||||
SetAnimation(item, LA_ONWATER_TO_CROUCH_1CLICK);
|
SetAnimation(item, LA_ONWATER_TO_CROUCH_1CLICK);
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
@ -1382,7 +1382,7 @@ bool TestLaraWaterClimbOut(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
{
|
{
|
||||||
if (headroom < LARA_HEIGHT)
|
if (headroom < LARA_HEIGHT)
|
||||||
{
|
{
|
||||||
if (g_GameFlow->Animations.CrawlExtended)
|
if (g_GameFlow->HasCrawlExtended())
|
||||||
SetAnimation(item, LA_ONWATER_TO_CROUCH_M1CLICK);
|
SetAnimation(item, LA_ONWATER_TO_CROUCH_M1CLICK);
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
@ -1395,7 +1395,7 @@ bool TestLaraWaterClimbOut(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
{
|
{
|
||||||
if (headroom < LARA_HEIGHT)
|
if (headroom < LARA_HEIGHT)
|
||||||
{
|
{
|
||||||
if (g_GameFlow->Animations.CrawlExtended)
|
if (g_GameFlow->HasCrawlExtended())
|
||||||
SetAnimation(item, LA_ONWATER_TO_CROUCH_0CLICK);
|
SetAnimation(item, LA_ONWATER_TO_CROUCH_0CLICK);
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue