1
0
Fork 0
forked from fte/fteqw

THIS COMMIT MOST LIKELY BREAKS THINGS.

changed conchars from 16-bit to 32-bit
added support for RGBI fg and bg colors
better support for ^8/^9 text codes
fix to echoish menu sounds
added plugin stuff for centerprints/server messages/chat messages, not finalized (?)
GL/SW color character functions improved (although neither handle transparent characters, and SW needs improvement with the palette remapping)


git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1750 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2006-01-01 09:01:15 +00:00
parent 8ef3ae1182
commit a8889d8f24
31 changed files with 632 additions and 575 deletions

View file

@ -3084,6 +3084,9 @@ char *CL_ParseChat(char *text, player_info_t **player)
Validation_CheckIfResponse(text); Validation_CheckIfResponse(text);
if (!Plug_ChatMessage(text + offset, *player ? (int)(*player - cl.players) : -1, flags))
return NULL;
if (flags == 2 && !TP_FilterMessage(text + offset)) if (flags == 2 && !TP_FilterMessage(text + offset))
return NULL; return NULL;
@ -3096,6 +3099,11 @@ char *CL_ParseChat(char *text, player_info_t **player)
else if (check_flood == NO_IGNORE_ADD) else if (check_flood == NO_IGNORE_ADD)
Ignore_Flood_Add(s); Ignore_Flood_Add(s);
} }
else
{
if (!Plug_ServerMessage(text + offset, PRINT_CHAT))
return NULL;
}
suppress_talksound = false; suppress_talksound = false;
@ -3163,35 +3171,35 @@ int CL_PlayerColor(player_info_t *plr, int *name_ormask)
{ //translate q1 skin colours to console colours { //translate q1 skin colours to console colours
case 10: case 10:
case 1: case 1:
*name_ormask = CON_STANDARDMASK; *name_ormask = CON_HIGHCHARSMASK;
case 4: //red case 4: //red
c = 1; c = 1;
break; break;
case 11: case 11:
*name_ormask = CON_STANDARDMASK; *name_ormask = CON_HIGHCHARSMASK;
case 3: // green case 3: // green
c = 2; c = 2;
break; break;
case 5: case 5:
*name_ormask = CON_STANDARDMASK; *name_ormask = CON_HIGHCHARSMASK;
case 12: case 12:
c = 3; c = 3;
break; break;
case 6: case 6:
case 7: case 7:
*name_ormask = CON_STANDARDMASK; *name_ormask = CON_HIGHCHARSMASK;
case 8: case 8:
case 9: case 9:
c = 5; c = 5;
break; break;
case 2: // light blue case 2: // light blue
*name_ormask = CON_STANDARDMASK; *name_ormask = CON_HIGHCHARSMASK;
case 13: //blue case 13: //blue
case 14: //blue case 14: //blue
c = 6; c = 6;
break; break;
default: default:
*name_ormask = CON_STANDARDMASK; *name_ormask = CON_HIGHCHARSMASK;
case 0: // white case 0: // white
c = 7; c = 7;
break; break;
@ -3218,7 +3226,7 @@ int CL_PlayerColor(player_info_t *plr, int *name_ormask)
} }
if ((c / 7) & 1) if ((c / 7) & 1)
*name_ormask = CON_STANDARDMASK; *name_ormask = CON_HIGHCHARSMASK;
c = 1 + (c % 7); c = 1 + (c % 7);
} }
@ -3236,7 +3244,7 @@ int CL_PlayerColor(player_info_t *plr, int *name_ormask)
c = plr->userid; // Quake2 can start from 0 c = plr->userid; // Quake2 can start from 0
if ((c / 7) & 1) if ((c / 7) & 1)
*name_ormask = CON_STANDARDMASK; *name_ormask = CON_HIGHCHARSMASK;
c = 1 + (c % 7); c = 1 + (c % 7);
} }
@ -3244,7 +3252,7 @@ int CL_PlayerColor(player_info_t *plr, int *name_ormask)
return c; return c;
} }
// CL_ParseChat: takes chat strings and performs name coloring and cl_parsewhitetext parsing // CL_PrintChat: takes chat strings and performs name coloring and cl_parsewhitetext parsing
// NOTE: text in rawmsg/msg is assumed destroyable and should not be used afterwards // NOTE: text in rawmsg/msg is assumed destroyable and should not be used afterwards
void CL_PrintChat(player_info_t *plr, char *rawmsg, char *msg, int plrflags) void CL_PrintChat(player_info_t *plr, char *rawmsg, char *msg, int plrflags)
{ {
@ -3272,7 +3280,7 @@ void CL_PrintChat(player_info_t *plr, char *rawmsg, char *msg, int plrflags)
if (cl_standardchat.value) if (cl_standardchat.value)
{ {
name_ormask = CON_STANDARDMASK; name_ormask = CON_HIGHCHARSMASK;
c = 7; c = 7;
} }
else else
@ -3284,7 +3292,7 @@ void CL_PrintChat(player_info_t *plr, char *rawmsg, char *msg, int plrflags)
c = 0; // blacken () on observers c = 0; // blacken () on observers
else else
{ {
name_ormask = CON_STANDARDMASK; name_ormask = CON_HIGHCHARSMASK;
c = 7; c = 7;
} }
} }
@ -3293,7 +3301,7 @@ void CL_PrintChat(player_info_t *plr, char *rawmsg, char *msg, int plrflags)
else else
{ {
// defaults for fake clients // defaults for fake clients
name_ormask = CON_STANDARDMASK; name_ormask = CON_HIGHCHARSMASK;
c = 7; c = 7;
} }
} }
@ -3304,7 +3312,7 @@ void CL_PrintChat(player_info_t *plr, char *rawmsg, char *msg, int plrflags)
{ {
if (memessage) if (memessage)
{ {
con_ormask = CON_STANDARDMASK; con_ormask = CON_HIGHCHARSMASK;
if (!cl_standardchat.value && (plrflags & TPM_SPECTATOR)) if (!cl_standardchat.value && (plrflags & TPM_SPECTATOR))
Con_Printf ("^0*^7 "); Con_Printf ("^0*^7 ");
else else
@ -3316,7 +3324,7 @@ void CL_PrintChat(player_info_t *plr, char *rawmsg, char *msg, int plrflags)
// color is reset every printf so we're safe here // color is reset every printf so we're safe here
con_ormask = name_ormask; con_ormask = name_ormask;
Con_Printf("^%c(", c); Con_Printf("^%c(", c);
con_ormask = CON_STANDARDMASK; con_ormask = CON_HIGHCHARSMASK;
Con_Printf("%s", name); Con_Printf("%s", name);
con_ormask = name_ormask; con_ormask = name_ormask;
Con_Printf("^%c)", c); Con_Printf("^%c)", c);
@ -3330,7 +3338,7 @@ void CL_PrintChat(player_info_t *plr, char *rawmsg, char *msg, int plrflags)
if (!memessage) if (!memessage)
{ {
// only print seperator with an actual player name // only print seperator with an actual player name
con_ormask = CON_STANDARDMASK; con_ormask = CON_HIGHCHARSMASK;
if (!cl_standardchat.value && (plrflags & TPM_SPECTATOR)) if (!cl_standardchat.value && (plrflags & TPM_SPECTATOR))
Con_Printf ("^0:^7 "); Con_Printf ("^0:^7 ");
else else
@ -3341,7 +3349,7 @@ void CL_PrintChat(player_info_t *plr, char *rawmsg, char *msg, int plrflags)
} }
// print message // print message
con_ormask = CON_STANDARDMASK; con_ormask = CON_HIGHCHARSMASK;
if (cl_parsewhitetext.value && (cl_parsewhitetext.value == 1 || (plrflags & TPM_TEAM))) if (cl_parsewhitetext.value && (cl_parsewhitetext.value == 1 || (plrflags & TPM_TEAM)))
{ {
char *t, *u; char *t, *u;
@ -3356,7 +3364,7 @@ void CL_PrintChat(player_info_t *plr, char *rawmsg, char *msg, int plrflags)
Con_Printf("%s", msg); Con_Printf("%s", msg);
con_ormask = 0; con_ormask = 0;
Con_Printf("%s", t+1); Con_Printf("%s", t+1);
con_ormask = CON_STANDARDMASK; con_ormask = CON_HIGHCHARSMASK;
msg = u+1; msg = u+1;
} }
else else
@ -3522,7 +3530,6 @@ void CL_ParsePrecache(void)
CL_ParseServerMessage CL_ParseServerMessage
===================== =====================
*/ */
char *Translate(char *message);
int received_framecount; int received_framecount;
void CL_ParseServerMessage (void) void CL_ParseServerMessage (void)
{ {
@ -3612,8 +3619,6 @@ void CL_ParseServerMessage (void)
i = MSG_ReadByte (); i = MSG_ReadByte ();
s = MSG_ReadString (); s = MSG_ReadString ();
// Plug_Message(0, i, s);
if (i == PRINT_CHAT) if (i == PRINT_CHAT)
{ {
char *msg; char *msg;
@ -3629,14 +3634,20 @@ void CL_ParseServerMessage (void)
} }
} }
else else
{
if (Plug_ServerMessage(s, i))
{ {
CL_ParsePrint(s, i); CL_ParsePrint(s, i);
CL_PrintStandardMessage(s); CL_PrintStandardMessage(s);
} }
}
break; break;
case svc_centerprint: case svc_centerprint:
SCR_CenterPrint (destsplit, Translate(MSG_ReadString ())); s = MSG_ReadString ();
if (Plug_CenterPrintMessage(s, destsplit))
SCR_CenterPrint (destsplit, s);
break; break;
case svc_stufftext: case svc_stufftext:
@ -4072,8 +4083,6 @@ void CLQ2_ParseServerMessage (void)
i = MSG_ReadByte (); i = MSG_ReadByte ();
s = MSG_ReadString (); s = MSG_ReadString ();
// Plug_Message(0, i, s);
if (i == PRINT_CHAT) if (i == PRINT_CHAT)
{ {
char *msg; char *msg;
@ -4086,10 +4095,13 @@ void CLQ2_ParseServerMessage (void)
} }
} }
else else
{
if (Plug_ServerMessage(s, i))
{ {
CL_ParsePrint(s, i); CL_ParsePrint(s, i);
CL_PrintStandardMessage(s); CL_PrintStandardMessage(s);
} }
}
con_ormask = 0; con_ormask = 0;
break; break;
case svcq2_stufftext: //11 // [string] stuffed into client's console buffer, should be \n terminated case svcq2_stufftext: //11 // [string] stuffed into client's console buffer, should be \n terminated
@ -4113,7 +4125,10 @@ void CLQ2_ParseServerMessage (void)
CLQ2_ParseBaseline(); CLQ2_ParseBaseline();
break; break;
case svcq2_centerprint: //15 // [string] to put in center of the screen case svcq2_centerprint: //15 // [string] to put in center of the screen
SCR_CenterPrint (0, Translate(MSG_ReadString ())); s = MSG_ReadString();
if (Plug_CenterPrintMessage(s, 0))
SCR_CenterPrint (0, s);
break; break;
case svcq2_download: //16 // [short] size [size bytes] case svcq2_download: //16 // [short] size [size bytes]
CL_ParseDownload(); CL_ParseDownload();
@ -4304,9 +4319,6 @@ void CLNQ_ParseServerMessage (void)
char *msg; char *msg;
player_info_t *plr = NULL; player_info_t *plr = NULL;
// Plug_Message(0, PRINT_CHAT, s);
if (msg = CL_ParseChat(s+1, &plr)) if (msg = CL_ParseChat(s+1, &plr))
{ {
CL_ParsePrint(s+1, PRINT_CHAT); CL_ParsePrint(s+1, PRINT_CHAT);
@ -4315,11 +4327,12 @@ void CLNQ_ParseServerMessage (void)
} }
else else
{ {
// Plug_Message(0, PRINT_HIGH, s); if (Plug_ServerMessage(s, PRINT_HIGH))
{
CL_ParsePrint(s, PRINT_HIGH); CL_ParsePrint(s, PRINT_HIGH);
CL_PrintStandardMessage(s); CL_PrintStandardMessage(s);
} }
}
con_ormask = 0; con_ormask = 0;
break; break;
@ -4328,7 +4341,10 @@ void CLNQ_ParseServerMessage (void)
break; break;
case svc_centerprint: case svc_centerprint:
SCR_CenterPrint (0, Translate(MSG_ReadString ())); s = MSG_ReadString ();
if (Plug_CenterPrintMessage(s, 0))
SCR_CenterPrint (0, s);
break; break;
case svc_stufftext: case svc_stufftext:

View file

@ -167,17 +167,17 @@ CENTER PRINTING
=============================================================================== ===============================================================================
*/ */
unsigned short scr_centerstring[MAX_SPLITS][1024]; conchar_t scr_centerstring[MAX_SPLITS][1024];
float scr_centertime_start[MAX_SPLITS]; // for slow victory printing float scr_centertime_start[MAX_SPLITS]; // for slow victory printing
float scr_centertime_off[MAX_SPLITS]; float scr_centertime_off[MAX_SPLITS];
int scr_center_lines[MAX_SPLITS]; int scr_center_lines[MAX_SPLITS];
int scr_erase_lines[MAX_SPLITS]; int scr_erase_lines[MAX_SPLITS];
int scr_erase_center[MAX_SPLITS]; int scr_erase_center[MAX_SPLITS];
void CopyAndMarkup(unsigned short *dest, qbyte *src, int maxlength) void CopyAndMarkup(conchar_t *dest, qbyte *src, int maxlength)
{ {
int ext = COLOR_WHITE<<8; conchar_t ext = CON_WHITEMASK;
int extstack[20]; conchar_t extstack[20];
int extstackdepth = 0; int extstackdepth = 0;
if (maxlength < 0) if (maxlength < 0)
@ -189,33 +189,21 @@ void CopyAndMarkup(unsigned short *dest, qbyte *src, int maxlength)
if (*src == '^') if (*src == '^')
{ {
src++; src++;
if (*src >= '0' && *src <= '7') if (*src >= '0' && *src <= '9')
{ {
ext = (*src++-'0')*256 | (ext&~CON_COLOURMASK); ext = q3codemasks[*src - '0'] | (ext&~CON_Q3MASK);
continue; continue;
} }
else if (*src == '8') //'half transparent' else if (*src == 'b') // toggle blink bit
{ {
src++; src++;
ext = (COLOR_WHITE)*256 | (ext&~CON_COLOURMASK); ext ^= CON_BLINKTEXT;
continue; continue;
} }
else if (*src == '9') //'half brightness' else if (*src == 'a') // toggle alternate charset
{ {
src++; src++;
ext = (COLOR_WHITE)*256 | (ext&~CON_COLOURMASK); ext ^= CON_2NDCHARSETTEXT;
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; continue;
} }
else if (*src == 's') else if (*src == 's')
@ -314,7 +302,7 @@ void SCR_EraseCenterString (void)
} }
} }
void SCR_CenterPrintBreaks(unsigned short *start, int *lines, int *maxlength) void SCR_CenterPrintBreaks(conchar_t *start, int *lines, int *maxlength)
{ {
int l; int l;
*lines = 0; *lines = 0;
@ -350,7 +338,7 @@ void SCR_CenterPrintBreaks(unsigned short *start, int *lines, int *maxlength)
void SCR_DrawCenterString (int pnum) void SCR_DrawCenterString (int pnum)
{ {
unsigned short *start; conchar_t *start;
int l; int l;
int j; int j;
int x, y; int x, y;

View file

@ -21,24 +21,44 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h" #include "quakedef.h"
//this is the same order as q3, except that white and black are swapped... // This is the standard RGBI palette used in CGA text mode
consolecolours_t consolecolours[] = { consolecolours_t consolecolours[MAXCONCOLOURS] = {
#define CON_WHITEMASK 7*256 //must be constant. things assume this { 0, 0, 0, 0, 0, 0 }, // black
{0, 0, 0, 0x0000}, { 0, 0, 170, 0, 0, 0.67}, // blue
{1, 0, 0, 0x001F}, { 0, 170, 0, 0, 0.67, 0 }, // green
{0, 1, 0, 0x03E0}, { 0, 170, 170, 0, 0.67, 0.67}, // cyan
{1, 1, 0, 0x03FF}, {170, 0, 0, 0.67, 0, 0 }, // red
{0.1, 0.1, 1, 0x7C00}, //brighten dark blue a little {170, 0, 170, 0.67, 0, 0.67}, // magenta
{1, 0, 1, 0x7C1F}, {170, 85, 0, 0.67, 0.33, 0 }, // brown
{0, 1, 1, 0x7FE0}, {170, 170, 170, 0.67, 0.67, 0.67}, // light gray
{1, 1, 1, 0x7FFF} { 85, 85, 85, 0.33, 0.33, 0.33}, // dark gray
{ 85, 85, 255, 0.33, 0.33, 1 }, // light blue
{ 85, 255, 85, 0.33, 1, 0.33}, // light green
{ 85, 255, 255, 0.33, 1, 1 }, // light cyan
{255, 85, 85, 1, 0.33, 0.33}, // light red
{255, 85, 255, 1, 0.33, 1 }, // light magenta
{255, 255, 85, 1, 1, 0.33}, // yellow
{255, 255, 255, 1, 1, 1 } // white
}; };
int con_ormask; // This is for remapping the Q3 color codes to character masks, including ^9
conchar_t q3codemasks[MAXQ3COLOURS] = {
0x00000000, // 0, black
0x0c000000, // 1, red
0x0a000000, // 2, green
0x0e000000, // 3, yellow
0x09000000, // 4, blue
0x0b000000, // 5, cyan
0x0d000000, // 6, magenta
0x0f000000, // 7, white
0x0f100000, // 8, half-alpha white (BX_COLOREDTEXT)
0x07000000 // 9, "half-intensity" (BX_COLOREDTEXT)
};
conchar_t con_ormask;
console_t con_main; console_t con_main;
console_t *con_current; // point to either con_main console_t *con_current; // point to either con_main
#ifdef QTERM #ifdef QTERM
#include <windows.h> #include <windows.h>
typedef struct qterm_s { typedef struct qterm_s {
@ -436,7 +456,7 @@ Con_Resize
void Con_ResizeCon (console_t *con) void Con_ResizeCon (console_t *con)
{ {
int i, j, width, oldwidth, oldtotallines, numlines, numchars; int i, j, width, oldwidth, oldtotallines, numlines, numchars;
unsigned short tbuf[CON_TEXTSIZE]; conchar_t tbuf[CON_TEXTSIZE];
if (scr_chatmode == 2) if (scr_chatmode == 2)
width = (vid.width >> 4) - 2; width = (vid.width >> 4) - 2;
@ -472,7 +492,7 @@ void Con_ResizeCon (console_t *con)
numchars = con->linewidth; numchars = con->linewidth;
Q_memcpy (tbuf, con->text, sizeof(con->text)); Q_memcpy (tbuf, con->text, sizeof(con->text));
for (i = 0; i < sizeof(con->text)/sizeof(unsigned short); i++) for (i = 0; i < sizeof(con->text)/sizeof(conchar_t); i++)
con->text[i] = ' '; con->text[i] = ' ';
// Q_memset (con->text, ' ', sizeof(con->text)); // Q_memset (con->text, ' ', sizeof(con->text));
@ -598,7 +618,7 @@ void Con_PrintCon (console_t *con, char *txt)
if (txt[0] == 1 || txt[0] == 2) if (txt[0] == 1 || txt[0] == 2)
{ {
mask = CON_STANDARDMASK|CON_WHITEMASK; // go to colored text mask = CON_HIGHCHARSMASK|CON_WHITEMASK; // go to colored text
txt++; txt++;
} }
else else
@ -609,21 +629,21 @@ void Con_PrintCon (console_t *con, char *txt)
{ {
if (c == '^') if (c == '^')
{ {
if (txt[1]>='0' && txt[1]<'8') if (txt[1]>='0' && txt[1]<='9')
{ {
mask = (txt[1]-'0')*256 + (mask&~CON_COLOURMASK); //change colour only. mask = q3codemasks[txt[1]-'0'] + (mask&~CON_Q3MASK); //change colour only.
txt+=2; txt+=2;
continue; continue;
} }
if (txt[1] == 'b') if (txt[1] == 'b')
{ {
mask = (mask & ~CON_BLINKTEXT) + (CON_BLINKTEXT - (mask & CON_BLINKTEXT)); mask ^= CON_BLINKTEXT;
txt+=2; txt+=2;
continue; continue;
} }
if (txt[1] == 'a') if (txt[1] == 'a')
{ {
mask = (mask & ~CON_2NDCHARSETTEXT) + (CON_2NDCHARSETTEXT - (mask & CON_2NDCHARSETTEXT)); mask ^= CON_2NDCHARSETTEXT;
txt+=2; txt+=2;
continue; continue;
} }
@ -873,9 +893,9 @@ void Con_DrawInput (void)
int p; int p;
unsigned char *text, *fname; unsigned char *text, *fname;
extern int con_commandmatch; extern int con_commandmatch;
unsigned short maskedtext[MAXCMDLINE]; conchar_t maskedtext[MAXCMDLINE];
unsigned short mask=CON_WHITEMASK; conchar_t mask=CON_WHITEMASK;
int maskstack[4]; int maskstack[4];
int maskstackdepth = 0; int maskstackdepth = 0;
@ -898,12 +918,12 @@ void Con_DrawInput (void)
{ {
if (text[i] == '^') //is this an escape code? if (text[i] == '^') //is this an escape code?
{ {
if (text[i+1]>='0' && text[i+1]<'8') if (text[i+1]>='0' && text[i+1]<='9')
mask = (text[i+1]-'0')*256 + (mask&~CON_COLOURMASK); //change colour only. mask = q3codemasks[text[i+1]-'0'] | (mask&~CON_Q3MASK); //change colour only.
else if (text[i+1] == 'b') else if (text[i+1] == 'b')
mask = (mask & ~CON_BLINKTEXT) + (CON_BLINKTEXT - (mask & CON_BLINKTEXT)); mask ^= CON_BLINKTEXT;
else if (text[i+1] == 'a') //alternate else if (text[i+1] == 'a') //alternate
mask = (mask & ~CON_2NDCHARSETTEXT) + (CON_2NDCHARSETTEXT - (mask & CON_2NDCHARSETTEXT)); mask ^= CON_2NDCHARSETTEXT;
else if (text[i+1] == 's') //store on stack (it's great for names) else if (text[i+1] == 's') //store on stack (it's great for names)
{ {
if (maskstackdepth < sizeof(maskstack)/sizeof(maskstack[0])) if (maskstackdepth < sizeof(maskstack)/sizeof(maskstack[0]))
@ -938,7 +958,7 @@ void Con_DrawInput (void)
if (text[1] == '/' || Cmd_IsCommand(text+1)) if (text[1] == '/' || Cmd_IsCommand(text+1))
{ //color the first token yellow, it's a valid command { //color the first token yellow, it's a valid command
for (p = 1; (maskedtext[p]&255)>' '; p++) for (p = 1; (maskedtext[p]&255)>' '; p++)
maskedtext[p] = (maskedtext[p]&255) | (COLOR_YELLOW<<8); maskedtext[p] = (maskedtext[p]&255) | (COLOR_YELLOW<<CON_FGSHIFT);
} }
if (key_linepos == i) //cursor is at end if (key_linepos == i) //cursor is at end
{ {
@ -947,7 +967,7 @@ void Con_DrawInput (void)
if (fname) //we can compleate it to: if (fname) //we can compleate it to:
{ {
for (p = i-x; fname[p]>' '; p++) for (p = i-x; fname[p]>' '; p++)
maskedtext[p+x] = (unsigned char)fname[p] | (COLOR_GREEN<<8); maskedtext[p+x] = (unsigned char)fname[p] | (COLOR_GREEN<<CON_FGSHIFT);
maskedtext[p+x] = '\0'; maskedtext[p+x] = '\0';
} }
} }
@ -988,7 +1008,7 @@ Draws the last few lines of output transparently over the game top
void Con_DrawNotify (void) void Con_DrawNotify (void)
{ {
int x, v; int x, v;
unsigned short *text; conchar_t *text;
int i; int i;
float time; float time;
char *s; char *s;
@ -1095,12 +1115,12 @@ void Con_DrawNotify (void)
{ {
if (s[x] == '^') if (s[x] == '^')
{ {
if (s[x+1]>='0' && s[x+1]<'8') if (s[x+1]>='0' && s[x+1]<='9')
mask = (s[x+1]-'0')*256 + (mask&~CON_COLOURMASK); //change colour only. mask = q3codemasks[s[x+1]-'0'] | (mask&~CON_Q3MASK); //change colour only.
else if (s[x+1] == 'b') else if (s[x+1] == 'b')
mask = (mask & ~CON_BLINKTEXT) + (CON_BLINKTEXT - (mask & CON_BLINKTEXT)); mask ^= CON_BLINKTEXT;
else if (s[x+1] == 'a') //alternate else if (s[x+1] == 'a') //alternate
mask = (mask & ~CON_2NDCHARSETTEXT) + (CON_2NDCHARSETTEXT - (mask & CON_2NDCHARSETTEXT)); mask ^= CON_2NDCHARSETTEXT;
else if (s[x+1] == 's') //store on stack (it's great for names) else if (s[x+1] == 's') //store on stack (it's great for names)
{ {
if (maskstackdepth < sizeof(maskstack)/sizeof(maskstack[0])) if (maskstackdepth < sizeof(maskstack)/sizeof(maskstack[0]))
@ -1125,12 +1145,12 @@ void Con_DrawNotify (void)
{ {
if (s[x] == '^') if (s[x] == '^')
{ {
if (s[x+1]>='0' && s[x+1]<'8') if (s[x+1]>='0' && s[x+1]<='9')
mask = (s[x+1]-'0')*256 + (mask&~CON_COLOURMASK); //change colour only. mask = q3codemasks[s[x+1]-'0'] | (mask&~CON_Q3MASK); //change colour only.
else if (s[x+1] == 'b') else if (s[x+1] == 'b')
mask = (mask & ~CON_BLINKTEXT) + (CON_BLINKTEXT - (mask & CON_BLINKTEXT)); mask ^= CON_BLINKTEXT;
else if (s[x+1] == 'a') //alternate else if (s[x+1] == 'a') //alternate
mask = (mask & ~CON_2NDCHARSETTEXT) + (CON_2NDCHARSETTEXT - (mask & CON_2NDCHARSETTEXT)); mask ^= CON_2NDCHARSETTEXT;
else if (s[x+1] == 's') //store on stack (it's great for names) else if (s[x+1] == 's') //store on stack (it's great for names)
{ {
if (maskstackdepth < sizeof(maskstack)/sizeof(maskstack[0])) if (maskstackdepth < sizeof(maskstack)/sizeof(maskstack[0]))
@ -1152,7 +1172,7 @@ void Con_DrawNotify (void)
Draw_ColouredCharacter ( (x+skip)<<3, v, s[x]|mask); Draw_ColouredCharacter ( (x+skip)<<3, v, s[x]|mask);
x++; x++;
} }
Draw_ColouredCharacter ( (x+skip)<<3, v, (10+((int)(realtime*con_cursorspeed)&1))|M_COLOR_WHITE); Draw_ColouredCharacter ( (x+skip)<<3, v, (10+((int)(realtime*con_cursorspeed)&1))|CON_WHITEMASK);
v += 8; v += 8;
} }
@ -1165,7 +1185,7 @@ void Con_DrawNotify (void)
void Con_PrintToSys(void) void Con_PrintToSys(void)
{ {
int line, row, x, spc, content; int line, row, x, spc, content;
short *text; conchar_t *text;
console_t *curcon = &con_main; console_t *curcon = &con_main;
content = 0; content = 0;
@ -1203,7 +1223,7 @@ void Con_DrawConsole (int lines, qboolean noback)
int i, j, x, y; int i, j, x, y;
float n; float n;
int rows; int rows;
unsigned short *text; conchar_t *text;
char *txt; char *txt;
int row; int row;
unsigned char dlbar[1024]; unsigned char dlbar[1024];
@ -1333,9 +1353,9 @@ void Con_DrawConsole (int lines, qboolean noback)
// draw it // draw it
y = curcon->vislines-22 + 8; y = curcon->vislines-22 + 8;
for (i = 0; i < strlen(dlbar); i++) for (i = 0; i < strlen(dlbar); i++)
Draw_ColouredCharacter ( (i+1)<<3, y, (unsigned char)dlbar[i] | M_COLOR_WHITE); Draw_ColouredCharacter ( (i+1)<<3, y, (unsigned char)dlbar[i] | CON_WHITEMASK);
Draw_ColouredCharacter ((n+1+x)*8, y, (unsigned char)'\x83' | M_COLOR_WHITE); Draw_ColouredCharacter ((n+1+x)*8, y, (unsigned char)'\x83' | CON_WHITEMASK);
} }
// draw the input prompt, user text, and cursor if desired // draw the input prompt, user text, and cursor if desired

View file

@ -480,7 +480,6 @@ void Menu_DownloadStuff_f (void)
key_dest = key_menu; key_dest = key_menu;
m_state = m_complex; m_state = m_complex;
m_entersound = true;
menu = M_CreateMenu(sizeof(dlmenu_t)); menu = M_CreateMenu(sizeof(dlmenu_t));
info = menu->data; info = menu->data;

View file

@ -1316,6 +1316,8 @@ void M_Menu_Main_f (void)
} }
*/ */
S_LocalSound ("misc/menu2.wav");
mgt = M_GameType(); mgt = M_GameType();
if (mgt == MGT_QUAKE2) //quake2 main menu. if (mgt == MGT_QUAKE2) //quake2 main menu.
{ {
@ -1323,7 +1325,6 @@ void M_Menu_Main_f (void)
{ {
m_state = m_complex; m_state = m_complex;
key_dest = key_menu; key_dest = key_menu;
m_entersound = true;
mainm = M_CreateMenu(0); mainm = M_CreateMenu(0);
mainm->key = MC_Main_Key; mainm->key = MC_Main_Key;
@ -1354,7 +1355,6 @@ void M_Menu_Main_f (void)
{ {
m_state = m_complex; m_state = m_complex;
key_dest = key_menu; key_dest = key_menu;
m_entersound = true;
mainm = M_CreateMenu(0); mainm = M_CreateMenu(0);
mainm->key = MC_Main_Key; mainm->key = MC_Main_Key;
@ -1389,7 +1389,6 @@ void M_Menu_Main_f (void)
{ {
m_state = m_complex; m_state = m_complex;
key_dest = key_menu; key_dest = key_menu;
m_entersound = true;
mainm = M_CreateMenu(0); mainm = M_CreateMenu(0);
p = Draw_SafeCachePic("gfx/ttl_main.lmp"); p = Draw_SafeCachePic("gfx/ttl_main.lmp");

View file

@ -80,7 +80,7 @@ static void NM_Print (int cx, int cy, qbyte *str)
{ {
while (*str) while (*str)
{ {
Draw_ColouredCharacter (cx, cy, (*str)|128|M_COLOR_WHITE); Draw_ColouredCharacter (cx, cy, (*str)|CON_HIGHCHARSMASK|CON_WHITEMASK);
str++; str++;
cx += 8; cx += 8;
} }
@ -90,7 +90,7 @@ static void NM_PrintWhite (int cx, int cy, qbyte *str)
{ {
while (*str) while (*str)
{ {
Draw_ColouredCharacter (cx, cy, (*str)+M_COLOR_WHITE); Draw_ColouredCharacter (cx, cy, (*str)|CON_WHITEMASK);
str++; str++;
cx += 8; cx += 8;
} }
@ -100,16 +100,12 @@ static void NM_PrintColoured (int cx, int cy, int colour, qbyte *str)
{ {
while (*str) while (*str)
{ {
NM_DrawColouredCharacter (cx, cy, (*str) + (colour<<8)); NM_DrawColouredCharacter (cx, cy, (*str) | (colour<<CON_FGSHIFT));
str++; str++;
cx += 8; cx += 8;
} }
} }
qboolean M_IsFiltered(serverinfo_t *server) //figure out if we should filter a server. qboolean M_IsFiltered(serverinfo_t *server) //figure out if we should filter a server.
{ {
if (slist_type == SLISTTYPE_FAVORITES) if (slist_type == SLISTTYPE_FAVORITES)
@ -260,7 +256,7 @@ int M_AddColumn (int right, int y, char *text, int maxchars, int colour)
right = left; right = left;
while (*text && maxchars>0) while (*text && maxchars>0)
{ {
NM_DrawColouredCharacter (right, y, (*(unsigned char *)text) + (colour<<8)); NM_DrawColouredCharacter (right, y, (*(unsigned char *)text) | (colour<<CON_FGSHIFT));
text++; text++;
right += 8; right += 8;
maxchars--; maxchars--;
@ -342,20 +338,20 @@ void M_DrawServerList(void)
y = 8*2; y = 8*2;
x = vid.width; x = vid.width;
if (sb_showtimelimit.value) if (sb_showtimelimit.value)
x = M_AddColumn(x, y, "tl", 3, 1); x = M_AddColumn(x, y, "tl", 3, COLOR_RED);
if (sb_showfraglimit.value) if (sb_showfraglimit.value)
x = M_AddColumn(x, y, "fl", 3, 1); x = M_AddColumn(x, y, "fl", 3, COLOR_RED);
if (sb_showplayers.value) if (sb_showplayers.value)
x = M_AddColumn(x, y, "plyrs", 6, 1); x = M_AddColumn(x, y, "plyrs", 6, COLOR_RED);
if (sb_showmap.value) if (sb_showmap.value)
x = M_AddColumn(x, y, "map", 9, 1); x = M_AddColumn(x, y, "map", 9, COLOR_RED);
if (sb_showgamedir.value) if (sb_showgamedir.value)
x = M_AddColumn(x, y, "gamedir", 9, 1); x = M_AddColumn(x, y, "gamedir", 9, COLOR_RED);
if (sb_showping.value) if (sb_showping.value)
x = M_AddColumn(x, y, "png", 4, 1); x = M_AddColumn(x, y, "png", 4, COLOR_RED);
if (sb_showaddress.value) if (sb_showaddress.value)
x = M_AddColumn(x, y, "address", 21, 1); x = M_AddColumn(x, y, "address", 21, COLOR_RED);
x = M_AddColumn(x, y, "name", x/8-1, 1); x = M_AddColumn(x, y, "name", x/8-1, COLOR_RED);
y = 8*3; y = 8*3;
while(server) while(server)

View file

@ -289,7 +289,6 @@ void Media_Next_f (void)
void M_Menu_Media_f (void) { void M_Menu_Media_f (void) {
key_dest = key_menu; key_dest = key_menu;
m_state = m_media; m_state = m_media;
m_entersound = true;
} }
void Media_LoadTrackNames (char *listname); void Media_LoadTrackNames (char *listname);

View file

@ -18,7 +18,6 @@ void M_Menu_MultiPlayer_f (void)
p = NULL; p = NULL;
key_dest = key_menu; key_dest = key_menu;
m_state = m_complex; m_state = m_complex;
m_entersound = true;
mgt = M_GameType(); mgt = M_GameType();
@ -93,8 +92,8 @@ qboolean ApplySetupMenu (union menuoption_s *option,struct menu_s *menu, int key
Cvar_Set(&team, info->teamedit->text); Cvar_Set(&team, info->teamedit->text);
Cvar_Set(&skin, info->skinedit->text); Cvar_Set(&skin, info->skinedit->text);
Cbuf_AddText(va("color %i %i\n", info->lowercolour, info->topcolour), RESTRICT_LOCAL); Cbuf_AddText(va("color %i %i\n", info->lowercolour, info->topcolour), RESTRICT_LOCAL);
m_entersound=true; S_LocalSound ("misc/menu2.wav");
M_RemoveMenu(menu); M_RemoveMenu(menu);
return true; return true;
} }
qboolean SetupMenuColour (union menuoption_s *option,struct menu_s *menu, int key) qboolean SetupMenuColour (union menuoption_s *option,struct menu_s *menu, int key)
@ -107,7 +106,7 @@ qboolean SetupMenuColour (union menuoption_s *option,struct menu_s *menu, int ke
info->topcolour ++; info->topcolour ++;
if (info->topcolour>=14) if (info->topcolour>=14)
info->topcolour=0; info->topcolour=0;
m_entersound=true; S_LocalSound ("misc/menu2.wav");
return true; return true;
} }
if (key == K_LEFTARROW) if (key == K_LEFTARROW)
@ -115,7 +114,7 @@ qboolean SetupMenuColour (union menuoption_s *option,struct menu_s *menu, int ke
info->topcolour --; info->topcolour --;
if (info->topcolour<=0) if (info->topcolour<=0)
info->topcolour=13; info->topcolour=13;
m_entersound=true; S_LocalSound ("misc/menu2.wav");
return true; return true;
} }
@ -127,7 +126,7 @@ qboolean SetupMenuColour (union menuoption_s *option,struct menu_s *menu, int ke
info->lowercolour ++; info->lowercolour ++;
if (info->lowercolour>=14) if (info->lowercolour>=14)
info->lowercolour=0; info->lowercolour=0;
m_entersound=true; S_LocalSound ("misc/menu2.wav");
return true; return true;
} }
if (key == K_LEFTARROW) if (key == K_LEFTARROW)
@ -135,7 +134,7 @@ qboolean SetupMenuColour (union menuoption_s *option,struct menu_s *menu, int ke
info->lowercolour --; info->lowercolour --;
if (info->lowercolour<=0) if (info->lowercolour<=0)
info->lowercolour=13; info->lowercolour=13;
m_entersound=true; S_LocalSound ("misc/menu2.wav");
return true; return true;
} }
} }
@ -179,7 +178,6 @@ void M_Menu_Setup_f (void)
key_dest = key_menu; key_dest = key_menu;
m_state = m_complex; m_state = m_complex;
m_entersound = true;
menu = M_CreateMenu(sizeof(setupmenu_t)); menu = M_CreateMenu(sizeof(setupmenu_t));
info = menu->data; info = menu->data;
@ -217,7 +215,6 @@ void M_Menu_ServerList_f (void)
{ {
key_dest = key_menu; key_dest = key_menu;
m_state = m_slist; m_state = m_slist;
m_entersound = true;
MasterInfo_Begin(); MasterInfo_Begin();
} }
@ -304,7 +301,6 @@ qboolean MultiBeginGame (union menuoption_s *option,struct menu_s *menu, int key
Cbuf_AddText("echo You can use the setrenderer command to return to a graphical interface at any time\n", RESTRICT_LOCAL); Cbuf_AddText("echo You can use the setrenderer command to return to a graphical interface at any time\n", RESTRICT_LOCAL);
} }
m_entersound=true;
M_RemoveAllMenus(); M_RemoveAllMenus();
return true; return true;
@ -372,7 +368,6 @@ void M_Menu_GameOptions_f (void)
key_dest = key_menu; key_dest = key_menu;
m_state = m_complex; m_state = m_complex;
m_entersound = true;
menu = M_CreateMenu(sizeof(newmultimenu_t)); menu = M_CreateMenu(sizeof(newmultimenu_t));
info = menu->data; info = menu->data;

View file

@ -46,7 +46,6 @@ void M_Menu_Options_f (void)
key_dest = key_menu; key_dest = key_menu;
m_state = m_complex; m_state = m_complex;
m_entersound = true;
menu = M_CreateMenu(0); menu = M_CreateMenu(0);
@ -204,7 +203,6 @@ void M_Menu_Audio_Speakers_f (void)
key_dest = key_menu; key_dest = key_menu;
m_state = m_complex; m_state = m_complex;
m_entersound = true;
menu = M_CreateMenu(sizeof(audiomenuinfo_t)); menu = M_CreateMenu(sizeof(audiomenuinfo_t));
info = menu->data; info = menu->data;
@ -262,7 +260,6 @@ void M_Menu_Audio_f (void)
key_dest = key_menu; key_dest = key_menu;
m_state = m_complex; m_state = m_complex;
m_entersound = true;
menu = M_CreateMenu(0); menu = M_CreateMenu(0);
@ -317,7 +314,6 @@ void M_Menu_Particles_f (void)
key_dest = key_menu; key_dest = key_menu;
m_state = m_complex; m_state = m_complex;
m_entersound = true;
menu = M_CreateMenu(0); menu = M_CreateMenu(0);
@ -434,7 +430,6 @@ void M_Menu_FPS_f (void)
key_dest = key_menu; key_dest = key_menu;
m_state = m_complex; m_state = m_complex;
m_entersound = true;
menu = M_CreateMenu(0); menu = M_CreateMenu(0);

View file

@ -44,8 +44,6 @@ void M_MenuS_Script_f (void) //create a menu.
// if (key_dest != key_console) // if (key_dest != key_console)
key_dest = key_menu; key_dest = key_menu;
m_state = m_complex; m_state = m_complex;
if (menu_script != currentmenu)
m_entersound = true;
selectitem = 0; selectitem = 0;
items=0; items=0;

View file

@ -98,7 +98,6 @@ void M_Menu_Save_f (void)
key_dest = key_menu; key_dest = key_menu;
m_state = m_complex; m_state = m_complex;
m_entersound = true;
menu = M_CreateMenu(sizeof(loadsavemenuinfo_t)); menu = M_CreateMenu(sizeof(loadsavemenuinfo_t));
menu->data = menu+1; menu->data = menu+1;
@ -123,7 +122,6 @@ void M_Menu_Load_f (void)
key_dest = key_menu; key_dest = key_menu;
m_state = m_complex; m_state = m_complex;
m_entersound = true;
menu = M_CreateMenu(sizeof(loadsavemenuinfo_t)); menu = M_CreateMenu(sizeof(loadsavemenuinfo_t));
menu->data = menu+1; menu->data = menu+1;
@ -158,7 +156,6 @@ void M_Menu_SinglePlayer_f (void)
key_dest = key_menu; key_dest = key_menu;
m_state = m_complex; m_state = m_complex;
m_entersound = true;
mgt = M_GameType(); mgt = M_GameType();
if (mgt == MGT_QUAKE2) if (mgt == MGT_QUAKE2)
@ -408,7 +405,6 @@ void M_Menu_Demos_f (void)
key_dest = key_menu; key_dest = key_menu;
m_state = m_complex; m_state = m_complex;
m_entersound = true;
menu = M_CreateMenu(sizeof(demomenu_t)); menu = M_CreateMenu(sizeof(demomenu_t));
menu->remove = M_Demo_Remove; menu->remove = M_Demo_Remove;
@ -445,7 +441,6 @@ void M_Menu_ParticleSets_f (void)
key_dest = key_menu; key_dest = key_menu;
m_state = m_complex; m_state = m_complex;
m_entersound = true;
menu = M_CreateMenu(sizeof(demomenu_t)); menu = M_CreateMenu(sizeof(demomenu_t));
menu->remove = M_Demo_Remove; menu->remove = M_Demo_Remove;
@ -474,7 +469,6 @@ void M_Menu_MediaFiles_f (void)
key_dest = key_menu; key_dest = key_menu;
m_state = m_complex; m_state = m_complex;
m_entersound = true;
menu = M_CreateMenu(sizeof(demomenu_t)); menu = M_CreateMenu(sizeof(demomenu_t));
menu->remove = M_Demo_Remove; menu->remove = M_Demo_Remove;

View file

@ -27,8 +27,6 @@ m_state_t m_state;
extern menu_t *menu_script; extern menu_t *menu_script;
qboolean m_entersound; // play after drawing a frame, so caching
// won't disrupt the sound
qboolean m_recursiveDraw; qboolean m_recursiveDraw;
int m_return_state; int m_return_state;
@ -69,7 +67,7 @@ void M_Print (int cx, int cy, qbyte *str)
{ {
while (*str) while (*str)
{ {
M_DrawCharacter (cx, cy, (*str)+128); M_DrawCharacter (cx, cy, (*str)|CON_HIGHCHARSMASK);
str++; str++;
cx += 8; cx += 8;
} }
@ -79,7 +77,7 @@ void M_PrintColoured (int cx, int cy, int colour, qbyte *str)
{ {
while (*str) while (*str)
{ {
M_DrawColouredCharacter (cx, cy, (*str) + (colour<<8)); M_DrawColouredCharacter (cx, cy, (*str) + (colour<<CON_FGMASK));
str++; str++;
cx += 8; cx += 8;
} }
@ -219,7 +217,6 @@ void M_ToggleMenu_f (void)
if (MP_Toggle()) if (MP_Toggle())
return; return;
#endif #endif
m_entersound = true;
if (key_dest == key_menu) if (key_dest == key_menu)
{ {
@ -346,7 +343,6 @@ void M_Menu_Keys_f (void)
{ {
key_dest = key_menu; key_dest = key_menu;
m_state = m_keys; m_state = m_keys;
m_entersound = true;
#ifdef Q2CLIENT #ifdef Q2CLIENT
if (cls.protocol == CP_QUAKE2) if (cls.protocol == CP_QUAKE2)
@ -538,7 +534,6 @@ void M_Menu_Help_f (void)
{ {
key_dest = key_menu; key_dest = key_menu;
m_state = m_help; m_state = m_help;
m_entersound = true;
help_page = 0; help_page = 0;
if (COM_FDepthFile("gfx/help1.lmp", true) < COM_FDepthFile("gfx/menu/help1.lmp", true)) if (COM_FDepthFile("gfx/help1.lmp", true) < COM_FDepthFile("gfx/menu/help1.lmp", true))
@ -578,14 +573,14 @@ void M_Help_Key (int key)
case K_UPARROW: case K_UPARROW:
case K_RIGHTARROW: case K_RIGHTARROW:
m_entersound = true; S_LocalSound ("misc/menu2.wav");
if (++help_page >= num_help_pages) if (++help_page >= num_help_pages)
help_page = 0; help_page = 0;
break; break;
case K_DOWNARROW: case K_DOWNARROW:
case K_LEFTARROW: case K_LEFTARROW:
m_entersound = true; S_LocalSound ("misc/menu2.wav");
if (--help_page < 0) if (--help_page < 0)
help_page = num_help_pages-1; help_page = num_help_pages-1;
break; break;
@ -781,7 +776,6 @@ void M_Menu_Quit_f (void)
key_dest = key_menu; key_dest = key_menu;
m_state = m_complex; m_state = m_complex;
m_entersound = true;
M_RemoveMenu(&quitmenu); M_RemoveMenu(&quitmenu);
memset(&quitmenu, 0, sizeof(quitmenu)); memset(&quitmenu, 0, sizeof(quitmenu));
@ -1005,12 +999,6 @@ void M_Draw (int uimenu)
#endif #endif
} }
if (m_entersound)
{
S_LocalSound ("misc/menu2.wav");
m_entersound = false;
}
VID_UnlockBuffer (); VID_UnlockBuffer ();
S_ExtraUpdate (); S_ExtraUpdate ();
VID_LockBuffer (); VID_LockBuffer ();

View file

@ -278,8 +278,6 @@ void M_Complex_Draw(void);
void M_Script_Init(void); void M_Script_Init(void);
void M_Serverlist_Init(void); void M_Serverlist_Init(void);
extern qboolean m_entersound;
void M_Menu_Main_f (void); void M_Menu_Main_f (void);
void M_Menu_SinglePlayer_f (void); void M_Menu_SinglePlayer_f (void);
void M_Menu_Load_f (void); void M_Menu_Load_f (void);

View file

@ -1138,7 +1138,6 @@ void M_Menu_Video_f (void)
key_dest = key_menu; key_dest = key_menu;
m_state = m_complex; m_state = m_complex;
m_entersound = true;
menu = M_CreateMenu(sizeof(videomenuinfo_t)); menu = M_CreateMenu(sizeof(videomenuinfo_t));
info = menu->data; info = menu->data;

View file

@ -110,7 +110,7 @@ void Sbar_ChatModeOverlay(void);
void Draw_FunString(int x, int y, unsigned char *str) void Draw_FunString(int x, int y, unsigned char *str)
{ {
int ext = COLOR_WHITE<<8; int ext = CON_WHITEMASK;
int extstack[4]; int extstack[4];
int extstackdepth = 0; int extstackdepth = 0;
@ -120,21 +120,21 @@ void Draw_FunString(int x, int y, unsigned char *str)
if (*str == '^') if (*str == '^')
{ {
str++; str++;
if (*str >= '0' && *str <= '7') if (*str >= '0' && *str <= '9')
{ {
ext = (*str++-'0')*256 + (ext&~CON_COLOURMASK); //change colour only. ext = q3codemasks[*str++-'0'] | (ext&~CON_Q3MASK); //change colour only.
continue; continue;
} }
else if (*str == 'a') else if (*str == 'a')
{ {
str++; str++;
ext = (ext & ~CON_2NDCHARSETTEXT) + (CON_2NDCHARSETTEXT - (ext & CON_2NDCHARSETTEXT)); ext ^= CON_2NDCHARSETTEXT;
continue; continue;
} }
else if (*str == 'b') else if (*str == 'b')
{ {
str++; str++;
ext = (ext & ~CON_BLINKTEXT) + (CON_BLINKTEXT - (ext & CON_BLINKTEXT)); ext ^= CON_BLINKTEXT;
continue; continue;
} }
else if (*str == 's') //store on stack (it's great for names) else if (*str == 's') //store on stack (it's great for names)
@ -159,26 +159,26 @@ void Draw_FunString(int x, int y, unsigned char *str)
} }
else if (*str == '^') else if (*str == '^')
{ {
Draw_ColouredCharacter(x, y, '^' + ext); Draw_ColouredCharacter(x, y, '^' | ext);
str++; str++;
} }
else else
{ {
Draw_ColouredCharacter(x, y, '^' + ext); Draw_ColouredCharacter(x, y, '^' | ext);
x += 8; x += 8;
Draw_ColouredCharacter (x, y, (*str++) + ext); Draw_ColouredCharacter (x, y, (*str++) | ext);
} }
x += 8; x += 8;
continue; continue;
} }
Draw_ColouredCharacter (x, y, (*str++) + ext); Draw_ColouredCharacter (x, y, (*str++) | ext);
x += 8; x += 8;
} }
} }
void Draw_FunStringLen(int x, int y, unsigned char *str, int len) void Draw_FunStringLen(int x, int y, unsigned char *str, int len)
{ {
int ext = COLOR_WHITE<<8; int ext = CON_WHITEMASK;
int extstack[4]; int extstack[4];
int extstackdepth = 0; int extstackdepth = 0;
@ -191,21 +191,21 @@ void Draw_FunStringLen(int x, int y, unsigned char *str, int len)
if (*str == '^') if (*str == '^')
{ {
str++; str++;
if (*str >= '0' && *str <= '7') if (*str >= '0' && *str <= '9')
{ {
ext = (*str++-'0')*256 + (ext&~CON_COLOURMASK); //change colour only. ext = q3codemasks[*str++-'0'] | (ext&~CON_Q3MASK); //change colour only.
continue; continue;
} }
else if (*str == 'a') else if (*str == 'a')
{ {
str++; str++;
ext = (ext & ~CON_2NDCHARSETTEXT) + (CON_2NDCHARSETTEXT - (ext & CON_2NDCHARSETTEXT)); ext ^= CON_2NDCHARSETTEXT;
continue; continue;
} }
else if (*str == 'b') else if (*str == 'b')
{ {
str++; str++;
ext = (ext & ~CON_BLINKTEXT) + (CON_BLINKTEXT - (ext & CON_BLINKTEXT)); ext ^= CON_BLINKTEXT;
continue; continue;
} }
else if (*str == 's') //store on stack (it's great for names) else if (*str == 's') //store on stack (it's great for names)
@ -229,19 +229,19 @@ void Draw_FunStringLen(int x, int y, unsigned char *str, int len)
} }
else if (*str == '^') else if (*str == '^')
{ {
Draw_ColouredCharacter(x, y, '^' + ext); Draw_ColouredCharacter(x, y, '^' | ext);
str++; str++;
} }
else else
{ {
Draw_ColouredCharacter(x, y, '^' + ext); Draw_ColouredCharacter(x, y, '^' | ext);
x += 8; x += 8;
Draw_ColouredCharacter (x, y, (*str++) + ext); Draw_ColouredCharacter (x, y, (*str++) | ext);
} }
x += 8; x += 8;
continue; continue;
} }
Draw_ColouredCharacter (x, y, (*str++) + ext); Draw_ColouredCharacter (x, y, (*str++) | ext);
x += 8; x += 8;
} }
} }
@ -2056,7 +2056,7 @@ void Sbar_DeathmatchOverlay (int start)
y += skip; y += skip;
} }
Draw_Character(0,0,COLOR_WHITE<<8); Draw_Character(0,0,CON_WHITEMASK);
if (y >= vid.height-10) // we ran over the screen size, squish if (y >= vid.height-10) // we ran over the screen size, squish
largegame = true; largegame = true;
@ -2157,7 +2157,7 @@ void Sbar_ChatModeOverlay(void)
y += skip; y += skip;
} }
Draw_Character(0,0,COLOR_WHITE<<8); Draw_Character(0,0,CON_WHITEMASK);
if (y >= vid.height-10) // we ran over the screen size, squish if (y >= vid.height-10) // we ran over the screen size, squish
largegame = true; largegame = true;
@ -2240,7 +2240,7 @@ void Sbar_MiniDeathmatchOverlay (void)
f = s->frags; f = s->frags;
sprintf (num, "%3i",f); sprintf (num, "%3i",f);
Draw_ColouredCharacter ( x+8 , y, (COLOR_WHITE<<8)|num[0]); Draw_ColouredCharacter ( x+8 , y, CON_WHITEMASK|num[0]);
Draw_Character ( x+16, y, num[1]); Draw_Character ( x+16, y, num[1]);
Draw_Character ( x+24, y, num[2]); Draw_Character ( x+24, y, num[2]);
@ -2270,7 +2270,7 @@ void Sbar_MiniDeathmatchOverlay (void)
// draw seperator // draw seperator
x += 208; x += 208;
for (y = sbar_rect.height - sb_lines; y < sbar_rect.height - 6; y += 2) for (y = sbar_rect.height - sb_lines; y < sbar_rect.height - 6; y += 2)
Draw_ColouredCharacter(x, y, (COLOR_WHITE<<8)|14); Draw_ColouredCharacter(x, y, CON_WHITEMASK|14);
x += 16; x += 16;

View file

@ -760,7 +760,7 @@ void Draw_CursorLine(int ox, int y, fileblock_t *b)
if (*d == '\t') if (*d == '\t')
{ {
if (a == cx) if (a == cx)
Draw_ColouredCharacter (x+ox, y, 11|M_COLOR_WHITE); Draw_ColouredCharacter (x+ox, y, 11|CON_WHITEMASK);
x+=ts; x+=ts;
x-=x%ts; x-=x%ts;
d++; d++;
@ -770,9 +770,9 @@ void Draw_CursorLine(int ox, int y, fileblock_t *b)
if (x+ox< vid.width) if (x+ox< vid.width)
{ {
if (a == cx) if (a == cx)
Draw_ColouredCharacter (x+ox, y, 11|M_COLOR_WHITE); Draw_ColouredCharacter (x+ox, y, 11|CON_WHITEMASK);
else else
Draw_ColouredCharacter (x+ox, y, (int)*d | (colour<<8)); Draw_ColouredCharacter (x+ox, y, (int)*d | (colour<<CON_FGSHIFT));
} }
d++; d++;
x += 8; x += 8;
@ -816,7 +816,7 @@ void Draw_NonCursorLine(int x, int y, fileblock_t *b)
continue; continue;
} }
if (x+nx < vid.width) if (x+nx < vid.width)
Draw_ColouredCharacter (x+nx, y, (int)*d | (colour<<8)); Draw_ColouredCharacter (x+nx, y, (int)*d | (colour<<CON_FGSHIFT));
d++; d++;
nx += 8; nx += 8;
} }
@ -894,9 +894,9 @@ void Editor_Draw(void)
x = 0; x = 0;
if (madechanges) if (madechanges)
Draw_Character (vid.width - 8, 0, '!'|128); Draw_Character (vid.width - 8, 0, '!'|CON_HIGHCHARSMASK);
if (!insertkeyhit) if (!insertkeyhit)
Draw_Character (vid.width - 16, 0, 'O'|128); Draw_Character (vid.width - 16, 0, 'O'|CON_HIGHCHARSMASK);
Draw_String(0, 0, va("%6i:%4i:%s", cursorlinenum, cursorx+1, OpenEditorFile)); Draw_String(0, 0, va("%6i:%4i:%s", cursorlinenum, cursorx+1, OpenEditorFile));
if (useeval) if (useeval)

View file

@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef FISH #ifdef FISH
void R_RenderView_fisheye(void); void R_RenderView_fisheye(void);
cvar_t ffov = {"ffov", "160"}; cvar_t ffov = {"ffov", "0"};
cvar_t fviews = {"fviews", "6"}; cvar_t fviews = {"fviews", "6"};
#endif #endif
@ -43,7 +43,7 @@ when crossing a water boudnary.
*/ */
#ifdef SIDEVIEWS #ifdef SIDEVIEWS
cvar_t vsec_enabled[SIDEVIEWS] = {{"v2_enabled", "1"}, {"v3_enabled", "0"}, {"v4_enabled", "0"}, {"v5_enabled", "0"}}; cvar_t vsec_enabled[SIDEVIEWS] = {{"v2_enabled", "0"}, {"v3_enabled", "0"}, {"v4_enabled", "0"}, {"v5_enabled", "0"}};
cvar_t vsec_x[SIDEVIEWS] = {{"v2_x", "0"}, {"v3_x", "0.25"}, {"v4_x", "0.5"}, {"v5_x", "0.75"}}; cvar_t vsec_x[SIDEVIEWS] = {{"v2_x", "0"}, {"v3_x", "0.25"}, {"v4_x", "0.5"}, {"v5_x", "0.75"}};
cvar_t vsec_y[SIDEVIEWS] = {{"v2_y", "0"}, {"v3_y", "0"}, {"v4_y", "0"}, {"v5_y", "0"}}; cvar_t vsec_y[SIDEVIEWS] = {{"v2_y", "0"}, {"v3_y", "0"}, {"v4_y", "0"}, {"v5_y", "0"}};
cvar_t vsec_scalex[SIDEVIEWS] = {{"v2_scalex", "0.25"}, {"v3_scalex", "0.25"}, {"v4_scalex", "0.25"}, {"v5_scalex", "0.25"}}; cvar_t vsec_scalex[SIDEVIEWS] = {{"v2_scalex", "0.25"}, {"v3_scalex", "0.25"}, {"v4_scalex", "0.25"}, {"v5_scalex", "0.25"}};

View file

@ -1393,7 +1393,7 @@ static char *TP_ParseFunChars (char *s, qbool chat)
} }
} }
if (!chat && *s == '^' && s[1] && s[1] != ' ') { if (!chat && *s == '^' && s[1] && s[1] != ' ') {
*out++ = s[1] | 128; *out++ = s[1] | CON_HIGHCHARSMASK;
s += 2; s += 2;
continue; continue;
} }

View file

@ -2773,7 +2773,7 @@ void Cmd_Condump_f(void)
// print out current contents of console // print out current contents of console
// stripping out starting blank lines and blank spaces // stripping out starting blank lines and blank spaces
{ {
unsigned short *text; conchar_t *text;
int row, line, x, spc, content; int row, line, x, spc, content;
console_t *curcon = &con_main; console_t *curcon = &con_main;

View file

@ -21,31 +21,53 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// console // console
// //
#define MAXCONCOLOURS 8 typedef unsigned int conchar_t;
#define MAXCONCOLOURS 16
typedef struct { typedef struct {
float r, g, b; int ir, ig, ib;
int rgbmask; float fr, fg, fb;
} consolecolours_t; } consolecolours_t;
extern consolecolours_t consolecolours[MAXCONCOLOURS]; extern consolecolours_t consolecolours[MAXCONCOLOURS];
#define CON_STANDARDMASK 0x0080 #define MAXQ3COLOURS 10
#define CON_COLOURMASK 0x0700 extern conchar_t q3codemasks[MAXQ3COLOURS];
#define CON_SPAREMASK3 0x0800 //something cool?
#define CON_SPAREMASK2 0x1000 //underline?
#define CON_SPAREMASK1 0x2000 //italics?
#define CON_BLINKTEXT 0x4000
#define CON_2NDCHARSETTEXT 0x8000
#define CON_NONCLEARBG 0x00800000
#define CON_BLINKTEXT 0x00400000
#define CON_2NDCHARSETTEXT 0x00200000
#define CON_HALFALPHA 0x00100000
#define CON_HIGHCHARSMASK 0x00000080 // Quake's alternative mask
#define CON_FLAGSMASK 0xFFFF0000
#define CON_CHARMASK 0x000000FF
#define CON_FGMASK 0x0F000000
#define CON_BGMASK 0xF0000000
#define CON_FGSHIFT 24
#define CON_BGSHIFT 28
#define CON_Q3MASK 0x0F100000
#define CON_WHITEMASK 0x0F000000 // must be constant. things assume this
// RGBI standard colors
#define COLOR_BLACK 0 #define COLOR_BLACK 0
#define COLOR_RED 1 #define COLOR_DARKBLUE 1
#define COLOR_GREEN 2 #define COLOR_DARKGREEN 2
#define COLOR_YELLOW 3 #define COLOR_DARKCYAN 3
#define COLOR_BLUE 4 #define COLOR_DARKRED 4
#define COLOR_MAGENTA 5 #define COLOR_DARKMAGENTA 5
#define COLOR_CYAN 6 #define COLOR_BROWN 6
#define COLOR_WHITE 7 #define COLOR_GREY 7
#define COLOR_DARKGREY 8
#define M_COLOR_WHITE ((COLOR_WHITE)<<8) #define COLOR_BLUE 9
#define COLOR_GREEN 10
#define COLOR_CYAN 11
#define COLOR_RED 12
#define COLOR_MAGENTA 13
#define COLOR_YELLOW 14
#define COLOR_WHITE 15
#define S_COLOR_BLACK "^0" #define S_COLOR_BLACK "^0"
#define S_COLOR_RED "^1" #define S_COLOR_RED "^1"
@ -57,10 +79,11 @@ extern consolecolours_t consolecolours[MAXCONCOLOURS];
#define S_COLOR_WHITE "^7" #define S_COLOR_WHITE "^7"
#define CON_TEXTSIZE 16384 #define CON_TEXTSIZE 16384
typedef struct console_s typedef struct console_s
{ {
char name[64]; char name[64];
unsigned short text[CON_TEXTSIZE]; conchar_t text[CON_TEXTSIZE];
int current; // line where next message will be printed int current; // line where next message will be printed
int x; // offset in current line for next print int x; // offset in current line for next print
int display; // bottom of console displays this line int display; // bottom of console displays this line
@ -78,7 +101,7 @@ typedef struct console_s
extern console_t con_main; extern console_t con_main;
extern console_t *con_current; // point to either con_main or con_chat extern console_t *con_current; // point to either con_main or con_chat
extern int con_ormask; extern conchar_t con_ormask;
extern int scr_chatmode; extern int scr_chatmode;

View file

@ -113,7 +113,7 @@ void Con_Log (char *s)
char c; char c;
c = *(s+1); c = *(s+1);
if ((c >= '0' && c < '8') || c == 'a' || c == 'b' || c == 's' || c == 'r') if ((c >= '0' && c <= '9') || c == 'a' || c == 'b' || c == 's' || c == 'r')
{ {
i--; i--;
s++; s++;

View file

@ -125,7 +125,9 @@ typedef struct plugin_s {
//protocol-in-a-plugin //protocol-in-a-plugin
int connectionlessclientpacket; int connectionlessclientpacket;
#endif #endif
int messagefunction; int svmsgfunction;
int chatmsgfunction;
int centerprintfunction;
struct plugin_s *next; struct plugin_s *next;
} plugin_t; } plugin_t;
@ -371,8 +373,12 @@ int VARGS Plug_ExportToEngine(void *offset, unsigned int mask, const long *arg)
currentplug->sbarlevel[2] = arg[1]; currentplug->sbarlevel[2] = arg[1];
else if (!strcmp(name, "ConnectionlessClientPacket")) else if (!strcmp(name, "ConnectionlessClientPacket"))
currentplug->connectionlessclientpacket = arg[1]; currentplug->connectionlessclientpacket = arg[1];
else if (!strcmp(name, "MessageEvent")) else if (!strcmp(name, "ServerMessageEvent"))
currentplug->messagefunction = arg[1]; currentplug->svmsgfunction = arg[1];
else if (!strcmp(name, "ChatMessageEvent"))
currentplug->chatmsgfunction = arg[1];
else if (!strcmp(name, "CenterPrintMessage"))
currentplug->centerprintfunction = arg[1];
#endif #endif
else else
return 0; return 0;
@ -1549,17 +1555,49 @@ void Plug_SBar(void)
} }
#endif #endif
int Plug_Message(int clientnum, int messagelevel, char *buffer) qboolean Plug_ServerMessage(char *buffer, int messagelevel)
{ {
qboolean ret = true;
for (currentplug = plugs; currentplug; currentplug = currentplug->next) for (currentplug = plugs; currentplug; currentplug = currentplug->next)
{ {
if (currentplug->messagefunction) if (currentplug->svmsgfunction)
{ {
VM_Call(currentplug->vm, currentplug->messagefunction, clientnum, messagelevel, buffer); ret &= VM_Call(currentplug->vm, currentplug->svmsgfunction, buffer, messagelevel);
} }
} }
return 1; // don't silence message return ret; // true to display message, false to supress
}
qboolean Plug_ChatMessage(char *buffer, int talkernum, int tpflags)
{
qboolean ret = true;
for (currentplug = plugs; currentplug; currentplug = currentplug->next)
{
if (currentplug->chatmsgfunction)
{
ret &= VM_Call(currentplug->vm, currentplug->chatmsgfunction, buffer, talkernum, tpflags);
}
}
return ret; // true to display message, false to supress
}
qboolean Plug_CenterPrintMessage(char *buffer, int clientnum)
{
qboolean ret = true;
for (currentplug = plugs; currentplug; currentplug = currentplug->next)
{
if (currentplug->centerprintfunction)
{
ret &= VM_Call(currentplug->vm, currentplug->centerprintfunction, buffer, clientnum);
}
}
return ret; // true to display message, false to supress
} }
void Plug_Close(plugin_t *plug) void Plug_Close(plugin_t *plug)

View file

@ -1279,9 +1279,10 @@ void GLDraw_Character (int x, int y, unsigned int num)
#endif*/ #endif*/
} }
void GLDraw_FillRGB (int x, int y, int w, int h, float r, float g, float b);
void GLDraw_ColouredCharacter (int x, int y, unsigned int num) void GLDraw_ColouredCharacter (int x, int y, unsigned int num)
{ {
int col; unsigned int col;
if (num & CON_BLINKTEXT) if (num & CON_BLINKTEXT)
{ {
@ -1290,11 +1291,16 @@ void GLDraw_ColouredCharacter (int x, int y, unsigned int num)
return; return;
} }
// draw background
if (num & CON_NONCLEARBG)
{ {
col = (num&CON_COLOURMASK)/256; col = (num & CON_BGMASK) >> CON_BGSHIFT;
qglColor3f(consolecolours[col].r, consolecolours[col].g, consolecolours[col].b); GLDraw_FillRGB(x, y, 8, 8, consolecolours[col].fr, consolecolours[col].fg, consolecolours[col].fb);
} }
// render character with foreground color
col = (num & CON_FGMASK) >> CON_FGSHIFT;
qglColor3f(consolecolours[col].fr, consolecolours[col].fg, consolecolours[col].fb);
Draw_Character(x, y, num); Draw_Character(x, y, num);
} }
/* /*
@ -1948,30 +1954,10 @@ void GLDraw_TileClear (int x, int y, int w, int h)
} }
} }
void GLDraw_FillRGB (int x, int y, int w, int h, float r, float g, float b)
/*
=============
Draw_Fill
Fills a box of pixels with a single color
=============
*/
void GLDraw_Fill (int x, int y, int w, int h, int c)
{ {
extern qboolean gammaworks;
qglDisable (GL_TEXTURE_2D); qglDisable (GL_TEXTURE_2D);
if (gammaworks) qglColor3f (r, g, b);
{
qglColor3f (host_basepal[c*3]/255.0,
host_basepal[c*3+1]/255.0,
host_basepal[c*3+2]/255.0);
}
else
{
qglColor3f (gammatable[host_basepal[c*3]]/255.0,
gammatable[host_basepal[c*3+1]]/255.0,
gammatable[host_basepal[c*3+2]]/255.0);
}
qglBegin (GL_QUADS); qglBegin (GL_QUADS);
@ -1984,6 +1970,32 @@ void GLDraw_Fill (int x, int y, int w, int h, int c)
qglColor3f (1,1,1); qglColor3f (1,1,1);
qglEnable (GL_TEXTURE_2D); qglEnable (GL_TEXTURE_2D);
} }
/*
=============
Draw_Fill
Fills a box of pixels with a single color
=============
*/
void GLDraw_Fill (int x, int y, int w, int h, int c)
{
extern qboolean gammaworks;
if (gammaworks)
{
GLDraw_FillRGB (x, y, w, h,
host_basepal[c*3]/255.0,
host_basepal[c*3+1]/255.0,
host_basepal[c*3+2]/255.0);
}
else
{
GLDraw_FillRGB (x, y, w, h,
gammatable[host_basepal[c*3]]/255.0,
gammatable[host_basepal[c*3+1]]/255.0,
gammatable[host_basepal[c*3+2]]/255.0);
}
}
//============================================================================= //=============================================================================
/* /*

View file

@ -38,6 +38,7 @@ void GLDraw_EditorBackground (int lines);
void GLDraw_BeginDisc (void); void GLDraw_BeginDisc (void);
void GLDraw_EndDisc (void); void GLDraw_EndDisc (void);
void GLDraw_TileClear (int x, int y, int w, int h); void GLDraw_TileClear (int x, int y, int w, int h);
void GLDraw_FillRGB (int x, int y, int w, int h, float r, float g, float b);
void GLDraw_Fill (int x, int y, int w, int h, int c); void GLDraw_Fill (int x, int y, int w, int h, int c);
void GLDraw_FadeScreen (void); void GLDraw_FadeScreen (void);
void GLDraw_String (int x, int y, const qbyte *str); void GLDraw_String (int x, int y, const qbyte *str);

View file

@ -30,7 +30,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//okay, so these are a quick but easy hack //okay, so these are a quick but easy hack
void ED_Print (struct progfuncs_s *progfuncs, struct edict_s *ed); void ED_Print (struct progfuncs_s *progfuncs, struct edict_s *ed);
int PR_EnableEBFSBuiltin(char *name, int binum); int PR_EnableEBFSBuiltin(char *name, int binum);
void PR_CleanLogText_Init (void);
cvar_t nomonsters = {"nomonsters", "0"}; cvar_t nomonsters = {"nomonsters", "0"};
cvar_t gamecfg = {"gamecfg", "0"}; cvar_t gamecfg = {"gamecfg", "0"};
@ -535,8 +534,6 @@ void PR_LoadGlabalStruct(void)
pr_items2 = !!PR_FindGlobal(svprogfuncs, "items2", 0); pr_items2 = !!PR_FindGlobal(svprogfuncs, "items2", 0);
PR_CleanLogText_Init();
SV_ClearQCStats(); SV_ClearQCStats();
if (progstype == PROG_H2) if (progstype == PROG_H2)
@ -5362,7 +5359,7 @@ void PF_redstring(progfuncs_t *prinst, struct globalvars_s *pr_globals)
static char buf[1024]; static char buf[1024];
for (s = buf; *string; s++, string++) for (s = buf; *string; s++, string++)
*s=*string|128; *s=*string|CON_HIGHCHARSMASK;
*s = '\0'; *s = '\0';
RETURN_TSTRING(buf); RETURN_TSTRING(buf);
@ -6836,66 +6833,46 @@ void PF_strstr (progfuncs_t *prinst, struct globalvars_s *pr_globals)
RETURN_TSTRING(p); RETURN_TSTRING(p);
} }
/* char readable2[256] =
====================
SV_CleanName_Init
sets chararcter table to translate quake texts to more friendly texts
====================
*/
char chartbl2[256];
void PR_CleanLogText_Init (void)
{ {
int i; '.', '_', '_', '_', '_', '.', '_', '_',
'_', '_', '\n', '_', '\n', '>', '.', '.',
for (i = 0; i < 256; i++) '[', ']', '0', '1', '2', '3', '4', '5',
chartbl2[i] = (i&127) < 32 ? ' ' : i&127; '6', '7', '8', '9', '.', '_', '_', '_',
' ', '!', '\"', '#', '$', '%', '&', '\'',
chartbl2[13] = 13; '(', ')', '*', '+', ',', '-', '.', '/',
chartbl2[10] = 10; '0', '1', '2', '3', '4', '5', '6', '7',
// special cases '8', '9', ':', ';', '<', '=', '>', '?',
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
// numbers 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
for (i = 18; i < 28; i++) 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
chartbl2[i] = chartbl2[i + 128] = i + 30; 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
// brackets 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
chartbl2[29] = chartbl2[29 + 128] = chartbl2[128] = '('; 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
chartbl2[31] = chartbl2[31 + 128] = chartbl2[130] = ')'; 'x', 'y', 'z', '{', '|', '}', '~', '_',
chartbl2[16] = chartbl2[16 + 128]= '['; '_', '_', '_', '_', '_', '.', '_', '_',
chartbl2[17] = chartbl2[17 + 128] = ']'; '_', '_', '_', '_', '_', '>', '.', '.',
'[', ']', '0', '1', '2', '3', '4', '5',
// hash '6', '7', '8', '9', '.', '_', '_', '_',
for (i = 1; i < 10; i++) // 5 redefined as '.' ' ', '!', '\"', '#', '$', '%', '&', '\'',
chartbl2[i] = chartbl2[i + 128] = '#'; '(', ')', '*', '+', ',', '-', '.', '/',
'0', '1', '2', '3', '4', '5', '6', '7',
chartbl2[11] = chartbl2[11 + 128] = '#'; '8', '9', ':', ';', '<', '=', '>', '?',
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
// dot 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
chartbl2[5] = chartbl2[14] = chartbl2[15] = chartbl2[28] = chartbl2[46] = '.'; 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
chartbl2[5 + 128] = chartbl2[14 + 128] = chartbl2[15 + 128] = chartbl2[28 + 128] = chartbl2[46 + 128] = '.'; 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
// left arrow 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
chartbl2[127] = '>'; 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
'x', 'y', 'z', '{', '|', '}', '~', '_'
// right arrow };
chartbl2[141] = '<';
// '='
chartbl2[30] = chartbl2[129] = chartbl2[30 + 128] = '=';
// whitespaces
chartbl2[12] = chartbl2[12 + 128] = chartbl2[138] = ' ';
chartbl2[33] = chartbl2[33 + 128]= '!';
}
void PR_CleanText(unsigned char *text) void PR_CleanText(unsigned char *text)
{ {
for ( ; *text; text++) for ( ; *text; text++)
*text = chartbl2[*text]; *text = readable2[*text];
} }
/* /*

View file

@ -899,8 +899,8 @@ void SV_MVDWritePackets (int num)
demo.dbuf->maxsize = MAXSIZE + demo.dbuf->bufsize; demo.dbuf->maxsize = MAXSIZE + demo.dbuf->bufsize;
} }
static char chartbl[256]; extern char readable[256];
void CleanName_Init (); #define chartbl readable
void MVD_Init (void) void MVD_Init (void)
{ {
@ -918,15 +918,8 @@ void MVD_Init (void)
Cvar_Register (&sv_demoSuffix, MVDVARGROUP); Cvar_Register (&sv_demoSuffix, MVDVARGROUP);
Cvar_Register (&sv_demotxt, MVDVARGROUP); Cvar_Register (&sv_demotxt, MVDVARGROUP);
Cvar_Register (&sv_demoExtraNames, MVDVARGROUP); Cvar_Register (&sv_demoExtraNames, MVDVARGROUP);
CleanName_Init();
} }
static char *SV_PrintTeams(void) static char *SV_PrintTeams(void)
{ {
char *teams[MAX_CLIENTS]; char *teams[MAX_CLIENTS];
@ -1523,85 +1516,6 @@ static qboolean SV_MVD_Record (mvddest_t *dest)
return true; return true;
} }
/*
====================
SV_CleanName_Init
sets chararcter table for quake text->filename translation
====================
*/
void CleanName_Init ()
{
int i;
for (i = 0; i < 256; i++)
chartbl[i] = (((i&127) < 'a' || (i&127) > 'z') && ((i&127) < '0' || (i&127) > '9')) ? '_' : (i&127);
// special cases
// numbers
for (i = 18; i < 29; i++)
chartbl[i] = chartbl[i + 128] = i + 30;
// allow lowercase only
for (i = 'A'; i <= 'Z'; i++)
chartbl[i] = chartbl[i+128] = i + 'a' - 'A';
// brackets
chartbl[29] = chartbl[29+128] = chartbl[128] = '(';
chartbl[31] = chartbl[31+128] = chartbl[130] = ')';
chartbl[16] = chartbl[16 + 128]= '[';
chartbl[17] = chartbl[17 + 128] = ']';
// dot
chartbl[5] = chartbl[14] = chartbl[15] = chartbl[28] = chartbl[46] = '.';
chartbl[5 + 128] = chartbl[14 + 128] = chartbl[15 + 128] = chartbl[28 + 128] = chartbl[46 + 128] = '.';
// !
chartbl[33] = chartbl[33 + 128] = '!';
// #
chartbl[35] = chartbl[35 + 128] = '#';
// %
chartbl[37] = chartbl[37 + 128] = '%';
// &
chartbl[38] = chartbl[38 + 128] = '&';
// '
chartbl[39] = chartbl[39 + 128] = '\'';
// (
chartbl[40] = chartbl[40 + 128] = '(';
// )
chartbl[41] = chartbl[41 + 128] = ')';
// +
chartbl[43] = chartbl[43 + 128] = '+';
// -
chartbl[45] = chartbl[45 + 128] = '-';
// @
chartbl[64] = chartbl[64 + 128] = '@';
// ^
// chartbl[94] = chartbl[94 + 128] = '^';
chartbl[91] = chartbl[91 + 128] = '[';
chartbl[93] = chartbl[93 + 128] = ']';
chartbl[16] = chartbl[16 + 128] = '[';
chartbl[17] = chartbl[17 + 128] = ']';
chartbl[123] = chartbl[123 + 128] = '{';
chartbl[125] = chartbl[125 + 128] = '}';
}
/* /*
==================== ====================
SV_CleanName SV_CleanName

View file

@ -41,8 +41,19 @@ cvar_t sys_linebuffer = {"sys_linebuffer", "1"};
qboolean stdin_ready; qboolean stdin_ready;
// This is for remapping the Q3 color codes to character masks, including ^9
conchar_t q3codemasks[MAXQ3COLOURS] = {
0x00000000, // 0, black
0x0c000000, // 1, red
0x0a000000, // 2, green
0x0e000000, // 3, yellow
0x09000000, // 4, blue
0x0b000000, // 5, cyan
0x0d000000, // 6, magenta
0x0f000000, // 7, white
0x0f100000, // 8, half-alpha white (BX_COLOREDTEXT)
0x07000000 // 9, "half-intensity" (BX_COLOREDTEXT)
};
struct termios orig, changes; struct termios orig, changes;
@ -186,40 +197,65 @@ void Sys_Error (const char *error, ...)
exit (1); exit (1);
} }
int ansiremap[8] = {0, 4, 2, 6, 1, 5, 3, 7};
void ApplyColour(unsigned int chr) void ApplyColour(unsigned int chr)
{ {
static int oldchar = 7*256; static int oldchar = CON_WHITEMASK;
chr = chr&~255; int bg, fg;
chr &= CON_FLAGSMASK;
if (oldchar == chr) if (oldchar == chr)
return; return;
oldchar = chr; oldchar = chr;
switch(chr&CON_COLOURMASK)
printf("\e[0;"); // reset
if (chr & CON_BLINKTEXT)
printf("5;"); // set blink
bg = chr & CON_BGMASK >> CON_BGSHIFT;
fg = chr & CON_FGMASK >> CON_FGSHIFT;
// don't handle intensive bit for background
// as terminals differ too much in displaying \e[1;7;3?m
bg &= 0x7;
if (chr & CON_NONCLEARBG)
{ {
//to get around wierd defaults (like a white background) we have these special hacks for colours 0 and 7 if (fg & 0x8) // intensive bit set for foreground
case 0*256: {
printf("\e[0;7%sm", (chr&CON_BLINKTEXT)?";5":""); printf("1;"); // set bold/intensity ansi flag
fg &= 0x7; // strip intensive bit
}
// set foreground and background colors
printf("3%i;4%im", ansiremap[fg], ansiremap[bg]);
}
else
{
switch(fg)
{
//to get around wierd defaults (like a white background) we have these special hacks for colours 0 and 7
case COLOR_BLACK:
printf("7m"); // set inverse
break; break;
case 7*256: case COLOR_GREY:
printf("\e[0%sm", (chr&CON_BLINKTEXT)?";5":""); printf("1;30m"); // treat as dark grey
break;
case COLOR_WHITE:
print("m"); // set nothing else
break; break;
default: default:
printf("\e[0;%i%sm", 30+((chr&CON_COLOURMASK)>>8), (chr&CON_BLINKTEXT)?";5":""); if (fg & 0x8) // intensive bit set for foreground
{
printf("1;"); // set bold/intensity ansi flag
fg &= 0x7; // strip intensive bit
}
printf("3%im", fg); // set foreground
break; break;
} }
}
} }
#define putch(c) putc(c, stdout); #define putch(c) putc(c, stdout);
@ -227,7 +263,7 @@ void Sys_PrintColouredChar(unsigned int chr)
{ {
ApplyColour(chr); ApplyColour(chr);
putch(chr&255); putch(chr & CON_CHARMASK);
} }
/* /*
@ -292,7 +328,7 @@ void Sys_Printf (char *fmt, ...)
if (sys_colorconsole.value) if (sys_colorconsole.value)
{ {
int ext = COLOR_WHITE<<8; int ext = CON_WHITEMASK;
int extstack[4]; int extstack[4];
int extstackdepth = 0; int extstackdepth = 0;
unsigned char *str = (unsigned char*)msg; unsigned char *str = (unsigned char*)msg;
@ -303,21 +339,21 @@ void Sys_Printf (char *fmt, ...)
if (*str == '^') if (*str == '^')
{ {
str++; str++;
if (*str >= '0' && *str <= '7') if (*str >= '0' && *str <= '9')
{ {
ext = (*str++-'0')*256 + (ext&~CON_COLOURMASK); //change colour only. ext = q3codemasks[*str++-'0'] | (ext&~CON_Q3MASK); //change colour only.
continue; continue;
} }
else if (*str == 'a') else if (*str == 'a')
{ {
str++; str++;
ext = (ext & ~CON_2NDCHARSETTEXT) + (CON_2NDCHARSETTEXT - (ext & CON_2NDCHARSETTEXT)); ext ^= CON_2NDCHARSETTEXT;
continue; continue;
} }
else if (*str == 'b') else if (*str == 'b')
{ {
str++; str++;
ext = (ext & ~CON_BLINKTEXT) + (CON_BLINKTEXT - (ext & CON_BLINKTEXT)); ext ^= CON_BLINKTEXT;
continue; continue;
} }
else if (*str == 's') //store on stack (it's great for names) else if (*str == 's') //store on stack (it's great for names)
@ -342,20 +378,20 @@ void Sys_Printf (char *fmt, ...)
} }
else if (*str == '^') else if (*str == '^')
{ {
Sys_PrintColouredChar('^' + ext); Sys_PrintColouredChar('^' | ext);
str++; str++;
} }
else else
{ {
Sys_PrintColouredChar('^' + ext); Sys_PrintColouredChar('^' | ext);
Sys_PrintColouredChar ((*str++) + ext); Sys_PrintColouredChar ((*str++) | ext);
} }
continue; continue;
} }
Sys_PrintColouredChar ((*str++) + ext); Sys_PrintColouredChar ((*str++) | ext);
} }
ApplyColour(7*256); ApplyColour(CON_WHITEMASK);
} }
else else
{ {

View file

@ -31,7 +31,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif #endif
#define SERVICENAME DISTRIBUTION"SV" #define SERVICENAME DISTRIBUTION"SV"
// This is for remapping the Q3 color codes to character masks, including ^9
conchar_t q3codemasks[MAXQ3COLOURS] = {
0x00000000, // 0, black
0x0c000000, // 1, red
0x0a000000, // 2, green
0x0e000000, // 3, yellow
0x09000000, // 4, blue
0x0b000000, // 5, cyan
0x0d000000, // 6, magenta
0x0f000000, // 7, white
0x0f100000, // 8, half-alpha white (BX_COLOREDTEXT)
0x07000000 // 9, "half-intensity" (BX_COLOREDTEXT)
};
static HANDLE hconsoleout; static HANDLE hconsoleout;
static HINSTANCE game_library; static HINSTANCE game_library;
@ -421,75 +433,54 @@ char *Sys_ConsoleInput (void)
void ApplyColour(unsigned int chr) void ApplyColour(unsigned int chr)
{ {
static int oldchar = 7*256; static int oldchar = CON_WHITEMASK;
chr = chr&~255; chr &= CON_FLAGSMASK;
if (oldchar == chr) if (oldchar == chr)
return; return;
oldchar = chr; oldchar = chr;
#if 1
if (hconsoleout) if (hconsoleout)
{ {
int val; unsigned short val = 0;
val = FOREGROUND_INTENSITY;
switch(chr&CON_COLOURMASK) // bits 28-31 of the console chars match up to the attributes for
// the CHAR_INFO struct exactly
if (chr & CON_NONCLEARBG)
val = (chr & (CON_FGMASK|CON_BGMASK) >> CON_FGSHIFT);
else
{ {
case 0*256: int fg = (chr & CON_FGMASK) >> CON_FGSHIFT;
val = FOREGROUND_INTENSITY|FOREGROUND_INTENSITY; //don't allow secret messages (just hard to read)
switch (fg)
{
case COLOR_BLACK: // reverse ^0 like the Linux version
val = BACKGROUND_RED|BACKGROUND_GREEN|BACKGROUND_BLUE;
break; break;
case 1*256: case COLOR_WHITE: // reset to defaults?
val = FOREGROUND_RED|FOREGROUND_INTENSITY; val = FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE; // use grey
break; break;
case 2*256: case COLOR_GREY:
val = FOREGROUND_GREEN|FOREGROUND_INTENSITY; val = FOREGROUND_INTENSITY; // color light grey as dark grey
break; break;
case 3*256: default:
val = FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_INTENSITY; val = fg; // send RGBI value as is
break;
case 4*256:
val = FOREGROUND_BLUE|FOREGROUND_INTENSITY;
break;
case 5*256:
val = FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_INTENSITY;
break;
case 6*256:
val = FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_INTENSITY;
break;
case 7*256:
val = FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE;
break; break;
} }
}
if ((chr & CON_HALFALPHA) && (val & ~FOREGROUND_INTENSITY))
val &= ~FOREGROUND_INTENSITY; // strip intensity to fake alpha
SetConsoleTextAttribute(hconsoleout, val); SetConsoleTextAttribute(hconsoleout, val);
} }
#else
//does ansi work?
//no?
//windows sucks.
switch(chr&CON_COLOURMASK)
{
case 0*256:
printf("%c[%s;3%u;4%um", (char)27,
(chr & CON_BLINKTEXT)? "01" : "00",
(unsigned int)(0),
(unsigned int)(0));
break;
default:
printf("%c[%s;3%u;4%um", (char)27,
(chr & CON_BLINKTEXT)? "01" : "00",
(unsigned int)(7),
(unsigned int)(0));
break;
}
#endif
} }
void Sys_PrintColouredChar(unsigned int chr) void Sys_PrintColouredChar(unsigned int chr)
{ {
ApplyColour(chr); ApplyColour(chr);
printf("%c", chr&255); printf("%c", chr & CON_CHARMASK);
} }
/* /*
@ -551,7 +542,7 @@ void Sys_Printf (char *fmt, ...)
if (sys_colorconsole.value && hconsoleout) if (sys_colorconsole.value && hconsoleout)
{ {
int ext = COLOR_WHITE<<8; int ext = CON_WHITEMASK;
int extstack[4]; int extstack[4];
int extstackdepth = 0; int extstackdepth = 0;
unsigned char *str = (unsigned char*)msg; unsigned char *str = (unsigned char*)msg;
@ -562,21 +553,21 @@ void Sys_Printf (char *fmt, ...)
if (*str == '^') if (*str == '^')
{ {
str++; str++;
if (*str >= '0' && *str <= '7') if (*str >= '0' && *str <= '9')
{ {
ext = (*str++-'0')*256 + (ext&~CON_COLOURMASK); //change colour only. ext = q3codemasks[*str++-'0'] | (ext&~CON_Q3MASK); //change colour only.
continue; continue;
} }
else if (*str == 'a') else if (*str == 'a')
{ {
str++; str++;
ext = (ext & ~CON_2NDCHARSETTEXT) + (CON_2NDCHARSETTEXT - (ext & CON_2NDCHARSETTEXT)); ext ^= CON_2NDCHARSETTEXT;
continue; continue;
} }
else if (*str == 'b') else if (*str == 'b')
{ {
str++; str++;
ext = (ext & ~CON_BLINKTEXT) + (CON_BLINKTEXT - (ext & CON_BLINKTEXT)); ext ^= CON_BLINKTEXT;
continue; continue;
} }
else if (*str == 's') //store on stack (it's great for names) else if (*str == 's') //store on stack (it's great for names)
@ -601,20 +592,20 @@ void Sys_Printf (char *fmt, ...)
} }
else if (*str == '^') else if (*str == '^')
{ {
Sys_PrintColouredChar('^' + ext); Sys_PrintColouredChar('^' | ext);
str++; str++;
} }
else else
{ {
Sys_PrintColouredChar('^' + ext); Sys_PrintColouredChar('^' | ext);
Sys_PrintColouredChar ((*str++) + ext); Sys_PrintColouredChar ((*str++) | ext);
} }
continue; continue;
} }
Sys_PrintColouredChar ((*str++) + ext); Sys_PrintColouredChar ((*str++) | ext);
} }
ApplyColour(7*256); ApplyColour(CON_WHITEMASK);
} }
else else
printf("%s", msg); printf("%s", msg);

View file

@ -153,8 +153,8 @@ int palremapsize;
palremap_t *D_GetPaletteRemap(int red, int green, int blue, qboolean desaturate, qboolean fullbrights, int topcolor, int bottomcolor); palremap_t *D_GetPaletteRemap(int red, int green, int blue, qboolean desaturate, qboolean fullbrights, int topcolor, int bottomcolor);
qbyte *D_GetMenuTintPal(void); qbyte *D_GetMenuTintPal(void);
extern palremap_t *D_IdentityRemap(void); palremap_t *D_IdentityRemap(void);
extern void D_DereferenceRemap(palremap_t *palremap); void D_DereferenceRemap(palremap_t *palremap);
void D_InitTrans(void); void D_InitTrans(void);
// void Set_TransLevelI(int level); // void Set_TransLevelI(int level);

View file

@ -256,7 +256,7 @@ void MakePaletteRemaps(void)
for (i = 2; i < palremapsize; i++) for (i = 2; i < palremapsize; i++)
{ {
palremaps[i].key = 0; palremaps[i].key = 0;
palremaps[i].references = 0; palremaps[i].references = -2147483648;
} }
} }
@ -360,7 +360,7 @@ void BuildModulatedPalette(qbyte *indexes, int red, int green, int blue, qboolea
palremap_t *D_GetPaletteRemap(int red, int green, int blue, qboolean desaturate, qboolean fullbrights, int topcolor, int bottomcolor) palremap_t *D_GetPaletteRemap(int red, int green, int blue, qboolean desaturate, qboolean fullbrights, int topcolor, int bottomcolor)
{ {
int i, key, deref = -1; int i, key, deref = -1, dereflast = 1;
topcolor = topcolor & 0xf; topcolor = topcolor & 0xf;
bottomcolor = bottomcolor & 0xf; bottomcolor = bottomcolor & 0xf;
@ -374,11 +374,17 @@ palremap_t *D_GetPaletteRemap(int red, int green, int blue, qboolean desaturate,
palremaps[i].b == blue && palremaps[i].b == blue &&
palremaps[i].key == key) palremaps[i].key == key)
{ {
if (palremaps[i].references < 1)
palremaps[i].references = 1;
else
palremaps[i].references++; palremaps[i].references++;
return palremaps + i; return palremaps + i;
} }
else if (palremaps[i].references <= 0) else if (palremaps[i].references < dereflast)
{
deref = i; deref = i;
dereflast = palremaps[i].references;
}
} }
if (deref < 2) // no remaps found and all maps are referenced if (deref < 2) // no remaps found and all maps are referenced
@ -420,8 +426,20 @@ palremap_t *RebuildMenuTint(void)
void D_DereferenceRemap(palremap_t *palremap) void D_DereferenceRemap(palremap_t *palremap)
{ {
static int dereftime;
if (palremap && palremap >= palremaps+2) if (palremap && palremap >= palremaps+2)
{
if (palremap->references < 2)
{
if (dereftime >= 0)
dereftime = -2147483648; // lowest negative 32-bit number
palremap->references = dereftime;
dereftime++;
}
else
palremap->references--; palremap->references--;
}
} }
qbyte *D_GetMenuTintPal(void) qbyte *D_GetMenuTintPal(void)
@ -441,7 +459,6 @@ qbyte *D_GetMenuTintPal(void)
return NULL; return NULL;
} }
palremap_t *D_IdentityRemap(void) // TODO: explicitly inline this palremap_t *D_IdentityRemap(void) // TODO: explicitly inline this
{ {
return palremaps; return palremaps;

View file

@ -666,22 +666,19 @@ void SWDraw_Character (int x, int y, unsigned int num)
} }
/* /*
#define FindPalette(r,g,b) pal555to8[((r&0xF8)>>3)|((g&0xF8)<<2)|((b&0xF8)<<7)]
#define colourmask(p,r,g,b) FindPalette(host_basepal[p*3]*r, host_basepal[p*3+1]*g, host_basepal[p*3+2]*b)
#define draw(p) colourmask(p, (int)consolecolours[colour].r, (int)consolecolours[colour].g, (int)consolecolours[colour].b)
*/
#define drawpal(r,g,b) pal555to8[(r|(g<<5)|(b<<10)) & consolecolours[colour].rgbmask] #define drawpal(r,g,b) pal555to8[(r|(g<<5)|(b<<10)) & consolecolours[colour].rgbmask]
#define draw(p) drawpal(host_basepal[p*3]>>3,host_basepal[p*3+1]>>3,host_basepal[p*3+2]>>3) #define draw(p) drawpal(host_basepal[p*3]>>3,host_basepal[p*3+1]>>3,host_basepal[p*3+2]>>3)
*/
#define draw(x) pr->pal[x]
void SWDraw_ColouredCharacter (int x, int y, unsigned int num) void SWDraw_ColouredCharacter (int x, int y, unsigned int num)
{ {
qbyte *source; qbyte *source;
int drawline; int drawline;
int row, col; int row, col;
extern cvar_t cl_noblink; extern cvar_t cl_noblink;
unsigned int colour, bgcolour;
int colour; qboolean drawbg = false;
if (y <= -8) if (y <= -8)
return; // totally off screen return; // totally off screen
@ -689,7 +686,11 @@ int colour;
if (y > vid.height - 8 || x < 0 || x > vid.width - 8) if (y > vid.height - 8 || x < 0 || x > vid.width - 8)
return; return;
colour = (num&CON_COLOURMASK)/256; colour = (num & CON_FGMASK) >> CON_FGSHIFT;
bgcolour = (num & CON_BGMASK) >> CON_BGSHIFT;
if (num & CON_NONCLEARBG)
drawbg = true;
if (num & CON_BLINKTEXT) if (num & CON_BLINKTEXT)
{ {
@ -698,7 +699,7 @@ int colour;
return; return;
} }
if (colour == COLOR_WHITE) if (colour == COLOR_WHITE && !drawbg)
{ {
Draw_Character(x, y, num); Draw_Character(x, y, num);
return; return;
@ -720,9 +721,37 @@ int colour;
if (r_pixbytes == 1) if (r_pixbytes == 1)
{ {
palremap_t *pr;
qbyte *dest; qbyte *dest;
dest = vid.conbuffer + y*vid.conrowbytes + x; dest = vid.conbuffer + y*vid.conrowbytes + x;
pr = D_GetPaletteRemap(consolecolours[colour].ir,
consolecolours[colour].ig,
consolecolours[colour].ib,
false, true, TOP_DEFAULT, BOTTOM_DEFAULT);
if (drawbg)
{
int bgidx = GetPalette(consolecolours[bgcolour].ir,
consolecolours[bgcolour].ig,
consolecolours[bgcolour].ib);
while (drawline--)
{
dest[0] = source[0] ? draw(source[0]) : bgidx;
dest[1] = source[1] ? draw(source[1]) : bgidx;
dest[2] = source[2] ? draw(source[2]) : bgidx;
dest[3] = source[3] ? draw(source[3]) : bgidx;
dest[4] = source[4] ? draw(source[4]) : bgidx;
dest[5] = source[5] ? draw(source[5]) : bgidx;
dest[6] = source[6] ? draw(source[6]) : bgidx;
dest[7] = source[7] ? draw(source[7]) : bgidx;
source += 128;
dest += vid.conrowbytes;
}
}
else
{
while (drawline--) while (drawline--)
{ {
if (source[0]) if (source[0])
@ -745,6 +774,9 @@ int colour;
dest += vid.conrowbytes; dest += vid.conrowbytes;
} }
} }
D_DereferenceRemap(pr);
}
else if (r_pixbytes == 2) else if (r_pixbytes == 2)
{ {
unsigned short *dest16; unsigned short *dest16;
@ -754,41 +786,47 @@ int colour;
dest16 = (unsigned short *)vid.conbuffer + y*vid.conrowbytes + x; dest16 = (unsigned short *)vid.conbuffer + y*vid.conrowbytes + x;
rm = consolecolours[colour].r*32; rm = consolecolours[colour].ir>>3;
gm = consolecolours[colour].g*32; gm = consolecolours[colour].ig>>3;
bm = consolecolours[colour].b*32; bm = consolecolours[colour].ib>>3;
if (drawbg)
{
int bgidx16 = (consolecolours[bgcolour].ir>>3) |
(consolecolours[bgcolour].ig>>3)<<5 |
(consolecolours[bgcolour].ib>>3)<<10;
while (drawline--) while (drawline--)
{ {
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
{ {
if (source[i]) if (source[i])
dest16[i] = ((pal[source[i]*4+0]*bm/256)<<10)+ dest16[i] = (((16+pal[source[i]*4+0]*bm)>>8)<<10)+
((pal[source[i]*4+1]*gm/256)<<5)+ (((16+pal[source[i]*4+1]*gm)>>8)<<5)+
pal[source[i]*4+2]*rm/256; ((16+pal[source[i]*4+2]*rm)>>8);
else
dest16[i] = bgidx16;
} }
/*
if (source[0])
dest16[0] = pal[draw(source[0])];
if (source[1])
dest16[1] = pal[draw(source[1])];
if (source[2])
dest16[2] = pal[draw(source[2])];
if (source[3])
dest16[3] = pal[draw(source[3])];
if (source[4])
dest16[4] = pal[draw(source[4])];
if (source[5])
dest16[5] = pal[draw(source[5])];
if (source[6])
dest16[6] = pal[draw(source[6])];
if (source[7])
dest16[7] = pal[draw(source[7])];
*/
source += 128; source += 128;
dest16 += vid.conrowbytes; dest16 += vid.conrowbytes;
} }
} }
else
{
while (drawline--)
{
for (i = 0; i < 8; i++)
{
if (source[i])
dest16[i] = (((16+pal[source[i]*4+0]*bm)>>8)<<10)+
(((16+pal[source[i]*4+1]*gm)>>8)<<5)+
((16+pal[source[i]*4+2]*rm)>>8);
}
source += 128;
dest16 += vid.conrowbytes;
}
}
}
else if (r_pixbytes == 4) else if (r_pixbytes == 4)
{ {
qbyte *dest; qbyte *dest;
@ -796,21 +834,47 @@ int colour;
unsigned char *pal = (unsigned char *)d_8to32table; unsigned char *pal = (unsigned char *)d_8to32table;
dest = vid.conbuffer + (y*vid.conrowbytes + x)*r_pixbytes; dest = vid.conbuffer + (y*vid.conrowbytes + x)*r_pixbytes;
if (drawbg)
{
while (drawline--) while (drawline--)
{ {
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
{ {
if (source[i]) if (source[i])
{ {
dest[0+i*4] = pal[source[i]*4+0]*consolecolours[colour].b; dest[0+i*4] = (128+pal[source[i]*4+0]*consolecolours[colour].ib)>>8;
dest[1+i*4] = pal[source[i]*4+1]*consolecolours[colour].g; dest[1+i*4] = (128+pal[source[i]*4+1]*consolecolours[colour].ig)>>8;
dest[2+i*4] = pal[source[i]*4+2]*consolecolours[colour].r; dest[2+i*4] = (128+pal[source[i]*4+2]*consolecolours[colour].ir)>>8;
}
else
{
dest[0+i*4] = consolecolours[bgcolour].ib;
dest[1+i*4] = consolecolours[bgcolour].ig;
dest[2+i*4] = consolecolours[bgcolour].ir;
} }
} }
source += 128; source += 128;
dest += vid.conrowbytes*r_pixbytes; dest += vid.conrowbytes*r_pixbytes;
} }
} }
else
{
while (drawline--)
{
for (i = 0; i < 8; i++)
{
if (source[i])
{
dest[0+i*4] = (128+pal[source[i]*4+0]*consolecolours[colour].ib)>>8;
dest[1+i*4] = (128+pal[source[i]*4+1]*consolecolours[colour].ig)>>8;
dest[2+i*4] = (128+pal[source[i]*4+2]*consolecolours[colour].ir)>>8;
}
}
source += 128;
dest += vid.conrowbytes*r_pixbytes;
}
}
}
} }
#undef draw #undef draw