From cae0793e7fd6723f1f62a5e04897e3a25edee0fb Mon Sep 17 00:00:00 2001 From: FutureRave Date: Mon, 21 Nov 2022 18:08:27 +0000 Subject: [PATCH] refactor(cmd): add support for cmds + cleanup --- .github/workflows/build.yml | 2 +- premake5.lua | 9 ++------- src/client/component/branding.cpp | 2 +- src/client/component/network.cpp | 3 ++- src/client/component/network.hpp | 1 - src/client/component/party.cpp | 4 ++-- src/client/component/party.hpp | 2 -- src/client/component/scheduler.cpp | 1 - src/client/component/splash.cpp | 1 + src/client/component/steam_proxy.cpp | 5 +++-- src/client/component/steam_proxy.hpp | 1 - src/client/game/game.cpp | 7 +++++++ src/client/game/game.hpp | 7 +++++++ src/client/game/symbols.hpp | 3 +-- src/client/std_include.hpp | 2 +- src/client/steam/interfaces/friends.cpp | 5 +++-- src/client/steam/interfaces/matchmaking_servers.cpp | 6 +++++- src/client/steam/interfaces/ugc.cpp | 3 +++ 18 files changed, 39 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b130dd74..b3b96c66 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,7 +39,7 @@ jobs: uses: microsoft/setup-msbuild@v1.1.3 - name: Generate project files - run: tools/premake5 vs2022 --ci-build + run: tools/premake5 vs2022 - name: Set up problem matching uses: ammaraskar/msvc-problem-matcher@master diff --git a/premake5.lua b/premake5.lua index 5130f021..f1e054d5 100644 --- a/premake5.lua +++ b/premake5.lua @@ -77,11 +77,6 @@ newoption { description = "Enable development builds of the client." } -newoption { - trigger = "ci-build", - description = "Enable CI builds of the client." -} - newaction { trigger = "version", description = "Returns the version string for the current commit of the source code.", @@ -249,7 +244,7 @@ workspace "boiii" defines {"DEV_BUILD"} end - if _OPTIONS["ci-build"] then + if os.getenv("CI") then defines {"CI"} end @@ -262,7 +257,7 @@ workspace "boiii" filter "configurations:Release" optimize "Size" buildoptions {"/GL"} - linkoptions { "/IGNORE:4702", "/LTCG" } + linkoptions {"/IGNORE:4702", "/LTCG"} defines {"NDEBUG"} flags {"FatalCompileWarnings"} filter {} diff --git a/src/client/component/branding.cpp b/src/client/component/branding.cpp index d6167021..c56659be 100644 --- a/src/client/component/branding.cpp +++ b/src/client/component/branding.cpp @@ -77,7 +77,7 @@ namespace branding std::string str = "BOIII: " VERSION; //str += "\n\n" + get_connectivity_info(); - game::R_AddCmdDrawText(str.data(), 0x7FFFFFFF, font, static_cast(x), + game::R_AddCmdDrawText(str.data(), std::numeric_limits::max(), font, static_cast(x), y + static_cast(font[2]) * scale, scale, scale, 0.0f, color, game::ITEM_TEXTSTYLE_NORMAL); } diff --git a/src/client/component/network.cpp b/src/client/component/network.cpp index d2eba869..8379f9c4 100644 --- a/src/client/component/network.cpp +++ b/src/client/component/network.cpp @@ -1,5 +1,4 @@ #include -#include "network.hpp" #include "loader/component_loader.hpp" #include "scheduler.hpp" @@ -9,6 +8,8 @@ #include #include +#include "network.hpp" + namespace network { namespace diff --git a/src/client/component/network.hpp b/src/client/component/network.hpp index 3014cc15..aba46009 100644 --- a/src/client/component/network.hpp +++ b/src/client/component/network.hpp @@ -1,5 +1,4 @@ #pragma once -#include "game/game.hpp" namespace network { diff --git a/src/client/component/party.cpp b/src/client/component/party.cpp index c843f170..57afa938 100644 --- a/src/client/component/party.cpp +++ b/src/client/component/party.cpp @@ -1,11 +1,11 @@ #include #include "loader/component_loader.hpp" +#include "game/game.hpp" +#include "steam/steam.hpp" #include "party.hpp" #include "network.hpp" #include "scheduler.hpp" -#include "game/game.hpp" -#include "steam/steam.hpp" #include #include diff --git a/src/client/component/party.hpp b/src/client/component/party.hpp index dfd278c7..b26ed164 100644 --- a/src/client/component/party.hpp +++ b/src/client/component/party.hpp @@ -1,6 +1,4 @@ #pragma once - -#include #include namespace party diff --git a/src/client/component/scheduler.cpp b/src/client/component/scheduler.cpp index 23978d64..0c75b321 100644 --- a/src/client/component/scheduler.cpp +++ b/src/client/component/scheduler.cpp @@ -5,7 +5,6 @@ #include "game/game.hpp" -#include #include #include #include diff --git a/src/client/component/splash.cpp b/src/client/component/splash.cpp index dd8aaa6b..70ac2855 100644 --- a/src/client/component/splash.cpp +++ b/src/client/component/splash.cpp @@ -1,5 +1,6 @@ #include #include "loader/component_loader.hpp" + #include "splash.hpp" #include "resource.hpp" diff --git a/src/client/component/steam_proxy.cpp b/src/client/component/steam_proxy.cpp index 9aae3f66..c1f91f59 100644 --- a/src/client/component/steam_proxy.cpp +++ b/src/client/component/steam_proxy.cpp @@ -1,7 +1,5 @@ #include #include "loader/component_loader.hpp" -#include "steam_proxy.hpp" -#include "scheduler.hpp" #include #include @@ -12,6 +10,9 @@ #include "steam/interface.hpp" #include "steam/steam.hpp" +#include "steam_proxy.hpp" +#include "scheduler.hpp" + namespace steam_proxy { namespace diff --git a/src/client/component/steam_proxy.hpp b/src/client/component/steam_proxy.hpp index b9709aab..16b45e85 100644 --- a/src/client/component/steam_proxy.hpp +++ b/src/client/component/steam_proxy.hpp @@ -1,5 +1,4 @@ #pragma once -#include namespace steam_proxy { diff --git a/src/client/game/game.cpp b/src/client/game/game.cpp index 7250a2dd..2412e404 100644 --- a/src/client/game/game.cpp +++ b/src/client/game/game.cpp @@ -19,4 +19,11 @@ namespace game }(); return base; } + + CmdArgs* cmd_args_t::operator->() const + { + return Sys_GetTLS()->cmdArgs; + } + + cmd_args_t cmd_args; } diff --git a/src/client/game/game.hpp b/src/client/game/game.hpp index 4410d479..7c49978c 100644 --- a/src/client/game/game.hpp +++ b/src/client/game/game.hpp @@ -50,6 +50,13 @@ namespace game private: size_t address_; }; + + struct cmd_args_t + { + CmdArgs* operator->() const; + }; + + extern cmd_args_t cmd_args; } inline size_t operator"" _g(const size_t val) diff --git a/src/client/game/symbols.hpp b/src/client/game/symbols.hpp index 4cf6548b..f1b445ce 100644 --- a/src/client/game/symbols.hpp +++ b/src/client/game/symbols.hpp @@ -6,8 +6,7 @@ namespace game { -#define Com_Error(code, fmt, ...) \ - Com_Error_(__FILE__, __LINE__, code, fmt, ##__VA_ARGS__) +#define Com_Error(code, fmt, ...) Com_Error_(__FILE__, __LINE__, code, fmt, ##__VA_ARGS__) // CL WEAK symbol #define RAPIDJSON_NOEXCEPT -#define RAPIDJSON_ASSERT(cond) if(cond); else throw std::runtime_error("rapidjson assert fail"); +#define RAPIDJSON_ASSERT(cond) if (cond); else throw std::runtime_error("rapidjson assert fail"); #include #include diff --git a/src/client/steam/interfaces/friends.cpp b/src/client/steam/interfaces/friends.cpp index 2d6f8c9d..14479d5f 100644 --- a/src/client/steam/interfaces/friends.cpp +++ b/src/client/steam/interfaces/friends.cpp @@ -1,8 +1,9 @@ #include #include "../steam.hpp" -#include "component/steam_proxy.hpp" -//#include +#include + +#include "component/steam_proxy.hpp" namespace steam { diff --git a/src/client/steam/interfaces/matchmaking_servers.cpp b/src/client/steam/interfaces/matchmaking_servers.cpp index 13ffbe28..cb2d612c 100644 --- a/src/client/steam/interfaces/matchmaking_servers.cpp +++ b/src/client/steam/interfaces/matchmaking_servers.cpp @@ -1,8 +1,12 @@ #include #include "../steam.hpp" + +#include "game/game.hpp" + #include "component/party.hpp" #include "component/network.hpp" -#include "utils/string.hpp" + +#include namespace steam { diff --git a/src/client/steam/interfaces/ugc.cpp b/src/client/steam/interfaces/ugc.cpp index eaacb52a..9f3eedca 100644 --- a/src/client/steam/interfaces/ugc.cpp +++ b/src/client/steam/interfaces/ugc.cpp @@ -1,5 +1,8 @@ #include #include "../steam.hpp" + +#include + #include "component/steam_proxy.hpp" namespace steam