09 Nov 2007

This commit is contained in:
g-cont 2007-11-09 00:00:00 +03:00 committed by Alibek Omarov
parent 25b92ef1e0
commit f5f108aa02
64 changed files with 752 additions and 730 deletions

View File

@ -2,6 +2,7 @@
Винда неадекватно реагирует на исполняемые файлы с именем setup.exe (какой-то набор умолчаний - см BC)
Ньютон - это просто пипец какой-то. С версии 1.3 до 1.53 левостороняя система координат сменилась на правую.
Коллижен менеджер (который фейсы добавляет) на версии 1.53 вылетает при парсинге base1.bsp почему-то.
DDS Converter 2.1 некорректно высчитывает размер dds файла (баг в devil ?), юзаем только nvdxt
Разработать концепцию языка VirtualC\VirtualC++ (базируется на QuakeC)
представить func_t как структуру(возвращаемые значения и аргументы)
@ -16,6 +17,13 @@ SV_ClipToLinks SV_ClipMoveToEntities
избавить от параметров командной строки в launch.dll (common.dll может брать их самостоятельно)
loading bar
1. textures
2. models
3. pictures
4. clients
studioframeadvance
studiorewindframe
@ -25,7 +33,12 @@ widthInChars = visible_length
maxchars = length
scroll = visible_offset
Имплементация собственной stdlib
1. Перенести менеджер памяти в launch.dll
Полная имплементация и подгонка уже существующих систем:
1. Исправить работу cmd для командной строки OK
2. Исправить работу кнопок для меню OK
3. удалить поддержку джойстика OK
@ -37,11 +50,23 @@ scroll = visible_offset
9. Добавить автоматическую систему levelshots OK
10. новая система парсинга худ-программы
11. консолька не всегда готова к приему комманд
12. Перенести наконец картинки в отдельную папку
12. Перенести наконец картинки в отдельную папку OK
13. научить системную консоль убивать color prefixes OK
14. переписать код загрузки уровня OK
15. убить версии библиотек (api_size вполне достаточно) OK
16. Разобраться, наконец, почему небо не грузится OK
17. пофиксить дедикатед консольку OK
18. пофиксить загрузку OK
19. пофиксить вылет движка в release OK
20. убрать мусор из консоли
21. заменить все strcpy, strcat на strncpy, strncat
//==================================================
// то, что уже готово
//==================================================
+исправлен баг с лаунчерами
+пофикшена проверка на размер картинки
+консоль теперь показывается только для dev или debug режимов
+SC_GetToken теперь умеет парсить слова
+добавлена миникарта
+спрайты наконец-то пофикшены

View File

@ -54,7 +54,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /opt:nowin98
# ADD LINK32 common/zlib.lib winmm.lib user32.lib /nologo /dll /profile /machine:I386 /nodefaultlib:"libc.lib" /opt:nowin98
# ADD LINK32 common/zlib.lib /nologo /dll /profile /machine:I386 /nodefaultlib:"libc.lib" /opt:nowin98
# Begin Custom Build
TargetDir=\XASH3D\src_main\!source\temp\common\!release
InputPath=\XASH3D\src_main\!source\temp\common\!release\common.dll
@ -90,7 +90,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 common/zlib.lib winmm.lib user32.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"libc.lib" /pdbtype:sept
# ADD LINK32 common/zlib.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"libc.lib" /pdbtype:sept
# SUBTRACT LINK32 /incremental:no /nodefaultlib
# Begin Custom Build
TargetDir=\XASH3D\src_main\!source\temp\common\!debug
@ -125,10 +125,6 @@ SOURCE=.\bsplib\csg.c
# End Source File
# Begin Source File
SOURCE=.\roqlib\roq_dec.c
# End Source File
# Begin Source File
SOURCE=.\bsplib\faces.c
# End Source File
# Begin Source File
@ -209,6 +205,10 @@ SOURCE=.\bsplib\qvis3.c
# End Source File
# Begin Source File
SOURCE=.\roqlib\roq_dec.c
# End Source File
# Begin Source File
SOURCE=.\roqlib\roq_main.c
# End Source File
# Begin Source File

View File

