24 Sep 2009

This commit is contained in:
g-cont 2009-09-24 00:00:00 +04:00 committed by Alibek Omarov
parent 2fc0894ba1
commit eef3c531db
36 changed files with 497 additions and 301 deletions

View File

@ -317,6 +317,7 @@ typedef struct
int (*pfnRestore)( edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity );
void (*pfnSetAbsBox)( edict_t *pent );
TYPEDESCRIPTION *(*pfnGetEntvarsDescirption)( int number );
void (*pfnSaveWriteFields)( SAVERESTOREDATA*, const char*, void*, TYPEDESCRIPTION*, int );
void (*pfnSaveReadFields)( SAVERESTOREDATA*, const char*, void*, TYPEDESCRIPTION*, int );
void (*pfnSaveGlobalState)( SAVERESTOREDATA * );

View File

@ -189,13 +189,14 @@ splash logo while map is loading
*/
void CL_LevelShot_f( void )
{
string checkname;
if( cls.scrshot_request != scrshot_plaque ) return;
cls.scrshot_request = scrshot_inactive;
if( !cl.need_levelshot ) return;
// check for exist
com.sprintf( checkname, "levelshots/%s.jpg", cl.configstrings[CS_NAME] );
if( !FS_FileExists( checkname )) re->ScrShot( checkname, VID_LEVELSHOT );
cl.need_levelshot = false; // done
com.sprintf( cls.shotname, "levelshots/%s.jpg", cl.configstrings[CS_NAME] );
if( !FS_FileExists( cls.shotname ))
cls.scrshot_action = scrshot_plaque; // build new frame for levelshot
else cls.scrshot_action = scrshot_inactive; // disable - not needs
}
/*
@ -207,8 +208,6 @@ mini-pic in loadgame menu
*/
void CL_SaveShot_f( void )
{
string checkname;
if( Cmd_Argc() < 2 )
{
Msg( "Usage: saveshot <savename>\n" );
@ -216,8 +215,8 @@ void CL_SaveShot_f( void )
}
// check for exist
com.sprintf( checkname, "saves/%s.jpg", Cmd_Argv( 1 ));
if( !FS_FileExists( checkname )) re->ScrShot( checkname, VID_SAVESHOT );
com.sprintf( cls.shotname, "save/%s.jpg", Cmd_Argv( 1 ));
cls.scrshot_action = scrshot_savegame; // build new frame for saveshot
}
/*

View File

@ -721,18 +721,18 @@ void pfnDrawCenterPrint( void )
int l, x, y, w;
rgba_t color;
if( !cl.centerPrintTime ) return;
CL_FadeAlpha( cl.centerPrintTime, scr_centertime->value, color );
if( !clgame.centerPrintTime ) return;
CL_FadeAlpha( clgame.centerPrintTime, scr_centertime->value, color );
if( *( int *)color == 0xFFFFFFFF )
{
cl.centerPrintTime = 0;
clgame.centerPrintTime = 0;
return;
}
re->SetColor( color );
start = cl.centerPrint;
y = cl.centerPrintY - cl.centerPrintLines * BIGCHAR_HEIGHT / 2;
start = clgame.centerPrint;
y = clgame.centerPrintY - clgame.centerPrintLines * BIGCHAR_HEIGHT / 2;
while( 1 )
{
@ -746,12 +746,12 @@ void pfnDrawCenterPrint( void )
}
linebuffer[l] = 0;
w = cl.centerPrintCharWidth * com.cstrlen( linebuffer );
w = clgame.centerPrintCharWidth * com.cstrlen( linebuffer );
x = ( SCREEN_WIDTH - w )>>1;
SCR_DrawStringExt( x, y, cl.centerPrintCharWidth, BIGCHAR_HEIGHT, linebuffer, color, false );
SCR_DrawStringExt( x, y, clgame.centerPrintCharWidth, BIGCHAR_HEIGHT, linebuffer, color, false );
y += cl.centerPrintCharWidth * 1.5;
y += clgame.centerPrintCharWidth * 1.5;
while( *start && ( *start != '\n' )) start++;
if( !*start ) break;
start++;
@ -770,18 +770,18 @@ void pfnCenterPrint( const char *text, int y, int charWidth )
{
char *s;
com.strncpy( cl.centerPrint, text, sizeof( cl.centerPrint ));
cl.centerPrintTime = cls.realtime * 0.001f;
cl.centerPrintY = y;
cl.centerPrintCharWidth = charWidth;
com.strncpy( clgame.centerPrint, text, sizeof( clgame.centerPrint ));
clgame.centerPrintTime = cls.realtime * 0.001f;
clgame.centerPrintY = y;
clgame.centerPrintCharWidth = charWidth;
// count the number of lines for centering
cl.centerPrintLines = 1;
s = cl.centerPrint;
clgame.centerPrintLines = 1;
s = clgame.centerPrint;
while( *s )
{
if( *s == '\n' )
cl.centerPrintLines++;
clgame.centerPrintLines++;
s++;
}
}
@ -928,9 +928,8 @@ force to make levelshot
*/
void pfnMakeLevelShot( void )
{
if( !cl.need_levelshot ) return;
Con_ClearNotify();
if( cls.scrshot_request != scrshot_plaque )
return;
// make levelshot at nextframe()
Cbuf_AddText( "wait 1\nlevelshot\n" );

View File

@ -1200,6 +1200,8 @@ void CL_Frame( int time )
// update the screen
SCR_UpdateScreen();
SCR_MakeScreenShot();
// update audio
S_Update( cl.playernum + 1, cl.refdef.vieworg, vec3_origin, cl.refdef.forward, cl.refdef.up );

View File

@ -262,7 +262,7 @@ void CL_ParseServerData( sizebuf_t *msg )
if( i == 3 )
{
Cvar_Set( "cl_levelshot_name", MAP_DEFAULT_SHADER ); // render a black screen
cl.need_levelshot = true; // make levelshot
cls.scrshot_request = scrshot_plaque; // make levelshot
}
// seperate the printfs so the server message can have a color
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");

View File

@ -323,7 +323,8 @@ void SCR_DrawFPS( void )
if( cls.state != ca_active ) return;
if( !cl_showfps->integer ) return;
if( cl.need_levelshot ) return;
if( cls.scrshot_action != scrshot_inactive )
return;
newtime = Sys_DoubleTime();
if( newtime >= nexttime )
@ -384,6 +385,25 @@ void SCR_RSpeeds( void )
}
}
void SCR_MakeScreenShot( void )
{
if( !re && host.type == HOST_NORMAL )
return; // don't reset action - it will be wait for render initalization is done
switch( cls.scrshot_action )
{
case scrshot_plaque:
re->ScrShot( cls.shotname, VID_LEVELSHOT );
break;
case scrshot_savegame:
re->ScrShot( cls.shotname, VID_SAVESHOT );
break;
}
cls.scrshot_action = scrshot_inactive;
cls.shotname[0] = '\0';
}
/*
==================
SCR_UpdateScreen
@ -433,6 +453,9 @@ void SCR_RegisterShaders( void )
// vid_state has changed
if( clgame.hInstance ) clgame.dllFuncs.pfnVidInit();
g_console_field_width = scr_width->integer / SMALLCHAR_WIDTH - 2;
g_consoleField.widthInChars = g_console_field_width;
}
/*

View File

@ -170,10 +170,13 @@ V_PostRender
*/
void V_PostRender( void )
{
SCR_RSpeeds();
SCR_DrawNet();
SCR_DrawFPS();
UI_UpdateMenu( cls.realtime );
Con_DrawConsole();
if( cls.scrshot_action == scrshot_inactive )
{
SCR_RSpeeds();
SCR_DrawNet();
SCR_DrawFPS();
UI_UpdateMenu( cls.realtime );
Con_DrawConsole();
}
re->EndFrame();
}

View File

