diff --git a/.gitmodules b/.gitmodules index 0158c89..6d1be60 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,12 +4,7 @@ [submodule "deps/GSL"] path = deps/GSL url = https://github.com/microsoft/GSL.git -[submodule "deps/sol2"] - path = deps/sol2 - url = https://github.com/ThePhD/sol2.git -[submodule "deps/lua"] - path = deps/lua - url = https://github.com/lua/lua.git [submodule "deps/json"] path = deps/json url = https://github.com/nlohmann/json.git + branch = develop diff --git a/deps/json b/deps/json index e10a3fa..e4643d1 160000 --- a/deps/json +++ b/deps/json @@ -1 +1 @@ -Subproject commit e10a3fac8a255433146e3f06a703dc110fc3c3da +Subproject commit e4643d1f1b03fc7a1d7b65f17e012ca93680cad8 diff --git a/generate.bat b/generate.bat index 58ba509..95cb0a4 100644 --- a/generate.bat +++ b/generate.bat @@ -1,2 +1,3 @@ @echo off +call git submodule update --init --recursive tools\windows\premake5.exe vs2019 \ No newline at end of file diff --git a/premake5.lua b/premake5.lua index be1423b..5d9a3e5 100644 --- a/premake5.lua +++ b/premake5.lua @@ -36,32 +36,35 @@ workspace "iw5-gsc-utils" targetdir "%{wks.location}/bin/%{cfg.buildcfg}" targetname "%{prj.name}" + configurations { "Debug", "Release", } + language "C++" + cppdialect "C++20" architecture "x86" - buildoptions "/std:c++latest" systemversion "latest" + symbols "On" + staticruntime "On" + editandcontinue "Off" + warnings "Extra" + characterset "ASCII" flags { "NoIncrementalLink", "MultiProcessorCompile", } - - configurations { "Debug", "Release", } - - symbols "On" - configuration "Release" + filter "configurations:Release" optimize "Full" defines { "NDEBUG" } - configuration{} + filter {} - configuration "Debug" + filter "configurations:Debug" optimize "Debug" defines { "DEBUG", "_DEBUG" } - configuration {} + filter {} startproject "iw5-gsc-utils" diff --git a/src/component/gsc.cpp b/src/component/gsc.cpp index 1eda243..707c591 100644 --- a/src/component/gsc.cpp +++ b/src/component/gsc.cpp @@ -53,8 +53,6 @@ namespace gsc { std::vector args; - const auto top = game::scr_VmPub->top; - for (auto i = 0; i < game::scr_VmPub->outparamcount; i++) { const auto value = game::scr_VmPub->top[-i]; @@ -380,7 +378,7 @@ namespace gsc return {}; }); - function::add("dropallbots", [](const function_args& args) -> scripting::script_value + function::add("dropallbots", [](const function_args&) -> scripting::script_value { for (auto i = 0; i < *game::svs_clientCount; i++) { @@ -437,7 +435,7 @@ namespace gsc return {}; }); - method::add("isbot", [](const game::scr_entref_t ent, const function_args& args) -> scripting::script_value + method::add("isbot", [](const game::scr_entref_t ent, const function_args&) -> scripting::script_value { if (ent.classnum != 0) { @@ -454,6 +452,23 @@ namespace gsc return game::svs_clients[client].bIsTestClient; }); + method::add("arecontrolsfrozen", [](const game::scr_entref_t ent, const function_args&) -> scripting::script_value + { + if (ent.classnum != 0) + { + throw std::runtime_error("Invalid entity"); + } + + const auto client = ent.entnum; + + if (game::g_entities[client].client == nullptr) + { + throw std::runtime_error("Not a player entity"); + } + + return {(game::g_entities[client].client->flags & 4) != 0}; + }); + utils::hook::jump(0x56C8EB, call_builtin_stub); utils::hook::jump(0x56CBDC, call_builtin_method_stub); } diff --git a/src/component/userinfo.cpp b/src/component/userinfo.cpp index 3fe1635..9f4c742 100644 --- a/src/component/userinfo.cpp +++ b/src/component/userinfo.cpp @@ -110,7 +110,7 @@ namespace userinfo return {}; }); - gsc::method::add("resetname", [](const game::scr_entref_t ent, const gsc::function_args& args) -> scripting::script_value + gsc::method::add("resetname", [](const game::scr_entref_t ent, const gsc::function_args&) -> scripting::script_value { if (ent.classnum != 0) { @@ -150,7 +150,7 @@ namespace userinfo return {}; }); - gsc::method::add("resetclantag", [](const game::scr_entref_t ent, const gsc::function_args& args) -> scripting::script_value + gsc::method::add("resetclantag", [](const game::scr_entref_t ent, const gsc::function_args&) -> scripting::script_value { if (ent.classnum != 0) { @@ -170,7 +170,7 @@ namespace userinfo return {}; }); - gsc::method::add("removeclantag", [](const game::scr_entref_t ent, const gsc::function_args& args) -> scripting::script_value + gsc::method::add("removeclantag", [](const game::scr_entref_t ent, const gsc::function_args&) -> scripting::script_value { if (ent.classnum != 0) { diff --git a/src/dllmain.cpp b/src/dllmain.cpp index c84d121..323e9f2 100644 --- a/src/dllmain.cpp +++ b/src/dllmain.cpp @@ -1,7 +1,7 @@ #include #include "loader/component_loader.hpp" -BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) +BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*lpReserved*/) { if (ul_reason_for_call == DLL_PROCESS_ATTACH) { diff --git a/src/game/scripting/execution.cpp b/src/game/scripting/execution.cpp index 7099cc1..9e1769f 100644 --- a/src/game/scripting/execution.cpp +++ b/src/game/scripting/execution.cpp @@ -269,8 +269,6 @@ namespace scripting { return get_custom_field(entity, field); } - - return {}; } unsigned int make_array() diff --git a/tools/windows/premake5.exe b/tools/windows/premake5.exe index 9048d51..c73da1f 100644 Binary files a/tools/windows/premake5.exe and b/tools/windows/premake5.exe differ