Update Animations script class.

This commit is contained in:
hispidence 2022-02-06 20:59:48 +00:00
parent 4abc85d9ad
commit f3a2bc6e12
6 changed files with 43 additions and 42 deletions

View file

@ -76,8 +76,8 @@
<ClInclude Include="include\ScriptInterfaceLevel.h" /> <ClInclude Include="include\ScriptInterfaceLevel.h" />
<ClInclude Include="include\ScriptUtil.h" /> <ClInclude Include="include\ScriptUtil.h" />
<ClInclude Include="src\AudioTracks.h" /> <ClInclude Include="src\AudioTracks.h" />
<ClInclude Include="src\Flow\Animations\Animations.h" />
<ClInclude Include="src\Flow\FlowHandler.h" /> <ClInclude Include="src\Flow\FlowHandler.h" />
<ClInclude Include="src\GameScriptAnimations.h" />
<ClInclude Include="src\GameScriptColor.h" /> <ClInclude Include="src\GameScriptColor.h" />
<ClInclude Include="src\GameScriptFreeFunctions.h" /> <ClInclude Include="src\GameScriptFreeFunctions.h" />
<ClInclude Include="src\GameScriptInventoryObject.h" /> <ClInclude Include="src\GameScriptInventoryObject.h" />
@ -114,6 +114,7 @@
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">frameworkandsol.h</PrecompiledHeaderFile> <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">frameworkandsol.h</PrecompiledHeaderFile>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
</ClCompile> </ClCompile>
<ClCompile Include="src\Flow\Animations\Animations.cpp" />
<ClCompile Include="src\Flow\FlowHandler.cpp" /> <ClCompile Include="src\Flow\FlowHandler.cpp" />
<ClCompile Include="src\Inventory\InventoryHandler.cpp" /> <ClCompile Include="src\Inventory\InventoryHandler.cpp" />
<ClCompile Include="src\Logic\LogicHandler.cpp" /> <ClCompile Include="src\Logic\LogicHandler.cpp" />
@ -125,7 +126,6 @@
<ClCompile Include="src\Objects\SoundSource\SoundSource.cpp" /> <ClCompile Include="src\Objects\SoundSource\SoundSource.cpp" />
<ClCompile Include="src\Objects\Static\Static.cpp" /> <ClCompile Include="src\Objects\Static\Static.cpp" />
<ClCompile Include="src\ScriptInterfaceState.cpp" /> <ClCompile Include="src\ScriptInterfaceState.cpp" />
<ClCompile Include="src\GameScriptAnimations.cpp" />
<ClCompile Include="src\GameScriptColor.cpp" /> <ClCompile Include="src\GameScriptColor.cpp" />
<ClCompile Include="src\GameScriptFreeFunctions.cpp" /> <ClCompile Include="src\GameScriptFreeFunctions.cpp" />
<ClCompile Include="src\GameScriptInventoryObject.cpp" /> <ClCompile Include="src\GameScriptInventoryObject.cpp" />

View file

@ -177,9 +177,6 @@
<ClInclude Include="src\AudioTracks.h"> <ClInclude Include="src\AudioTracks.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\GameScriptAnimations.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\GameScriptColor.h"> <ClInclude Include="src\GameScriptColor.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
@ -279,6 +276,9 @@
<ClInclude Include="src\Inventory\InventoryHandler.h"> <ClInclude Include="src\Inventory\InventoryHandler.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\Flow\Animations\Animations.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="frameworkandsol.cpp"> <ClCompile Include="frameworkandsol.cpp">
@ -308,9 +308,6 @@
<ClCompile Include="src\GameScriptLevel.cpp"> <ClCompile Include="src\GameScriptLevel.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\GameScriptAnimations.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\GameScriptFreeFunctions.cpp"> <ClCompile Include="src\GameScriptFreeFunctions.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
@ -359,6 +356,9 @@
<ClCompile Include="src\Inventory\InventoryHandler.cpp"> <ClCompile Include="src\Inventory\InventoryHandler.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\Flow\Animations\Animations.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <None Include="packages.config" />

