Subversion Repositories eduke32

Rev

Rev 5047 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5047 Rev 5063
Line 2397... Line 2397...
2397
    }
2397
    }
2398
2398
2399
    return 0;
2399
    return 0;
2400
}
2400
}
2401
2401
-
 
2402
static void C_ReplaceQuoteSubstring(const size_t q, char const * const query, char const * const replacement)
-
 
2403
{
-
 
2404
    size_t querylength = Bstrlen(query);
-
 
2405
-
 
2406
    for (int i = MAXQUOTELEN - querylength - 2; i >= 0; i--)
-
 
2407
        if (Bstrncmp(&ScriptQuotes[q][i], query, querylength) == 0)
-
 
2408
        {
-
 
2409
            Bmemset(tempbuf, 0, sizeof(tempbuf));
-
 
2410
            Bstrncpy(tempbuf, ScriptQuotes[q], i);
-
 
2411
            Bstrcat(tempbuf, replacement);
-
 
2412
            Bstrcat(tempbuf, &ScriptQuotes[q][i + querylength]);
-
 
2413
            Bstrncpy(ScriptQuotes[q], tempbuf, MAXQUOTELEN - 1);
-
 
2414
            i = MAXQUOTELEN - querylength - 2;
-
 
2415
        }
-
 
2416
}
-
 
2417
2402
void C_InitQuotes(void)
2418
void C_InitQuotes(void)
2403
{
2419
{
2404
    for (int i = 0; i < 128; i++) C_AllocQuote(i);
2420
    for (int i = 0; i < 128; i++) C_AllocQuote(i);
2405
2421
2406
#ifdef EDUKE32_TOUCH_DEVICES
2422
#ifdef EDUKE32_TOUCH_DEVICES
2407
    ScriptQuotes[QUOTE_DEAD] = 0;
2423
    ScriptQuotes[QUOTE_DEAD] = 0;
2408
#else
2424
#else
2409
    for (int i = MAXQUOTELEN - 7; i >= 0; i--)
2425
    char const * const replacement_USE = "USE";
2410
        if (Bstrncmp(&ScriptQuotes[QUOTE_DEAD][i], "SPACE", 5) == 0)
2426
    if (!Bstrstr(ScriptQuotes[QUOTE_DEAD], replacement_USE))
2411
        {
2427
    {
2412
            Bmemset(tempbuf, 0, sizeof(tempbuf));
-
 
2413
            Bstrncpy(tempbuf, ScriptQuotes[QUOTE_DEAD], i);
2428
        C_ReplaceQuoteSubstring(QUOTE_DEAD, "SPACE", replacement_USE);
2414
            Bstrcat(tempbuf, "USE");
-
 
2415
            Bstrcat(tempbuf, &ScriptQuotes[QUOTE_DEAD][i + 5]);
2429
        C_ReplaceQuoteSubstring(QUOTE_DEAD, "OPEN", replacement_USE);
2416
            Bstrncpy(ScriptQuotes[QUOTE_DEAD], tempbuf, MAXQUOTELEN - 1);
2430
        C_ReplaceQuoteSubstring(QUOTE_DEAD, "ANY BUTTON", replacement_USE);
2417
            i = MAXQUOTELEN - 7;
-
 
2418
        }
2431
    }
2419
#endif
2432
#endif
2420
2433
2421
    // most of these are based on Blood, obviously
2434
    // most of these are based on Blood, obviously
2422
    const char *PlayerObituaries[] =
2435
    const char *PlayerObituaries[] =