18 Jun 2010

This commit is contained in:
g-cont 2010-06-18 00:00:00 +04:00 committed by Alibek Omarov
parent 7efdf1ea1b
commit b891de956d
47 changed files with 329 additions and 317 deletions

View File

@ -34,7 +34,7 @@ launch\ximage\
launch\imagelib\ launch\imagelib\
launch\extragen\ launch\extragen\
launch\soundlib\ launch\soundlib\
cms_hl\ physic\
public\ public\
server\ server\
server\ents\ server\ents\

View File

@ -473,7 +473,6 @@ void CWorld :: Spawn( void )
{ {
g_fGameOver = FALSE; g_fGameOver = FALSE;
Precache( ); Precache( );
g_flWeaponCheat = CVAR_GET_FLOAT( "sv_cheats" ); // Is the impulse 101 command allowed?
} }
void CWorld :: Precache( void ) void CWorld :: Precache( void )
@ -642,6 +641,9 @@ void CWorld :: Precache( void )
else else
CVAR_SET_FLOAT( "sv_zmax", 0 ); // let the renderer calculate optimal value 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 ) if ( pev->netname )
{ {
ALERT( at_aiconsole, "Chapter title: %s\n", STRING(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 ); CVAR_SET_FLOAT( "mp_defaultteam", 0 );
} }
g_flWeaponCheat = CVAR_GET_FLOAT( "sv_cheats" ); // Is the impulse 101 command allowed?
} }

View File

@ -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 ); 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 ); g_pTempEnts->AllocDLight( pos, RANDOM_LONG( 400, 430 ), 0.001f, 0 );

View File

@ -23,7 +23,7 @@ if errorlevel 1 set BUILD_ERROR=1
%MSDEV% launch/launch.dsp %CONFIG%"launch - Win32 Debug" %build_target% %MSDEV% launch/launch.dsp %CONFIG%"launch - Win32 Debug" %build_target%
if errorlevel 1 set BUILD_ERROR=1 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 if errorlevel 1 set BUILD_ERROR=1
%MSDEV% vid_gl/vid_gl.dsp %CONFIG%"vid_gl - Win32 Debug" %build_target% %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 client\client.plg del /f /q client\client.plg
if exist engine\engine.plg del /f /q engine\engine.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 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 server\server.plg del /f /q server\server.plg
if exist spirit\spirit.plg del /f /q spirit\spirit.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 if exist vid_gl\vid_gl.plg del /f /q vid_gl\vid_gl.plg

View File

@ -193,7 +193,7 @@ void CL_LevelShot_f( void )
// check for exist // check for exist
com.sprintf( cls.shotname, "levelshots/%s.%s", cl.configstrings[CS_NAME], LEVELSHOT_TYPE ); 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 cls.scrshot_action = scrshot_plaque; // build new frame for levelshot
else cls.scrshot_action = scrshot_inactive; // disable - not needs else cls.scrshot_action = scrshot_inactive; // disable - not needs
} }

View File