@ -652,11 +652,11 @@ void FS_FileBase (char *in, char *out)
start = 0;
else start++;
if(in[start] == '#') start++;
// Length of new sting
len = end - start + 1;
if(in[start] == '#')start++;
// Copy partial string
strncpy( out, &in[start], len );
out[len] = 0;
@ -1080,10 +1080,10 @@ void FS_CreateGameInfo( const char *filename )
char *buffer = Malloc( MAX_SYSPATH );
// make simply gameinfo.txt
strcat(buffer, "// generated by Xash3D\r\r\nbasedir\t\"xash\"\n");//add new string
strcat(buffer, va("gamedir\t\"%s\"\n", gs_basedir ));
strcat(buffer, "title\t\"New Game\"\rversion\t\"1.0\"\rviewmode\t\"firstperson\"\r");
strcat(buffer, "gamemode\t\"singleplayer\"\rgamekey\t\"\"");
strncat(buffer, "// generated by Xash3D\r\r\nbasedir\t\"xash\"\n", MAX_SYSPATH );//add new string
strncat(buffer, va("gamedir\t\"%s\"\n", gs_basedir ), MAX_SYSPATH);
strncat(buffer, "title\t\"New Game\"\rversion\t\"1.0\"\rviewmode\t\"firstperson\"\r", MAX_SYSPATH );
strncat(buffer, "gamemode\t\"singleplayer\"\rgamekey\t\"\"", MAX_SYSPATH );
FS_WriteFile( filename, buffer, strlen(buffer));
Free( buffer );
@ -1178,7 +1178,7 @@ void FS_Init( int argc, char **argv )
}
// checked nasty path
if(FS_CheckNastyPath(gs_basedir, true ) || !stricmp("bin", gs_basedir )) // "bin" it's a reserved word
if(FS_CheckNastyPath( gs_basedir, true ) || !stricmp("bin", gs_basedir )) // "bin" it's a reserved word
{
MsgWarn("FS_Init: invalid game directory \"%s\". Use default gamedir \"xash\".\n", gs_basedir );
strcpy(gs_basedir, "xash" );//default dir
@ -1198,7 +1198,7 @@ void FS_Init( int argc, char **argv )
}
stringlistfreecontents(&dirs);
MsgDev(D_INFO, "FS_Init: done\n");
MsgDev(D_NOTE, "FS_Init: done\n");
}
void FS_InitRootDir( char *path )
@ -1225,6 +1225,7 @@ bool FS_GetParmFromCmdLine( char *parm, char *out )
if(!argc) return false;
if(!out) return false;
if(!fs_argv[argc + 1]) return false;
strcpy( out, fs_argv[argc+1]);
return true;
@ -2102,7 +2103,7 @@ void FS_DefaultExtension (char *path, const char *extension )
if (*src == '.') return;
src--;
}
strcat (path, extension );
strcat( path, extension );
}
/*

View File

@ -189,7 +189,7 @@ bool LoadWAL( char *name, char *buffer, int filesize )
pixels = image_width * image_height;
mipsize = (int)sizeof(wal) + ofs + pixels;
image_size = image_width * image_height * 4;// wall can't have alpha
image_size = image_width * image_height * 4; // wall can't have alpha
if (pixels > 256 && filesize < mipsize)
{
@ -888,7 +888,7 @@ uint dds_calc_mipmap_size( dds_t *hdr )
int i, mipsize = 0;
int bits = hdr->dsPixelFormat.dwRGBBitCount / 8;
//now correct buffer size
// now correct buffer size
for( i = 0; i < image_num_mips; i++, buffsize += mipsize )
{
mipsize = dds_get_linear_size( w, h, d, bits );
@ -926,7 +926,7 @@ uint dds_calc_size( char *name, dds_t *hdr, uint filesize )
buffsize = dds_calc_mipmap_size( hdr );
}
if(filesize != buffsize) //main check
if(filesize != buffsize) // main check
{
MsgWarn("LoadDDS: (%s) probably corrupted(%i should be %i)\n", name, buffsize, filesize );
return false;
@ -1593,7 +1593,7 @@ bool FS_AddImageToPack( const char *name )
if(resampled != image_rgba)
{
MsgDev(D_SPAM, "FS_AddImageToPack: resample %s from [%dx%d] to [%dx%d]\n", name, image_width, image_height, cubemap_width, cubemap_height );
MsgDev(D_NOTE, "FS_AddImageToPack: resample %s from [%dx%d] to [%dx%d]\n", name, image_width, image_height, cubemap_width, cubemap_height );
Mem_Move( imagepool, &image_rgba, resampled, image_size );// update buffer
}
@ -1630,7 +1630,7 @@ rgbdata_t *FS_LoadImage(const char *filename, char *buffer, int buffsize )
FS_StripExtension( loadname ); //remove extension if needed
// developer warning
if(!anyformat) MsgWarn( "%s will be loading only with ext .%s\n", loadname, ext );
if(!anyformat) MsgDev(D_NOTE, "Note: %s will be loading only with ext .%s\n", loadname, ext );
// now try all the formats in the selected list
for (format = load_formats; format->formatstring; format++)
@ -1675,7 +1675,7 @@ rgbdata_t *FS_LoadImage(const char *filename, char *buffer, int buffsize )
// first side not found, probably it's not cubemap
// it contain info about image_type and dimensions, don't generate black cubemaps
if(!image_cubemap) break;
MsgDev(D_SPAM, "FS_LoadImage: couldn't load (%s%s.%s), create balck image\n",loadname,suf[i],ext );
MsgDev(D_ERROR, "FS_LoadImage: couldn't load (%s%s.%s), create balck image\n",loadname,suf[i],ext );
// Mem_Alloc already filled memblock with 0x00, no need to do it again
image_cubemap = Mem_Realloc( imagepool, image_cubemap, image_ptr + image_size );
@ -1703,7 +1703,7 @@ rgbdata_t *FS_LoadImage(const char *filename, char *buffer, int buffsize )
}
}
MsgDev(D_SPAM, "FS_LoadImage: couldn't load (%s)\n", texname );
MsgDev(D_WARN, "couldn't load %s\n", texname );
return NULL;
}
@ -1808,7 +1808,7 @@ bool SaveTGA( const char *filename, byte *data, int width, int height, bool alph
}
}
MsgDev(D_SPAM, "Writing %s[%d]\n", filename, alpha ? 32 : 24 );
MsgDev(D_NOTE, "Writing %s[%d]\n", filename, alpha ? 32 : 24 );
FS_WriteFile (filename, buffer, outsize );
Free( buffer );

View File

@ -20,11 +20,11 @@ static dllfunc_t winmm_funcs[] =
{ NULL, NULL }
};
dll_info_t winmm_dll = { "winmm.dll", winmm_funcs, "", NULL, NULL, true, 0, 0 };
dll_info_t winmm_dll = { "winmm.dll", winmm_funcs, "", NULL, NULL, true, 0 };
void Plat_LinkDlls( void )
{
//Sys_LoadLibrary( &winmm_dll );
Sys_LoadLibrary( &winmm_dll );
}
char *strlower (char *start)
@ -1690,11 +1690,11 @@ double Plat_DoubleTime (void)
// windows have varying accuracy
if (firsttimegettime)
{
timeBeginPeriod (1);
qtimeBeginPeriod (1);
firsttimegettime = false;
}
newtime = (double)timeGetTime () * 0.001;
newtime = (double)qtimeGetTime () * 0.001;
}
else
{

View File

@ -48,14 +48,13 @@ common_exp_t DLLEXPORT *CreateAPI ( stdlib_api_t *input )
// and always make exception, run simply check for avoid it
if(input) std = *input;
//generic functions
Com.apiversion = COMMON_API_VERSION;
// generic functions
Com.api_size = sizeof(common_exp_t);
Com.Init = InitPlatform;
Com.Shutdown = ClosePlatform;
//get interfaces
// get interfaces
Com.Fs = FS_GetAPI();
Com.VFs = VFS_GetAPI();
Com.Mem = Mem_GetAPI();

View File

@ -22,7 +22,6 @@ launch_exp_t DLLEXPORT *CreateAPI( stdlib_api_t *input )
// and always make exception, run simply check for avoid it
if(input)std = *input;
Editor.apiversion = LAUNCH_API_VERSION;
Editor.api_size = sizeof(launch_exp_t);
Editor.Init = InitEditor;

View File

@ -34,8 +34,8 @@ wnd_options_t w_opts; //window options
common_exp_t *com; //common utils
static bool editor_init = false;
static char textbuffer[MAX_INPUTLINE];
dll_info_t common_dll = { "common.dll", NULL, "CreateAPI", NULL, NULL, false, COMMON_API_VERSION, sizeof(common_exp_t) };
dll_info_t richedit_dll = { "riched32.dll", NULL, NULL, NULL, NULL, false, 0, 0 };
dll_info_t common_dll = { "common.dll", NULL, "CreateAPI", NULL, NULL, false, sizeof(common_exp_t) };
dll_info_t richedit_dll = { "riched32.dll", NULL, NULL, NULL, NULL, false, 0 };
/*
@ -429,9 +429,8 @@ void GUI_ResetWndOptions( void )
s_gui.gHinst = (HINSTANCE) GetModuleHandle( NULL );
//reset options
// reset options
w_opts.id = IDEDITORHEADER;
w_opts.version = (int)EDITOR_VERSION;
w_opts.csize = sizeof(wnd_options_t);
w_opts.show_console = true;
w_opts.con_scale = 6L;
@ -837,7 +836,7 @@ void GUI_UpdateDefault( WPARAM wParam )
break;
case IDM_ABOUT:
if(!w_opts.show_console) GUI_ShowConsole();
Msg("Xash Resource Editor. Ver %g\n", EDITOR_VERSION );
Msg("Xash Resource Editor. ver. %g\n", XASH_VERSION );
Msg("Copyright XashXT Group 2007 ©.\n");
break;
}
@ -1003,11 +1002,6 @@ void InitEditor ( char *funcname, int argc, char **argv )
MsgWarn("InitEditor: editor.dat have mismath header!\n");
iErrors++;
}
if(config_dat->version != (int)EDITOR_VERSION)
{
MsgWarn("InitEditor: editor.dat have mismath version!\n");
iErrors++;
}
if(config_dat->csize != config_size)
{
MsgWarn("InitEditor: editor.dat have mismath size!\n");
@ -1032,7 +1026,7 @@ void InitEditor ( char *funcname, int argc, char **argv )
// end of all initializations
ShowWindow(s_gui.hWnd, SW_SHOWDEFAULT);
MsgDev(D_INFO, "------- Xash Recource Editor ver. %g initialized -------\n", EDITOR_VERSION );
MsgDev(D_INFO, "------- Xash Recource Editor ver. %g initialized -------\n", XASH_VERSION );
}
void EditorMain ( void )

View File

@ -36,6 +36,7 @@ bool _GetParmFromCmdLine( char *parm, char *out, size_t size )
if(!argc) return false;
if(!out) return false;
if(!com_argv[argc + 1]) return false;
strncpy( out, com_argv[argc+1], size );
return true;

View File

@ -10,7 +10,6 @@
typedef struct wnd_options_s
{
int id; //must be "IDRV"
int version;
size_t csize;
float con_scale;
float exp_scale;

View File

@ -10,8 +10,6 @@ extern cvar_t *scr_centertime;
extern cvar_t *scr_showpause;
extern bool scr_draw_loading;
#define FADE_TIME 0.5f
bool scr_draw_loading;
/*
@ -42,7 +40,6 @@ void CG_SetSky_f( void )
{
VectorSet(axis, 0, 0, 1 );
}
re->SetSky(Cmd_Argv(1), rotate, axis);
}
@ -72,41 +69,86 @@ CG_FadeColor
float *CG_FadeColor( float starttime, float endtime )
{
static vec4_t color;
float time;
float time, fade_time;
if( starttime == 0 ) return NULL;
time = cls.realtime - starttime;
if( time >= endtime ) return NULL;
// fade time is 1/4 of endtime
fade_time = endtime / 4;
fade_time = bound( 0.3f, fade_time, 10.0f );
// fade out
if((endtime - time) < FADE_TIME )
color[3] = (endtime - time) * 1.0f / FADE_TIME;
if((endtime - time) < fade_time)
color[3] = (endtime - time) * 1.0f / fade_time;
else color[3] = 1.0;
color[0] = color[1] = color[2] = 1.0f;
return color;
}
int CG_StatsValue( const char *name )
bool CG_StatsValue( const char *name, int *value )
{
int i, value = 0;
int i, find = 0;
if(!name || !name[0]) return false;
for(i = 0; i < cls.cg_numaliases; i++)
{
if(!strcmp(cls.cg_alias[i].name, name ))
{
value = cls.cg_alias[i].value;
find = cls.cg_alias[i].value;
break;
}
}
if(i == cls.cg_numaliases)
{
MsgDev(D_WARN, "CG_StatsValue: can't use undefined alias %s\n", name );
return 0;
*value = 0;
return false;
}
return cl.frame.playerstate.stats[value];
*value = cl.frame.playerstate.stats[find];
return true;
}
char *CG_StatsString( const char *name, int start, int end )
{
int i, value;
if(!name || !name[0]) return "common/black";
// search for alias
if(!CG_StatsValue( name, &value ))
{
// search for normal name
for(i = 0; i < end; i++)
{
if(!strcmp(cl.configstrings[start + i], name ))
{
// index can be changed from server
return cl.configstrings[start + i];
}
}
}
else if(value < end)
{
// static image index
return cl.configstrings[start + value];
}
// direct path ?
return (char *)name;
}
char *CG_ImageIndex( const char *name )
{
return CG_StatsString(name, CS_IMAGES, MAX_IMAGES );
}
char *CG_ModelIndex( const char *name )
{
return CG_StatsString(name, CS_MODELS, MAX_MODELS );
}
void CG_SetAlias( const char *name, int value )
@ -144,7 +186,6 @@ void CG_SetAlias( const char *name, int value )
// register new alias
if(i == cls.cg_numaliases)
{
Msg("add alias %s = %d\n", name, value );
strncpy(cls.cg_alias[cls.cg_numaliases].name, name, MAX_QPATH );
cls.cg_alias[cls.cg_numaliases].value = value;
cls.cg_numaliases++;
@ -169,17 +210,15 @@ bool CG_ParseArgs( int num_argc )
memset(cls.cg_argv, 0, MAX_PARMS * MAX_QPATH );
strncpy( cls.cg_progname, COM_Token, MAX_QPATH );
if( num_argc > MAX_PARMS )
{
MsgDev(D_WARN, "CG_ParseArgs: %s have too many args, limit is %d\n", cls.cg_progname, MAX_PARMS );
num_argc = MAX_PARMS;
}
// bound range silently
num_argc = bound(0, num_argc, MAX_PARMS - 1);
while(COM_TryToken())
{
if(cls.cg_argc > num_argc )
if(!num_argc) continue; // nothing to handle
if(num_argc > 0 && cls.cg_argc > num_argc - 1 )
{
MsgWarn("CG_ParseArgs: syntax error in function %s\n", cls.cg_progname );
MsgDev(D_ERROR, "CG_ParseArgs: %s have too many parameters\n", cls.cg_progname );
return false; // stack overflow
}
else if(COM_MatchToken(";")) break; // end of parsing
@ -188,6 +227,10 @@ bool CG_ParseArgs( int num_argc )
continue; // skip punctuation
else strncpy(cls.cg_argv[cls.cg_argc], COM_Token, MAX_QPATH ); // fill stack
}
if(num_argc > 0 && cls.cg_argc < num_argc - 1)
MsgDev(D_WARN, "CG_ParseArgs: %s have too few parameters\n", cls.cg_progname );
return true;
}
@ -215,6 +258,44 @@ void CG_SkipBlock( void )
}
}
void CG_StringToVector( float *vec, const char *string )
{
char *pstr, *pfront, buffer[MAX_QPATH];
int j;
strncpy( buffer, string, MAX_QPATH );
pstr = pfront = buffer;
for ( j = 0; j < 3; j++ )
{
vec[j] = atof( pfront );
while( *pstr && *pstr != ' ' )
pstr++;
if (!*pstr) break;
pstr++;
pfront = pstr;
}
if (j < 2) VectorSet( vec, 0, 0, 0 );
}
void CG_DrawLoadingBar( float percent, float scale)
{
SCR_FillRect(viddef.width * 0.5f - scale * 15.0f, viddef.height * 0.8f + scale * 5.0f, scale * 30.0f, scale * 2.0f, g_color_table[0] );
if(re->RegisterPic("common/bar_back") && re->RegisterPic("common/bar_load"))
{
SCR_DrawPic(viddef.width * 0.5f - scale * 15.0f + 1, viddef.height * 0.8f + scale * 5.0f + 1, scale * 30.0f - 2, scale * 2 - 2, "common/bar_back");
SCR_DrawPic(viddef.width * 0.5f - scale * 15.0f + 1, viddef.height * 0.8f + scale * 5.0f + 1, (scale * 30 - 2) * percent * 0.01f, scale * 2 - 2, "common/bar_load");
}
else
{
SCR_FillRect(viddef.width * 0.5f - scale * 15.0f + 1, viddef.height * 0.8f + scale * 5.0f + 1, scale * 30.0f - 2, scale * 2 - 2, g_color_table[3] );
SCR_FillRect(viddef.width * 0.5f - scale * 15.0f + 1, viddef.height * 0.8f + scale * 5.0f + 1, (scale * 30.0f - 2) * percent * 0.01, scale * 2 - 2, g_color_table[7] );
}
}
/*
===============================================================================
@ -639,28 +720,6 @@ void SCR_DrawField (int x, int y, int color, int width, int value)
}
}
/*
===============
SCR_TouchPics
Allows rendering code to cache all needed sbar graphics
===============
*/
void SCR_TouchPics (void)
{
if (crosshair->value)
{
if (crosshair->value > 3 || crosshair->value < 0)
crosshair->value = 3;
sprintf (crosshair_pic, "hud/ch%i", (int)(crosshair->value));
re->DrawGetPicSize (&crosshair_width, &crosshair_height, crosshair_pic);
if (!crosshair_width)
crosshair_pic[0] = 0;
}
}
/*
================
CG_ExecuteProgram
@ -669,7 +728,8 @@ CG_ExecuteProgram
*/
void CG_ExecuteProgram( char *section )
{
bool skip = true;
bool skip = true;
int value = 0;
COM_ResetScript();
cls.cg_program_depth = 0;
@ -704,14 +764,15 @@ void CG_ExecuteProgram( char *section )
if(COM_MatchToken("if"))
{
bool equal = true;
int value = 0;
if(!CG_ParseArgs( 1 )) continue;
if( cls.cg_argv[0][0] == '!' ) equal = false;
value = CG_StatsValue(cls.cg_argv[0] + (equal ? 0 : 1));
if(value && equal) continue;
else if(!value && !equal) continue;
if(CG_StatsValue(cls.cg_argv[0] + (equal ? 0 : 1), &value ))
{
if(value && equal) continue;
else if(!value && !equal) continue;
else CG_SkipBlock(); // skip if{ }
}
else CG_SkipBlock(); // skip if{ }
}
else if(COM_MatchToken("SetAlias"))
@ -730,13 +791,15 @@ void CG_ExecuteProgram( char *section )
{
// displayed health, armor, e.t.c.
if(!CG_ParseArgs( 4 )) continue;
CG_DrawField(CG_StatsValue(cls.cg_argv[0]), atoi(cls.cg_argv[1]), atoi(cls.cg_argv[2]), atoi(cls.cg_argv[3]));
if(!CG_StatsValue(cls.cg_argv[0], &value))
MsgDev(D_WARN, "%s: can't use undefined alias %s\n", cls.cg_progname, cls.cg_argv[0]);
else CG_DrawField( value, atoi(cls.cg_argv[1]), atoi(cls.cg_argv[2]), atoi(cls.cg_argv[3]));
}
else if(COM_MatchToken("DrawPic"))
{
// draw named pic
if(!CG_ParseArgs( 3 )) continue;
SCR_DrawPic( atoi(cls.cg_argv[1]), atoi(cls.cg_argv[2]), 48, 48, cls.cg_argv[0]);
SCR_DrawPic( atoi(cls.cg_argv[1]), atoi(cls.cg_argv[2]), 48, 48, CG_ImageIndex(cls.cg_argv[0]));
}
else if(COM_MatchToken("DrawStretchPic"))
{
@ -762,6 +825,13 @@ void CG_ExecuteProgram( char *section )
if(!CG_ParseArgs( 0 )) continue;
SCR_DrawPic(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, cl.levelshot_name );
}
else if(COM_MatchToken("DrawCrosshair"))
{
// draw crosshair
if(!crosshair->value) continue;
if(!CG_ParseArgs( 1 )) continue;
CG_DrawCenterPic( 16, 16, CG_ImageIndex(cls.cg_argv[0]));
}
/*if(!strcmp(token, "x"))
{
token = COM_Parse (&s);
@ -995,7 +1065,6 @@ void CG_ExecuteProgram( char *section )
CG_ResetColor(); // don't forget reset color
}
/*
================
SCR_DrawStats
@ -1043,13 +1112,14 @@ void V_RenderHUD( void )
{
CG_MakeLevelShot();
CG_DrawCenterString();
CG_DrawPause();
CG_DrawNet();
// move into client.dat
SCR_DrawStats();
if(cl.frame.playerstate.stats[STAT_LAYOUTS] & 1) SCR_DrawLayout();
if(cl.frame.playerstate.stats[STAT_LAYOUTS] & 2) CL_DrawInventory();
CG_DrawNet();
CG_DrawPause();
}
/*
@ -1074,6 +1144,7 @@ loading splash
void V_RenderLogo( void )
{
CG_ExecuteProgram( "Hud_DrawPlaque" );
CG_DrawLoadingBar( scr_loading->value, 8 );
}
/*

View File

@ -1202,7 +1202,8 @@ bool CIN_PlayCinematic( const char *arg, int x, int y, int w, int h, int systemB
char name[MAX_OSPATH];
memset(&cin, 0, sizeof(cinematics_t));
sprintf (name, "video/%s", arg);
sprintf(name, "video/%s", arg);
FS_DefaultExtension(name, ".roq" );
strcpy(cinTable.fileName, name);
cinTable.ROQSize = 0;

View File

@ -46,7 +46,8 @@ Con_ToggleConsole_f
*/
void Con_ToggleConsole_f (void)
{
SCR_EndLoadingPlaque(); // get rid of loading plaque
if(!host.debug && !host.developer) return;
Field_Clear( &g_consoleField );
g_consoleField.widthInChars = g_console_field_width;
@ -81,12 +82,11 @@ void Con_ToggleChat_f (void)
{
if (cls.state == ca_active)
{
M_ForceMenuOff ();
M_ForceMenuOff();
cls.key_dest = key_game;
}
}
else
cls.key_dest = key_console;
else cls.key_dest = key_console;
Con_ClearNotify ();
}
@ -505,6 +505,7 @@ void Con_DrawSolidConsole (float frac)
int lines;
int currentColor;
vec4_t color;
char version[MAX_QPATH];
lines = viddef.height * frac;
if (lines <= 0) return;
@ -523,9 +524,10 @@ void Con_DrawSolidConsole (float frac)
// draw the version number
re->SetColor(g_color_table[ColorIndex(COLOR_RED)]);
i = strlen( VERSION );
sprintf( version, "Xash %g", XASH_VERSION );
i = strlen( version );
for (x = 0; x < i; x++)
SCR_DrawSmallChar( viddef.width - ( i - x ) * SMALLCHAR_WIDTH, (lines - (SMALLCHAR_HEIGHT+SMALLCHAR_HEIGHT/2)), VERSION[x]);
SCR_DrawSmallChar( viddef.width - ( i - x ) * SMALLCHAR_WIDTH, (lines - (SMALLCHAR_HEIGHT+SMALLCHAR_HEIGHT/2)), version[x]);
// draw the text
con.vislines = lines;
@ -584,6 +586,8 @@ Con_DrawConsole
*/
void Con_DrawConsole( void )
{
if(!host.debug && !host.developer) return;
// check for console width changes from a vid mode change
Con_CheckResize ();
@ -624,6 +628,8 @@ Scroll it up or down
*/
void Con_RunConsole( void )
{
if(!host.debug && !host.developer) return;
// decide on the destination height of the console
if (cls.key_dest == key_console)
{

View File

@ -889,7 +889,7 @@ void CL_ConnectionlessPacket (void)
c = Cmd_Argv(0);
Msg ("%s: %s\n", NET_AdrToString (net_from), c);
MsgDev(D_INFO, "%s: %s\n", NET_AdrToString (net_from), c);
// server connection
if (!strcmp(c, "client_connect"))
@ -1301,8 +1301,8 @@ void CL_RequestNextDownload (void)
{
int n = precache_check++ - ENV_CNT - 1;
if (n & 1) sprintf(fn, "env/%s%s.pcx", cl.configstrings[CS_SKY], env_suf[n/2]);
else sprintf(fn, "env/%s%s.tga", cl.configstrings[CS_SKY], env_suf[n/2]);
if (n & 1) sprintf(fn, "textures/cubemaps/env/%s%s.dds", cl.configstrings[CS_SKY], env_suf[n/2]);
else sprintf(fn, "textures/cubemaps/env/%s%s.tga", cl.configstrings[CS_SKY], env_suf[n/2]);
if (!CL_CheckOrDownloadFile(fn)) return; // started a download
}
}
@ -1726,10 +1726,10 @@ void CL_Init (void)
return; // nothing running on the client
// all archived variables will now be loaded
scr_loading = _Cvar_Get("scr_loading", "0", 0, "progress bar loading value" );
Con_Init ();
VID_Init ();
S_Init (); // sound must be initialized after window is created
V_Init ();
CG_Init();

View File

@ -295,7 +295,6 @@ void CL_ParseServerData (void)
char *str;
int i;
//Sys_Error("Serverdata packet received.\n");
MsgDev (D_INFO, "Serverdata packet received.\n");
// wipe the client_t struct
@ -329,9 +328,7 @@ void CL_ParseServerData (void)
else
{
// seperate the printfs so the server message can have a color
Msg("\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n");
Msg ("^3%s\n", str);
Msg("\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n");
// need to prep refresh at next oportunity
cl.refresh_prepped = false;
}
@ -494,10 +491,8 @@ void CL_ParseConfigString (void)
// do something apropriate
if (i >= CS_LIGHTS && i < CS_LIGHTS+MAX_LIGHTSTYLES)
CL_SetLightstyle (i - CS_LIGHTS);
else if (i == CS_CDTRACK)
{
Msg("unsupported command\n");
CL_SetLightstyle (i - CS_LIGHTS);
}
else if (i >= CS_MODELS && i < CS_MODELS+MAX_MODELS)
{

View File

@ -8,17 +8,15 @@
bool scr_initialized; // ready to draw
vrect_t scr_vrect; // position of render window on screen
cvar_t *scr_viewsize;
cvar_t *scr_centertime;
cvar_t *scr_showpause;
cvar_t *scr_printspeed;
char crosshair_pic[MAX_QPATH];
int crosshair_width, crosshair_height;
cvar_t *scr_viewsize;
cvar_t *scr_centertime;
cvar_t *scr_showpause;
cvar_t *scr_printspeed;
cvar_t *scr_loading;
void SCR_TimeRefresh_f( void );
void SCR_Loading_f( void );
/*
================
SCR_AdjustSize

View File

@ -148,11 +148,6 @@ void CL_RegisterTEntModels (void)
cl_mod_explo2 = re->RegisterModel ("sprites/s_explo2.spr");
cl_mod_explo4 = re->RegisterModel ("sprites/s_explod.spr");
cl_mod_bfg_explo = re->RegisterModel ("sprites/s_bfg2.spr");
re->RegisterPic ("w_machinegun");
re->RegisterPic ("a_bullets");
re->RegisterPic ("i_health");
re->RegisterPic ("a_grenades");
}
/*

View File

@ -203,7 +203,7 @@ void V_TestEntities (void)
r_numentities = 32;
memset (r_entities, 0, sizeof(r_entities));
for (i=0 ; i<r_numentities ; i++)
for (i = 0; i < r_numentities; i++)
{
ent = &r_entities[i];
@ -264,13 +264,14 @@ Call before entering a new level, or after changing dlls
void CL_PrepRefresh( void )
{
char mapname[32];
int i;
char name[MAX_QPATH];
float rotate;
vec3_t axis;
int i;
int mdlcount = 0, imgcount = 0, cl_count = 0;
if (!cl.configstrings[CS_MODELS+1][0])
return; // no map loaded
return; // no map loaded
// get splash name
sprintf( cl.levelshot_name, "background/%s.tga", cl.configstrings[CS_NAME] );
@ -279,39 +280,47 @@ void CL_PrepRefresh( void )
strcpy( cl.levelshot_name, "common/black" );
cl.make_levelshot = true; // make levelshot
}
Con_Close();
Cvar_SetValue("scr_loading", 0.0f ); // reset progress bar
// let the render dll load the map
strcpy (mapname, cl.configstrings[CS_MODELS+1] + 5); // skip "maps/"
mapname[strlen(mapname)-4] = 0; // cut off ".bsp"
// register models, pics, and skins
Msg ("Map: %s\r", mapname);
SCR_UpdateScreen ();
re->BeginRegistration (mapname);
Msg (" \r");
// precache status bar pics
Msg ("pics\r");
SCR_UpdateScreen ();
// get alias names
CG_ExecuteProgram( "Hud_Precache" );
SCR_TouchPics ();
Msg (" \r");
FS_FileBase( cl.configstrings[CS_MODELS+1], mapname );
SCR_UpdateScreen();
re->BeginRegistration( mapname ); // load map
SCR_UpdateScreen();
CG_ExecuteProgram( "Hud_Precache" ); // get alias names
CL_RegisterTEntModels ();
num_cl_weaponmodels = 1;
strcpy(cl_weaponmodels[0], "weapon.mdl");
for (i=1 ; i<MAX_MODELS && cl.configstrings[CS_MODELS+i][0] ; i++)
for( i = 1; i < MAX_MODELS; i++ )
{
strcpy (name, cl.configstrings[CS_MODELS+i]);
if(!cl.configstrings[CS_MODELS+i][0])
break;
mdlcount++; // total num models
}
for( i = 1; i < MAX_IMAGES; i++ )
{
if(!cl.configstrings[CS_IMAGES+i][0])
break;
imgcount++; // total num models
}
for (i = 0; i < MAX_CLIENTS; i++)
{
if(!cl.configstrings[CS_PLAYERSKINS+i][0])
continue;
cl_count++;
}
// create thread here ?
for (i = 1; i < MAX_MODELS && cl.configstrings[CS_MODELS+i][0]; i++)
{
strcpy(name, cl.configstrings[CS_MODELS+i]);
name[37] = 0; // never go beyond one line
if (name[0] != '*') Msg ("%s\r", name);
SCR_UpdateScreen ();
Sys_SendKeyEvents (); // pump message loop
if (name[0] != '*') MsgDev(D_LOAD, "%s\n", name);
SCR_UpdateScreen();
Sys_SendKeyEvents(); // pump message loop
if (name[0] == '#')
{
// special player weapon model
@ -324,55 +333,50 @@ void CL_PrepRefresh( void )
}
else
{
cl.model_draw[i] = re->RegisterModel (cl.configstrings[CS_MODELS+i]);
if (name[0] == '*')
cl.model_clip[i] = CM_InlineModel (cl.configstrings[CS_MODELS+i]);
else
cl.model_clip[i] = NULL;
cl.model_draw[i] = re->RegisterModel(cl.configstrings[CS_MODELS+i]);
if (name[0] == '*') cl.model_clip[i] = CM_InlineModel (cl.configstrings[CS_MODELS+i]);
else cl.model_clip[i] = NULL;
}
if (name[0] != '*')
Msg (" \r");
Cvar_SetValue("scr_loading", scr_loading->value + 50.0f/mdlcount );
Msg("loading models %g\n", scr_loading->value + 50.0f/mdlcount );
SCR_UpdateScreen();
}
Msg ("images\r", i);
SCR_UpdateScreen ();
for (i=1 ; i<MAX_IMAGES && cl.configstrings[CS_IMAGES+i][0] ; i++)
// create thread here ?
SCR_UpdateScreen();
for (i = 1; i < MAX_IMAGES && cl.configstrings[CS_IMAGES+i][0]; i++)
{
cl.image_precache[i] = re->RegisterPic (cl.configstrings[CS_IMAGES+i]);
Sys_SendKeyEvents (); // pump message loop
Sys_SendKeyEvents (); // pump message loop
Cvar_SetValue("scr_loading", scr_loading->value + 3.0f/imgcount );
SCR_UpdateScreen();
}
Msg (" \r");
for (i=0 ; i<MAX_CLIENTS ; i++)
// create thread here ?
for (i = 0; i < MAX_CLIENTS; i++)
{
if (!cl.configstrings[CS_PLAYERSKINS+i][0])
continue;
Msg ("client %i\r", i);
if(!cl.configstrings[CS_PLAYERSKINS+i][0]) continue;
Cvar_SetValue("scr_loading", scr_loading->value + 2.0f/cl_count );
SCR_UpdateScreen ();
Sys_SendKeyEvents (); // pump message loop
CL_ParseClientinfo (i);
Msg (" \r");
Sys_SendKeyEvents(); // pump message loop
CL_ParseClientinfo(i);
}
CL_LoadClientinfo (&cl.baseclientinfo, "unnamed\\male/grunt");
// set sky textures and speed
Msg ("sky\r", i);
SCR_UpdateScreen ();
rotate = atof (cl.configstrings[CS_SKYROTATE]);
sscanf (cl.configstrings[CS_SKYAXIS], "%f %f %f", &axis[0], &axis[1], &axis[2]);
re->SetSky (cl.configstrings[CS_SKY], rotate, axis);
Msg (" \r");
// the render can now free unneeded stuff
re->EndRegistration ();
// clear any lines of console text
Con_ClearNotify ();
SCR_UpdateScreen ();
SCR_UpdateScreen();
rotate = atof(cl.configstrings[CS_SKYROTATE]);
CG_StringToVector( axis, cl.configstrings[CS_SKYAXIS] );
Msg("Sky Vector %g %g %g\n", axis[0], axis[1], axis[2] );
re->SetSky( cl.configstrings[CS_SKY], rotate, axis);
Cvar_SetValue("scr_loading", 100.0f ); // all done
re->EndRegistration (); // the render can now free unneeded stuff
Con_ClearNotify(); // clear any lines of console text
SCR_UpdateScreen();
cl.refresh_prepped = true;
cl.force_refdef = true; // make sure we have a valid refdef
cl.force_refdef = true;
}
/*
@ -428,30 +432,6 @@ void V_Gun_Model_f (void)
//============================================================================
/*
=================
SCR_DrawCrosshair
=================
*/
void SCR_DrawCrosshair (void)
{
if (!crosshair->value)
return;
if (crosshair->modified)
{
crosshair->modified = false;
SCR_TouchPics ();
}
if (!crosshair_pic[0])
return;
re->DrawPic (scr_vrect.x + ((scr_vrect.width - crosshair_width)>>1)
, scr_vrect.y + ((scr_vrect.height - crosshair_height)>>1), crosshair_pic);
}
/*
==================
V_RenderView
@ -543,8 +523,6 @@ void V_RenderView( void )
cl.refdef.rdflags |= RDF_BLOOM;
re->RenderFrame (&cl.refdef);
if (cl_stats->value) Msg ("ent:%i lt:%i part:%i\n", r_numentities, r_numdlights, r_numparticles);
SCR_DrawCrosshair ();
}
/*

View File

@ -66,27 +66,17 @@ void SCR_Init (void);
void SCR_UpdateScreen (void);
void SCR_SizeUp (void);
void SCR_SizeDown (void);
void SCR_CenterPrint (char *str);
void SCR_BeginLoadingPlaque (void);
void SCR_EndLoadingPlaque (void);
void SCR_SizeUp (void);
void SCR_SizeDown (void);
void SCR_CenterPrint (char *str);
void SCR_BeginLoadingPlaque (void);
void SCR_EndLoadingPlaque (void);
void SCR_TouchPics (void);
void SCR_RunConsole (void);
extern cvar_t *crosshair;
extern cvar_t *scr_loading;
extern vrect_t scr_vrect; // position of render window
extern int sb_lines;
extern cvar_t *crosshair;
extern vrect_t scr_vrect; // position of render window
extern char crosshair_pic[MAX_QPATH];
extern int crosshair_width, crosshair_height;
void SCR_AddDirtyPoint (int x, int y);
void SCR_DirtyScreen (void);
void SCR_AdjustSize( float *x, float *y, float *w, float *h );
void SCR_DrawPic( float x, float y, float width, float height, char *picname );
void SCR_FillRect( float x, float y, float width, float height, const float *color );
@ -102,7 +92,9 @@ void SCR_DrawBigStringColor( int x, int y, const char *s, vec4_t color );
void CG_SetSky_f( void );
void CG_DrawCenterString( void );
void CG_CenterPrint( const char *str, int y, int charWidth );
float *CG_FadeColor( float starttime, float endtime );
void CG_DrawCenterPic( int w, int h, char *picname );
void CG_StringToVector( float *vec, const char *string );
void CG_ExecuteProgram( char *section );
void CG_MakeLevelShot( void );
void CG_DrawLoading( void );

View File

@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// common.h -- definitions common between client and server, but not game.dll
#define VERSION "Xash 0.48"
#define BASEDIRNAME "xash"
@ -346,7 +346,7 @@ The game starts with a Cbuf_AddText ("exec quake.rc\n"); Cbuf_Execute ();
#define EXEC_INSERT 1 // insert at current position, but don't run yet
#define EXEC_APPEND 2 // add to end of the command buffer
void Cbuf_Init (void);
void Cbuf_Init( int argc, char **argv );
void Cbuf_AddText (const char *text);
void Cbuf_InsertText (const char *text);
void Cbuf_ExecuteText (int exec_when, const char *text);
@ -364,6 +364,10 @@ typedef void (*xcommand_t) (void);
void Cmd_Init( int argc, char **argv );
#define Cmd_AddCommand(name, func) _Cmd_AddCommand(name, func, "no description" )
void _Cmd_AddCommand(const char *cmd_name, xcommand_t function, const char *cmd_desc);
#define Cmd_GetParmFromCmdLine(parm, out) _Cmd_GetParmFromCmdLine( parm, out, sizeof(out))
bool _Cmd_GetParmFromCmdLine( char *parm, char *out, size_t outsize );
int Cmd_CheckParm (const char *parm);
// called by the init functions of other parts of the program to
// register commands and functions to call for them.
// The cmd_name is referenced later, so it should not be in temp memory

View File

@ -53,11 +53,13 @@ int fs_argc;
Cbuf_Init
============
*/
void Cbuf_Init (void)
void Cbuf_Init (int argc, char **argv )
{
cmd_text.data = cmd_text_buf;
cmd_text.maxsize = MAX_CMD_BUFFER;
cmd_text.cursize = 0;
fs_argc = argc;
fs_argv = argv;
}
/*
@ -623,6 +625,40 @@ void Cmd_List_f (void)
Msg("%i commands\n", i);
}
/*
================
CMD_CheckParm
Returns the position (1 to argc-1) in the program's argument list
where the given parameter apears, or 0 if not present
================
*/
int Cmd_CheckParm (const char *parm)
{
int i;
for (i = 1; i < fs_argc; i++ )
{
// NEXTSTEP sometimes clears appkit vars.
if (!fs_argv[i]) continue;
if (!stricmp (parm, fs_argv[i])) return i;
}
return 0;
}
bool _Cmd_GetParmFromCmdLine( char *parm, char *out, size_t outsize )
{
int argc = Cmd_CheckParm( parm );
if(!argc) return false;
if(!out) return false;
if(!fs_argv[argc + 1]) return false;
strncpy( out, fs_argv[argc + 1], outsize );
return true;
}
/*
============
Cmd_Init
@ -630,7 +666,9 @@ Cmd_Init
*/
void Cmd_Init( int argc, char **argv )
{
Cbuf_Init();
char dev_level[4];
Cbuf_Init( argc, argv );
// register our commands
Cmd_AddCommand ("exec", Cmd_Exec_f);
@ -639,8 +677,9 @@ void Cmd_Init( int argc, char **argv )
Cmd_AddCommand ("cmdlist", Cmd_List_f);
Cmd_AddCommand ("stuffcmds", Cmd_StuffCmds_f );
// save pointers
fs_argc = argc;
fs_argv = argv;
// determine debug and developer mode
if (Cmd_CheckParm ("-debug")) host.debug = true;
if(Cmd_GetParmFromCmdLine("-dev", dev_level ))
host.developer = atoi(dev_level);
}

View File

@ -18,15 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// common.c -- misc functions used in client and server
#include <windows.h>
#include "engine.h"
#define MAXPRINTMSG 4096
int com_argc;
char *com_argv[MAX_NUM_ARGVS+1];
cvar_t *host_speeds;
cvar_t *host_frametime;
cvar_t *dedicated;
@ -70,100 +64,13 @@ void Com_SetServerState (int state)
{
server_state = state;
}
//============================================================================
/*
================
CheckParm
Returns the position (1 to argc-1) in the program's argument list
where the given parameter apears, or 0 if not present
================
*/
int CheckParm (const char *parm)
{
int i;
for (i = 1; i < com_argc; i++ )
{
// NEXTSTEP sometimes clears appkit vars.
if (!com_argv[i]) continue;
if (!strcmp (parm, com_argv[i])) return i;
}
return 0;
}
bool _GetParmFromCmdLine( char *parm, char *out, size_t size )
{
int argc = CheckParm( parm );
if(!argc) return false;
if(!out) return false;
strncpy( out, com_argv[argc+1], size );
return true;
}
int COM_Argc (void)
{
return com_argc;
}
char *COM_Argv (int arg)
{
if (arg < 0 || arg >= com_argc || !com_argv[arg])
return "";
return com_argv[arg];
}
void COM_ClearArgv (int arg)
{
if (arg < 0 || arg >= com_argc || !com_argv[arg])
return;
com_argv[arg] = "";
}
/*
================
COM_InitArgv
================
*/
void COM_InitArgv (int argc, char **argv)
{
int i;
char dev_level[4];
if (argc > MAX_NUM_ARGVS)
{
Msg ("COM_InitArgv: too many arguments in cmdline (max %d)\n", MAX_NUM_ARGVS);
argc = MAX_NUM_ARGVS;
}
com_argc = argc;
for (i = 0; i < argc; i++)
{
if (!argv[i] || strlen(argv[i]) >= MAX_TOKEN_CHARS )
com_argv[i] = "";
else com_argv[i] = argv[i];
}
// determine debug and developer mode
if (CheckParm ("-debug")) host.debug = true;
if(GetParmFromCmdLine("-dev", dev_level ))
host.developer = atoi(dev_level);
srand(time(NULL)); // init random generator
}
char *CopyString (const char *in)
{
char *out;
out = Z_Malloc (strlen(in)+1);
strcpy (out, in);
out = Z_Malloc( strlen(in) + 1);
strcpy(out, in);
return out;
}
@ -283,22 +190,6 @@ float crand(void)
return (rand()&32767)* (2.0/32767) - 1;
}
/*
===============
Com_PageInMemory
===============
*/
int paged_total;
void Com_PageInMemory (byte *buffer, int size)
{
int i;
for (i = size - 1; i > 0; i -= 4096)
paged_total += buffer[i];
}
/*
================
Com_Print
@ -310,7 +201,7 @@ If no console is visible, the text will appear at the top of the game window
*/
void Com_Print (char *txt)
{
if (host.rd.target)
if(host.rd.target)
{
if((strlen (txt) + strlen(host.rd.buffer)) > (host.rd.buffersize - 1))
{
@ -380,8 +271,11 @@ void Com_DPrintf (int level, char *fmt, ...)
case D_ERROR:
Com_Print(va("^1Error:^7 %s", msg));
break;
case D_SPAM:
Com_Print(msg);
case D_LOAD:
Com_Print(va("^2Loading: ^7%s", msg));
break;
case D_NOTE:
Con_Print( msg );
break;
}
}

View File

@ -1295,37 +1295,41 @@ END GAME MENU
=============================================================================
*/
static float credits_start_time;
static float credits_fade_time;
static float credits_show_time;
static const char **credits;
static char *creditsIndex[256];
static char *creditsIndex[1024];
static char *creditsBuffer;
static const char *idcredits[] =
static uint credit_numlines;
static const char *xash_credits[] =
{
"+QUAKE II BY ID SOFTWARE",
"^3QUAKE II BY ID SOFTWARE",
"",
"+PROGRAMMING",
"^3PROGRAMMING",
"John Carmack",
"John Cash",
"Brian Hook",
"",
"+ART",
"^3ART",
"Adrian Carmack",
"Kevin Cloud",
"Paul Steed",
"",
"+LEVEL DESIGN",
"^3LEVEL DESIGN",
"Tim Willits",
"American McGee",
"Christian Antkow",
"Paul Jaquays",
"Brandon James",
"",
"+BIZ",
"^3BIZ",
"Todd Hollenshead",
"Barrett (Bear) Alexander",
"Donna Jackson",
"",
"",
"+SPECIAL THANKS",
"^3SPECIAL THANKS",
"Ben Donges for beta testing",
"",
"",
@ -1333,9 +1337,9 @@ static const char *idcredits[] =
"",
"",
"",
"+ADDITIONAL SUPPORT",
"^3ADDITIONAL SUPPORT",
"",
"+CINEMATIC SEQUENCES",
"^3CINEMATIC SEQUENCES",
"Ending Cinematic by Blur Studio - ",
"Venice, CA",
"",
@ -1345,7 +1349,7 @@ static const char *idcredits[] =
"Assistance with environment design",
"by Cliff Iwai",
"",
"+SOUND EFFECTS AND MUSIC",
"^3SOUND EFFECTS AND MUSIC",
"Sound Design by Soundelux Media Labs.",
"Music Composed and Produced by",
"Soundelux Media Labs. Special thanks",
@ -1365,8 +1369,8 @@ static const char *idcredits[] =
"Voice of computers by",
"Carly Staehlin-Taylor",
"",
"+THANKS TO ACTIVISION",
"+IN PARTICULAR:",
"^3THANKS TO ACTIVISION",
"^3IN PARTICULAR:",
"",
"John Tam",
"Steve Rosenthal",
@ -1383,104 +1387,99 @@ static const char *idcredits[] =
"trademark of Activision, Inc. All",
"other trademarks and trade names are",
"properties of their respective owners.",
"",
"",
"",
"The End",
0
};
void M_Credits_MenuDraw( void )
{
int i, y;
int i, x, y;
float *color;
/*
** draw the credits
*/
for ( i = 0, y = viddef.height - (( cls.realtime - credits_start_time ) * 40.0F ); credits[i] && y < viddef.height; y += 10, i++ )
y = viddef.height - (( cls.realtime - credits_start_time ) * 40.0f );
// draw the credits
for ( i = 0; i < credit_numlines && credits[i]; i++, y += 20 )
{
int j, stringoffset = 0;
int bold = false;
// skip not visible lines, but always draw end line
if( y <= -16 && i != credit_numlines - 1) continue;
x = ( SCREEN_WIDTH - BIGCHAR_WIDTH * ColorStrlen( credits[i] ))/2;
if ( y <= -8 )
continue;
if ( credits[i][0] == '+' )
if((y < (viddef.height - BIGCHAR_HEIGHT) / 2) && i == credit_numlines - 1)
{
bold = true;
stringoffset = 1;
}
else
{
bold = false;
stringoffset = 0;
}
for ( j = 0; credits[i][j+stringoffset]; j++ )
{
int x;
x = ( viddef.width - strlen( credits[i] ) * 8 - stringoffset * 8 ) / 2 + ( j + stringoffset ) * 8;
if ( bold )
re->DrawChar( x, y, credits[i][j+stringoffset] + 128 );
else
re->DrawChar( x, y, credits[i][j+stringoffset] );
if(!credits_fade_time) credits_fade_time = cls.realtime;
color = CG_FadeColor( credits_fade_time, credits_show_time );
if(color) SCR_DrawBigStringColor( x, (viddef.height-BIGCHAR_HEIGHT)/2, credits[i], color);
}
else SCR_DrawBigString( x, y, credits[i], 1.0f );
}
if ( y < 0 ) credits_start_time = cls.realtime;
if( y < 0 && !color ) M_PopMenu(); // end of credits
}
const char *M_Credits_Key( int key )
{
switch (key)
switch( key )
{
case K_ESCAPE:
M_PopMenu ();
M_PopMenu();
break;
}
return menu_out_sound;
}
void M_Menu_Credits_f( void )
{
int n;
int count;
char *p;
int isdeveloper = 0;
char *p;
creditsBuffer = NULL;
creditsBuffer = FS_LoadFile ("credits", &count );
if (count != -1)
if(!creditsBuffer)
{
p = creditsBuffer;
for (n = 0; n < 255; n++)
// load credits if needed
creditsBuffer = FS_LoadFile( "scripts/credits.txt", &count );
if(count)
{
creditsIndex[n] = p;
while (*p != '\r' && *p != '\n')
if(creditsBuffer[count - 1] != '\n' && creditsBuffer[count - 1] != '\r')
{
p++;
if (--count == 0)
break;
}
if (*p == '\r')
{
*p++ = 0;
if (--count == 0)
break;
}
*p++ = 0;
if (--count == 0)
break;
}
creditsIndex[++n] = 0;
credits = creditsIndex;
}
else
{
credits = idcredits;
}
creditsBuffer = Mem_Realloc( zonepool, creditsBuffer, count + 2 );
strncpy( creditsBuffer + count, "\r", 1 ); // add terminator
count += 2;
}
p = creditsBuffer;
for (credit_numlines = 0; credit_numlines < 1024; credit_numlines++)
{
creditsIndex[credit_numlines] = p;
while (*p != '\r' && *p != '\n')
{
p++;
if (--count == 0) break;
}
if (*p == '\r')
{
*p++ = 0;
if (--count == 0) break;
}
*p++ = 0;
if (--count == 0) break;
}
creditsIndex[++credit_numlines] = 0;
credits = creditsIndex;
}
else
{
credits = xash_credits;
credit_numlines = 87;
}
}
// run credits
credits_start_time = cls.realtime;
credits_show_time = bound(0.1f, (float)strlen(credits[credit_numlines - 1]), 12.0f );
credits_fade_time = 0.0f;
M_PushMenu( M_Credits_MenuDraw, M_Credits_Key);
}

View File

@ -95,7 +95,6 @@ void Netchan_Init (void)
// pick a port value that should be nice and random
port = RANDOM_LONG(1, 65535);
Msg("netchan port %d\n", port );
showpackets = Cvar_Get ("showpackets", "0", 0);
showdrop = Cvar_Get ("showdrop", "0", 0);
qport = Cvar_Get ("qport", va("%i", port), CVAR_INIT);

View File

@ -83,7 +83,7 @@ static dllfunc_t winsock_funcs[] =
{ NULL, NULL }
};
dll_info_t winsock_dll = { "wsock32.dll", winsock_funcs, NULL, NULL, NULL, true, 0, 0 };
dll_info_t winsock_dll = { "wsock32.dll", winsock_funcs, NULL, NULL, NULL, true, 0 };
char *NET_ErrorString (void);
@ -808,7 +808,7 @@ void NET_Init (void)
r = pWSAStartup (MAKEWORD(1, 1), &winsockdata);
if(r) Sys_Error("Winsock initialization failed.");
Msg("Winsock Initialized\n");
MsgDev(D_NOTE, "NET_Init()\n");
noudp = Cvar_Get ("noudp", "0", CVAR_INIT);
noipx = Cvar_Get ("noipx", "0", CVAR_INIT);

