PicToStart implementation; fix NumPrompts limitation error

This commit is contained in:
mazmazz 2018-11-12 23:16:24 -05:00
parent d31b4b792b
commit eb7718bfeb
3 changed files with 10 additions and 6 deletions

View file

@ -1653,6 +1653,8 @@ static void readtextpromptpage(MYFILE *f, INT32 num, INT32 pagenum)
}
else if (fastcmp(word, "PICTOLOOP"))
textprompts[num]->page[pagenum].pictoloop = (UINT8)i;
else if (fastcmp(word, "PICTOSTART"))
textprompts[num]->page[pagenum].pictostart = (UINT8)i;
else if (fastcmp(word, "PICSMETAPAGE"))
{
if (usi && usi <= textprompts[num]->numpages)
@ -1663,6 +1665,7 @@ static void readtextpromptpage(MYFILE *f, INT32 num, INT32 pagenum)
textprompts[num]->page[pagenum].numpics = textprompts[num]->page[metapagenum].numpics;
textprompts[num]->page[pagenum].picmode = textprompts[num]->page[metapagenum].picmode;
textprompts[num]->page[pagenum].pictoloop = textprompts[num]->page[metapagenum].pictoloop;
textprompts[num]->page[pagenum].pictostart = textprompts[num]->page[metapagenum].pictostart;
for (picid = 0; picid < MAX_PROMPT_PICS; picid++)
{
@ -3601,11 +3604,11 @@ static void DEH_LoadDehackedFile(MYFILE *f)
}
else if (fastcmp(word, "PROMPT"))
{
if (i > 0 && i < 257)
if (i > 0 && i < MAX_PROMPTS)
readtextprompt(f, i - 1);
else
{
deh_warning("Prompt number %d out of range (1 - 256)", i);
deh_warning("Prompt number %d out of range (1 - %d)", i, MAX_PROMPTS);
ignorelines(f);
}
}
@ -8281,7 +8284,7 @@ struct {
{"V_CHARCOLORSHIFT",V_CHARCOLORSHIFT},
{"V_ALPHASHIFT",V_ALPHASHIFT},
//Kick Reasons
{"KR_KICK",KR_KICK},
{"KR_PINGLIMIT",KR_PINGLIMIT},

View file

@ -186,6 +186,7 @@ typedef struct
UINT8 numpics;
UINT8 picmode; // sequence mode after displaying last pic, 0 = persist, 1 = loop, 2 = destroy
UINT8 pictoloop; // if picmode == loop, which pic to loop to?
UINT8 pictostart; // initial pic number to show
char picname[MAX_PROMPT_PICS][8];
UINT8 pichires[MAX_PROMPT_PICS];
UINT16 xcoord[MAX_PROMPT_PICS]; // gfx

View file

@ -2137,7 +2137,7 @@ static void F_PreparePageText(char *pagetext)
static void F_AdvanceToNextPage(void)
{
UINT8 nextprompt = textprompts[cutnum]->page[scenenum].nextprompt,
INT32 nextprompt = textprompts[cutnum]->page[scenenum].nextprompt,
nextpage = textprompts[cutnum]->page[scenenum].nextpage,
oldcutnum = cutnum;
@ -2178,7 +2178,7 @@ static void F_AdvanceToNextPage(void)
F_PreparePageText(textprompts[cutnum]->page[scenenum].text);
// gfx
picnum = 0;
picnum = textprompts[cutnum]->page[scenenum].pictostart;
numpics = textprompts[cutnum]->page[scenenum].numpics;
picmode = textprompts[cutnum]->page[scenenum].picmode;
pictoloop = textprompts[cutnum]->page[scenenum].pictoloop > 0 ? textprompts[cutnum]->page[scenenum].pictoloop - 1 : 0;
@ -2266,7 +2266,7 @@ void F_StartTextPrompt(INT32 promptnum, INT32 pagenum, mobj_t *mo, UINT16 postex
F_PreparePageText(textprompts[cutnum]->page[scenenum].text);
// gfx
picnum = 0;
picnum = textprompts[cutnum]->page[scenenum].pictostart;
numpics = textprompts[cutnum]->page[scenenum].numpics;
picmode = textprompts[cutnum]->page[scenenum].picmode;
pictoloop = textprompts[cutnum]->page[scenenum].pictoloop > 0 ? textprompts[cutnum]->page[scenenum].pictoloop - 1 : 0;