mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-02-02 20:01:23 +00:00
Expand the quote #13 auto-replacement to catch "OPEN" and "ANY BUTTON" in addition to "SPACE".
git-svn-id: https://svn.eduke32.com/eduke32@5063 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
27777f96c3
commit
6e64696605
1 changed files with 23 additions and 10 deletions
|
@ -2399,6 +2399,22 @@ int32_t C_AllocQuote(int32_t qnum)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void C_ReplaceQuoteSubstring(const size_t q, char const * const query, char const * const replacement)
|
||||||
|
{
|
||||||
|
size_t querylength = Bstrlen(query);
|
||||||
|
|
||||||
|
for (int i = MAXQUOTELEN - querylength - 2; i >= 0; i--)
|
||||||
|
if (Bstrncmp(&ScriptQuotes[q][i], query, querylength) == 0)
|
||||||
|
{
|
||||||
|
Bmemset(tempbuf, 0, sizeof(tempbuf));
|
||||||
|
Bstrncpy(tempbuf, ScriptQuotes[q], i);
|
||||||
|
Bstrcat(tempbuf, replacement);
|
||||||
|
Bstrcat(tempbuf, &ScriptQuotes[q][i + querylength]);
|
||||||
|
Bstrncpy(ScriptQuotes[q], tempbuf, MAXQUOTELEN - 1);
|
||||||
|
i = MAXQUOTELEN - querylength - 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void C_InitQuotes(void)
|
void C_InitQuotes(void)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 128; i++) C_AllocQuote(i);
|
for (int i = 0; i < 128; i++) C_AllocQuote(i);
|
||||||
|
@ -2406,16 +2422,13 @@ void C_InitQuotes(void)
|
||||||
#ifdef EDUKE32_TOUCH_DEVICES
|
#ifdef EDUKE32_TOUCH_DEVICES
|
||||||
ScriptQuotes[QUOTE_DEAD] = 0;
|
ScriptQuotes[QUOTE_DEAD] = 0;
|
||||||
#else
|
#else
|
||||||
for (int i = MAXQUOTELEN - 7; i >= 0; i--)
|
char const * const replacement_USE = "USE";
|
||||||
if (Bstrncmp(&ScriptQuotes[QUOTE_DEAD][i], "SPACE", 5) == 0)
|
if (!Bstrstr(ScriptQuotes[QUOTE_DEAD], replacement_USE))
|
||||||
{
|
{
|
||||||
Bmemset(tempbuf, 0, sizeof(tempbuf));
|
C_ReplaceQuoteSubstring(QUOTE_DEAD, "SPACE", replacement_USE);
|
||||||
Bstrncpy(tempbuf, ScriptQuotes[QUOTE_DEAD], i);
|
C_ReplaceQuoteSubstring(QUOTE_DEAD, "OPEN", replacement_USE);
|
||||||
Bstrcat(tempbuf, "USE");
|
C_ReplaceQuoteSubstring(QUOTE_DEAD, "ANY BUTTON", replacement_USE);
|
||||||
Bstrcat(tempbuf, &ScriptQuotes[QUOTE_DEAD][i + 5]);
|
}
|
||||||
Bstrncpy(ScriptQuotes[QUOTE_DEAD], tempbuf, MAXQUOTELEN - 1);
|
|
||||||
i = MAXQUOTELEN - 7;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// most of these are based on Blood, obviously
|
// most of these are based on Blood, obviously
|
||||||
|
|
Loading…
Reference in a new issue