1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-11-06 08:35:54 +00:00

CMessages::GetTokenPadKeyString

This commit is contained in:
Sergeanur 2021-01-22 05:49:17 +02:00
parent b5deee823c
commit 8dab92d158
5 changed files with 85 additions and 15 deletions

View file

@ -358,7 +358,7 @@ CFont::PrintChar(float x, float y, wchar c)
CSprite2d::AddToBuffer( CSprite2d::AddToBuffer(
CRect(x, y + RenderState.scaleY * 4.0f, CRect(x, y + RenderState.scaleY * 4.0f,
x + 32.0f * RenderState.scaleY * xScale * 0.96f, x + 32.0f * RenderState.scaleY * xScale * 0.96f,
y + 4.0f * RenderState.scaleY * + 16.0f * RenderState.scaleY), y + 4.0f * RenderState.scaleY + 16.0f * RenderState.scaleY),
RenderState.color, RenderState.color,
xoff / 16.0f, yoff / 12.8f + 0.0021f, xoff / 16.0f, yoff / 12.8f + 0.0021f,
(xoff + 1.0f) / 16.0f - 0.001f, yoff / 12.8f + 0.0021f, (xoff + 1.0f) / 16.0f - 0.001f, yoff / 12.8f + 0.0021f,

View file

@ -188,24 +188,25 @@ struct
{ "", "" }, { "", "" },
{ "", "" }, { "", "" },
{ "radardisc", "radardisc" }, { "radardisc", "radardisc" },
{ "radardiscback", "" },
{ "", "" }, { "", "" },
{ "", "" }, { "", "" },
{ "", "" }, { "", "" },
{ "", "" }, { "", "" },
{ "", "" }, { "", "" },
{ "", "" }, { "bar_inside1dark", "" },
{ "", "" }, { "bar_inside2dark", "" },
{ "", "" }, { "hudnumbers", "" },
{ "", "" }, { "bar_inside1", "" },
{ "", "" }, { "bar_inside2", "" },
{ "", "" }, { "bar_outline", "" },
{ "", "" },
{ "sitesniper", "sitesniperm" }, { "sitesniper", "sitesniperm" },
{ "siteM16", "siteM16m" }, { "siteM16", "siteM16m" },
{ "sitelaser", "sitelaserm" }, { "sitelaser", "sitelaserm" },
{ "laserdot", "laserdotm" }, { "laserdot", "laserdotm" },
{ "viewfinder_128", "viewfinder_128m" }, { "viewfinder_128", "viewfinder_128m" },
{ "bleeder", "" } { "bleeder", "" },
{ "gren_rem", "noMaskNeeded" }
}; };
RwTexture *gpSniperSightTex; RwTexture *gpSniperSightTex;

View file

@ -44,7 +44,7 @@ enum eSprites
HUD_LASERDOT, HUD_LASERDOT,
HUD_VIEWFINDER, HUD_VIEWFINDER,
HUD_BLEEDER, HUD_BLEEDER,
NUM_HUD_SPRITES = 69, NUM_HUD_SPRITES = 70,
}; };
extern float BigMessageInUse[6]; extern float BigMessageInUse[6];

View file