@ -107,14 +107,6 @@ typedef struct
edict_t viewent; // viewmodel
client_data_t data; // hud data
// misc 2d drawing stuff
float centerPrintTime;
int centerPrintCharWidth;
int centerPrintY;
char centerPrint[1024];
int centerPrintLines;
bool need_levelshot;
// predicting stuff
int predicted_origins[CMD_BACKUP][3];// for debug comparing against server
@ -170,6 +162,13 @@ typedef enum
dl_generic,
} dltype_t; // download type
typedef enum
{
scrshot_inactive,
scrshot_plaque, // levelshot
scrshot_savegame, // saveshot
} e_scrshot;
// cl_private_edict_t
struct cl_priv_s
{
@ -220,6 +219,13 @@ typedef struct
void *vp; // acess by offset in bytes
};
// misc 2d drawing stuff
float centerPrintTime;
int centerPrintCharWidth;
int centerPrintY;
char centerPrint[1024];
int centerPrintLines;
int maxClients;
int numEntities;
int maxEntities;
@ -266,6 +272,10 @@ typedef struct
int downloadnumber;
dltype_t downloadtype;
e_scrshot scrshot_request; // request for screen shot
e_scrshot scrshot_action; // in-action
string shotname;
// demo recording info must be here, so it isn't clearing on level change
bool demorecording;
bool demoplayback;
@ -511,6 +521,7 @@ void SCR_DrawSmallStringExt( int x, int y, const char *string, rgba_t setColor,
void SCR_DrawStringExt( int x, int y, float w, float h, const char *string, rgba_t setColor, bool forceColor );
void SCR_DrawBigString( int x, int y, const char *s, byte alpha );
void SCR_DrawBigStringColor( int x, int y, const char *s, rgba_t color );
void SCR_MakeScreenShot( void );
void SCR_RSpeeds( void );
void SCR_DrawFPS( void );
void SCR_DrawNet( void );

View File

@ -631,7 +631,7 @@ void Key_Console( int key )
}
// ctrl-end = bottom of console
if ( key == K_END && keys[K_CTRL].down )
if( key == K_END && keys[K_CTRL].down )
{
Con_Bottom();
return;

View File

@ -10,9 +10,7 @@ cvar_t *con_notifytime;
cvar_t *con_speed;
cvar_t *con_font;
vec4_t console_color = {1.0, 1.0, 1.0, 1.0};
int g_console_field_width = 78;
#define DEFAULT_CONSOLE_WIDTH 78
#define COLOR_BLACK '0'
#define COLOR_RED '1'
#define COLOR_GREEN '2'
@ -23,7 +21,9 @@ int g_console_field_width = 78;
#define COLOR_WHITE '7'
#define NUM_CON_TIMES 5 // need for 4 lines
#define CON_TEXTSIZE MAX_MSGLEN * 4 // 128 kb buffer
#define CON_TEXTSIZE (MAX_MSGLEN * 4) // 128 kb buffer
int g_console_field_width = 78;
// console color typeing
rgba_t g_color_table[8] =
@ -121,7 +121,7 @@ void Con_ToggleChat_f (void)
Con_Clear_f
================
*/
void Con_Clear_f (void)
void Con_Clear_f( void )
{
int i;
@ -182,14 +182,14 @@ void Con_CheckResize( void )
int i, j, width, oldwidth, oldtotallines, numlines, numchars;
short tbuf[CON_TEXTSIZE];
width = ((int)Cvar_VariableValue( "width" ) / SMALLCHAR_WIDTH) - 2;
width = SCREEN_WIDTH / SMALLCHAR_WIDTH - 2;
if( width == con.linewidth )
return;
if( width < 1 ) // video hasn't been initialized yet
if( re == NULL ) // video hasn't been initialized yet
{
width = g_console_field_width;
width = DEFAULT_CONSOLE_WIDTH;
con.linewidth = width;
con.totallines = CON_TEXTSIZE / con.linewidth;
for(i = 0; i < CON_TEXTSIZE; i++)
@ -198,17 +198,17 @@ void Con_CheckResize( void )
else
{
oldwidth = con.linewidth;
con.linewidth = width;
con.linewidth = g_console_field_width;
oldtotallines = con.totallines;
con.totallines = CON_TEXTSIZE / con.linewidth;
numlines = oldtotallines;
if (con.totallines < numlines)
if( con.totallines < numlines )
numlines = con.totallines;
numchars = oldwidth;
if (con.linewidth < numchars)
if( con.linewidth < numchars )
numchars = con.linewidth;
Mem_Copy( tbuf, con.text, CON_TEXTSIZE * sizeof( short ));
@ -236,16 +236,16 @@ void Con_CheckResize( void )
Con_Init
================
*/
void Con_Init (void)
void Con_Init( void )
{
int i;
Con_CheckResize();
// register our commands
con_notifytime = Cvar_Get ("con_notifytime", "3", 0, "notify time to live" );
con_speed = Cvar_Get ("con_speed", "3", 0, "console moving speed" );
con_font = Cvar_Get( "con_font", "default", CVAR_ARCHIVE, "path to console charset" );
con_notifytime = Cvar_Get( "con_notifytime", "3", 0, "notify time to live" );
con_speed = Cvar_Get( "con_speed", "3", 0, "console moving speed" );
con_font = Cvar_Get( "con_font", "default", CVAR_ARCHIVE, "path to console charset" );
Field_Clear( &g_consoleField );
g_consoleField.widthInChars = g_console_field_width;
@ -255,11 +255,11 @@ void Con_Init (void)
historyEditLines[i].widthInChars = g_console_field_width;
}
Cmd_AddCommand ("toggleconsole", Con_ToggleConsole_f, "opens or closes the console" );
Cmd_AddCommand ("togglechat", Con_ToggleChat_f, "enable or disable chat mode" );
Cmd_AddCommand ("messagemode", Con_MessageMode_f, "input a chat message to say to everyone" );
Cmd_AddCommand ("messagemode2", Con_MessageMode2_f, "input a chat message to say to only your team" );
Cmd_AddCommand ("clear", Con_Clear_f, "clear console history" );
Cmd_AddCommand( "toggleconsole", Con_ToggleConsole_f, "opens or closes the console" );
Cmd_AddCommand( "togglechat", Con_ToggleChat_f, "enable or disable chat mode" );
Cmd_AddCommand( "messagemode", Con_MessageMode_f, "input a chat message to say to everyone" );
Cmd_AddCommand( "messagemode2", Con_MessageMode2_f, "input a chat message to say to only your team" );
Cmd_AddCommand( "clear", Con_Clear_f, "clear console history" );
con.initialized = true;
MsgDev( D_NOTE, "Console initialized.\n" );
}
@ -304,8 +304,8 @@ void Con_Print( const char *txt )
int prev;
// client not running
if(host.type == HOST_DEDICATED) return;
if(!con.initialized) return;
if( host.type == HOST_DEDICATED ) return;
if( !con.initialized ) return;
if(!com.strncmp( txt, "[skipnotify]", 12 ))
{
@ -313,7 +313,7 @@ void Con_Print( const char *txt )
txt += 12;
}
color = ColorIndex(COLOR_WHITE);
color = ColorIndex( COLOR_WHITE );
while((c = *txt) != 0 )
{
@ -325,13 +325,13 @@ void Con_Print( const char *txt )
}
// count word length
for (l = 0; l < con.linewidth; l++)
for( l = 0; l < con.linewidth; l++ )
{
if ( txt[l] <= ' ') break;
if( txt[l] <= ' ') break;
}
// word wrap
if (l != con.linewidth && (con.x + l >= con.linewidth))
if( l != con.linewidth && (con.x + l >= con.linewidth ))
Con_Linefeed( skipnotify);
txt++;
@ -405,12 +405,10 @@ Draws the last few lines of output transparently over the game top
*/
void Con_DrawNotify( void )
{
int x, v = 0;
short *text;
int i;
int time;
int skip;
int currentColor;
int x, v = 0;
short *text;
int i, time, skip;
int currentColor;
currentColor = 7;
re->SetColor( g_color_table[currentColor] );
@ -424,12 +422,12 @@ void Con_DrawNotify( void )
if( time > (con_notifytime->value * 1000)) continue;
text = con.text + (i % con.totallines) * con.linewidth;
for( x = 0; x < con.linewidth; x++)
for( x = 0; x < con.linewidth; x++ )
{
if((text[x] & 0xff ) == ' ' ) continue;
if(((text[x]>>8)&7 ) != currentColor )
if(((text[x]>>8) & 7 ) != currentColor )
{
currentColor = (text[x]>>8)&7;
currentColor = (text[x]>>8) & 7;
re->SetColor(g_color_table[currentColor]);
}
SCR_DrawSmallChar( con.xadjust + (x+1)*SMALLCHAR_WIDTH, v, text[x] & 0xff );
@ -465,7 +463,7 @@ Con_DrawConsole
Draws the console with the solid background
================
*/
void Con_DrawSolidConsole (float frac)
void Con_DrawSolidConsole( float frac )
{
int i, x, y;
int rows;
@ -485,18 +483,18 @@ void Con_DrawSolidConsole (float frac)
// draw the background
y = frac * SCREEN_HEIGHT - 2;
if ( y < 1 ) y = 0;
if( y < 1 ) y = 0;
else SCR_DrawPic( 0, y - SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT, cls.consoleBack );
MakeRGBA( color, 255, 0, 0, 255 );
SCR_FillRect( 0, y, SCREEN_WIDTH, 2, color );
// draw current time
re->SetColor(g_color_table[ColorIndex(COLOR_YELLOW)]);
com.snprintf( curtime, MAX_STRING, "%s ", timestamp( TIME_TIME_ONLY));
re->SetColor( g_color_table[ColorIndex(COLOR_YELLOW)] );
com.snprintf( curtime, MAX_STRING, "%s ", timestamp( TIME_TIME_ONLY ));
i = com.strlen( curtime );
for (x = 0; x < i; x++)
SCR_DrawSmallChar(scr_width->integer - ( i - x ) * SMALLCHAR_WIDTH, (lines - (SMALLCHAR_HEIGHT+SMALLCHAR_HEIGHT/2)), curtime[x]);
SCR_DrawSmallChar( scr_width->integer - ( i - x ) * SMALLCHAR_WIDTH, (lines - (SMALLCHAR_HEIGHT+SMALLCHAR_HEIGHT/2)), curtime[x] );
re->SetColor(NULL);
// draw the text
@ -508,7 +506,7 @@ void Con_DrawSolidConsole (float frac)
if (con.display != con.current)
{
// draw arrows to show the buffer is backscrolled
re->SetColor(g_color_table[ColorIndex(COLOR_RED)]);
re->SetColor( g_color_table[ColorIndex(COLOR_RED)] );
for (x = 0; x < con.linewidth; x += 4)
SCR_DrawSmallChar( con.xadjust + (x+1) * SMALLCHAR_WIDTH, y, '^' );
y -= SMALLCHAR_HEIGHT;
@ -523,18 +521,18 @@ void Con_DrawSolidConsole (float frac)
for (i = 0; i < rows; i++, y -= SMALLCHAR_HEIGHT, row--)
{
if (row < 0) break;
if (con.current - row >= con.totallines)
if( row < 0 ) break;
if( con.current - row >= con.totallines )
{
// past scrollback wrap point
continue;
}
text = con.text + (row % con.totallines)*con.linewidth;
text = con.text + (row % con.totallines) * con.linewidth;
for (x = 0; x < con.linewidth; x++)
for( x = 0; x < con.linewidth; x++ )
{
if((text[x] & 0xff ) == ' ') continue;
if((text[x] & 0xff ) == ' ' ) continue;
if(((text[x]>>8) & 7 ) != currentColor )
{
currentColor = (text[x]>>8) & 7;
@ -603,7 +601,7 @@ void Con_RunConsole( void )
// decide on the destination height of the console
if( cls.key_dest == key_console )
{
if ( cls.state == ca_disconnected )
if( cls.state == ca_disconnected )
con.finalFrac = 1.0;// full screen
else con.finalFrac = 0.5; // half screen
}
@ -633,13 +631,13 @@ void Con_PageUp( void )
void Con_PageDown( void )
{
con.display += 2;
if (con.display > con.current) con.display = con.current;
if( con.display > con.current) con.display = con.current;
}
void Con_Top( void )
{
con.display = con.totallines;
if ( con.current - con.display >= con.totallines )
if( con.current - con.display >= con.totallines )
con.display = con.current - con.totallines + 1;
}

View File

@ -237,7 +237,7 @@ typedef struct
// library exports table
word *ordinals;
dword *funcs;
char *names[MAX_SYSPATH]; // max 1024 exports supported
char *names[4096]; // max 4096 exports supported
int num_ordinals; // actual exports count
dword funcBase; // base offset
@ -388,7 +388,6 @@ void SV_UpdateEntityState( edict_t *ent, bool baseline );
void SV_LoadProgs( const char *name );
void SV_UnloadProgs( void );
void SV_FreeEdicts( void );
void SV_InitEdict( edict_t *pEdict );
void SV_ConfigString( int index, const char *val );
void SV_SetModel( edict_t *ent, const char *name );
void SV_CreatePhysBody( edict_t *ent );

View File

@ -280,13 +280,13 @@ void SV_Delete_f( void )
{
if( Cmd_Argc() != 2 )
{
Msg ("Usage: delete <name>\n");
Msg( "Usage: delete <name>\n" );
return;
}
// delete save and saveshot
FS_Delete( va( "saves/%s.bin", Cmd_Argv( 1 )));
FS_Delete( va( "saves/%s.jpg", Cmd_Argv( 1 )));
FS_Delete( va( "%s/save/%s.bin", GI->gamedir, Cmd_Argv( 1 )));
FS_Delete( va( "%s/save/%s.jpg", GI->gamedir, Cmd_Argv( 1 )));
}
/*

View File

@ -10,13 +10,11 @@
#include "com_library.h"
#include "const.h"
#define EOFS( x ) (int)&(((entvars_t *)0)->x)
void Sys_FsGetString( file_t *f, char *str )
{
char ch;
while( (ch = FS_Getc( f )) != EOF )
while(( ch = FS_Getc( f )) != EOF )
{
*str++ = ch;
if( !ch ) break;
@ -28,7 +26,7 @@ void Sys_FreeNameFuncGlobals( void )
int i;
if( svgame.ordinals ) Mem_Free( svgame.ordinals );
if( svgame.funcs) Mem_Free( svgame.funcs);
if( svgame.funcs ) Mem_Free( svgame.funcs );
for( i = 0; i < svgame.num_ordinals; i++ )
{
@ -89,7 +87,7 @@ bool Sys_LoadSymbols( const char *filename )
return false;
}
if( FS_Read( f, &dos_header, sizeof(dos_header)) != sizeof( dos_header ))
if( FS_Read( f, &dos_header, sizeof( dos_header )) != sizeof( dos_header ))
{
MsgDev( D_ERROR, "Sys_LoadSymbols: %s has corrupted EXE header\n", filename );
FS_Close( f );
@ -159,7 +157,7 @@ bool Sys_LoadSymbols( const char *filename )
if( !com.strcmp((char *)section_header.Name, ".edata" ))
{
edata_found = TRUE;
edata_found = true;
break;
}
}
@ -172,7 +170,7 @@ bool Sys_LoadSymbols( const char *filename )
else
{
edata_offset = optional_header.DataDirectory[0].VirtualAddress;
edata_delta = 0L;
edata_delta = 0;
}
if( FS_Seek( f, edata_offset, SEEK_SET ) == -1 )
@ -191,7 +189,7 @@ bool Sys_LoadSymbols( const char *filename )
svgame.num_ordinals = export_directory.NumberOfNames; // also number of ordinals
if( svgame.num_ordinals > MAX_SYSPATH )
if( svgame.num_ordinals > 4096 )
{
MsgDev( D_ERROR, "Sys_LoadSymbols: %s too many exports\n", filename );
FS_Close( f );
@ -207,7 +205,7 @@ bool Sys_LoadSymbols( const char *filename )
return false;
}
svgame.ordinals = Z_Malloc( svgame.num_ordinals * sizeof( word ));
svgame.ordinals = Mem_Alloc( svgame.private, svgame.num_ordinals * sizeof( word ));
if( FS_Read( f, svgame.ordinals, svgame.num_ordinals * sizeof( word )) != (svgame.num_ordinals * sizeof( word )))
{
@ -225,7 +223,7 @@ bool Sys_LoadSymbols( const char *filename )
return false;
}
svgame.funcs = Z_Malloc( svgame.num_ordinals * sizeof( dword ));
svgame.funcs = Mem_Alloc( svgame.private, svgame.num_ordinals * sizeof( dword ));
if( FS_Read( f, svgame.funcs, svgame.num_ordinals * sizeof( dword )) != (svgame.num_ordinals * sizeof( dword )))
{
@ -245,7 +243,7 @@ bool Sys_LoadSymbols( const char *filename )
return false;
}
p_Names = Z_Malloc( svgame.num_ordinals * sizeof( dword ));
p_Names = Mem_Alloc( svgame.private, svgame.num_ordinals * sizeof( dword ));
if( FS_Read( f, p_Names, svgame.num_ordinals * sizeof( dword )) != (svgame.num_ordinals * sizeof( dword )))
{
@ -293,94 +291,24 @@ bool Sys_LoadSymbols( const char *filename )
break;
}
}
if( p_Names ) Mem_Free( p_Names );
return true;
}
/*
============
SV_CalcBBox
FIXME: get to work
============
*/
void SV_CalcBBox( edict_t *ent, const float *mins, const float *maxs )
void SV_SetMinMaxSize( edict_t *e, const float *min, const float *max )
{
vec3_t rmin, rmax;
int i, j, k, l;
float a, *angles;
vec3_t bounds[2];
float xvector[2], yvector[2];
vec3_t base, transformed;
// find min / max for rotations
angles = ent->v.angles;
a = angles[1]/180 * M_PI;
xvector[0] = cos(a);
xvector[1] = sin(a);
yvector[0] = -sin(a);
yvector[1] = cos(a);
VectorCopy( mins, bounds[0] );
VectorCopy( maxs, bounds[1] );
rmin[0] = rmin[1] = rmin[2] = 9999;
rmax[0] = rmax[1] = rmax[2] = -9999;
for( i = 0; i <= 1; i++ )
{
base[0] = bounds[i][0];
for( j = 0; j <= 1; j++ )
{
base[1] = bounds[j][1];
for( k = 0; k <= 1; k++ )
{
base[2] = bounds[k][2];
// transform the point
transformed[0] = xvector[0] * base[0] + yvector[0] * base[1];
transformed[1] = xvector[1] * base[0] + yvector[1] * base[1];
transformed[2] = base[2];
for( l = 0; l < 3; l++ )
{
if( transformed[l] < rmin[l] ) rmin[l] = transformed[l];
if( transformed[l] > rmax[l] ) rmax[l] = transformed[l];
}
}
}
}
VectorCopy( rmin, ent->v.mins );
VectorCopy( rmax, ent->v.maxs );
}
void SV_SetMinMaxSize( edict_t *e, const float *min, const float *max, bool rotate )
{
int i;
int i;
for( i = 0; i < 3; i++ )
if( min[i] > max[i] )
Host_Error( "SV_SetMinMaxSize: backwards mins/maxs\n" );
rotate = false; // FIXME
// set derived values
if( rotate && e->v.solid == SOLID_BBOX )
{
SV_CalcBBox( e, min, max );
}
else
{
VectorCopy( min, e->v.mins);
VectorCopy( max, e->v.maxs);
}
VectorCopy( min, e->v.mins );
VectorCopy( max, e->v.maxs );
VectorSubtract( max, min, e->v.size );
// TODO: fill also mass and density
SV_LinkEdict (e);
SV_LinkEdict( e );
}
void SV_CopyTraceResult( TraceResult *out, trace_t trace )
@ -476,7 +404,7 @@ bool SV_CheckForPhysobject( edict_t *ent )
case SOLID_SPHERE:
case SOLID_CYLINDER:
case SOLID_MESH:
switch( (int)ent->v.movetype )
switch( ent->v.movetype )
{
case MOVETYPE_PHYSIC: // dynamic physobject (with gravity)
return true;
@ -529,11 +457,11 @@ void SV_SetModel( edict_t *ent, const char *name )
{
case mod_brush:
case mod_sprite:
SV_SetMinMaxSize( ent, mod->mins, mod->maxs, false );
SV_SetMinMaxSize( ent, mod->mins, mod->maxs );
break;
case mod_studio:
case mod_bad:
SV_SetMinMaxSize( ent, vec3_origin, vec3_origin, false );
SV_SetMinMaxSize( ent, vec3_origin, vec3_origin );
break;
}
@ -565,35 +493,35 @@ float SV_AngleMod( float ideal, float current, float speed )
{
float move;
if (current == ideal) // already there?
if( current == ideal ) // already there?
return anglemod( current );
move = ideal - current;
if (ideal > current)
if( ideal > current )
{
if (move >= 180) move = move - 360;
if( move >= 180 ) move = move - 360;
}
else
{
if (move <= -180) move = move + 360;
if( move <= -180 ) move = move + 360;
}
if (move > 0)
if( move > 0 )
{
if (move > speed) move = speed;
if( move > speed ) move = speed;
}
else
{
if (move < -speed) move = -speed;
if( move < -speed ) move = -speed;
}
return anglemod(current + move);
return anglemod( current + move );
}
void SV_ConfigString( int index, const char *val )
{
if(index < 0 || index >= MAX_CONFIGSTRINGS)
Host_Error ("configstring: bad index %i value %s\n", index, val);
if( index < 0 || index >= MAX_CONFIGSTRINGS )
Host_Error( "SV_ConfigString: bad index %i value %s\n", index, val );
if(!*val) val = "";
if( !val || !*val ) val = "";
// change the string in sv
com.strcpy( sv.configstrings[index], val );
@ -602,38 +530,38 @@ void SV_ConfigString( int index, const char *val )
{
// send the update to everyone
MSG_Clear( &sv.multicast );
MSG_Begin(svc_configstring);
MSG_WriteShort (&sv.multicast, index);
MSG_WriteString (&sv.multicast, (char *)val);
MSG_Send(MSG_ALL_R, vec3_origin, NULL );
MSG_Begin( svc_configstring );
MSG_WriteShort( &sv.multicast, index );
MSG_WriteString( &sv.multicast, val );
MSG_Send( MSG_ALL_R, vec3_origin, NULL );
}
}
bool SV_EntitiesIn( bool mode, vec3_t v1, vec3_t v2 )
static bool SV_EntitiesIn( int mode, vec3_t v1, vec3_t v2 )
{
int leafnum, cluster;
int area1, area2;
byte *mask;
leafnum = pe->PointLeafnum (v1);
cluster = pe->LeafCluster (leafnum);
area1 = pe->LeafArea (leafnum);
leafnum = pe->PointLeafnum( v1 );
cluster = pe->LeafCluster( leafnum );
area1 = pe->LeafArea( leafnum );
if( mode == DVIS_PHS ) mask = pe->ClusterPHS( cluster );
else if( mode == DVIS_PVS ) mask = pe->ClusterPVS( cluster );
else Host_Error( "SV_EntitiesIn: unsupported mode\n" );
else Host_Error( "SV_EntitiesIn: ?\n" );
leafnum = pe->PointLeafnum (v2);
cluster = pe->LeafCluster (leafnum);
area2 = pe->LeafArea (leafnum);
leafnum = pe->PointLeafnum( v2 );
cluster = pe->LeafCluster( leafnum );
area2 = pe->LeafArea( leafnum );
if( mask && (!(mask[cluster>>3] & (1<<(cluster&7)))))
if( mask && (!( mask[cluster>>3] & (1<<( cluster & 7 )) )))
return false;
else if (!pe->AreasConnected (area1, area2))
else if( !pe->AreasConnected( area1, area2 ))
return false;
return true;
}
void SV_InitEdict( edict_t *pEdict )
static void SV_InitEdict( edict_t *pEdict )
{
Com_Assert( pEdict == NULL );
Com_Assert( pEdict->pvPrivateData != NULL );
@ -673,6 +601,7 @@ void SV_FreeEdict( edict_t *pEdict )
edict_t *SV_AllocEdict( void )
{
edict_t *pEdict;
float time = sv.time * 0.001;
int i;
for( i = svgame.globals->maxClients + 1; i < svgame.globals->numEntities; i++ )
@ -680,7 +609,7 @@ edict_t *SV_AllocEdict( void )
pEdict = EDICT_NUM( i );
// the first couple seconds of server time can involve a lot of
// freeing and allocating, so relax the replacement policy
if( pEdict->free && ( pEdict->freetime < 2.0f || ((sv.time * 0.001f) - pEdict->freetime) > 0.5f ))
if( pEdict->free && ( pEdict->freetime < 2.0 || time - pEdict->freetime > 0.5 ))
{
SV_InitEdict( pEdict );
return pEdict;
@ -756,11 +685,11 @@ void SV_FreeEdicts( void )
/*
===============================================================================
Game Builtin Functions
===============================================================================
*/
/*
=========
pfnMemAlloc
@ -892,8 +821,7 @@ void pfnSetSize( edict_t *e, const float *rgflMin, const float *rgflMax )
MsgDev( D_ERROR, "SV_SetSize: can't modify free entity\n" );
return;
}
SV_SetMinMaxSize( e, rgflMin, rgflMax, !VectorIsNull( e->v.angles ));
SV_SetMinMaxSize( e, rgflMin, rgflMax );
}
/*
@ -1053,30 +981,27 @@ pfnFindEntityByString
*/
edict_t* pfnFindEntityByString( edict_t *pStartEdict, const char *pszField, const char *pszValue )
{
int f, e = 0;
edict_t *ed;
int index = 0, e = 0;
int m_iValue;
float m_flValue;
const float *m_vecValue;
vec3_t m_vecValue2;
edict_t *ed, *ed2;
TYPEDESCRIPTION *desc = NULL;
const char *t;
if( pStartEdict ) e = NUM_FOR_EDICT( pStartEdict );
if( !pszValue || !*pszValue ) return NULL;
// FIXME: make table with hints
if( !com.strcmp( pszField, "classname" ))
f = EOFS( classname );
else if( !com.strcmp( pszField, "globalname" ))
f = EOFS( globalname );
else if( !com.strcmp( pszField, "targetname" ))
f = EOFS( targetname );
else if( !com.strcmp( pszField, "target" ))
f = EOFS( target );
else if( !com.strcmp( pszField, "netname" ))
f = EOFS( netname );
else if( !com.strcmp( pszField, "model" ))
f = EOFS( model );
else
while((desc = svgame.dllFuncs.pfnGetEntvarsDescirption( index++ )) != NULL )
{
// FIXME: make cases for all fileds
MsgDev( D_ERROR, "field %s unsupported\n", pszField );
if( !com.strcmp( pszField, desc->fieldName ))
break;
}
if( desc == NULL )
{
MsgDev( D_ERROR, "SV_FindEntityByString: field %s not found\n", pszField );
return pStartEdict;
}
@ -1085,10 +1010,49 @@ edict_t* pfnFindEntityByString( edict_t *pStartEdict, const char *pszField, cons
ed = EDICT_NUM( e );
if( ed->free ) continue;
t = STRING( *(string_t *)&((byte *)&ed->v)[f] );
if( !t ) t = "";
if( !com.strcmp( t, pszValue ))
return ed;
switch( desc->fieldType )
{
case FIELD_STRING:
case FIELD_MODELNAME:
case FIELD_SOUNDNAME:
t = STRING( *(string_t *)&((byte *)&ed->v)[desc->fieldOffset] );
if( !t ) t = "";
if( !com.strcmp( t, pszValue ))
return ed;
break;
case FIELD_SHORT:
m_iValue = *(short *)&((byte *)&ed->v)[desc->fieldOffset];
if( m_iValue == com.atoi( pszValue ))
return ed;
break;
case FIELD_INTEGER:
case FIELD_BOOLEAN:
m_iValue = *(int *)&((byte *)&ed->v)[desc->fieldOffset];
if( m_iValue == com.atoi( pszValue ))
return ed;
break;
case FIELD_TIME:
case FIELD_FLOAT:
m_flValue = *(int *)&((byte *)&ed->v)[desc->fieldOffset];
if( m_flValue == com.atof( pszValue ))
return ed;
break;
case FIELD_VECTOR:
case FIELD_POSITION_VECTOR:
m_vecValue = (float *)&((byte *)&ed->v)[desc->fieldOffset];
if( !m_vecValue ) m_vecValue = vec3_origin;
com.atov( m_vecValue2, pszValue, 3 );
if( VectorCompare( m_vecValue, m_vecValue2 ))
return ed;
break;
case FIELD_EDICT:
// NOTE: string must be contain an edict number
ed2 = (edict_t *)&((byte *)&ed->v)[desc->fieldOffset];
if( !ed2 ) ed2 = svgame.edicts;
if( NUM_FOR_EDICT( ed2 ) == com.atoi( pszValue ))
return ed;
break;
}
}
return NULL;
}

View File

@ -188,7 +188,7 @@ static void SV_SaveServerData( wfile_t *f )
// initialize game header
ghdr.mapCount = svs.spawncount;
com.strncpy( ghdr.mapName, svs.mapname, CS_SIZE );
com.strncpy( ghdr.comment, svs.comment, MAX_STRING );
Mem_Copy( ghdr.comment, svs.comment, MAX_STRING );
// initialize ENTITYTABLE
pSaveData->tableCount = svgame.globals->numEntities;
@ -229,7 +229,7 @@ static void SV_SaveServerData( wfile_t *f )
pSaveData->currentIndex++; // move pointer
}
SV_SaveBuffer( f, LUMP_ENTITIES, false );
SV_SaveBuffer( f, LUMP_BASEENTS, false );
// write entity table
for( i = 0; i < pSaveData->tableCount; i++ )
@ -300,7 +300,7 @@ void SV_WriteSaveFile( const char *name, bool autosave )
// split comment to sections
com.strncpy( svs.comment, sv.configstrings[CS_NAME], CS_SIZE );
com.strncpy( svs.comment + CS_SIZE, timestamp( TIME_DATE_ONLY ), CS_TIME );
com.strncpy( svs.comment + CS_SIZE + CS_TIME, timestamp( TIME_TIME_ONLY ), CS_TIME );
com.strncpy( svs.comment + CS_SIZE + CS_TIME, timestamp( TIME_NO_SECONDS ), CS_TIME );
com.strncpy( svs.comment + CS_SIZE + (CS_TIME * 2), svs.mapname, CS_SIZE );
MsgDev( D_INFO, "Saving game..." );
@ -332,7 +332,7 @@ void SV_ReadComment( wfile_t *l )
// read game header
svgame.dllFuncs.pfnSaveReadFields( pSaveData, "Game Header", &ghdr, gGameHeader, ARRAYSIZE( gGameHeader ));
com.strncpy( svs.comment, ghdr.comment, CS_SIZE );
Mem_Copy( svs.comment, ghdr.comment, MAX_STRING );
if( svgame.SaveData.pTokens ) Mem_Free( svgame.SaveData.pTokens );
Mem_Set( &svgame.SaveData, 0, sizeof( SAVERESTOREDATA ));
}
@ -407,7 +407,7 @@ void SV_ReadGlobals( wfile_t *l )
svgame.dllFuncs.pfnSaveReadFields( pSaveData, "Game Header", &ghdr, gGameHeader, ARRAYSIZE( gGameHeader ));
svs.spawncount = ghdr.mapCount; // restore spawncount
com.strncpy( svs.comment, ghdr.comment, MAX_STRING );
Mem_Copy( svs.comment, ghdr.comment, MAX_STRING );
com.strncpy( svs.mapname, ghdr.mapName, MAX_STRING );
// restore global state
@ -474,7 +474,7 @@ void SV_ReadEntities( wfile_t *l )
pTable->pent = pent;
}
SV_ReadBuffer( l, LUMP_ENTITIES );
SV_ReadBuffer( l, LUMP_BASEENTS );
pSaveData->fUseLandmark = true;
// and read entities ...
@ -576,7 +576,7 @@ bool SV_GetComment( char *comment, int savenum )
savfile = WAD_Open( va( "save/save%i.bin", savenum ), "rb" );
SV_ReadComment( savfile );
com.strncpy( comment, svs.comment, MAX_STRING );
Mem_Copy( comment, svs.comment, MAX_STRING );
WAD_Close( savfile );
return true;

View File

@ -46,10 +46,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
typedef struct
{
char map[80];
char time[16];
char date[16];
char name[32];
char map[CS_SIZE];
char time[CS_TIME];
char date[CS_TIME];
char name[CS_SIZE];
bool valid;
} uiLoadGameGame_t;
@ -109,10 +109,10 @@ static void UI_LoadGame_GetGameList( void )
continue;
}
Mem_Copy( uiLoadGame.games[i].map, name + CS_SIZE + (CS_TIME * 2), CS_SIZE );
Mem_Copy( uiLoadGame.games[i].time, name + CS_SIZE + CS_TIME, CS_TIME );
Mem_Copy( uiLoadGame.games[i].date, name + CS_TIME, CS_TIME );
Mem_Copy( uiLoadGame.games[i].name, name, CS_SIZE );
com.strncpy( uiLoadGame.games[i].map, name + CS_SIZE + (CS_TIME * 2), CS_SIZE );
com.strncpy( uiLoadGame.games[i].time, name + CS_SIZE + CS_TIME, CS_TIME );
com.strncpy( uiLoadGame.games[i].date, name + CS_SIZE, CS_TIME );
com.strncpy( uiLoadGame.games[i].name, name, CS_SIZE );
uiLoadGame.games[i].valid = true;
}
@ -255,7 +255,7 @@ static void UI_LoadGame_Ownerdraw( void *self )
if( uiLoadGame.games[uiLoadGame.currentGame].map[0] )
{
string pathTGA, pathJPG;
string pathJPG;
if( uiStatic.realTime - uiLoadGame.fadeTime >= 3000 )
{
@ -271,16 +271,11 @@ static void UI_LoadGame_Ownerdraw( void *self )
color[3] = bound( 0.0f, (float)(uiStatic.realTime - uiLoadGame.fadeTime) * 0.001f, 1.0f ) * 255;
com.snprintf( pathTGA, sizeof( pathTGA ), "gfx/shell/menu_levelshots/%s_1.tga", uiLoadGame.games[uiLoadGame.currentGame].map);
com.snprintf( pathJPG, sizeof( pathJPG ), "gfx/shell/menu_levelshots/%s_1.jpg", uiLoadGame.games[uiLoadGame.currentGame].map);
com.snprintf( pathJPG, sizeof( pathJPG ), "save/save%i.jpg", uiLoadGame.currentGame );
if( !FS_FileExists( pathTGA ) && !FS_FileExists( pathJPG ))
if( !FS_FileExists( pathJPG ))
UI_DrawPic( x, y, w, h, uiColorWhite, "gfx/shell/menu_levelshots/unknownmap" );
else
{
UI_DrawPic( x, y, w, h, uiColorWhite, va( "gfx/shell/menu_levelshots/%s_%i", uiLoadGame.games[uiLoadGame.currentGame].map, prev + 1 ));
UI_DrawPic( x, y, w, h, color, va( "gfx/shell/menu_levelshots/%s_%i", uiLoadGame.games[uiLoadGame.currentGame].map, uiLoadGame.currentLevelShot + 1 ));
}
else UI_DrawPic( x, y, w, h, uiColorWhite, pathJPG );
}
else UI_DrawPic( x, y, w, h, uiColorWhite, "gfx/shell/menu_levelshots/unknownmap" );

View File

@ -104,10 +104,10 @@ static void UI_SaveGame_GetGameList( void )
continue;
}
Mem_Copy( uiSaveGame.games[i].map, name + CS_SIZE + (CS_TIME * 2), CS_SIZE );
Mem_Copy( uiSaveGame.games[i].time, name + CS_SIZE + CS_TIME, CS_TIME );
Mem_Copy( uiSaveGame.games[i].date, name + CS_TIME, CS_TIME );
Mem_Copy( uiSaveGame.games[i].name, name, CS_SIZE );
com.strncpy( uiSaveGame.games[i].map, name + CS_SIZE + (CS_TIME * 2), CS_SIZE );
com.strncpy( uiSaveGame.games[i].time, name + CS_SIZE + CS_TIME, CS_TIME );
com.strncpy( uiSaveGame.games[i].date, name + CS_SIZE, CS_TIME );
com.strncpy( uiSaveGame.games[i].name, name, CS_SIZE );
uiSaveGame.games[i].valid = true;
}
@ -257,7 +257,7 @@ static void UI_SaveGame_Ownerdraw( void *self )
if( uiSaveGame.games[uiSaveGame.currentGame].map[0] )
{
string pathTGA, pathJPG;
string pathJPG;
if( uiStatic.realTime - uiSaveGame.fadeTime >= 3000 )
{
@ -273,16 +273,11 @@ static void UI_SaveGame_Ownerdraw( void *self )
color[3] = bound( 0.0f, (float)(uiStatic.realTime - uiSaveGame.fadeTime) * 0.001f, 1.0f ) * 255;
com.snprintf( pathTGA, sizeof( pathTGA ), "gfx/shell/menu_levelshots/%s_1.tga", uiSaveGame.games[uiSaveGame.currentGame].map);
com.snprintf( pathJPG, sizeof( pathJPG ), "gfx/shell/menu_levelshots/%s_1.jpg", uiSaveGame.games[uiSaveGame.currentGame].map);
com.snprintf( pathJPG, sizeof( pathJPG ), "save/save%i.jpg", uiSaveGame.currentGame );
if( !FS_FileExists( pathTGA ) && !FS_FileExists( pathJPG ))
if( !FS_FileExists( pathJPG ))
UI_DrawPic( x, y, w, h, uiColorWhite, "gfx/shell/menu_levelshots/unknownmap" );
else
{
UI_DrawPic( x, y, w, h, uiColorWhite, va( "gfx/shell/menu_levelshots/%s_%i", uiSaveGame.games[uiSaveGame.currentGame].map, prev + 1 ));
UI_DrawPic( x, y, w, h, color, va( "gfx/shell/menu_levelshots/%s_%i", uiSaveGame.games[uiSaveGame.currentGame].map, uiSaveGame.currentLevelShot + 1 ));
}
else UI_DrawPic( x, y, w, h, uiColorWhite, pathJPG );
}
else UI_DrawPic( x, y, w, h, uiColorWhite, "gfx/shell/menu_levelshots/unknownmap" );

View File

@ -517,13 +517,17 @@ const char* com_timestamp( int format )
strftime(timestring, sizeof (timestring), "%H:%M.%S", crt_tm);
break;
case TIME_NO_SECONDS:
// Build a timestamp that can use for filename (ex: "Nov2006-26 (19.14)");
strftime(timestring, sizeof (timestring), "%b%Y-%d (%H.%M)", crt_tm);
// Build the time stamp exclude seconds (ex: "13:46");
strftime(timestring, sizeof (timestring), "%H:%M", crt_tm);
break;
case TIME_YEAR_ONLY:
// Build the date stamp year only (ex: "2006");
strftime(timestring, sizeof (timestring), "%Y", crt_tm);
break;
case TIME_FILENAME:
// Build a timestamp that can use for filename (ex: "Nov2006-26 (19.14)");
strftime(timestring, sizeof (timestring), "%b%Y-%d (%H.%M)", crt_tm);
break;
default: return NULL;
}

View File

@ -339,7 +339,7 @@ void Sys_LookupInstance( void )
Sys.con_showalways = false;
}
Sys.linked_dll = &engine_dll; // pointer to engine.dll info
com_sprintf( Sys.log_path, "engine.log", com_timestamp( TIME_NO_SECONDS )); // logs folder
com_sprintf( Sys.log_path, "engine.log", com_timestamp( TIME_FILENAME )); // logs folder
com_strcpy(Sys.caption, va("Xash3D ver.%g", XASH_VERSION ));
}
else if( !com_strcmp( Sys.progname, "bsplib" ))

View File

@ -102,6 +102,7 @@ enum
TIME_TIME_ONLY,
TIME_NO_SECONDS,
TIME_YEAR_ONLY,
TIME_FILENAME,
};
// cvar flags

View File

@ -533,7 +533,7 @@ _inline void Matrix4x4_CreateRotate( matrix4x4 out, float angle, float x, float
y *= len;
z *= len;
angle *= (-M_PI / 180.0);
angle *= (-M_PI / 180.0f);
c = com.cos( angle );
s = com.sin( angle );

View File

@ -705,9 +705,8 @@ included global, and both (client & server) pent list
#define LUMP_ENTTABLE "enttable" // entity transition table
#define LUMP_ADJACENCY "adjacency" // Save Header + ADJACENCY
#define LUMP_GLOBALS "global_data" // Game Header + Global State
#define LUMP_GAMECVARS "latched_cvars"
#define LUMP_GAMECVARS "latched_cvars" // sv.latched_cvars
#define LUMP_HASHTABLE "hashtable" // contains string_t only for used hash-values
#define LUMP_SNAPSHOT "saveshot" // currently not implemented
#define DENT_KEY 0
#define DENT_VAL 1

View File

@ -2028,6 +2028,7 @@ void R_BeginRegistration( const char *mapname, const dvis_t *visData )
// update progress bar
Cvar_SetValue( "scr_loading", 50.0f );
if( ri.UpdateScreen ) ri.UpdateScreen();
R_StudioFreeAllExtradata (); // load game issues
}
if( r_lighting_packlightmaps->integer )

View File

@ -82,6 +82,7 @@ void R_StudioFreeAllExtradata( void )
Mem_FreePool( &r_entities[i].mempool );
r_entities[i].extradata = NULL;
}
Mem_Set( r_entities, 0, sizeof( r_entities ));
}
void R_StudioAllocExtradata( edict_t *in, ref_entity_t *e )

View File

@ -630,7 +630,6 @@ void CSprite::Spawn( void )
}
SetBits( pev->flags, FL_POINTENTITY );
TurnOff();
}
void CSprite::PostSpawn( void )
@ -694,7 +693,7 @@ void CSprite::Move( void )
if ( m_flDelay > gpGlobals->time )
pev->speed = UTIL_Approach( 0, pev->speed, 5 * gpGlobals->frametime );
else pev->speed = UTIL_Approach( pev->armorvalue, pev->speed, 5 * gpGlobals->frametime );
else pev->speed = UTIL_Approach( pev->armorvalue, pev->speed, 5 * gpGlobals->frametime );
float fraction = 2 * gpGlobals->frametime;
UTIL_SetVelocity( this, ((pev->movedir * pev->speed) * fraction) + (pev->velocity * (1-fraction)));
@ -704,7 +703,7 @@ void CSprite::TurnOff( void )
{
SetBits( pev->effects, EF_NODRAW );
m_iState = STATE_OFF;
if(m_pGoalEnt) m_pGoalEnt = m_pGoalEnt->GetPrev();
if( m_pGoalEnt ) m_pGoalEnt = m_pGoalEnt->GetPrev();
UTIL_SetVelocity( this, g_vecZero );
DontThink();
}

View File

@ -21,6 +21,7 @@ public:
TurnOn();
ClearBits( pev->spawnflags, SF_START_ON );
}
else TurnOff();
}
void Think( void );

