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)
|
void S_Init (void)
|
||||||
{
|
{
|
||||||
int madi;
|
int madi;
|
||||||
Con_Printf("\nSound Initialization\n");
|
Con_Printf("\n[SOUND] Initialization\n");
|
||||||
|
|
||||||
if (COM_CheckParm("-nosound"))
|
if (COM_CheckParm("-nosound"))
|
||||||
return;
|
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
|
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
|
// 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++)
|
for (i=0 ; i<pak->numfiles ; i++)
|
||||||
if (!strcmp (pak->files[i].name, filename))
|
if (!strcmp (pak->files[i].name, filename))
|
||||||
{ // found it!
|
{ // 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)
|
if (handle)
|
||||||
{
|
{
|
||||||
*handle = pak->handle;
|
*handle = pak->handle;
|
||||||
|
@ -1541,7 +1541,7 @@ int COM_FindFile (char *filename, int *handle, FILE **file, searchpath_t **found
|
||||||
strcpy (netpath, cachepath);
|
strcpy (netpath, cachepath);
|
||||||
}
|
}
|
||||||
|
|
||||||
Sys_Printf ("FindFile: %s\n",netpath);
|
Sys_Printf ("[ENGINE] Found: %s\n",netpath);
|
||||||
com_filesize = Sys_FileOpenRead (netpath, &i);
|
com_filesize = Sys_FileOpenRead (netpath, &i);
|
||||||
if (handle)
|
if (handle)
|
||||||
*handle = i;
|
*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)
|
if (handle)
|
||||||
*handle = -1;
|
*handle = -1;
|
||||||
|
@ -2050,7 +2050,7 @@ void COM_InitFilesystem (void)
|
||||||
{
|
{
|
||||||
search->pack = COM_LoadPackFile (com_argv[i]);
|
search->pack = COM_LoadPackFile (com_argv[i]);
|
||||||
if (!search->pack)
|
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
|
else
|
||||||
strcpy (search->filename, com_argv[i]);
|
strcpy (search->filename, com_argv[i]);
|
||||||
|
|
|
@ -280,39 +280,17 @@ void Con_Init (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
con_text = Hunk_AllocName (CON_TEXTSIZE, "context");
|
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();
|
Con_Clear_f();
|
||||||
// 2000-01-05 Console scrolling fix by Maddes end
|
|
||||||
con_linewidth = -1;
|
con_linewidth = -1;
|
||||||
Con_CheckResize ();
|
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 ("toggleconsole", Con_ToggleConsole_f);
|
||||||
Cmd_AddCommand ("messagemode", Con_MessageMode_f);
|
Cmd_AddCommand ("messagemode", Con_MessageMode_f);
|
||||||
Cmd_AddCommand ("messagemode2", Con_MessageMode2_f);
|
Cmd_AddCommand ("messagemode2", Con_MessageMode2_f);
|
||||||
Cmd_AddCommand ("clear", Con_Clear_f);
|
Cmd_AddCommand ("clear", Con_Clear_f);
|
||||||
|
|
||||||
con_initialized = true;
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
136
engine/draw.c
136
engine/draw.c
|
@ -689,7 +689,7 @@ void GrabColorMapRGB (void) // leilei - for the r g b components looking ups et
|
||||||
int COLORLEVELS = 64;
|
int COLORLEVELS = 64;
|
||||||
int PALBRIGHTS;
|
int PALBRIGHTS;
|
||||||
int limit = 127;
|
int limit = 127;
|
||||||
Con_Printf("YES!\nYES!!\nYES!!!\n");
|
;
|
||||||
RANGE = 2; // was 2.
|
RANGE = 2; // was 2.
|
||||||
|
|
||||||
if(!fullbrights) PALBRIGHTS = 0;
|
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 menumap[256][16]; // Used for menu backgrounds and simple colormod
|
||||||
byte gelmap[256]; // Unused id effect TO be used somehow. made redundant by menumap
|
byte gelmap[256]; // Unused id effect TO be used somehow. made redundant by menumap
|
||||||
|
@ -1198,6 +1191,7 @@ void MassiveLookupTablesInit (void)
|
||||||
int r, g, b;
|
int r, g, b;
|
||||||
int beastcolor;
|
int beastcolor;
|
||||||
int ugly;
|
int ugly;
|
||||||
|
int iTablefile = 0;
|
||||||
|
|
||||||
unsigned char* thepaltouse;
|
unsigned char* thepaltouse;
|
||||||
InitSmooth();
|
InitSmooth();
|
||||||
|
@ -1210,25 +1204,16 @@ void MassiveLookupTablesInit (void)
|
||||||
#endif
|
#endif
|
||||||
thepaltouse = host_basepal;
|
thepaltouse = host_basepal;
|
||||||
|
|
||||||
// if (COM_CheckParm ("-cache"))
|
Sys_FileOpenRead (va("%s/tinttab.lmp",com_gamedir), &iTablefile);
|
||||||
// lookupcaching = 1; // try to cache it all for future loading
|
if(iTablefile != -1)
|
||||||
|
|
||||||
fprintf(stderr,"\nGenerating additive table... ");
|
|
||||||
for (l=0;l<255;l++)
|
|
||||||
{
|
{
|
||||||
for (c=0 ; c<255 ; c++)
|
printf("\n[ENGINE] Reading alpha table... ");
|
||||||
|
Sys_FileRead(iTablefile, transTable, 65536);
|
||||||
|
printf("[DONE]");
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
red = thepaltouse[c*3] + thepaltouse[l*3];
|
printf("\n[ENGINE] Generating alpha table... ");
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(addTable)
|
|
||||||
fprintf(stderr,"[DONE]");
|
|
||||||
|
|
||||||
|
|
||||||
fprintf(stderr,"\nGenerating alpha table... ");
|
|
||||||
for (l=0;l<255;l++)
|
for (l=0;l<255;l++)
|
||||||
{
|
{
|
||||||
for (c=0 ; c<255 ; c++)
|
for (c=0 ; c<255 ; c++)
|
||||||
|
@ -1239,20 +1224,12 @@ void MassiveLookupTablesInit (void)
|
||||||
transTable[l][c] = BestColor(red,green,blue, 0, 254);
|
transTable[l][c] = BestColor(red,green,blue, 0, 254);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(transTable)
|
|
||||||
fprintf(stderr,"[DONE]");
|
|
||||||
|
|
||||||
|
printf("[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")){
|
if (COM_CheckParm ("-ugly")){
|
||||||
fprintf(stderr,"\n*** UGLY GENERATION MODE ON ***\n");
|
printf("\n\n*** UGLY GENERATION MODE ON ***\n");
|
||||||
ugly = 1;}
|
ugly = 1;}
|
||||||
else
|
else
|
||||||
ugly = 0;
|
ugly = 0;
|
||||||
|
@ -1261,7 +1238,16 @@ void MassiveLookupTablesInit (void)
|
||||||
VID_SetPalette2 (thepaltouse);
|
VID_SetPalette2 (thepaltouse);
|
||||||
|
|
||||||
|
|
||||||
fprintf(stderr,"\nGenerating 15-bit lookup table... ");
|
Sys_FileOpenRead (va("%s/dithtab.lmp",com_gamedir), &iTablefile);
|
||||||
|
if(iTablefile != -1)
|
||||||
|
{
|
||||||
|
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 (r=0 ; r<256 ; r+=8)
|
||||||
{
|
{
|
||||||
for (g=0 ; g<256 ; g+=8)
|
for (g=0 ; g<256 ; g+=8)
|
||||||
|
@ -1312,21 +1298,19 @@ void MassiveLookupTablesInit (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!palmap)
|
printf("[DONE]");
|
||||||
printf(stderr,"FAILED!\n");
|
}
|
||||||
else
|
|
||||||
fprintf(stderr,"[DONE]");
|
|
||||||
|
|
||||||
// Make the 18-bit lookup table here
|
Sys_FileOpenRead (va("%s/palmap2.lmp",com_gamedir), &iTablefile);
|
||||||
// This is a HUGE 256kb table, the biggest there is here
|
if(iTablefile != -1)
|
||||||
// TODO: Option to enable this
|
{
|
||||||
// if (r_lightquality->value){
|
printf("\n[ENGINE] Reading 18-bit lookup table... ");
|
||||||
|
Sys_FileRead(iTablefile, palmap2, 262144);
|
||||||
if (COM_CheckParm ("-no18"))
|
printf("[DONE]");
|
||||||
fprintf(stderr,"\n18-bit lookup generation skipped - High quality light mode DISABLED!\n");
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr,"\nGenerating 18-bit lookup table... ");
|
printf("\n[ENGINE] Generating 18-bit lookup table... ");
|
||||||
|
|
||||||
for (r=0 ; r<256 ; r+=4)
|
for (r=0 ; r<256 ; r+=4)
|
||||||
{
|
{
|
||||||
|
@ -1344,15 +1328,19 @@ void MassiveLookupTablesInit (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!palmap2)
|
printf("[DONE]");
|
||||||
printf(stderr,"FAILED!\n");
|
|
||||||
else
|
|
||||||
fprintf(stderr,"[DONE]");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr,"\nGenerating additive table... ");
|
Sys_FileOpenRead (va("%s/addmap.lmp",com_gamedir), &iTablefile);
|
||||||
|
if(iTablefile != -1)
|
||||||
|
{
|
||||||
|
printf("\n[ENGINE] Reading additive table... ");
|
||||||
|
Sys_FileRead(iTablefile, addTable, 65536);
|
||||||
|
printf(" [DONE]");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("\n[ENGINE] Generating additive table... ");
|
||||||
for (l=0;l<255;l++)
|
for (l=0;l<255;l++)
|
||||||
{
|
{
|
||||||
for (c=0 ; c<255 ; c++)
|
for (c=0 ; c<255 ; c++)
|
||||||
|
@ -1366,14 +1354,19 @@ void MassiveLookupTablesInit (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!addTable)
|
printf(" [DONE]");
|
||||||
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
|
else
|
||||||
fprintf(stderr,"[DONE]");
|
{
|
||||||
|
printf("\n[ENGINE] Generating multiply blend table...");
|
||||||
|
|
||||||
fprintf(stderr,"\nGenerating multiply blend table... ");
|
|
||||||
|
|
||||||
for (l=0;l<255;l++)
|
for (l=0;l<255;l++)
|
||||||
{
|
{
|
||||||
for (c=0 ; c<255 ; c++)
|
for (c=0 ; c<255 ; c++)
|
||||||
|
@ -1394,20 +1387,14 @@ void MassiveLookupTablesInit (void)
|
||||||
mulTable[l][c] = BestColor(red,green,blue, 0, 223);
|
mulTable[l][c] = BestColor(red,green,blue, 0, 223);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
printf("[DONE]\n");
|
||||||
|
}
|
||||||
|
|
||||||
if (!mulTable)
|
|
||||||
printf(stderr,"FAILED!\n");
|
|
||||||
else
|
|
||||||
fprintf(stderr,"[DONE]");
|
|
||||||
|
|
||||||
// if(palmap2)
|
|
||||||
PalmapStaticized();
|
PalmapStaticized();
|
||||||
|
|
||||||
// TODO: Caching lookups to disk, possibly folder unfriendly.
|
|
||||||
/* if (lookupcaching){
|
|
||||||
|
|
||||||
if (palmap)
|
/* if (palmap)
|
||||||
COM_WriteFile ("palmap.lmp", palmap, 32768);
|
COM_WriteFile ("palmap.lmp", palmap, 32768);*/
|
||||||
if (palmap2)
|
if (palmap2)
|
||||||
COM_WriteFile ("palmap2.lmp", palmap2, 262144);
|
COM_WriteFile ("palmap2.lmp", palmap2, 262144);
|
||||||
if (addTable)
|
if (addTable)
|
||||||
|
@ -1417,10 +1404,7 @@ void MassiveLookupTablesInit (void)
|
||||||
if (transTable)
|
if (transTable)
|
||||||
COM_WriteFile ("tinttab.lmp", transTable, 65536);
|
COM_WriteFile ("tinttab.lmp", transTable, 65536);
|
||||||
if (ditherTable)
|
if (ditherTable)
|
||||||
COM_WriteFile ("dithtab.lmp", ditherTable, 262144); // good lord this is huge.
|
COM_WriteFile ("dithtab.lmp", ditherTable, 1048576);.
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
int ahe;
|
int ahe;
|
||||||
for (ahe=0; ahe<256; ahe++)
|
for (ahe=0; ahe<256; ahe++)
|
||||||
|
|
|
@ -1073,7 +1073,7 @@ void VID_SetPalette2 (unsigned char *palette)
|
||||||
char s[255];
|
char s[255];
|
||||||
float gamma = 0;
|
float gamma = 0;
|
||||||
|
|
||||||
fprintf(stderr,"\nGenerating 8to24 lookup tables... ");
|
fprintf(stderr,"\n[ENGINE] Generating 8to24 lookup tables... ");
|
||||||
//
|
//
|
||||||
// 8 8 8 encoding
|
// 8 8 8 encoding
|
||||||
//
|
//
|
||||||
|
@ -1297,8 +1297,8 @@ void Host_Init (quakeparms_t *parms)
|
||||||
NVS_Init ();
|
NVS_Init ();
|
||||||
NVS_Init_Server ();
|
NVS_Init_Server ();
|
||||||
NVS_Init_Client ();
|
NVS_Init_Client ();
|
||||||
Con_Printf ("Engine compiled: "__TIME__" "__DATE__"\n");
|
Con_Printf ("[ENGINE] Dated "__TIME__" "__DATE__"\n");
|
||||||
Con_Printf ("%4.1f megabyte heap\n",parms->memsize/ (1024*1024.0));
|
Con_Printf ("[ENGINE] %4.1f megabyte heap\n",parms->memsize/ (1024*1024.0));
|
||||||
|
|
||||||
R_InitTextures (); // needed even for dedicated servers
|
R_InitTextures (); // needed even for dedicated servers
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ int UDP_Init (void)
|
||||||
if (colon)
|
if (colon)
|
||||||
*colon = 0;
|
*colon = 0;
|
||||||
|
|
||||||
Con_Printf("UDP Initialized\n");
|
Con_Printf("[NETWORK] UDP Initialized\n");
|
||||||
tcpipAvailable = true;
|
tcpipAvailable = true;
|
||||||
|
|
||||||
return net_controlsocket;
|
return net_controlsocket;
|
||||||
|
|
|
@ -84,7 +84,7 @@ void D_InitCaches (void *buffer, int size)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!msg_suppress_1)
|
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_size = size - GUARDSIZE;
|
||||||
sc_base = (surfcache_t *)buffer;
|
sc_base = (surfcache_t *)buffer;
|
||||||
|
|
|
@ -419,7 +419,6 @@ int main (int c, char **v)
|
||||||
nostdout = 1;
|
nostdout = 1;
|
||||||
else {
|
else {
|
||||||
fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);
|
fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);
|
||||||
printf ("NGUNIX -- Version %s\n", VERSION);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
oldtime = Sys_FloatTime () - 0.1;
|
oldtime = Sys_FloatTime () - 0.1;
|
||||||
|
|
|
@ -66,7 +66,7 @@ void FmodEx_Play(byte track, qboolean looping)
|
||||||
|
|
||||||
if (fmod_result != FMOD_OK)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,24 +125,28 @@ int FmodEx_Init(void)
|
||||||
unsigned int version;
|
unsigned int version;
|
||||||
|
|
||||||
if (FMOD_System_Create (&fmod_system)){
|
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)){
|
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)){
|
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);
|
Cmd_AddCommand ("fmod", FmodEx_f);
|
||||||
Con_Printf("FmodEx Initialised.\n");
|
|
||||||
fmod_initialised = true;
|
fmod_initialised = true;
|
||||||
|
Con_Printf("[MUSIC] Initialized\n");
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FmodEx_Shutdown(void)
|
void FmodEx_Shutdown(void)
|
||||||
{
|
{
|
||||||
|
if(fmod_initialised == false)
|
||||||
|
return;
|
||||||
|
|
||||||
FMOD_Sound_Release (fmod_sound);
|
FMOD_Sound_Release (fmod_sound);
|
||||||
FMOD_System_Close (fmod_system);
|
FMOD_System_Close (fmod_system);
|
||||||
FMOD_System_Release (fmod_system);
|
FMOD_System_Release (fmod_system);
|
||||||
Con_Printf("FmodEx Shutdown.\n");
|
fmod_initialised = false;
|
||||||
|
Con_Printf("[MUSIC] Shutdown\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -269,7 +269,7 @@ void TragicDeath(int signal_num)
|
||||||
{
|
{
|
||||||
XAutoRepeatOn(x_disp);
|
XAutoRepeatOn(x_disp);
|
||||||
XCloseDisplay(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");
|
d_pzbuffer = Hunk_HighAllocName (X11_buffersize, "video");
|
||||||
if (d_pzbuffer == NULL)
|
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_surfcache = (byte *) d_pzbuffer
|
||||||
+ vid.width * vid.height * sizeof (*d_pzbuffer);
|
+ vid.width * vid.height * sizeof (*d_pzbuffer);
|
||||||
|
@ -348,7 +348,7 @@ void ResetFrameBuffer(void)
|
||||||
0);
|
0);
|
||||||
|
|
||||||
if (!x_framebuffer[0])
|
if (!x_framebuffer[0])
|
||||||
Sys_Error("VID: XCreateImage failed\n");
|
Sys_Error("[VIDEO] XCreateImage failed\n");
|
||||||
|
|
||||||
vid.buffer = (byte*) (x_framebuffer[0]);
|
vid.buffer = (byte*) (x_framebuffer[0]);
|
||||||
vid.conbuffer = vid.buffer;
|
vid.conbuffer = vid.buffer;
|
||||||
|
@ -381,7 +381,7 @@ void ResetSharedFrameBuffers(void)
|
||||||
|
|
||||||
d_pzbuffer = Hunk_HighAllocName (X11_buffersize, "video");
|
d_pzbuffer = Hunk_HighAllocName (X11_buffersize, "video");
|
||||||
if (d_pzbuffer == NULL)
|
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_surfcache = (byte *) d_pzbuffer
|
||||||
+ vid.width * vid.height * sizeof (*d_pzbuffer);
|
+ vid.width * vid.height * sizeof (*d_pzbuffer);
|
||||||
|
@ -416,18 +416,18 @@ void ResetSharedFrameBuffers(void)
|
||||||
size = x_framebuffer[frm]->bytes_per_line
|
size = x_framebuffer[frm]->bytes_per_line
|
||||||
* x_framebuffer[frm]->height;
|
* x_framebuffer[frm]->height;
|
||||||
if (size < minsize)
|
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();
|
key = random();
|
||||||
x_shminfo[frm].shmid = shmget((key_t)key, size, IPC_CREAT|0777);
|
x_shminfo[frm].shmid = shmget((key_t)key, size, IPC_CREAT|0777);
|
||||||
if (x_shminfo[frm].shmid==-1)
|
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
|
// attach to the shared memory segment
|
||||||
x_shminfo[frm].shmaddr =
|
x_shminfo[frm].shmaddr =
|
||||||
(void *) shmat(x_shminfo[frm].shmid, 0, 0);
|
(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);
|
(long) x_shminfo[frm].shmaddr);
|
||||||
|
|
||||||
x_framebuffer[frm]->data = 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
|
// get the X server to attach to it
|
||||||
|
|
||||||
if (!XShmAttach(x_disp, &x_shminfo[frm]))
|
if (!XShmAttach(x_disp, &x_shminfo[frm]))
|
||||||
Sys_Error("VID: XShmAttach() failed\n");
|
Sys_Error("[VIDEO] XShmAttach() failed\n");
|
||||||
XSync(x_disp, 0);
|
XSync(x_disp, 0);
|
||||||
shmctl(x_shminfo[frm].shmid, IPC_RMID, 0);
|
shmctl(x_shminfo[frm].shmid, IPC_RMID, 0);
|
||||||
|
|
||||||
|
@ -495,10 +495,10 @@ void VID_Init (unsigned char *palette)
|
||||||
if (!x_disp)
|
if (!x_disp)
|
||||||
{
|
{
|
||||||
if (getenv("DISPLAY"))
|
if (getenv("DISPLAY"))
|
||||||
Sys_Error("VID: Could not open display [%s]\n",
|
Sys_Error("[VIDEO] Could not open display [%s]\n",
|
||||||
getenv("DISPLAY"));
|
getenv("DISPLAY"));
|
||||||
else
|
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
|
// 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_CheckParm("-winsize")))
|
||||||
{
|
{
|
||||||
if (pnum >= com_argc-2)
|
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.width = Q_atoi(com_argv[pnum+1]);
|
||||||
vid.height = Q_atoi(com_argv[pnum+2]);
|
vid.height = Q_atoi(com_argv[pnum+2]);
|
||||||
if (!vid.width || !vid.height)
|
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_CheckParm("-width"))) {
|
||||||
if (pnum >= com_argc-1)
|
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]);
|
vid.width = Q_atoi(com_argv[pnum+1]);
|
||||||
if (!vid.width)
|
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_CheckParm("-height"))) {
|
||||||
if (pnum >= com_argc-1)
|
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]);
|
vid.height = Q_atoi(com_argv[pnum+1]);
|
||||||
if (!vid.height)
|
if (!vid.height)
|
||||||
Sys_Error("VID: Bad window height\n");
|
Sys_Error("[VIDEO] Bad window height\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
template_mask = 0;
|
template_mask = 0;
|
||||||
|
@ -547,7 +547,7 @@ void VID_Init (unsigned char *palette)
|
||||||
if ((pnum=COM_CheckParm("-visualid")))
|
if ((pnum=COM_CheckParm("-visualid")))
|
||||||
{
|
{
|
||||||
if (pnum >= com_argc-1)
|
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.visualid = Q_atoi(com_argv[pnum+1]);
|
||||||
template_mask = VisualIDMask;
|
template_mask = VisualIDMask;
|
||||||
}
|
}
|
||||||
|
@ -566,16 +566,16 @@ void VID_Init (unsigned char *palette)
|
||||||
x_visinfo = XGetVisualInfo(x_disp, template_mask, &template, &num_visuals);
|
x_visinfo = XGetVisualInfo(x_disp, template_mask, &template, &num_visuals);
|
||||||
if (num_visuals > 1)
|
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++)
|
for (i=0 ; i<num_visuals ; i++)
|
||||||
printf(" -visualid %d\n", (int)(x_visinfo[i].visualid));
|
printf(" -visualid %d\n", (int)(x_visinfo[i].visualid));
|
||||||
}
|
}
|
||||||
else if (num_visuals == 0)
|
else if (num_visuals == 0)
|
||||||
{
|
{
|
||||||
if (template_mask == VisualIDMask)
|
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
|
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)
|
if (verbose)
|
||||||
|
@ -753,7 +753,7 @@ void VID_SetPalette(unsigned char *palette)
|
||||||
|
|
||||||
void VID_Shutdown (void)
|
void VID_Shutdown (void)
|
||||||
{
|
{
|
||||||
Con_Printf("VID_Shutdown\n");
|
Con_Printf("[VIDEO] Shutdown\n");
|
||||||
XAutoRepeatOn(x_disp);
|
XAutoRepeatOn(x_disp);
|
||||||
XCloseDisplay(x_disp);
|
XCloseDisplay(x_disp);
|
||||||
}
|
}
|
||||||
|
@ -1045,7 +1045,7 @@ void VID_Update (vrect_t *rects)
|
||||||
if (!XShmPutImage(x_disp, x_win, x_gc,
|
if (!XShmPutImage(x_disp, x_win, x_gc,
|
||||||
x_framebuffer[current_framebuffer], rects->x, rects->y,
|
x_framebuffer[current_framebuffer], rects->x, rects->y,
|
||||||
rects->x, rects->y, rects->width, rects->height, True))
|
rects->x, rects->y, rects->width, rects->height, True))
|
||||||
Sys_Error("VID_Update: XShmPutImage failed\n");
|
Sys_Error("[VIDEO] XShmPutImage failed\n");
|
||||||
oktodraw = false;
|
oktodraw = false;
|
||||||
while (!oktodraw) GetEvent();
|
while (!oktodraw) GetEvent();
|
||||||
rects = rects->pnext;
|
rects = rects->pnext;
|
||||||
|
|
Loading…
Reference in a new issue