[TextRenderer]: Changed subtitle width for console ui.
This commit is contained in:
parent
564261f844
commit
410ca08a27
@ -419,6 +419,56 @@ namespace Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int TextRenderer::SubtitleCalculateWidth(int width)
|
||||||
|
{
|
||||||
|
if (Dvars::console_menu_style->current.enabled)
|
||||||
|
return width - 100;
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
void __declspec(naked) TextRenderer::CG_SubtitlePrintStub1()
|
||||||
|
{
|
||||||
|
const static uint32_t retn_addr = 0x420854;
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
mov eax, ds:7FDDD4h
|
||||||
|
mov eax, [eax + 0Ch];
|
||||||
|
|
||||||
|
push eax;
|
||||||
|
pushad;
|
||||||
|
push eax;
|
||||||
|
call SubtitleCalculateWidth;
|
||||||
|
add esp, 4;
|
||||||
|
mov [esp + 0x20], eax;
|
||||||
|
popad
|
||||||
|
pop eax
|
||||||
|
|
||||||
|
mov edx, eax;
|
||||||
|
|
||||||
|
jmp retn_addr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void __declspec(naked) TextRenderer::CG_SubtitlePrintStub2()
|
||||||
|
{
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
mov edx, ds:7F777Ch
|
||||||
|
mov edx, [edx + 0Ch];
|
||||||
|
|
||||||
|
push edx;
|
||||||
|
pushad;
|
||||||
|
push edx;
|
||||||
|
call SubtitleCalculateWidth;
|
||||||
|
add esp, 4;
|
||||||
|
mov [esp + 0x20], edx;
|
||||||
|
popad;
|
||||||
|
pop edx;
|
||||||
|
|
||||||
|
retn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TextRenderer::TextRenderer()
|
TextRenderer::TextRenderer()
|
||||||
{
|
{
|
||||||
Utils::Hook(0x56E613, R_TextWidth_Stub01, HOOK_JUMP).install()->quick();
|
Utils::Hook(0x56E613, R_TextWidth_Stub01, HOOK_JUMP).install()->quick();
|
||||||
@ -447,5 +497,11 @@ namespace Components
|
|||||||
Utils::Hook(0x56F90C, UI_GetFontHandleStub8, HOOK_JUMP).install()->quick();
|
Utils::Hook(0x56F90C, UI_GetFontHandleStub8, HOOK_JUMP).install()->quick();
|
||||||
Utils::Hook(0x57056A, UI_GetFontHandleStub9, HOOK_JUMP).install()->quick();
|
Utils::Hook(0x57056A, UI_GetFontHandleStub9, HOOK_JUMP).install()->quick();
|
||||||
Utils::Hook(0x570800, UI_GetFontHandleStub10, HOOK_JUMP).install()->quick();
|
Utils::Hook(0x570800, UI_GetFontHandleStub10, HOOK_JUMP).install()->quick();
|
||||||
|
|
||||||
|
// Hooks the subtitle width
|
||||||
|
Utils::Hook::Nop(0x420841, 8);
|
||||||
|
Utils::Hook::Nop(0x42084B, 9);
|
||||||
|
Utils::Hook(0x420841, CG_SubtitlePrintStub1, HOOK_JUMP).install()->quick();
|
||||||
|
Utils::Hook(0x42084B, CG_SubtitlePrintStub2, HOOK_CALL).install()->quick();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -27,6 +27,7 @@ namespace Components
|
|||||||
static void CG_DrawPlayerWeaponLowAmmoWarningStub();
|
static void CG_DrawPlayerWeaponLowAmmoWarningStub();
|
||||||
static const char* CG_DrawPlayerWeaponLowAmmoKey(const char* pszInputBuffer, const char* pszMessageType, int errType);
|
static const char* CG_DrawPlayerWeaponLowAmmoKey(const char* pszInputBuffer, const char* pszMessageType, int errType);
|
||||||
static void UI_GetKeyBindingLocalizedStringStub();
|
static void UI_GetKeyBindingLocalizedStringStub();
|
||||||
|
static int SubtitleCalculateWidth(int width);
|
||||||
|
|
||||||
static void UI_GetFontHandleStub1();
|
static void UI_GetFontHandleStub1();
|
||||||
static void UI_GetFontHandleStub2();
|
static void UI_GetFontHandleStub2();
|
||||||
@ -39,6 +40,9 @@ namespace Components
|
|||||||
static void UI_GetFontHandleStub9();
|
static void UI_GetFontHandleStub9();
|
||||||
static void UI_GetFontHandleStub10();
|
static void UI_GetFontHandleStub10();
|
||||||
|
|
||||||
|
static void CG_SubtitlePrintStub1();
|
||||||
|
static void CG_SubtitlePrintStub2();
|
||||||
|
|
||||||
static int R_TextWidth_Hk(const char* text, int maxChars, Game::Font_s* font);
|
static int R_TextWidth_Hk(const char* text, int maxChars, Game::Font_s* font);
|
||||||
static float DrawHudIcon(const char* text, const Game::Font_s* font, const float x, const float y, const float sinAngle, const float cosAngle, const float xScale, const float yScale, Game::GfxColor color);
|
static float DrawHudIcon(const char* text, const Game::Font_s* font, const float x, const float y, const float sinAngle, const float cosAngle, const float xScale, const float yScale, Game::GfxColor color);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user