@ -512,7 +512,7 @@ void CL_ParseServerData( sizebuf_t *msg )
Cvar_SetValue( "scr_loading", 0.0f ); // reset progress bar Cvar_SetValue( "scr_loading", 0.0f ); // reset progress bar
// FIXME: Quake3 may be use both 'jpg' and 'tga' levelshot types // 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 Cvar_Set( "cl_levelshot_name", MAP_DEFAULT_SHADER ); // render a black screen
cls.scrshot_request = scrshot_plaque; // make levelshot cls.scrshot_request = scrshot_plaque; // make levelshot
@ -595,7 +595,6 @@ void CL_ParseConfigString( sizebuf_t *msg )
{ {
edict_t *world = CL_GetEdictByIndex( 0 ); edict_t *world = CL_GetEdictByIndex( 0 );
world->v.scale = com.atof( cl.configstrings[CS_WATERAMP] ); world->v.scale = com.atof( cl.configstrings[CS_WATERAMP] );
Msg( "Global WaveHeight is %g\n", world->v.scale * 16 );
} }
else if( i == CS_SKYVEC ) else if( i == CS_SKYVEC )
{ {

View File

@ -27,7 +27,7 @@ void SCR_StopCinematic( void )
return; return;
cl.cin = NULL; cl.cin = NULL;
cin->time = 0; // done cin->time = 0.0f; // done
cin->pic = NULL; cin->pic = NULL;
cin->pic_pending = NULL; cin->pic_pending = NULL;
@ -67,7 +67,7 @@ SCR_InitCinematic
uint SCR_GetCinematicTime( void ) uint SCR_GetCinematicTime( void )
{ {
cinematics_t *cin = cl.cin; 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; uint frame;
cinematics_t *cin = cl.cin; cinematics_t *cin = cl.cin;
if( !cin || cin->time == 0 ) if( !cin || cin->time == 0.0f )
{ {
SCR_StopCinematic (); SCR_StopCinematic ();
return; 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 ) return;
if( frame > cin->frame + 1 ) if( frame > cin->frame + 1 )
{ {
MsgDev( D_WARN, "dropped frame: %i > %i\n", 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; cin->pic = cin->pic_pending;
@ -118,8 +118,9 @@ bool SCR_DrawCinematic( void )
cinematics_t *cin = cl.cin; cinematics_t *cin = cl.cin;
float x, y, w, h; float x, y, w, h;
if( !re || !cin || cin->time <= 0 ) if( !re || !cin || cin->time <= 0.0f )
return false; return false;
if( !cin->pic ) if( !cin->pic )
return true; return true;
@ -189,7 +190,7 @@ bool SCR_PlayCinematic( const char *arg )
cin->headerlen = FS_Tell( cin->file ); cin->headerlen = FS_Tell( cin->file );
cin->frame = 0; cin->frame = 0;
cin->pic = cin->pic_pending = CIN_ReadNextFrame( cin, false ); cin->pic = cin->pic_pending = CIN_ReadNextFrame( cin, false );
cin->time = Host_Milliseconds (); cin->time = Sys_DoubleTime();
return true; return true;
} }

View File

@ -31,10 +31,8 @@ extern cvar_t *sys_sharedstrings;
extern string video_dlls[MAX_RENDERS]; extern string video_dlls[MAX_RENDERS];
extern string audio_dlls[MAX_RENDERS]; extern string audio_dlls[MAX_RENDERS];
extern string cphys_dlls[MAX_RENDERS];
extern int num_video_dlls; extern int num_video_dlls;
extern int num_audio_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_ShutdownServer( void );
void Host_CheckChanges( void ); void Host_CheckChanges( void );
void Host_CheckRestart( void ); void Host_CheckRestart( void );
int Host_Milliseconds( void );
void Host_Print( const char *txt ); void Host_Print( const char *txt );
void Host_Error( const char *error, ... ); void Host_Error( const char *error, ... );
void Host_Credits( void ); void Host_Credits( void );

View File

@ -217,7 +217,7 @@ pfnTime
*/ */
float pfnTime( void ) float pfnTime( void )
{ {
return (Host_Milliseconds() * 0.001f); return Sys_DoubleTime();
} }
/* /*

View File

@ -15,11 +15,11 @@ bool in_mouseactive; // false when not focus app
bool in_restore_spi; bool in_restore_spi;
bool in_mouseinitialized; bool in_mouseinitialized;
int in_originalmouseparms[3]; int in_originalmouseparms[3];
int in_mouse_oldbuttonstate;
int in_newmouseparms[3] = { 0, 0, 1 }; int in_newmouseparms[3] = { 0, 0, 1 };
bool in_mouse_suspended; bool in_mouse_suspended;
bool in_mouseparmsvalid; bool in_mouseparmsvalid;
int in_mouse_buttons; int in_mouse_buttons;
int in_mouse_oldbuttonstate;
int window_center_x, window_center_y; int window_center_x, window_center_y;
RECT window_rect, real_rect; RECT window_rect, real_rect;
uint in_mouse_wheel; uint in_mouse_wheel;
@ -65,7 +65,7 @@ static int Host_MapKey( int key )
if( !is_extended ) if( !is_extended )
{ {
switch ( result ) switch( result )
{ {
case K_HOME: return K_KP_HOME; case K_HOME: return K_KP_HOME;
case K_UPARROW: return K_KP_UPARROW; case K_UPARROW: return K_KP_UPARROW;
@ -82,7 +82,7 @@ static int Host_MapKey( int key )
} }
else else
{ {
switch ( result ) switch( result )
{ {
case K_PAUSE: return K_KP_NUMLOCK; case K_PAUSE: return K_KP_NUMLOCK;
case 0x0D: return K_KP_ENTER; case 0x0D: return K_KP_ENTER;
@ -103,7 +103,7 @@ void IN_StartupMouse( void )
cvar_t *cv; cvar_t *cv;
if( host.type == HOST_DEDICATED ) return; 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; if( !cv->value ) return;
in_mouse_buttons = 3; in_mouse_buttons = 3;
@ -154,7 +154,7 @@ void IN_ActivateMouse( void )
if( cls.key_dest == key_menu && !scr_fullscreen->integer ) if( cls.key_dest == key_menu && !scr_fullscreen->integer )
{ {
// check for mouse leave-entering // check for mouse leave-entering
if( !in_mouse_suspended && !UI_MouseInRect()) if( !in_mouse_suspended && !UI_MouseInRect( ))
in_mouse_suspended = true; in_mouse_suspended = true;
if( oldstate != in_mouse_suspended ) if( oldstate != in_mouse_suspended )
@ -178,7 +178,7 @@ void IN_ActivateMouse( void )
oldstate = in_mouse_suspended; oldstate = in_mouse_suspended;
if( in_mouse_suspended && IN_CursorInRect()) if( in_mouse_suspended && IN_CursorInRect( ))
{ {
GetCursorPos( &global_pos ); GetCursorPos( &global_pos );
in_mouse_suspended = false; in_mouse_suspended = false;
@ -235,7 +235,7 @@ void IN_DeactivateMouse( void )
in_mouseactive = false; in_mouseactive = false;
ClipCursor( NULL ); ClipCursor( NULL );
ReleaseCapture(); ReleaseCapture();
while( ShowCursor(true) < 0 ); while( ShowCursor( true ) < 0 );
} }
/* /*
@ -278,11 +278,11 @@ void IN_MouseEvent( int mstate )
// perform button actions // perform button actions
for( i = 0; i < in_mouse_buttons; i++ ) 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 ); 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 ); Sys_QueEvent( -1, SE_KEY, K_MOUSE1 + i, false, 0, NULL );
} }
@ -297,7 +297,7 @@ IN_Shutdown
*/ */
void IN_Shutdown( void ) void IN_Shutdown( void )
{ {
IN_DeactivateMouse(); IN_DeactivateMouse( );
} }
@ -308,7 +308,7 @@ IN_Init
*/ */
void IN_Init( void ) 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 ); ShowWindow( host.hWnd, SW_SHOWMINNOACTIVE );
break; break;
case WM_MOUSEWHEEL: 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, true, 0, NULL );
Sys_QueEvent( -1, SE_KEY, K_MWHEELUP, false, 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; else host.state = HOST_FRAME;
wnd_caption = GetSystemMetrics( SM_CYCAPTION ); wnd_caption = GetSystemMetrics( SM_CYCAPTION );
S_Activate( (host.state == HOST_FRAME) ? true : false ); S_Activate(( host.state == HOST_FRAME ) ? true : false );
Key_ClearStates(); // FIXME!!! Key_ClearStates(); // FIXME!!!
if( host.state == HOST_FRAME ) if( host.state == HOST_FRAME )
@ -433,19 +433,19 @@ long IN_WndProc( void *hWnd, uint uMsg, uint wParam, long lParam )
case WM_MOVE: case WM_MOVE:
if( !scr_fullscreen->integer ) if( !scr_fullscreen->integer )
{ {
RECT r; RECT rect;
int xPos, yPos, style; int xPos, yPos, style;
xPos = (short)LOWORD( lParam ); // horizontal position xPos = (short)LOWORD( lParam ); // horizontal position
yPos = (short)HIWORD( lParam ); // vertical position yPos = (short)HIWORD( lParam ); // vertical position
r.left = r.top = 0; rect.left = rect.top = 0;
r.right = r.bottom = 1; rect.right = rect.bottom = 1;
style = GetWindowLong( hWnd, GWL_STYLE ); style = GetWindowLong( hWnd, GWL_STYLE );
AdjustWindowRect( &r, style, FALSE ); AdjustWindowRect( &rect, style, FALSE );
Cvar_SetValue( "r_xpos", xPos + r.left ); Cvar_SetValue( "r_xpos", xPos + rect.left );
Cvar_SetValue( "r_ypos", yPos + r.top ); Cvar_SetValue( "r_ypos", yPos + rect.top );
scr_xpos->modified = false; scr_xpos->modified = false;
scr_ypos->modified = false; scr_ypos->modified = false;
GetWindowRect( host.hWnd, &real_rect ); GetWindowRect( host.hWnd, &real_rect );
@ -464,7 +464,7 @@ long IN_WndProc( void *hWnd, uint uMsg, uint wParam, long lParam )
IN_MouseEvent( temp ); IN_MouseEvent( temp );
break; break;
case WM_SYSCOMMAND: 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 ) if( wParam == SC_SCREENSAVE && host.state != HOST_SLEEP )
return 0; return 0;
break; break;

View File

@ -17,14 +17,12 @@ stdlib_api_t com, newcom;
char *buildstring = __TIME__ " " __DATE__; char *buildstring = __TIME__ " " __DATE__;
string video_dlls[MAX_RENDERS]; string video_dlls[MAX_RENDERS];
string audio_dlls[MAX_RENDERS]; string audio_dlls[MAX_RENDERS];
string cphys_dlls[MAX_RENDERS];
int num_video_dlls; int num_video_dlls;
int num_audio_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 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 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 *timescale;
cvar_t *sys_sharedstrings; cvar_t *sys_sharedstrings;
@ -248,38 +246,20 @@ bool Host_InitSound( void )
void Host_CheckRestart( 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 MsgDev( D_ERROR, "couldn't initialize physic system\n" );
SV_ForceMod();
CL_ForceVid();
} }
else return;
num_changes = 0; host_cphys->modified = false;
// 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++;
}
}
} }
void Host_CheckChanges( void ) void Host_CheckChanges( void )
@ -774,7 +754,7 @@ void Host_InitCommon( const int argc, const char **argv )
num_video_dlls = num_audio_dlls = 0; num_video_dlls = num_audio_dlls = 0;
host_video = Cvar_Get( "host_video", "vid_gl.dll", CVAR_SYSTEMINFO, "name of video rendering library" ); 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_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 // make sure what global copy has no changed with any dll checking
Mem_Copy( &check_vid, &render_dll, sizeof( dll_info_t )); 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++; 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 ); 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( "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 Cmd_AddCommand( "game", Host_ChangeGame_f, "change game" ); // allow to change game from the console
host.frametime = Host_Milliseconds(); host.frametime = Host_Milliseconds();
host.errorframe = 0; host.errorframe = 0;

View File

@ -197,6 +197,9 @@ typedef struct
typedef struct typedef struct
{ {
float time; // cached sv.time
float frametime; // cached sv.frametime
// user messages stuff // user messages stuff
const char *msg_name; // just for debug const char *msg_name; // just for debug
int msg_sizes[MAX_USER_MESSAGES]; // user messages bounds checker int msg_sizes[MAX_USER_MESSAGES]; // user messages bounds checker
@ -234,7 +237,7 @@ typedef struct
{ {
bool initialized; // sv_init has completed bool initialized; // sv_init has completed
int realtime; // always increasing, no clamping, etc int realtime; // always increasing, no clamping, etc
int timestart; // just for profiling double timestart; // just for profiling
int groupmask; int groupmask;
int groupop; int groupop;
@ -306,7 +309,7 @@ void SV_InitOperatorCommands( void );
void SV_KillOperatorCommands( void ); void SV_KillOperatorCommands( void );
void SV_UserinfoChanged( sv_client_t *cl, const char *userinfo ); void SV_UserinfoChanged( sv_client_t *cl, const char *userinfo );
void SV_PrepWorldFrame( void ); void SV_PrepWorldFrame( void );
void SV_CalcFrametime( void ); void SV_CalcFrameTime( void );
void Master_Heartbeat( void ); void Master_Heartbeat( void );
void Master_Packet( void ); void Master_Packet( void );

View File

@ -294,7 +294,6 @@ bool SV_ClientConnect( edict_t *ent, char *userinfo )
if( !sv.loadgame ) ent->v.flags = 0; if( !sv.loadgame ) ent->v.flags = 0;
MsgDev( D_NOTE, "SV_ClientConnect()\n" ); MsgDev( D_NOTE, "SV_ClientConnect()\n" );
svgame.globals->time = sv.time * 0.001f;
result = svgame.dllFuncs.pfnClientConnect( ent, userinfo ); result = svgame.dllFuncs.pfnClientConnect( ent, userinfo );
return result; return result;
@ -320,8 +319,6 @@ void SV_DropClient( sv_client_t *drop )
MSG_WriteByte( &drop->netchan.message, svc_disconnect ); MSG_WriteByte( &drop->netchan.message, svc_disconnect );
// let the game known about client state // let the game known about client state
svgame.globals->time = sv.time * 0.001f;
if( drop->edict->v.flags & FL_SPECTATOR ) if( drop->edict->v.flags & FL_SPECTATOR )
svgame.dllFuncs.pfnSpectatorDisconnect( drop->edict ); svgame.dllFuncs.pfnSpectatorDisconnect( drop->edict );
else svgame.dllFuncs.pfnClientDisconnect( drop->edict ); else svgame.dllFuncs.pfnClientDisconnect( drop->edict );
@ -335,8 +332,8 @@ void SV_DropClient( sv_client_t *drop )
drop->edict->pvPrivateData = NULL; drop->edict->pvPrivateData = NULL;
} }
// SV_FreeEdict( drop->edict ); if( drop->download )
if( drop->download ) drop->download = NULL; drop->download = NULL;
drop->state = cs_zombie; // become free in a few seconds drop->state = cs_zombie; // become free in a few seconds
drop->name[0] = 0; drop->name[0] = 0;
@ -642,7 +639,6 @@ void SV_PutClientInServer( edict_t *ent )
index = NUM_FOR_EDICT( ent ) - 1; index = NUM_FOR_EDICT( ent ) - 1;
client = ent->pvServerData->client; client = ent->pvServerData->client;
svgame.globals->time = sv.time * 0.001f;
ent->pvServerData->s.ed_type = ED_CLIENT; // init edict type ent->pvServerData->s.ed_type = ED_CLIENT; // init edict type
if( !sv.loadgame ) if( !sv.loadgame )
@ -702,7 +698,7 @@ void SV_PutClientInServer( edict_t *ent )
sv.paused = false; sv.paused = false;
if( sv_maxclients->integer == 1 ) // singleplayer profiler 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 // 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 ); svgame.dllFuncs.pfnClientUserInfoChanged( cl->edict, cl->userinfo );
if( SV_IsValidEdict( ent )) if( SV_IsValidEdict( ent ))
@ -1127,8 +1121,6 @@ void SV_ExecuteClientCommand( sv_client_t *cl, char *s )
if( !u->name && sv.state == ss_active ) if( !u->name && sv.state == ss_active )
{ {
// custom client commands // custom client commands
svgame.globals->time = sv.time * 0.001f;
svgame.globals->frametime = sv.frametime * 0.001f;
svgame.dllFuncs.pfnClientCommand( cl->edict ); svgame.dllFuncs.pfnClientCommand( cl->edict );
} }
} }

View File

@ -361,7 +361,7 @@ void SV_FreeEdict( edict_t *pEdict )
Mem_Set( pEdict, 0, sizeof( *pEdict )); Mem_Set( pEdict, 0, sizeof( *pEdict ));
// mark edict as freed // mark edict as freed
pEdict->freetime = sv.time * 0.001f; pEdict->freetime = svgame.time;
pEdict->v.nextthink = -1; pEdict->v.nextthink = -1;
pEdict->free = true; pEdict->free = true;
} }
@ -369,7 +369,6 @@ void SV_FreeEdict( edict_t *pEdict )
edict_t *SV_AllocEdict( void ) edict_t *SV_AllocEdict( void )
{ {
edict_t *pEdict; edict_t *pEdict;
float time = sv.time * 0.001;
int i; int i;
for( i = svgame.globals->maxClients + 1; i < svgame.globals->numEntities; 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 ); pEdict = EDICT_NUM( i );
// the first couple seconds of server time can involve a lot of // the first couple seconds of server time can involve a lot of
// freeing and allocating, so relax the replacement policy // 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 ); SV_InitEdict( pEdict );
return pEdict; return pEdict;
@ -750,10 +749,10 @@ void pfnChangeLevel( const char* s1, const char* s2 )
if( !s1 || s1[0] <= ' ' ) return; if( !s1 || s1[0] <= ' ' ) return;
// make sure we don't issue two changelevels // make sure we don't issue two changelevels
if( svs.changelevel_next_time > svgame.globals->time ) if( svs.changelevel_next_time > svgame.time )
return; 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 if( !s2 ) Cbuf_AddText( va( "changelevel %s\n", s1 )); // Quake changlevel
else Cbuf_AddText( va( "changelevel %s %s\n", s1, s2 )); // Half-Life changelevel 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->maxClients = sv_maxclients->integer;
svgame.globals->mapname = MAKE_STRING( sv.name ); svgame.globals->mapname = MAKE_STRING( sv.name );
svgame.globals->startspot = MAKE_STRING( sv.startspot ); svgame.globals->startspot = MAKE_STRING( sv.startspot );
svgame.globals->time = sv.time * 0.001f;
// spawn the rest of the entities on the map // spawn the rest of the entities on the map
SV_LoadFromFile( entities ); SV_LoadFromFile( entities );

View File

@ -179,10 +179,12 @@ void SV_ActivateServer( void )
// create a baseline for more efficient communications // create a baseline for more efficient communications
SV_CreateBaseline(); 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 // run two frames to allow everything to settle
SV_Physics(); if( !sv.loadgame ) SV_Physics();
svgame.time = ( sv.time * 0.001f );
SV_Physics(); SV_Physics();
// invoke to refresh all movevars // invoke to refresh all movevars
@ -317,7 +319,7 @@ bool SV_SpawnServer( const char *mapname, const char *startspot )
return false; return false;
svgame.globals->changelevel = false; // will be restored later if needed 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.spawncount++; // any partially connected client will be restarted
svs.realtime = 0; svs.realtime = 0;
@ -363,6 +365,11 @@ bool SV_SpawnServer( const char *mapname, const char *startspot )
Cvar_SetValue( "skill", (float)current_skill ); Cvar_SetValue( "skill", (float)current_skill );
sv.time = 1000; // server spawn time it's always 1.0 second 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 // make sure what server name doesn't contain path and extension
FS_FileBase( mapname, sv.name ); FS_FileBase( mapname, sv.name );
@ -518,7 +525,7 @@ void SV_ForceMod( void )
void SV_ForceError( void ) void SV_ForceError( void )
{ {
// this only for singleplayer testing // this is only for singleplayer testing
if( sv_maxclients->integer != 1 ) return; if( sv_maxclients->integer != 1 ) return;
sv.write_bad_message = true; sv.write_bad_message = true;
} }
@ -540,15 +547,8 @@ bool SV_NewGame( const char *mapName, bool loadGame )
if( !SV_SpawnServer( mapName, NULL )) if( !SV_SpawnServer( mapName, NULL ))
return false; return false;
// make sure the time is set
svgame.globals->time = (sv.time * 0.001f);
SV_LevelInit( mapName, NULL, NULL, loadGame ); SV_LevelInit( mapName, NULL, NULL, loadGame );
sv.loadgame = loadGame;
if( loadGame )
{
sv.loadgame = true;
svgame.globals->time = (sv.time * 0.001f);
}
SV_ActivateServer(); SV_ActivateServer();

View File

@ -257,10 +257,10 @@ void SV_UpdateServerInfo( void )
/* /*
================= =================
SV_CalcFrametime SV_CalcFrameTime
================= =================
*/ */
void SV_CalcFrametime( void ) void SV_CalcFrameTime( void )
{ {
if( sv_fps->modified ) if( sv_fps->modified )
{ {
@ -350,8 +350,8 @@ void SV_CheckTimeouts( void )
float zombiepoint; float zombiepoint;
int i, numclients = 0; int i, numclients = 0;
droppoint = svs.realtime - (timeout->value * 1000); droppoint = svs.realtime - ( timeout->value * 1000 );
zombiepoint = svs.realtime - (zombietime->value * 1000); zombiepoint = svs.realtime - ( zombietime->value * 1000 );
for( i = 0, cl = svs.clients; i < sv_maxclients->integer; i++, cl++ ) 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 cl->state = cs_free; // can now be reused
continue; 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_BroadcastPrintf( PRINT_HIGH, "%s timed out\n", cl->name );
SV_DropClient( cl ); SV_DropClient( cl );
@ -450,6 +450,10 @@ void SV_RunGameFrame( void )
// has the "current" frame // has the "current" frame
sv.framenum++; 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 // don't run if paused or not in game
if( !sv.paused && CL_IsInGame( )) if( !sv.paused && CL_IsInGame( ))
SV_Physics(); SV_Physics();
@ -476,7 +480,7 @@ void SV_Frame( int time )
rand (); rand ();
// calc sv.frametime // calc sv.frametime
SV_CalcFrametime (); SV_CalcFrameTime ();
// check timeouts // check timeouts
SV_CheckTimeouts (); SV_CheckTimeouts ();

View File

@ -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] ); 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] ); 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 )) if(!( clent->v.flags & FL_SPECTATOR ))
{ {
svgame.dllFuncs.pfnPlayerPreThink( clent ); 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 )) if(( sv_maxclients->integer <= 1 ) && !CL_IsInGame( ) || ( clent->v.flags & FL_FROZEN ) || ( sv.framenum < 3 ))
ucmd->msec = 0; // pause ucmd->msec = 0; // pause
svgame.globals->time = (sv.time * 0.001f);
svgame.globals->frametime = (ucmd->msec * 0.001f);
// setup playermove state // setup playermove state
PM_SetupMove( svgame.pmove, clent, ucmd, cl->physinfo ); PM_SetupMove( svgame.pmove, clent, ucmd, cl->physinfo );
@ -716,6 +710,6 @@ void SV_PostRunCmd( sv_client_t *cl )
else svgame.dllFuncs.pfnPlayerPostThink( clent ); else svgame.dllFuncs.pfnPlayerPostThink( clent );
// restore frametime // restore frametime
svgame.globals->frametime = sv.frametime * 0.001f; svgame.globals->frametime = svgame.frametime;
svgame.dllFuncs.pfnCmdEnd( cl->edict ); svgame.dllFuncs.pfnCmdEnd( cl->edict );
} }

