[UIScript]: Added new ownerdraws

This commit is contained in:
JerryALT 2024-03-29 20:04:02 +03:00
parent 2c353466ef
commit dd88caffb7

View File

@ -145,13 +145,102 @@ namespace Components
UIScript::UIScript() UIScript::UIScript()
{ {
UIScript::AddOwnerDraw(197, []([[maybe_unused]] float x, [[maybe_unused]] float y, [[maybe_unused]] float w, [[maybe_unused]] float h, // UI_LOGGEDINUSER
UIScript::AddOwnerDraw(272, []([[maybe_unused]] float x, [[maybe_unused]] float y, [[maybe_unused]] float w, [[maybe_unused]] float h,
[[maybe_unused]] int horzAlign, [[maybe_unused]] int vertAlign, [[maybe_unused]] float text_x, [[maybe_unused]] float text_y, [[maybe_unused]] float scale, [[maybe_unused]] int horzAlign, [[maybe_unused]] int vertAlign, [[maybe_unused]] float text_x, [[maybe_unused]] float text_y, [[maybe_unused]] float scale,
[[maybe_unused]] Game::Font_s* font, [[maybe_unused]] const float* color, [[maybe_unused]] Game::Material* material, [[maybe_unused]] int textStyle, [[maybe_unused]] Game::Font_s* font, [[maybe_unused]] const float* color, [[maybe_unused]] Game::Material* material, [[maybe_unused]] int textStyle,
[[maybe_unused]] int textAlignMode) [[maybe_unused]] int textAlignMode)
{ {
auto* const scrPlace = Game::ScrPlace_GetFullPlacement(); auto* const scrPlace = Game::ScrPlace_GetFullPlacement();
Game::UI_DrawText(scrPlace, std::string("Signed in as: "s + Utils::IO::ReadFile("players/profiles/active.txt")).c_str(), 128, font, x, y, horzAlign, vertAlign, scale, color, textStyle); std::string profileName = Utils::IO::ReadFile("players/profiles/active.txt");
const char* displayString = Game::UI_SafeTranslateString("IW3SP_MOD_LOC_MENU_SIGNEDINAS");
const char* localizedString = Game::UI_ReplaceConversionString(displayString, profileName.data());
Game::UI_DrawText(scrPlace, localizedString, 64, font, x, y, horzAlign, vertAlign, scale, color, textStyle);
});
// UI_GPAD_BUTTONS_SCHEME
UIScript::AddOwnerDraw(198, []([[maybe_unused]] float x, [[maybe_unused]] float y, [[maybe_unused]] float w, [[maybe_unused]] float h,
[[maybe_unused]] int horzAlign, [[maybe_unused]] int vertAlign, [[maybe_unused]] float text_x, [[maybe_unused]] float text_y, [[maybe_unused]] float scale,
[[maybe_unused]] Game::Font_s* font, [[maybe_unused]] const float* color, [[maybe_unused]] Game::Material* material, [[maybe_unused]] int textStyle,
[[maybe_unused]] int textAlignMode)
{
Gamepad::GetButtonLayout();
auto* const scrPlace = Game::ScrPlace_GetFullPlacement();
auto fontHandle = Game::UI_GetFontHandle(0, scrPlace, 0.3750f);
if (Dvars::gpad_style->current.enabled)
{
//SONY
Game::rectDef_s textRect{};
Game::rectDef_s rect{};
rect.x = 462.0f;
rect.y = 375.0f;
rect.w = 200.0f;
rect.horzAlign = 0;
rect.vertAlign = 0;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonA), rect.x, rect.y + 20.0f, scale, color, textStyle, textAlignMode, &textRect, 0, 0, 0);
rect.x = 452.0f; rect.y = 330.0f;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonB), rect.x, rect.y + 20.0f, scale, color, textStyle, textAlignMode, &textRect, 0, 0, 0);
rect.x = 459.0f; rect.y = 350.0f;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonX), rect.x, rect.y + 24.0f, scale, color, textStyle, textAlignMode, &textRect, 0, 0, 0);
rect.x = 450.0f; rect.y = 307.0f;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonY), rect.x, rect.y + 20.0f, scale, color, textStyle, textAlignMode, &textRect, 0, 0, 0);
rect.x = 0.0f; rect.y = 248.0f;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonBlack), rect.x, rect.y + 15.0f, scale, color, textStyle, 6, &textRect, 0, 0, 0); //R1/L1
rect.x = 442.0f; rect.y = 248.0f;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonWhite), rect.x + 7.0f, rect.y + 33.0f, scale, color, textStyle, textAlignMode, &textRect, 0, 0, 0); //R1/L1
rect.x = 20.0f; rect.y = 298.0f;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonLStick), rect.x, rect.y + 70.0f, scale, color, textStyle, 6, &textRect, 0, 0, 0);
rect.x = 7.0f; rect.y = 228.0f;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonLTrig), rect.x, rect.y + 15.0f, scale, color, textStyle, 6, &textRect, 0, 0, 0);
rect.x = 435.0f; rect.y = 228.0f;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonRTrig), rect.x + 7.0f, rect.y + 33.0f, scale, color, textStyle, textAlignMode, &textRect, 0, 0, 0);
rect.x = 307.0f; rect.y = 213.0f;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonStart), rect.x, rect.y + 45.0f, scale, color, textStyle, textAlignMode, &textRect, 0, 0, 0);
rect.x = 120.0f; rect.y = 213.0f;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonBack), rect.x, rect.y - 3.0f, scale, color, textStyle, 6, &textRect, 0, 0, 0);
rect.x = -20.0f; rect.y = 298.0f;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonDown), rect.x, rect.y + 25.0f, scale, color, textStyle, 6, &textRect, 0, 0, 0);
rect.x = 327.0f; rect.y = 404.0f;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonRStick), rect.x, rect.y + 33.0f, scale, color, textStyle, textAlignMode, &textRect, 0, 0, 0);
}
else
{
//XBOX
Game::rectDef_s textRect{};
Game::rectDef_s rect{};
rect.x = 467.0f;
rect.y = 348.0f;
rect.w = 200.0f;
rect.horzAlign = 0;
rect.vertAlign = 0;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonA), rect.x, rect.y + 12.0f, scale, color, textStyle, textAlignMode, &textRect, 0, 0, 0);
rect.x = 466.0f; rect.y = 326.0f;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonX), rect.x, rect.y + 12.0f, scale, color, textStyle, textAlignMode, &textRect, 0, 0, 0);
rect.x = 462.0f; rect.y = 303.0f;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonB), rect.x, rect.y + 16.0f, scale, color, textStyle, textAlignMode, &textRect, 0, 0, 0);
rect.x = 457.0f; rect.y = 278.0f;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonY), rect.x, rect.y + 16.0f, scale, color, textStyle, textAlignMode, &textRect, 0, 0, 0);
rect.x = 0.0f; rect.y = 248.0f;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonBlack), rect.x, rect.y, scale, color, textStyle, 6, &textRect, 0, 0, 0); //R1/L1
rect.x = 442.0f; rect.y = 248.0f;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonWhite), rect.x, rect.y + 18.0f, scale, color, textStyle, textAlignMode, &textRect, 0, 0, 0); //R1/L1
rect.x = 105.0f; rect.y = 417.0f;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonLStick), rect.x, rect.y, scale, color, textStyle, 6, &textRect, 0, 0, 0);
rect.x = 7.0f; rect.y = 228.0f;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonLTrig), rect.x, rect.y, scale, color, textStyle, 6, &textRect, 0, 0, 0);
rect.x = 435.0f; rect.y = 228.0f;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonRTrig), rect.x, rect.y + 18.0f, scale, color, textStyle, textAlignMode, &textRect, 0, 0, 0);
rect.x = 307.0f; rect.y = 213.0f;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonStart), rect.x, rect.y + 12.0f, scale, color, textStyle, textAlignMode, &textRect, 0, 0, 0);
rect.x = 120.0f; rect.y = 180.0f;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonBack), rect.x, rect.y, scale, color, textStyle, 6, &textRect, 0, 0, 0);
rect.x = -20.0f; rect.y = 298.0f;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonDown), rect.x, rect.y, scale, color, textStyle, 6, &textRect, 0, 0, 0);
rect.x = 327.0f; rect.y = 404.0f;
Game::DrawWrappedText(&rect, fontHandle, scrPlace, Game::UI_SafeTranslateString(Gamepad::buttonMappingLayout.buttonRStick), rect.x, rect.y + 16.0f, scale, color, textStyle, textAlignMode, &textRect, 0, 0, 0);
}
}); });
// UI_RunMenuScript "clearError" hooking // UI_RunMenuScript "clearError" hooking