diff options
author | Sergeanur <s.anureev@yandex.ua> | 2021-02-10 07:57:51 +0100 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2021-02-10 07:57:51 +0100 |
commit | 12330e38cb3c2a023bc1327cb89afd19efed0a43 (patch) | |
tree | e1db738c39b18b532ef4fe5ac67d8d0cc25b5064 /src/render/Font.cpp | |
parent | fix (diff) | |
download | re3-12330e38cb3c2a023bc1327cb89afd19efed0a43.tar re3-12330e38cb3c2a023bc1327cb89afd19efed0a43.tar.gz re3-12330e38cb3c2a023bc1327cb89afd19efed0a43.tar.bz2 re3-12330e38cb3c2a023bc1327cb89afd19efed0a43.tar.lz re3-12330e38cb3c2a023bc1327cb89afd19efed0a43.tar.xz re3-12330e38cb3c2a023bc1327cb89afd19efed0a43.tar.zst re3-12330e38cb3c2a023bc1327cb89afd19efed0a43.zip |
Diffstat (limited to 'src/render/Font.cpp')
-rw-r--r-- | src/render/Font.cpp | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/src/render/Font.cpp b/src/render/Font.cpp index 0f5930ee..35ed2e56 100644 --- a/src/render/Font.cpp +++ b/src/render/Font.cpp @@ -289,11 +289,26 @@ CFont::Initialise(void) SetDropShadowPosition(0); CTxdStore::PopCurrentTxd(); +#if !defined(GAMEPAD_MENU) && defined(BUTTON_ICONS) + // loaded in CMenuManager with GAMEPAD_MENU defined + LoadButtons("MODELS/X360BTNS.TXD"); +#endif +} + #ifdef BUTTON_ICONS - if (int file = CFileMgr::OpenFile("MODELS/X360BTNS.TXD")) { +void +CFont::LoadButtons(const char *txdPath) +{ + if (int file = CFileMgr::OpenFile(txdPath)) { CFileMgr::CloseFile(file); - ButtonsSlot = CTxdStore::AddTxdSlot("buttons"); - CTxdStore::LoadTxd(ButtonsSlot, "MODELS/X360BTNS.TXD"); + if (ButtonsSlot == -1) + ButtonsSlot = CTxdStore::AddTxdSlot("buttons"); + else { + for (int i = 0; i < MAX_BUTTON_ICONS; i++) + ButtonSprite[i].Delete(); + CTxdStore::RemoveTxd(ButtonsSlot); + } + CTxdStore::LoadTxd(ButtonsSlot, txdPath); CTxdStore::AddRef(ButtonsSlot); CTxdStore::PushCurrentTxd(); CTxdStore::SetCurrentTxd(ButtonsSlot); @@ -311,12 +326,22 @@ CFont::Initialise(void) ButtonSprite[BUTTON_R1].SetTexture("r1"); ButtonSprite[BUTTON_R2].SetTexture("r2"); ButtonSprite[BUTTON_R3].SetTexture("r3"); + ButtonSprite[BUTTON_RSTICK_UP].SetTexture("thumbryu"); + ButtonSprite[BUTTON_RSTICK_DOWN].SetTexture("thumbryd"); ButtonSprite[BUTTON_RSTICK_LEFT].SetTexture("thumbrxl"); ButtonSprite[BUTTON_RSTICK_RIGHT].SetTexture("thumbrxr"); CTxdStore::PopCurrentTxd(); } -#endif // BUTTON_ICONS + else { + if (ButtonsSlot != -1) { + for (int i = 0; i < MAX_BUTTON_ICONS; i++) + ButtonSprite[i].Delete(); + CTxdStore::RemoveTxdSlot(ButtonsSlot); + ButtonsSlot = -1; + } + } } +#endif // BUTTON_ICONS #ifdef MORE_LANGUAGES void @@ -369,6 +394,7 @@ CFont::Shutdown(void) for (int i = 0; i < MAX_BUTTON_ICONS; i++) ButtonSprite[i].Delete(); CTxdStore::RemoveTxdSlot(ButtonsSlot); + ButtonsSlot = -1; } #endif Sprite[0].Delete(); @@ -1437,6 +1463,8 @@ CFont::ParseToken(wchar* str, CRGBA &color, bool &flash, bool &bold) case 'J': PS2Symbol = BUTTON_R1; break; case 'V': PS2Symbol = BUTTON_R2; break; case 'C': PS2Symbol = BUTTON_R3; break; + case 'H': PS2Symbol = BUTTON_RSTICK_UP; break; + case 'L': PS2Symbol = BUTTON_RSTICK_DOWN; break; case '(': PS2Symbol = BUTTON_RSTICK_LEFT; break; case ')': PS2Symbol = BUTTON_RSTICK_RIGHT; break; #endif @@ -1488,6 +1516,8 @@ CFont::ParseToken(wchar *s, bool japShit) case 'J': PS2Symbol = BUTTON_R1; break; case 'V': PS2Symbol = BUTTON_R2; break; case 'C': PS2Symbol = BUTTON_R3; break; + case 'H': PS2Symbol = BUTTON_RSTICK_UP; break; + case 'L': PS2Symbol = BUTTON_RSTICK_DOWN; break; case '(': PS2Symbol = BUTTON_RSTICK_LEFT; break; case ')': PS2Symbol = BUTTON_RSTICK_RIGHT; break; #endif @@ -1612,6 +1642,8 @@ CFont::ParseToken(wchar *s) case 'J': PS2Symbol = BUTTON_R1; break; case 'V': PS2Symbol = BUTTON_R2; break; case 'C': PS2Symbol = BUTTON_R3; break; + case 'H': PS2Symbol = BUTTON_RSTICK_UP; break; + case 'L': PS2Symbol = BUTTON_RSTICK_DOWN; break; case '(': PS2Symbol = BUTTON_RSTICK_LEFT; break; case ')': PS2Symbol = BUTTON_RSTICK_RIGHT; break; #endif |