Skip to content

Commit

Permalink
Fixed BUG #1497853 'Quickload - hintmessage issue'
Browse files Browse the repository at this point in the history
This was due to overflowing the buffer used for displaying messages. We now split the message into multiple parts (and lines) if the section of string is larger than the buffer.

Fixed BUG #1497854 'Quickload - unrecognised key'
This was due to the fact that Doomsday was correctly calling the ccmd handler for message responses with any keys bound to those controls. The problem was that we didn't check for them in the ccmd handler.
  • Loading branch information
danij committed Jun 10, 2006
1 parent a8bc079 commit c726ecc
Showing 1 changed file with 35 additions and 16 deletions.
51 changes: 35 additions & 16 deletions doomsday/Src/Common/mn_menu.c
Expand Up @@ -1695,11 +1695,13 @@ void M_SetMenuMatrix(float time)
*/
void M_Drawer(void)
{
#define BUFSIZE 80

static short x;
static short y;
short i;
short max;
char string[40];
char string[BUFSIZE];
int start;
float scale;
int w, h, off_x, off_y;
Expand Down Expand Up @@ -1743,14 +1745,16 @@ void M_Drawer(void)
if(messageToPrint)
{
start = 0;

y = 100 - M_StringHeight(messageString, hu_font_a) / 2;
while(*(messageString + start))
{
for(i = 0; i < strlen(messageString + start); i++)
if(*(messageString + start + i) == '\n')
if(*(messageString + start + i) == '\n' || i > BUFSIZE-1)
{
memset(string, 0, 40);
memset(string, 0, BUFSIZE);
strncpy(string, messageString + start, i);
string[BUFSIZE] = 0;
start += i + 1;
break;
}
Expand All @@ -1764,6 +1768,7 @@ void M_Drawer(void)
x = 160 - M_StringWidth(string, hu_font_a) / 2;
M_WriteText2(x, y, string, hu_font_a, cfg.menuColor2[0],
cfg.menuColor2[1], cfg.menuColor2[2], 1);

y += SHORT(hu_font_a[17].height);
}

Expand Down Expand Up @@ -1990,6 +1995,13 @@ boolean M_EditResponder(event_t *ev)
return false;
}

void M_EndAnyKeyMsg(void)
{
M_StopMessage();
M_ClearMenus();
S_LocalSound(menusnds[1], NULL);
}

/*
* This is the "fallback" responder, its the last stage in the event chain
* so if an event reaches here it means there was no suitable binding for it.
Expand Down Expand Up @@ -2017,9 +2029,7 @@ boolean M_Responder(event_t *ev)
// Handle "Press any key to continue" messages
if(messageToPrint && !messageNeedsInput)
{
M_StopMessage();
M_ClearMenus();
S_LocalSound(menusnds[1], NULL);
M_EndAnyKeyMsg();
return true;
}

Expand Down Expand Up @@ -4136,20 +4146,29 @@ DEFCC(CCmdMsgResponse)
{
if(messageToPrint)
{
if(!stricmp(argv[0], "messageyes"))
{
messageResponse = 1;
return true;
}
else if(!stricmp(argv[0], "messageno"))
// Handle "Press any key to continue" messages
if(!messageNeedsInput)
{
messageResponse = -1;
M_EndAnyKeyMsg();
return true;
}
else if(!stricmp(argv[0], "messagecancel"))
else
{
messageResponse = -2;
return true;
if(!stricmp(argv[0], "messageyes"))
{
messageResponse = 1;
return true;
}
else if(!stricmp(argv[0], "messageno"))
{
messageResponse = -1;
return true;
}
else if(!stricmp(argv[0], "messagecancel"))
{
messageResponse = -2;
return true;
}
}
}

Expand Down

0 comments on commit c726ecc

Please sign in to comment.