Scoreboard stuff
This commit is contained in:
parent
2e4dd10c3e
commit
77506fff8d
2
deps/protobuf
vendored
2
deps/protobuf
vendored
@ -1 +1 @@
|
||||
Subproject commit 9aea0ef0cd836fb998d2eb27bd84897f3c9a14f6
|
||||
Subproject commit 44fdead9d2652f958cb6e7e29a6d871ef132bb4c
|
@ -249,7 +249,7 @@ namespace Components
|
||||
{
|
||||
// Frame limit
|
||||
static int lastFrame = 0;
|
||||
if ((Game::Com_Milliseconds() - lastFrame) < (1000 / NODE_FRAME_LOCK)) return;
|
||||
if ((Game::Com_Milliseconds() - lastFrame) < (1000 / NODE_FRAME_LOCK) || Game::Com_Milliseconds() < 5000) return;
|
||||
lastFrame = Game::Com_Milliseconds();
|
||||
|
||||
int registerCount = 0;
|
||||
|
@ -68,11 +68,47 @@ namespace Components
|
||||
}
|
||||
}
|
||||
|
||||
void ServerInfo::DrawScoreboardInfo(void* a1)
|
||||
{
|
||||
Game::Font* font = Game::R_RegisterFont("fonts/bigfont");
|
||||
void* cxt = Game::UI_GetContext(a1);
|
||||
|
||||
Network::Address address(reinterpret_cast<Game::netadr_t*>(0xA1E888));
|
||||
std::string addressText = address.GetString();
|
||||
if (addressText == "0.0.0.0:0") addressText = "Listen Server";
|
||||
|
||||
// get x positions
|
||||
float fontSize = 0.35f;
|
||||
float y = (480.0f - Dvar::Var("cg_scoreboardHeight").Get<float>()) * 0.5f;
|
||||
y += Dvar::Var("cg_scoreboardHeight").Get<float>() + 6.0f;
|
||||
|
||||
float x = 320.0f - Dvar::Var("cg_scoreboardWidth").Get<float>() * 0.5f;
|
||||
float x2 = 320.0f + Dvar::Var("cg_scoreboardWidth").Get<float>() * 0.5f;
|
||||
|
||||
Game::UI_DrawText(cxt, reinterpret_cast<const char*>(0x7ED3F8), 0x7FFFFFFF, font, x, y, 0, 0, fontSize, reinterpret_cast<float*>(0x747F34), 3);
|
||||
Game::UI_DrawText(cxt, addressText.data(), 0x7FFFFFFF, font, x2 - Game::UI_TextWidth(addressText.data(), 0, font, fontSize), y, 0, 0, fontSize, reinterpret_cast<float*>(0x747F34), 3);
|
||||
}
|
||||
|
||||
void __declspec(naked) ServerInfo::DrawScoreboardStub()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
push eax
|
||||
call ServerInfo::DrawScoreboardInfo
|
||||
pop eax
|
||||
mov ecx, 591B70h
|
||||
jmp ecx
|
||||
}
|
||||
}
|
||||
|
||||
ServerInfo::ServerInfo()
|
||||
{
|
||||
ServerInfo::PlayerContainer.CurrentPlayer = 0;
|
||||
ServerInfo::PlayerContainer.PlayerList.clear();
|
||||
|
||||
// Draw IP and hostname on the scoreboard
|
||||
Utils::Hook(0x4FC6EA, ServerInfo::DrawScoreboardStub, HOOK_CALL).Install()->Quick();
|
||||
|
||||
// Ignore native getStatus implementation
|
||||
Utils::Hook::Nop(0x62654E, 6);
|
||||
|
||||
|
@ -29,5 +29,8 @@ namespace Components
|
||||
static unsigned int GetPlayerCount();
|
||||
static const char* GetPlayerText(unsigned int index, int column);
|
||||
static void SelectPlayer(unsigned int index);
|
||||
|
||||
static void DrawScoreboardInfo(void* a1);
|
||||
static void DrawScoreboardStub();
|
||||
};
|
||||
}
|
||||
|
@ -141,6 +141,9 @@ namespace Game
|
||||
UI_AddMenuList_t UI_AddMenuList = (UI_AddMenuList_t)0x4533C0;
|
||||
UI_LoadMenus_t UI_LoadMenus = (UI_LoadMenus_t)0x641460;
|
||||
UI_DrawHandlePic_t UI_DrawHandlePic = (UI_DrawHandlePic_t)0x4D0EA0;
|
||||
UI_GetContext_t UI_GetContext = (UI_GetContext_t)0x4F8940;
|
||||
UI_TextWidth_t UI_TextWidth = (UI_TextWidth_t)0x6315C0;
|
||||
UI_DrawText_t UI_DrawText = (UI_DrawText_t)0x49C0D0;
|
||||
|
||||
Win_GetLanguage_t Win_GetLanguage = (Win_GetLanguage_t)0x45CBA0;
|
||||
|
||||
@ -255,6 +258,16 @@ namespace Game
|
||||
return gameType;
|
||||
}
|
||||
|
||||
float UI_GetScoreboardLeft(void* a1)
|
||||
{
|
||||
static int func = 0x590390;
|
||||
__asm
|
||||
{
|
||||
mov eax, [esp + 4h]
|
||||
call func
|
||||
}
|
||||
}
|
||||
|
||||
const char *DB_GetXAssetName(XAsset *asset)
|
||||
{
|
||||
if (!asset) return "";
|
||||
|
@ -329,6 +329,15 @@ namespace Game
|
||||
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);
|
||||
extern UI_DrawHandlePic_t UI_DrawHandlePic;
|
||||
|
||||
typedef void* (__cdecl * UI_GetContext_t)(void*);
|
||||
extern UI_GetContext_t UI_GetContext;
|
||||
|
||||
typedef int(__cdecl * UI_TextWidth_t)(const char *text, int maxChars, Font *font, float scale);
|
||||
extern UI_TextWidth_t UI_TextWidth;
|
||||
|
||||
typedef void(__cdecl * UI_DrawText_t)(void* scrPlace, const char *text, int maxChars, Font *font, float x, float y, int horzAlign, int vertAlign, float scale, const float *color, int style);
|
||||
extern UI_DrawText_t UI_DrawText;
|
||||
|
||||
typedef const char * (__cdecl * Win_GetLanguage_t)();
|
||||
extern Win_GetLanguage_t Win_GetLanguage;
|
||||
|
||||
@ -381,6 +390,7 @@ namespace Game
|
||||
const char* TabeLookup(StringTable* stringtable, int row, int column);
|
||||
const char* UI_LocalizeMapName(const char* mapName);
|
||||
const char* UI_LocalizeGameType(const char* gameType);
|
||||
float UI_GetScoreboardLeft(void*);
|
||||
|
||||
const char *DB_GetXAssetName(XAsset *asset);
|
||||
XAssetType DB_GetXAssetNameType(const char* name);
|
||||
|
Loading…
Reference in New Issue
Block a user