@ -11,6 +11,8 @@
#include "Font.h" #include "Font.h"
#include "Pad.h"
// --MIAMI: file done // --MIAMI: file done
tMessage CMessages::BriefMessages[NUMBRIEFMESSAGES]; tMessage CMessages::BriefMessages[NUMBRIEFMESSAGES];
@ -443,6 +445,64 @@ CMessages::InsertStringInString(wchar *str1, wchar *str2)
str1[i++] = '\0'; str1[i++] = '\0';
} }
int
CMessages::GetTokenPadKeyString(const wchar *in, wchar *out)
{
wchar str[256];
memset(str, 0, sizeof(str));
str[0] = 'C';
// TODO: there was a switch here but that's stupid
str[1] = CPad::GetPad(0)->Mode + 48;
while (*in != '~') in++;
in++;
int i = 1;
while (*in != '~')
str[1+i++] = *(in++);
wchar *text = TheText.Get(UnicodeToAscii(str));
if (!text) return i;
while (text[0] != '\0')
{
if (text[0] == '~')
{
switch (text[1])
{
case 'L':
*(out++) = 'M';
break;
case 'N':
*(out++) = 'O';
break;
case 'O':
*(out++) = 227;
break;
case 'R':
*(out++) = 'S';
break;
case 'S':
*(out++) = 225;
break;
case 'T':
*(out++) = 224;
break;
case 'X':
*(out++) = 226;
break;
default:
break;
}
text += 3;
}
else {
*(out++) = *(text++);
}
}
return i;
}
void void
CMessages::InsertPlayerControlKeysInString(wchar *str) CMessages::InsertPlayerControlKeysInString(wchar *str)
{ {
@ -452,7 +512,7 @@ CMessages::InsertPlayerControlKeysInString(wchar *str)
if (!str) return; if (!str) return;
uint16 strSize = GetWideStringLength(str); uint16 strSize = GetWideStringLength(str);
memset(keybuf, 0, 256*sizeof(wchar)); memset(keybuf, 0, 256*sizeof(wchar)); // not memset? :O
wchar *_outstr = outstr; wchar *_outstr = outstr;
for (i = 0; i < strSize;) { for (i = 0; i < strSize;) {
@ -462,9 +522,16 @@ CMessages::InsertPlayerControlKeysInString(wchar *str)
#else #else
if (str[i] == '~' && str[i + 1] == 'k' && str[i + 2] == '~') { if (str[i] == '~' && str[i + 1] == 'k' && str[i + 2] == '~') {
#endif #endif
memset(keybuf, 0, 256 * sizeof(wchar));
i += 4; i += 4;
bool done = false; i += GetTokenPadKeyString(&str[i], keybuf) + 1;
for (int32 cont = 0; cont < MAX_CONTROLLERACTIONS && !done; cont++) { uint16 keybuf_size = GetWideStringLength(keybuf);
for (uint16 j = 0; j < keybuf_size; j++) {
*(_outstr++) = keybuf[j];
keybuf[j] = '\0';
}
/*for (int32 cont = 0; cont < MAX_CONTROLLERACTIONS && !done; cont++) {
uint16 contSize = GetWideStringLength(ControlsManager.m_aActionNames[cont]); uint16 contSize = GetWideStringLength(ControlsManager.m_aActionNames[cont]);
if (contSize != 0) { if (contSize != 0) {
if (WideStringCompare(&str[i], ControlsManager.m_aActionNames[cont], contSize)) { if (WideStringCompare(&str[i], ControlsManager.m_aActionNames[cont], contSize)) {
@ -478,7 +545,7 @@ CMessages::InsertPlayerControlKeysInString(wchar *str)
i += contSize + 1; i += contSize + 1;
} }
} }
} }*/
} else { } else {
*(_outstr++) = str[i++]; *(_outstr++) = str[i++];
} }
@ -824,3 +891,4 @@ CMessages::ClearThisBigPrintNow(uint32 id)
CHud::m_BigMessage[id][0] = '\0'; CHud::m_BigMessage[id][0] = '\0';
BigMessageInUse[id] = 0.0f; BigMessageInUse[id] = 0.0f;
} }

View file

@ -62,6 +62,7 @@ public:
static void ClearThisBigPrint(wchar *str); static void ClearThisBigPrint(wchar *str);
static void ClearAllMessagesDisplayedByGame(void); static void ClearAllMessagesDisplayedByGame(void);
static void ClearThisBigPrintNow(uint32 id); static void ClearThisBigPrintNow(uint32 id);
static int GetTokenPadKeyString(const wchar *in, wchar *out);
// unused or cut // unused or cut
//static void AddMessageSoonWithString(wchar*, uint32, uint16, wchar*); //static void AddMessageSoonWithString(wchar*, uint32, uint16, wchar*);