23 Aug 2017

This commit is contained in:
g-cont 2017-08-23 00:00:00 +03:00 committed by Alibek Omarov
parent 547b56497e
commit b11b79d08a
14 changed files with 150 additions and 112 deletions

View File

@ -976,7 +976,6 @@ void CL_ParseBaseline( sizebuf_t *msg )
{
int newnum;
float timebase;
position_history_t *ph;
cl_entity_t *ent;
Delta_InitClient (); // finalize client delta's
@ -995,12 +994,6 @@ void CL_ParseBaseline( sizebuf_t *msg )
else timebase = 1.0f; // sv.state == ss_loading
MSG_ReadDeltaEntity( msg, &ent->prevstate, &ent->baseline, newnum, CL_IsPlayerIndex( newnum ), timebase );
// EXPERIMENTAL
ph = &ent->ph[ent->current_position];
VectorCopy( ent->baseline.origin, ph->origin );
VectorCopy( ent->baseline.angles, ph->angles );
ph->animtime = ent->baseline.animtime; // !!!
}
/*

View File

@ -766,8 +766,6 @@ void R_DrawCylinder( vec3_t source, vec3_t delta, float width, float scale, floa
// Scroll speed 3.5 -- initial texture position, scrolls 3.5/sec (1.0 is entire texture)
vLast = fmod( freq * speed, 1 );
scale = scale * length;
TriCullFace( TRI_NONE ); // draw both sides
for ( i = 0; i < segments; i++ )
{
@ -794,8 +792,6 @@ void R_DrawCylinder( vec3_t source, vec3_t delta, float width, float scale, floa
vLast += vStep; // Advance texture scroll (v axis only)
}
TriCullFace( TRI_FRONT );
}
/*

View File

@ -95,29 +95,25 @@ R_CullSurface
cull invisible surfaces
=================
*/
qboolean R_CullSurface( msurface_t *surf, gl_frustum_t *frustum, uint clipflags )
int R_CullSurface( msurface_t *surf, gl_frustum_t *frustum, uint clipflags )
{
cl_entity_t *e = RI.currententity;
if( !surf || !surf->texinfo || !surf->texinfo->texture )
return true;
return CULL_OTHER;
if( !FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE ))
{
if( surf->flags & SURF_WATERCSG && !( e->curstate.effects & EF_NOWATERCSG ))
return true;
return CULL_OTHER;
}
// don't cull transparent surfaces because we should be draw decals on them
if( surf->pdecals && ( e->curstate.rendermode == kRenderTransTexture || e->curstate.rendermode == kRenderTransAdd ))
return false;
if( r_nocull->value )
return false;
return CULL_VISIBLE;
// world surfaces can be culled by vis frame too
if( RI.currententity == clgame.entities && surf->visframe != tr.framecount )
return true;
return CULL_VISFRAME;
if( r_faceplanecull->value && !FBitSet( surf->flags, SURF_DRAWTURB ))
{
@ -140,35 +136,35 @@ qboolean R_CullSurface( msurface_t *surf, gl_frustum_t *frustum, uint clipflags
if( glState.faceCull == GL_FRONT || ( RI.params & RP_MIRRORVIEW ))
{
if( surf->flags & SURF_PLANEBACK )
if( FBitSet( surf->flags, SURF_PLANEBACK ))
{
if( dist >= -BACKFACE_EPSILON )
return true; // wrong side
return CULL_BACKSIDE; // wrong side
}
else
{
if( dist <= BACKFACE_EPSILON )
return true; // wrong side
return CULL_BACKSIDE; // wrong side
}
}
else if( glState.faceCull == GL_BACK )
{
if( surf->flags & SURF_PLANEBACK )
if( FBitSet( surf->flags, SURF_PLANEBACK ))
{
if( dist <= BACKFACE_EPSILON )
return true; // wrong side
return CULL_BACKSIDE; // wrong side
}
else
{
if( dist >= -BACKFACE_EPSILON )
return true; // wrong side
return CULL_BACKSIDE; // wrong side
}
}
}
}
if( frustum )
return GL_FrustumCullBox( frustum, surf->info->mins, surf->info->maxs, clipflags );
if( frustum && GL_FrustumCullBox( frustum, surf->info->mins, surf->info->maxs, clipflags ))
return CULL_FRUSTUM;
return false;
return CULL_VISIBLE;
}

View File