View File

@ -161,11 +161,11 @@ bool SV_RunThink( edict_t *ent )
float thinktime; float thinktime;
thinktime = ent->v.nextthink; 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; return true;
if( thinktime < ( sv.time * 0.001f )) if( thinktime < svgame.globals->time )
thinktime = ( sv.time * 0.001f ); // don't let things stay in the past. thinktime = svgame.globals->time; // don't let things stay in the past.
// it is possible to start that way // it is possible to start that way
// by a trigger with a local time. // by a trigger with a local time.
ent->v.nextthink = 0; ent->v.nextthink = 0;
@ -193,7 +193,6 @@ bool SV_Impact( edict_t *e1, trace_t *trace )
SV_CopyTraceToGlobal( trace ); SV_CopyTraceToGlobal( trace );
VectorCopy( e1->v.origin, org ); VectorCopy( e1->v.origin, org );
svgame.globals->time = (sv.time * 0.001f);
if( !e1->free && !e2->free && e1->v.solid != SOLID_NOT ) if( !e1->free && !e2->free && e1->v.solid != SOLID_NOT )
{ {
@ -625,8 +624,8 @@ SV_AddGravity
void SV_AddGravity( edict_t *ent ) void SV_AddGravity( edict_t *ent )
{ {
if( ent->v.gravity ) // gravity modifier if( ent->v.gravity ) // gravity modifier
ent->v.velocity[2] -= sv_gravity->value * ent->v.gravity * svgame.globals->frametime; ent->v.velocity[2] -= sv_gravity->value * ent->v.gravity * svgame.frametime;
else ent->v.velocity[2] -= sv_gravity->value * svgame.globals->frametime; else ent->v.velocity[2] -= sv_gravity->value * svgame.frametime;
} }
void SV_AddHalfGravity( edict_t *ent, float timestep ) 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 // 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] -= ( 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; ent->v.basevelocity[2] = 0.0f;
// bound velocity // bound velocity
@ -1169,8 +1168,6 @@ void SV_PushComplex( edict_t *pusher, float movetime )
} }
// call the pusher "blocked" function // 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 ); svgame.dllFuncs.pfnBlocked( pusher, check );
return; return;
} }
@ -1194,12 +1191,12 @@ void SV_Physics_Pusher( edict_t *ent )
oldtime = ent->v.ltime; oldtime = ent->v.ltime;
thinktime = ent->v.nextthink; thinktime = ent->v.nextthink;
if( thinktime < ent->v.ltime + svgame.globals->frametime ) if( thinktime < ent->v.ltime + svgame.frametime )
{ {
movetime = thinktime - ent->v.ltime; movetime = thinktime - ent->v.ltime;
if( movetime < 0.0f ) movetime = 0.0f; if( movetime < 0.0f ) movetime = 0.0f;
} }
else movetime = svgame.globals->frametime; else movetime = svgame.frametime;
if( movetime ) if( movetime )
{ {
@ -1239,19 +1236,12 @@ void SV_Physics_Pusher( edict_t *ent )
svgame.dllFuncs.pfnBlocked( ent, pBlocker ); 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; ent->v.nextthink = 0.0f;
svgame.globals->time = svgame.globals->time;
svgame.dllFuncs.pfnThink( ent ); svgame.dllFuncs.pfnThink( ent );
if( ent->free ) return; 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 ); SV_CheckWater( ent );
VectorMA( ent->v.origin, svgame.globals->frametime, ent->v.velocity, ent->v.origin ); VectorMA( ent->v.origin, svgame.frametime, ent->v.velocity, ent->v.origin );
VectorMA( ent->v.angles, svgame.globals->frametime, ent->v.avelocity, ent->v.angles ); VectorMA( ent->v.angles, svgame.frametime, ent->v.avelocity, ent->v.angles );
SV_LinkEdict( ent, false ); // nocip ents never touch triggers 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_TOSS:
case MOVETYPE_BOUNCE: case MOVETYPE_BOUNCE:
SV_AngularMove( ent, svgame.globals->frametime, ent->v.friction ); SV_AngularMove( ent, svgame.frametime, ent->v.friction );
break; break;
default: default:
SV_AngularMove( ent, svgame.globals->frametime, 0.0f ); SV_AngularMove( ent, svgame.frametime, 0.0f );
break; break;
} }
@ -1453,7 +1443,7 @@ void SV_Physics_Toss( edict_t *ent )
VectorAdd( ent->v.velocity, ent->v.basevelocity, ent->v.velocity ); VectorAdd( ent->v.velocity, ent->v.basevelocity, ent->v.velocity );
SV_CheckVelocity( ent ); 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 ); VectorSubtract( ent->v.velocity, ent->v.basevelocity, ent->v.velocity );
trace = SV_PushEntity( ent, move, vec3_origin, NULL ); trace = SV_PushEntity( ent, move, vec3_origin, NULL );
@ -1489,7 +1479,7 @@ void SV_Physics_Toss( edict_t *ent )
{ {
float vel; 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. // we're rolling on the ground, add static friction.
ent->v.groundentity = trace.pHit; ent->v.groundentity = trace.pHit;
@ -1507,7 +1497,7 @@ void SV_Physics_Toss( edict_t *ent )
} }
else 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 ); trace = SV_PushEntity( ent, move, vec3_origin, NULL );
if( ent->free ) return; 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.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; hitsound = true;
} }
if( !inwater ) if( !inwater )
{ {
SV_AddHalfGravity( ent, svgame.globals->frametime ); SV_AddHalfGravity( ent, svgame.frametime );
isfalling = true; isfalling = true;
} }
} }
@ -1574,13 +1564,13 @@ void SV_Physics_Step( edict_t *ent )
if( ent->v.waterlevel > 1 ) if( ent->v.waterlevel > 1 )
{ {
VectorScale( ent->v.velocity, 0.9f, ent->v.velocity ); 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 ) else if( ent->v.waterlevel == 1 )
{ {
if( ent->v.velocity[2] > 0.0f ) if( ent->v.velocity[2] > 0.0f )
ent->v.velocity[2] = svgame.globals->frametime; ent->v.velocity[2] = svgame.frametime;
ent->v.velocity[2] -= (ent->v.skin * svgame.globals->frametime); ent->v.velocity[2] -= ( ent->v.skin * svgame.frametime );
} }
} }
} }
@ -1609,7 +1599,7 @@ void SV_Physics_Step( edict_t *ent )
if( speed ) if( speed )
{ {
control = speed < sv_stopspeed->value ? sv_stopspeed->value : 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 ) if( newspeed < 0.0f )
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 ); 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_CheckVelocity( ent );
SV_TryMove( ent, svgame.globals->frametime, NULL ); SV_TryMove( ent, svgame.frametime, NULL );
SV_CheckVelocity( ent ); SV_CheckVelocity( ent );
VectorSubtract( ent->v.velocity, ent->v.basevelocity, ent->v.velocity ); 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 ); 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; if( !SV_RunThink( ent )) return;
@ -1689,7 +1679,7 @@ void SV_Physics_Conveyor( edict_t *ent )
vec3_t point, end; vec3_t point, end;
VectorScale( ent->v.movedir, ent->v.speed, v ); 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++ ) 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]; 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 ) if(DotProduct( ent->v.movedir, tr.vecPlaneNormal) > 0.0f )
v[2] = -v[2]; // then we're moving down 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 ); VectorAdd( player->v.origin, move, end );
tr = SV_Move( player->v.origin, player->v.mins, player->v.maxs, end, MOVE_NORMAL, player ); 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 )) if(!( ent->v.flags & FL_BASEVELOCITY ) && !VectorIsNull( ent->v.basevelocity ))
{ {
// Apply momentum (add in half of the previous frame of velocity first) // 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 ); VectorClear( ent->v.basevelocity );
} }
ent->v.flags &= ~FL_BASEVELOCITY; ent->v.flags &= ~FL_BASEVELOCITY;
@ -1823,9 +1813,6 @@ void SV_Physics( void )
edict_t *ent; edict_t *ent;
// let the progs know that a new frame has started // 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(); svgame.dllFuncs.pfnStartFrame();
SV_CheckAllEnts (); SV_CheckAllEnts ();
@ -1853,7 +1840,7 @@ void SV_Physics( void )
} }
// let everything in the world think and move // 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 // at end of frame kill all entities which supposed to it
SV_FreeOldEntities(); SV_FreeOldEntities();
@ -1863,5 +1850,6 @@ void SV_Physics( void )
svgame.dllFuncs.pfnEndFrame(); svgame.dllFuncs.pfnEndFrame();
if( !( sv.hostflags & SVF_PLAYERSONLY )) sv.time += sv.frametime; if( !( sv.hostflags & SVF_PLAYERSONLY ))
sv.time += sv.frametime;
} }

View File

@ -294,7 +294,7 @@ void SV_BuildSaveComment( char *text, int maxlength )
{ {
const char *pName; const char *pName;
edict_t *pWorld = EDICT_NUM( 0 ); edict_t *pWorld = EDICT_NUM( 0 );
float time = svgame.globals->time; float time = svgame.time;
if( pWorld && pWorld->v.message ) if( pWorld && pWorld->v.message )
{ {
@ -355,7 +355,6 @@ void LandmarkOrigin( SAVERESTOREDATA *pSaveData, vec3_t output, const char *pLan
int EntityInSolid( edict_t *ent ) int EntityInSolid( edict_t *ent )
{ {
edict_t *pParent = ent->v.aiment; edict_t *pParent = ent->v.aiment;
vec3_t point;
// if you're attached to a client, always go through // if you're attached to a client, always go through
if( SV_IsValidEdict( pParent )) if( SV_IsValidEdict( pParent ))
@ -363,10 +362,7 @@ int EntityInSolid( edict_t *ent )
if( pParent->v.flags & FL_CLIENT ) if( pParent->v.flags & FL_CLIENT )
return 0; return 0;
} }
return SV_TestEntityPosition( ent );
VectorAverage( ent->v.absmin, ent->v.absmax, point );
return (SV_PointContents( point ) == CONTENTS_SOLID);
} }
void SV_ClearSaveDir( void ) void SV_ClearSaveDir( void )
@ -1036,6 +1032,7 @@ int SV_LoadGameState( char const *level, bool createPlayers )
SV_SaveFinish( pSaveData ); SV_SaveFinish( pSaveData );
// restore server time
sv.time = header.time * 1000; sv.time = header.time * 1000;
return 1; return 1;
@ -1283,14 +1280,12 @@ void SV_ChangeLevel( bool loadfromsavedgame, const char *mapname, const char *st
SV_SaveFinish( pSaveData ); SV_SaveFinish( pSaveData );
svgame.globals->changelevel = true; svgame.globals->changelevel = true;
svgame.globals->time = (sv.time * 0.001f);
SV_LevelInit( level, oldlevel, startspot, true ); SV_LevelInit( level, oldlevel, startspot, true );
sv.paused = true; // pause until all clients connect sv.paused = true; // pause until all clients connect
sv.loadgame = true; sv.loadgame = true;
} }
else else
{ {
svgame.globals->time = (sv.time * 0.001f);
SV_LevelInit( level, NULL, NULL, false ); SV_LevelInit( level, NULL, NULL, false );
} }

View File

@ -109,9 +109,7 @@ void SV_TouchLinks( edict_t *ent, areanode_t *node )
continue; continue;
} }
svgame.globals->time = sv.time * 0.001f;
svgame.dllFuncs.pfnTouch( touch, ent ); svgame.dllFuncs.pfnTouch( touch, ent );
if( ent->free ) break; // killtarget issues if( ent->free ) break; // killtarget issues
} }

