Prompt page string field length adjustment; check empty named tag before prompt search

This commit is contained in:
mazmazz 2018-11-10 09:38:32 -05:00
parent e1e94c3af2
commit a197c19742
3 changed files with 13 additions and 10 deletions

View File

@ -1641,11 +1641,11 @@ static void readtextpromptpage(MYFILE *f, INT32 num, INT32 pagenum)
// HACK: Add yellow control char now
// so the drawing function doesn't call it repeatedly
char name[32];
char name[34];
name[0] = '\x82'; // color yellow
name[1] = 0;
strncat(name, word2, 31);
name[31] = 0;
strncat(name, word2, 33);
name[33] = 0;
// Replace _ with ' '
for (i = 0; i < 32 && name[i]; i++)
@ -1728,7 +1728,7 @@ static void readtextpromptpage(MYFILE *f, INT32 num, INT32 pagenum)
}
}
else if (fastcmp(word, "TAG"))
strncpy(textprompts[num]->page[pagenum].tag, word2, 25);
strncpy(textprompts[num]->page[pagenum].tag, word2, 33);
else if (fastcmp(word, "NEXTPROMPT"))
textprompts[num]->page[pagenum].nextprompt = usi;
else if (fastcmp(word, "NEXTPAGE"))

View File

@ -174,8 +174,8 @@ extern cutscene_t *cutscenes[128];
typedef struct
{
char tag[25]; // page tag (24 chars due to texture concatenating)
char name[32]; // narrator name
char tag[33]; // page tag
char name[34]; // narrator name, extra char for color
char iconname[8]; // narrator icon lump
boolean rightside; // narrator side, false = left, true = right
boolean iconflip; // narrator flip icon horizontally

View File

@ -2236,14 +2236,17 @@ void F_StartTextPrompt(INT32 promptnum, INT32 pagenum, mobj_t *mo, UINT16 postex
void F_StartTextPromptByNamedTag(char *tag, mobj_t *mo, UINT16 postexectag, boolean blockcontrols, boolean freezerealtime)
{
INT32 promptnum, pagenum;
char realtag[25];
char realtag[33];
strncpy(realtag, tag, 25);
realtag[24] = 0;
if (!tag || !tag[0])
return;
strncpy(realtag, tag, 33);
realtag[32] = 0;
// \todo hardcoded tutorial mode behavior: concat control mode (fps, platform, custom) to end of input tag
if (tutorialmode)
strncat(realtag, "FPS", 25);
strncat(realtag, "FPS", 33);
for (promptnum = 0; promptnum < MAX_PROMPTS; promptnum++)
{