@ -878,7 +878,7 @@ void DrawSingleDecal( decal_t *pDecal, msurface_t *fa )
pglEnd();
}
void DrawSurfaceDecals( msurface_t *fa, qboolean single )
void DrawSurfaceDecals( msurface_t *fa, qboolean single, qboolean reverse )
{
decal_t *p;
cl_entity_t *e;
@ -964,28 +964,25 @@ void DrawSurfaceDecals( msurface_t *fa, qboolean single )
}
}
for( p = fa->pdecals; p; p = p->pnext )
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
pglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
if( reverse && e->curstate.rendermode == kRenderTransTexture )
{
if( p->texture )
decal_t *list[1024];
int i, count;
for( p = fa->pdecals, count = 0; p && count < 1024; p = p->pnext )
if( p->texture ) list[count++] = p;
for( i = count - 1; i >= 0; i-- )
DrawSingleDecal( list[i], fa );
}
else
{
for( p = fa->pdecals; p; p = p->pnext )
{
gltexture_t *glt = R_GetTexture( p->texture );
// normal HL decal with alpha-channel
if( glt->flags & TF_HAS_ALPHA )
{
// draw transparent decals with GL_MODULATE
if( glt->fogParams[3] > DECAL_TRANSPARENT_THRESHOLD )
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
else pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
pglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
}
else
{
// color decal like detail texture. Base color is 127 127 127
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
pglBlendFunc( GL_DST_COLOR, GL_SRC_COLOR );
}
if( !p->texture ) continue;
DrawSingleDecal( p, fa );
}
}
@ -1048,7 +1045,7 @@ void DrawDecalsBatch( void )
for( i = 0; i < tr.num_draw_decals; i++ )
{
DrawSurfaceDecals( tr.draw_decals[i], false );
DrawSurfaceDecals( tr.draw_decals[i], false, false );
}
if( e->curstate.rendermode != kRenderTransTexture )

View File

