Skip to content

Commit

Permalink
add colored font to modals; display modal for help
Browse files Browse the repository at this point in the history
  • Loading branch information
timbergeron committed Oct 29, 2024
1 parent 8c47e69 commit 54909e7
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Quake/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1510,7 +1510,7 @@ qboolean Cmd_ExecuteString (const char *text, cmd_source_t src)

if (Cmd_IsQuitMistype(Cmd_Argv(0))) // // woods -- #smartquit -- check for mistyped "quit" command
{
if (SCR_ModalMessage(va("you typed: %s\n\n do you want to quit? (y/n)\n", Cmd_Argv(0)), 0.0f))
if (SCR_ModalMessage(va("you typed: ^m%s^m\n\n do you want to quit? (^my^m/^mn^m)\n", Cmd_Argv(0)), 0.0f))
Host_Quit_f();
return true;
}
Expand Down
92 changes: 80 additions & 12 deletions Quake/gl_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -3495,38 +3495,106 @@ void SCR_EndLoadingPlaque (void)
const char *scr_notifystring;
qboolean scr_drawdialog;

void SCR_DrawNotifyString (void)
void SCR_DrawNotifyString (void) // woods add ^m support
{
const char *start;
int l;
int j;
int x, y;
int mask = 0; // Masking state
int last_char = 0; // Previous character

GL_SetCanvas (CANVAS_MENU); //johnfitz

start = scr_notifystring;

y = 200 * 0.35; //johnfitz -- stretched overlays

do
while (*start)
{
// scan the width of the line
for (l=0 ; l<40 ; l++)
// First pass: calculate visible length (excluding control sequences)
int visible_length = 0;
for (l = 0; l < 40; l++)
{
if (start[l] == '\n' || !start[l])
break;
x = (320 - l*8)/2; //johnfitz -- stretched overlays
for (j=0 ; j<l ; j++, x+=8)
Draw_Character (x, y, start[j]);

// Skip ^m sequences when calculating length
if (start[l] == '^' && l + 1 < 40 && start[l + 1] == 'm')
{
l++; // Skip both ^ and m
continue;
}
// Skip standalone ^ if it's not part of a valid sequence
if (start[l] == '^' && l + 1 < 40 && start[l + 1] != 'm')
{
continue;
}
visible_length++;
}

// Calculate starting x position based on visible length
x = (320 - visible_length * 8) / 2;

// Second pass: actual drawing
for (int j = 0; j < l;)
{
char c = start[j];

// Handle masking sequences
if (last_char == '^' && c == 'm')
{
mask ^= 128; // Toggle mask
last_char = 0;
j++;
continue;
}

if (c == '^')
{
last_char = '^';
j++;
continue;
}

if (last_char == '^' && c != 'm')
{
last_char = 0;
// Continue to draw the current character
}
else
{
last_char = 0;
}

// Apply mask if enabled
int num = c;
if (mask)
num = (num & 127) | 128;
else
num &= 127;

if (num == 32)
{
x += 8;
j++;
continue;
}

Draw_CharacterRGBA(x, y, num, CL_PLColours_Parse("0xffffff"), 1);
x += 8;
j++;
}

y += 8;

start += l;

while (*start && *start != '\n')
start++;

if (!*start)
break;
start++; // skip the \n
} while (1);
if (*start == '\n')
start++;
}
}

/*
Expand Down
1 change: 1 addition & 0 deletions Quake/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -3780,6 +3780,7 @@ void M_Menu_Help_f (void)
m_entersound = true;
help_page = 0;
IN_UpdateGrabs();
SCR_ModalMessage("The QSS-M webpage has been opened\nin your ^mweb browser^m\n\nMinimize QSS-M for further assistance", 3.5f); // woods
SDL_OpenURL("https://qssm.quakeone.com");
}

Expand Down

0 comments on commit 54909e7

Please sign in to comment.