diff --git a/src/Components/Loader.cpp b/src/Components/Loader.cpp index 08ed4485..b1af5759 100644 --- a/src/Components/Loader.cpp +++ b/src/Components/Loader.cpp @@ -69,7 +69,6 @@ namespace Components Loader::Register(new Renderer()); Loader::Register(new UIFeeder()); Loader::Register(new UIScript()); - Loader::Register(new AntiCheat()); Loader::Register(new Changelog()); Loader::Register(new Dedicated()); Loader::Register(new Discovery()); @@ -105,6 +104,7 @@ namespace Components Loader::Register(new Elevators()); Loader::Register(new ClientCommand()); Loader::Register(new ScriptExtension()); + Loader::Register(new Branding()); Loader::Pregame = false; } diff --git a/src/Components/Loader.hpp b/src/Components/Loader.hpp index 9d521bba..52c40528 100644 --- a/src/Components/Loader.hpp +++ b/src/Components/Loader.hpp @@ -99,7 +99,6 @@ namespace Components #include "Modules/RawFiles.hpp" #include "Modules/Renderer.hpp" #include "Modules/UIFeeder.hpp" -#include "Modules/AntiCheat.hpp" #include "Modules/Changelog.hpp" #include "Modules/Dedicated.hpp" #include "Modules/Discovery.hpp" @@ -134,6 +133,6 @@ namespace Components #include "Modules/Movement.hpp" #include "Modules/Elevators.hpp" #include "Modules/ClientCommand.hpp" - #include "Modules/Gamepad.hpp" #include "Modules/ScriptExtension.hpp" +#include "Modules/Branding.hpp" diff --git a/src/Components/Modules/Branding.cpp b/src/Components/Modules/Branding.cpp new file mode 100644 index 00000000..fbc4a9c9 --- /dev/null +++ b/src/Components/Modules/Branding.cpp @@ -0,0 +1,118 @@ +#include + +namespace Components +{ + Dvar::Var Branding::CGDrawVersion; + Dvar::Var Branding::CGDrawVersionX; + Dvar::Var Branding::CGDrawVersionY; + Game::dvar_t** Branding::Version = reinterpret_cast(0x1AD7930); + + void Branding::CG_DrawVersion() + { + // Default values + constexpr auto fontScale = 0.25f; + constexpr auto maxChars = std::numeric_limits::max(); + // Default colours + constexpr Game::vec4_t shadowColor = {0.0f, 0.0f, 0.0f, 0.7f}; + constexpr Game::vec4_t color = {0.4f, 0.7f, 1.0f, 0.7f}; + + auto* const placement = Game::ScrPlace_GetUnsafeFullPlacement(); + auto* const font = Game::UI_GetFontHandle(placement, 0, 0.5f); + + const auto width = Game::UI_TextWidth((*Version)->current.string, 0, font, fontScale); + const auto height = Game::UI_TextHeight(font, fontScale); + + Game::UI_DrawText(placement, (*Version)->current.string, maxChars, font, 1.0f - (CGDrawVersionX.get() + width), + 1.0f - (CGDrawVersionY.get() + height), 3, 3, fontScale, shadowColor, 0); + Game::UI_DrawText(placement, (*Version)->current.string, maxChars, font, (0.0f - width) - CGDrawVersionX.get(), + (0.0f - height) - CGDrawVersionY.get(), 3, 3, fontScale, color, 0); + } + + void Branding::CG_DrawVersion_Hk(int localClientNum) + { + Utils::Hook::Call(0x4EFF80)(localClientNum); + + if (Branding::CGDrawVersion.get()) + { + Branding::CG_DrawVersion(); + } + } + + const char* Branding::GetBuildNumber() + { + static char buf[128]; // Length the game uses + + const auto* data = "latest " __DATE__ " " __TIME__; + sprintf_s(buf, sizeof(buf), "%s %s", SHORTVERSION, data); + + return buf; + } + + // Use IW4x Branding + void Branding::Dvar_SetVersionString(const Game::dvar_t* dvar, const char* /*value*/) + { +#ifdef _DEBUG + const auto* buildType = "IW4x_DEV MP"; +#else + const auto* buildType = "IW4x MP"; +#endif + + // IW4x is technically a beta + const auto* result = Utils::String::VA("%s %s build %s %s", + buildType, "(Beta)", Branding::GetBuildNumber(), reinterpret_cast(0x7170A0)); + + Utils::Hook::Call(0x4A9580)(dvar, result); + } + + Game::dvar_t* Branding::Dvar_RegisterUIBuildLocation(const char* dvarName, + float /*x*/, float /*y*/, float min, float max, int /*flags*/, const char* description) + { +#ifdef _DEBUG + constexpr auto flag = Game::dvar_flag::DVAR_NONE; +#else + constexpr auto flag = Game::dvar_flag::DVAR_READONLY; +#endif + return Game::Dvar_RegisterVec2(dvarName, -60.0f, 474.0f, min, max, flag, description); + } + + void Branding::RegisterBrandingDvars() + { +#ifdef _DEBUG + constexpr auto value = true; +#else + constexpr auto value = false; +#endif + Branding::CGDrawVersion = Dvar::Register("cg_drawVersion", value, + Game::dvar_flag::DVAR_NONE, "Draw the game version"); + Branding::CGDrawVersionX = Dvar::Register("cg_drawVersionX", 50.0f, + 0.0f, 512.0f, Game::dvar_flag::DVAR_NONE, "X offset for the version string"); + Branding::CGDrawVersionY = Dvar::Register("cg_drawVersionY", 18.0f, + 0.0f, 512.0f, Game::dvar_flag::DVAR_NONE, "Y offset for the version string"); + } + + Branding::Branding() + { + Dvar::OnInit(Branding::RegisterBrandingDvars); + + // UI version string + Utils::Hook::Set(0x43F73B, "IW4x: " VERSION); + + // Short version dvar + Utils::Hook::Set(0x60BD91, SHORTVERSION); + + // Console version string + Utils::Hook::Set(0x4B12BB, "IW4x " VERSION " (built " __DATE__ " " __TIME__ ")"); + + // Version string color + static Game::vec4_t buildLocColor = {1.0f, 1.0f, 1.0f, 0.8f}; + Utils::Hook::Set(0x43F710, buildLocColor); + + // Shift ui version string to the left (ui_buildlocation) + Utils::Hook(0x6310A0, Branding::Dvar_RegisterUIBuildLocation, HOOK_CALL).install()->quick(); // Dvar_RegisterVec2 + + Utils::Hook(0x60BD81, Branding::Dvar_SetVersionString, HOOK_CALL).install()->quick(); + + // Hook CG_DrawFullScreenDebugOverlays so we may render the version when it's appropriate + Utils::Hook(0x5AC975, Branding::CG_DrawVersion_Hk, HOOK_CALL).install()->quick(); + } +} diff --git a/src/Components/Modules/Branding.hpp b/src/Components/Modules/Branding.hpp new file mode 100644 index 00000000..a0735a53 --- /dev/null +++ b/src/Components/Modules/Branding.hpp @@ -0,0 +1,26 @@ +#pragma once + +namespace Components +{ + class Branding : public Component + { + public: + Branding(); + + private: + static Dvar::Var CGDrawVersion; + static Dvar::Var CGDrawVersionX; + static Dvar::Var CGDrawVersionY; + static Game::dvar_t** Version; + + static void CG_DrawVersion(); + static void CG_DrawVersion_Hk(int localClientNum); + + static const char* GetBuildNumber(); + static void Dvar_SetVersionString(const Game::dvar_t* dvar, const char* value); + + static Game::dvar_t* Dvar_RegisterUIBuildLocation(const char* dvarName, float x, float y, float min, float max, int flags, const char* description); + + static void RegisterBrandingDvars(); + }; +} diff --git a/src/Components/Modules/QuickPatch.cpp b/src/Components/Modules/QuickPatch.cpp index d8c1d1f6..adcf2415 100644 --- a/src/Components/Modules/QuickPatch.cpp +++ b/src/Components/Modules/QuickPatch.cpp @@ -348,12 +348,6 @@ namespace Components } } - Game::dvar_t* QuickPatch::Dvar_RegisterUIBuildLocation(const char* dvarName, - float /*x*/, float /*y*/, float min, float max, int /*flags*/, const char* description) - { - return Game::Dvar_RegisterVec2(dvarName, -60.0f, 474.0f, min, max, Game::DVAR_READONLY, description); - } - QuickPatch::QuickPatch() { // quitHard @@ -426,22 +420,6 @@ namespace Components // fs_basegame Utils::Hook::Set(0x6431D1, BASEGAME); - // UI version string - Utils::Hook::Set(0x43F73B, "IW4x: " VERSION); - - // console version string - Utils::Hook::Set(0x4B12BB, "IW4x " VERSION " (built " __DATE__ " " __TIME__ ")"); - - // version string - Utils::Hook::Set(0x60BD56, "IW4x (" VERSION ")"); - - // version string color - static Game::vec4_t buildLocColor = { 1.0f, 1.0f, 1.0f, 0.8f }; - Utils::Hook::Set(0x43F710, buildLocColor); - - // Shift ui version string to the left (ui_buildlocation) - Utils::Hook(0x6310A0, QuickPatch::Dvar_RegisterUIBuildLocation, HOOK_CALL).install()->quick(); - // console title if (ZoneBuilder::IsEnabled()) { @@ -462,9 +440,6 @@ namespace Components // sv_hostname Utils::Hook::Set(0x4D378B, "IW4Host"); - // shortversion - Utils::Hook::Set(0x60BD91, SHORTVERSION); - // console logo Utils::Hook::Set(0x428A66, BASEGAME "/images/logo.bmp"); diff --git a/src/Components/Modules/QuickPatch.hpp b/src/Components/Modules/QuickPatch.hpp index 6eac85a2..e3acc495 100644 --- a/src/Components/Modules/QuickPatch.hpp +++ b/src/Components/Modules/QuickPatch.hpp @@ -40,7 +40,5 @@ namespace Components static void CL_KeyEvent_OnEscape(); static void CL_KeyEvent_ConsoleEscape_Stub(); - - static Game::dvar_t* Dvar_RegisterUIBuildLocation(const char* dvarName, float x, float y, float min, float max, int flags, const char* description); }; } diff --git a/src/Components/Modules/Window.cpp b/src/Components/Modules/Window.cpp index a5669656..2a635678 100644 --- a/src/Components/Modules/Window.cpp +++ b/src/Components/Modules/Window.cpp @@ -88,7 +88,7 @@ namespace Components } } - void Window::DrawCursorStub(void *scrPlace, float x, float y, float w, float h, int horzAlign, int vertAlign, const float *color, Game::Material *material) + void Window::DrawCursorStub(Game::ScreenPlacement* scrPlace, float x, float y, float w, float h, int horzAlign, int vertAlign, const float* color, Game::Material* material) { if (Window::NativeCursor.get()) { diff --git a/src/Components/Modules/Window.hpp b/src/Components/Modules/Window.hpp index 37a97547..d170ceab 100644 --- a/src/Components/Modules/Window.hpp +++ b/src/Components/Modules/Window.hpp @@ -32,7 +32,7 @@ namespace Components static BOOL WINAPI MessageHandler(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); static int WINAPI ShowCursorHook(BOOL show); - static void DrawCursorStub(void *scrPlace, float x, float y, float w, float h, int horzAlign, int vertAlign, const float *color, Game::Material *material); + static void DrawCursorStub(Game::ScreenPlacement* scrPlace, float x, float y, float w, float h, int horzAlign, int vertAlign, const float* color, Game::Material* material); static void StyleHookStub(); static HWND WINAPI CreateMainWindow(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam); diff --git a/src/Game/Functions.cpp b/src/Game/Functions.cpp index 6e2ff06e..75d37d74 100644 --- a/src/Game/Functions.cpp +++ b/src/Game/Functions.cpp @@ -192,7 +192,7 @@ namespace Game Load_snd_alias_list_nameArray_t Load_snd_alias_list_nameArray = Load_snd_alias_list_nameArray_t(0x4499F0); Menus_CloseAll_t Menus_CloseAll = Menus_CloseAll_t(0x4BA5B0); - Menus_CloseRequest_t Menus_CloseRequest = Menus_CloseRequest_t(0x430D50); + Menus_CloseRequest_t Menus_CloseRequest = Menus_CloseRequest_t(0x430D50); Menus_OpenByName_t Menus_OpenByName = Menus_OpenByName_t(0x4CCE60); Menus_FindByName_t Menus_FindByName = Menus_FindByName_t(0x487240); Menu_IsVisible_t Menu_IsVisible = Menu_IsVisible_t(0x4D77D0); @@ -378,6 +378,7 @@ namespace Game UI_DrawHandlePic_t UI_DrawHandlePic = UI_DrawHandlePic_t(0x4D0EA0); ScrPlace_GetActivePlacement_t ScrPlace_GetActivePlacement = ScrPlace_GetActivePlacement_t(0x4F8940); UI_TextWidth_t UI_TextWidth = UI_TextWidth_t(0x6315C0); + UI_TextHeight_t UI_TextHeight = UI_TextHeight_t(0x4C8630); UI_DrawText_t UI_DrawText = UI_DrawText_t(0x49C0D0); UI_GetFontHandle_t UI_GetFontHandle = UI_GetFontHandle_t(0x4AEA60); ScrPlace_ApplyRect_t ScrPlace_ApplyRect = ScrPlace_ApplyRect_t(0x454E20); @@ -432,7 +433,7 @@ namespace Game int* svs_clientCount = reinterpret_cast(0x31D938C); client_t* svs_clients = reinterpret_cast(0x31D9390); - UiContext *uiContext = reinterpret_cast(0x62E2858); + UiContext* uiContext = reinterpret_cast(0x62E2858); int* arenaCount = reinterpret_cast(0x62E6930); mapArena_t* arenas = reinterpret_cast(0x62E6934); @@ -460,10 +461,6 @@ namespace Game gentity_t* g_entities = reinterpret_cast(0x18835D8); - int* level_num_entities = reinterpret_cast(0x1A831B0); - int* level_time = reinterpret_cast(0x1A83554); - int* level_scriptPrintChannel = reinterpret_cast(0x1A860FC); - netadr_t* connectedHost = reinterpret_cast(0xA1E888); SOCKET* ip_socket = reinterpret_cast(0x64A3008); @@ -534,9 +531,11 @@ namespace Game XModel** cached_models = reinterpret_cast(0x1AA20C8); + vec3_t* CorrectSolidDeltas = reinterpret_cast(0x739BB8); // Count 26 + FastCriticalSection* db_hashCritSect = reinterpret_cast(0x16B8A54); - vec3_t* CorrectSolidDeltas = reinterpret_cast(0x739BB8); // Count 26 + ScreenPlacement* scrPlaceFullUnsafe = reinterpret_cast(0x1084460); void Sys_LockRead(FastCriticalSection* critSect) { @@ -1102,6 +1101,11 @@ namespace Game return GraphGetValueFromFraction(graph->knotCount, graph->knots, fraction) * graph->scale; } + ScreenPlacement* ScrPlace_GetUnsafeFullPlacement() + { + return scrPlaceFullUnsafe; + } + #pragma optimize("", off) __declspec(naked) float UI_GetScoreboardLeft(void* /*a1*/) { @@ -1576,7 +1580,7 @@ namespace Game __declspec(naked) void AimAssist_UpdateAdsLerp(const AimInput* /*aimInput*/) { - __asm + __asm { mov eax, [esp + 0x4] mov ebx, 0x569AA0 diff --git a/src/Game/Functions.hpp b/src/Game/Functions.hpp index 80610630..a8951af3 100644 --- a/src/Game/Functions.hpp +++ b/src/Game/Functions.hpp @@ -420,7 +420,7 @@ namespace Game typedef void(__cdecl * LargeLocalInit_t)(); extern LargeLocalInit_t LargeLocalInit; - typedef bool(__cdecl * Load_Stream_t)(bool atStreamStart, const void *ptr, unsigned int size); + typedef bool(__cdecl * Load_Stream_t)(bool atStreamStart, const void* ptr, unsigned int size); extern Load_Stream_t Load_Stream; typedef void(__cdecl * Load_XString_t)(bool atStreamStart); @@ -429,64 +429,64 @@ namespace Game typedef void(__cdecl * Load_XModelPtr_t)(bool atStreamStart); extern Load_XModelPtr_t Load_XModelPtr; - typedef void(__cdecl * Load_XModelSurfsFixup_t)(XModelSurfs **, XModelLodInfo *); + typedef void(__cdecl * Load_XModelSurfsFixup_t)(XModelSurfs**, XModelLodInfo*); extern Load_XModelSurfsFixup_t Load_XModelSurfsFixup; typedef void(__cdecl * Load_XStringArray_t)(bool atStreamStart, int count); extern Load_XStringArray_t Load_XStringArray; - typedef void(__cdecl * Load_XStringCustom_t)(const char **str); + typedef void(__cdecl * Load_XStringCustom_t)(const char** str); extern Load_XStringCustom_t Load_XStringCustom; - typedef void(__cdecl *Load_FxEffectDefHandle_t)(bool atStreamStart); + typedef void(__cdecl * Load_FxEffectDefHandle_t)(bool atStreamStart); extern Load_FxEffectDefHandle_t Load_FxEffectDefHandle; - typedef void(__cdecl *Load_FxElemDef_t)(bool atStreamStart); + typedef void(__cdecl * Load_FxElemDef_t)(bool atStreamStart); extern Load_FxElemDef_t Load_FxElemDef; - typedef void(__cdecl *Load_GfxImagePtr_t)(bool atStreamStart); + typedef void(__cdecl * Load_GfxImagePtr_t)(bool atStreamStart); extern Load_GfxImagePtr_t Load_GfxImagePtr; - typedef void(__cdecl *Load_GfxTextureLoad_t)(bool atStreamStart); + typedef void(__cdecl * Load_GfxTextureLoad_t)(bool atStreamStart); extern Load_GfxTextureLoad_t Load_GfxTextureLoad; - typedef int(__cdecl *Load_Texture_t)(GfxImageLoadDef **loadDef, GfxImage *image); + typedef int(__cdecl * Load_Texture_t)(GfxImageLoadDef** loadDef, GfxImage* image); extern Load_Texture_t Load_Texture; typedef void(__cdecl * Load_SndAliasCustom_t)(snd_alias_list_t** var); extern Load_SndAliasCustom_t Load_SndAliasCustom; - typedef void(__cdecl *Load_MaterialHandle_t)(bool atStreamStart); + typedef void(__cdecl * Load_MaterialHandle_t)(bool atStreamStart); extern Load_MaterialHandle_t Load_MaterialHandle; - typedef void(__cdecl *Load_PhysCollmapPtr_t)(bool atStreamStart); + typedef void(__cdecl * Load_PhysCollmapPtr_t)(bool atStreamStart); extern Load_PhysCollmapPtr_t Load_PhysCollmapPtr; - typedef void(__cdecl *Load_PhysPresetPtr_t)(bool atStreamStart); + typedef void(__cdecl * Load_PhysPresetPtr_t)(bool atStreamStart); extern Load_PhysPresetPtr_t Load_PhysPresetPtr; - typedef void(__cdecl *Load_TracerDefPtr_t)(bool atStreamStart); + typedef void(__cdecl * Load_TracerDefPtr_t)(bool atStreamStart); extern Load_TracerDefPtr_t Load_TracerDefPtr; - typedef void(__cdecl *Load_snd_alias_list_nameArray_t)(bool atStreamStart, int count); + typedef void(__cdecl * Load_snd_alias_list_nameArray_t)(bool atStreamStart, int count); extern Load_snd_alias_list_nameArray_t Load_snd_alias_list_nameArray; - typedef void(__cdecl * Menus_CloseAll_t)(UiContext *dc); + typedef void(__cdecl * Menus_CloseAll_t)(UiContext* dc); extern Menus_CloseAll_t Menus_CloseAll; - typedef void(__cdecl * Menus_CloseRequest_t)(UiContext *dc, menuDef_t* menu); - extern Menus_CloseRequest_t Menus_CloseRequest; + typedef void(__cdecl * Menus_CloseRequest_t)(UiContext *dc, menuDef_t* menu); + extern Menus_CloseRequest_t Menus_CloseRequest; - typedef int(__cdecl * Menus_OpenByName_t)(UiContext *dc, const char *p); + typedef int(__cdecl * Menus_OpenByName_t)(UiContext* dc, const char* p); extern Menus_OpenByName_t Menus_OpenByName; - typedef menuDef_t *(__cdecl * Menus_FindByName_t)(UiContext *dc, const char *name); + typedef menuDef_t *(__cdecl * Menus_FindByName_t)(UiContext* dc, const char* name); extern Menus_FindByName_t Menus_FindByName; - typedef bool(__cdecl * Menu_IsVisible_t)(UiContext *dc, menuDef_t *menu); + typedef bool(__cdecl * Menu_IsVisible_t)(UiContext* dc, menuDef_t* menu); extern Menu_IsVisible_t Menu_IsVisible; - typedef bool(__cdecl * Menus_MenuIsInStack_t)(UiContext *dc, menuDef_t *menu); + typedef bool(__cdecl * Menus_MenuIsInStack_t)(UiContext* dc, menuDef_t* menu); extern Menus_MenuIsInStack_t Menus_MenuIsInStack; typedef menuDef_t*(__cdecl * Menu_GetFocused_t)(UiContext* ctx); @@ -498,16 +498,16 @@ namespace Game typedef bool(__cdecl * UI_KeyEvent_t)(int clientNum, int key, int down); extern UI_KeyEvent_t UI_KeyEvent; - typedef const char* (__cdecl * UI_SafeTranslateString_t)(const char* reference); + typedef const char*(__cdecl * UI_SafeTranslateString_t)(const char* reference); extern UI_SafeTranslateString_t UI_SafeTranslateString; typedef void(__cdecl * UI_ReplaceConversions_t)(const char* sourceString, ConversionArguments* arguments, char* outputString, size_t outputStringSize); extern UI_ReplaceConversions_t UI_ReplaceConversions; - typedef void(__cdecl * MSG_Init_t)(msg_t *buf, char *data, int length); + typedef void(__cdecl * MSG_Init_t)(msg_t* buf, char* data, int length); extern MSG_Init_t MSG_Init; - typedef void(__cdecl * MSG_ReadData_t)(msg_t *msg, void *data, int len); + typedef void(__cdecl * MSG_ReadData_t)(msg_t* msg, void* data, int len); extern MSG_ReadData_t MSG_ReadData; typedef int(__cdecl * MSG_ReadLong_t)(msg_t* msg); @@ -894,16 +894,16 @@ namespace Game typedef void(__cdecl * Sys_SuspendOtherThreads_t)(); extern Sys_SuspendOtherThreads_t Sys_SuspendOtherThreads; - typedef void(__cdecl * UI_AddMenuList_t)(UiContext *dc, MenuList *menuList, int close); + typedef void(__cdecl * UI_AddMenuList_t)(UiContext* dc, MenuList* menuList, int close); extern UI_AddMenuList_t UI_AddMenuList; typedef uiMenuCommand_t(__cdecl * UI_GetActiveMenu_t)(int localClientNum); extern UI_GetActiveMenu_t UI_GetActiveMenu; - typedef char* (__cdecl * UI_CheckStringTranslation_t)(char*, char*); + typedef char*(__cdecl * UI_CheckStringTranslation_t)(char*, char*); extern UI_CheckStringTranslation_t UI_CheckStringTranslation; - typedef MenuList *(__cdecl * UI_LoadMenus_t)(const char *menuFile, int imageTrack); + typedef MenuList*(__cdecl * UI_LoadMenus_t)(const char* menuFile, int imageTrack); extern UI_LoadMenus_t UI_LoadMenus; typedef void(__cdecl * UI_UpdateArenas_t)(); @@ -912,15 +912,18 @@ namespace Game typedef void(__cdecl * UI_SortArenas_t)(); extern UI_SortArenas_t UI_SortArenas; - typedef void(__cdecl * UI_DrawHandlePic_t)(/*ScreenPlacement*/void *scrPlace, float x, float y, float w, float h, int horzAlign, int vertAlign, const float *color, Material *material); + typedef void(__cdecl * UI_DrawHandlePic_t)(ScreenPlacement* scrPlace, float x, float y, float w, float h, int horzAlign, int vertAlign, const float* color, Material* material); extern UI_DrawHandlePic_t UI_DrawHandlePic; typedef ScreenPlacement*(__cdecl * ScrPlace_GetActivePlacement_t)(int localClientNum); extern ScrPlace_GetActivePlacement_t ScrPlace_GetActivePlacement; - typedef int(__cdecl * UI_TextWidth_t)(const char *text, int maxChars, Font_s *font, float scale); + typedef int(__cdecl * UI_TextWidth_t)(const char* text, int maxChars, Font_s *font, float scale); extern UI_TextWidth_t UI_TextWidth; + typedef int(__cdecl * UI_TextHeight_t)(Font_s* font, float scale); + extern UI_TextHeight_t UI_TextHeight; + typedef void(__cdecl * UI_DrawText_t)(const ScreenPlacement* scrPlace, const char* text, int maxChars, Font_s* font, float x, float y, int horzAlign, int vertAlign, float scale, const float* color, int style); extern UI_DrawText_t UI_DrawText; @@ -1006,7 +1009,7 @@ namespace Game extern source_t **sourceFiles; extern keywordHash_t **menuParseKeywordHash; - extern UiContext *uiContext; + extern UiContext* uiContext; extern int* arenaCount; extern mapArena_t* arenas; @@ -1036,10 +1039,6 @@ namespace Game constexpr auto ENTITYNUM_NONE = MAX_GENTITIES - 1; extern gentity_t* g_entities; - extern int* level_num_entities; - extern int* level_time; - extern int* level_scriptPrintChannel; - extern netadr_t* connectedHost; extern SOCKET* ip_socket; @@ -1117,11 +1116,17 @@ namespace Game extern FastCriticalSection* db_hashCritSect; + extern ScreenPlacement* scrPlaceFullUnsafe; + + extern level_locals_t* level; + void Sys_LockRead(FastCriticalSection* critSect); void Sys_UnlockRead(FastCriticalSection* critSect); XModel* G_GetModel(int index); + ScreenPlacement* ScrPlace_GetUnsafeFullPlacement(); + XAssetHeader ReallocateAssetPool(XAssetType type, unsigned int newSize); void Menu_FreeItemMemory(Game::itemDef_s* item); void Menu_SetNextCursorItem(Game::UiContext* ctx, Game::menuDef_t* currentMenu, int unk = 1);