18 Jun 2010
This commit is contained in:
parent
7efdf1ea1b
commit
b891de956d
|
@ -34,7 +34,7 @@ launch\ximage\
|
|||
launch\imagelib\
|
||||
launch\extragen\
|
||||
launch\soundlib\
|
||||
cms_hl\
|
||||
physic\
|
||||
public\
|
||||
server\
|
||||
server\ents\
|
||||
|
|
|
@ -473,7 +473,6 @@ void CWorld :: Spawn( void )
|
|||
{
|
||||
g_fGameOver = FALSE;
|
||||
Precache( );
|
||||
g_flWeaponCheat = CVAR_GET_FLOAT( "sv_cheats" ); // Is the impulse 101 command allowed?
|
||||
}
|
||||
|
||||
void CWorld :: Precache( void )
|
||||
|
@ -642,6 +641,9 @@ void CWorld :: Precache( void )
|
|||
else
|
||||
CVAR_SET_FLOAT( "sv_zmax", 0 ); // let the renderer calculate optimal value
|
||||
|
||||
// g-cont. moved here to right restore global WaveHeight on save\restore level
|
||||
CVAR_SET_FLOAT( "sv_wateramp", pev->scale );
|
||||
|
||||
if ( pev->netname )
|
||||
{
|
||||
ALERT( at_aiconsole, "Chapter title: %s\n", STRING(pev->netname) );
|
||||
|
@ -678,6 +680,8 @@ void CWorld :: Precache( void )
|
|||
{
|
||||
CVAR_SET_FLOAT( "mp_defaultteam", 0 );
|
||||
}
|
||||
|
||||
g_flWeaponCheat = CVAR_GET_FLOAT( "sv_cheats" ); // Is the impulse 101 command allowed?
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -408,7 +408,9 @@ int HUD_AddVisibleEntity( edict_t *pEnt, int ed_type )
|
|||
}
|
||||
}
|
||||
|
||||
if ( pEnt->v.effects & EF_BRIGHTLIGHT )
|
||||
// NOTE: Xash3D sent entities to client even if it has EF_NODRAW flags
|
||||
// run simple check here to prevent lighting invisible entity
|
||||
if ( pEnt->v.effects & EF_BRIGHTLIGHT && !( pEnt->v.effects & EF_NODRAW ))
|
||||
{
|
||||
Vector pos( pEnt->v.origin.x, pEnt->v.origin.y, pEnt->v.origin.z + 16 );
|
||||
g_pTempEnts->AllocDLight( pos, RANDOM_LONG( 400, 430 ), 0.001f, 0 );
|
||||
|
|
|
@ -23,7 +23,7 @@ if errorlevel 1 set BUILD_ERROR=1
|
|||
%MSDEV% launch/launch.dsp %CONFIG%"launch - Win32 Debug" %build_target%
|
||||
if errorlevel 1 set BUILD_ERROR=1
|
||||
|
||||
%MSDEV% cms_hl/cms_hl.dsp %CONFIG%"cms_hl - Win32 Debug" %build_target%
|
||||
%MSDEV% physic/physic.dsp %CONFIG%"physic - Win32 Debug" %build_target%
|
||||
if errorlevel 1 set BUILD_ERROR=1
|
||||
|
||||
%MSDEV% vid_gl/vid_gl.dsp %CONFIG%"vid_gl - Win32 Debug" %build_target%
|
||||
|
@ -68,7 +68,7 @@ if exist bshift\bshift.plg del /f /q bshift\bshift.plg
|
|||
if exist client\client.plg del /f /q client\client.plg
|
||||
if exist engine\engine.plg del /f /q engine\engine.plg
|
||||
if exist launch\launch.plg del /f /q launch\launch.plg
|
||||
if exist cms_hl\cms_hl.plg del /f /q cms_hl\cms_hl.plg
|
||||
if exist physic\physic.plg del /f /q physic\physic.plg
|
||||
if exist server\server.plg del /f /q server\server.plg
|
||||
if exist spirit\spirit.plg del /f /q spirit\spirit.plg
|
||||
if exist vid_gl\vid_gl.plg del /f /q vid_gl\vid_gl.plg
|
||||
|
|
|
@ -193,7 +193,7 @@ void CL_LevelShot_f( void )
|
|||
|
||||
// check for exist
|
||||
com.sprintf( cls.shotname, "levelshots/%s.%s", cl.configstrings[CS_NAME], LEVELSHOT_TYPE );
|
||||
if( !FS_FileExists( cls.shotname ))
|
||||
if( !FS_FileExists( va( "†%s", cls.shotname )))
|
||||
cls.scrshot_action = scrshot_plaque; // build new frame for levelshot
|
||||
else cls.scrshot_action = scrshot_inactive; // disable - not needs
|
||||
}
|
||||
|
|
|
@ -512,7 +512,7 @@ void CL_ParseServerData( sizebuf_t *msg )
|
|||
Cvar_SetValue( "scr_loading", 0.0f ); // reset progress bar
|
||||
|
||||
// FIXME: Quake3 may be use both 'jpg' and 'tga' levelshot types
|
||||
if( !FS_FileExists( va( "%s.%s", cl_levelshot_name->string, SI->levshot_ext )) && cls.drawplaque )
|
||||
if( !FS_FileExists( va( "†%s.%s", cl_levelshot_name->string, SI->levshot_ext )) && cls.drawplaque )
|
||||
{
|
||||
Cvar_Set( "cl_levelshot_name", MAP_DEFAULT_SHADER ); // render a black screen
|
||||
cls.scrshot_request = scrshot_plaque; // make levelshot
|
||||
|
@ -595,7 +595,6 @@ void CL_ParseConfigString( sizebuf_t *msg )
|
|||
{
|
||||
edict_t *world = CL_GetEdictByIndex( 0 );
|
||||
world->v.scale = com.atof( cl.configstrings[CS_WATERAMP] );
|
||||
Msg( "Global WaveHeight is %g\n", world->v.scale * 16 );
|
||||
}
|
||||
else if( i == CS_SKYVEC )
|
||||
{
|
||||
|
|
|
@ -27,7 +27,7 @@ void SCR_StopCinematic( void )
|
|||
return;
|
||||
|
||||
cl.cin = NULL;
|
||||
cin->time = 0; // done
|
||||
cin->time = 0.0f; // done
|
||||
cin->pic = NULL;
|
||||
cin->pic_pending = NULL;
|
||||
|
||||
|
@ -67,7 +67,7 @@ SCR_InitCinematic
|
|||
uint SCR_GetCinematicTime( void )
|
||||
{
|
||||
cinematics_t *cin = cl.cin;
|
||||
return (cin ? cin->time : 0);
|
||||
return (cin ? cin->time : 0.0f);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -80,19 +80,19 @@ void SCR_RunCinematic( void )
|
|||
uint frame;
|
||||
cinematics_t *cin = cl.cin;
|
||||
|
||||
if( !cin || cin->time == 0 )
|
||||
if( !cin || cin->time == 0.0f )
|
||||
{
|
||||
SCR_StopCinematic ();
|
||||
return;
|
||||
}
|
||||
|
||||
frame = (Host_Milliseconds() - cin->time) * (float)(RoQ_FRAMERATE) / 1000;
|
||||
frame = (Sys_DoubleTime() - cin->time) * (float)(RoQ_FRAMERATE);
|
||||
if( frame <= cin->frame ) return;
|
||||
|
||||
if( frame > cin->frame + 1 )
|
||||
{
|
||||
MsgDev( D_WARN, "dropped frame: %i > %i\n", frame, cin->frame + 1 );
|
||||
cin->time = Host_Milliseconds() - cin->frame * 1000 / RoQ_FRAMERATE;
|
||||
cin->time = Sys_DoubleTime() - cin->frame / RoQ_FRAMERATE;
|
||||
}
|
||||
|
||||
cin->pic = cin->pic_pending;
|
||||
|
@ -118,8 +118,9 @@ bool SCR_DrawCinematic( void )
|
|||
cinematics_t *cin = cl.cin;
|
||||
float x, y, w, h;
|
||||
|
||||
if( !re || !cin || cin->time <= 0 )
|
||||
if( !re || !cin || cin->time <= 0.0f )
|
||||
return false;
|
||||
|
||||
if( !cin->pic )
|
||||
return true;
|
||||
|
||||
|
@ -189,7 +190,7 @@ bool SCR_PlayCinematic( const char *arg )
|
|||
cin->headerlen = FS_Tell( cin->file );
|
||||
cin->frame = 0;
|
||||
cin->pic = cin->pic_pending = CIN_ReadNextFrame( cin, false );
|
||||
cin->time = Host_Milliseconds ();
|
||||
cin->time = Sys_DoubleTime();
|
||||
|
||||
return true;
|
||||
}
|
|
@ -31,10 +31,8 @@ extern cvar_t *sys_sharedstrings;
|
|||
|
||||
extern string video_dlls[MAX_RENDERS];
|
||||
extern string audio_dlls[MAX_RENDERS];
|
||||
extern string cphys_dlls[MAX_RENDERS];
|
||||
extern int num_video_dlls;
|
||||
extern int num_audio_dlls;
|
||||
extern int num_cphys_dlls;
|
||||
|
||||
/*
|
||||
==============================================================
|
||||
|
@ -116,7 +114,6 @@ void Host_WriteConfig( void );
|
|||
void Host_ShutdownServer( void );
|
||||
void Host_CheckChanges( void );
|
||||
void Host_CheckRestart( void );
|
||||
int Host_Milliseconds( void );
|
||||
void Host_Print( const char *txt );
|
||||
void Host_Error( const char *error, ... );
|
||||
void Host_Credits( void );
|
||||
|
|
|
@ -217,7 +217,7 @@ pfnTime
|
|||
*/
|
||||
float pfnTime( void )
|
||||
{
|
||||
return (Host_Milliseconds() * 0.001f);
|
||||
return Sys_DoubleTime();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -15,11 +15,11 @@ bool in_mouseactive; // false when not focus app
|
|||
bool in_restore_spi;
|
||||
bool in_mouseinitialized;
|
||||
int in_originalmouseparms[3];
|
||||
int in_mouse_oldbuttonstate;
|
||||
int in_newmouseparms[3] = { 0, 0, 1 };
|
||||
bool in_mouse_suspended;
|
||||
bool in_mouseparmsvalid;
|
||||
int in_mouse_buttons;
|
||||
int in_mouse_oldbuttonstate;
|
||||
int window_center_x, window_center_y;
|
||||
RECT window_rect, real_rect;
|
||||
uint in_mouse_wheel;
|
||||
|
@ -65,7 +65,7 @@ static int Host_MapKey( int key )
|
|||
|
||||
if( !is_extended )
|
||||
{
|
||||
switch ( result )
|
||||
switch( result )
|
||||
{
|
||||
case K_HOME: return K_KP_HOME;
|
||||
case K_UPARROW: return K_KP_UPARROW;
|
||||
|
@ -82,7 +82,7 @@ static int Host_MapKey( int key )
|
|||
}
|
||||
else
|
||||
{
|
||||
switch ( result )
|
||||
switch( result )
|
||||
{
|
||||
case K_PAUSE: return K_KP_NUMLOCK;
|
||||
case 0x0D: return K_KP_ENTER;
|
||||
|
@ -103,7 +103,7 @@ void IN_StartupMouse( void )
|
|||
cvar_t *cv;
|
||||
|
||||
if( host.type == HOST_DEDICATED ) return;
|
||||
cv = Cvar_Get( "in_initmouse", "1", CVAR_SYSTEMINFO, "allow mouse device" );
|
||||
cv = Cvar_Get( "host_mouse", "1", CVAR_SYSTEMINFO, "allow mouse device" );
|
||||
if( !cv->value ) return;
|
||||
|
||||
in_mouse_buttons = 3;
|
||||
|
@ -154,7 +154,7 @@ void IN_ActivateMouse( void )
|
|||
if( cls.key_dest == key_menu && !scr_fullscreen->integer )
|
||||
{
|
||||
// check for mouse leave-entering
|
||||
if( !in_mouse_suspended && !UI_MouseInRect())
|
||||
if( !in_mouse_suspended && !UI_MouseInRect( ))
|
||||
in_mouse_suspended = true;
|
||||
|
||||
if( oldstate != in_mouse_suspended )
|
||||
|
@ -178,7 +178,7 @@ void IN_ActivateMouse( void )
|
|||
|
||||
oldstate = in_mouse_suspended;
|
||||
|
||||
if( in_mouse_suspended && IN_CursorInRect())
|
||||
if( in_mouse_suspended && IN_CursorInRect( ))
|
||||
{
|
||||
GetCursorPos( &global_pos );
|
||||
in_mouse_suspended = false;
|
||||
|
@ -235,7 +235,7 @@ void IN_DeactivateMouse( void )
|
|||
in_mouseactive = false;
|
||||
ClipCursor( NULL );
|
||||
ReleaseCapture();
|
||||
while( ShowCursor(true) < 0 );
|
||||
while( ShowCursor( true ) < 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -278,11 +278,11 @@ void IN_MouseEvent( int mstate )
|
|||
// perform button actions
|
||||
for( i = 0; i < in_mouse_buttons; i++ )
|
||||
{
|
||||
if((mstate & (1<<i)) && !(in_mouse_oldbuttonstate & (1<<i)) )
|
||||
if(( mstate & (1<<i)) && !( in_mouse_oldbuttonstate & (1<<i)) )
|
||||
{
|
||||
Sys_QueEvent( -1, SE_KEY, K_MOUSE1 + i, true, 0, NULL );
|
||||
}
|
||||
if(!(mstate & (1<<i)) && (in_mouse_oldbuttonstate & (1<<i)) )
|
||||
if(!( mstate & (1<<i)) && ( in_mouse_oldbuttonstate & (1<<i)) )
|
||||
{
|
||||
Sys_QueEvent( -1, SE_KEY, K_MOUSE1 + i, false, 0, NULL );
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ IN_Shutdown
|
|||
*/
|
||||
void IN_Shutdown( void )
|
||||
{
|
||||
IN_DeactivateMouse();
|
||||
IN_DeactivateMouse( );
|
||||
}
|
||||
|
||||
|
||||
|
@ -308,7 +308,7 @@ IN_Init
|
|||
*/
|
||||
void IN_Init( void )
|
||||
{
|
||||
IN_StartupMouse();
|
||||
IN_StartupMouse( );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -388,7 +388,7 @@ long IN_WndProc( void *hWnd, uint uMsg, uint wParam, long lParam )
|
|||
ShowWindow( host.hWnd, SW_SHOWMINNOACTIVE );
|
||||
break;
|
||||
case WM_MOUSEWHEEL:
|
||||
if((short)HIWORD(wParam) > 0 )
|
||||
if(( short )HIWORD( wParam ) > 0 )
|
||||
{
|
||||
Sys_QueEvent( -1, SE_KEY, K_MWHEELUP, true, 0, NULL );
|
||||
Sys_QueEvent( -1, SE_KEY, K_MWHEELUP, false, 0, NULL );
|
||||
|
@ -417,7 +417,7 @@ long IN_WndProc( void *hWnd, uint uMsg, uint wParam, long lParam )
|
|||
else host.state = HOST_FRAME;
|
||||
|
||||
wnd_caption = GetSystemMetrics( SM_CYCAPTION );
|
||||
S_Activate( (host.state == HOST_FRAME) ? true : false );
|
||||
S_Activate(( host.state == HOST_FRAME ) ? true : false );
|
||||
Key_ClearStates(); // FIXME!!!
|
||||
|
||||
if( host.state == HOST_FRAME )
|
||||
|
@ -433,19 +433,19 @@ long IN_WndProc( void *hWnd, uint uMsg, uint wParam, long lParam )
|
|||
case WM_MOVE:
|
||||
if( !scr_fullscreen->integer )
|
||||
{
|
||||
RECT r;
|
||||
int xPos, yPos, style;
|
||||
RECT rect;
|
||||
int xPos, yPos, style;
|
||||
|
||||
xPos = (short)LOWORD( lParam ); // horizontal position
|
||||
yPos = (short)HIWORD( lParam ); // vertical position
|
||||
|
||||
r.left = r.top = 0;
|
||||
r.right = r.bottom = 1;
|
||||
rect.left = rect.top = 0;
|
||||
rect.right = rect.bottom = 1;
|
||||
style = GetWindowLong( hWnd, GWL_STYLE );
|
||||
AdjustWindowRect( &r, style, FALSE );
|
||||
AdjustWindowRect( &rect, style, FALSE );
|
||||
|
||||
Cvar_SetValue( "r_xpos", xPos + r.left );
|
||||
Cvar_SetValue( "r_ypos", yPos + r.top );
|
||||
Cvar_SetValue( "r_xpos", xPos + rect.left );
|
||||
Cvar_SetValue( "r_ypos", yPos + rect.top );
|
||||
scr_xpos->modified = false;
|
||||
scr_ypos->modified = false;
|
||||
GetWindowRect( host.hWnd, &real_rect );
|
||||
|
@ -464,7 +464,7 @@ long IN_WndProc( void *hWnd, uint uMsg, uint wParam, long lParam )
|
|||
IN_MouseEvent( temp );
|
||||
break;
|
||||
case WM_SYSCOMMAND:
|
||||
// never turn screensave when Xash is active
|
||||
// never turn screensaver while Xash is active
|
||||
if( wParam == SC_SCREENSAVE && host.state != HOST_SLEEP )
|
||||
return 0;
|
||||
break;
|
||||
|
|
|
@ -17,14 +17,12 @@ stdlib_api_t com, newcom;
|
|||
char *buildstring = __TIME__ " " __DATE__;
|
||||
string video_dlls[MAX_RENDERS];
|
||||
string audio_dlls[MAX_RENDERS];
|
||||
string cphys_dlls[MAX_RENDERS];
|
||||
int num_video_dlls;
|
||||
int num_audio_dlls;
|
||||
int num_cphys_dlls;
|
||||
|
||||
dll_info_t render_dll = { "", NULL, "CreateAPI", NULL, NULL, 0, sizeof(render_exp_t), sizeof(stdlib_api_t) };
|
||||
dll_info_t vsound_dll = { "", NULL, "CreateAPI", NULL, NULL, 0, sizeof(vsound_exp_t), sizeof(stdlib_api_t) };
|
||||
dll_info_t physic_dll = { "", NULL, "CreateAPI", NULL, NULL, 0, sizeof(physic_exp_t), sizeof(stdlib_api_t) };
|
||||
dll_info_t physic_dll = { "physic.dll", NULL, "CreateAPI", NULL, NULL, 0, sizeof(physic_exp_t), sizeof(stdlib_api_t) };
|
||||
|
||||
cvar_t *timescale;
|
||||
cvar_t *sys_sharedstrings;
|
||||
|
@ -248,38 +246,20 @@ bool Host_InitSound( void )
|
|||
|
||||
void Host_CheckRestart( void )
|
||||
{
|
||||
int num_changes;
|
||||
if( !host_cphys->modified )
|
||||
return;
|
||||
|
||||
if( host_cphys->modified )
|
||||
S_StopAllSounds(); // don't let them loop during the restart
|
||||
SV_ForceMod();
|
||||
|
||||
// restart physics library
|
||||
Host_FreePhysic(); // release physic.dll
|
||||
if( !Host_InitPhysic( )) // load it again
|
||||
{
|
||||
S_StopAllSounds(); // don't let them loop during the restart
|
||||
|
||||
SV_ForceMod();
|
||||
CL_ForceVid();
|
||||
MsgDev( D_ERROR, "couldn't initialize physic system\n" );
|
||||
}
|
||||
else return;
|
||||
|
||||
num_changes = 0;
|
||||
|
||||
// restart or change renderer
|
||||
while( host_cphys->modified )
|
||||
{
|
||||
host_cphys->modified = false;
|
||||
|
||||
Host_FreePhysic(); // release physic.dll
|
||||
if( !Host_InitPhysic( )) // load it again
|
||||
{
|
||||
if( num_changes > num_cphys_dlls )
|
||||
{
|
||||
MsgDev( D_ERROR, "couldn't initialize physic system\n" );
|
||||
return;
|
||||
}
|
||||
if( !com.strcmp( cphys_dlls[num_changes], host_cphys->string ))
|
||||
num_changes++; // already trying - failed
|
||||
Cvar_FullSet( "host_cphys", cphys_dlls[num_changes], CVAR_SYSTEMINFO );
|
||||
num_changes++;
|
||||
}
|
||||
}
|
||||
host_cphys->modified = false;
|
||||
}
|
||||
|
||||
void Host_CheckChanges( void )
|
||||
|
@ -774,7 +754,7 @@ void Host_InitCommon( const int argc, const char **argv )
|
|||
num_video_dlls = num_audio_dlls = 0;
|
||||
host_video = Cvar_Get( "host_video", "vid_gl.dll", CVAR_SYSTEMINFO, "name of video rendering library" );
|
||||
host_audio = Cvar_Get( "host_audio", "snd_al.dll", CVAR_SYSTEMINFO, "name of sound rendering library" );
|
||||
host_cphys = Cvar_Get( "host_cphys", "cms_qf.dll", CVAR_SYSTEMINFO, "name of physic colision library" );
|
||||
host_cphys = Cvar_Get( "host_cphys", "physic.dll", CVAR_SYSTEMINFO, "name of physic colision library" );
|
||||
|
||||
// make sure what global copy has no changed with any dll checking
|
||||
Mem_Copy( &check_vid, &render_dll, sizeof( dll_info_t ));
|
||||
|
@ -816,17 +796,6 @@ void Host_InitCommon( const int argc, const char **argv )
|
|||
num_audio_dlls++;
|
||||
}
|
||||
}
|
||||
else if(!com.strnicmp( "cms_", dlls->filenames[i], 4 ))
|
||||
{
|
||||
// make sure what found library is valid
|
||||
if( Sys_LoadLibrary( dlls->filenames[i], &check_cms ))
|
||||
{
|
||||
MsgDev( D_NOTE, "PhysicLibrary[%i]: %s\n", num_cphys_dlls, dlls->filenames[i] );
|
||||
com.strncpy( cphys_dlls[num_cphys_dlls], dlls->filenames[i], MAX_STRING );
|
||||
Sys_FreeLibrary( &check_cms );
|
||||
num_cphys_dlls++;
|
||||
}
|
||||
}
|
||||
}
|
||||
Mem_Free( dlls );
|
||||
}
|
||||
|
@ -910,7 +879,7 @@ void Host_Init( const int argc, const char **argv )
|
|||
Cmd_AddCommand( "snd_restart", Host_SndRestart_f, "restarts audio system" );
|
||||
}
|
||||
|
||||
Cmd_AddCommand( "cmap_restart", Host_PhysRestart_f, "restarts physic system" );
|
||||
Cmd_AddCommand( "phys_restart", Host_PhysRestart_f, "restarts physic system" );
|
||||
Cmd_AddCommand( "game", Host_ChangeGame_f, "change game" ); // allow to change game from the console
|
||||
host.frametime = Host_Milliseconds();
|
||||
host.errorframe = 0;
|
||||
|
|
|
@ -197,6 +197,9 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
float time; // cached sv.time
|
||||
float frametime; // cached sv.frametime
|
||||
|
||||
// user messages stuff
|
||||
const char *msg_name; // just for debug
|
||||
int msg_sizes[MAX_USER_MESSAGES]; // user messages bounds checker
|
||||
|
@ -234,7 +237,7 @@ typedef struct
|
|||
{
|
||||
bool initialized; // sv_init has completed
|
||||
int realtime; // always increasing, no clamping, etc
|
||||
int timestart; // just for profiling
|
||||
double timestart; // just for profiling
|
||||
|
||||
int groupmask;
|
||||
int groupop;
|
||||
|
@ -306,7 +309,7 @@ void SV_InitOperatorCommands( void );
|
|||
void SV_KillOperatorCommands( void );
|
||||
void SV_UserinfoChanged( sv_client_t *cl, const char *userinfo );
|
||||
void SV_PrepWorldFrame( void );
|
||||
void SV_CalcFrametime( void );
|
||||
void SV_CalcFrameTime( void );
|
||||
void Master_Heartbeat( void );
|
||||
void Master_Packet( void );
|
||||
|
||||
|
|
|
@ -294,7 +294,6 @@ bool SV_ClientConnect( edict_t *ent, char *userinfo )
|
|||
if( !sv.loadgame ) ent->v.flags = 0;
|
||||
|
||||
MsgDev( D_NOTE, "SV_ClientConnect()\n" );
|
||||
svgame.globals->time = sv.time * 0.001f;
|
||||
result = svgame.dllFuncs.pfnClientConnect( ent, userinfo );
|
||||
|
||||
return result;
|
||||
|
@ -320,8 +319,6 @@ void SV_DropClient( sv_client_t *drop )
|
|||
MSG_WriteByte( &drop->netchan.message, svc_disconnect );
|
||||
|
||||
// let the game known about client state
|
||||
svgame.globals->time = sv.time * 0.001f;
|
||||
|
||||
if( drop->edict->v.flags & FL_SPECTATOR )
|
||||
svgame.dllFuncs.pfnSpectatorDisconnect( drop->edict );
|
||||
else svgame.dllFuncs.pfnClientDisconnect( drop->edict );
|
||||
|
@ -335,8 +332,8 @@ void SV_DropClient( sv_client_t *drop )
|
|||
drop->edict->pvPrivateData = NULL;
|
||||
}
|
||||
|
||||
// SV_FreeEdict( drop->edict );
|
||||
if( drop->download ) drop->download = NULL;
|
||||
if( drop->download )
|
||||
drop->download = NULL;
|
||||
|
||||
drop->state = cs_zombie; // become free in a few seconds
|
||||
drop->name[0] = 0;
|
||||
|
@ -642,7 +639,6 @@ void SV_PutClientInServer( edict_t *ent )
|
|||
index = NUM_FOR_EDICT( ent ) - 1;
|
||||
client = ent->pvServerData->client;
|
||||
|
||||
svgame.globals->time = sv.time * 0.001f;
|
||||
ent->pvServerData->s.ed_type = ED_CLIENT; // init edict type
|
||||
|
||||
if( !sv.loadgame )
|
||||
|
@ -702,7 +698,7 @@ void SV_PutClientInServer( edict_t *ent )
|
|||
sv.paused = false;
|
||||
|
||||
if( sv_maxclients->integer == 1 ) // singleplayer profiler
|
||||
MsgDev( D_INFO, "level loaded at %g sec\n", (Sys_Milliseconds() - svs.timestart) * 0.001f );
|
||||
MsgDev( D_INFO, "level loaded at %.2f sec\n", Sys_DoubleTime() - svs.timestart );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1066,8 +1062,6 @@ void SV_UserinfoChanged( sv_client_t *cl, const char *userinfo )
|
|||
}
|
||||
|
||||
// call prog code to allow overrides
|
||||
svgame.globals->time = sv.time * 0.001f;
|
||||
svgame.globals->frametime = sv.frametime * 0.001f;
|
||||
svgame.dllFuncs.pfnClientUserInfoChanged( cl->edict, cl->userinfo );
|
||||
|
||||
if( SV_IsValidEdict( ent ))
|
||||
|
@ -1127,8 +1121,6 @@ void SV_ExecuteClientCommand( sv_client_t *cl, char *s )
|
|||
if( !u->name && sv.state == ss_active )
|
||||
{
|
||||
// custom client commands
|
||||
svgame.globals->time = sv.time * 0.001f;
|
||||
svgame.globals->frametime = sv.frametime * 0.001f;
|
||||
svgame.dllFuncs.pfnClientCommand( cl->edict );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -361,7 +361,7 @@ void SV_FreeEdict( edict_t *pEdict )
|
|||
Mem_Set( pEdict, 0, sizeof( *pEdict ));
|
||||
|
||||
// mark edict as freed
|
||||
pEdict->freetime = sv.time * 0.001f;
|
||||
pEdict->freetime = svgame.time;
|
||||
pEdict->v.nextthink = -1;
|
||||
pEdict->free = true;
|
||||
}
|
||||
|
@ -369,7 +369,6 @@ 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++ )
|
||||
|
@ -377,7 +376,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.0 || time - pEdict->freetime > 0.5 ))
|
||||
if( pEdict->free && ( pEdict->freetime < 2.0 || svgame.time - pEdict->freetime > 0.5 ))
|
||||
{
|
||||
SV_InitEdict( pEdict );
|
||||
return pEdict;
|
||||
|
@ -750,10 +749,10 @@ void pfnChangeLevel( const char* s1, const char* s2 )
|
|||
if( !s1 || s1[0] <= ' ' ) return;
|
||||
|
||||
// make sure we don't issue two changelevels
|
||||
if( svs.changelevel_next_time > svgame.globals->time )
|
||||
if( svs.changelevel_next_time > svgame.time )
|
||||
return;
|
||||
|
||||
svs.changelevel_next_time = svgame.globals->time + 1.0f; // rest 1 secs if failed
|
||||
svs.changelevel_next_time = svgame.time + 1.0f; // rest 1 secs if failed
|
||||
|
||||
if( !s2 ) Cbuf_AddText( va( "changelevel %s\n", s1 )); // Quake changlevel
|
||||
else Cbuf_AddText( va( "changelevel %s %s\n", s1, s2 )); // Half-Life changelevel
|
||||
|
@ -3616,7 +3615,6 @@ void SV_SpawnEntities( const char *mapname, script_t *entities )
|
|||
svgame.globals->maxClients = sv_maxclients->integer;
|
||||
svgame.globals->mapname = MAKE_STRING( sv.name );
|
||||
svgame.globals->startspot = MAKE_STRING( sv.startspot );
|
||||
svgame.globals->time = sv.time * 0.001f;
|
||||
|
||||
// spawn the rest of the entities on the map
|
||||
SV_LoadFromFile( entities );
|
||||
|
|
|
@ -179,10 +179,12 @@ void SV_ActivateServer( void )
|
|||
// create a baseline for more efficient communications
|
||||
SV_CreateBaseline();
|
||||
|
||||
if( sv.loadgame ) SV_CalcFrametime ();
|
||||
svgame.frametime = ( sv.frametime * 0.001f );
|
||||
svgame.time = ( sv.time * 0.001f );
|
||||
|
||||
// run two frames to allow everything to settle
|
||||
SV_Physics();
|
||||
if( !sv.loadgame ) SV_Physics();
|
||||
svgame.time = ( sv.time * 0.001f );
|
||||
SV_Physics();
|
||||
|
||||
// invoke to refresh all movevars
|
||||
|
@ -317,7 +319,7 @@ bool SV_SpawnServer( const char *mapname, const char *startspot )
|
|||
return false;
|
||||
|
||||
svgame.globals->changelevel = false; // will be restored later if needed
|
||||
svs.timestart = Sys_Milliseconds();
|
||||
svs.timestart = Sys_DoubleTime();
|
||||
svs.spawncount++; // any partially connected client will be restarted
|
||||
svs.realtime = 0;
|
||||
|
||||
|
@ -363,6 +365,11 @@ bool SV_SpawnServer( const char *mapname, const char *startspot )
|
|||
Cvar_SetValue( "skill", (float)current_skill );
|
||||
|
||||
sv.time = 1000; // server spawn time it's always 1.0 second
|
||||
sv.frametime = 100;
|
||||
|
||||
// half-life compatibility
|
||||
svgame.globals->time = 1.0f;
|
||||
svgame.globals->frametime = 0;
|
||||
|
||||
// make sure what server name doesn't contain path and extension
|
||||
FS_FileBase( mapname, sv.name );
|
||||
|
@ -518,7 +525,7 @@ void SV_ForceMod( void )
|
|||
|
||||
void SV_ForceError( void )
|
||||
{
|
||||
// this only for singleplayer testing
|
||||
// this is only for singleplayer testing
|
||||
if( sv_maxclients->integer != 1 ) return;
|
||||
sv.write_bad_message = true;
|
||||
}
|
||||
|
@ -540,15 +547,8 @@ bool SV_NewGame( const char *mapName, bool loadGame )
|
|||
if( !SV_SpawnServer( mapName, NULL ))
|
||||
return false;
|
||||
|
||||
// make sure the time is set
|
||||
svgame.globals->time = (sv.time * 0.001f);
|
||||
SV_LevelInit( mapName, NULL, NULL, loadGame );
|
||||
|
||||
if( loadGame )
|
||||
{
|
||||
sv.loadgame = true;
|
||||
svgame.globals->time = (sv.time * 0.001f);
|
||||
}
|
||||
sv.loadgame = loadGame;
|
||||
|
||||
SV_ActivateServer();
|
||||
|
||||
|
|
|
@ -257,10 +257,10 @@ void SV_UpdateServerInfo( void )
|
|||
|
||||
/*
|
||||
=================
|
||||
SV_CalcFrametime
|
||||
SV_CalcFrameTime
|
||||
=================
|
||||
*/
|
||||
void SV_CalcFrametime( void )
|
||||
void SV_CalcFrameTime( void )
|
||||
{
|
||||
if( sv_fps->modified )
|
||||
{
|
||||
|
@ -350,8 +350,8 @@ void SV_CheckTimeouts( void )
|
|||
float zombiepoint;
|
||||
int i, numclients = 0;
|
||||
|
||||
droppoint = svs.realtime - (timeout->value * 1000);
|
||||
zombiepoint = svs.realtime - (zombietime->value * 1000);
|
||||
droppoint = svs.realtime - ( timeout->value * 1000 );
|
||||
zombiepoint = svs.realtime - ( zombietime->value * 1000 );
|
||||
|
||||
for( i = 0, cl = svs.clients; i < sv_maxclients->integer; i++, cl++ )
|
||||
{
|
||||
|
@ -371,7 +371,7 @@ void SV_CheckTimeouts( void )
|
|||
cl->state = cs_free; // can now be reused
|
||||
continue;
|
||||
}
|
||||
if(( cl->state == cs_connected || cl->state == cs_spawned) && cl->lastmessage < droppoint )
|
||||
if(( cl->state == cs_connected || cl->state == cs_spawned ) && cl->lastmessage < droppoint )
|
||||
{
|
||||
SV_BroadcastPrintf( PRINT_HIGH, "%s timed out\n", cl->name );
|
||||
SV_DropClient( cl );
|
||||
|
@ -450,6 +450,10 @@ void SV_RunGameFrame( void )
|
|||
// has the "current" frame
|
||||
sv.framenum++;
|
||||
|
||||
// update progs timings
|
||||
svgame.globals->frametime = svgame.frametime = ( sv.frametime * 0.001f );
|
||||
svgame.globals->time = svgame.time = ( sv.time * 0.001f );
|
||||
|
||||
// don't run if paused or not in game
|
||||
if( !sv.paused && CL_IsInGame( ))
|
||||
SV_Physics();
|
||||
|
@ -476,7 +480,7 @@ void SV_Frame( int time )
|
|||
rand ();
|
||||
|
||||
// calc sv.frametime
|
||||
SV_CalcFrametime ();
|
||||
SV_CalcFrameTime ();
|
||||
|
||||
// check timeouts
|
||||
SV_CheckTimeouts ();
|
||||
|
|
|
@ -638,9 +638,6 @@ void SV_RunCmd( sv_client_t *cl, usercmd_t *ucmd )
|
|||
SV_SetMinMaxSize( clent, svgame.pmove->player_mins[1], svgame.pmove->player_maxs[1] );
|
||||
else SV_SetMinMaxSize( clent, svgame.pmove->player_mins[0], svgame.pmove->player_maxs[0] );
|
||||
|
||||
svgame.globals->time = (sv.time * 0.001f);
|
||||
svgame.globals->frametime = (sv.frametime * 0.001f);
|
||||
|
||||
if(!( clent->v.flags & FL_SPECTATOR ))
|
||||
{
|
||||
svgame.dllFuncs.pfnPlayerPreThink( clent );
|
||||
|
@ -654,9 +651,6 @@ void SV_RunCmd( sv_client_t *cl, usercmd_t *ucmd )
|
|||
if(( sv_maxclients->integer <= 1 ) && !CL_IsInGame( ) || ( clent->v.flags & FL_FROZEN ) || ( sv.framenum < 3 ))
|
||||
ucmd->msec = 0; // pause
|
||||
|
||||
svgame.globals->time = (sv.time * 0.001f);
|
||||
svgame.globals->frametime = (ucmd->msec * 0.001f);
|
||||
|
||||
// setup playermove state
|
||||
PM_SetupMove( svgame.pmove, clent, ucmd, cl->physinfo );
|
||||
|
||||
|
@ -716,6 +710,6 @@ void SV_PostRunCmd( sv_client_t *cl )
|
|||
else svgame.dllFuncs.pfnPlayerPostThink( clent );
|
||||
|
||||
// restore frametime
|
||||
svgame.globals->frametime = sv.frametime * 0.001f;
|
||||
svgame.globals->frametime = svgame.frametime;
|
||||
svgame.dllFuncs.pfnCmdEnd( cl->edict );
|
||||
}
|
|
@ -161,11 +161,11 @@ bool SV_RunThink( edict_t *ent )
|
|||
float thinktime;
|
||||
|
||||
thinktime = ent->v.nextthink;
|
||||
if( thinktime <= 0.0f || thinktime > ( sv.time * 0.001f ) + ( sv.frametime * 0.001f ))
|
||||
if( thinktime <= 0.0f || thinktime > svgame.globals->time + svgame.globals->frametime )
|
||||
return true;
|
||||
|
||||
if( thinktime < ( sv.time * 0.001f ))
|
||||
thinktime = ( sv.time * 0.001f ); // don't let things stay in the past.
|
||||
if( thinktime < svgame.globals->time )
|
||||
thinktime = svgame.globals->time; // don't let things stay in the past.
|
||||
// it is possible to start that way
|
||||
// by a trigger with a local time.
|
||||
ent->v.nextthink = 0;
|
||||
|
@ -193,7 +193,6 @@ bool SV_Impact( edict_t *e1, trace_t *trace )
|
|||
|
||||
SV_CopyTraceToGlobal( trace );
|
||||
VectorCopy( e1->v.origin, org );
|
||||
svgame.globals->time = (sv.time * 0.001f);
|
||||
|
||||
if( !e1->free && !e2->free && e1->v.solid != SOLID_NOT )
|
||||
{
|
||||
|
@ -625,8 +624,8 @@ SV_AddGravity
|
|||
void SV_AddGravity( edict_t *ent )
|
||||
{
|
||||
if( ent->v.gravity ) // gravity modifier
|
||||
ent->v.velocity[2] -= sv_gravity->value * ent->v.gravity * svgame.globals->frametime;
|
||||
else ent->v.velocity[2] -= sv_gravity->value * svgame.globals->frametime;
|
||||
ent->v.velocity[2] -= sv_gravity->value * ent->v.gravity * svgame.frametime;
|
||||
else ent->v.velocity[2] -= sv_gravity->value * svgame.frametime;
|
||||
}
|
||||
|
||||
void SV_AddHalfGravity( edict_t *ent, float timestep )
|
||||
|
@ -639,7 +638,7 @@ void SV_AddHalfGravity( edict_t *ent, float timestep )
|
|||
|
||||
// Add 1/2 of the total gravitational effects over this timestep
|
||||
ent->v.velocity[2] -= ( 0.5f * ent_gravity * sv_gravity->value * timestep );
|
||||
ent->v.velocity[2] += ent->v.basevelocity[2] * svgame.globals->frametime;
|
||||
ent->v.velocity[2] += ent->v.basevelocity[2] * svgame.frametime;
|
||||
ent->v.basevelocity[2] = 0.0f;
|
||||
|
||||
// bound velocity
|
||||
|
@ -1169,8 +1168,6 @@ void SV_PushComplex( edict_t *pusher, float movetime )
|
|||
}
|
||||
|
||||
// call the pusher "blocked" function
|
||||
svgame.globals->time = (sv.time * 0.001f);
|
||||
Msg( "%s is blocked by %s\n", SV_ClassName( pusher ), SV_ClassName( check ));
|
||||
svgame.dllFuncs.pfnBlocked( pusher, check );
|
||||
return;
|
||||
}
|
||||
|
@ -1194,12 +1191,12 @@ void SV_Physics_Pusher( edict_t *ent )
|
|||
oldtime = ent->v.ltime;
|
||||
thinktime = ent->v.nextthink;
|
||||
|
||||
if( thinktime < ent->v.ltime + svgame.globals->frametime )
|
||||
if( thinktime < ent->v.ltime + svgame.frametime )
|
||||
{
|
||||
movetime = thinktime - ent->v.ltime;
|
||||
if( movetime < 0.0f ) movetime = 0.0f;
|
||||
}
|
||||
else movetime = svgame.globals->frametime;
|
||||
else movetime = svgame.frametime;
|
||||
|
||||
if( movetime )
|
||||
{
|
||||
|
@ -1239,19 +1236,12 @@ void SV_Physics_Pusher( edict_t *ent )
|
|||
svgame.dllFuncs.pfnBlocked( ent, pBlocker );
|
||||
}
|
||||
|
||||
if( thinktime > oldtime && thinktime <= ent->v.ltime )
|
||||
if(( thinktime > oldtime && thinktime <= ent->v.ltime ) || ( ent->v.flags & FL_ALWAYSTHINK ))
|
||||
{
|
||||
ent->v.nextthink = 0.0f;
|
||||
svgame.globals->time = svgame.globals->time;
|
||||
svgame.dllFuncs.pfnThink( ent );
|
||||
if( ent->free ) return;
|
||||
}
|
||||
else if( ent->v.flags & FL_ALWAYSTHINK )
|
||||
{
|
||||
ent->v.nextthink = 0.0f;
|
||||
svgame.globals->time = svgame.globals->time;
|
||||
svgame.dllFuncs.pfnThink( ent );
|
||||
}
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
@ -1345,8 +1335,8 @@ void SV_Physics_Noclip( edict_t *ent )
|
|||
|
||||
SV_CheckWater( ent );
|
||||
|
||||
VectorMA( ent->v.origin, svgame.globals->frametime, ent->v.velocity, ent->v.origin );
|
||||
VectorMA( ent->v.angles, svgame.globals->frametime, ent->v.avelocity, ent->v.angles );
|
||||
VectorMA( ent->v.origin, svgame.frametime, ent->v.velocity, ent->v.origin );
|
||||
VectorMA( ent->v.angles, svgame.frametime, ent->v.avelocity, ent->v.angles );
|
||||
|
||||
SV_LinkEdict( ent, false ); // nocip ents never touch triggers
|
||||
}
|
||||
|
@ -1440,10 +1430,10 @@ void SV_Physics_Toss( edict_t *ent )
|
|||
{
|
||||
case MOVETYPE_TOSS:
|
||||
case MOVETYPE_BOUNCE:
|
||||
SV_AngularMove( ent, svgame.globals->frametime, ent->v.friction );
|
||||
SV_AngularMove( ent, svgame.frametime, ent->v.friction );
|
||||
break;
|
||||
default:
|
||||
SV_AngularMove( ent, svgame.globals->frametime, 0.0f );
|
||||
SV_AngularMove( ent, svgame.frametime, 0.0f );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1453,7 +1443,7 @@ void SV_Physics_Toss( edict_t *ent )
|
|||
VectorAdd( ent->v.velocity, ent->v.basevelocity, ent->v.velocity );
|
||||
|
||||
SV_CheckVelocity( ent );
|
||||
VectorScale( ent->v.velocity, svgame.globals->frametime, move );
|
||||
VectorScale( ent->v.velocity, svgame.frametime, move );
|
||||
VectorSubtract( ent->v.velocity, ent->v.basevelocity, ent->v.velocity );
|
||||
|
||||
trace = SV_PushEntity( ent, move, vec3_origin, NULL );
|
||||
|
@ -1489,7 +1479,7 @@ void SV_Physics_Toss( edict_t *ent )
|
|||
{
|
||||
float vel;
|
||||
|
||||
if( ent->v.velocity[2] < sv_gravity->value * svgame.globals->frametime )
|
||||
if( ent->v.velocity[2] < sv_gravity->value * svgame.frametime )
|
||||
{
|
||||
// we're rolling on the ground, add static friction.
|
||||
ent->v.groundentity = trace.pHit;
|
||||
|
@ -1507,7 +1497,7 @@ void SV_Physics_Toss( edict_t *ent )
|
|||
}
|
||||
else
|
||||
{
|
||||
VectorScale( ent->v.velocity, (1.0f - trace.flFraction) * svgame.globals->frametime * 0.9f, move );
|
||||
VectorScale( ent->v.velocity, (1.0f - trace.flFraction) * svgame.frametime * 0.9f, move );
|
||||
trace = SV_PushEntity( ent, move, vec3_origin, NULL );
|
||||
if( ent->free ) return;
|
||||
}
|
||||
|
@ -1558,14 +1548,14 @@ void SV_Physics_Step( edict_t *ent )
|
|||
{
|
||||
if(!( ent->v.flags & (FL_SWIM|FL_FLOAT) && ent->v.waterlevel > 0 ))
|
||||
{
|
||||
if( ent->v.velocity[2] < ( sv_gravity->value * -svgame.globals->frametime ))
|
||||
if( ent->v.velocity[2] < ( sv_gravity->value * -svgame.frametime ))
|
||||
{
|
||||
hitsound = true;
|
||||
}
|
||||
|
||||
if( !inwater )
|
||||
{
|
||||
SV_AddHalfGravity( ent, svgame.globals->frametime );
|
||||
SV_AddHalfGravity( ent, svgame.frametime );
|
||||
isfalling = true;
|
||||
}
|
||||
}
|
||||
|
@ -1574,13 +1564,13 @@ void SV_Physics_Step( edict_t *ent )
|
|||
if( ent->v.waterlevel > 1 )
|
||||
{
|
||||
VectorScale( ent->v.velocity, 0.9f, ent->v.velocity );
|
||||
ent->v.velocity[2] += (ent->v.skin * svgame.globals->frametime);
|
||||
ent->v.velocity[2] += ( ent->v.skin * svgame.frametime );
|
||||
}
|
||||
else if( ent->v.waterlevel == 1 )
|
||||
{
|
||||
if( ent->v.velocity[2] > 0.0f )
|
||||
ent->v.velocity[2] = svgame.globals->frametime;
|
||||
ent->v.velocity[2] -= (ent->v.skin * svgame.globals->frametime);
|
||||
ent->v.velocity[2] = svgame.frametime;
|
||||
ent->v.velocity[2] -= ( ent->v.skin * svgame.frametime );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1609,7 +1599,7 @@ void SV_Physics_Step( edict_t *ent )
|
|||
if( speed )
|
||||
{
|
||||
control = speed < sv_stopspeed->value ? sv_stopspeed->value : speed;
|
||||
newspeed = speed - svgame.globals->frametime * control * friction;
|
||||
newspeed = speed - svgame.frametime * control * friction;
|
||||
|
||||
if( newspeed < 0.0f )
|
||||
newspeed = 0.0f;
|
||||
|
@ -1622,10 +1612,10 @@ void SV_Physics_Step( edict_t *ent )
|
|||
|
||||
VectorAdd( ent->v.velocity, ent->v.basevelocity, ent->v.velocity );
|
||||
|
||||
SV_AngularMove( ent, svgame.globals->frametime, friction );
|
||||
SV_AngularMove( ent, svgame.frametime, friction );
|
||||
|
||||
SV_CheckVelocity( ent );
|
||||
SV_TryMove( ent, svgame.globals->frametime, NULL );
|
||||
SV_TryMove( ent, svgame.frametime, NULL );
|
||||
SV_CheckVelocity( ent );
|
||||
|
||||
VectorSubtract( ent->v.velocity, ent->v.basevelocity, ent->v.velocity );
|
||||
|
@ -1660,9 +1650,9 @@ void SV_Physics_Step( edict_t *ent )
|
|||
SV_LinkEdict( ent, true );
|
||||
}
|
||||
|
||||
if(!( ent->v.flags & FL_ONGROUND) && isfalling )
|
||||
if(!( ent->v.flags & FL_ONGROUND ) && isfalling )
|
||||
{
|
||||
SV_AddHalfGravity( ent, svgame.globals->frametime );
|
||||
SV_AddHalfGravity( ent, svgame.frametime );
|
||||
}
|
||||
|
||||
if( !SV_RunThink( ent )) return;
|
||||
|
@ -1689,7 +1679,7 @@ void SV_Physics_Conveyor( edict_t *ent )
|
|||
vec3_t point, end;
|
||||
|
||||
VectorScale( ent->v.movedir, ent->v.speed, v );
|
||||
VectorScale( v, svgame.globals->frametime, move );
|
||||
VectorScale( v, svgame.frametime, move );
|
||||
|
||||
for( i = 0; i < svgame.globals->maxClients; i++ )
|
||||
{
|
||||
|
@ -1714,7 +1704,7 @@ void SV_Physics_Conveyor( edict_t *ent )
|
|||
v[2] = ent->v.speed * com.sqrt( 1.0f - tr.vecPlaneNormal[2] * tr.vecPlaneNormal[2] ) / tr.vecPlaneNormal[2];
|
||||
if(DotProduct( ent->v.movedir, tr.vecPlaneNormal) > 0.0f )
|
||||
v[2] = -v[2]; // then we're moving down
|
||||
move[2] = v[2] * svgame.globals->frametime;
|
||||
move[2] = v[2] * svgame.frametime;
|
||||
}
|
||||
VectorAdd( player->v.origin, move, end );
|
||||
tr = SV_Move( player->v.origin, player->v.mins, player->v.maxs, end, MOVE_NORMAL, player );
|
||||
|
@ -1746,7 +1736,7 @@ static void SV_Physics_Entity( edict_t *ent )
|
|||
if(!( ent->v.flags & FL_BASEVELOCITY ) && !VectorIsNull( ent->v.basevelocity ))
|
||||
{
|
||||
// Apply momentum (add in half of the previous frame of velocity first)
|
||||
VectorMA( ent->v.velocity, 1.0f + (svgame.globals->frametime * 0.5f), ent->v.basevelocity, ent->v.velocity );
|
||||
VectorMA( ent->v.velocity, 1.0f + (svgame.frametime * 0.5f), ent->v.basevelocity, ent->v.velocity );
|
||||
VectorClear( ent->v.basevelocity );
|
||||
}
|
||||
ent->v.flags &= ~FL_BASEVELOCITY;
|
||||
|
@ -1823,9 +1813,6 @@ void SV_Physics( void )
|
|||
edict_t *ent;
|
||||
|
||||
// let the progs know that a new frame has started
|
||||
svgame.globals->time = sv.time * 0.001f;
|
||||
svgame.globals->frametime = sv.frametime * 0.001f;
|
||||
|
||||
svgame.dllFuncs.pfnStartFrame();
|
||||
|
||||
SV_CheckAllEnts ();
|
||||
|
@ -1853,7 +1840,7 @@ void SV_Physics( void )
|
|||
}
|
||||
|
||||
// let everything in the world think and move
|
||||
CM_Frame( svgame.globals->frametime );
|
||||
CM_Frame( svgame.frametime );
|
||||
|
||||
// at end of frame kill all entities which supposed to it
|
||||
SV_FreeOldEntities();
|
||||
|
@ -1863,5 +1850,6 @@ void SV_Physics( void )
|
|||
|
||||
svgame.dllFuncs.pfnEndFrame();
|
||||
|
||||
if( !( sv.hostflags & SVF_PLAYERSONLY )) sv.time += sv.frametime;
|
||||
if( !( sv.hostflags & SVF_PLAYERSONLY ))
|
||||
sv.time += sv.frametime;
|
||||
}
|
|
@ -294,7 +294,7 @@ void SV_BuildSaveComment( char *text, int maxlength )
|
|||
{
|
||||
const char *pName;
|
||||
edict_t *pWorld = EDICT_NUM( 0 );
|
||||
float time = svgame.globals->time;
|
||||
float time = svgame.time;
|
||||
|
||||
if( pWorld && pWorld->v.message )
|
||||
{
|
||||
|
@ -355,7 +355,6 @@ void LandmarkOrigin( SAVERESTOREDATA *pSaveData, vec3_t output, const char *pLan
|
|||
int EntityInSolid( edict_t *ent )
|
||||
{
|
||||
edict_t *pParent = ent->v.aiment;
|
||||
vec3_t point;
|
||||
|
||||
// if you're attached to a client, always go through
|
||||
if( SV_IsValidEdict( pParent ))
|
||||
|
@ -363,10 +362,7 @@ int EntityInSolid( edict_t *ent )
|
|||
if( pParent->v.flags & FL_CLIENT )
|
||||
return 0;
|
||||
}
|
||||
|
||||
VectorAverage( ent->v.absmin, ent->v.absmax, point );
|
||||
|
||||
return (SV_PointContents( point ) == CONTENTS_SOLID);
|
||||
return SV_TestEntityPosition( ent );
|
||||
}
|
||||
|
||||
void SV_ClearSaveDir( void )
|
||||
|
@ -1036,6 +1032,7 @@ int SV_LoadGameState( char const *level, bool createPlayers )
|
|||
|
||||
SV_SaveFinish( pSaveData );
|
||||
|
||||
// restore server time
|
||||
sv.time = header.time * 1000;
|
||||
|
||||
return 1;
|
||||
|
@ -1283,14 +1280,12 @@ void SV_ChangeLevel( bool loadfromsavedgame, const char *mapname, const char *st
|
|||
SV_SaveFinish( pSaveData );
|
||||
|
||||
svgame.globals->changelevel = true;
|
||||
svgame.globals->time = (sv.time * 0.001f);
|
||||
SV_LevelInit( level, oldlevel, startspot, true );
|
||||
sv.paused = true; // pause until all clients connect
|
||||
sv.loadgame = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
svgame.globals->time = (sv.time * 0.001f);
|
||||
SV_LevelInit( level, NULL, NULL, false );
|
||||
}
|
||||
|
||||
|
|
|
@ -109,9 +109,7 @@ void SV_TouchLinks( edict_t *ent, areanode_t *node )
|
|||
continue;
|
||||
}
|
||||
|
||||
svgame.globals->time = sv.time * 0.001f;
|
||||
svgame.dllFuncs.pfnTouch( touch, ent );
|
||||
|
||||
if( ent->free ) break; // killtarget issues
|
||||
}
|
||||
|
||||
|
|
|
@ -284,8 +284,8 @@ cpuinfo_t GetCPUInfo( void )
|
|||
|
||||
void Sys_InitMathlib( cpuinfo_t *cpu )
|
||||
{
|
||||
size_t size = 1024 * 1024;
|
||||
int i, start, min, result[8];
|
||||
size_t i, size = 1024 * 1024;
|
||||
double start, min, result[8];
|
||||
void *buf0 = Malloc( size );
|
||||
void *buf1 = Malloc( size );
|
||||
int numchecks = 16; // iterations
|
||||
|
@ -296,19 +296,19 @@ void Sys_InitMathlib( cpuinfo_t *cpu )
|
|||
if( Sys.app_name == HOST_NORMAL || Sys.app_name == HOST_DEDICATED )
|
||||
{
|
||||
// testing sqrt
|
||||
start = Sys_Milliseconds();
|
||||
start = Sys_DoubleTime();
|
||||
for( i = 1; i < 800000; i++ ) a = sqrtf( i );
|
||||
a *= 0.00000001;
|
||||
result[(int)a] = Sys_Milliseconds() - start;
|
||||
MsgDev( D_NOTE, "crt_sqrt %i ms\n", result[0] );
|
||||
result[(int)a] = Sys_DoubleTime() - start;
|
||||
MsgDev( D_NOTE, "crt_sqrt %i ms\n", (int)( result[0] * 1000 ));
|
||||
|
||||
if( cpu->m_bSSE )
|
||||
{
|
||||
start = Sys_Milliseconds();
|
||||
start = Sys_DoubleTime();
|
||||
for( i = 0; i < 800000; i++ ) a = sse_sqrt( i );
|
||||
a *= 0.00000001;
|
||||
result[(int)a+1] = Sys_Milliseconds() - start;
|
||||
MsgDev( D_NOTE, "sse_sqrt %i ms\n", result[1] );
|
||||
result[(int)a+1] = Sys_DoubleTime() - start;
|
||||
MsgDev( D_NOTE, "sse_sqrt %i ms\n", (int)( result[1] * 1000 ));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -329,27 +329,27 @@ void Sys_InitMathlib( cpuinfo_t *cpu )
|
|||
}
|
||||
}
|
||||
|
||||
start = Sys_Milliseconds();
|
||||
start = Sys_DoubleTime();
|
||||
for( i = 0; i < numchecks; i++ ) _crt_mem_copy( buf0, buf1, size, __FILE__, __LINE__ );
|
||||
result[0] = Sys_Milliseconds() - start;
|
||||
MsgDev( D_NOTE, "crt_memcpy %i ms\n", result[0] );
|
||||
result[0] = Sys_DoubleTime() - start;
|
||||
MsgDev( D_NOTE, "crt_memcpy %i ms\n", (int)( result[0] * 1000 ));
|
||||
|
||||
start = Sys_Milliseconds();
|
||||
start = Sys_DoubleTime();
|
||||
for( i = 0; i < numchecks; i++ ) _asm_mem_copy( buf0, buf1, size, __FILE__, __LINE__ );
|
||||
result[1] = Sys_Milliseconds() - start;
|
||||
MsgDev( D_NOTE, "asm_memcpy %i ms\n", result[1] );
|
||||
result[1] = Sys_DoubleTime() - start;
|
||||
MsgDev( D_NOTE, "asm_memcpy %i ms\n", (int)( result[1] * 1000 ));
|
||||
|
||||
start = Sys_Milliseconds();
|
||||
start = Sys_DoubleTime();
|
||||
for( i = 0; i < numchecks; i++ ) _com_mem_copy( buf0, buf1, size, __FILE__, __LINE__ );
|
||||
result[2] = Sys_Milliseconds() - start;
|
||||
MsgDev( D_NOTE, "com_memcpy %i ms\n", result[2] );
|
||||
result[2] = Sys_DoubleTime() - start;
|
||||
MsgDev( D_NOTE, "com_memcpy %i ms\n", (int)( result[2] * 1000 ));
|
||||
|
||||
if( cpu->m_bMMX )
|
||||
{
|
||||
start = Sys_Milliseconds();
|
||||
start = Sys_DoubleTime();
|
||||
for( i = 0; i < numchecks; i++ ) _mmx_mem_copy( buf0, buf1, size, __FILE__, __LINE__ );
|
||||
result[3] = Sys_Milliseconds() - start;
|
||||
MsgDev( D_NOTE, "mmx_memcpy %i ms\n", result[3] );
|
||||
result[3] = Sys_DoubleTime() - start;
|
||||
MsgDev( D_NOTE, "mmx_memcpy %i ms\n", (int)( result[3] * 1000 ));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -359,10 +359,10 @@ void Sys_InitMathlib( cpuinfo_t *cpu )
|
|||
|
||||
if( cpu->m_b3DNow )
|
||||
{
|
||||
start = Sys_Milliseconds();
|
||||
start = Sys_DoubleTime();
|
||||
for( i = 0; i < numchecks; i++ ) _amd_mem_copy( buf0, buf1, size, __FILE__, __LINE__ );
|
||||
result[4] = Sys_Milliseconds() - start;
|
||||
MsgDev( D_NOTE, "amd_memcpy %i ms\n", result[4] );
|
||||
result[4] = Sys_DoubleTime() - start;
|
||||
MsgDev( D_NOTE, "amd_memcpy %i ms\n", (int)( result[4] * 1000 ));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -398,27 +398,27 @@ void Sys_InitMathlib( cpuinfo_t *cpu )
|
|||
}
|
||||
|
||||
// memset
|
||||
start = Sys_Milliseconds();
|
||||
start = Sys_DoubleTime();
|
||||
for( i = 0; i < numchecks; i++ ) _crt_mem_set( buf0, 0, size, __FILE__, __LINE__ );
|
||||
result[0] = Sys_Milliseconds() - start;
|
||||
MsgDev( D_NOTE, "crt_memset %i ms\n", result[0] );
|
||||
result[0] = Sys_DoubleTime() - start;
|
||||
MsgDev( D_NOTE, "crt_memset %i ms\n", (int)( result[0] * 1000 ));
|
||||
|
||||
start = Sys_Milliseconds();
|
||||
start = Sys_DoubleTime();
|
||||
for( i = 0; i < numchecks; i++ ) _asm_mem_set( buf0, 0, size, __FILE__, __LINE__ );
|
||||
result[1] = Sys_Milliseconds() - start;
|
||||
MsgDev( D_NOTE, "asm_memset %i ms\n", result[1] );
|
||||
result[1] = Sys_DoubleTime() - start;
|
||||
MsgDev( D_NOTE, "asm_memset %i ms\n", (int)( result[1] * 1000 ));
|
||||
|
||||
start = Sys_Milliseconds();
|
||||
start = Sys_DoubleTime();
|
||||
for( i = 0; i < numchecks; i++ ) _com_mem_set( buf0, 0, size, __FILE__, __LINE__ );
|
||||
result[2] = Sys_Milliseconds() - start;
|
||||
MsgDev( D_NOTE, "com_memset %i ms\n", result[2] );
|
||||
result[2] = Sys_DoubleTime() - start;
|
||||
MsgDev( D_NOTE, "com_memset %i ms\n", (int)( result[2] * 1000 ));
|
||||
|
||||
if( cpu->m_bMMX )
|
||||
{
|
||||
start = Sys_Milliseconds();
|
||||
start = Sys_DoubleTime();
|
||||
for( i = 0; i < numchecks; i++ ) _mmx_mem_set( buf0, 0, size, __FILE__, __LINE__ );
|
||||
result[3] = Sys_Milliseconds() - start;
|
||||
MsgDev( D_NOTE, "mmx_memset %i ms\n", result[3] );
|
||||
result[3] = Sys_DoubleTime() - start;
|
||||
MsgDev( D_NOTE, "mmx_memset %i ms\n", (int)( result[3] * 1000 ));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -474,16 +474,16 @@ void Sys_InitCPU( void )
|
|||
}
|
||||
|
||||
com_strcpy(szFeatureString, "" );
|
||||
if( cpu.m_bMMX ) com_strcat(szFeatureString, "MMX " );
|
||||
if( cpu.m_b3DNow ) com_strcat(szFeatureString, "3DNow " );
|
||||
if( cpu.m_bSSE ) com_strcat(szFeatureString, "SSE " );
|
||||
if( cpu.m_bSSE2 ) com_strcat(szFeatureString, "SSE2 " );
|
||||
if( cpu.m_bRDTSC ) com_strcat(szFeatureString, "RDTSC " );
|
||||
if( cpu.m_bCMOV ) com_strcat(szFeatureString, "CMOV " );
|
||||
if( cpu.m_bFCMOV ) com_strcat(szFeatureString, "FCMOV " );
|
||||
if( cpu.m_bMMX ) com.strcat( szFeatureString, "MMX " );
|
||||
if( cpu.m_b3DNow ) com.strcat( szFeatureString, "3DNow " );
|
||||
if( cpu.m_bSSE ) com.strcat( szFeatureString, "SSE " );
|
||||
if( cpu.m_bSSE2 ) com.strcat( szFeatureString, "SSE2 " );
|
||||
if( cpu.m_bRDTSC ) com.strcat( szFeatureString, "RDTSC " );
|
||||
if( cpu.m_bCMOV ) com.strcat( szFeatureString, "CMOV " );
|
||||
if( cpu.m_bFCMOV ) com.strcat( szFeatureString, "FCMOV " );
|
||||
|
||||
// Remove the trailing space. There will always be one.
|
||||
szFeatureString[com_strlen(szFeatureString)-1] = '\0';
|
||||
szFeatureString[com.strlen( szFeatureString ) - 1] = '\0';
|
||||
|
||||
// Dump CPU information:
|
||||
if( cpu.m_usNumLogicCore == 1 ) MsgDev( D_INFO, "CPU: %s [1 core]. Frequency: %.01f %s\n", cpu.m_szCPUID, fFrequency, szFrequencyDenomination );
|
||||
|
|
|
@ -92,6 +92,8 @@ typedef struct system_s
|
|||
typedef struct timer_s
|
||||
{
|
||||
bool initialized; // any timer can be setup it
|
||||
bool hardware_timer; // QueryPerfomanceCounter is present
|
||||
|
||||
double oldtime;
|
||||
double curtime;
|
||||
dword timebase;
|
||||
|
@ -118,7 +120,7 @@ typedef struct cvar_s
|
|||
};
|
||||
|
||||
extern system_t Sys;
|
||||
extern timer_t Msec;
|
||||
extern timer_t Clock;
|
||||
extern sysinfo_t SI;
|
||||
extern stdlib_api_t com;
|
||||
|
||||
|
|
103
launch/system.c
103
launch/system.c
|
@ -16,7 +16,7 @@
|
|||
system_t Sys;
|
||||
stdlib_api_t com;
|
||||
baserc_exp_t *rc; // library of resources
|
||||
timer_t Msec;
|
||||
timer_t Clock;
|
||||
launch_exp_t *Host; // callback to mainframe
|
||||
sys_event_t event_que[MAX_QUED_EVENTS];
|
||||
int event_head, event_tail;
|
||||
|
@ -706,30 +706,87 @@ Sys_DoubleTime
|
|||
*/
|
||||
double Sys_DoubleTime( void )
|
||||
{
|
||||
double newtime;
|
||||
double newtime;
|
||||
|
||||
if( !Msec.initialized )
|
||||
// LordHavoc: note to people modifying this code,
|
||||
// DWORD is specifically defined as an unsigned 32bit number,
|
||||
// therefore the 65536.0 * 65536.0 is fine.
|
||||
if( SI.cpunum > 1 || !Clock.hardware_timer )
|
||||
{
|
||||
timeBeginPeriod( 1 );
|
||||
Msec.timebase = timeGetTime();
|
||||
Msec.initialized = true;
|
||||
Msec.oldtime = (double)timeGetTime() * 0.001;
|
||||
}
|
||||
newtime = ( double )timeGetTime() * 0.001;
|
||||
// timeGetTime
|
||||
// platform:
|
||||
// Windows 95/98/ME/NT/2000/XP
|
||||
// features:
|
||||
// reasonable accuracy (millisecond)
|
||||
// issues:
|
||||
// wraps around every 47 days or so (but this is non-fatal to us,
|
||||
// odd times are rejected, only causes a one frame stutter)
|
||||
|
||||
if( newtime < Msec.oldtime )
|
||||
// make sure the timer is high precision, otherwise different versions of
|
||||
// windows have varying accuracy
|
||||
if( !Clock.timebase )
|
||||
{
|
||||
timeBeginPeriod( 1 );
|
||||
Clock.timebase = timeGetTime();
|
||||
}
|
||||
|
||||
newtime = (double)timeGetTime() * 0.001;
|
||||
}
|
||||
else
|
||||
{
|
||||
// QueryPerformanceCounter
|
||||
// platform:
|
||||
// Windows 95/98/ME/NT/2000/XP
|
||||
// features:
|
||||
// very accurate (CPU cycles)
|
||||
// known issues:
|
||||
// does not necessarily match realtime too well
|
||||
// (tends to get faster and faster in win98)
|
||||
// wraps around occasionally on some platforms
|
||||
// (depends on CPU speed and probably other unknown factors)
|
||||
|
||||
LARGE_INTEGER PerformanceFreq;
|
||||
LARGE_INTEGER PerformanceCount;
|
||||
double timescale;
|
||||
|
||||
if( !QueryPerformanceFrequency( &PerformanceFreq ))
|
||||
{
|
||||
MsgDev( D_NOTE, "Sys_Time: no hardware timer available, use timeGetTime()\n" );
|
||||
|
||||
// fall back to timeGetTime
|
||||
Clock.hardware_timer = false;
|
||||
return Sys_DoubleTime();
|
||||
}
|
||||
|
||||
QueryPerformanceCounter( &PerformanceCount );
|
||||
|
||||
timescale = 1.0 / ((double)PerformanceFreq.LowPart + (double)PerformanceFreq.HighPart * 65536.0 * 65536.0);
|
||||
newtime = ((double)PerformanceCount.LowPart + (double)PerformanceCount.HighPart * 65536.0 * 65536.0) * timescale;
|
||||
}
|
||||
|
||||
if( !Clock.initialized )
|
||||
{
|
||||
Clock.oldtime = newtime;
|
||||
Clock.initialized = true;
|
||||
}
|
||||
|
||||
if( newtime < Clock.oldtime )
|
||||
{
|
||||
// warn if it's significant
|
||||
if( newtime - Msec.oldtime < -0.01 )
|
||||
if( newtime - Clock.oldtime < -0.01 )
|
||||
{
|
||||
MsgDev( D_ERROR, "Sys_DoubleTime: time stepped backwards\n" );
|
||||
MsgDev( D_NOTE, "(went from %f to %f, difference %f)\n", Msec.oldtime, newtime, newtime - Msec.oldtime );
|
||||
MsgDev( D_NOTE, "(went from %f to %f, difference %f)\n", Clock.oldtime, newtime, newtime - Clock.oldtime );
|
||||
}
|
||||
}
|
||||
else Msec.curtime += newtime - Msec.oldtime;
|
||||
Msec.oldtime = newtime;
|
||||
else
|
||||
{
|
||||
Clock.curtime += newtime - Clock.oldtime;
|
||||
}
|
||||
|
||||
return Msec.curtime;
|
||||
Clock.oldtime = newtime;
|
||||
|
||||
return Clock.curtime;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -741,13 +798,12 @@ dword Sys_Milliseconds( void )
|
|||
{
|
||||
dword curtime;
|
||||
|
||||
if( !Msec.initialized )
|
||||
if( !Clock.timebase )
|
||||
{
|
||||
timeBeginPeriod( 1 );
|
||||
Msec.timebase = timeGetTime();
|
||||
Msec.initialized = true;
|
||||
Clock.timebase = timeGetTime();
|
||||
}
|
||||
curtime = timeGetTime() - Msec.timebase;
|
||||
curtime = timeGetTime() - Clock.timebase;
|
||||
|
||||
return curtime;
|
||||
}
|
||||
|
@ -957,7 +1013,8 @@ void Sys_Init( void )
|
|||
|
||||
lpBuffer.dwLength = sizeof( MEMORYSTATUS );
|
||||
GlobalMemoryStatus( &lpBuffer );
|
||||
ZeroMemory( &Msec, sizeof( Msec )); // can't use memset - not init
|
||||
ZeroMemory( &Clock, sizeof( Clock )); // can't use memset - not init
|
||||
Clock.hardware_timer = true; // predict state
|
||||
Sys.logfile = NULL;
|
||||
|
||||
// get current hInstance
|
||||
|
@ -1350,7 +1407,7 @@ void Sys_QueEvent( int time, ev_type_t type, int value, int value2, int length,
|
|||
{
|
||||
MsgDev( D_ERROR, "Sys_QueEvent: overflow\n");
|
||||
// make sure what memory is allocated by engine
|
||||
if(Mem_IsAllocated( ev->data )) Mem_Free( ev->data );
|
||||
if( Mem_IsAllocated( ev->data )) Mem_Free( ev->data );
|
||||
event_tail++;
|
||||
}
|
||||
event_head++;
|
||||
|
@ -1383,7 +1440,7 @@ sys_event_t Sys_GetEvent( void )
|
|||
if( event_head > event_tail )
|
||||
{
|
||||
event_tail++;
|
||||
return event_que[(event_tail-1) & MASK_QUED_EVENTS];
|
||||
return event_que[(event_tail - 1) & MASK_QUED_EVENTS];
|
||||
}
|
||||
|
||||
// pump the message loop
|
||||
|
@ -1408,7 +1465,7 @@ sys_event_t Sys_GetEvent( void )
|
|||
|
||||
len = com_strlen( s ) + 1;
|
||||
b = Malloc( len );
|
||||
com_strncpy( b, s, len - 1 );
|
||||
com.strncpy( b, s, len - 1 );
|
||||
Sys_QueEvent( 0, SE_CONSOLE, 0, 0, len, b );
|
||||
}
|
||||
|
||||
|
|
|
@ -82,14 +82,14 @@ void CM_CalcPHS( void )
|
|||
byte *scan, *visdata;
|
||||
uint *dest, *src;
|
||||
int hcount, vcount;
|
||||
uint timestart;
|
||||
double timestart;
|
||||
int bitbyte;
|
||||
|
||||
if( !worldmodel || !cm.pvs )
|
||||
return;
|
||||
|
||||
MsgDev( D_NOTE, "Building PAS...\n" );
|
||||
timestart = Sys_Milliseconds();
|
||||
timestart = Sys_DoubleTime();
|
||||
|
||||
num = worldmodel->numleafs;
|
||||
rowwords = (num + 31)>>5;
|
||||
|
@ -169,7 +169,7 @@ void CM_CalcPHS( void )
|
|||
}
|
||||
|
||||
MsgDev( D_NOTE, "Average leaves visible / audible / total: %i / %i / %i\n", vcount / num, hcount / num, num );
|
||||
MsgDev( D_NOTE, "PAS building time: %g secs\n", (Sys_Milliseconds() - timestart) * 0.001f );
|
||||
MsgDev( D_NOTE, "PAS building time: %g secs\n", Sys_DoubleTime() - timestart );
|
||||
}
|
||||
|
||||
/*
|
|
@ -60,9 +60,9 @@ chull_t *CM_HullForEntity( edict_t *ent, vec3_t mins, vec3_t maxs, vec3_t offset
|
|||
// point hull
|
||||
hull = &model->hulls[0];
|
||||
}
|
||||
else if( size[0] <= 36 )
|
||||
else if( size[0] <= 32 )
|
||||
{
|
||||
if( size[2] < 36 )
|
||||
if( size[2] < 54 )
|
||||
{
|
||||
// head hull (ducked)
|
||||
hull = &model->hulls[3];
|
|
@ -1,24 +1,24 @@
|
|||
# Microsoft Developer Studio Project File - Name="cms_hl" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Project File - Name="physic" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=cms_hl - Win32 Debug
|
||||
CFG=physic - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "cms_hl.mak".
|
||||
!MESSAGE NMAKE /f "physic.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "cms_hl.mak" CFG="cms_hl - Win32 Debug"
|
||||
!MESSAGE NMAKE /f "physic.mak" CFG="physic - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "cms_hl - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "cms_hl - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "physic - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "physic - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
|
@ -29,7 +29,7 @@ CPP=cl.exe
|
|||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "cms_hl - Win32 Release"
|
||||
!IF "$(CFG)" == "physic - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
|
@ -38,8 +38,8 @@ RSC=rc.exe
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\temp\cms_hl\!release"
|
||||
# PROP Intermediate_Dir "..\temp\cms_hl\!release"
|
||||
# PROP Output_Dir "..\temp\physic\!release"
|
||||
# PROP Intermediate_Dir "..\temp\physic\!release"
|
||||
# PROP Ignore_Export_Lib 1
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHYSIC_EXPORTS" /YX /FD /c
|
||||
|
@ -56,16 +56,16 @@ 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
|
||||
# ADD LINK32 user32.lib msvcrt.lib /nologo /dll /pdb:none /machine:I386 /nodefaultlib:"libc.lib" /libpath:"../public/libs/"
|
||||
# Begin Custom Build
|
||||
TargetDir=\Xash3D\src_main\temp\cms_hl\!release
|
||||
InputPath=\Xash3D\src_main\temp\cms_hl\!release\cms_hl.dll
|
||||
TargetDir=\Xash3D\src_main\temp\physic\!release
|
||||
InputPath=\Xash3D\src_main\temp\physic\!release\physic.dll
|
||||
SOURCE="$(InputPath)"
|
||||
|
||||
"D:\Xash3D\bin\cms_hl.dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
copy $(TargetDir)\cms_hl.dll "D:\Xash3D\bin\cms_hl.dll"
|
||||
"D:\Xash3D\bin\physic.dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
copy $(TargetDir)\physic.dll "D:\Xash3D\bin\physic.dll"
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "cms_hl - Win32 Debug"
|
||||
!ELSEIF "$(CFG)" == "physic - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
|
@ -74,8 +74,8 @@ SOURCE="$(InputPath)"
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "..\temp\cms_hl\!debug"
|
||||
# PROP Intermediate_Dir "..\temp\cms_hl\!debug"
|
||||
# PROP Output_Dir "..\temp\physic\!debug"
|
||||
# PROP Intermediate_Dir "..\temp\physic\!debug"
|
||||
# PROP Ignore_Export_Lib 1
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHYSIC_EXPORTS" /YX /FD /GZ /c
|
||||
|
@ -93,12 +93,12 @@ LINK32=link.exe
|
|||
# ADD LINK32 user32.lib msvcrtd.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"libc.lib" /pdbtype:sept
|
||||
# SUBTRACT LINK32 /nodefaultlib
|
||||
# Begin Custom Build
|
||||
TargetDir=\Xash3D\src_main\temp\cms_hl\!debug
|
||||
InputPath=\Xash3D\src_main\temp\cms_hl\!debug\cms_hl.dll
|
||||
TargetDir=\Xash3D\src_main\temp\physic\!debug
|
||||
InputPath=\Xash3D\src_main\temp\physic\!debug\physic.dll
|
||||
SOURCE="$(InputPath)"
|
||||
|
||||
"D:\Xash3D\bin\cms_hl.dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
copy $(TargetDir)\cms_hl.dll "D:\Xash3D\bin\cms_hl.dll"
|
||||
"D:\Xash3D\bin\physic.dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
copy $(TargetDir)\physic.dll "D:\Xash3D\bin\physic.dll"
|
||||
|
||||
# End Custom Build
|
||||
|
||||
|
@ -106,8 +106,8 @@ SOURCE="$(InputPath)"
|
|||
|
||||
# Begin Target
|
||||
|
||||
# Name "cms_hl - Win32 Release"
|
||||
# Name "cms_hl - Win32 Debug"
|
||||
# Name "physic - Win32 Release"
|
||||
# Name "physic - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
|
@ -132,7 +132,7 @@ typedef struct
|
|||
file_t *file;
|
||||
int headerlen;
|
||||
|
||||
uint time; // Sys_Milliseconds for first cinematic frame
|
||||
float time; // curtime for first cinematic frame
|
||||
uint frame;
|
||||
} cinematics_t;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ if errorlevel 1 set BUILD_ERROR=1
|
|||
%MSDEV% launch/launch.dsp %CONFIG%"launch - Win32 Release" %build_target%
|
||||
if errorlevel 1 set BUILD_ERROR=1
|
||||
|
||||
%MSDEV% cms_hl/cms_hl.dsp %CONFIG%"cms_hl - Win32 Release" %build_target%
|
||||
%MSDEV% physic/physic.dsp %CONFIG%"physic - Win32 Release" %build_target%
|
||||
if errorlevel 1 set BUILD_ERROR=1
|
||||
|
||||
%MSDEV% vid_gl/vid_gl.dsp %CONFIG%"vid_gl - Win32 Release" %build_target%
|
||||
|
@ -68,7 +68,7 @@ if exist bshift\bshift.plg del /f /q bshift\bshift.plg
|
|||
if exist client\client.plg del /f /q client\client.plg
|
||||
if exist engine\engine.plg del /f /q engine\engine.plg
|
||||
if exist launch\launch.plg del /f /q launch\launch.plg
|
||||
if exist cms_hl\cms_hl.plg del /f /q cms_hl\cms_hl.plg
|
||||
if exist physic\physic.plg del /f /q physic\physic.plg
|
||||
if exist vid_gl\vid_gl.plg del /f /q vid_gl\vid_gl.plg
|
||||
if exist server\server.plg del /f /q server\server.plg
|
||||
if exist spirit\spirit.plg del /f /q spirit\spirit.plg
|
||||
|
|
|
@ -357,7 +357,7 @@ channel_t *SND_PickDynamicChannel( int entnum, int channel, sfx_t *sfx )
|
|||
{
|
||||
int ch_idx;
|
||||
int first_to_die;
|
||||
int life_left;
|
||||
float life_left;
|
||||
|
||||
// check for replacement sound, or find the best one to replace
|
||||
first_to_die = -1;
|
||||
|
@ -580,7 +580,7 @@ void S_StartSound( const vec3_t pos, int ent, int chan, sound_t handle, float fv
|
|||
|
||||
target_chan->entnum = ent;
|
||||
target_chan->entchannel = chan;
|
||||
target_chan->startTime = Sys_Milliseconds();
|
||||
target_chan->startTime = Sys_DoubleTime();
|
||||
VectorCopy( pos, target_chan->position );
|
||||
target_chan->volume = vol;
|
||||
target_chan->entnum = ent;
|
||||
|
@ -661,7 +661,7 @@ void S_StaticSound( const vec3_t pos, int ent, int chan, sound_t handle, float f
|
|||
|
||||
ch->entnum = ent;
|
||||
ch->entchannel = chan;
|
||||
ch->startTime = Sys_Milliseconds();
|
||||
ch->startTime = Sys_DoubleTime();
|
||||
VectorCopy( pos, ch->position );
|
||||
ch->volume = vol;
|
||||
ch->entnum = ent;
|
||||
|
|
|
@ -72,7 +72,7 @@ typedef struct
|
|||
|
||||
int entnum; // to allow overriding a specific sound
|
||||
int entchannel;
|
||||
uint startTime; // for overriding oldest sounds
|
||||
float startTime; // for overriding oldest sounds
|
||||
bool staticsound; // use position instead of fetching entity's origin
|
||||
vec3_t position; // only use if fixedPosition is set
|
||||
float volume;
|
||||
|
|
|
@ -559,8 +559,7 @@ void CBaseEntity::Activate( void )
|
|||
m_activated = TRUE;
|
||||
InitMoveWith();
|
||||
|
||||
if( !gpGlobals->changelevel )
|
||||
PostSpawn();
|
||||
PostSpawn();
|
||||
}
|
||||
|
||||
//LRC- called by activate() to support movewith
|
||||
|
|
|
@ -479,7 +479,6 @@ void CWorld :: Spawn( void )
|
|||
{
|
||||
g_fGameOver = FALSE;
|
||||
Precache( );
|
||||
g_flWeaponCheat = CVAR_GET_FLOAT( "sv_cheats" ); // Is the impulse 101 command allowed?
|
||||
}
|
||||
|
||||
void CWorld :: Precache( void )
|
||||
|
@ -634,6 +633,9 @@ void CWorld :: Precache( void )
|
|||
else
|
||||
CVAR_SET_FLOAT( "sv_zmax", 0 ); // let the renderer calculate optimal value
|
||||
|
||||
// g-cont. moved here to right restore global WaveHeight on save\restore level
|
||||
CVAR_SET_FLOAT( "sv_wateramp", pev->scale );
|
||||
|
||||
if ( pev->netname )
|
||||
{
|
||||
ALERT( at_aiconsole, "Chapter title: %s\n", STRING(pev->netname) );
|
||||
|
@ -670,6 +672,8 @@ void CWorld :: Precache( void )
|
|||
{
|
||||
CVAR_SET_FLOAT( "mp_defaultteam", 0 );
|
||||
}
|
||||
|
||||
g_flWeaponCheat = CVAR_GET_FLOAT( "sv_cheats" ); // Is the impulse 101 command allowed?
|
||||
}
|
||||
|
||||
|
||||
|
@ -693,7 +697,6 @@ void CWorld :: KeyValue( KeyValueData *pkvd )
|
|||
// Sent over net now.
|
||||
pev->scale = atof(pkvd->szValue) * (1.0/8.0);
|
||||
pkvd->fHandled = TRUE;
|
||||
CVAR_SET_FLOAT( "sv_wateramp", pev->scale );
|
||||
}
|
||||
else if ( FStrEq(pkvd->szKeyName, "MaxRange") )
|
||||
{
|
||||
|
|
5
todo.log
5
todo.log
|
@ -48,4 +48,7 @@ Xash 0.72 Stable 13.12.10
|
|||
24.remove all unused stuff in engine
|
||||
25.regrouping resources in baserc
|
||||
26.implement lighting in render OK
|
||||
27.implement dlights
|
||||
27.implement dlights OK
|
||||
28.rework SV_PointContents
|
||||
29.implement sound library
|
||||
30.rewrite engine timer
|
||||
|
|
|
@ -431,7 +431,7 @@ void R_BackendEndFrame( void )
|
|||
break;
|
||||
case 2:
|
||||
com.snprintf( r_speeds_msg, sizeof( r_speeds_msg ),
|
||||
"lvs: %5i node: %5i\nfarclip: %6.f",
|
||||
"lvs: %.8f node: %.8f\nfarclip: %6.f",
|
||||
r_mark_leaves,
|
||||
r_world_node,
|
||||
RI.farClip
|
||||
|
@ -439,7 +439,7 @@ void R_BackendEndFrame( void )
|
|||
break;
|
||||
case 3:
|
||||
com.snprintf( r_speeds_msg, sizeof( r_speeds_msg ),
|
||||
"polys\\ents: %5i\\%5i\nsort\\draw: %5i\\%i",
|
||||
"polys\\ents: %.8f\\%.8f\nsort\\draw: %.8f\\%.8f",
|
||||
r_add_polys, r_add_entities,
|
||||
r_sort_meshes, r_draw_meshes
|
||||
);
|
||||
|
|
|
@ -75,7 +75,7 @@ R_StopRoQ
|
|||
static void R_StopRoQ( cinematics_t *cin )
|
||||
{
|
||||
cin->frame = 0;
|
||||
cin->time = 0; // done
|
||||
cin->time = 0.0f; // done
|
||||
cin->pic = NULL;
|
||||
cin->pic_pending = NULL;
|
||||
|
||||
|
|
|
@ -306,9 +306,9 @@ extern int r_framecount;
|
|||
extern int r_framecount2;
|
||||
extern int c_brush_polys, c_world_leafs;
|
||||
|
||||
extern int r_mark_leaves, r_world_node;
|
||||
extern int r_add_polys, r_add_entities;
|
||||
extern int r_sort_meshes, r_draw_meshes;
|
||||
extern double r_mark_leaves, r_world_node;
|
||||
extern double r_add_polys, r_add_entities;
|
||||
extern double r_sort_meshes, r_draw_meshes;
|
||||
|
||||
extern msurface_t *r_debug_surface;
|
||||
|
||||
|
|
|
@ -56,9 +56,9 @@ int r_framecount2; // used bonestransform checking
|
|||
|
||||
int c_brush_polys, c_world_leafs;
|
||||
|
||||
int r_mark_leaves, r_world_node;
|
||||
int r_add_polys, r_add_entities;
|
||||
int r_sort_meshes, r_draw_meshes;
|
||||
double r_mark_leaves, r_world_node;
|
||||
double r_add_polys, r_add_entities;
|
||||
double r_sort_meshes, r_draw_meshes;
|
||||
|
||||
msurface_t *r_debug_surface;
|
||||
|
||||
|
@ -1567,7 +1567,7 @@ RI.refdef must be set before the first call
|
|||
*/
|
||||
void R_RenderView( const ref_params_t *fd )
|
||||
{
|
||||
int msec = 0;
|
||||
double starttime;
|
||||
bool shadowMap = RI.params & RP_SHADOWMAPVIEW ? true : false;
|
||||
|
||||
RI.refdef = *fd;
|
||||
|
@ -1600,12 +1600,12 @@ void R_RenderView( const ref_params_t *fd )
|
|||
R_SetupFrustum();
|
||||
|
||||
if( r_speeds->integer )
|
||||
msec = Sys_Milliseconds();
|
||||
starttime = Sys_DoubleTime();
|
||||
|
||||
R_MarkLeaves();
|
||||
|
||||
if( r_speeds->integer )
|
||||
r_mark_leaves += ( Sys_Milliseconds() - msec );
|
||||
r_mark_leaves += ( Sys_DoubleTime() - starttime );
|
||||
|
||||
R_DrawWorld();
|
||||
|
||||
|
@ -1617,20 +1617,21 @@ void R_RenderView( const ref_params_t *fd )
|
|||
R_DrawCoronas();
|
||||
|
||||
if( r_speeds->integer )
|
||||
msec = Sys_Milliseconds();
|
||||
starttime = Sys_DoubleTime();
|
||||
|
||||
R_AddPolysToList();
|
||||
|
||||
if( r_speeds->integer )
|
||||
r_add_polys += ( Sys_Milliseconds() - msec );
|
||||
r_add_polys += ( Sys_DoubleTime() - starttime );
|
||||
}
|
||||
|
||||
if( r_speeds->integer ) msec = Sys_Milliseconds();
|
||||
if( r_speeds->integer )
|
||||
starttime = Sys_DoubleTime();
|
||||
|
||||
R_DrawEntities();
|
||||
|
||||
if( r_speeds->integer )
|
||||
r_add_entities += ( Sys_Milliseconds() - msec );
|
||||
r_add_entities += ( Sys_DoubleTime() - starttime );
|
||||
|
||||
if( shadowMap )
|
||||
{
|
||||
|
@ -1642,12 +1643,12 @@ void R_RenderView( const ref_params_t *fd )
|
|||
}
|
||||
|
||||
if( r_speeds->integer )
|
||||
msec = Sys_Milliseconds();
|
||||
starttime = Sys_DoubleTime();
|
||||
|
||||
R_SortMeshes();
|
||||
|
||||
if( r_speeds->integer )
|
||||
r_sort_meshes += ( Sys_Milliseconds() - msec );
|
||||
r_sort_meshes += ( Sys_DoubleTime() - starttime );
|
||||
|
||||
R_DrawPortals();
|
||||
|
||||
|
@ -1659,12 +1660,12 @@ void R_RenderView( const ref_params_t *fd )
|
|||
R_Clear( shadowMap ? ~( GL_STENCIL_BUFFER_BIT|GL_COLOR_BUFFER_BIT ) : ~0 );
|
||||
|
||||
if( r_speeds->integer )
|
||||
msec = Sys_Milliseconds();
|
||||
starttime = Sys_DoubleTime();
|
||||
|
||||
R_DrawMeshes();
|
||||
|
||||
if( r_speeds->integer )
|
||||
r_draw_meshes += ( Sys_Milliseconds() - msec );
|
||||
r_draw_meshes += ( Sys_DoubleTime() - starttime );
|
||||
|
||||
R_BackendCleanUpTextureUnits();
|
||||
|
||||
|
|
|
@ -2518,8 +2518,8 @@ static void R_TraceGrid( int num )
|
|||
|
||||
void R_BuildLightGrid( mbrushmodel_t *world )
|
||||
{
|
||||
double timestart = Sys_DoubleTime();
|
||||
int i;
|
||||
uint timestart = Sys_Milliseconds();
|
||||
|
||||
MsgDev( D_INFO, "Building LightGrid...\n" );
|
||||
|
||||
|
@ -2544,7 +2544,7 @@ void R_BuildLightGrid( mbrushmodel_t *world )
|
|||
R_TraceGrid( i );
|
||||
|
||||
Msg( "numGridPoints %i, mem %s\n", world->numgridpoints, memprint( world->numgridpoints * sizeof( mgridlight_t )));
|
||||
MsgDev( D_INFO, "LightGrid building time: %g secs\n", (Sys_Milliseconds() - timestart) * 0.001f );
|
||||
MsgDev( D_INFO, "LightGrid building time: %g secs\n", Sys_DoubleTime() - timestart );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1170,10 +1170,12 @@ void R_StudioSetUpTransform( ref_entity_t *e, bool trivial_accept )
|
|||
}
|
||||
}
|
||||
|
||||
if( e->ent_type == ED_CLIENT || e->ent_type == ED_MONSTER )
|
||||
angles[PITCH] = 0; // don't rotate clients and monsters, only aim
|
||||
// don't rotate clients, only aim
|
||||
if( e->ent_type == ED_CLIENT )
|
||||
angles[PITCH] = 0;
|
||||
|
||||
if( e->ent_type == ED_VIEWMODEL ) angles[PITCH] = -angles[PITCH]; // stupid Half-Life bug
|
||||
if( e->ent_type == ED_VIEWMODEL )
|
||||
angles[PITCH] = -angles[PITCH]; // stupid Half-Life bug
|
||||
|
||||
Matrix4x4_CreateFromEntity( m_protationmatrix, origin[0], origin[1], origin[2], -angles[PITCH], angles[YAW], angles[ROLL], e->scale );
|
||||
|
||||
|
|
|
@ -589,8 +589,9 @@ R_DrawWorld
|
|||
*/
|
||||
void R_DrawWorld( void )
|
||||
{
|
||||
int clipflags, msec = 0;
|
||||
int clipflags;
|
||||
uint dlightbits;
|
||||
double starttime;
|
||||
|
||||
if( !r_drawworld->integer )
|
||||
return;
|
||||
|
@ -623,7 +624,7 @@ void R_DrawWorld( void )
|
|||
else clipflags = RI.clipFlags;
|
||||
|
||||
if( r_speeds->integer )
|
||||
msec = Sys_Milliseconds();
|
||||
starttime = Sys_DoubleTime();
|
||||
|
||||
if( r_dynamiclight->integer != 1 || r_fullbright->integer )
|
||||
dlightbits = 0;
|
||||
|
@ -633,7 +634,7 @@ void R_DrawWorld( void )
|
|||
else R_RecursiveWorldNode( r_worldbrushmodel->nodes, clipflags, dlightbits );
|
||||
|
||||
if( r_speeds->integer )
|
||||
r_world_node += Sys_Milliseconds() - msec;
|
||||
r_world_node += Sys_DoubleTime() - starttime;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Reference in New Issue