Fixed centerprints with DP servers
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1541 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
9858ac6fdb
commit
dbd0c13069
1 changed files with 171 additions and 140 deletions
|
@ -167,13 +167,88 @@ CENTER PRINTING
|
|||
===============================================================================
|
||||
*/
|
||||
|
||||
qbyte scr_centerstring[MAX_SPLITS][1024];
|
||||
unsigned short scr_centerstring[MAX_SPLITS][1024];
|
||||
float scr_centertime_start[MAX_SPLITS]; // for slow victory printing
|
||||
float scr_centertime_off[MAX_SPLITS];
|
||||
int scr_center_lines[MAX_SPLITS];
|
||||
int scr_erase_lines[MAX_SPLITS];
|
||||
int scr_erase_center[MAX_SPLITS];
|
||||
|
||||
void CopyAndMarkup(unsigned short *dest, qbyte *src, int maxlength)
|
||||
{
|
||||
int ext = COLOR_WHITE<<8;
|
||||
int extstack[20];
|
||||
int extstackdepth = 0;
|
||||
|
||||
if (maxlength < 0)
|
||||
return; // ...
|
||||
|
||||
maxlength--;
|
||||
while(*src && maxlength>0)
|
||||
{
|
||||
if (*src == '^')
|
||||
{
|
||||
src++;
|
||||
if (*src >= '0' && *src <= '7')
|
||||
{
|
||||
ext = (*src++-'0')*256 | (ext&~CON_COLOURMASK);
|
||||
continue;
|
||||
}
|
||||
else if (*src == '8') //'half transparent'
|
||||
{
|
||||
src++;
|
||||
ext = (COLOR_WHITE)*256 | (ext&~CON_COLOURMASK);
|
||||
continue;
|
||||
}
|
||||
else if (*src == '9') //'half brightness'
|
||||
{
|
||||
src++;
|
||||
ext = (COLOR_WHITE)*256 | (ext&~CON_COLOURMASK);
|
||||
continue;
|
||||
}
|
||||
else if (*src == 'b')
|
||||
{
|
||||
src++;
|
||||
ext = (ext & ~CON_BLINKTEXT) + (CON_BLINKTEXT - (ext & CON_BLINKTEXT));
|
||||
continue;
|
||||
}
|
||||
else if (*src == 'a')
|
||||
{
|
||||
src++;
|
||||
ext = (ext & ~CON_2NDCHARSETTEXT) + (CON_2NDCHARSETTEXT - (ext & CON_2NDCHARSETTEXT));
|
||||
continue;
|
||||
}
|
||||
else if (*src == 's')
|
||||
{
|
||||
src++;
|
||||
if (extstackdepth < sizeof(extstack)/sizeof(extstack[0]))
|
||||
{
|
||||
extstack[extstackdepth] = ext;
|
||||
extstackdepth++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else if (*src == 'r')
|
||||
{
|
||||
src++;
|
||||
if (extstackdepth)
|
||||
{
|
||||
extstackdepth--;
|
||||
ext = extstack[extstackdepth];
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else if (*src != '^')
|
||||
src--;
|
||||
}
|
||||
if (*src == '\n')
|
||||
*dest++ = *src++;
|
||||
else
|
||||
*dest++ = *src++ | ext;
|
||||
}
|
||||
*dest = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
SCR_CenterPrint
|
||||
|
@ -189,7 +264,17 @@ void SCR_CenterPrint (int pnum, char *str)
|
|||
return;
|
||||
#endif
|
||||
|
||||
Q_strncpyz (scr_centerstring[pnum], str, sizeof(scr_centerstring[pnum]));
|
||||
if (Cmd_AliasExist("f_centerprint", RESTRICT_LOCAL))
|
||||
{
|
||||
cvar_t *var;
|
||||
var = Cvar_FindVar ("scr_centerprinttext");
|
||||
if (!var)
|
||||
Cvar_Get("scr_centerprinttext", "", 0, "Script Notifications");
|
||||
Cvar_Set(var, str);
|
||||
Cbuf_AddText("f_centerprint\n", RESTRICT_LOCAL);
|
||||
}
|
||||
|
||||
CopyAndMarkup (scr_centerstring[pnum], str, sizeof(scr_centerstring[pnum]));
|
||||
scr_centertime_off[pnum] = scr_centertime.value;
|
||||
scr_centertime_start[pnum] = cl.time;
|
||||
|
||||
|
@ -201,17 +286,6 @@ void SCR_CenterPrint (int pnum, char *str)
|
|||
scr_center_lines[pnum]++;
|
||||
str++;
|
||||
}
|
||||
|
||||
if (Cmd_AliasExist("f_centerprint", RESTRICT_LOCAL))
|
||||
{
|
||||
cvar_t *var;
|
||||
var = Cvar_FindVar ("scr_centerprinttext");
|
||||
if (var)
|
||||
Cvar_Set(var, scr_centerstring[pnum]);
|
||||
else
|
||||
Cvar_Get("scr_centerprinttext", scr_centerstring[pnum], 0, "Script Notifications");
|
||||
Cbuf_AddText("f_centerprint\n", RESTRICT_LOCAL);
|
||||
}
|
||||
}
|
||||
|
||||
void SCR_EraseCenterString (void)
|
||||
|
@ -240,7 +314,7 @@ void SCR_EraseCenterString (void)
|
|||
}
|
||||
}
|
||||
|
||||
void SCR_CenterPrintBreaks(qbyte *start, int *lines, int *maxlength)
|
||||
void SCR_CenterPrintBreaks(unsigned short *start, int *lines, int *maxlength)
|
||||
{
|
||||
int l;
|
||||
*lines = 0;
|
||||
|
@ -276,15 +350,12 @@ void SCR_CenterPrintBreaks(qbyte *start, int *lines, int *maxlength)
|
|||
|
||||
void SCR_DrawCenterString (int pnum)
|
||||
{
|
||||
qbyte *start;
|
||||
unsigned short *start;
|
||||
int l;
|
||||
int j;
|
||||
int x, y;
|
||||
int remaining;
|
||||
int hd = 1;
|
||||
int ext = COLOR_WHITE<<8;
|
||||
int extstack[4];
|
||||
int extstackdepth = 0;
|
||||
|
||||
vrect_t rect;
|
||||
|
||||
|
@ -311,14 +382,14 @@ void SCR_DrawCenterString (int pnum)
|
|||
|
||||
y += rect.y;
|
||||
|
||||
if (start[0] == '/')
|
||||
if ((start[0]&255) == '/')
|
||||
{
|
||||
if (start[1] == 'O')
|
||||
if ((start[1]&255) == 'O')
|
||||
{
|
||||
telejanostyle = start[1];
|
||||
telejanostyle = (start[1]&255);
|
||||
start+=2;
|
||||
}
|
||||
else if (start[1] == 'P')
|
||||
else if ((start[1]&255) == 'P')
|
||||
{ //hexen2 style plaque.
|
||||
int lines, len;
|
||||
start+=2;
|
||||
|
@ -344,53 +415,13 @@ void SCR_DrawCenterString (int pnum)
|
|||
x = rect.x + (rect.width - l*8)/2+4;
|
||||
for (j=0 ; j<l ; j++, x+=8)
|
||||
{
|
||||
if (start[j] == '^')
|
||||
{
|
||||
j++;
|
||||
if (start[j] >= '0' && start[j] <= '7')
|
||||
{
|
||||
ext = (start[j]-'0')*256 | (ext&~CON_COLOURMASK);
|
||||
continue;
|
||||
}
|
||||
else if (start[j] == 'b')
|
||||
{
|
||||
ext = (ext & ~CON_BLINKTEXT) + (CON_BLINKTEXT - (ext & CON_BLINKTEXT));
|
||||
continue;
|
||||
}
|
||||
else if (start[j] == 'a')
|
||||
{
|
||||
ext = (ext & ~CON_2NDCHARSETTEXT) + (CON_2NDCHARSETTEXT - (ext & CON_2NDCHARSETTEXT));
|
||||
continue;
|
||||
}
|
||||
else if (start[j] == 's')
|
||||
{
|
||||
if (extstackdepth < sizeof(extstack)/sizeof(extstack[0]))
|
||||
{
|
||||
extstack[extstackdepth] = ext;
|
||||
extstackdepth++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else if (start[j] == 'r')
|
||||
{
|
||||
if (extstackdepth)
|
||||
{
|
||||
extstackdepth--;
|
||||
ext = extstack[extstackdepth];
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else if (start[j] != '^')
|
||||
j--;
|
||||
}
|
||||
|
||||
switch(telejanostyle)
|
||||
{
|
||||
case 'O':
|
||||
Draw_ColouredCharacter (x, y+vid.height/2, start[j]|ext);
|
||||
Draw_ColouredCharacter (x, y+vid.height/2, start[j]);
|
||||
break;
|
||||
default:
|
||||
Draw_ColouredCharacter (x, y, start[j]|ext);
|
||||
Draw_ColouredCharacter (x, y, start[j]);
|
||||
}
|
||||
if (!remaining--)
|
||||
return;
|
||||
|
@ -428,8 +459,8 @@ extern qboolean sb_showscores;
|
|||
if (sb_showscores) //this was annoying
|
||||
continue;
|
||||
|
||||
if (scr_centertime_off[pnum] <= 0 && !cl.intermission && strncmp(scr_centerstring[pnum], "/P", 2))
|
||||
continue;
|
||||
if (scr_centertime_off[pnum] <= 0 && !cl.intermission && (scr_centerstring[pnum][0]&255) != '/' && (scr_centerstring[pnum][1]&255) != 'P')
|
||||
continue; //'/P' prefix doesn't time out
|
||||
|
||||
SCR_DrawCenterString (pnum);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue