27 Mar 2017

This commit is contained in:
g-cont 2017-03-27 00:00:00 +03:00 committed by Alibek Omarov
parent 3dfa909805
commit 5932684d40
21 changed files with 142 additions and 75 deletions

View File

@ -49,6 +49,9 @@ typedef struct event_api_s
void ( *EV_PlayerTraceExt )( float *start, float *end, int traceFlags, int (*pfnIgnore)( struct physent_s *pe ), struct pmtrace_s *tr ); void ( *EV_PlayerTraceExt )( float *start, float *end, int traceFlags, int (*pfnIgnore)( struct physent_s *pe ), struct pmtrace_s *tr );
const char *(*EV_SoundForIndex)( int index ); const char *(*EV_SoundForIndex)( int index );
struct msurface_s *( *EV_TraceSurface )( int ground, float *vstart, float *vend ); struct msurface_s *( *EV_TraceSurface )( int ground, float *vstart, float *vend );
struct movevars_s *( *EV_GetMovevars )( void );
struct pmtrace_s *( *EV_VisTraceLine )( float *start, float *end, int flags );
struct physent_s *( *EV_GetVisent )( int idx );
} event_api_t; } event_api_t;
#endif//EVENT_API_H #endif//EVENT_API_H

View File

@ -58,7 +58,7 @@ GNU General Public License for more details.
#define PARM_CLIENT_INGAME 25 #define PARM_CLIENT_INGAME 25
#define PARM_FEATURES 26 // same as movevars->features #define PARM_FEATURES 26 // same as movevars->features
#define PARM_ACTIVE_TMU 27 // for debug #define PARM_ACTIVE_TMU 27 // for debug
//reserved #define PARM_LIGHTSTYLEVALUE 28 // second arg is stylenum
#define PARM_MAX_IMAGE_UNITS 29 #define PARM_MAX_IMAGE_UNITS 29
#define PARM_CLIENT_ACTIVE 30 #define PARM_CLIENT_ACTIVE 30
#define PARM_REBUILD_GAMMA 31 // if true lightmaps rebuilding for gamma change #define PARM_REBUILD_GAMMA 31 // if true lightmaps rebuilding for gamma change
@ -66,6 +66,7 @@ GNU General Public License for more details.
#define PARM_SURF_SAMPLESIZE 33 // lightmap resolution per face (second arg interpret as facenumber) #define PARM_SURF_SAMPLESIZE 33 // lightmap resolution per face (second arg interpret as facenumber)
#define PARM_GL_CONTEXT_TYPE 34 // opengl or opengles #define PARM_GL_CONTEXT_TYPE 34 // opengl or opengles
#define PARM_GLES_WRAPPER 35 // #define PARM_GLES_WRAPPER 35 //
#define PARM_STENCIL_ACTIVE 36
enum enum
{ {
@ -162,12 +163,12 @@ typedef struct render_api_s
dlight_t* (*GetDynamicLight)( int number ); dlight_t* (*GetDynamicLight)( int number );
dlight_t* (*GetEntityLight)( int number ); dlight_t* (*GetEntityLight)( int number );
byte (*LightToTexGamma)( byte color ); // software gamma support byte (*LightToTexGamma)( byte color ); // software gamma support
void (*Reserved0)( void ); float (*GetFrameTime)( void );
// Set renderer info (tell engine about changes) // Set renderer info (tell engine about changes)
void (*R_SetCurrentEntity)( struct cl_entity_s *ent ); // tell engine about both currententity and currentmodel void (*R_SetCurrentEntity)( struct cl_entity_s *ent ); // tell engine about both currententity and currentmodel
void (*R_SetCurrentModel)( struct model_s *mod ); // change currentmodel but leave currententity unchanged void (*R_SetCurrentModel)( struct model_s *mod ); // change currentmodel but leave currententity unchanged
void (*Reserved1)( void ); int (*R_FatPVS)( const float *org, float radius, byte *visbuffer, qboolean merge, qboolean fullvis );
void (*R_StoreEfrags)( struct efrag_s **ppefrag, int framecount );// store efrags for static entities void (*R_StoreEfrags)( struct efrag_s **ppefrag, int framecount );// store efrags for static entities
// Texture tools // Texture tools
@ -209,7 +210,7 @@ typedef struct render_api_s
void (*GL_Reserved2)( void ); void (*GL_Reserved2)( void );
// Misc renderer functions // Misc renderer functions
void (*GL_DrawParticles)( const struct ref_viewpass_s *rvp, qboolean solid_pass ); void (*GL_DrawParticles)( const struct ref_viewpass_s *rvp, qboolean trans_pass );
void (*EnvShot)( const float *vieworg, const char *name, qboolean skyshot, int shotsize ); // creates a cubemap or skybox into gfx\env folder void (*EnvShot)( const float *vieworg, const char *name, qboolean skyshot, int shotsize ); // creates a cubemap or skybox into gfx\env folder
int (*COM_CompareFileTime)( const char *filename1, const char *filename2, int *iCompare ); int (*COM_CompareFileTime)( const char *filename1, const char *filename2, int *iCompare );
void (*Host_Error)( const char *error, ... ); // cause Host Error void (*Host_Error)( const char *error, ... ); // cause Host Error

View File

@ -1199,6 +1199,9 @@ void CL_EmitEntities( void )
// set client ideal pitch when mlook is disabled // set client ideal pitch when mlook is disabled
CL_SetIdealPitch (); CL_SetIdealPitch ();
// think thirdperson camera
clgame.dllFuncs.CAM_Think ();
// link all the visible clients first // link all the visible clients first
CL_LinkPlayers ( &cl.frames[cl.parsecountmod] ); CL_LinkPlayers ( &cl.frames[cl.parsecountmod] );
@ -1214,9 +1217,6 @@ void CL_EmitEntities( void )
// fire events (client and server) // fire events (client and server)
CL_FireEvents (); CL_FireEvents ();
// think thirdperson camera
clgame.dllFuncs.CAM_Think ();
// handle spectator camera movement // handle spectator camera movement
CL_MoveSpectatorCamera(); CL_MoveSpectatorCamera();

View File

@ -1194,7 +1194,7 @@ static model_t *CL_LoadSpriteModel( const char *filename, uint type, uint texFla
} }
// load new map sprite // load new map sprite
if( CL_LoadHudSprite( name, &clgame.sprites[i], type, 0 )) if( CL_LoadHudSprite( name, &clgame.sprites[i], type, texFlags ))
{ {
if( i < ( MAX_IMAGES - 1 )) if( i < ( MAX_IMAGES - 1 ))
clgame.sprites[i].needload = clgame.load_sequence; clgame.sprites[i].needload = clgame.load_sequence;
@ -2293,6 +2293,22 @@ physent_t *pfnGetPhysent( int idx )
return NULL; return NULL;
} }
/*
=============
pfnGetVisent
=============
*/
physent_t *pfnGetVisent( int idx )
{
if( idx >= 0 && idx < clgame.pmove->numvisent )
{
// return physent
return &clgame.pmove->visents[idx];
}
return NULL;
}
/* /*
============= =============
pfnSetTraceHull pfnSetTraceHull
@ -2362,6 +2378,17 @@ static struct msurface_s *pfnTraceSurface( int ground, float *vstart, float *ven
pe = &clgame.pmove->physents[ground]; pe = &clgame.pmove->physents[ground];
return PM_TraceSurface( pe, vstart, vend ); return PM_TraceSurface( pe, vstart, vend );
} }
/*
=============
pfnGetMovevars
=============
*/
static movevars_t *pfnGetMoveVars( void )
{
return &clgame.movevars;
}
/* /*
============= =============
@ -3763,6 +3790,9 @@ static event_api_t gEventApi =
CL_PlayerTraceExt, CL_PlayerTraceExt,
CL_SoundFromIndex, CL_SoundFromIndex,
pfnTraceSurface, pfnTraceSurface,
pfnGetMoveVars,
CL_VisTraceLine,
pfnGetVisent,
}; };
static demo_api_t gDemoApi = static demo_api_t gDemoApi =
@ -4080,8 +4110,11 @@ qboolean CL_LoadProgs( const char *name )
CL_InitStudioAPI( ); CL_InitStudioAPI( );
// grab them from client.dll // trying to grab them from client.dll
cl_righthand = Cvar_Get( "cl_righthand", "0", FCVAR_ARCHIVE, "flip viewmodel (left to right)" ); cl_righthand = Cvar_FindVar( "cl_righthand" );
if( cl_righthand == NULL )
cl_righthand = Cvar_Get( "cl_righthand", "0", FCVAR_ARCHIVE, "flip viewmodel (left to right)" );
return true; return true;
} }

View File

@ -726,17 +726,17 @@ CL_VisTraceLine
trace by visible objects (thats can be non-solid) trace by visible objects (thats can be non-solid)
============= =============
*/ */
pmtrace_t CL_VisTraceLine( vec3_t start, vec3_t end, int flags ) pmtrace_t *CL_VisTraceLine( vec3_t start, vec3_t end, int flags )
{ {
int old_usehull; int old_usehull;
pmtrace_t tr; static pmtrace_t tr;
old_usehull = clgame.pmove->usehull; old_usehull = clgame.pmove->usehull;
clgame.pmove->usehull = 2; clgame.pmove->usehull = 2;
tr = PM_PlayerTraceExt( clgame.pmove, start, end, flags, clgame.pmove->numvisent, clgame.pmove->visents, -1, NULL ); tr = PM_PlayerTraceExt( clgame.pmove, start, end, flags, clgame.pmove->numvisent, clgame.pmove->visents, -1, NULL );
clgame.pmove->usehull = old_usehull; clgame.pmove->usehull = old_usehull;
return tr; return &tr;
} }
/* /*

View File

@ -2622,7 +2622,7 @@ void CL_UpdateFlashlight( cl_entity_t *ent )
vec3_t forward, view_ofs; vec3_t forward, view_ofs;
vec3_t vecSrc, vecEnd; vec3_t vecSrc, vecEnd;
float falloff; float falloff;
pmtrace_t trace; pmtrace_t *trace;
dlight_t *dl; dlight_t *dl;
if( ent->index == ( cl.playernum + 1 )) if( ent->index == ( cl.playernum + 1 ))
@ -2658,14 +2658,14 @@ void CL_UpdateFlashlight( cl_entity_t *ent )
dl = CL_AllocDlight( ent->index ); dl = CL_AllocDlight( ent->index );
#if 0 #if 0
// g-cont. disabled until studio lighting will be finished // g-cont. disabled until studio lighting will be finished
if( trace.ent > 0 && clgame.pmove->visents[trace.ent].studiomodel ) if( trace->ent > 0 && clgame.pmove->visents[trace->ent].studiomodel )
VectorCopy( clgame.pmove->visents[trace.ent].origin, dl->origin ); VectorCopy( clgame.pmove->visents[trace->ent].origin, dl->origin );
else VectorCopy( trace.endpos, dl->origin ); else VectorCopy( trace->endpos, dl->origin );
#else #else
VectorCopy( trace.endpos, dl->origin ); VectorCopy( trace->endpos, dl->origin );
#endif #endif
// compute falloff // compute falloff
falloff = trace.fraction * FLASHLIGHT_DISTANCE; falloff = trace->fraction * FLASHLIGHT_DISTANCE;
if( falloff < 500.0f ) falloff = 1.0f; if( falloff < 500.0f ) falloff = 1.0f;
else falloff = 500.0f / falloff; else falloff = 500.0f / falloff;
falloff *= falloff; falloff *= falloff;

View File

@ -119,6 +119,7 @@ void SCR_CheckStartupVids( void )
{ {
cls.movienum = 0; cls.movienum = 0;
SCR_NextMovie (); SCR_NextMovie ();
Cbuf_Execute();
} }
else cls.movienum = -1; else cls.movienum = -1;
} }

View File

@ -805,7 +805,7 @@ int CL_PointContents( const vec3_t p );
int CL_WaterEntity( const float *rgflPos ); int CL_WaterEntity( const float *rgflPos );
cl_entity_t *CL_GetWaterEntity( const float *rgflPos ); cl_entity_t *CL_GetWaterEntity( const float *rgflPos );
void CL_SetupPMove( playermove_t *pmove, local_state_t *from, usercmd_t *ucmd, qboolean runfuncs, double time ); void CL_SetupPMove( playermove_t *pmove, local_state_t *from, usercmd_t *ucmd, qboolean runfuncs, double time );
pmtrace_t CL_VisTraceLine( vec3_t start, vec3_t end, int flags ); pmtrace_t *CL_VisTraceLine( vec3_t start, vec3_t end, int flags );
pmtrace_t CL_TraceLine( vec3_t start, vec3_t end, int flags ); pmtrace_t CL_TraceLine( vec3_t start, vec3_t end, int flags );
void CL_MoveSpectatorCamera( void ); void CL_MoveSpectatorCamera( void );
qboolean CL_LocalWeapons( void ); qboolean CL_LocalWeapons( void );
@ -853,7 +853,7 @@ void CL_WeaponAnim( int iAnim, int body );
void CL_ClearEffects( void ); void CL_ClearEffects( void );
void CL_ClearEfrags( void ); void CL_ClearEfrags( void );
void CL_TestLights( void ); void CL_TestLights( void );
void CL_DrawParticlesExternal( const ref_viewpass_t *rvp, qboolean solid_pass ); void CL_DrawParticlesExternal( const ref_viewpass_t *rvp, qboolean trans_pass );
void CL_FireCustomDecal( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags, float scale ); void CL_FireCustomDecal( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags, float scale );
void CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags ); void CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags );
void CL_PlayerDecal( int textureIndex, int entityIndex, float *pos ); void CL_PlayerDecal( int textureIndex, int entityIndex, float *pos );

View File

@ -808,7 +808,7 @@ byte *GL_ApplyGamma( const byte *source, int pixels, qboolean isNormalMap )
byte *out = (byte *)source; byte *out = (byte *)source;
int i; int i;
if( !isNormalMap ) if( source && !isNormalMap )
{ {
for( i = 0; i < pixels; i++, in += 4 ) for( i = 0; i < pixels; i++, in += 4 )
{ {

View File

@ -203,8 +203,10 @@ typedef struct
int realframecount; // not including viewpasses int realframecount; // not including viewpasses
int framecount; int framecount;
qboolean fResetVis;
byte visbytes[(MAX_MAP_LEAFS+7)/8]; // member custom PVS
int lightstylevalue[MAX_LIGHTSTYLES]; // value 0 - 65536 int lightstylevalue[MAX_LIGHTSTYLES]; // value 0 - 65536
float lightcache[MAX_LIGHTSTYLES];
double frametime; // special frametime for multipass rendering (will set to 0 on a nextview) double frametime; // special frametime for multipass rendering (will set to 0 on a nextview)
float blend; // global blend value float blend; // global blend value

View File

@ -36,7 +36,7 @@ CL_RunLightStyles
void CL_RunLightStyles( void ) void CL_RunLightStyles( void )
{ {
int i, k, flight, clight; int i, k, flight, clight;
float l, c, lerpfrac, backlerp; float l, lerpfrac, backlerp;
float frametime = (cl.time - cl.oldtime); float frametime = (cl.time - cl.oldtime);
float scale; float scale;
lightstyle_t *ls; lightstyle_t *ls;
@ -52,7 +52,6 @@ void CL_RunLightStyles( void )
if( r_fullbright->value || !cl.worldmodel->lightdata ) if( r_fullbright->value || !cl.worldmodel->lightdata )
{ {
tr.lightstylevalue[i] = 256 * 256; tr.lightstylevalue[i] = 256 * 256;
tr.lightcache[i] = 3.0f;
continue; continue;
} }
@ -67,20 +66,17 @@ void CL_RunLightStyles( void )
if( !ls->length ) if( !ls->length )
{ {
tr.lightstylevalue[i] = 256 * scale; tr.lightstylevalue[i] = 256 * scale;
tr.lightcache[i] = 3.0f * scale;
continue; continue;
} }
else if( ls->length == 1 ) else if( ls->length == 1 )
{ {
// single length style so don't bother interpolating // single length style so don't bother interpolating
tr.lightstylevalue[i] = ls->map[0] * 22 * scale; tr.lightstylevalue[i] = ls->map[0] * 22 * scale;
tr.lightcache[i] = ( ls->map[0] / 12.0f ) * 3.0f * scale;
continue; continue;
} }
else if( !ls->interp || !cl_lightstyle_lerping->value ) else if( !ls->interp || !cl_lightstyle_lerping->value )
{ {
tr.lightstylevalue[i] = ls->map[flight%ls->length] * 22 * scale; tr.lightstylevalue[i] = ls->map[flight%ls->length] * 22 * scale;
tr.lightcache[i] = ( ls->map[flight%ls->length] / 12.0f ) * 3.0f * scale;
continue; continue;
} }
@ -88,15 +84,12 @@ void CL_RunLightStyles( void )
// frame just gone // frame just gone
k = ls->map[flight % ls->length]; k = ls->map[flight % ls->length];
l = (float)( k * 22.0f ) * backlerp; l = (float)( k * 22.0f ) * backlerp;
c = (float)( k / 12.0f ) * backlerp;
// upcoming frame // upcoming frame
k = ls->map[clight % ls->length]; k = ls->map[clight % ls->length];
l += (float)( k * 22.0f ) * lerpfrac; l += (float)( k * 22.0f ) * lerpfrac;
c += (float)( k / 12.0f ) * lerpfrac;
tr.lightstylevalue[i] = (int)l * scale; tr.lightstylevalue[i] = (int)l * scale;
tr.lightcache[i] = c * 3.0f * scale;
} }
} }

View File

@ -1076,7 +1076,8 @@ void R_RenderFrame( const ref_viewpass_t *rvp )
{ {
if( clgame.drawFuncs.GL_RenderFrame( rvp )) if( clgame.drawFuncs.GL_RenderFrame( rvp ))
{ {
RI.viewleaf = NULL; // force markleafs next frame tr.realframecount++;
tr.fResetVis = true;
return; return;
} }
} }
@ -1174,7 +1175,7 @@ static int GL_RenderGetParm( int parm, int arg )
case PARM_TEX_SKYTEXNUM: case PARM_TEX_SKYTEXNUM:
return tr.skytexturenum; return tr.skytexturenum;
case PARM_TEX_LIGHTMAP: case PARM_TEX_LIGHTMAP:
ASSERT( arg >= 0 && arg < MAX_LIGHTMAPS ); arg = bound( 0, arg, MAX_LIGHTMAPS - 1 );
return tr.lightmapTextures[arg]; return tr.lightmapTextures[arg];
case PARM_SKY_SPHERE: case PARM_SKY_SPHERE:
return world.sky_sphere && !world.custom_skybox; return world.sky_sphere && !world.custom_skybox;
@ -1209,6 +1210,9 @@ static int GL_RenderGetParm( int parm, int arg )
return host.features; return host.features;
case PARM_ACTIVE_TMU: case PARM_ACTIVE_TMU:
return glState.activeTMU; return glState.activeTMU;
case PARM_LIGHTSTYLEVALUE:
arg = bound( 0, arg, MAX_LIGHTSTYLES - 1 );
return tr.lightstylevalue[arg];
case PARM_MAP_HAS_DELUXE: case PARM_MAP_HAS_DELUXE:
return (world.deluxedata != NULL); return (world.deluxedata != NULL);
case PARM_MAX_IMAGE_UNITS: case PARM_MAX_IMAGE_UNITS:
@ -1227,6 +1231,8 @@ static int GL_RenderGetParm( int parm, int arg )
return glConfig.context; return glConfig.context;
case PARM_GLES_WRAPPER: case PARM_GLES_WRAPPER:
return glConfig.wrapper; return glConfig.wrapper;
case PARM_STENCIL_ACTIVE:
return glState.stencilEnabled;
} }
return 0; return 0;
} }
@ -1307,6 +1313,13 @@ static void R_SetCurrentModel( model_t *mod )
RI.currentmodel = mod; RI.currentmodel = mod;
} }
static int R_FatPVS( const vec3_t org, float radius, byte *visbuffer, qboolean merge, qboolean fullvis )
{
int bytes = Mod_FatPVS( org, radius, visbuffer, world.visbytes, merge, fullvis );
if( visbuffer ) memcpy( tr.visbytes, visbuffer, world.visbytes );
return bytes;
}
static lightstyle_t *CL_GetLightStyle( int number ) static lightstyle_t *CL_GetLightStyle( int number )
{ {
ASSERT( number >= 0 && number < MAX_LIGHTSTYLES ); ASSERT( number >= 0 && number < MAX_LIGHTSTYLES );
@ -1325,6 +1338,11 @@ static dlight_t *CL_GetEntityLight( int number )
return &cl_elights[number]; return &cl_elights[number];
} }
static float R_GetFrameTime( void )
{
return tr.frametime;
}
static const char *GL_TextureName( unsigned int texnum ) static const char *GL_TextureName( unsigned int texnum )
{ {
return R_GetTexture( texnum )->name; return R_GetTexture( texnum )->name;
@ -1398,10 +1416,10 @@ static render_api_t gRenderAPI =
CL_GetDynamicLight, CL_GetDynamicLight,
CL_GetEntityLight, CL_GetEntityLight,
LightToTexGamma, LightToTexGamma,
NULL, R_GetFrameTime,
R_SetCurrentEntity, R_SetCurrentEntity,
R_SetCurrentModel, R_SetCurrentModel,
NULL, R_FatPVS,
R_StoreEfrags, R_StoreEfrags,
GL_FindTexture, GL_FindTexture,
GL_TextureName, GL_TextureName,

View File

@ -655,7 +655,7 @@ CL_DrawParticlesExternal
allow to draw effects from custom renderer allow to draw effects from custom renderer
=============== ===============
*/ */
void CL_DrawParticlesExternal( const ref_viewpass_t *rvp, qboolean solid_pass ) void CL_DrawParticlesExternal( const ref_viewpass_t *rvp, qboolean trans_pass )
{ {
ref_instance_t oldRI = RI; ref_instance_t oldRI = RI;
@ -664,7 +664,10 @@ void CL_DrawParticlesExternal( const ref_viewpass_t *rvp, qboolean solid_pass )
R_SetupFrustum(); R_SetupFrustum();
R_SetupGL( false ); // don't touch GL-states R_SetupGL( false ); // don't touch GL-states
if( solid_pass ) // setup PVS for frame
memcpy( RI.visbytes, tr.visbytes, world.visbytes );
if( trans_pass == false )
{ {
CL_DrawBeams( false ); CL_DrawBeams( false );
} }

View File

@ -447,7 +447,7 @@ texture_t *R_TextureAnimation( msurface_t *s )
reletive = (int)(cl.time * speed) % base->anim_total; reletive = (int)(cl.time * speed) % base->anim_total;
} }
count = 0; count = 0;
while( base->anim_min > reletive || base->anim_max <= reletive ) while( base->anim_min > reletive || base->anim_max <= reletive )
{ {
@ -1962,10 +1962,11 @@ void R_MarkLeaves( void )
if( !RI.drawWorld ) return; if( !RI.drawWorld ) return;
if( FBitSet( r_novis->flags, FCVAR_CHANGED )) if( FBitSet( r_novis->flags, FCVAR_CHANGED ) || tr.fResetVis )
{ {
// force recalc viewleaf // force recalc viewleaf
ClearBits( r_novis->flags, FCVAR_CHANGED ); ClearBits( r_novis->flags, FCVAR_CHANGED );
tr.fResetVis = false;
RI.viewleaf = NULL; RI.viewleaf = NULL;
} }

View File

@ -781,7 +781,7 @@ static float R_SpriteGlowBlend( vec3_t origin, int rendermode, int renderfx, flo
{ {
float dist, brightness; float dist, brightness;
vec3_t glowDist; vec3_t glowDist;
pmtrace_t tr; pmtrace_t *tr;
VectorSubtract( origin, RI.vieworg, glowDist ); VectorSubtract( origin, RI.vieworg, glowDist );
dist = VectorLength( glowDist ); dist = VectorLength( glowDist );
@ -790,7 +790,7 @@ static float R_SpriteGlowBlend( vec3_t origin, int rendermode, int renderfx, flo
{ {
tr = CL_VisTraceLine( RI.vieworg, origin, r_traceglow->value ? PM_GLASS_IGNORE : (PM_GLASS_IGNORE|PM_STUDIO_IGNORE)); tr = CL_VisTraceLine( RI.vieworg, origin, r_traceglow->value ? PM_GLASS_IGNORE : (PM_GLASS_IGNORE|PM_STUDIO_IGNORE));
if(( 1.0f - tr.fraction ) * dist > 8.0f ) if(( 1.0f - tr->fraction ) * dist > 8.0f )
return 0.0f; return 0.0f;
} }

View File

@ -352,8 +352,8 @@ pfnGetEngineTimes
static void pfnGetEngineTimes( int *framecount, double *current, double *old ) static void pfnGetEngineTimes( int *framecount, double *current, double *old )
{ {
if( framecount ) *framecount = tr.realframecount; if( framecount ) *framecount = tr.realframecount;
if( current ) *current = g_studio.time; if( current ) *current = cl.time;
if( old ) *old = g_studio.time - g_studio.frametime; if( old ) *old = cl.oldtime;
} }
/* /*

View File

@ -121,6 +121,7 @@ vidmode_t vidmode[] =
{ "1680 x 1050 (wide)", 1680, 1050, true }, { "1680 x 1050 (wide)", 1680, 1050, true },
{ "1920 x 1080 (wide)", 1920, 1080, true }, { "1920 x 1080 (wide)", 1920, 1080, true },
{ "1920 x 1200 (wide)", 1920, 1200, true }, { "1920 x 1200 (wide)", 1920, 1200, true },
{ "2560 x 1440 (wide)", 2560, 1440, true },
{ "2560 x 1600 (wide)", 2560, 1600, true }, { "2560 x 1600 (wide)", 2560, 1600, true },
{ "1600 x 900 (wide)", 1600, 900, true }, { "1600 x 900 (wide)", 1600, 900, true },
}; };
@ -1584,7 +1585,7 @@ void GL_InitCommands( void )
window_xpos = Cvar_Get( "_window_xpos", "130", FCVAR_RENDERINFO, "window position by horizontal" ); window_xpos = Cvar_Get( "_window_xpos", "130", FCVAR_RENDERINFO, "window position by horizontal" );
window_ypos = Cvar_Get( "_window_ypos", "48", FCVAR_RENDERINFO, "window position by vertical" ); window_ypos = Cvar_Get( "_window_ypos", "48", FCVAR_RENDERINFO, "window position by vertical" );
gl_extensions = Cvar_Get( "gl_extensions", "1", FCVAR_GLCONFIG, "allow gl_extensions" ); gl_extensions = Cvar_Get( "gl_allow_extensions", "1", FCVAR_GLCONFIG, "allow gl_extensions" );
gl_compress_textures = Cvar_Get( "gl_compress_textures", "0", FCVAR_GLCONFIG, "compress textures to safe video memory" ); gl_compress_textures = Cvar_Get( "gl_compress_textures", "0", FCVAR_GLCONFIG, "compress textures to safe video memory" );
gl_texture_nearest = Cvar_Get( "gl_texture_nearest", "0", FCVAR_ARCHIVE, "disable texture filter" ); gl_texture_nearest = Cvar_Get( "gl_texture_nearest", "0", FCVAR_ARCHIVE, "disable texture filter" );
gl_max_size = Cvar_Get( "gl_max_size", "512", FCVAR_ARCHIVE, "no effect in Xash3D just a legacy" ); gl_max_size = Cvar_Get( "gl_max_size", "512", FCVAR_ARCHIVE, "no effect in Xash3D just a legacy" );

View File

@ -212,38 +212,22 @@ void Cbuf_Execute( void )
} }
} }
/*
==============================================================================
SCRIPT COMMANDS
==============================================================================
*/
/* /*
=============== ===============
Cmd_StuffCmds_f Cbuf_ExecStuffCmds
Adds command line parameters as script statements execute commandline
Commands lead with a +, and continue until a - or another +
xash -dev 3 +map c1a0d
xash -nosound -game bshift
=============== ===============
*/ */
void Cmd_StuffCmds_f( void ) void Cbuf_ExecStuffCmds( void )
{ {
int i, j, l = 0;
char build[MAX_CMD_LINE]; // this is for all commandline options combined (and is bounds checked) char build[MAX_CMD_LINE]; // this is for all commandline options combined (and is bounds checked)
int i, j, l = 0;
if( Cmd_Argc() != 1 )
{
Msg( "Usage: stuffcmds : execute command line parameters\n" );
return;
}
// no reason to run the commandline arguments twice // no reason to run the commandline arguments twice
if( host.stuffcmdsrun ) return; if( !host.stuffcmds_pending )
return;
host.stuffcmdsrun = true;
build[0] = 0; build[0] = 0;
for( i = 0; i < host.argc; i++ ) for( i = 0; i < host.argc; i++ )
@ -282,6 +266,33 @@ void Cmd_StuffCmds_f( void )
// we already reserved space for the terminator // we already reserved space for the terminator
build[l++] = 0; build[l++] = 0;
Cbuf_InsertText( build ); Cbuf_InsertText( build );
Cbuf_Execute(); // apply now
// this command can be called only from .rc
Cmd_RemoveCommand( "stuffcmds" );
host.stuffcmds_pending = false;
}
/*
==============================================================================
SCRIPT COMMANDS
==============================================================================
*/
/*
===============
Cmd_StuffCmds_f
Adds command line parameters as script statements
Commands lead with a +, and continue until a - or another +
xash -dev 3 +map c1a0d
xash -nosound -game bshift
===============
*/
void Cmd_StuffCmds_f( void )
{
host.stuffcmds_pending = true;
} }
/* /*

View File

@ -320,7 +320,7 @@ typedef struct host_parm_s
int developer; // show all developer's message int developer; // show all developer's message
int old_developer; // keep real dev state (we need enable dev-mode in multiplayer) int old_developer; // keep real dev state (we need enable dev-mode in multiplayer)
qboolean key_overstrike; // key overstrike mode qboolean key_overstrike; // key overstrike mode
qboolean stuffcmdsrun; // execute stuff commands qboolean stuffcmds_pending; // should execute stuff commands
qboolean allow_cheats; // this host will allow cheating qboolean allow_cheats; // this host will allow cheating
qboolean con_showalways; // show console always (developer and dedicated) qboolean con_showalways; // show console always (developer and dedicated)
qboolean com_handlecolon; // allow COM_ParseFile to handle colon as single char qboolean com_handlecolon; // allow COM_ParseFile to handle colon as single char

View File

@ -40,6 +40,7 @@ void Cbuf_Init( void );
void Cbuf_Clear( void ); void Cbuf_Clear( void );
void Cbuf_AddText( const char *text ); void Cbuf_AddText( const char *text );
void Cbuf_InsertText( const char *text ); void Cbuf_InsertText( const char *text );
void Cbuf_ExecStuffCmds( void );
void Cbuf_Execute (void); void Cbuf_Execute (void);
uint Cmd_Argc( void ); uint Cmd_Argc( void );
char *Cmd_Args( void ); char *Cmd_Args( void );

View File

@ -995,22 +995,21 @@ int EXPORT Host_Main( const char *progname, int bChangeGame, pfnChangeGame func
// execute startup config and cmdline // execute startup config and cmdline
Cbuf_AddText( va( "exec %s.rc\n", SI.ModuleName )); Cbuf_AddText( va( "exec %s.rc\n", SI.ModuleName ));
Cbuf_AddText( "exec config.cfg\n" ); Cbuf_AddText( "exec config.cfg\n" );
// intentional fallthrough
case HOST_DEDICATED:
// if stuffcmds wasn't run, then init.rc is probably missing, use default
if( !host.stuffcmdsrun ) Cbuf_AddText( "stuffcmds\n" );
Cbuf_Execute(); Cbuf_Execute();
break; break;
case HOST_DEDICATED:
// allways parse commandline in dedicated-mode
host.stuffcmds_pending = true;
break;
} }
host.change_game = false; // done host.change_game = false; // done
Cmd_RemoveCommand( "setr" ); // remove potentially backdoor for change render settings Cmd_RemoveCommand( "setr" ); // remove potentially backdoor for change render settings
Cmd_RemoveCommand( "setgl" ); Cmd_RemoveCommand( "setgl" );
Cbuf_ExecStuffCmds(); // execute stuffcmds (commandline)
SCR_CheckStartupVids(); // must be last
// we need to execute it again here
oldtime = Sys_DoubleTime() - 0.1; oldtime = Sys_DoubleTime() - 0.1;
SCR_CheckStartupVids(); // must be last
// main window message loop // main window message loop
while( !host.crashed ) while( !host.crashed )