@ -780,14 +780,6 @@ byte *GL_ResampleTexture( const byte *source, int inWidth, int inHeight, int out
return scaledImage;
}
float GL_SimpleSpline( float value )
{
float valueSquared = value * value * value;
// nice little ease-in, ease-out spline-like curve
return (4.0f * valueSquared - 3.0f * valueSquared * value);
}
/*
=================
GL_BoxFilter3x3
@ -832,7 +824,7 @@ void GL_BoxFilter3x3( byte *out, const byte *in, int w, int h, int x, int y )
out[0] = r / acount;
out[1] = g / acount;
out[2] = b / acount;
// out[3] = (int)( SimpleSpline( ( a / 9.0f ) / 255.0f ) * 255 );
// out[3] = (int)( SimpleSpline( ( a / 12.0f ) / 255.0f ) * 255 );
}
/*
@ -848,6 +840,9 @@ byte *GL_ApplyFilter( const byte *source, int width, int height )
byte *out = (byte *)source;
int i;
if( FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE ))
return in;
for( i = 0; source && i < width * height; i++, in += 4 )
{
if( in[0] == 0 && in[1] == 0 && in[2] == 0 && in[3] == 0 )

View File

@ -56,6 +56,12 @@ extern byte *r_temppool;
#define TF_IMAGE (TF_NOMIPMAP|TF_CLAMP)
#define TF_DECAL (TF_CLAMP)
#define CULL_VISIBLE 0 // not culled
#define CULL_BACKSIDE 1 // backside of transparent wall
#define CULL_FRUSTUM 2 // culled by frustum
#define CULL_VISFRAME 3 // culled by PVS
#define CULL_OTHER 4 // culled by other reason
typedef struct gltexture_s
{
char name[256]; // game path, including extension (can be store image programs)
@ -285,12 +291,12 @@ void R_ShowTextures( void );
int R_CullModel( cl_entity_t *e, const vec3_t absmin, const vec3_t absmax );
qboolean R_CullBox( const vec3_t mins, const vec3_t maxs );
qboolean R_CullSphere( const vec3_t centre, const float radius );
qboolean R_CullSurface( msurface_t *surf, gl_frustum_t *frustum, uint clipflags );
int R_CullSurface( msurface_t *surf, gl_frustum_t *frustum, uint clipflags );
//
// gl_decals.c
//
void DrawSurfaceDecals( msurface_t *fa, qboolean single );
void DrawSurfaceDecals( msurface_t *fa, qboolean single, qboolean reverse );
float *R_DecalSetupVerts( decal_t *pDecal, msurface_t *surf, int texture, int *outCount );
void DrawSingleDecal( decal_t *pDecal, msurface_t *fa );
void R_EntityRemoveDecals( model_t *mod );

View File

@ -133,7 +133,7 @@ static int R_TransEntityCompare( const cl_entity_t **a, const cl_entity_t **b )
ent2 = (cl_entity_t *)*b;
// sort by distance
if( ent1->curstate.rendermode != kRenderTransAlpha )
if( ent1->model->type != mod_brush || ent1->curstate.rendermode != kRenderTransAlpha )
{
VectorAverage( ent1->model->mins, ent1->model->maxs, org );
VectorAdd( ent1->origin, org, org );
@ -142,7 +142,7 @@ static int R_TransEntityCompare( const cl_entity_t **a, const cl_entity_t **b )
}
else dist1 = 1000000000;
if( ent2->curstate.rendermode != kRenderTransAlpha )
if( ent2->model->type != mod_brush || ent2->curstate.rendermode != kRenderTransAlpha )
{
VectorAverage( ent2->model->mins, ent2->model->maxs, org );
VectorAdd( ent2->origin, org, org );

View File

@ -1165,8 +1165,12 @@ void R_RenderBrushPoly( msurface_t *fa )
}
else
{
float dist = PlaneDiff( tr.modelorg, fa->plane );
if( FBitSet( fa->flags, SURF_PLANEBACK ))
dist = -dist;
// if rendermode != kRenderNormal draw decals sequentially
DrawSurfaceDecals( fa, true );
DrawSurfaceDecals( fa, true, (dist < 0.0f) ? true : false );
}
// NOTE: draw mirror through in mirror show dummy lightmapped texture
@ -1555,11 +1559,13 @@ void R_DrawBrushModel( cl_entity_t *e )
psurf = &clmodel->surfaces[clmodel->firstmodelsurface];
for( i = 0; i < clmodel->nummodelsurfaces; i++, psurf++ )
{
if( R_CullSurface( psurf, NULL, 0 )) // ignore frustum for bmodels
continue;
int result = R_CullSurface( psurf, NULL, 0 ); // ignore frustum for bmodels
if( num_sorted < world.max_surfaces )
world.draw_surfaces[num_sorted++] = psurf;
if(( result == CULL_VISIBLE ) || ( result == CULL_BACKSIDE && psurf->pdecals && e->curstate.rendermode == kRenderTransTexture ))
{
if( num_sorted < world.max_surfaces )
world.draw_surfaces[num_sorted++] = psurf;
}
}
// sort faces if needs

View File

@ -923,10 +923,19 @@ static void Cmd_WriteOpenGLCvar( const char *name, const char *string, const cha
static void Cmd_WriteHelp(const char *name, const char *unused, const char *desc, void *f )
{
if( !desc ) return; // ignore fantom cmds
if( !Q_strcmp( desc, "" )) return; // blank description
if( name[0] == '+' || name[0] == '-' ) return; // key bindings
FS_Printf( f, "%s\t\t\t\"%s\"\n", name, desc );
int length;
if( !desc || !Q_strcmp( desc, "" ))
return; // ignore fantom cmds
if( name[0] == '+' || name[0] == '-' )
return; // key bindings
length = 3 - (Q_strlen( name ) / 10); // Asm_Ed default tab stop is 10
if( length == 3 ) FS_Printf( f, "%s\t\t\t\"%s\"\n", name, desc );
if( length == 2 ) FS_Printf( f, "%s\t\t\"%s\"\n", name, desc );
if( length == 1 ) FS_Printf( f, "%s\t\"%s\"\n", name, desc );
if( length == 0 ) FS_Printf( f, "%s \"%s\"\n", name, desc );
}
void Cmd_WriteOpenGLVariables( file_t *f )

33
engine/engine.plg Normal file
View File

@ -0,0 +1,33 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: engine - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\WINDOWS\TEMP\RSP6457.bat" with contents
[
@echo off
copy \Xash3D\src_main\temp\engine\!release\xash.dll "D:\Xash3D\xash.dll"
copy \Xash3D\src_main\temp\engine\!release\xash.dll "D:\Paranoia2\xash.dll"
copy \Xash3D\src_main\temp\engine\!release\xash.dll "D:\Area51\xash.dll"
copy \Xash3D\src_main\temp\engine\!release\xash.dll "D:\Quake\xash.dll"
]
Creating command line "C:\WINDOWS\TEMP\RSP6457.bat"
<h3>Output Window</h3>
Performing Custom Build Step on \Xash3D\src_main\temp\engine\!release\xash.dll
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.
Žâª § ­® ¢ ¤®áâ㯥.
‘ª®¯¨à®¢ ­® ä ©«®¢: 0.
Error executing c:\windows\system32\cmd.exe.
<h3>Results</h3>
xash.dll - 1 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -2961,6 +2961,9 @@ string_t SV_AllocString( const char *szString )
if( svgame.physFuncs.pfnAllocString != NULL )
return svgame.physFuncs.pfnAllocString( szString );
if( !szString || !*szString )
return 0;
l = Q_strlen( szString ) + 1;
out = out_p = Mem_Alloc( svgame.stringspool, l );

View File

@ -310,23 +310,14 @@ void SV_ActivateServer( void )
// Activate the DLL server code
svgame.dllFuncs.pfnServerActivate( svgame.edicts, svgame.numEntities, svgame.globals->maxClients );
if( sv.loadgame || svgame.globals->changelevel )
{
sv.frametime = 0.001; // change to 0.1 if you want to repair broken trains in SoHL 1.0
numFrames = 1;
}
else if( svs.maxclients <= 1 )
{
if( FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE ))
sv.frametime = 0.1f;
else sv.frametime = 0.8f; // EXPERIMENTAL!!!
numFrames = 2;
}
else
{
sv.frametime = 0.1f;
numFrames = 8;
}
numFrames = (sv.loadgame) ? 1 : 2;
if( !sv.loadgame || svgame.globals->changelevel )
sv.frametime = 0.1f;
// GoldSrc rules
// NOTE: this stuff is breaking sound from func_rotating in multiplayer
// e.g. ambience\boomer.wav on snark_pit.bsp
numFrames *= Q_min( svs.maxclients, 8 );
// run some frames to allow everything to settle
for( i = 0; i < numFrames; i++ )

View File

@ -1585,7 +1585,7 @@ void SV_Physics_Step( edict_t *ent )
wasonmover = SV_CheckMover( ent );
inwater = SV_CheckWater( ent );
if( ent->v.flags & FL_FLOAT && ent->v.waterlevel > 0 )
if( FBitSet( ent->v.flags, FL_FLOAT ) && ent->v.waterlevel > 0 )
{
float buoyancy = SV_Submerged( ent ) * ent->v.skin * sv.frametime;
@ -1597,7 +1597,7 @@ void SV_Physics_Step( edict_t *ent )
{
if( !FBitSet( ent->v.flags, FL_FLY ))
{
if( !FBitSet( ent->v.flags, FL_SWIM ) && ( ent->v.waterlevel > 0 ))
if( !FBitSet( ent->v.flags, FL_SWIM ) || ( ent->v.waterlevel <= 0 ))
{
if( !inwater )
SV_AddGravity( ent );
@ -1609,30 +1609,27 @@ void SV_Physics_Step( edict_t *ent )
{
ent->v.flags &= ~FL_ONGROUND;
if( wasonground || wasonmover )
if(( wasonground || wasonmover ) && ( ent->v.health > 0 || SV_CheckBottom( ent, MOVE_NORMAL )))
{
if(!( ent->v.health <= 0 && !SV_CheckBottom( ent, MOVE_NORMAL )))
float *vel = ent->v.velocity;
float control, speed, newspeed;
float friction;
speed = sqrt(( vel[0] * vel[0] ) + ( vel[1] * vel[1] )); // DotProduct2D
if( speed )
{
float *vel = ent->v.velocity;
float control, speed, newspeed;
float friction;
friction = sv_friction.value * ent->v.friction; // factor
ent->v.friction = 1.0f; // g-cont. ???
if( wasonmover ) friction *= 0.5f; // add a little friction
speed = sqrt(( vel[0] * vel[0] ) + ( vel[1] * vel[1] )); // DotProduct2D
control = (speed < sv_stopspeed.value) ? sv_stopspeed.value : speed;
newspeed = speed - (sv.frametime * control * friction);
if( newspeed < 0 ) newspeed = 0;
newspeed /= speed;
if( speed )
{
friction = sv_friction.value * ent->v.friction; // factor
ent->v.friction = 1.0f; // g-cont. ???
if( wasonmover ) friction *= 0.5f; // add a little friction
control = (speed < sv_stopspeed.value) ? sv_stopspeed.value : speed;
newspeed = speed - (sv.frametime * control * friction);
if( newspeed < 0 ) newspeed = 0;
newspeed /= speed;
vel[0] = vel[0] * newspeed;
vel[1] = vel[1] * newspeed;
}
vel[0] = vel[0] * newspeed;
vel[1] = vel[1] * newspeed;
}
}

16
mainui/mainui.plg Normal file
View File

@ -0,0 +1,16 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: mainui - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
<h3>Results</h3>
menu.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>