Now caching lookup tables to disk for an immense speedup
This commit is contained in:
parent
be560d872b
commit
723fbd8523
10 changed files with 186 additions and 221 deletions
|
@ -216,7 +216,7 @@ S_Init
|
|||
void S_Init (void)
|
||||
{
|
||||
int madi;
|
||||
Con_Printf("\nSound Initialization\n");
|
||||
Con_Printf("\n[SOUND] Initialization\n");
|
||||
|
||||
if (COM_CheckParm("-nosound"))
|
||||
return;
|
||||
|
@ -260,7 +260,7 @@ Con_Printf("\nSound Initialization\n");
|
|||
}
|
||||
|
||||
if (shm) // 2000-07-09 GPF when GUS or BLASTER variable not set fix by Maddes/Raymond Martineau
|
||||
Con_Printf ("Sound sampling rate: %i\n", shm->speed);
|
||||
Con_Printf ("[SOUND] Sampling rate: %i\n", shm->speed);
|
||||
|
||||
// provides a tick sound until washed clean
|
||||
|
||||
|
|
|
@ -1481,7 +1481,7 @@ int COM_FindFile (char *filename, int *handle, FILE **file, searchpath_t **found
|
|||
for (i=0 ; i<pak->numfiles ; i++)
|
||||
if (!strcmp (pak->files[i].name, filename))
|
||||
{ // found it!
|
||||
Sys_Printf ("PackFile: %s : %s\n",pak->filename, filename);
|
||||
Sys_Printf ("[ENGINE] Found in PAK: %s : %s\n",pak->filename, filename);
|
||||
if (handle)
|
||||
{
|
||||
*handle = pak->handle;
|
||||
|
@ -1541,7 +1541,7 @@ int COM_FindFile (char *filename, int *handle, FILE **file, searchpath_t **found
|
|||
strcpy (netpath, cachepath);
|
||||
}
|
||||
|
||||
Sys_Printf ("FindFile: %s\n",netpath);
|
||||
Sys_Printf ("[ENGINE] Found: %s\n",netpath);
|
||||
com_filesize = Sys_FileOpenRead (netpath, &i);
|
||||
if (handle)
|
||||
*handle = i;
|
||||
|
@ -1563,7 +1563,7 @@ int COM_FindFile (char *filename, int *handle, FILE **file, searchpath_t **found
|
|||
|
||||
}
|
||||
|
||||
Sys_Printf ("FindFile: can't find %s\n", filename);
|
||||
Sys_Printf ("[ENGINE] Can't find %s\n", filename);
|
||||
|
||||
if (handle)
|
||||
*handle = -1;
|
||||
|
@ -2050,7 +2050,7 @@ void COM_InitFilesystem (void)
|
|||
{
|
||||
search->pack = COM_LoadPackFile (com_argv[i]);
|
||||
if (!search->pack)
|
||||
Sys_Error ("Couldn't load packfile: %s", com_argv[i]);
|
||||
Sys_Error ("[ENGINE] Couldn't load PAK file: %s", com_argv[i]);
|
||||
}
|
||||
else
|
||||
strcpy (search->filename, com_argv[i]);
|
||||
|
|
|
@ -280,39 +280,17 @@ void Con_Init (void)
|
|||
}
|
||||
|
||||
con_text = Hunk_AllocName (CON_TEXTSIZE, "context");
|
||||
// 2000-01-05 Console scrolling fix by Maddes start
|
||||
// Q_memset (con_text, ' ', CON_TEXTSIZE);
|
||||
Con_Clear_f();
|
||||
// 2000-01-05 Console scrolling fix by Maddes end
|
||||
con_linewidth = -1;
|
||||
Con_CheckResize ();
|
||||
|
||||
// Con_Printf ("Console initialized.\n"); // 2000-01-05 Console scrolling fix by Maddes
|
||||
|
||||
//
|
||||
// register our commands
|
||||
//
|
||||
// 2001-09-18 New cvar system by Maddes (Init) start
|
||||
/*
|
||||
con_notifytime = Cvar_Get ("con_notifytime", "3", CVAR_ORIGINAL);
|
||||
|
||||
// 2000-08-04 "Transparent" console background for software renderer by Norberto Alfredo Bensa/Maddes start
|
||||
// 2000-01-11 Transparent console by Radix start
|
||||
con_alpha = Cvar_Get ("con_alpha", "1", CVAR_ARCHIVE);
|
||||
Cvar_SetRangecheck (con_alpha, Cvar_RangecheckFloat, 0, 1);
|
||||
Cvar_Set(con_alpha, con_alpha->string); // do rangecheck
|
||||
// 2000-01-11 Transparent console by Radix end
|
||||
// 2000-08-04 "Transparent" console background for software renderer by Norberto Alfredo Bensa/Maddes end
|
||||
*/
|
||||
// 2001-09-18 New cvar system by Maddes (Init) end
|
||||
|
||||
Cmd_AddCommand ("toggleconsole", Con_ToggleConsole_f);
|
||||
Cmd_AddCommand ("messagemode", Con_MessageMode_f);
|
||||
Cmd_AddCommand ("messagemode2", Con_MessageMode2_f);
|
||||
Cmd_AddCommand ("clear", Con_Clear_f);
|
||||
|
||||
con_initialized = true;
|
||||
Con_Printf ("Console initialized.\n"); // 2000-01-05 Console scrolling fix by Maddes
|
||||
Con_Printf ("[ENGINE] Console Initialized.\n"); // 2000-01-05 Console scrolling fix by Maddes
|
||||
}
|
||||
|
||||
|
||||
|
|
300
engine/draw.c
300
engine/draw.c
|
@ -689,7 +689,7 @@ void GrabColorMapRGB (void) // leilei - for the r g b components looking ups et
|
|||
int COLORLEVELS = 64;
|
||||
int PALBRIGHTS;
|
||||
int limit = 127;
|
||||
Con_Printf("YES!\nYES!!\nYES!!!\n");
|
||||
;
|
||||
RANGE = 2; // was 2.
|
||||
|
||||
if(!fullbrights) PALBRIGHTS = 0;
|
||||
|
@ -891,13 +891,6 @@ Draw_Init
|
|||
===============
|
||||
*/
|
||||
|
||||
//
|
||||
// Our Friendly Neighborhood Lookup Tables
|
||||
//
|
||||
// TODO: Cache all to disk and load from disk when available
|
||||
// gfx/addmap.lmp, gfx/mulmap.lmp, gfx/tinttab.lmp (hi hexen2)
|
||||
// gfx/8to16.lmp, gfx/8to24.lmp, gfx/palmap.lmp, gfx/palmap2.lmp
|
||||
// These are proposed filenames.
|
||||
|
||||
byte menumap[256][16]; // Used for menu backgrounds and simple colormod
|
||||
byte gelmap[256]; // Unused id effect TO be used somehow. made redundant by menumap
|
||||
|
@ -1193,12 +1186,13 @@ int fbs[256];
|
|||
void MassiveLookupTablesInit (void)
|
||||
{
|
||||
|
||||
int i, j, l, c;
|
||||
int i, j, l, c;
|
||||
float red, green, blue;
|
||||
int r, g, b;
|
||||
int beastcolor;
|
||||
int r, g, b;
|
||||
int beastcolor;
|
||||
int ugly;
|
||||
|
||||
int iTablefile = 0;
|
||||
|
||||
unsigned char* thepaltouse;
|
||||
InitSmooth();
|
||||
|
||||
|
@ -1210,49 +1204,32 @@ void MassiveLookupTablesInit (void)
|
|||
#endif
|
||||
thepaltouse = host_basepal;
|
||||
|
||||
// if (COM_CheckParm ("-cache"))
|
||||
// lookupcaching = 1; // try to cache it all for future loading
|
||||
|
||||
fprintf(stderr,"\nGenerating additive table... ");
|
||||
for (l=0;l<255;l++)
|
||||
Sys_FileOpenRead (va("%s/tinttab.lmp",com_gamedir), &iTablefile);
|
||||
if(iTablefile != -1)
|
||||
{
|
||||
for (c=0 ; c<255 ; c++)
|
||||
{
|
||||
red = thepaltouse[c*3] + thepaltouse[l*3];
|
||||
green = thepaltouse[c*3+1] + thepaltouse[l*3+1];
|
||||
blue = thepaltouse[c*3+2] + thepaltouse[l*3+2];
|
||||
addTable[l][c] = BestColor(red,green,blue, 0, 254);
|
||||
}
|
||||
printf("\n[ENGINE] Reading alpha table... ");
|
||||
Sys_FileRead(iTablefile, transTable, 65536);
|
||||
printf("[DONE]");
|
||||
}
|
||||
if(addTable)
|
||||
fprintf(stderr,"[DONE]");
|
||||
|
||||
|
||||
fprintf(stderr,"\nGenerating alpha table... ");
|
||||
for (l=0;l<255;l++)
|
||||
else
|
||||
{
|
||||
for (c=0 ; c<255 ; c++)
|
||||
printf("\n[ENGINE] Generating alpha table... ");
|
||||
for (l=0;l<255;l++)
|
||||
{
|
||||
red = thepaltouse[c*3] *0.66 + (thepaltouse[l*3] * 0.33);
|
||||
green = thepaltouse[c*3+1] *0.66 + (thepaltouse[l*3+1] * 0.33);
|
||||
blue = thepaltouse[c*3+2] *0.66 + (thepaltouse[l*3+2] * 0.33);
|
||||
for (c=0 ; c<255 ; c++)
|
||||
{
|
||||
red = thepaltouse[c*3] *0.66 + (thepaltouse[l*3] * 0.33);
|
||||
green = thepaltouse[c*3+1] *0.66 + (thepaltouse[l*3+1] * 0.33);
|
||||
blue = thepaltouse[c*3+2] *0.66 + (thepaltouse[l*3+2] * 0.33);
|
||||
transTable[l][c] = BestColor(red,green,blue, 0, 254);
|
||||
}
|
||||
}
|
||||
|
||||
printf("[DONE]");
|
||||
}
|
||||
if(transTable)
|
||||
fprintf(stderr,"[DONE]");
|
||||
|
||||
|
||||
if (COM_CheckParm ("-nolookups")){
|
||||
nolookups = 1;
|
||||
fprintf(stderr,"Color lookup tables are skipped\n");
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(stderr,"\n\n---------------------\nGenerating all the lookup tables\n(If your computer is slow, this will take up to 30 seconds. Use the -nolookups \nparameter if you find this unsettling)\nYou can also skip the 18-bit generation by passing -no18\nAlternatively, you can pass -ugly for faster but ugly generation\n---------------------\n\n");
|
||||
|
||||
if (COM_CheckParm ("-ugly")){
|
||||
fprintf(stderr,"\n*** UGLY GENERATION MODE ON ***\n");
|
||||
printf("\n\n*** UGLY GENERATION MODE ON ***\n");
|
||||
ugly = 1;}
|
||||
else
|
||||
ugly = 0;
|
||||
|
@ -1261,72 +1238,79 @@ void MassiveLookupTablesInit (void)
|
|||
VID_SetPalette2 (thepaltouse);
|
||||
|
||||
|
||||
fprintf(stderr,"\nGenerating 15-bit lookup table... ");
|
||||
for (r=0 ; r<256 ; r+=8)
|
||||
Sys_FileOpenRead (va("%s/dithtab.lmp",com_gamedir), &iTablefile);
|
||||
if(iTablefile != -1)
|
||||
{
|
||||
for (g=0 ; g<256 ; g+=8)
|
||||
printf("\n[ENGINE] Reading 15-bit lookup table... ");
|
||||
Sys_FileRead(iTablefile, ditherTable, 1048576);
|
||||
printf("[DONE]");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\n[ENGINE] Generating 15-bit lookup table... ");
|
||||
for (r=0 ; r<256 ; r+=8)
|
||||
{
|
||||
for (b=0 ; b<256 ; b+=8)
|
||||
for (g=0 ; g<256 ; g+=8)
|
||||
{
|
||||
float lol = 3.6;
|
||||
beastcolor = BestColor (r + lol, g + lol, b + lol, 0, 254);
|
||||
palmap[r>>3][g>>3][b>>3] = beastcolor;
|
||||
// andrewj's crud here
|
||||
int k;
|
||||
int pix = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3);
|
||||
int rr = r - 4;
|
||||
int gg = g - 4;
|
||||
int bb = b - 4;
|
||||
int col[4];
|
||||
int ity[4];
|
||||
byte *found;
|
||||
|
||||
for (k = 0 ; k < 4 ; k++)
|
||||
for (b=0 ; b<256 ; b+=8)
|
||||
{
|
||||
col[k] = BestColor(rr + lol, gg + lol, bb + lol, 0, 254);
|
||||
|
||||
// apply error term
|
||||
found = thepaltouse + col[k] * 3;
|
||||
rr += (rr - (int)found[0]);
|
||||
gg += (gg - (int)found[1]);
|
||||
bb += (bb - (int)found[2]);
|
||||
ity[k] = found[0] + found[1] + found[2];
|
||||
}
|
||||
|
||||
// sort colors by intensity
|
||||
for (rr = 0 ; rr < 4 ; rr++)
|
||||
for (k = 0 ; k < 3 ; k++)
|
||||
float lol = 3.6;
|
||||
beastcolor = BestColor (r + lol, g + lol, b + lol, 0, 254);
|
||||
palmap[r>>3][g>>3][b>>3] = beastcolor;
|
||||
// andrewj's crud here
|
||||
int k;
|
||||
int pix = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3);
|
||||
int rr = r - 4;
|
||||
int gg = g - 4;
|
||||
int bb = b - 4;
|
||||
int col[4];
|
||||
int ity[4];
|
||||
byte *found;
|
||||
|
||||
for (k = 0 ; k < 4 ; k++)
|
||||
{
|
||||
if (ity[k] < ity[k+1])
|
||||
{
|
||||
gg = col[k] ; col[k] = col[k+1] ; col[k+1] = gg;
|
||||
gg = ity[k] ; ity[k] = ity[k+1] ; ity[k+1] = gg;
|
||||
}
|
||||
col[k] = BestColor(rr + lol, gg + lol, bb + lol, 0, 254);
|
||||
|
||||
// apply error term
|
||||
found = thepaltouse + col[k] * 3;
|
||||
rr += (rr - (int)found[0]);
|
||||
gg += (gg - (int)found[1]);
|
||||
bb += (bb - (int)found[2]);
|
||||
ity[k] = found[0] + found[1] + found[2];
|
||||
}
|
||||
|
||||
// sort colors by intensity
|
||||
for (rr = 0 ; rr < 4 ; rr++)
|
||||
for (k = 0 ; k < 3 ; k++)
|
||||
{
|
||||
if (ity[k] < ity[k+1])
|
||||
{
|
||||
gg = col[k] ; col[k] = col[k+1] ; col[k+1] = gg;
|
||||
gg = ity[k] ; ity[k] = ity[k+1] ; ity[k+1] = gg;
|
||||
}
|
||||
}
|
||||
|
||||
ditherTable[pix][0] = col[0];
|
||||
ditherTable[pix][3] = col[1];
|
||||
ditherTable[pix][2] = col[2];
|
||||
ditherTable[pix][1] = col[3];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("[DONE]");
|
||||
}
|
||||
|
||||
if (!palmap)
|
||||
printf(stderr,"FAILED!\n");
|
||||
else
|
||||
fprintf(stderr,"[DONE]");
|
||||
|
||||
// Make the 18-bit lookup table here
|
||||
// This is a HUGE 256kb table, the biggest there is here
|
||||
// TODO: Option to enable this
|
||||
// if (r_lightquality->value){
|
||||
|
||||
if (COM_CheckParm ("-no18"))
|
||||
fprintf(stderr,"\n18-bit lookup generation skipped - High quality light mode DISABLED!\n");
|
||||
Sys_FileOpenRead (va("%s/palmap2.lmp",com_gamedir), &iTablefile);
|
||||
if(iTablefile != -1)
|
||||
{
|
||||
printf("\n[ENGINE] Reading 18-bit lookup table... ");
|
||||
Sys_FileRead(iTablefile, palmap2, 262144);
|
||||
printf("[DONE]");
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr,"\nGenerating 18-bit lookup table... ");
|
||||
printf("\n[ENGINE] Generating 18-bit lookup table... ");
|
||||
|
||||
for (r=0 ; r<256 ; r+=4)
|
||||
{
|
||||
|
@ -1343,85 +1327,85 @@ void MassiveLookupTablesInit (void)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!palmap2)
|
||||
printf(stderr,"FAILED!\n");
|
||||
else
|
||||
fprintf(stderr,"[DONE]");
|
||||
|
||||
printf("[DONE]");
|
||||
}
|
||||
|
||||
fprintf(stderr,"\nGenerating additive table... ");
|
||||
|
||||
for (l=0;l<255;l++)
|
||||
Sys_FileOpenRead (va("%s/addmap.lmp",com_gamedir), &iTablefile);
|
||||
if(iTablefile != -1)
|
||||
{
|
||||
for (c=0 ; c<255 ; c++)
|
||||
{
|
||||
red = thepaltouse[c*3] + thepaltouse[l*3];
|
||||
green = thepaltouse[c*3+1] + thepaltouse[l*3+1];
|
||||
blue = thepaltouse[c*3+2] + thepaltouse[l*3+2];
|
||||
if (ugly) addTable[l][c] = FindColor(red,green,blue);
|
||||
else
|
||||
addTable[l][c] = BestColor(red,green,blue, 0, 254);
|
||||
}
|
||||
printf("\n[ENGINE] Reading additive table... ");
|
||||
Sys_FileRead(iTablefile, addTable, 65536);
|
||||
printf(" [DONE]");
|
||||
}
|
||||
|
||||
if (!addTable)
|
||||
printf(stderr,"FAILED!\n");
|
||||
else
|
||||
fprintf(stderr,"[DONE]");
|
||||
|
||||
|
||||
fprintf(stderr,"\nGenerating multiply blend table... ");
|
||||
|
||||
for (l=0;l<255;l++)
|
||||
{
|
||||
for (c=0 ; c<255 ; c++)
|
||||
printf("\n[ENGINE] Generating additive table... ");
|
||||
for (l=0;l<255;l++)
|
||||
{
|
||||
float ee, er, erp;
|
||||
ee = 0.5;
|
||||
er = 0.5;
|
||||
erp = 0.03; // 0.1;
|
||||
red = ((thepaltouse[l*3] * erp * (thepaltouse[c*3] * ee)) * er);
|
||||
green = ((thepaltouse[l*3+1] * erp * (thepaltouse[c*3+1] * ee)) * er);
|
||||
blue = ((thepaltouse[l*3+2] * erp * (thepaltouse[c*3+2] * ee)) * er);
|
||||
|
||||
if (red>255) red=255; if (green>255) green=255; if (blue>255) blue=255;
|
||||
|
||||
if (ugly)
|
||||
mulTable[l][c] = FindColor(red,green,blue);
|
||||
else
|
||||
mulTable[l][c] = BestColor(red,green,blue, 0, 223);
|
||||
for (c=0 ; c<255 ; c++)
|
||||
{
|
||||
red = thepaltouse[c*3] + thepaltouse[l*3];
|
||||
green = thepaltouse[c*3+1] + thepaltouse[l*3+1];
|
||||
blue = thepaltouse[c*3+2] + thepaltouse[l*3+2];
|
||||
if (ugly) addTable[l][c] = FindColor(red,green,blue);
|
||||
else
|
||||
addTable[l][c] = BestColor(red,green,blue, 0, 254);
|
||||
}
|
||||
}
|
||||
|
||||
printf(" [DONE]");
|
||||
}
|
||||
|
||||
if (!mulTable)
|
||||
printf(stderr,"FAILED!\n");
|
||||
Sys_FileOpenRead (va("%s/mulmap.lmp",com_gamedir), &iTablefile);
|
||||
if(iTablefile != -1)
|
||||
{
|
||||
printf("\n[ENGINE] Reading multiply blend table... ");
|
||||
Sys_FileRead(iTablefile, mulTable, 65536);
|
||||
printf("[DONE]\n");
|
||||
}
|
||||
else
|
||||
fprintf(stderr,"[DONE]");
|
||||
{
|
||||
printf("\n[ENGINE] Generating multiply blend table...");
|
||||
for (l=0;l<255;l++)
|
||||
{
|
||||
for (c=0 ; c<255 ; c++)
|
||||
{
|
||||
float ee, er, erp;
|
||||
ee = 0.5;
|
||||
er = 0.5;
|
||||
erp = 0.03; // 0.1;
|
||||
red = ((thepaltouse[l*3] * erp * (thepaltouse[c*3] * ee)) * er);
|
||||
green = ((thepaltouse[l*3+1] * erp * (thepaltouse[c*3+1] * ee)) * er);
|
||||
blue = ((thepaltouse[l*3+2] * erp * (thepaltouse[c*3+2] * ee)) * er);
|
||||
|
||||
if (red>255) red=255; if (green>255) green=255; if (blue>255) blue=255;
|
||||
|
||||
if (ugly)
|
||||
mulTable[l][c] = FindColor(red,green,blue);
|
||||
else
|
||||
mulTable[l][c] = BestColor(red,green,blue, 0, 223);
|
||||
}
|
||||
}
|
||||
printf("[DONE]\n");
|
||||
}
|
||||
|
||||
// if(palmap2)
|
||||
PalmapStaticized();
|
||||
|
||||
// TODO: Caching lookups to disk, possibly folder unfriendly.
|
||||
/* if (lookupcaching){
|
||||
|
||||
/* if (palmap)
|
||||
COM_WriteFile ("palmap.lmp", palmap, 32768);*/
|
||||
if (palmap2)
|
||||
COM_WriteFile ("palmap2.lmp", palmap2, 262144);
|
||||
if (addTable)
|
||||
COM_WriteFile ("addmap.lmp", addTable, 65536);
|
||||
if (mulTable)
|
||||
COM_WriteFile ("mulmap.lmp", mulTable, 65536);
|
||||
if (transTable)
|
||||
COM_WriteFile ("tinttab.lmp", transTable, 65536);
|
||||
if (ditherTable)
|
||||
COM_WriteFile ("dithtab.lmp", ditherTable, 1048576);.
|
||||
|
||||
if (palmap)
|
||||
COM_WriteFile ("palmap.lmp", palmap, 32768);
|
||||
if (palmap2)
|
||||
COM_WriteFile ("palmap2.lmp", palmap2, 262144);
|
||||
if (addTable)
|
||||
COM_WriteFile ("addmap.lmp", addTable, 65536);
|
||||
if (mulTable)
|
||||
COM_WriteFile ("mulmap.lmp", mulTable, 65536);
|
||||
if (transTable)
|
||||
COM_WriteFile ("tinttab.lmp", transTable, 65536);
|
||||
if (ditherTable)
|
||||
COM_WriteFile ("dithtab.lmp", ditherTable, 262144); // good lord this is huge.
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
int ahe;
|
||||
for (ahe=0; ahe<256; ahe++)
|
||||
{
|
||||
|
|
|
@ -1073,7 +1073,7 @@ void VID_SetPalette2 (unsigned char *palette)
|
|||
char s[255];
|
||||
float gamma = 0;
|
||||
|
||||
fprintf(stderr,"\nGenerating 8to24 lookup tables... ");
|
||||
fprintf(stderr,"\n[ENGINE] Generating 8to24 lookup tables... ");
|
||||
//
|
||||
// 8 8 8 encoding
|
||||
//
|
||||
|
@ -1297,8 +1297,8 @@ void Host_Init (quakeparms_t *parms)
|
|||
NVS_Init ();
|
||||
NVS_Init_Server ();
|
||||
NVS_Init_Client ();
|
||||
Con_Printf ("Engine compiled: "__TIME__" "__DATE__"\n");
|
||||
Con_Printf ("%4.1f megabyte heap\n",parms->memsize/ (1024*1024.0));
|
||||
Con_Printf ("[ENGINE] Dated "__TIME__" "__DATE__"\n");
|
||||
Con_Printf ("[ENGINE] %4.1f megabyte heap\n",parms->memsize/ (1024*1024.0));
|
||||
|
||||
R_InitTextures (); // needed even for dedicated servers
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ int UDP_Init (void)
|
|||
if (colon)
|
||||
*colon = 0;
|
||||
|
||||
Con_Printf("UDP Initialized\n");
|
||||
Con_Printf("[NETWORK] UDP Initialized\n");
|
||||
tcpipAvailable = true;
|
||||
|
||||
return net_controlsocket;
|
||||
|
|
|
@ -84,7 +84,7 @@ void D_InitCaches (void *buffer, int size)
|
|||
{
|
||||
|
||||
if (!msg_suppress_1)
|
||||
Con_Printf ("%ik surface cache\n", size/1024);
|
||||
Con_Printf ("[RENDERER] %ik surface cache\n", size/1024);
|
||||
|
||||
sc_size = size - GUARDSIZE;
|
||||
sc_base = (surfcache_t *)buffer;
|
||||
|
|
|
@ -419,7 +419,6 @@ int main (int c, char **v)
|
|||
nostdout = 1;
|
||||
else {
|
||||
fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);
|
||||
printf ("NGUNIX -- Version %s\n", VERSION);
|
||||
}
|
||||
|
||||
oldtime = Sys_FloatTime () - 0.1;
|
||||
|
|
|
@ -66,7 +66,7 @@ void FmodEx_Play(byte track, qboolean looping)
|
|||
|
||||
if (fmod_result != FMOD_OK)
|
||||
{
|
||||
Con_Printf("FmodEx: Can't load %s!\n", fmod_file);
|
||||
Con_Printf("[MUSIC] Can't load %s!\n", fmod_file);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -125,24 +125,28 @@ int FmodEx_Init(void)
|
|||
unsigned int version;
|
||||
|
||||
if (FMOD_System_Create (&fmod_system)){
|
||||
Con_Printf ("FMOD_System_Create failed!\n"); return 0;}
|
||||
Con_Printf ("[MUSIC] FMOD_System_Create failed!\n"); return 0;}
|
||||
if (FMOD_System_GetVersion (fmod_system, &version)){
|
||||
Con_Printf ("FMOD_System_GetVersion failed!\n"); return 0;}
|
||||
Con_Printf ("[MUSIC] FMOD_System_GetVersion failed!\n"); return 0;}
|
||||
if (FMOD_System_Init (fmod_system, 1, FMOD_INIT_NORMAL, NULL)){
|
||||
Con_Printf ("FMOD_System_Init failed!\n"); return 0; }
|
||||
Con_Printf ("[MUSIC] FMOD_System_Init failed!\n"); return 0; }
|
||||
|
||||
Cmd_AddCommand ("fmod", FmodEx_f);
|
||||
Con_Printf("FmodEx Initialised.\n");
|
||||
fmod_initialised = true;
|
||||
Con_Printf("[MUSIC] Initialized\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void FmodEx_Shutdown(void)
|
||||
{
|
||||
if(fmod_initialised == false)
|
||||
return;
|
||||
|
||||
FMOD_Sound_Release (fmod_sound);
|
||||
FMOD_System_Close (fmod_system);
|
||||
FMOD_System_Release (fmod_system);
|
||||
Con_Printf("FmodEx Shutdown.\n");
|
||||
fmod_initialised = false;
|
||||
Con_Printf("[MUSIC] Shutdown\n");
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -269,7 +269,7 @@ void TragicDeath(int signal_num)
|
|||
{
|
||||
XAutoRepeatOn(x_disp);
|
||||
XCloseDisplay(x_disp);
|
||||
Sys_Error("This death brought to you by the number %d\n", signal_num);
|
||||
Sys_Error("[VIDEO] Death Number %d\n", signal_num);
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
|
@ -326,7 +326,7 @@ void ResetFrameBuffer(void)
|
|||
|
||||
d_pzbuffer = Hunk_HighAllocName (X11_buffersize, "video");
|
||||
if (d_pzbuffer == NULL)
|
||||
Sys_Error ("Not enough memory for video mode\n");
|
||||
Sys_Error ("[VIDEO] Not enough memory for video mode\n");
|
||||
|
||||
vid_surfcache = (byte *) d_pzbuffer
|
||||
+ vid.width * vid.height * sizeof (*d_pzbuffer);
|
||||
|
@ -348,7 +348,7 @@ void ResetFrameBuffer(void)
|
|||
0);
|
||||
|
||||
if (!x_framebuffer[0])
|
||||
Sys_Error("VID: XCreateImage failed\n");
|
||||
Sys_Error("[VIDEO] XCreateImage failed\n");
|
||||
|
||||
vid.buffer = (byte*) (x_framebuffer[0]);
|
||||
vid.conbuffer = vid.buffer;
|
||||
|
@ -381,7 +381,7 @@ void ResetSharedFrameBuffers(void)
|
|||
|
||||
d_pzbuffer = Hunk_HighAllocName (X11_buffersize, "video");
|
||||
if (d_pzbuffer == NULL)
|
||||
Sys_Error ("Not enough memory for video mode\n");
|
||||
Sys_Error ("[VIDEO] Not enough memory for video mode\n");
|
||||
|
||||
vid_surfcache = (byte *) d_pzbuffer
|
||||
+ vid.width * vid.height * sizeof (*d_pzbuffer);
|
||||
|
@ -416,18 +416,18 @@ void ResetSharedFrameBuffers(void)
|
|||
size = x_framebuffer[frm]->bytes_per_line
|
||||
* x_framebuffer[frm]->height;
|
||||
if (size < minsize)
|
||||
Sys_Error("VID: Window must use at least %d bytes\n", minsize);
|
||||
Sys_Error("[VIDEO] Window must use at least %d bytes\n", minsize);
|
||||
|
||||
key = random();
|
||||
x_shminfo[frm].shmid = shmget((key_t)key, size, IPC_CREAT|0777);
|
||||
if (x_shminfo[frm].shmid==-1)
|
||||
Sys_Error("VID: Could not get any shared memory\n");
|
||||
Sys_Error("[VIDEO] Could not get any shared memory\n");
|
||||
|
||||
// attach to the shared memory segment
|
||||
x_shminfo[frm].shmaddr =
|
||||
(void *) shmat(x_shminfo[frm].shmid, 0, 0);
|
||||
|
||||
printf("VID: shared memory id=%d, addr=0x%lx\n", x_shminfo[frm].shmid,
|
||||
printf("[VIDEO] Shared memory id=%d, addr=0x%lx\n", x_shminfo[frm].shmid,
|
||||
(long) x_shminfo[frm].shmaddr);
|
||||
|
||||
x_framebuffer[frm]->data = x_shminfo[frm].shmaddr;
|
||||
|
@ -435,7 +435,7 @@ void ResetSharedFrameBuffers(void)
|
|||
// get the X server to attach to it
|
||||
|
||||
if (!XShmAttach(x_disp, &x_shminfo[frm]))
|
||||
Sys_Error("VID: XShmAttach() failed\n");
|
||||
Sys_Error("[VIDEO] XShmAttach() failed\n");
|
||||
XSync(x_disp, 0);
|
||||
shmctl(x_shminfo[frm].shmid, IPC_RMID, 0);
|
||||
|
||||
|
@ -495,10 +495,10 @@ void VID_Init (unsigned char *palette)
|
|||
if (!x_disp)
|
||||
{
|
||||
if (getenv("DISPLAY"))
|
||||
Sys_Error("VID: Could not open display [%s]\n",
|
||||
Sys_Error("[VIDEO] Could not open display [%s]\n",
|
||||
getenv("DISPLAY"));
|
||||
else
|
||||
Sys_Error("VID: Could not open local display\n");
|
||||
Sys_Error("[VIDEO] Could not open local display\n");
|
||||
}
|
||||
|
||||
// catch signals so i can turn on auto-repeat
|
||||
|
@ -520,25 +520,25 @@ void VID_Init (unsigned char *palette)
|
|||
if ((pnum=COM_CheckParm("-winsize")))
|
||||
{
|
||||
if (pnum >= com_argc-2)
|
||||
Sys_Error("VID: -winsize <width> <height>\n");
|
||||
Sys_Error("[VIDEO] -winsize <width> <height>\n");
|
||||
vid.width = Q_atoi(com_argv[pnum+1]);
|
||||
vid.height = Q_atoi(com_argv[pnum+2]);
|
||||
if (!vid.width || !vid.height)
|
||||
Sys_Error("VID: Bad window width/height\n");
|
||||
Sys_Error("[VIDEO] Bad window width/height\n");
|
||||
}
|
||||
if ((pnum=COM_CheckParm("-width"))) {
|
||||
if (pnum >= com_argc-1)
|
||||
Sys_Error("VID: -width <width>\n");
|
||||
Sys_Error("[VIDEO] -width <width>\n");
|
||||
vid.width = Q_atoi(com_argv[pnum+1]);
|
||||
if (!vid.width)
|
||||
Sys_Error("VID: Bad window width\n");
|
||||
Sys_Error("[VIDEO] Bad window width\n");
|
||||
}
|
||||
if ((pnum=COM_CheckParm("-height"))) {
|
||||
if (pnum >= com_argc-1)
|
||||
Sys_Error("VID: -height <height>\n");
|
||||
Sys_Error("[VIDEO] -height <height>\n");
|
||||
vid.height = Q_atoi(com_argv[pnum+1]);
|
||||
if (!vid.height)
|
||||
Sys_Error("VID: Bad window height\n");
|
||||
Sys_Error("[VIDEO] Bad window height\n");
|
||||
}
|
||||
|
||||
template_mask = 0;
|
||||
|
@ -547,7 +547,7 @@ void VID_Init (unsigned char *palette)
|
|||
if ((pnum=COM_CheckParm("-visualid")))
|
||||
{
|
||||
if (pnum >= com_argc-1)
|
||||
Sys_Error("VID: -visualid <id#>\n");
|
||||
Sys_Error("[VIDEO] -visualid <id#>\n");
|
||||
template.visualid = Q_atoi(com_argv[pnum+1]);
|
||||
template_mask = VisualIDMask;
|
||||
}
|
||||
|
@ -566,16 +566,16 @@ void VID_Init (unsigned char *palette)
|
|||
x_visinfo = XGetVisualInfo(x_disp, template_mask, &template, &num_visuals);
|
||||
if (num_visuals > 1)
|
||||
{
|
||||
printf("Found more than one visual id at depth %d:\n", template.depth);
|
||||
printf("[VIDEO] Found more than one visual id at depth %d:\n", template.depth);
|
||||
for (i=0 ; i<num_visuals ; i++)
|
||||
printf(" -visualid %d\n", (int)(x_visinfo[i].visualid));
|
||||
}
|
||||
else if (num_visuals == 0)
|
||||
{
|
||||
if (template_mask == VisualIDMask)
|
||||
Sys_Error("VID: Bad visual id %d\n", template.visualid);
|
||||
Sys_Error("[VIDEO] Bad visual id %d\n", template.visualid);
|
||||
else
|
||||
Sys_Error("VID: No visuals at depth %d\n", template.depth);
|
||||
Sys_Error("[VIDEO] No visuals at depth %d\n", template.depth);
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
|
@ -753,7 +753,7 @@ void VID_SetPalette(unsigned char *palette)
|
|||
|
||||
void VID_Shutdown (void)
|
||||
{
|
||||
Con_Printf("VID_Shutdown\n");
|
||||
Con_Printf("[VIDEO] Shutdown\n");
|
||||
XAutoRepeatOn(x_disp);
|
||||
XCloseDisplay(x_disp);
|
||||
}
|
||||
|
@ -1045,7 +1045,7 @@ void VID_Update (vrect_t *rects)
|
|||
if (!XShmPutImage(x_disp, x_win, x_gc,
|
||||
x_framebuffer[current_framebuffer], rects->x, rects->y,
|
||||
rects->x, rects->y, rects->width, rects->height, True))
|
||||
Sys_Error("VID_Update: XShmPutImage failed\n");
|
||||
Sys_Error("[VIDEO] XShmPutImage failed\n");
|
||||
oktodraw = false;
|
||||
while (!oktodraw) GetEvent();
|
||||
rects = rects->pnext;
|
||||
|
|
Loading…
Reference in a new issue