View File

@ -367,7 +367,7 @@ void PRVM_FreeString(int num);
// helper macro to make function pointer calls easier
#define PRVM_GCALL(func) if(prog->func) prog->func
#define PRVM_ERROR prog->error_cmd
#define PRVM_ERROR if(prog) prog->error_cmd
// other prog handling functions
bool PRVM_SetProgFromString(const char *str);

View File

@ -114,8 +114,7 @@ void VM_error (void)
ed = PRVM_G_EDICT(prog->pev->ofs);
PRVM_ED_Print(ed);
}
PRVM_ERROR ("%s: Program error in function %s:\n%s\nTip: read above for entity information\n", PRVM_NAME, PRVM_GetString(prog->xfunction->s_name), string);
Host_Error("%s: Program error in function %s:\n%s\nTip: read above for entity information\n", PRVM_NAME, PRVM_GetString(prog->xfunction->s_name), string);
}
/*

View File

@ -1062,7 +1062,7 @@ const char *PRVM_ED_ParseEdict (const char *data, edict_t *ent)
PRVM_ERROR ("PRVM_ED_ParseEdict: EOF without closing brace");
newline = (COM_Token[0] == '}') ? true : false;
if(!newline) MsgDev(D_SPAM, "Key: \"%s\"", COM_Token);
if(!newline) MsgDev(D_NOTE, "Key: \"%s\"", COM_Token);
else break;
// anglehack is to allow QuakeEd to write single scalar angles
@ -1087,7 +1087,7 @@ const char *PRVM_ED_ParseEdict (const char *data, edict_t *ent)
// parse value
if (!COM_Parse(&data))
PRVM_ERROR ("PRVM_ED_ParseEdict: EOF without closing brace");
MsgDev(D_SPAM, " \"%s\"\n", COM_Token);
MsgDev(D_NOTE, " \"%s\"\n", COM_Token);
if (COM_Token[0] == '}')
PRVM_ERROR ("PRVM_ED_ParseEdict: closing brace without data");
@ -1342,7 +1342,7 @@ void PRVM_LoadProgs (const char *filename, int numedfunc, char **ed_func, int nu
PRVM_ERROR ("%s: %s system vars have been modified, progdefs.h is out of date", PRVM_NAME, filename);
break;
}
Msg("Loading %s [CRC %d]\n", filename, prog->progs->crc );
MsgDev(D_INFO, "Loading %s [CRC %d]\n", filename, prog->progs->crc );
// set initial pointers
prog->statements = (dstatement_t *)((byte *)prog->progs + prog->progs->ofs_statements);
@ -1371,7 +1371,7 @@ void PRVM_LoadProgs (const char *filename, int numedfunc, char **ed_func, int nu
}
complen = LittleLong(*(int*)prog->statements);
Msg("Unpacked statements: len %d, comp len %d\n", len, complen );
MsgDev(D_NOTE, "Unpacked statements: len %d, comp len %d\n", len, complen );
s = Mem_Alloc(prog->progs_mempool, len ); // alloc memory for inflate block
Com->Compile.DecryptDAT(complen, len, 2, (char *)(((int *)prog->statements)+1), &s);
prog->statements = (dstatement16_t *)s;
@ -1392,7 +1392,7 @@ void PRVM_LoadProgs (const char *filename, int numedfunc, char **ed_func, int nu
}
complen = LittleLong(*(int*)prog->globaldefs);
Msg("Unpacked defs: len %d, comp len %d\n", len, complen);
MsgDev(D_NOTE, "Unpacked defs: len %d, comp len %d\n", len, complen);
s = Mem_Alloc(prog->progs_mempool, len ); // alloc memory for inflate block
Com->Compile.DecryptDAT(complen, len, 2, (char *)(((int *)prog->globaldefs)+1), &s);
prog->globaldefs = (ddef16_t *)s;
@ -1413,7 +1413,7 @@ void PRVM_LoadProgs (const char *filename, int numedfunc, char **ed_func, int nu
}
complen = LittleLong(*(int*)infielddefs);
Msg("Unpacked fields: len %d, comp len %d\n", len, complen );
MsgDev(D_NOTE, "Unpacked fields: len %d, comp len %d\n", len, complen );
s = Mem_Alloc(prog->progs_mempool, len ); // alloc memory for inflate block
Com->Compile.DecryptDAT(complen, len, 2, (char *)(((int *)infielddefs)+1), &s);
infielddefs = (ddef16_t *)s;
@ -1425,7 +1425,7 @@ void PRVM_LoadProgs (const char *filename, int numedfunc, char **ed_func, int nu
len = sizeof(dfunction_t) * prog->progs->numfunctions;
complen = LittleLong(*(int*)dfunctions);
Msg("Unpacked functions: len %d, comp len %d\n", len, complen );
MsgDev(D_NOTE, "Unpacked functions: len %d, comp len %d\n", len, complen );
s = Mem_Alloc(prog->progs_mempool, len ); // alloc memory for inflate block
Com->Compile.DecryptDAT(complen, len, 2, (char *)(((int *)dfunctions)+1), &s);
dfunctions = (dfunction_t *)s;
@ -1437,7 +1437,7 @@ void PRVM_LoadProgs (const char *filename, int numedfunc, char **ed_func, int nu
len = sizeof(char) * prog->progs->numstrings;
complen = LittleLong(*(int*)prog->strings);
Msg("Unpacked strings: count %d, len %d, comp len %d\n", prog->progs->numstrings, len, complen );
MsgDev(D_NOTE, "Unpacked strings: count %d, len %d, comp len %d\n", prog->progs->numstrings, len, complen );
s = Mem_Alloc(prog->progs_mempool, len ); // alloc memory for inflate block
Com->Compile.DecryptDAT(complen, len, 2, (char *)(((int *)prog->strings)+1), &s);
prog->strings = (char *)s;
@ -1451,7 +1451,7 @@ void PRVM_LoadProgs (const char *filename, int numedfunc, char **ed_func, int nu
len = sizeof(float) * prog->progs->numglobals;
complen = LittleLong(*(int*)prog->globals.gp);
Msg("Unpacked globals: len %d, comp len %d\n", len, complen );
MsgDev(D_NOTE, "Unpacked globals: len %d, comp len %d\n", len, complen );
s = Mem_Alloc(prog->progs_mempool, len ); // alloc memory for inflate block
Com->Compile.DecryptDAT(complen, len, 2, (char *)(((int *)prog->globals.gp)+1), &s);
prog->globals.gp = (float *)s;
@ -1463,7 +1463,7 @@ void PRVM_LoadProgs (const char *filename, int numedfunc, char **ed_func, int nu
len = sizeof(int) * prog->progs->numstatements;
complen = LittleLong(*(int*)prog->linenums);
Msg("Unpacked linenums: len %d, comp len %d\n", len, complen );
MsgDev(D_NOTE, "Unpacked linenums: len %d, comp len %d\n", len, complen );
s = Mem_Alloc(prog->progs_mempool, len ); // alloc memory for inflate block
Com->Compile.DecryptDAT(complen, len, 2, (char *)(((int *)prog->linenums)+1), &s);
prog->linenums = (int *)s;
@ -1475,7 +1475,7 @@ void PRVM_LoadProgs (const char *filename, int numedfunc, char **ed_func, int nu
len = sizeof(type_t) * prog->progs->numtypes;
complen = LittleLong(*(int*)prog->types);
Msg("Unpacked types: len %d, comp len %d\n", len, complen );
MsgDev(D_NOTE, "Unpacked types: len %d, comp len %d\n", len, complen );
s = Mem_Alloc(prog->progs_mempool, len ); // alloc memory for inflate block
Com->Compile.DecryptDAT( complen, len, 2, (char *)(((int *)prog->types)+1), &s);
prog->types = (type_t *)s;
@ -1653,7 +1653,7 @@ void PRVM_LoadProgs (const char *filename, int numedfunc, char **ed_func, int nu
PRVM_ERROR("PRVM_LoadProgs: out of bounds global index (statement %d) in %s", i, PRVM_NAME);
break;
default:
MsgDev(D_WARN, "PRVM_LoadProgs: unknown opcode %d at statement %d in %s\n", st->op, i, PRVM_NAME);
MsgDev(D_NOTE, "PRVM_LoadProgs: unknown opcode %d at statement %d in %s\n", st->op, i, PRVM_NAME);
break;
}
}
@ -2029,7 +2029,7 @@ int PRVM_SetEngineString(const char *s)
if (prog->knownstrings[i] == s)
return -1 - i;
// new unknown engine string
MsgDev(D_SPAM, "new engine string %p\n", s );
MsgDev(D_NOTE, "new engine string %p\n", s );
for (i = prog->firstfreeknownstring;i < prog->numknownstrings;i++)
if (!prog->knownstrings[i])
break;

View File

@ -155,8 +155,6 @@ void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point,
void Com_PageInMemory (byte *buffer, int size);
//=============================================
//
@ -566,17 +564,17 @@ typedef enum
// Each config string can be at most MAX_QPATH characters.
//
#define CS_NAME 0
#define CS_CDTRACK 1
#define CS_SKY 2
#define CS_SKYAXIS 3 // %f %f %f format
#define CS_SKYROTATE 4
#define CS_STATUSBAR 5 // display program string (1536 chars)
#define CS_STATUSBAR_SIZE (CS_AIRACCEL - CS_STATUSBAR) * MAX_QPATH
#define CS_AIRACCEL 29 // air acceleration control
#define CS_MAXCLIENTS 30
#define CS_MAPCHECKSUM 31 // for catching cheater maps
#define CS_SKY 1
#define CS_SKYAXIS 2 // %f %f %f format
#define CS_SKYROTATE 3
#define CS_STATUSBAR 4 // hud_program section name
#define CS_AIRACCEL 5 // air acceleration control
#define CS_MAXCLIENTS 6
#define CS_MAPCHECKSUM 7 // for catching cheater maps
#define CS_MODELS 32
// reserved config strings
#define CS_MODELS 16
#define CS_SOUNDS (CS_MODELS+MAX_MODELS)
#define CS_IMAGES (CS_SOUNDS+MAX_SOUNDS)
#define CS_LIGHTS (CS_IMAGES+MAX_IMAGES)

View File

@ -99,6 +99,7 @@ memory manager
//malloc-free
#define Mem_Alloc(pool,size) Com->Mem.Alloc(pool, size, __FILE__, __LINE__)
#define Mem_Realloc(pool, mem, size) Com->Mem.Realloc(pool, mem, size, __FILE__, __LINE__)
#define Mem_Free(mem) Com->Mem.Free(mem, __FILE__, __LINE__)
//Hunk_AllocName

View File

@ -22,8 +22,8 @@ void Key_Init (void);
void SCR_EndLoadingPlaque (void);
HINSTANCE global_hInstance;
dll_info_t common_dll = { "common.dll", NULL, "CreateAPI", NULL, NULL, true, COMMON_API_VERSION, sizeof(common_exp_t) };
dll_info_t physic_dll = { "physic.dll", NULL, "CreateAPI", NULL, NULL, true, PHYSIC_API_VERSION, sizeof(physic_exp_t) };
dll_info_t common_dll = { "common.dll", NULL, "CreateAPI", NULL, NULL, true, sizeof(common_exp_t) };
dll_info_t physic_dll = { "physic.dll", NULL, "CreateAPI", NULL, NULL, true, sizeof(physic_exp_t) };
cvar_t *timescale;
cvar_t *fixedtime;
@ -140,9 +140,9 @@ void Host_Init (char *funcname, int argc, char **argv)
else if(!strcmp(funcname, "host_shared")) host.type = HOST_NORMAL;
else host.type = HOST_OFFLINE; // launcher can loading engine for some reasons
COM_InitArgv (argc, argv); // init host.debug & host.developer here
Host_InitCommon( funcname, argc, argv );
srand(time(NULL)); // init random generator
Host_InitCommon( funcname, argc, argv ); // loading common.dll
Cmd_Init( argc, argv );
Cvar_Init();
Key_Init();
@ -163,7 +163,7 @@ void Host_Init (char *funcname, int argc, char **argv)
if(host.type == HOST_DEDICATED) dedicated = Cvar_Get ("dedicated", "1", CVAR_INIT);
else dedicated = Cvar_Get ("dedicated", "0", CVAR_INIT);
s = va("%4.2f %s %s %s", VERSION, "x86", __DATE__, BUILDSTRING);
s = va("Xash %g (%s)", XASH_VERSION, BUILDSTRING);
Cvar_Get ("version", s, CVAR_SERVERINFO|CVAR_INIT);
if (dedicated->value) Cmd_AddCommand ("quit", Sys_Quit);
@ -171,7 +171,7 @@ void Host_Init (char *funcname, int argc, char **argv)
NET_Init();
Netchan_Init();
Host_InitPhysic();
SV_Init();
CL_Init();

View File

@ -157,8 +157,7 @@ void SV_SpawnServer (char *server, char *spawnpoint, char *savename, sv_state_t
if (attractloop) Cvar_Set ("paused", "0");
Msg("------- Server Initialization -------\n");
MsgDev (D_INFO, "SpawnServer: %s\n", server);
Msg("SpawnServer [%s]\n", server );
if (sv.demofile) FS_Close (sv.demofile);
svs.spawncount++; // any partially connected client will be restarted
@ -200,8 +199,8 @@ void SV_SpawnServer (char *server, char *spawnpoint, char *savename, sv_state_t
sv.time = 1.0f;
strcpy (sv.name, server);
strcpy (sv.configstrings[CS_NAME], server);
strcpy(sv.name, server);
FS_FileBase(server, sv.configstrings[CS_NAME]);
if (serverstate != ss_game)
{
@ -209,7 +208,7 @@ void SV_SpawnServer (char *server, char *spawnpoint, char *savename, sv_state_t
}
else
{
sprintf (sv.configstrings[CS_MODELS+1], "maps/%s.bsp", server);
sprintf (sv.configstrings[CS_MODELS+1], "maps/%s", server);
sv.models[1] = CM_LoadMap (sv.configstrings[CS_MODELS+1], false, &checksum);
}
sprintf (sv.configstrings[CS_MAPCHECKSUM],"%i", checksum);
@ -252,7 +251,6 @@ void SV_SpawnServer (char *server, char *spawnpoint, char *savename, sv_state_t
// set serverinfo variable
Cvar_FullSet ("mapname", sv.name, CVAR_SERVERINFO | CVAR_INIT);
Msg ("-------------------------------------\n");
SV_VM_End();
}
@ -384,10 +382,6 @@ void SV_Map (bool attractloop, char *levelstring, char *savename, bool loadgame)
}
else Cvar_Set ("nextserver", "");
//ZOID special hack for end game screen in coop mode
if (Cvar_VariableValue ("coop") && !strcasecmp(level, "victory.pcx"))
Cvar_Set ("nextserver", "gamemap \"*base1\"");
// if there is a $, use the remainder as a spawnpoint
ch = strstr(level, "$");
if (ch)
@ -416,8 +410,9 @@ void SV_Map (bool attractloop, char *levelstring, char *savename, bool loadgame)
else
{
SCR_BeginLoadingPlaque (); // for local system
FS_DefaultExtension( level, ".bsp" );
SV_BroadcastCommand ("changing\n");
SV_SendClientMessages ();
SV_SendClientMessages();
SV_SpawnServer (level, spawnpoint, savename, ss_game, attractloop, loadgame);
}
SV_BroadcastCommand ("reconnect\n");
@ -544,7 +539,7 @@ void SV_VM_Begin(void)
PRVM_Begin;
PRVM_SetProg( PRVM_SERVERPROG );
*prog->time = sv.time;
if(prog) *prog->time = sv.time;
}
void SV_VM_End(void)

View File

@ -172,7 +172,7 @@ Responds with all the info that qplug or qspy can see
*/
void SVC_Status (void)
{
Netchan_OutOfBandPrint (NS_SERVER, net_from, "print\n%s", SV_StatusString());
Netchan_OutOfBandPrint(NS_SERVER, net_from, "print\n%s", SV_StatusString());
}
/*
@ -217,7 +217,7 @@ void SVC_Info (void)
sprintf (string, "%16s %8s %2i/%2i\n", hostname->string, sv.name, count, (int)maxclients->value);
}
Netchan_OutOfBandPrint (NS_SERVER, net_from, "info\n%s", string);
Netchan_OutOfBandPrint(NS_SERVER, net_from, "info\n%s", string);
}
/*
@ -305,7 +305,7 @@ void SVC_DirectConnect( void )
version = atoi(Cmd_Argv(1));
if (version != PROTOCOL_VERSION)
{
Netchan_OutOfBandPrint (NS_SERVER, adr, "print\nServer is version %4.2f.\n", VERSION);
Netchan_OutOfBandPrint (NS_SERVER, adr, "print\nServer is version %4.2f.\n", XASH_VERSION);
MsgWarn ("SVC_DirectConnect: rejected connect from version %i\n", version);
return;
}
@ -1044,7 +1044,7 @@ void SV_Shutdown (char *finalmsg, bool reconnect)
// already freed
if(host.state == HOST_ERROR) return;
Msg("SV_Shutdown: %s\n", finalmsg );
MsgDev(D_NOTE, "SV_Shutdown: %s\n", finalmsg );
if (svs.clients) SV_FinalMessage (finalmsg, reconnect);
Master_Shutdown ();

View File

@ -86,7 +86,7 @@ void SV_SpawnEntities (char *mapname, char *entities, char *spawnpoint)
edict_t *ent;
int i;
Msg("====== SpawnEntities ========\n");
MsgDev(D_NOTE, "SV_SpawnEntities()\n");
// used by PushMove to move back pushed entities
sv.moved_edicts = (edict_t **)PRVM_Alloc(prog->max_edicts * sizeof(edict_t *));
@ -317,7 +317,7 @@ void SV_CalcViewOffset (edict_t *ent)
void SV_SetStats (edict_t *ent)
{
ent->priv.sv->client->ps.stats[STAT_HEALTH_ICON] = SV_ImageIndex("i_health");
ent->priv.sv->client->ps.stats[STAT_HEALTH_ICON] = SV_ImageIndex("hud/i_health");
ent->priv.sv->client->ps.stats[STAT_HEALTH] = ent->progs.sv->health;
}
@ -462,7 +462,7 @@ bool SV_ClientConnect (edict_t *ent, char *userinfo)
ent->progs.sv->flags = 0; // make sure we start with known default
ent->progs.sv->health = 100;
Msg("SV_ClientConnect()\n");
MsgDev(D_NOTE, "SV_ClientConnect()\n");
prog->globals.sv->time = sv.time;
prog->globals.sv->pev = PRVM_EDICT_TO_PROG(ent);
PRVM_ExecuteProgram (prog->globals.sv->ClientConnect, "QC function ClientConnect is missing");
@ -641,8 +641,6 @@ void SV_ClientDisconnect (edict_t *ent)
if (!ent->priv.sv->client) return;
Msg("player disconnected\n");
// send effect
MSG_Begin( svc_muzzleflash );
MSG_WriteShort( &sv.multicast, PRVM_NUM_FOR_EDICT(ent));

View File

@ -1454,13 +1454,12 @@ it is changing to a different game directory.
*/
void SV_ShutdownGameProgs (void)
{
int i;
edict_t *ent;
int i;
Msg("==== ShutdownGame ====\n");
SV_VM_Begin();
for (i = 1; i < prog->num_edicts; i++)
for (i = 1; prog && i < prog->num_edicts; i++)
{
ent = PRVM_EDICT_NUM(i);
SV_FreeEdict( ent );// release physic
@ -1483,6 +1482,6 @@ Init the game subsystem for a new map
*/
void SV_InitGameProgs (void)
{
Msg("==== InitGame ====\n");
Msg("\n");
SV_VM_Setup();
}

View File

@ -99,9 +99,6 @@ S_Init
void S_Init( void )
{
cvar_t *cv;
bool r;
Msg("\n------- sound initialization -------\n");
s_volume = Cvar_Get ("s_volume", "0.8", CVAR_ARCHIVE);
s_musicVolume = Cvar_Get ("s_musicvolume", "0.25", CVAR_ARCHIVE);
@ -114,12 +111,7 @@ void S_Init( void )
s_testsound = Cvar_Get ("s_testsound", "0", CVAR_CHEAT);
cv = Cvar_Get ("s_initsound", "1", 0);
if ( !cv->value )
{
Msg ("not initializing.\n");
Msg("------------------------------------\n");
return;
}
if ( !cv->value ) return;
Cmd_AddCommand("play", S_Play_f);
Cmd_AddCommand("music", S_Music_f);
@ -127,10 +119,7 @@ void S_Init( void )
Cmd_AddCommand("s_info", S_SoundInfo_f);
Cmd_AddCommand("s_stop", S_StopAllSounds);
r = SNDDMA_Init();
Msg("------------------------------------\n");
if ( r )
if (SNDDMA_Init())
{
s_soundStarted = 1;
s_soundMuted = 1;
@ -138,7 +127,6 @@ void S_Init( void )
s_soundtime = 0;
s_paintedtime = 0;
S_StopAllSounds ();
S_SoundInfo_f();
}
}
@ -372,7 +360,7 @@ sound_t S_RegisterSound( const char *name )
{
if( sfx->defaultSound )
{
MsgWarn("S_RegisterSound: could not find %s\n", sfx->soundName );
MsgDev(D_WARN, "couldn't load %s\n", sfx->soundName );
return 0;
}
return sfx - s_knownSfx;
@ -383,7 +371,7 @@ sound_t S_RegisterSound( const char *name )
if ( sfx->defaultSound )
{
MsgWarn("S_RegisterSound: could not find %s\n", sfx->soundName );
MsgDev(D_WARN, "couldn't load %s\n", sfx->soundName );
return 0;
}
return sfx - s_knownSfx;

View File

@ -69,8 +69,6 @@ void SND_setup( void )
while (--q > p) *(sndBuffer **)q = q-1;
*(sndBuffer **)q = NULL;
freelist = p + scs - 1;
Msg("Sound memory manager started\n");
}
/*

View File

@ -32,7 +32,7 @@ static dllfunc_t dsound_funcs[] =
{"DirectSoundCreate", (void **) &pDirectSoundCreate },
{ NULL, NULL }
};
dll_info_t dsound_dll = { "dsound.dll", dsound_funcs, NULL, NULL, NULL, false, 0, 0 };
dll_info_t dsound_dll = { "dsound.dll", dsound_funcs, NULL, NULL, NULL, false, 0 };
#define SECONDARY_BUFFER_SIZE 0x10000
extern HWND cl_hwnd;
@ -120,7 +120,7 @@ int SNDDMA_InitDS( void )
WAVEFORMATEX format;
int use8 = 1;
Msg("Initializing DirectSound - ");
MsgDev(D_INFO, "Initializing DirectSound - ");
// Create IDirectSound using the primary sound device
if(FAILED( hresult = CoCreateInstance(&CLSID_DirectSound8, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectSound8, (void **)&pDS)))
@ -128,14 +128,14 @@ int SNDDMA_InitDS( void )
use8 = 0;
if( FAILED( hresult = CoCreateInstance(&CLSID_DirectSound, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectSound, (void **)&pDS)))
{
Msg("failed\n");
MsgDev(D_INFO, "failed\n");
SNDDMA_Shutdown();
return false;
}
}
hresult = pDS->lpVtbl->Initialize( pDS, NULL);
Msg( "ok\n" );
MsgDev(D_INFO, "ok\n" );
MsgDev(D_INFO, "...setting DSSCL_PRIORITY coop level: " );
if(DS_OK != pDS->lpVtbl->SetCooperativeLevel( pDS, cl_hwnd, DSSCL_PRIORITY ))

View File

@ -119,7 +119,6 @@ launch_exp_t DLLEXPORT *CreateAPI( stdlib_api_t *input )
// and always make exception, run simply check for avoid it
if(input) std = *input;
Host.apiversion = LAUNCH_API_VERSION;
Host.api_size = sizeof(launch_exp_t);
Host.Init = Host_Init;

View File

@ -46,7 +46,7 @@ cvar_t *vid_fullscreen;
// Global variables used internally by this module
viddef_t viddef; // global video state; used by other modules
dll_info_t render_dll = { "render.dll", NULL, "CreateAPI", NULL, NULL, true, RENDER_API_VERSION, sizeof(render_exp_t) };
dll_info_t render_dll = { "render.dll", NULL, "CreateAPI", NULL, NULL, true, sizeof(render_exp_t) };
bool reflib_active = 0;
HWND cl_hwnd; // Main window handle for life of program
@ -504,7 +504,7 @@ void VID_InitRender( void )
CreateRender = (void *)render_dll.main;
re = CreateRender( &ri );
if(!re->Init( global_hInstance, MainWndProc ))
Sys_Error("VID_InitRender: can't init render.dll\nUpdate your opengl drivers\n");
@ -570,7 +570,7 @@ void VID_Init (void)
/* Add some console commands that we want to handle */
Cmd_AddCommand ("vid_restart", VID_Restart_f);
Cmd_AddCommand ("vid_front", VID_Front_f);
// Start the graphics mode and load refresh DLL
VID_CheckChanges();
}

View File

@ -49,7 +49,7 @@ typedef struct
} WinConData;
static WinConData s_wcd;
extern char caption[64];
extern char caption[MAX_QPATH];
// gdi32 export table
static HDC (_stdcall *pGetDC)(HWND);
@ -74,7 +74,7 @@ static dllfunc_t gdi32_funcs[] =
{ NULL, NULL }
};
dll_info_t gdi32_dll = { /*"gdi32.dll"*/NULL, gdi32_funcs, NULL, NULL, NULL, true, 0, 0 }; // FIXME
dll_info_t gdi32_dll = { /*"gdi32.dll"*/NULL, gdi32_funcs, NULL, NULL, NULL, true, 0 }; // FIXME
void Sys_InitLog( void )
{
@ -246,13 +246,14 @@ Sys_PrintW
print into window console
================
*/
void Sys_PrintW(const char *pMsg)
void Sys_Print(const char *pMsg)
{
char buffer[MAX_INPUTLINE*2];
static dword s_totalChars;
char *b = buffer;
const char *msg;
int bufLen, i = 0;
const char *msg;
char buffer[MAX_INPUTLINE * 2];
char logbuf[MAX_INPUTLINE * 2];
char *b = buffer;
char *c = logbuf;
int i = 0;
// if the message is REALLY long, use just the last portion of it
if ( strlen( pMsg ) > MAX_INPUTLINE - 1 )
@ -260,73 +261,81 @@ void Sys_PrintW(const char *pMsg)
else msg = pMsg;
// copy into an intermediate buffer
while ( msg[i] && ( ( b - buffer ) < sizeof( buffer ) - 1 ) )
while ( msg[i] && (( b - buffer ) < sizeof( buffer ) - 1 ))
{
if ( msg[i] == '\n' && msg[i+1] == '\r' )
if( msg[i] == '\n' && msg[i+1] == '\r' )
{
b[0] = '\r';
b[1] = '\n';
b += 2;
b[1] = c[0] = '\n';
b += 2, c++;
i++;
}
else if ( msg[i] == '\r' )
else if( msg[i] == '\r' )
{
b[0] = c[0] = '\r';
b[1] = '\n';
b += 2, c++;
}
else if( msg[i] == '\n' )
{
b[0] = '\r';
b[1] = '\n';
b += 2;
b[1] = c[0] = '\n';
b += 2, c++;
}
else if ( msg[i] == '\n' )
else if( msg[i] == '\35' || msg[i] == '\36' || msg[i] == '\37' )
{
b[0] = '\r';
b[1] = '\n';
b += 2;
}
else if ( IsColorString( &msg[i] ))
{
i++; //skip color suffix
i++; // skip console pseudo graph
}
else if(IsColorString( &msg[i])) i++; // skip color prefix
else
{
*b= msg[i];
b++;
*b = *c = msg[i];
b++, c++;
}
i++;
}
*b = 0;
bufLen = b - buffer;
s_totalChars += bufLen;
*b = *c = 0; // cutoff garbage
// replace selection instead of appending if we're overflowing
if ( s_totalChars > 0x7fff )
{
SendMessage( s_wcd.hwndBuffer, EM_SETSEL, 0, -1 );
s_totalChars = bufLen;
}
Sys_PrintLog( msg );
// put this text into the windows console
SendMessage( s_wcd.hwndBuffer, EM_LINESCROLL, 0, 0xffff );
SendMessage( s_wcd.hwndBuffer, EM_SCROLLCARET, 0, 0 );
SendMessage( s_wcd.hwndBuffer, EM_REPLACESEL, 0, (LPARAM) buffer );
Sys_PrintLog( logbuf );
Msg_Print( buffer );
}
/*
================
Sys_PrintA
Msg_PrintA
print into cmd32 console
================
*/
void Sys_PrintA(const char *pMsg)
void Msg_PrintA(const char *pMsg)
{
DWORD cbWritten;
Sys_PrintLog( pMsg );
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), pMsg, strlen(pMsg), &cbWritten, 0 );
//write(1, pMsg, strlen(pMsg));
}
/*
================
Msg_PrintW
print into window console
================
*/
void Msg_PrintW(const char *pMsg)
{
// replace selection instead of appending if we're overflowing
if( strlen(pMsg) > 0x7fff )
{
SendMessage( s_wcd.hwndBuffer, EM_SETSEL, 0, -1 );
}
// put this text into the windows console
SendMessage( s_wcd.hwndBuffer, EM_LINESCROLL, 0, 0xffff );
SendMessage( s_wcd.hwndBuffer, EM_SCROLLCARET, 0, 0 );
SendMessage( s_wcd.hwndBuffer, EM_REPLACESEL, 0, (LPARAM)pMsg );
}
/*
================
Sys_Msg
@ -348,30 +357,28 @@ void Sys_MsgW( const char *pMsg, ... )
void Sys_MsgDevW( int level, const char *pMsg, ... )
{
va_list argptr;
char text[MAX_INPUTLINE];
va_list argptr;
char text[MAX_INPUTLINE];
if(dev_mode >= level)
{
va_start (argptr, pMsg);
vsprintf (text, pMsg, argptr);
va_end (argptr);
Sys_Print( text );
}
if(dev_mode < level) return;
va_start (argptr, pMsg);
vsprintf (text, pMsg, argptr);
va_end (argptr);
Sys_Print( text );
}
void Sys_MsgWarnW( const char *pMsg, ... )
{
va_list argptr;
char text[MAX_INPUTLINE];
va_list argptr;
char text[MAX_INPUTLINE];
if(debug_mode)
{
va_start (argptr, pMsg);
vsprintf (text, pMsg, argptr);
va_end (argptr);
Sys_Print( text );
}
if(!debug_mode) return;
va_start (argptr, pMsg);
vsprintf (text, pMsg, argptr);
va_end (argptr);
Sys_Print( text );
}
/*
@ -390,12 +397,12 @@ void Sys_CreateConsoleW( void )
int swidth, sheight, fontsize;
int DEDSTYLE = WS_POPUPWINDOW | WS_CAPTION;
int CONSTYLE = WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_BORDER | WS_EX_CLIENTEDGE | ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY;
char Title[32], FontName[32];
char Title[MAX_QPATH], FontName[MAX_QPATH];
memset( &wc, 0, sizeof( wc ) );
wc.style = 0;
wc.lpfnWndProc = (WNDPROC) ConWndProc;
wc.lpfnWndProc = (WNDPROC)ConWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = base_hInstance;
@ -415,7 +422,7 @@ void Sys_CreateConsoleW( void )
rect.right = 536;
rect.top = 0;
rect.bottom = 280;
strcpy(FontName, "Arial" );
strncpy(FontName, "Arial", MAX_QPATH );
fontsize = 16;
}
else if(console_read_only)
@ -424,7 +431,7 @@ void Sys_CreateConsoleW( void )
rect.right = 536;
rect.top = 0;
rect.bottom = 364;
strcpy(FontName, "Fixedsys" );
strncpy(FontName, "Fixedsys", MAX_QPATH );
fontsize = 8;
}
else // dedicated console
@ -433,11 +440,11 @@ void Sys_CreateConsoleW( void )
rect.right = 540;
rect.top = 0;
rect.bottom = 392;
strcpy(FontName, "Courier" );
fontsize = 8;
strncpy(FontName, "System", MAX_QPATH );
fontsize = 14;
}
strcpy(Title, caption );
strncpy( Title, caption, MAX_QPATH );
AdjustWindowRect( &rect, DEDSTYLE, FALSE );
hDC = GetDC( GetDesktopWindow() );

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -66,7 +66,7 @@ BOOL GetReg( void )
DWORD dwBufLen = 4096; // max env length
HKEY hKey;
long lRet;
bool result = FALSE;
BOOL result = FALSE;
if(advapi32_dll)
{

View File

@ -12,13 +12,13 @@ bool show_always = true;
bool about_mode = false;
bool silent_mode = false;
bool sys_error = false;
char caption[64];
char caption[MAX_QPATH];
const char *show_credits = "\n\n\n\n\tCopyright XashXT Group 2007 ©\n\t All Rights Reserved\n\n\t Visit www.xash.ru\n";
dll_info_t common_dll = { "common.dll", NULL, "CreateAPI", NULL, NULL, true, COMMON_API_VERSION, sizeof(common_exp_t) };
dll_info_t engine_dll = { "engine.dll", NULL, "CreateAPI", NULL, NULL, true, LAUNCH_API_VERSION, sizeof(launch_exp_t) };
dll_info_t editor_dll = { "editor.dll", NULL, "CreateAPI", NULL, NULL, true, LAUNCH_API_VERSION, sizeof(launch_exp_t) };
dll_info_t common_dll = { "common.dll", NULL, "CreateAPI", NULL, NULL, true, sizeof(common_exp_t) };
dll_info_t engine_dll = { "engine.dll", NULL, "CreateAPI", NULL, NULL, true, sizeof(launch_exp_t) };
dll_info_t editor_dll = { "editor.dll", NULL, "CreateAPI", NULL, NULL, true, sizeof(launch_exp_t) };
dll_info_t *linked_dll; // generic hinstance
//app name
@ -73,7 +73,7 @@ void LookupInstance( const char *funcname )
//memeber name
strncpy( progname, funcname, sizeof(progname));
//lookup all instances
// lookup all instances
if(!strcmp(progname, "host_shared"))
{
app_name = HOST_SHARED;
@ -82,7 +82,7 @@ void LookupInstance( const char *funcname )
if(!debug_mode) show_always = false;
linked_dll = &engine_dll; // pointer to engine.dll info
strcpy(log_path, "engine.log" ); // xash3d root directory
strcpy(caption, va("Xash3D ver.%g", CalcEngineVersion()));
strcpy(caption, va("Xash3D ver.%g", XASH_VERSION ));
}
else if(!strcmp(progname, "host_dedicated"))
{
@ -90,7 +90,7 @@ void LookupInstance( const char *funcname )
console_read_only = false;
linked_dll = &engine_dll; // pointer to engine.dll info
strcpy(log_path, "engine.log" ); // xash3d root directory
strcpy(caption, va("Xash3D Dedicated Server ver.%g", CalcEngineVersion()));
strcpy(caption, va("Xash3D Dedicated Server ver.%g", XASH_VERSION ));
}
else if(!strcmp(progname, "host_editor"))
{
@ -100,7 +100,7 @@ void LookupInstance( const char *funcname )
if(!debug_mode) show_always = false;
linked_dll = &editor_dll; // pointer to editor.dll info
strcpy(log_path, "editor.log" ); // xash3d root directory
strcpy(caption, va("Xash3D Editor ver.%g", CalcEditorVersion()));
strcpy(caption, va("Xash3D Editor ver.%g", XASH_VERSION ));
}
else if(!strcmp(progname, "bsplib"))
{
@ -354,7 +354,7 @@ void CreateInstance( void )
launch_t CreateHost;
// first text message into console or log
MsgDev(D_INFO, "Sys_LoadLibrary: Loading launch.dll [%d] - ok\n", INIT32_API_VERSION );
MsgDev(D_INFO, "Sys_LoadLibrary: Loading launch.dll - ok\n" );
Sys_LoadLibrary( linked_dll ); // loading library if need
@ -431,7 +431,7 @@ void API_Reset( void )
Msg = NullVarArgs;
MsgDev = NullVarArgs2;
MsgWarn = NullVarArgs;
Sys_Print = NullVoidWithName;
Msg_Print = NullVoidWithName;
}
void API_SetConsole( void )
@ -441,7 +441,7 @@ void API_SetConsole( void )
if( hooked_out && app_name > HOST_EDITOR)
{
Sys_Print = Sys_PrintA;
Msg_Print = Msg_PrintA;
Sys_InitConsole = Sys_InitLog;
Sys_FreeConsole = Sys_CloseLog;
Sys_Error = Sys_ErrorA;
@ -451,9 +451,9 @@ void API_SetConsole( void )
Sys_InitConsole = Sys_CreateConsoleW;
Sys_FreeConsole = Sys_DestroyConsoleW;
Sys_ShowConsole = Sys_ShowConsoleW;
Sys_Print = Sys_PrintW;
Sys_Input = Sys_InputW;
Sys_Error = Sys_ErrorW;
Msg_Print = Msg_PrintW;
}
Msg = Sys_MsgW;

View File

@ -27,16 +27,17 @@ enum
// import variables
char *(*Sys_Input ) ( void );
void ( *Msg )( char *msg, ... );
void ( *Sys_Print )( const char *msg );
void ( *Sys_InitConsole )( void );
void ( *Sys_FreeConsole )( void );
void ( *MsgDev )( int level, char *msg, ... );
void ( *MsgWarn )( char *msg, ... );
void ( *Msg_Print )( const char *msg );
void ( *Sys_Error )( char *msg, ... );
void ( *Sys_ShowConsole )( bool show );
void Sys_Init( void ); // static
void Sys_Exit( void ); // static
void Sys_Sleep( int msec);
void Sys_Print( const char *pMsg );
bool Sys_LoadLibrary ( dll_info_t *dll ); // load library
bool Sys_FreeLibrary ( dll_info_t *dll ); // free library
void* Sys_GetProcAddress ( dll_info_t *dll, const char* name );
@ -74,14 +75,12 @@ void ParseCommandLine (LPSTR lpCmdLine);
void UpdateEnvironmentVariables( void );
bool _GetParmFromCmdLine( char *parm, char *out, size_t size );
#define GetParmFromCmdLine( parm, out ) _GetParmFromCmdLine( parm, out, sizeof(out))
float CalcEngineVersion( void );
float CalcEditorVersion( void );
//
// console.c
//
void Sys_PrintA(const char *pMsg);
void Sys_PrintW(const char *pMsg);
void Msg_PrintA(const char *pMsg);
void Msg_PrintW(const char *pMsg);
void Sys_MsgW( const char *pMsg, ... );
void Sys_MsgDevW( int level, const char *pMsg, ... );
void Sys_MsgWarnW( const char *pMsg, ... );

View File

@ -17,7 +17,6 @@ char *strupper(char *start)
return start;
}
#ifndef HAVE_STRLCAT
size_t strlcat(char *dst, const char *src, size_t siz)
{
register char *d = dst;
@ -44,10 +43,7 @@ size_t strlcat(char *dst, const char *src, size_t siz)
*d = '\0';
return(dlen + (s - src)); //count does not include NUL
}
#endif
#ifndef HAVE_STRLCPY
size_t strlcpy(char *dst, const char *src, size_t siz)
{
register char *d = dst;
@ -72,4 +68,91 @@ size_t strlcpy(char *dst, const char *src, size_t siz)
}
return(s - src - 1); //count does not include NUL
}
#endif
/*
====================
timestamp
====================
*/
const char* tstamp( int format )
{
static char timestamp [128];
time_t crt_time;
const struct tm *crt_tm;
char timestring [64];
time (&crt_time);
crt_tm = localtime (&crt_time);
switch( format )
{
case TIME_FULL:
// Build the full timestamp (ex: "Apr03 2007 [23:31.55]");
strftime(timestring, sizeof (timestring), "%b%d %Y [%H:%M.%S]", crt_tm);
break;
case TIME_DATE_ONLY:
// Build the date stamp only (ex: "Apr03 2007");
strftime(timestring, sizeof (timestring), "%b%d %Y", crt_tm);
break;
case TIME_TIME_ONLY:
// Build the time stamp only (ex: "[23:31.55]");
strftime(timestring, sizeof (timestring), "[%H:%M.%S]", crt_tm);
break;
case TIME_NO_SECONDS:
// Build the full timestamp (ex: "Apr03 2007 [23:31]");
strftime(timestring, sizeof (timestring), "%b%d %Y [%H:%M]", crt_tm);
break;
}
strcpy( timestamp, timestring );
return timestamp;
}
/*
============
va
does a varargs printf into a temp buffer, so I don't need to have
varargs versions of all text functions.
FIXME: make this buffer size safe someday
============
*/
char *_va(const char *format, ...)
{
va_list argptr;
static char string[8][1024], *s;
static int stringindex = 0;
s = string[stringindex];
stringindex = (stringindex + 1) & 7;
va_start (argptr, format);
vsprintf (s, format, argptr);
va_end (argptr);
return s;
}
int vslprintf(char *buffer, size_t buffersize, const char *format, va_list args)
{
int result;
result = _vsnprintf (buffer, buffersize, format, args);
if (result < 0 || (size_t)result >= buffersize)
{
buffer[buffersize - 1] = '\0';
return -1;
}
return result;
}
int slprintf(char *buffer, size_t buffersize, const char *format, ...)
{
va_list args;
int result;
va_start (args, format);
result = vslprintf (buffer, buffersize, format, args);
va_end (args);
return result;
}