View file

@ -1,21 +1,21 @@
#include "frameworkandsol.h" #include "frameworkandsol.h"
#include "GameScriptAnimations.h" #include "Flow/Animations/Animations.h"
/*** /***
New custom animations which Lara can perform. New custom animations which Lara can perform.
@pregameclass Animations @tenclass Flow.Animations
@pragma nostrip @pragma nostrip
*/ */
void GameScriptAnimations::Register(sol::state* lua) void Animations::Register(sol::table & parent)
{ {
lua->new_usertype<GameScriptAnimations>("Animations", parent.new_usertype<Animations>("Animations",
"crawlExtended", &GameScriptAnimations::CrawlExtended, "crawlExtended", &Animations::CrawlExtended,
"crouchRoll", &GameScriptAnimations::CrouchRoll, "crouchRoll", &Animations::CrouchRoll,
"crawlspaceSwandive", &GameScriptAnimations::CrawlspaceSwandive, "crawlspaceSwandive", &Animations::CrawlspaceSwandive,
"monkeyTurn180", &GameScriptAnimations::MonkeyTurn180, "monkeyTurn180", &Animations::MonkeyTurn180,
"monkeyAutoJump", &GameScriptAnimations::MonkeyAutoJump, "monkeyAutoJump", &Animations::MonkeyAutoJump,
"oscillateHang", &GameScriptAnimations::OscillateHang, "oscillateHang", &Animations::OscillateHang,
"pose", &GameScriptAnimations::Pose "pose", &Animations::Pose
); );
} }

View file

@ -7,7 +7,7 @@ namespace sol {
class state; class state;
} }
struct GameScriptAnimations struct Animations
{ {
bool CrawlExtended; // Extended crawl moveset bool CrawlExtended; // Extended crawl moveset
bool CrouchRoll; // Crouch roll bool CrouchRoll; // Crouch roll
@ -17,5 +17,5 @@ struct GameScriptAnimations
bool OscillateHang; // Grab thin ledge animation from TR1 and 2 bool OscillateHang; // Grab thin ledge animation from TR1 and 2
bool Pose; // Crossed arms AFK posing bool Pose; // Crossed arms AFK posing
static void Register(sol::state* lua); static void Register(sol::table &);
}; };

View file

@ -25,15 +25,6 @@ ScriptInterfaceFlowHandler* g_GameFlow;
FlowHandler::FlowHandler(sol::state* lua, sol::table & parent) : LuaHandler{ lua } FlowHandler::FlowHandler(sol::state* lua, sol::table & parent) : LuaHandler{ lua }
{ {
GameScriptLevel::Register(m_lua);
GameScriptSkyLayer::Register(m_lua);
GameScriptFog::Register(m_lua);
GameScriptMirror::Register(m_lua);
GameScriptInventoryObject::Register(m_lua);
GameScriptSettings::Register(m_lua);
GameScriptAnimations::Register(m_lua);
GameScriptColor::Register(m_lua);
GameScriptRotation::Register(m_lua);
/*** gameflow.lua. /*** gameflow.lua.
These functions are called in gameflow.lua, a file loosely equivalent to winroomedit's SCRIPT.DAT. These functions are called in gameflow.lua, a file loosely equivalent to winroomedit's SCRIPT.DAT.
@ -110,6 +101,16 @@ Specify which translations in the strings table correspond to which languages.
*/ */
table_flow.set_function(ScriptReserved_SetLanguageNames, &FlowHandler::SetLanguageNames, this); table_flow.set_function(ScriptReserved_SetLanguageNames, &FlowHandler::SetLanguageNames, this);
GameScriptLevel::Register(m_lua);
GameScriptSkyLayer::Register(m_lua);
GameScriptMirror::Register(m_lua);
GameScriptInventoryObject::Register(m_lua);
GameScriptSettings::Register(m_lua);
Animations::Register(table_flow);
GameScriptColor::Register(m_lua);
GameScriptRotation::Register(m_lua);
GameScriptFog::Register(m_lua);
MakeReadOnlyTable(ScriptReserved_WeatherType, kWeatherTypes); MakeReadOnlyTable(ScriptReserved_WeatherType, kWeatherTypes);
MakeReadOnlyTable(ScriptReserved_LaraType, kLaraTypes); MakeReadOnlyTable(ScriptReserved_LaraType, kLaraTypes);
MakeReadOnlyTable(ScriptReserved_InvItem, kInventorySlots); MakeReadOnlyTable(ScriptReserved_InvItem, kInventorySlots);
@ -141,9 +142,9 @@ void FlowHandler::SetSettings(GameScriptSettings const & src)
m_settings = src; m_settings = src;
} }
void FlowHandler::SetAnimations(GameScriptAnimations const& src) void FlowHandler::SetAnimations(Animations const& src)
{ {
Animations = src; Anims = src;
} }
void FlowHandler::AddLevel(GameScriptLevel const& level) void FlowHandler::AddLevel(GameScriptLevel const& level)