View File

@ -43,6 +43,7 @@ static DLL_FUNCTIONS gFunctionTable =
DispatchRestore, // pfnRestore
DispatchObjectCollsionBox, // pfnAbsBox
GetEntvarsDescirption, // pfnGetEntvarsDescirption
SaveWriteFields, // pfnSaveWriteFields
SaveReadFields, // pfnSaveReadFields

View File

@ -38,6 +38,7 @@ extern void DispatchBlocked( edict_t *pentBlocked, edict_t *pentOther );
extern void DispatchSave( edict_t *pent, SAVERESTOREDATA *pSaveData );
extern int DispatchRestore( edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity );
extern void DispatchObjectCollsionBox( edict_t *pent );
extern TYPEDESCRIPTION *GetEntvarsDescirption( int number );
extern int ServerClassifyEdict( edict_t *pentToClassify );
extern void UpdateEntityState( struct entity_state_s *to, edict_t *from, int baseline );
extern void SaveWriteFields( SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount );

View File

@ -136,6 +136,13 @@ TYPEDESCRIPTION gEntvarsDescription[] =
DEFINE_ENTITY_FIELD( speed, FIELD_FLOAT ),
};
// used by engine for FindEntityByString and some other things
TYPEDESCRIPTION *GetEntvarsDescirption( int number )
{
if( number < 0 && number >= ENTVARS_COUNT )
return NULL;
return &gEntvarsDescription[number];
}
// --------------------------------------------------------------
//