View File

@ -284,8 +284,8 @@ cpuinfo_t GetCPUInfo( void )
void Sys_InitMathlib( cpuinfo_t *cpu ) void Sys_InitMathlib( cpuinfo_t *cpu )
{ {
size_t size = 1024 * 1024; size_t i, size = 1024 * 1024;
int i, start, min, result[8]; double start, min, result[8];
void *buf0 = Malloc( size ); void *buf0 = Malloc( size );
void *buf1 = Malloc( size ); void *buf1 = Malloc( size );
int numchecks = 16; // iterations 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 ) if( Sys.app_name == HOST_NORMAL || Sys.app_name == HOST_DEDICATED )
{ {
// testing sqrt // testing sqrt
start = Sys_Milliseconds(); start = Sys_DoubleTime();
for( i = 1; i < 800000; i++ ) a = sqrtf( i ); for( i = 1; i < 800000; i++ ) a = sqrtf( i );
a *= 0.00000001; a *= 0.00000001;
result[(int)a] = Sys_Milliseconds() - start; result[(int)a] = Sys_DoubleTime() - start;
MsgDev( D_NOTE, "crt_sqrt %i ms\n", result[0] ); MsgDev( D_NOTE, "crt_sqrt %i ms\n", (int)( result[0] * 1000 ));
if( cpu->m_bSSE ) if( cpu->m_bSSE )
{ {
start = Sys_Milliseconds(); start = Sys_DoubleTime();
for( i = 0; i < 800000; i++ ) a = sse_sqrt( i ); for( i = 0; i < 800000; i++ ) a = sse_sqrt( i );
a *= 0.00000001; a *= 0.00000001;
result[(int)a+1] = Sys_Milliseconds() - start; result[(int)a+1] = Sys_DoubleTime() - start;
MsgDev( D_NOTE, "sse_sqrt %i ms\n", result[1] ); MsgDev( D_NOTE, "sse_sqrt %i ms\n", (int)( result[1] * 1000 ));
} }
else 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__ ); for( i = 0; i < numchecks; i++ ) _crt_mem_copy( buf0, buf1, size, __FILE__, __LINE__ );
result[0] = Sys_Milliseconds() - start; result[0] = Sys_DoubleTime() - start;
MsgDev( D_NOTE, "crt_memcpy %i ms\n", result[0] ); 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__ ); for( i = 0; i < numchecks; i++ ) _asm_mem_copy( buf0, buf1, size, __FILE__, __LINE__ );
result[1] = Sys_Milliseconds() - start; result[1] = Sys_DoubleTime() - start;
MsgDev( D_NOTE, "asm_memcpy %i ms\n", result[1] ); 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__ ); for( i = 0; i < numchecks; i++ ) _com_mem_copy( buf0, buf1, size, __FILE__, __LINE__ );
result[2] = Sys_Milliseconds() - start; result[2] = Sys_DoubleTime() - start;
MsgDev( D_NOTE, "com_memcpy %i ms\n", result[2] ); MsgDev( D_NOTE, "com_memcpy %i ms\n", (int)( result[2] * 1000 ));
if( cpu->m_bMMX ) if( cpu->m_bMMX )
{ {
start = Sys_Milliseconds(); start = Sys_DoubleTime();
for( i = 0; i < numchecks; i++ ) _mmx_mem_copy( buf0, buf1, size, __FILE__, __LINE__ ); for( i = 0; i < numchecks; i++ ) _mmx_mem_copy( buf0, buf1, size, __FILE__, __LINE__ );
result[3] = Sys_Milliseconds() - start; result[3] = Sys_DoubleTime() - start;
MsgDev( D_NOTE, "mmx_memcpy %i ms\n", result[3] ); MsgDev( D_NOTE, "mmx_memcpy %i ms\n", (int)( result[3] * 1000 ));
} }
else else
{ {
@ -359,10 +359,10 @@ void Sys_InitMathlib( cpuinfo_t *cpu )
if( cpu->m_b3DNow ) if( cpu->m_b3DNow )
{ {
start = Sys_Milliseconds(); start = Sys_DoubleTime();
for( i = 0; i < numchecks; i++ ) _amd_mem_copy( buf0, buf1, size, __FILE__, __LINE__ ); for( i = 0; i < numchecks; i++ ) _amd_mem_copy( buf0, buf1, size, __FILE__, __LINE__ );
result[4] = Sys_Milliseconds() - start; result[4] = Sys_DoubleTime() - start;
MsgDev( D_NOTE, "amd_memcpy %i ms\n", result[4] ); MsgDev( D_NOTE, "amd_memcpy %i ms\n", (int)( result[4] * 1000 ));
} }
else else
{ {
@ -398,27 +398,27 @@ void Sys_InitMathlib( cpuinfo_t *cpu )
} }
// memset // memset
start = Sys_Milliseconds(); start = Sys_DoubleTime();
for( i = 0; i < numchecks; i++ ) _crt_mem_set( buf0, 0, size, __FILE__, __LINE__ ); for( i = 0; i < numchecks; i++ ) _crt_mem_set( buf0, 0, size, __FILE__, __LINE__ );
result[0] = Sys_Milliseconds() - start; result[0] = Sys_DoubleTime() - start;
MsgDev( D_NOTE, "crt_memset %i ms\n", result[0] ); 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__ ); for( i = 0; i < numchecks; i++ ) _asm_mem_set( buf0, 0, size, __FILE__, __LINE__ );
result[1] = Sys_Milliseconds() - start; result[1] = Sys_DoubleTime() - start;
MsgDev( D_NOTE, "asm_memset %i ms\n", result[1] ); 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__ ); for( i = 0; i < numchecks; i++ ) _com_mem_set( buf0, 0, size, __FILE__, __LINE__ );
result[2] = Sys_Milliseconds() - start; result[2] = Sys_DoubleTime() - start;
MsgDev( D_NOTE, "com_memset %i ms\n", result[2] ); MsgDev( D_NOTE, "com_memset %i ms\n", (int)( result[2] * 1000 ));
if( cpu->m_bMMX ) if( cpu->m_bMMX )
{ {
start = Sys_Milliseconds(); start = Sys_DoubleTime();
for( i = 0; i < numchecks; i++ ) _mmx_mem_set( buf0, 0, size, __FILE__, __LINE__ ); for( i = 0; i < numchecks; i++ ) _mmx_mem_set( buf0, 0, size, __FILE__, __LINE__ );
result[3] = Sys_Milliseconds() - start; result[3] = Sys_DoubleTime() - start;
MsgDev( D_NOTE, "mmx_memset %i ms\n", result[3] ); MsgDev( D_NOTE, "mmx_memset %i ms\n", (int)( result[3] * 1000 ));
} }
else else
{ {
@ -474,16 +474,16 @@ void Sys_InitCPU( void )
} }
com_strcpy(szFeatureString, "" ); com_strcpy(szFeatureString, "" );
if( cpu.m_bMMX ) com_strcat(szFeatureString, "MMX " ); if( cpu.m_bMMX ) com.strcat( szFeatureString, "MMX " );
if( cpu.m_b3DNow ) com_strcat(szFeatureString, "3DNow " ); if( cpu.m_b3DNow ) com.strcat( szFeatureString, "3DNow " );
if( cpu.m_bSSE ) com_strcat(szFeatureString, "SSE " ); if( cpu.m_bSSE ) com.strcat( szFeatureString, "SSE " );
if( cpu.m_bSSE2 ) com_strcat(szFeatureString, "SSE2 " ); if( cpu.m_bSSE2 ) com.strcat( szFeatureString, "SSE2 " );
if( cpu.m_bRDTSC ) com_strcat(szFeatureString, "RDTSC " ); if( cpu.m_bRDTSC ) com.strcat( szFeatureString, "RDTSC " );
if( cpu.m_bCMOV ) com_strcat(szFeatureString, "CMOV " ); if( cpu.m_bCMOV ) com.strcat( szFeatureString, "CMOV " );
if( cpu.m_bFCMOV ) com_strcat(szFeatureString, "FCMOV " ); if( cpu.m_bFCMOV ) com.strcat( szFeatureString, "FCMOV " );
// Remove the trailing space. There will always be one. // Remove the trailing space. There will always be one.
szFeatureString[com_strlen(szFeatureString)-1] = '\0'; szFeatureString[com.strlen( szFeatureString ) - 1] = '\0';
// Dump CPU information: // Dump CPU information:
if( cpu.m_usNumLogicCore == 1 ) MsgDev( D_INFO, "CPU: %s [1 core]. Frequency: %.01f %s\n", cpu.m_szCPUID, fFrequency, szFrequencyDenomination ); if( cpu.m_usNumLogicCore == 1 ) MsgDev( D_INFO, "CPU: %s [1 core]. Frequency: %.01f %s\n", cpu.m_szCPUID, fFrequency, szFrequencyDenomination );

View File

@ -92,6 +92,8 @@ typedef struct system_s
typedef struct timer_s typedef struct timer_s
{ {
bool initialized; // any timer can be setup it bool initialized; // any timer can be setup it
bool hardware_timer; // QueryPerfomanceCounter is present
double oldtime; double oldtime;
double curtime; double curtime;
dword timebase; dword timebase;
@ -118,7 +120,7 @@ typedef struct cvar_s
}; };
extern system_t Sys; extern system_t Sys;
extern timer_t Msec; extern timer_t Clock;
extern sysinfo_t SI; extern sysinfo_t SI;
extern stdlib_api_t com; extern stdlib_api_t com;

View File

@ -16,7 +16,7 @@
system_t Sys; system_t Sys;
stdlib_api_t com; stdlib_api_t com;
baserc_exp_t *rc; // library of resources baserc_exp_t *rc; // library of resources
timer_t Msec; timer_t Clock;
launch_exp_t *Host; // callback to mainframe launch_exp_t *Host; // callback to mainframe
sys_event_t event_que[MAX_QUED_EVENTS]; sys_event_t event_que[MAX_QUED_EVENTS];
int event_head, event_tail; int event_head, event_tail;
@ -706,30 +706,87 @@ Sys_DoubleTime
*/ */
double Sys_DoubleTime( void ) 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 ); // timeGetTime
Msec.timebase = timeGetTime(); // platform:
Msec.initialized = true; // Windows 95/98/ME/NT/2000/XP
Msec.oldtime = (double)timeGetTime() * 0.001; // features:
} // reasonable accuracy (millisecond)
newtime = ( double )timeGetTime() * 0.001; // 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 // 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_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; else
Msec.oldtime = newtime; {
Clock.curtime += newtime - Clock.oldtime;
}
return Msec.curtime; Clock.oldtime = newtime;
return Clock.curtime;
} }
/* /*
@ -741,13 +798,12 @@ dword Sys_Milliseconds( void )
{ {
dword curtime; dword curtime;
if( !Msec.initialized ) if( !Clock.timebase )
{ {
timeBeginPeriod( 1 ); timeBeginPeriod( 1 );
Msec.timebase = timeGetTime(); Clock.timebase = timeGetTime();
Msec.initialized = true;
} }
curtime = timeGetTime() - Msec.timebase; curtime = timeGetTime() - Clock.timebase;
return curtime; return curtime;
} }
@ -957,7 +1013,8 @@ void Sys_Init( void )
lpBuffer.dwLength = sizeof( MEMORYSTATUS ); lpBuffer.dwLength = sizeof( MEMORYSTATUS );
GlobalMemoryStatus( &lpBuffer ); 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; Sys.logfile = NULL;
// get current hInstance // 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"); MsgDev( D_ERROR, "Sys_QueEvent: overflow\n");
// make sure what memory is allocated by engine // 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_tail++;
} }
event_head++; event_head++;
@ -1383,7 +1440,7 @@ sys_event_t Sys_GetEvent( void )
if( event_head > event_tail ) if( event_head > event_tail )
{ {
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 // pump the message loop
@ -1408,7 +1465,7 @@ sys_event_t Sys_GetEvent( void )
len = com_strlen( s ) + 1; len = com_strlen( s ) + 1;
b = Malloc( len ); b = Malloc( len );
com_strncpy( b, s, len - 1 ); com.strncpy( b, s, len - 1 );
Sys_QueEvent( 0, SE_CONSOLE, 0, 0, len, b ); Sys_QueEvent( 0, SE_CONSOLE, 0, 0, len, b );
} }

View File

@ -82,14 +82,14 @@ void CM_CalcPHS( void )
byte *scan, *visdata; byte *scan, *visdata;
uint *dest, *src; uint *dest, *src;
int hcount, vcount; int hcount, vcount;
uint timestart; double timestart;
int bitbyte; int bitbyte;
if( !worldmodel || !cm.pvs ) if( !worldmodel || !cm.pvs )
return; return;
MsgDev( D_NOTE, "Building PAS...\n" ); MsgDev( D_NOTE, "Building PAS...\n" );
timestart = Sys_Milliseconds(); timestart = Sys_DoubleTime();
num = worldmodel->numleafs; num = worldmodel->numleafs;
rowwords = (num + 31)>>5; 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, "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 );
} }
/* /*

View File

@ -60,9 +60,9 @@ chull_t *CM_HullForEntity( edict_t *ent, vec3_t mins, vec3_t maxs, vec3_t offset
// point hull // point hull
hull = &model->hulls[0]; 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) // head hull (ducked)
hull = &model->hulls[3]; hull = &model->hulls[3];

View File

@ -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 # Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT ** # ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 # 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 This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run !MESSAGE use the Export Makefile command and run
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "cms_hl.mak". !MESSAGE NMAKE /f "physic.mak".
!MESSAGE !MESSAGE
!MESSAGE You can specify a configuration when running NMAKE !MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "cms_hl.mak" CFG="cms_hl - Win32 Debug" !MESSAGE NMAKE /f "physic.mak" CFG="physic - Win32 Debug"
!MESSAGE !MESSAGE
!MESSAGE Possible choices for configuration are: !MESSAGE Possible choices for configuration are:
!MESSAGE !MESSAGE
!MESSAGE "cms_hl - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "physic - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "cms_hl - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "physic - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE !MESSAGE
# Begin Project # Begin Project
@ -29,7 +29,7 @@ CPP=cl.exe
MTL=midl.exe MTL=midl.exe
RSC=rc.exe RSC=rc.exe
!IF "$(CFG)" == "cms_hl - Win32 Release" !IF "$(CFG)" == "physic - Win32 Release"
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0 # PROP BASE Use_Debug_Libraries 0
@ -38,8 +38,8 @@ RSC=rc.exe
# PROP BASE Target_Dir "" # PROP BASE Target_Dir ""
# PROP Use_MFC 0 # PROP Use_MFC 0
# PROP Use_Debug_Libraries 0 # PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\temp\cms_hl\!release" # PROP Output_Dir "..\temp\physic\!release"
# PROP Intermediate_Dir "..\temp\cms_hl\!release" # PROP Intermediate_Dir "..\temp\physic\!release"
# PROP Ignore_Export_Lib 1 # PROP Ignore_Export_Lib 1
# PROP Target_Dir "" # 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 # 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 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/" # ADD LINK32 user32.lib msvcrt.lib /nologo /dll /pdb:none /machine:I386 /nodefaultlib:"libc.lib" /libpath:"../public/libs/"
# Begin Custom Build # Begin Custom Build
TargetDir=\Xash3D\src_main\temp\cms_hl\!release TargetDir=\Xash3D\src_main\temp\physic\!release
InputPath=\Xash3D\src_main\temp\cms_hl\!release\cms_hl.dll InputPath=\Xash3D\src_main\temp\physic\!release\physic.dll
SOURCE="$(InputPath)" SOURCE="$(InputPath)"
"D:\Xash3D\bin\cms_hl.dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" "D:\Xash3D\bin\physic.dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(TargetDir)\cms_hl.dll "D:\Xash3D\bin\cms_hl.dll" copy $(TargetDir)\physic.dll "D:\Xash3D\bin\physic.dll"
# End Custom Build # End Custom Build
!ELSEIF "$(CFG)" == "cms_hl - Win32 Debug" !ELSEIF "$(CFG)" == "physic - Win32 Debug"
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1 # PROP BASE Use_Debug_Libraries 1
@ -74,8 +74,8 @@ SOURCE="$(InputPath)"
# PROP BASE Target_Dir "" # PROP BASE Target_Dir ""
# PROP Use_MFC 0 # PROP Use_MFC 0
# PROP Use_Debug_Libraries 1 # PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\temp\cms_hl\!debug" # PROP Output_Dir "..\temp\physic\!debug"
# PROP Intermediate_Dir "..\temp\cms_hl\!debug" # PROP Intermediate_Dir "..\temp\physic\!debug"
# PROP Ignore_Export_Lib 1 # PROP Ignore_Export_Lib 1
# PROP Target_Dir "" # 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 # 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 # ADD LINK32 user32.lib msvcrtd.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"libc.lib" /pdbtype:sept
# SUBTRACT LINK32 /nodefaultlib # SUBTRACT LINK32 /nodefaultlib
# Begin Custom Build # Begin Custom Build
TargetDir=\Xash3D\src_main\temp\cms_hl\!debug TargetDir=\Xash3D\src_main\temp\physic\!debug
InputPath=\Xash3D\src_main\temp\cms_hl\!debug\cms_hl.dll InputPath=\Xash3D\src_main\temp\physic\!debug\physic.dll
SOURCE="$(InputPath)" SOURCE="$(InputPath)"
"D:\Xash3D\bin\cms_hl.dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" "D:\Xash3D\bin\physic.dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(TargetDir)\cms_hl.dll "D:\Xash3D\bin\cms_hl.dll" copy $(TargetDir)\physic.dll "D:\Xash3D\bin\physic.dll"
# End Custom Build # End Custom Build
@ -106,8 +106,8 @@ SOURCE="$(InputPath)"
# Begin Target # Begin Target
# Name "cms_hl - Win32 Release" # Name "physic - Win32 Release"
# Name "cms_hl - Win32 Debug" # Name "physic - Win32 Debug"
# Begin Group "Source Files" # Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"

View File

@ -132,7 +132,7 @@ typedef struct
file_t *file; file_t *file;
int headerlen; int headerlen;
uint time; // Sys_Milliseconds for first cinematic frame float time; // curtime for first cinematic frame
uint frame; uint frame;
} cinematics_t; } cinematics_t;

View File

@ -23,7 +23,7 @@ if errorlevel 1 set BUILD_ERROR=1
%MSDEV% launch/launch.dsp %CONFIG%"launch - Win32 Release" %build_target% %MSDEV% launch/launch.dsp %CONFIG%"launch - Win32 Release" %build_target%
if errorlevel 1 set BUILD_ERROR=1 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 if errorlevel 1 set BUILD_ERROR=1
%MSDEV% vid_gl/vid_gl.dsp %CONFIG%"vid_gl - Win32 Release" %build_target% %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 client\client.plg del /f /q client\client.plg
if exist engine\engine.plg del /f /q engine\engine.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 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 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 server\server.plg del /f /q server\server.plg
if exist spirit\spirit.plg del /f /q spirit\spirit.plg if exist spirit\spirit.plg del /f /q spirit\spirit.plg

View File

@ -357,7 +357,7 @@ channel_t *SND_PickDynamicChannel( int entnum, int channel, sfx_t *sfx )
{ {
int ch_idx; int ch_idx;
int first_to_die; int first_to_die;
int life_left; float life_left;
// check for replacement sound, or find the best one to replace // check for replacement sound, or find the best one to replace
first_to_die = -1; 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->entnum = ent;
target_chan->entchannel = chan; target_chan->entchannel = chan;
target_chan->startTime = Sys_Milliseconds(); target_chan->startTime = Sys_DoubleTime();
VectorCopy( pos, target_chan->position ); VectorCopy( pos, target_chan->position );
target_chan->volume = vol; target_chan->volume = vol;
target_chan->entnum = ent; 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->entnum = ent;
ch->entchannel = chan; ch->entchannel = chan;
ch->startTime = Sys_Milliseconds(); ch->startTime = Sys_DoubleTime();
VectorCopy( pos, ch->position ); VectorCopy( pos, ch->position );
ch->volume = vol; ch->volume = vol;
ch->entnum = ent; ch->entnum = ent;

View File

@ -72,7 +72,7 @@ typedef struct
int entnum; // to allow overriding a specific sound int entnum; // to allow overriding a specific sound
int entchannel; int entchannel;
uint startTime; // for overriding oldest sounds float startTime; // for overriding oldest sounds
bool staticsound; // use position instead of fetching entity's origin bool staticsound; // use position instead of fetching entity's origin
vec3_t position; // only use if fixedPosition is set vec3_t position; // only use if fixedPosition is set
float volume; float volume;

View File

@ -559,8 +559,7 @@ void CBaseEntity::Activate( void )
m_activated = TRUE; m_activated = TRUE;
InitMoveWith(); InitMoveWith();
if( !gpGlobals->changelevel ) PostSpawn();
PostSpawn();
} }
//LRC- called by activate() to support movewith //LRC- called by activate() to support movewith

View File

@ -479,7 +479,6 @@ void CWorld :: Spawn( void )
{ {
g_fGameOver = FALSE; g_fGameOver = FALSE;
Precache( ); Precache( );
g_flWeaponCheat = CVAR_GET_FLOAT( "sv_cheats" ); // Is the impulse 101 command allowed?
} }
void CWorld :: Precache( void ) void CWorld :: Precache( void )
@ -634,6 +633,9 @@ void CWorld :: Precache( void )
else else
CVAR_SET_FLOAT( "sv_zmax", 0 ); // let the renderer calculate optimal value 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 ) if ( pev->netname )
{ {
ALERT( at_aiconsole, "Chapter title: %s\n", STRING(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 ); 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. // Sent over net now.
pev->scale = atof(pkvd->szValue) * (1.0/8.0); pev->scale = atof(pkvd->szValue) * (1.0/8.0);
pkvd->fHandled = TRUE; pkvd->fHandled = TRUE;
CVAR_SET_FLOAT( "sv_wateramp", pev->scale );
} }
else if ( FStrEq(pkvd->szKeyName, "MaxRange") ) else if ( FStrEq(pkvd->szKeyName, "MaxRange") )
{ {

View File

@ -48,4 +48,7 @@ Xash 0.72 Stable 13.12.10
24.remove all unused stuff in engine 24.remove all unused stuff in engine
25.regrouping resources in baserc 25.regrouping resources in baserc
26.implement lighting in render OK 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

View File

@ -431,7 +431,7 @@ void R_BackendEndFrame( void )
break; break;
case 2: case 2:
com.snprintf( r_speeds_msg, sizeof( r_speeds_msg ), 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_mark_leaves,
r_world_node, r_world_node,
RI.farClip RI.farClip
@ -439,7 +439,7 @@ void R_BackendEndFrame( void )
break; break;
case 3: case 3:
com.snprintf( r_speeds_msg, sizeof( r_speeds_msg ), 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_add_polys, r_add_entities,
r_sort_meshes, r_draw_meshes r_sort_meshes, r_draw_meshes
); );

View File

@ -75,7 +75,7 @@ R_StopRoQ
static void R_StopRoQ( cinematics_t *cin ) static void R_StopRoQ( cinematics_t *cin )
{ {
cin->frame = 0; cin->frame = 0;
cin->time = 0; // done cin->time = 0.0f; // done
cin->pic = NULL; cin->pic = NULL;
cin->pic_pending = NULL; cin->pic_pending = NULL;

View File

@ -306,9 +306,9 @@ extern int r_framecount;
extern int r_framecount2; extern int r_framecount2;
extern int c_brush_polys, c_world_leafs; extern int c_brush_polys, c_world_leafs;
extern int r_mark_leaves, r_world_node; extern double r_mark_leaves, r_world_node;
extern int r_add_polys, r_add_entities; extern double r_add_polys, r_add_entities;
extern int r_sort_meshes, r_draw_meshes; extern double r_sort_meshes, r_draw_meshes;
extern msurface_t *r_debug_surface; extern msurface_t *r_debug_surface;

View File

@ -56,9 +56,9 @@ int r_framecount2; // used bonestransform checking
int c_brush_polys, c_world_leafs; int c_brush_polys, c_world_leafs;
int r_mark_leaves, r_world_node; double r_mark_leaves, r_world_node;
int r_add_polys, r_add_entities; double r_add_polys, r_add_entities;
int r_sort_meshes, r_draw_meshes; double r_sort_meshes, r_draw_meshes;
msurface_t *r_debug_surface; 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 ) void R_RenderView( const ref_params_t *fd )
{ {
int msec = 0; double starttime;
bool shadowMap = RI.params & RP_SHADOWMAPVIEW ? true : false; bool shadowMap = RI.params & RP_SHADOWMAPVIEW ? true : false;
RI.refdef = *fd; RI.refdef = *fd;
@ -1600,12 +1600,12 @@ void R_RenderView( const ref_params_t *fd )
R_SetupFrustum(); R_SetupFrustum();
if( r_speeds->integer ) if( r_speeds->integer )
msec = Sys_Milliseconds(); starttime = Sys_DoubleTime();
R_MarkLeaves(); R_MarkLeaves();
if( r_speeds->integer ) if( r_speeds->integer )
r_mark_leaves += ( Sys_Milliseconds() - msec ); r_mark_leaves += ( Sys_DoubleTime() - starttime );
R_DrawWorld(); R_DrawWorld();
@ -1617,20 +1617,21 @@ void R_RenderView( const ref_params_t *fd )
R_DrawCoronas(); R_DrawCoronas();
if( r_speeds->integer ) if( r_speeds->integer )
msec = Sys_Milliseconds(); starttime = Sys_DoubleTime();
R_AddPolysToList(); R_AddPolysToList();
if( r_speeds->integer ) 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(); R_DrawEntities();
if( r_speeds->integer ) if( r_speeds->integer )
r_add_entities += ( Sys_Milliseconds() - msec ); r_add_entities += ( Sys_DoubleTime() - starttime );
if( shadowMap ) if( shadowMap )
{ {
@ -1642,12 +1643,12 @@ void R_RenderView( const ref_params_t *fd )
} }
if( r_speeds->integer ) if( r_speeds->integer )
msec = Sys_Milliseconds(); starttime = Sys_DoubleTime();
R_SortMeshes(); R_SortMeshes();
if( r_speeds->integer ) if( r_speeds->integer )
r_sort_meshes += ( Sys_Milliseconds() - msec ); r_sort_meshes += ( Sys_DoubleTime() - starttime );
R_DrawPortals(); 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 ); R_Clear( shadowMap ? ~( GL_STENCIL_BUFFER_BIT|GL_COLOR_BUFFER_BIT ) : ~0 );
if( r_speeds->integer ) if( r_speeds->integer )
msec = Sys_Milliseconds(); starttime = Sys_DoubleTime();
R_DrawMeshes(); R_DrawMeshes();
if( r_speeds->integer ) if( r_speeds->integer )
r_draw_meshes += ( Sys_Milliseconds() - msec ); r_draw_meshes += ( Sys_DoubleTime() - starttime );
R_BackendCleanUpTextureUnits(); R_BackendCleanUpTextureUnits();

View File

@ -2518,8 +2518,8 @@ static void R_TraceGrid( int num )
void R_BuildLightGrid( mbrushmodel_t *world ) void R_BuildLightGrid( mbrushmodel_t *world )
{ {
double timestart = Sys_DoubleTime();
int i; int i;
uint timestart = Sys_Milliseconds();
MsgDev( D_INFO, "Building LightGrid...\n" ); MsgDev( D_INFO, "Building LightGrid...\n" );
@ -2544,7 +2544,7 @@ void R_BuildLightGrid( mbrushmodel_t *world )
R_TraceGrid( i ); R_TraceGrid( i );
Msg( "numGridPoints %i, mem %s\n", world->numgridpoints, memprint( world->numgridpoints * sizeof( mgridlight_t ))); 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 );
} }
/* /*

View File

@ -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 ) // don't rotate clients, only aim
angles[PITCH] = 0; // don't rotate clients and monsters, 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 ); Matrix4x4_CreateFromEntity( m_protationmatrix, origin[0], origin[1], origin[2], -angles[PITCH], angles[YAW], angles[ROLL], e->scale );

View File

@ -589,8 +589,9 @@ R_DrawWorld
*/ */
void R_DrawWorld( void ) void R_DrawWorld( void )
{ {
int clipflags, msec = 0; int clipflags;
uint dlightbits; uint dlightbits;
double starttime;
if( !r_drawworld->integer ) if( !r_drawworld->integer )
return; return;
@ -623,7 +624,7 @@ void R_DrawWorld( void )
else clipflags = RI.clipFlags; else clipflags = RI.clipFlags;
if( r_speeds->integer ) if( r_speeds->integer )
msec = Sys_Milliseconds(); starttime = Sys_DoubleTime();
if( r_dynamiclight->integer != 1 || r_fullbright->integer ) if( r_dynamiclight->integer != 1 || r_fullbright->integer )
dlightbits = 0; dlightbits = 0;
@ -633,7 +634,7 @@ void R_DrawWorld( void )
else R_RecursiveWorldNode( r_worldbrushmodel->nodes, clipflags, dlightbits ); else R_RecursiveWorldNode( r_worldbrushmodel->nodes, clipflags, dlightbits );
if( r_speeds->integer ) if( r_speeds->integer )
r_world_node += Sys_Milliseconds() - msec; r_world_node += Sys_DoubleTime() - starttime;
} }
/* /*

View File

@ -87,7 +87,7 @@ Package=<4>
############################################################################### ###############################################################################
Project: "cms_hl"=".\cms_hl\cms_hl.dsp" - Package Owner=<4> Project: "physic"=".\physic\physic.dsp" - Package Owner=<4>
Package=<5> Package=<5>
{{{ {{{