View File

@ -24,16 +24,6 @@ void Sys_SendKeyEvents( void )
}
}
float CalcEngineVersion( void )
{
return LAUNCH_VERSION + COMMON_VERSION + RENDER_VERSION + PHYSIC_API_VERSION + ENGINE_VERSION;
}
float CalcEditorVersion( void )
{
return LAUNCH_VERSION + COMMON_VERSION + RENDER_VERSION + PHYSIC_API_VERSION + EDITOR_VERSION;
}
/*
==================
ParseCommandLine
@ -102,6 +92,7 @@ bool _GetParmFromCmdLine( char *parm, char *out, size_t size )
if(!argc) return false;
if(!out) return false;
if(!com_argv[argc + 1]) return false;
strncpy( out, com_argv[argc+1], size );
return true;
@ -235,12 +226,6 @@ bool Sys_LoadLibrary ( dll_info_t *dll )
sprintf(errorstring, "Sys_LoadLibrary: \"%s\" have no export\n", dll->name );
goto error;
}
if(check->apiversion != dll->apiversion)
{
sprintf(errorstring, "Sys_LoadLibrary: \"%s\" mismatch version (%i should be %i)\n", dll->name, check->apiversion, dll->apiversion);
goto error;
}
else MsgDev(D_ERROR, " [%d]", check->apiversion );
if(check->api_size != dll->api_size)
{
sprintf(errorstring, "Sys_LoadLibrary: \"%s\" mismatch interface size (%i should be %i)\n", dll->name, check->api_size, dll->api_size);

View File

@ -32,8 +32,7 @@ physic_exp_t DLLEXPORT *CreateAPI ( physic_imp_t *import )
// and always make exception, run simply check for avoid it
if(import) pi = *import;
//generic functions
Phys.apiversion = PHYSIC_API_VERSION;
// generic functions
Phys.api_size = sizeof(physic_exp_t);
Phys.Init = InitPhysics;

View File

@ -245,7 +245,7 @@ void Phys_LoadBSP( uint *buffer )
VectorAdd( boxP1, extra, boxP1 );
NewtonSetWorldSize( gWorld, &boxP0[0], &boxP1[0] );
Msg("physic map generated\n");
MsgDev(D_INFO, "physic map generated\n");
Mem_Free( map_surfedges );
Mem_Free( map_edges );
Mem_Free( map_surfaces );

View File

@ -145,20 +145,20 @@ _inline const char* time_stamp( int format )
switch( format )
{
case TIME_FULL:
// Build the full timestamp (ex: "Apr2007-03(23.31.55)");
strftime(timestring, sizeof (timestring), "%b%Y-%d(%H.%M.%S)", crt_tm);
// Build the full timestamp (ex: "Apr03 2007 [23:31.55]");
strftime(timestring, sizeof (timestring), "%b%d %Y [%H:%M.%S]", crt_tm);
break;
case TIME_DATE_ONLY:
// Build the date stamp only (ex: "Apr2007-03");
strftime(timestring, sizeof (timestring), "%b%Y-%d", crt_tm);
// Build the date stamp only (ex: "Apr03 2007");
strftime(timestring, sizeof (timestring), "%b%d %Y", crt_tm);
break;
case TIME_TIME_ONLY:
// Build the time stamp only (ex: "(23.31.55)");
strftime(timestring, sizeof (timestring), "%b%Y-%d", crt_tm);
// Build the time stamp only (ex: "[23:31.55]");
strftime(timestring, sizeof (timestring), "[%H:%M.%S]", crt_tm);
break;
case TIME_NO_SECONDS:
// Build the full timestamp (ex: "Apr2007-03(23.31)");
strftime(timestring, sizeof (timestring), "%b%Y-%d(%H.%M)", crt_tm);
// Build the full timestamp (ex: "Apr03 2007 [23:31]");
strftime(timestring, sizeof (timestring), "%b%d %Y [%H:%M]", crt_tm);
break;
}

View File

@ -8,20 +8,13 @@
#include "ref_format.h"
#include "version.h"
#define RENDER_API_VERSION 4
#define PHYSIC_API_VERSION 1
#define COMMON_API_VERSION 2
#define LAUNCH_API_VERSION 3
#define INIT32_API_VERSION 5 // executables entry point
//bsplib compile flags
// bsplib compile flags
#define BSP_ONLYENTS 0x01
#define BSP_ONLYVIS 0x02
#define BSP_ONLYRAD 0x04
#define BSP_FULLCOMPILE 0x08
//qcclib compile flags
// qcclib compile flags
#define QCC_PROGDEFS 0x01
#define QCC_OPT_LEVEL_0 0x02
#define QCC_OPT_LEVEL_1 0x04
@ -273,7 +266,8 @@ enum dev_level
D_INFO = 1, // "-dev 1", shows various system messages
D_WARN, // "-dev 2", shows not critical system warnings, same as MsgWarn
D_ERROR, // "-dev 3", shows critical warnings
D_SPAM, // "-dev 4", show all system messages
D_LOAD, // "-dev 4", show messages about loading resources
D_NOTE, // "-dev 5", show system notifications for engine develeopers
};
// format info table
@ -309,7 +303,7 @@ static bpc_desc_t PFDesc[] =
{PF_LUMINANCE_ALPHA,"LUM A", GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, 2, 1, -2 },
{PF_RXGB, "RXGB", GL_RGBA, GL_UNSIGNED_BYTE, 3, 1, 16 },
{PF_ABGR_64, "ABGR 64",GL_BGRA, GL_UNSIGNED_BYTE, 4, 2, -8 },
{PF_RGBA_GN, "system", GL_RGBA, GL_UNSIGNED_BYTE, 4, 1, -32},
{PF_RGBA_GN, "system", GL_RGBA, GL_UNSIGNED_BYTE, 4, 1, -4 },
};
static activity_map_t activity_map[] =
@ -514,7 +508,6 @@ typedef struct dll_info_s
bool crash; // crash if dll not found
// xash dlls validator
int apiversion; // generic api version
size_t api_size; // generic interface size
} dll_info_t;
@ -740,7 +733,6 @@ GENERIC INTERFACE
typedef struct generic_api_s
{
// interface validator
int apiversion; // must matched with *_API_VERSION
size_t api_size; // must matched with sizeof(*_api_t)
} generic_api_t;
@ -974,8 +966,7 @@ LAUNCH.DLL INTERFACE
*/
typedef struct launch_exp_s
{
//interface validator
int apiversion; // must matched with LAUNCH_API_VERSION
// interface validator
size_t api_size; // must matched with sizeof(launch_api_t)
void ( *Init ) ( char *funcname, int argc, char **argv ); // init host
@ -993,8 +984,7 @@ COMMON.DLL INTERFACE
typedef struct common_exp_s
{
//interface validator
int apiversion; // must matched with COMMON_API_VERSION
// interface validator
size_t api_size; // must matched with sizeof(common_api_t)
// initialize
@ -1030,8 +1020,7 @@ RENDER.DLL INTERFACE
typedef struct render_exp_s
{
//interface validator
int apiversion; // must matched with RENDER_API_VERSION
// interface validator
size_t api_size; // must matched with sizeof(render_exp_t)
// initialize
@ -1113,7 +1102,6 @@ PHYSIC.DLL INTERFACE
typedef struct physic_exp_s
{
// interface validator
int apiversion; // must matched with PHYSIC_API_VERSION
size_t api_size; // must matched with sizeof(physic_exp_t)
// initialize

View File

@ -1,15 +1,10 @@
//=======================================================================
// Copyright XashXT Group 2007 ©
// version.h - current dll versions
// version.h - engine version
//=======================================================================
#ifndef VERSION_H
#define VERSION_H
#define LAUNCH_VERSION 0.6
#define COMMON_VERSION 1.3
#define RENDER_VERSION 3.1
#define PHYSIC_VERSION 0.1
#define ENGINE_VERSION 1.8
#define EDITOR_VERSION 0.2
#define XASH_VERSION 0.48f
#endif//VERSION_H

View File

@ -62,5 +62,5 @@ if exist vprogs\progdefs.h move vprogs\progdefs.h engine\progdefs.h
echo Build succeeded!
echo Please wait. Xash is now loading
cd D:\Xash3D\
xash.exe +map qctest -debug -log -dev 3
xash.exe +map qctest -log -dev 4 -debug
:done

View File

@ -262,6 +262,7 @@ extern cvar_t *r_fullbright;
extern cvar_t *r_novis;
extern cvar_t *r_nocull;
extern cvar_t *r_lerpmodels;
extern cvar_t *r_loading;
extern cvar_t *r_pause;
extern cvar_t *r_lightlevel; // FIXME: This is a HACK to get the client's light level

View File

@ -178,7 +178,7 @@ model_t *Mod_ForName(char *name, bool crash)
int i;
if (!name[0]) return NULL;
// inline models are grabbed only from worldmodel
if (name[0] == '*')
{
@ -446,7 +446,7 @@ void Mod_LoadTexinfo (lump_t *l)
for ( i = 0; i < count; i++, in++, out++)
{
for (j=0 ; j<8 ; j++)
for (j = 0; j < 8; j++)
out->vecs[0][j] = LittleFloat(in->vecs[0][j]);
out->flags = LittleLong (in->flags);
@ -455,7 +455,12 @@ void Mod_LoadTexinfo (lump_t *l)
else out->next = NULL;
out->image = R_FindImage (in->texture, NULL, 0, it_wall);
if (!out->image)
if(out->image)
{
ri.Cvar_SetValue("scr_loading", r_loading->value + 45.0f/count );
Msg("loading textures %g\n", r_loading->value + 45.0f/count );
}
else
{
Msg("Couldn't load %s\n", in->texture);
out->image = r_notexture;
@ -949,8 +954,15 @@ void R_BeginRegistration (char *model)
// explicitly free the old map if different
// this guarantees that mod_known[0] is the world map
flushmap = ri.Cvar_Get ("flushmap", "0", 0);
if ( strcmp(mod_known[0].name, fullname) || flushmap->value)
if(strcmp(mod_known[0].name, fullname) || flushmap->value)
{
Mod_Free (&mod_known[0]);
}
else
{
// textures already loaded
ri.Cvar_SetValue("scr_loading", r_loading->value + 45.0f );
}
r_worldmodel = Mod_ForName(fullname, true);
r_viewcluster = -1;

View File

@ -90,6 +90,7 @@ cvar_t *r_novis;
cvar_t *r_nocull;
cvar_t *r_lerpmodels;
cvar_t *r_lefthand;
cvar_t *r_loading;
cvar_t *r_lightlevel; // FIXME: This is a HACK to get the client's light level
cvar_t *r_emboss_bump;
@ -928,6 +929,8 @@ void R_Register( void )
r_speeds = ri.Cvar_Get ("r_speeds", "0", 0);
r_pause = ri.Cvar_Get("paused", "0", 0);
r_loading = ri.Cvar_Get("scr_loading", "0", 0 );
r_lightlevel = ri.Cvar_Get ("r_lightlevel", "0", 0);
r_emboss_bump = ri.Cvar_Get ("r_emboss_bump", "0", 0);
@ -1105,10 +1108,12 @@ int R_Init( void *hinstance, void *hWnd )
return false;
}
MsgDev(D_INFO, "------- Loading bin/render.dll [%g] -------\n", RENDER_VERSION );
// FIXME: don't remove - renderer immediately crash without it
MsgDev(D_INFO, "Initializing render\n" );
ri.Vid_MenuInit();
// get our various GL strings
//get our various GL strings
gl_config.vendor_string = qglGetString (GL_VENDOR);
MsgDev(D_INFO, "GL_VENDOR: %s\n", gl_config.vendor_string );
gl_config.renderer_string = qglGetString (GL_RENDERER);
@ -1117,7 +1122,7 @@ int R_Init( void *hinstance, void *hWnd )
MsgDev(D_INFO, "GL_VERSION: %s\n", gl_config.version_string );
gl_config.extensions_string = qglGetString (GL_EXTENSIONS);
MsgDev(D_INFO, "GL_EXTENSIONS: %s\n", gl_config.extensions_string );
strcpy( renderer_buffer, gl_config.renderer_string );
strlwr( renderer_buffer );
@ -1131,7 +1136,7 @@ int R_Init( void *hinstance, void *hWnd )
else if ( strstr( vendor_buffer, "nvidia" ) )
gl_config.renderer = GL_RENDERER_ATI;
else gl_config.renderer = GL_RENDERER_DEFAULT;
gl_config.allow_cds = true;
/*
@ -1525,7 +1530,7 @@ render_exp_t DLLEXPORT *CreateAPI(render_imp_t *rimp )
// and always make exception, run simply check for avoid it
if(rimp) ri = *rimp;
re.apiversion = RENDER_API_VERSION;
// generic functions
re.api_size = sizeof(render_exp_t);
re.BeginRegistration = R_BeginRegistration;

View File

@ -62,6 +62,7 @@ void R_InitParticleTexture (void)
r_tex.height = 8;
r_tex.type = PF_RGBA_GN; // generated
r_tex.flags = IMAGE_HAS_ALPHA;
r_tex.size = r_tex.width * r_tex.height * 4;
r_tex.numMips = 1;
r_tex.palette = NULL;
r_tex.buffer = (byte *)data;

View File

@ -556,7 +556,8 @@ void R_DrawSkyBox (void)
int i;
if (skyrotate)
{ // check for no sky at all
{
// check for no sky at all
for (i = 0; i < 6; i++)
if (skymins[0][i] < skymaxs[0][i] && skymins[1][i] < skymaxs[1][i])
break;
@ -577,11 +578,10 @@ void R_DrawSkyBox (void)
skymaxs[1][i] = 1;
}
if (skymins[0][i] >= skymaxs[0][i]
|| skymins[1][i] >= skymaxs[1][i])
if (skymins[0][i] >= skymaxs[0][i] || skymins[1][i] >= skymaxs[1][i])
continue;
GL_Bind (sky_image->texnum[sky_image->texorder[i]]);
GL_Bind(sky_image->texnum[sky_image->texorder[i]]);
qglBegin (GL_QUADS);
MakeSkyVec (skymins[0][i], skymins[1][i], i);
@ -602,14 +602,14 @@ void R_SetSky (char *name, float rotate, vec3_t axis)
{
char pathname[MAX_QPATH];
strncpy (skyname, name, sizeof(skyname)-1);
strncpy (skyname, name, sizeof(skyname) - 1);
skyrotate = rotate;
VectorCopy (axis, skyaxis);
VectorCopy(axis, skyaxis);
// chop down rotating skies for less memory
if (gl_skymip->value || skyrotate) gl_picmip->value += 6;
sprintf (pathname, "base_sky/%s", skyname);
sprintf (pathname, "cubemaps/env/%s", skyname);
sky_image = R_FindImage (pathname, NULL, 0, it_sky);
if (!sky_image) sky_image = r_notexture;

View File

@ -161,22 +161,18 @@ rserr_t GLimp_SetMode( int *pwidth, int *pheight, int mode, bool fullscreen )
int width, height;
const char *win_fs[] = { "W", "FS" };
Msg("Initializing OpenGL display\n");
Msg("...setting mode %d:", mode );
if ( !ri.Vid_GetModeInfo( &width, &height, mode ) )
{
Msg(" invalid mode\n" );
return rserr_invalid_mode;
}
Msg(" %d %d %s\n", width, height, win_fs[fullscreen] );
MsgDev(D_INFO, "Initializing OpenGL: %d %d %s\n", width, height, win_fs[fullscreen] );
// destroy the existing window
if (glw_state.hWnd)
{
GLimp_Shutdown ();
GLimp_Shutdown();
}
// do a CDS if needed
@ -184,10 +180,7 @@ rserr_t GLimp_SetMode( int *pwidth, int *pheight, int mode, bool fullscreen )
{
DEVMODE dm;
Msg("...attempting fullscreen\n" );
memset( &dm, 0, sizeof( dm ) );
dm.dmSize = sizeof( dm );
dm.dmPelsWidth = width;
@ -198,19 +191,14 @@ rserr_t GLimp_SetMode( int *pwidth, int *pheight, int mode, bool fullscreen )
{
dm.dmBitsPerPel = gl_bitdepth->value;
dm.dmFields |= DM_BITSPERPEL;
Msg("...using gl_bitdepth of %d\n", ( int ) gl_bitdepth->value );
}
else
{
HDC hdc = GetDC( NULL );
int bitspixel = GetDeviceCaps( hdc, BITSPIXEL );
Msg("...using desktop display depth of %d\n", bitspixel );
ReleaseDC( 0, hdc );
}
Msg("...calling CDS: " );
if ( ChangeDisplaySettings( &dm, CDS_FULLSCREEN ) == DISP_CHANGE_SUCCESSFUL )
{
*pwidth = width;
@ -218,8 +206,6 @@ rserr_t GLimp_SetMode( int *pwidth, int *pheight, int mode, bool fullscreen )
gl_state.fullscreen = true;
Msg("ok\n" );
if ( !VID_CreateWindow (width, height, true) )
return rserr_invalid_mode;
@ -230,10 +216,6 @@ rserr_t GLimp_SetMode( int *pwidth, int *pheight, int mode, bool fullscreen )
*pwidth = width;
*pheight = height;
Msg("failed\n" );
Msg("...calling CDS assuming dual monitors:" );
dm.dmPelsWidth = width * 2;
dm.dmPelsHeight = height;
dm.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;
@ -250,10 +232,6 @@ rserr_t GLimp_SetMode( int *pwidth, int *pheight, int mode, bool fullscreen )
*/
if ( ChangeDisplaySettings( &dm, CDS_FULLSCREEN ) != DISP_CHANGE_SUCCESSFUL )
{
Msg(" failed\n" );
Msg("...setting windowed mode\n" );
ChangeDisplaySettings( 0, 0 );
*pwidth = width;
@ -265,7 +243,6 @@ rserr_t GLimp_SetMode( int *pwidth, int *pheight, int mode, bool fullscreen )
}
else
{
Msg(" ok\n" );
if ( !VID_CreateWindow (width, height, true) )
return rserr_invalid_mode;
@ -276,8 +253,6 @@ rserr_t GLimp_SetMode( int *pwidth, int *pheight, int mode, bool fullscreen )
}
else
{
Msg("...setting windowed mode\n" );
ChangeDisplaySettings( 0, 0 );
*pwidth = width;
@ -501,7 +476,7 @@ bool GLimp_InitGL (void)
/*
** print out PFD specifics
*/
Msg("GL PFD: color(%d-bits) Z(%d-bit)\n", ( int ) pfd.cColorBits, ( int ) pfd.cDepthBits );
MsgDev(D_NOTE, "GL PFD: color(%d-bits) Z(%d-bit)\n", ( int )pfd.cColorBits, ( int )pfd.cDepthBits );
return true;
fail:
if ( glw_state.hGLRC )

View File

@ -104,9 +104,13 @@ void R_Bloom_InitBackUpTexture( int width, int height )
rgbdata_t r_bloom;
data = Z_Malloc( width * height * 4 );
memset(&r_bloom, 0, sizeof(rgbdata_t));
r_bloom.width = width;
r_bloom.height = height;
r_bloom.type = PF_RGBA_GN;
r_bloom.size = width * height * 4;
r_bloom.flags = 0;
r_bloom.numMips = 1;
r_bloom.palette = NULL;
@ -127,6 +131,8 @@ void R_Bloom_InitEffectTexture( void )
byte *data;
float bloomsizecheck;
rgbdata_t r_bloomfx;
memset(&r_bloomfx, 0, sizeof(rgbdata_t));
if( (int)r_bloom_sample_size->value < 32 )
ri.Cvar_SetValue ("r_bloom_sample_size", 32);
@ -154,6 +160,7 @@ void R_Bloom_InitEffectTexture( void )
r_bloomfx.width = BLOOM_SIZE;
r_bloomfx.height = BLOOM_SIZE;
r_bloomfx.size = BLOOM_SIZE * BLOOM_SIZE * 4;
r_bloomfx.type = PF_RGBA_GN;
r_bloomfx.flags = 0;
r_bloomfx.numMips = 1;
@ -175,6 +182,9 @@ void R_Bloom_InitTextures( void )
int size;
rgbdata_t r_bloomscr, r_downsample;
memset(&r_bloomscr, 0, sizeof(rgbdata_t));
memset(&r_downsample, 0, sizeof(rgbdata_t));
//find closer power of 2 to screen size
for (screen_texture_width = 1; screen_texture_width < vid.width; screen_texture_width *= 2);
for (screen_texture_height = 1; screen_texture_height < vid.height; screen_texture_height *= 2);
@ -191,6 +201,7 @@ void R_Bloom_InitTextures( void )
r_bloomscr.palette = NULL;
r_bloomscr.buffer = (byte *)data;
r_bloomscr.numMips = 1;
r_bloomscr.size = screen_texture_width * screen_texture_height * 4;
r_bloomscreentexture = R_LoadImage( "***r_bloomscreentexture***", &r_bloomscr, it_pic );
Z_Free ( data );
@ -207,6 +218,7 @@ void R_Bloom_InitTextures( void )
r_downsample.width = r_screendownsamplingtexture_size;
r_downsample.height = r_screendownsamplingtexture_size;
r_downsample.type = PF_RGBA_GN;
r_downsample.size = r_screendownsamplingtexture_size * r_screendownsamplingtexture_size * 4;
r_downsample.flags = 0;
r_downsample.palette = NULL;
r_downsample.buffer = (byte *)data;

View File

@ -192,7 +192,7 @@ bool R_GetPixelFormat( rgbdata_t *pic, imagetype_t type )
break;
}
}
if(i != PF_TOTALCOUNT) //make sure what match found
if(i != PF_TOTALCOUNT) // make sure what match found
{
image_desc.numLayers = pic->numLayers;
image_desc.width = w = pic->width;
@ -242,7 +242,7 @@ bool R_GetPixelFormat( rgbdata_t *pic, imagetype_t type )
if(r_size != pic->size) // sanity check
{
MsgDev(D_ERROR, "R_GetPixelFormat: invalid image size\n");
MsgDev(D_WARN, "R_GetPixelFormat: invalid image size (%i should be %i)\n", pic->size, r_size );
return false;
}
return true;
@ -1666,7 +1666,7 @@ image_t *R_LoadImage(char *name, rgbdata_t *pic, imagetype_t type )
R_SetPixelFormat( image_desc.width, image_desc.height, image_desc.numLayers );
offset = image_desc.SizeOfFile;// move pointer
MsgDev(D_SPAM, "loading %s [%s] \n", name, PFDesc[image_desc.format].name );
MsgDev(D_LOAD, "%s [%s] \n", name, PFDesc[image_desc.format].name );
switch(pic->type)
{
@ -1692,13 +1692,11 @@ image_t *R_LoadImage(char *name, rgbdata_t *pic, imagetype_t type )
}
}
//check for errors
// check for errors
if(!iResult)
{
MsgWarn("R_LoadImage: can't loading %s with bpp %d\n", name, image_desc.bpp );
image->name[0] = '\0';
image->registration_sequence = 0;
return NULL;
return r_notexture;
}
return image;
}

View File

@ -289,11 +289,11 @@ void() PutClientInServer =
pev->th_pain = PlayerPain;
pev->th_die = PlayerDie;
setstats( pev, STAT_HEALTH_ICON, "i_health");
setstats( pev, STAT_HEALTH_ICON, "hud/i_health");
setstats( pev, STAT_HEALTH, ftoa(pev->health));
setstats( pev, STAT_HELPICON, "i_help");
setstats( pev, STAT_HELPICON, "hud/i_help");
image_index( "help" );
image_index( "hud/help" );
GetLevelParms();
};

View File

@ -196,11 +196,10 @@ float TRUE = 1;
// newdefines
#define CS_NAME 0
#define CS_CDTRACK 1
#define CS_SKY 2
#define CS_SKYAXIS 3 // %f %f %f format
#define CS_SKYROTATE 4
#define CS_STATUSBAR 5 // display program string
#define CS_SKY 1
#define CS_SKYAXIS 2 // %f %f %f format
#define CS_SKYROTATE 3
#define CS_STATUSBAR 4 // hud_program section name
//NOTE: other CS_* will be set by engine
#define STAT_HEALTH_ICON 0

View File

@ -109,7 +109,6 @@ void worldspawn( void )
configstring (CS_SKY, "sky" );
configstring (CS_SKYROTATE, ftoa( pev->speed )); // rotate speed
configstring (CS_SKYAXIS, vtoa( pev->angles )); // rotate axis
configstring (CS_CDTRACK, ftoa( 0 ));
}
/*