View File

@ -41,10 +41,6 @@
extern globalvars_t *gpGlobals;
#pragma warning( disable : 4244 )
int ExtractBbox( void *pmodel, int sequence, float *mins, float *maxs )
{
dstudiohdr_t *pstudiohdr;

102
server/server.plg Normal file
View File

@ -0,0 +1,102 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: server - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPA9A2.tmp" with contents
[
/nologo /MD /W3 /O2 /I "./" /I "ents" /I "game" /I "global" /I "monsters" /I "../common" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fo"..\temp\server\!release/" /Fd"..\temp\server\!release/" /FD /c
"D:\Xash3D\src_main\server\monsters\animation.cpp"
]
Creating command line "cl.exe @C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPA9A2.tmp"
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPA9A3.tmp" with contents
[
msvcrt.lib /nologo /subsystem:windows /dll /pdb:none /machine:I386 /nodefaultlib:"libc.lib" /def:".\server.def" /out:"..\temp\server\!release/server.dll" /implib:"..\temp\server\!release/server.lib" /libpath:"..\common\libs"
"\Xash3D\src_main\temp\server\!release\ai_sound.obj"
"\Xash3D\src_main\temp\server\!release\animating.obj"
"\Xash3D\src_main\temp\server\!release\animation.obj"
"\Xash3D\src_main\temp\server\!release\apache.obj"
"\Xash3D\src_main\temp\server\!release\barnacle.obj"
"\Xash3D\src_main\temp\server\!release\barney.obj"
"\Xash3D\src_main\temp\server\!release\basebrush.obj"
"\Xash3D\src_main\temp\server\!release\baseentity.obj"
"\Xash3D\src_main\temp\server\!release\basefunc.obj"
"\Xash3D\src_main\temp\server\!release\basefx.obj"
"\Xash3D\src_main\temp\server\!release\baseinfo.obj"
"\Xash3D\src_main\temp\server\!release\baseitem.obj"
"\Xash3D\src_main\temp\server\!release\baselogic.obj"
"\Xash3D\src_main\temp\server\!release\basemonster.obj"
"\Xash3D\src_main\temp\server\!release\basemover.obj"
"\Xash3D\src_main\temp\server\!release\baseother.obj"
"\Xash3D\src_main\temp\server\!release\basepath.obj"
"\Xash3D\src_main\temp\server\!release\basephys.obj"
"\Xash3D\src_main\temp\server\!release\baserockets.obj"
"\Xash3D\src_main\temp\server\!release\basetank.obj"
"\Xash3D\src_main\temp\server\!release\basetrigger.obj"
"\Xash3D\src_main\temp\server\!release\baseutil.obj"
"\Xash3D\src_main\temp\server\!release\baseweapon.obj"
"\Xash3D\src_main\temp\server\!release\baseworld.obj"
"\Xash3D\src_main\temp\server\!release\client.obj"
"\Xash3D\src_main\temp\server\!release\combat.obj"
"\Xash3D\src_main\temp\server\!release\decals.obj"
"\Xash3D\src_main\temp\server\!release\defaultai.obj"
"\Xash3D\src_main\temp\server\!release\dll_int.obj"
"\Xash3D\src_main\temp\server\!release\flyingmonster.obj"
"\Xash3D\src_main\temp\server\!release\game.obj"
"\Xash3D\src_main\temp\server\!release\gamerules.obj"
"\Xash3D\src_main\temp\server\!release\generic.obj"
"\Xash3D\src_main\temp\server\!release\globals.obj"
"\Xash3D\src_main\temp\server\!release\gman.obj"
"\Xash3D\src_main\temp\server\!release\hassassin.obj"
"\Xash3D\src_main\temp\server\!release\headcrab.obj"
"\Xash3D\src_main\temp\server\!release\hgrunt.obj"
"\Xash3D\src_main\temp\server\!release\leech.obj"
"\Xash3D\src_main\temp\server\!release\legacy.obj"
"\Xash3D\src_main\temp\server\!release\lights.obj"
"\Xash3D\src_main\temp\server\!release\multiplay_gamerules.obj"
"\Xash3D\src_main\temp\server\!release\nodes.obj"
"\Xash3D\src_main\temp\server\!release\osprey.obj"
"\Xash3D\src_main\temp\server\!release\parent.obj"
"\Xash3D\src_main\temp\server\!release\player.obj"
"\Xash3D\src_main\temp\server\!release\rat.obj"
"\Xash3D\src_main\temp\server\!release\roach.obj"
"\Xash3D\src_main\temp\server\!release\saverestore.obj"
"\Xash3D\src_main\temp\server\!release\scientist.obj"
"\Xash3D\src_main\temp\server\!release\scripted.obj"
"\Xash3D\src_main\temp\server\!release\sfx.obj"
"\Xash3D\src_main\temp\server\!release\singleplay_gamerules.obj"
"\Xash3D\src_main\temp\server\!release\sound.obj"
"\Xash3D\src_main\temp\server\!release\squadmonster.obj"
"\Xash3D\src_main\temp\server\!release\talkmonster.obj"
"\Xash3D\src_main\temp\server\!release\teamplay_gamerules.obj"
"\Xash3D\src_main\temp\server\!release\turret.obj"
"\Xash3D\src_main\temp\server\!release\utils.obj"
"\Xash3D\src_main\temp\server\!release\weapon_generic.obj"
"\Xash3D\src_main\temp\server\!release\zombie.obj"
"\Xash3D\src_main\temp\server\!release\spectator.obj"
]
Creating command line "link.exe @C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPA9A3.tmp"
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPA9A4.bat" with contents
[
@echo off
copy \Xash3D\src_main\temp\server\!release\server.dll "D:\Xash3D\bin\server.dll"
]
Creating command line "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPA9A4.bat"
Compiling...
animation.cpp
Linking...
Creating library ..\temp\server\!release/server.lib and object ..\temp\server\!release/server.exp
<h3>Output Window</h3>
Performing Custom Build Step on \Xash3D\src_main\temp\server\!release\server.dll
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.
<h3>Results</h3>
server.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -150,3 +150,5 @@ Beta 13.12.09
123. fixup studio EF_ANIMATE OK
124. fixup studio events on client-side OK
125. sort & implement engfuncs on server.dll
126. implement trace from Quake3
127. debug sv.edicts and cl.edicts management

View File

@ -547,7 +547,7 @@ void WriteIBSPFile( const char *filename )
FS_Write( file, (bspHeader_t*)header, sizeof( *header )); /* overwritten later */
// add marker lump
com.sprintf( marker, "Written by Xash BspLib at %s)", timestamp( TIME_NO_SECONDS ));
com.sprintf( marker, "Written by Xash BspLib at %s)", timestamp( TIME_FILENAME ));
AddLump( file, (bspHeader_t*) header, 0, marker, com.strlen( marker ) + 1 );
/* add lumps */

View File

@ -290,7 +290,7 @@ void WriteRBSPFile( const char *filename )
FS_Write( file, (bspHeader_t *)header, sizeof( *header )); /* overwritten later */
// add marker lump
com.sprintf( marker, "Written by Xash BspLib at %s)", timestamp( TIME_NO_SECONDS ));
com.sprintf( marker, "Written by Xash BspLib at %s)", timestamp( TIME_FILENAME ));
AddLump( file, (bspHeader_t*) header, 0, marker, com.strlen( marker ) + 1 );
/* add lumps */

View File

@ -40,11 +40,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/* dependencies */
#include "picointernal.h"
/* disable warnings */
#ifdef _WIN32
#pragma warning( disable:4100 ) /* unref param */
#endif
/* remarks:
* - loader seems stable
* todo:

View File

@ -41,11 +41,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "picointernal.h"
#include "stdio.h" // sscanf
/* disable warnings */
#ifdef _WIN32
#pragma warning( disable:4100 ) /* unref param */
#endif
/* todo:
* - '_obj_load' code crashes in a weird way after
* '_obj_mtl_load' for a few .mtl files

102
xtools/xtools.plg Normal file
View File

@ -0,0 +1,102 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: xtools - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPA9B0.tmp" with contents
[
/nologo /MD /W3 /GX /O2 /I "./" /I "../public" /I "bsplib" /I "models" /I "ripper" /I "../common" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fo"..\temp\xtools\!release/" /Fd"..\temp\xtools\!release/" /FD /c
"D:\Xash3D\src_main\xtools\models\pm_obj.c"
]
Creating command line "cl.exe @C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPA9B0.tmp"
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPA9B1.tmp" with contents
[
msvcrt.lib /nologo /dll /pdb:none /machine:I386 /nodefaultlib:"libc.lib" /out:"..\temp\xtools\!release/xtools.dll" /implib:"..\temp\xtools\!release/xtools.lib" /opt:nowin98
"\Xash3D\src_main\temp\xtools\!release\brush.obj"
"\Xash3D\src_main\temp\xtools\!release\brush_primit.obj"
"\Xash3D\src_main\temp\xtools\!release\bsp.obj"
"\Xash3D\src_main\temp\xtools\!release\bspfile_abstract.obj"
"\Xash3D\src_main\temp\xtools\!release\bspfile_ibsp.obj"
"\Xash3D\src_main\temp\xtools\!release\bspfile_rbsp.obj"
"\Xash3D\src_main\temp\xtools\!release\bsplib.obj"
"\Xash3D\src_main\temp\xtools\!release\conv_bsplumps.obj"
"\Xash3D\src_main\temp\xtools\!release\conv_doom.obj"
"\Xash3D\src_main\temp\xtools\!release\conv_image.obj"
"\Xash3D\src_main\temp\xtools\!release\conv_main.obj"
"\Xash3D\src_main\temp\xtools\!release\conv_shader.obj"
"\Xash3D\src_main\temp\xtools\!release\conv_sprite.obj"
"\Xash3D\src_main\temp\xtools\!release\convert_ase.obj"
"\Xash3D\src_main\temp\xtools\!release\convert_map.obj"
"\Xash3D\src_main\temp\xtools\!release\decals.obj"
"\Xash3D\src_main\temp\xtools\!release\facebsp.obj"
"\Xash3D\src_main\temp\xtools\!release\fog.obj"
"\Xash3D\src_main\temp\xtools\!release\image.obj"
"\Xash3D\src_main\temp\xtools\!release\leakfile.obj"
"\Xash3D\src_main\temp\xtools\!release\light.obj"
"\Xash3D\src_main\temp\xtools\!release\light_bounce.obj"
"\Xash3D\src_main\temp\xtools\!release\light_trace.obj"
"\Xash3D\src_main\temp\xtools\!release\light_ydnar.obj"
"\Xash3D\src_main\temp\xtools\!release\lightmaps_ydnar.obj"
"\Xash3D\src_main\temp\xtools\!release\map.obj"
"\Xash3D\src_main\temp\xtools\!release\md5.obj"
"\Xash3D\src_main\temp\xtools\!release\mesh.obj"
"\Xash3D\src_main\temp\xtools\!release\model.obj"
"\Xash3D\src_main\temp\xtools\!release\patch.obj"
"\Xash3D\src_main\temp\xtools\!release\picointernal.obj"
"\Xash3D\src_main\temp\xtools\!release\picomodel.obj"
"\Xash3D\src_main\temp\xtools\!release\picomodules.obj"
"\Xash3D\src_main\temp\xtools\!release\pm_3ds.obj"
"\Xash3D\src_main\temp\xtools\!release\pm_ase.obj"
"\Xash3D\src_main\temp\xtools\!release\pm_fm.obj"
"\Xash3D\src_main\temp\xtools\!release\pm_md2.obj"
"\Xash3D\src_main\temp\xtools\!release\pm_md3.obj"
"\Xash3D\src_main\temp\xtools\!release\pm_mdc.obj"
"\Xash3D\src_main\temp\xtools\!release\pm_ms3d.obj"
"\Xash3D\src_main\temp\xtools\!release\pm_obj.obj"
"\Xash3D\src_main\temp\xtools\!release\polylib.obj"
"\Xash3D\src_main\temp\xtools\!release\portals.obj"
"\Xash3D\src_main\temp\xtools\!release\prtfile.obj"
"\Xash3D\src_main\temp\xtools\!release\shaders.obj"
"\Xash3D\src_main\temp\xtools\!release\spritegen.obj"
"\Xash3D\src_main\temp\xtools\!release\studio.obj"
"\Xash3D\src_main\temp\xtools\!release\studio_utils.obj"
"\Xash3D\src_main\temp\xtools\!release\surface.obj"
"\Xash3D\src_main\temp\xtools\!release\surface_extra.obj"
"\Xash3D\src_main\temp\xtools\!release\surface_foliage.obj"
"\Xash3D\src_main\temp\xtools\!release\surface_fur.obj"
"\Xash3D\src_main\temp\xtools\!release\surface_meta.obj"
"\Xash3D\src_main\temp\xtools\!release\tjunction.obj"
"\Xash3D\src_main\temp\xtools\!release\tree.obj"
"\Xash3D\src_main\temp\xtools\!release\utils.obj"
"\Xash3D\src_main\temp\xtools\!release\vis.obj"
"\Xash3D\src_main\temp\xtools\!release\visflow.obj"
"\Xash3D\src_main\temp\xtools\!release\wadlib.obj"
"\Xash3D\src_main\temp\xtools\!release\writebsp.obj"
"\Xash3D\src_main\temp\xtools\!release\ximage.obj"
"\Xash3D\src_main\temp\xtools\!release\xtools.obj"
]
Creating command line "link.exe @C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPA9B1.tmp"
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPA9B2.bat" with contents
[
@echo off
copy \Xash3D\src_main\temp\xtools\!release\xtools.dll "D:\Xash3D\bin\xtools.dll"
]
Creating command line "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPA9B2.bat"
Compiling...
pm_obj.c
Linking...
Creating library ..\temp\xtools\!release/xtools.lib and object ..\temp\xtools\!release/xtools.exp
<h3>Output Window</h3>
Performing Custom Build Step on \Xash3D\src_main\temp\xtools\!release\xtools.dll
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.
<h3>Results</h3>
xtools.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>