View file

@ -5,7 +5,7 @@
#include "GameScriptColor.h" #include "GameScriptColor.h"
#include "GameScriptLevel.h" #include "GameScriptLevel.h"
#include "GameScriptSettings.h" #include "GameScriptSettings.h"
#include "GameScriptAnimations.h" #include "Flow/Animations/Animations.h"
#include "ScriptInterfaceGame.h" #include "ScriptInterfaceGame.h"
#include "Flow/ScriptInterfaceFlowHandler.h" #include "Flow/ScriptInterfaceFlowHandler.h"
@ -28,7 +28,7 @@ public:
byte GameFarView{ 0 }; byte GameFarView{ 0 };
// New animation flag table // New animation flag table
GameScriptAnimations Animations{}; Animations Anims{};
// Selected language set // Selected language set
std::vector<GameScriptLevel*> Levels; std::vector<GameScriptLevel*> Levels;
@ -41,7 +41,7 @@ public:
char const * GetString(const char* id) const; char const * GetString(const char* id) const;
void SetStrings(sol::nested<std::unordered_map<std::string, std::vector<std::string>>> && src); void SetStrings(sol::nested<std::unordered_map<std::string, std::vector<std::string>>> && src);
void SetLanguageNames(sol::as_table_t<std::vector<std::string>> && src); void SetLanguageNames(sol::as_table_t<std::vector<std::string>> && src);
void SetAnimations(GameScriptAnimations const & src); void SetAnimations(Animations const & src);
void SetSettings(GameScriptSettings const & src); void SetSettings(GameScriptSettings const & src);
GameScriptSettings* GetSettings(); GameScriptSettings* GetSettings();
GameScriptLevel* GetLevel(int id); GameScriptLevel* GetLevel(int id);
@ -52,13 +52,13 @@ public:
bool IsFlyCheatEnabled() const; bool IsFlyCheatEnabled() const;
bool CanPlayAnyLevel() const; bool CanPlayAnyLevel() const;
bool HasCrawlExtended() const override { return Animations.CrawlExtended; } bool HasCrawlExtended() const override { return Anims.CrawlExtended; }
bool HasCrouchRoll() const override { return Animations.CrouchRoll; } bool HasCrouchRoll() const override { return Anims.CrouchRoll; }
bool HasCrawlspaceSwandive() const override { return Animations.CrawlspaceSwandive; } bool HasCrawlspaceSwandive() const override { return Anims.CrawlspaceSwandive; }
bool HasMonkeyTurn180() const override { return Animations.MonkeyTurn180; } bool HasMonkeyTurn180() const override { return Anims.MonkeyTurn180; }
bool HasMonkeyAutoJump() const override { return Animations.MonkeyAutoJump; } bool HasMonkeyAutoJump() const override { return Anims.MonkeyAutoJump; }
bool HasOscillateHang() const override { return Animations.OscillateHang; } bool HasOscillateHang() const override { return Anims.OscillateHang; }
bool HasAFKPose() const override { return Animations.Pose; } bool HasAFKPose() const override { return Anims.Pose; }
bool DoFlow() override; bool DoFlow() override;
}; };