mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08:00
Compare commits
61 Commits
continuous
...
continuous
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
15bc09b06b | ||
|
|
315aea1991 | ||
|
|
380422a6dc | ||
|
|
be26ecf1c9 | ||
|
|
d2bbe9dfd2 | ||
|
|
9c929c1405 | ||
|
|
9551240680 | ||
|
|
6605d0456c | ||
|
|
99e8f7b486 | ||
|
|
5ac8f63741 | ||
|
|
9d3949a948 | ||
|
|
5bd1dd34b3 | ||
|
|
6862b14e59 | ||
|
|
dc1d65f621 | ||
|
|
fba3a2b67f | ||
|
|
b946c8455d | ||
|
|
c56e876043 | ||
|
|
9773d11464 | ||
|
|
3c28b11754 | ||
|
|
f2584dcb9d | ||
|
|
ce73838f1b | ||
|
|
49f972a7c9 | ||
|
|
1ae01d89de | ||
|
|
8e54e18c8f | ||
|
|
18136e5320 | ||
|
|
a29f1899d3 | ||
|
|
0f804ffc30 | ||
|
|
620a4b4894 | ||
|
|
4cf87c2c23 | ||
|
|
f031c31b77 | ||
|
|
c2447d8634 | ||
|
|
ae9c1d9f18 | ||
|
|
0132eb6e44 | ||
|
|
f12df54226 | ||
|
|
d971055927 | ||
|
|
6059538d77 | ||
|
|
17deba0606 | ||
|
|
82a2d272ad | ||
|
|
707a9228e1 | ||
|
|
59ddfb787f | ||
|
|
acdf1da995 | ||
|
|
f1cdab91eb | ||
|
|
05d5abe4db | ||
|
|
44e017a410 | ||
|
|
64f3884f23 | ||
|
|
6386782674 | ||
|
|
8084687e50 | ||
|
|
6c16de55c0 | ||
|
|
537237ef62 | ||
|
|
4dfc3f34cb | ||
|
|
d22bbb4213 | ||
|
|
0e3b14e9a5 | ||
|
|
afb0540aa3 | ||
|
|
4d802d8901 | ||
|
|
6a4bf4965f | ||
|
|
a3c9538d12 | ||
|
|
632264809f | ||
|
|
bcfabbe802 | ||
|
|
c244cfc937 | ||
|
|
520fc33394 | ||
|
|
f705a7cd26 |
21
.cirrus.yml
21
.cirrus.yml
@@ -1,14 +1,15 @@
|
||||
task:
|
||||
name: freebsd-12-amd64
|
||||
freebsd_instance:
|
||||
image_family: freebsd-12-4
|
||||
setup_script:
|
||||
- pkg update
|
||||
- pkg install -y pkgconf git sdl2 python fontconfig opus
|
||||
- git submodule update --init --recursive
|
||||
test_script:
|
||||
- ./scripts/cirrus/build_freebsd.sh dedicated
|
||||
- ./scripts/cirrus/build_freebsd.sh full
|
||||
# Seems packages for it were removed from the mirrors
|
||||
# name: freebsd-12-amd64
|
||||
# freebsd_instance:
|
||||
# image_family: freebsd-12-4
|
||||
# setup_script:
|
||||
# - pkg update
|
||||
# - pkg install -y pkgconf git sdl2 python fontconfig opus
|
||||
# - git submodule update --init --recursive
|
||||
# test_script:
|
||||
# - ./scripts/cirrus/build_freebsd.sh dedicated
|
||||
# - ./scripts/cirrus/build_freebsd.sh full
|
||||
|
||||
task:
|
||||
name: freebsd-13-amd64
|
||||
|
||||
@@ -27,6 +27,8 @@ GNU General Public License for more details.
|
||||
#define ENGINE_COMPUTE_STUDIO_LERP (1<<7) // enable MOVETYPE_STEP lerping back in engine
|
||||
#define ENGINE_LINEAR_GAMMA_SPACE (1<<8) // disable influence of gamma/brightness cvars to textures/lightmaps, for mods with custom renderer
|
||||
|
||||
#define ENGINE_STEP_POSHISTORY_LERP (1U<<31) // enable MOVETYPE_STEP interpolation based on position history. Incompatible with ENGINE_COMPUTE_STUDIO_LERP!
|
||||
|
||||
// adjust the mask when features will be added or removed
|
||||
#define ENGINE_FEATURES_MASK \
|
||||
( ENGINE_WRITE_LARGE_COORD \
|
||||
@@ -37,6 +39,7 @@ GNU General Public License for more details.
|
||||
| ENGINE_COMPENSATE_QUAKE_BUG \
|
||||
| ENGINE_IMPROVED_LINETRACE \
|
||||
| ENGINE_COMPUTE_STUDIO_LERP \
|
||||
| ENGINE_LINEAR_GAMMA_SPACE )
|
||||
| ENGINE_LINEAR_GAMMA_SPACE \
|
||||
| ENGINE_STEP_POSHISTORY_LERP )
|
||||
|
||||
#endif//FEATURES_H
|
||||
|
||||
@@ -121,10 +121,15 @@ typedef uint64_t longtime_t;
|
||||
#define likely(x) (x)
|
||||
#endif
|
||||
|
||||
#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L // C11 static_assert
|
||||
#define STATIC_ASSERT static_assert
|
||||
#if __STDC_VERSION >= 202311L || __cplusplus >= 201103L // C23 or C++ static_assert is a keyword
|
||||
#define STATIC_ASSERT_ static_assert
|
||||
#define STATIC_ASSERT static_assert
|
||||
#elif __STDC_VERSION >= 201112L // in C11 it's _Static_assert
|
||||
#define STATIC_ASSERT_ _Static_assert
|
||||
#define STATIC_ASSERT _Static_assert
|
||||
#else
|
||||
#define STATIC_ASSERT( x, y ) extern int _static_assert_##__LINE__[( x ) ? 1 : -1]
|
||||
#define STATIC_ASSERT_( id, x, y ) extern int id[( x ) ? 1 : -1]
|
||||
#define STATIC_ASSERT( x, y ) STATIC_ASSERT_( static_assert_##__LINE__, x, y )
|
||||
#endif
|
||||
|
||||
#ifdef XASH_BIG_ENDIAN
|
||||
|
||||
@@ -570,6 +570,9 @@ void CL_ReadDemoUserCmd( qboolean discard )
|
||||
memset( &nullcmd, 0, sizeof( nullcmd ));
|
||||
MSG_Init( &buf, "UserCmd", data, sizeof( data ));
|
||||
|
||||
// a1ba: I have no proper explanation why
|
||||
cmdnumber++;
|
||||
|
||||
pcmd = &cl.commands[cmdnumber & CL_UPDATE_MASK];
|
||||
pcmd->processedfuncs = false;
|
||||
pcmd->senttime = 0.0f;
|
||||
|
||||
@@ -175,7 +175,7 @@ particle_t * GAME_EXPORT R_AllocParticle( void (*callback)( particle_t*, float )
|
||||
return NULL;
|
||||
|
||||
// never alloc particles when we not in game
|
||||
// if( tr.frametime == 0.0 ) return NULL;
|
||||
if( cl_clientframetime() == 0.0 ) return NULL;
|
||||
|
||||
if( !cl_free_particles )
|
||||
{
|
||||
@@ -226,7 +226,7 @@ particle_t *R_AllocTracer( const vec3_t org, const vec3_t vel, float life )
|
||||
return NULL;
|
||||
|
||||
// never alloc particles when we not in game
|
||||
//if( tr.frametime == 0.0 ) return NULL;
|
||||
if( cl_clientframetime() == 0.0 ) return NULL;
|
||||
|
||||
if( !cl_free_particles )
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ GNU General Public License for more details.
|
||||
#include "sound.h"
|
||||
#include "input.h"
|
||||
|
||||
#define STUDIO_INTERPOLATION_FIX
|
||||
// #define STUDIO_INTERPOLATION_FIX
|
||||
|
||||
/*
|
||||
==================
|
||||
@@ -54,17 +54,28 @@ Store another position into interpolation circular buffer
|
||||
*/
|
||||
void CL_UpdatePositions( cl_entity_t *ent )
|
||||
{
|
||||
position_history_t *ph;
|
||||
position_history_t *ph, *prev;
|
||||
|
||||
prev = &ent->ph[ent->current_position];
|
||||
|
||||
ent->current_position = (ent->current_position + 1) & HISTORY_MASK;
|
||||
ph = &ent->ph[ent->current_position];
|
||||
VectorCopy( ent->curstate.origin, ph->origin );
|
||||
VectorCopy( ent->curstate.angles, ph->angles );
|
||||
|
||||
if( ent->model && ent->model->type == mod_brush )
|
||||
ph->animtime = ent->curstate.animtime;
|
||||
else
|
||||
ph->animtime = cl.time;
|
||||
ph->animtime = ent->curstate.animtime;
|
||||
|
||||
// a1ba: for some reason, this sometimes still may happen
|
||||
// at this time, I'm not sure whether this bug happens in delta readwrite code
|
||||
// or server just decides to go backwards and really sends these values
|
||||
if( ph->animtime < prev->animtime )
|
||||
{
|
||||
// try to deduce real animtime by looking up the difference between
|
||||
// server messages (cl.mtime is never modified ny the interpolation code)
|
||||
float diff = Q_max( 0, ent->curstate.msg_time - ent->prevstate.msg_time );
|
||||
|
||||
ph->animtime = prev->animtime + diff;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -159,6 +170,13 @@ qboolean CL_EntityCustomLerp( cl_entity_t *e )
|
||||
case MOVETYPE_FLY:
|
||||
case MOVETYPE_COMPOUND:
|
||||
return false;
|
||||
|
||||
// ABSOLUTELY STUPID HACK TO ALLOW MONSTERS
|
||||
// INTERPOLATION IN GRAVGUNMOD COOP
|
||||
// MUST BE REMOVED ONCE WE REMOVE 48 PROTO SUPPORT
|
||||
case MOVETYPE_TOSS:
|
||||
if( cls.legacymode && e->model && e->model->type == mod_studio )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -171,7 +189,7 @@ CL_ParametricMove
|
||||
check for parametrical moved entities
|
||||
==================
|
||||
*/
|
||||
qboolean CL_ParametricMove( cl_entity_t *ent )
|
||||
static qboolean CL_ParametricMove( cl_entity_t *ent )
|
||||
{
|
||||
float frac, dt, t;
|
||||
vec3_t delta;
|
||||
@@ -349,11 +367,10 @@ CL_FindInterpolationUpdates
|
||||
find two timestamps
|
||||
==================
|
||||
*/
|
||||
qboolean CL_FindInterpolationUpdates( cl_entity_t *ent, float targettime, position_history_t **ph0, position_history_t **ph1 )
|
||||
static qboolean CL_FindInterpolationUpdates( cl_entity_t *ent, double targettime, position_history_t **ph0, position_history_t **ph1 )
|
||||
{
|
||||
qboolean extrapolate = true;
|
||||
uint i, i0, i1, imod;
|
||||
float at;
|
||||
|
||||
imod = ent->current_position;
|
||||
i0 = (imod - 0) & HISTORY_MASK; // curpos (lerp end)
|
||||
@@ -361,8 +378,10 @@ qboolean CL_FindInterpolationUpdates( cl_entity_t *ent, float targettime, positi
|
||||
|
||||
for( i = 1; i < HISTORY_MAX - 1; i++ )
|
||||
{
|
||||
at = ent->ph[( imod - i ) & HISTORY_MASK].animtime;
|
||||
if( at == 0.0f ) break;
|
||||
double at = ent->ph[( imod - i ) & HISTORY_MASK].animtime;
|
||||
|
||||
if( at == 0.0f )
|
||||
break;
|
||||
|
||||
if( targettime > at )
|
||||
{
|
||||
@@ -387,15 +406,14 @@ CL_PureOrigin
|
||||
non-local players interpolation
|
||||
==================
|
||||
*/
|
||||
void CL_PureOrigin( cl_entity_t *ent, float t, vec3_t outorigin, vec3_t outangles )
|
||||
static void CL_PureOrigin( cl_entity_t *ent, double t, vec3_t outorigin, vec3_t outangles )
|
||||
{
|
||||
qboolean extrapolate;
|
||||
float t1, t0, frac;
|
||||
double t1, t0, frac;
|
||||
position_history_t *ph0, *ph1;
|
||||
vec3_t delta;
|
||||
|
||||
// NOTE: ph0 is next, ph1 is a prev
|
||||
extrapolate = CL_FindInterpolationUpdates( ent, t, &ph0, &ph1 );
|
||||
CL_FindInterpolationUpdates( ent, t, &ph0, &ph1 );
|
||||
|
||||
if ( !ph0 || !ph1 )
|
||||
return;
|
||||
@@ -403,7 +421,7 @@ void CL_PureOrigin( cl_entity_t *ent, float t, vec3_t outorigin, vec3_t outangle
|
||||
t0 = ph0->animtime;
|
||||
t1 = ph1->animtime;
|
||||
|
||||
if( t0 != 0.0f )
|
||||
if( t0 != 0.0 )
|
||||
{
|
||||
vec4_t q, q1, q2;
|
||||
|
||||
@@ -411,9 +429,9 @@ void CL_PureOrigin( cl_entity_t *ent, float t, vec3_t outorigin, vec3_t outangle
|
||||
|
||||
if( !Q_equal( t0, t1 ))
|
||||
frac = ( t - t1 ) / ( t0 - t1 );
|
||||
else frac = 1.0f;
|
||||
else frac = 1.0;
|
||||
|
||||
frac = bound( 0.0f, frac, 1.2f );
|
||||
frac = bound( 0.0, frac, 1.2 );
|
||||
|
||||
VectorMA( ph1->origin, frac, delta, outorigin );
|
||||
|
||||
@@ -437,11 +455,11 @@ CL_InterpolateModel
|
||||
non-players interpolation
|
||||
==================
|
||||
*/
|
||||
int CL_InterpolateModel( cl_entity_t *e )
|
||||
static int CL_InterpolateModel( cl_entity_t *e )
|
||||
{
|
||||
position_history_t *ph0 = NULL, *ph1 = NULL;
|
||||
vec3_t origin, angles, delta;
|
||||
float t, t1, t2, frac;
|
||||
double t, t1, t2, frac;
|
||||
vec4_t q, q1, q2;
|
||||
|
||||
VectorCopy( e->curstate.origin, e->origin );
|
||||
@@ -489,9 +507,7 @@ int CL_InterpolateModel( cl_entity_t *e )
|
||||
return 0;
|
||||
}
|
||||
|
||||
// HACKHACK: workaround buggy position history animtime
|
||||
// going backward sometimes
|
||||
if( Q_equal( t2, t1 ) || t2 < t1 )
|
||||
if( Q_equal( t2, t1 ))
|
||||
{
|
||||
VectorCopy( ph0->origin, e->origin );
|
||||
VectorCopy( ph0->angles, e->angles );
|
||||
@@ -529,7 +545,7 @@ interpolate non-local clients
|
||||
*/
|
||||
void CL_ComputePlayerOrigin( cl_entity_t *ent )
|
||||
{
|
||||
float targettime;
|
||||
double targettime;
|
||||
vec4_t q, q1, q2;
|
||||
vec3_t origin;
|
||||
vec3_t angles;
|
||||
@@ -1212,17 +1228,33 @@ void CL_LinkPacketEntities( frame_t *frame )
|
||||
#else
|
||||
if( ent->lastmove >= cl.time )
|
||||
{
|
||||
float at = ent->curstate.animtime;
|
||||
|
||||
CL_ResetLatchedVars( ent, true );
|
||||
|
||||
if( cl_fixmodelinterpolationartifacts.value )
|
||||
ent->latched.prevanimtime = ent->curstate.animtime = at;
|
||||
|
||||
VectorCopy( ent->curstate.origin, ent->latched.prevorigin );
|
||||
VectorCopy( ent->curstate.angles, ent->latched.prevangles );
|
||||
|
||||
// disable step interpolation in client.dll
|
||||
ent->curstate.movetype = MOVETYPE_NONE;
|
||||
if( !FBitSet( host.features, ENGINE_COMPUTE_STUDIO_LERP ))
|
||||
{
|
||||
// disable step interpolation in client.dll
|
||||
ent->curstate.movetype = MOVETYPE_NONE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// restore step interpolation in client.dll
|
||||
ent->curstate.movetype = MOVETYPE_STEP;
|
||||
if( FBitSet( host.features, ENGINE_COMPUTE_STUDIO_LERP ))
|
||||
{
|
||||
interpolate = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// restore step interpolation in client.dll
|
||||
ent->curstate.movetype = MOVETYPE_STEP;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -1247,11 +1279,24 @@ void CL_LinkPacketEntities( frame_t *frame )
|
||||
if ( !CL_InterpolateModel( ent ))
|
||||
continue;
|
||||
}
|
||||
else if( ent->curstate.movetype == MOVETYPE_STEP && !NET_IsLocalAddress( cls.netchan.remote_address ))
|
||||
// a1ba: in GoldSrc this is done for cstrike and czero
|
||||
// but let modders use this as an engine feature
|
||||
else if( FBitSet( host.features, ENGINE_STEP_POSHISTORY_LERP ) &&
|
||||
ent->curstate.movetype == MOVETYPE_STEP && !NET_IsLocalAddress( cls.netchan.remote_address ))
|
||||
{
|
||||
if( !CL_InterpolateModel( ent ))
|
||||
continue;
|
||||
}
|
||||
#if 0
|
||||
// ABSOLUTELY STUPID HACK TO ALLOW MONSTERS
|
||||
// INTERPOLATION IN GRAVGUNMOD COOP
|
||||
// MUST BE REMOVED ONCE WE REMOVE 48 PROTO SUPPORT
|
||||
else if( cls.legacymode && ent->model->type == mod_studio && ent->curstate.movetype == MOVETYPE_TOSS )
|
||||
{
|
||||
if( !CL_InterpolateModel( ent ))
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
// no interpolation right now
|
||||
|
||||
@@ -78,6 +78,8 @@ CVAR_DEFINE_AUTO( cl_trace_events, "0", FCVAR_ARCHIVE|FCVAR_CHEAT, "enable event
|
||||
static CVAR_DEFINE_AUTO( cl_nat, "0", 0, "show servers running under NAT" );
|
||||
CVAR_DEFINE_AUTO( hud_utf8, "0", FCVAR_ARCHIVE, "Use utf-8 encoding for hud text" );
|
||||
CVAR_DEFINE_AUTO( ui_renderworld, "0", FCVAR_ARCHIVE, "render world when UI is visible" );
|
||||
static CVAR_DEFINE_AUTO( cl_maxframetime, "0", 0, "set deadline timer for client rendering to catch freezes" );
|
||||
CVAR_DEFINE_AUTO( cl_fixmodelinterpolationartifacts, "1", 0, "try to fix up models interpolation on a moving platforms (monsters on trains for example)" );
|
||||
|
||||
//
|
||||
// userinfo
|
||||
@@ -87,7 +89,6 @@ static CVAR_DEFINE_AUTO( model, "", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABL
|
||||
static CVAR_DEFINE_AUTO( topcolor, "0", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABLE, "player top color" );
|
||||
static CVAR_DEFINE_AUTO( bottomcolor, "0", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABLE, "player bottom color" );
|
||||
CVAR_DEFINE_AUTO( rate, "3500", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABLE, "player network rate" );
|
||||
static CVAR_DEFINE_AUTO( cl_maxframetime, "0", 0, "set deadline timer for client rendering to catch freezes" );
|
||||
|
||||
client_t cl;
|
||||
client_static_t cls;
|
||||
@@ -606,10 +607,10 @@ void CL_CreateCmd( void )
|
||||
// message we are constructing.
|
||||
i = cls.netchan.outgoing_sequence & CL_UPDATE_MASK;
|
||||
pcmd = &cl.commands[i];
|
||||
pcmd->processedfuncs = false;
|
||||
|
||||
if( !cls.demoplayback )
|
||||
{
|
||||
pcmd->processedfuncs = false;
|
||||
pcmd->senttime = host.realtime;
|
||||
memset( &pcmd->cmd, 0, sizeof( pcmd->cmd ));
|
||||
pcmd->receivedtime = -1.0;
|
||||
@@ -2919,6 +2920,7 @@ void CL_InitLocal( void )
|
||||
Cvar_Get( "lastdemo", "", FCVAR_ARCHIVE, "last played demo" );
|
||||
Cvar_RegisterVariable( &ui_renderworld );
|
||||
Cvar_RegisterVariable( &cl_maxframetime );
|
||||
Cvar_RegisterVariable( &cl_fixmodelinterpolationartifacts );
|
||||
|
||||
// these two added to shut up CS 1.5 about 'unknown' commands
|
||||
Cvar_Get( "lightgamma", "1", FCVAR_ARCHIVE, "ambient lighting level (legacy, unused)" );
|
||||
|
||||
@@ -903,11 +903,7 @@ void CL_ParseServerData( sizebuf_t *msg, qboolean legacy )
|
||||
Q_strncpy( clgame.maptitle, MSG_ReadString( msg ), sizeof( clgame.maptitle ));
|
||||
background = MSG_ReadOneBit( msg );
|
||||
Q_strncpy( gamefolder, MSG_ReadString( msg ), sizeof( gamefolder ));
|
||||
host.features = (uint)MSG_ReadLong( msg );
|
||||
host.features &= legacy ? ENGINE_LEGACY_FEATURES_MASK : ENGINE_FEATURES_MASK;
|
||||
|
||||
if( !Host_IsLocalGame( ))
|
||||
Host_PrintEngineFeatures( host.features );
|
||||
Host_ValidateEngineFeatures( MSG_ReadDword( msg ));
|
||||
|
||||
if( !legacy )
|
||||
{
|
||||
@@ -1642,9 +1638,6 @@ void CL_RegisterResources( sizebuf_t *msg )
|
||||
|
||||
CL_ClearWorld ();
|
||||
|
||||
// update the ref state.
|
||||
R_UpdateRefState ();
|
||||
|
||||
// tell rendering system we have a new set of models.
|
||||
ref.dllFuncs.R_NewMap ();
|
||||
|
||||
|
||||
@@ -660,9 +660,6 @@ void CL_LegacyPrecache_f( void )
|
||||
if( clgame.entities )
|
||||
clgame.entities->model = cl.worldmodel;
|
||||
|
||||
// update the ref state.
|
||||
R_UpdateRefState ();
|
||||
|
||||
// tell rendering system we have a new set of models.
|
||||
ref.dllFuncs.R_NewMap ();
|
||||
|
||||
|
||||
@@ -824,6 +824,27 @@ static void CL_SetupPMove( playermove_t *pmove, const local_state_t *from, const
|
||||
cd = &from->client;
|
||||
|
||||
pmove->player_index = ps->number - 1;
|
||||
|
||||
// a1ba: workaround bug on old protocol where the server refuse to send
|
||||
// our local player in delta. cl.playernum, in theory, must be equal
|
||||
// to our local player index anyway
|
||||
// this might not be a real solution, since everything else will be bogus
|
||||
// but we need to properly run prediction and avoid potential memory
|
||||
// corruption
|
||||
// either debug this, or remove when old protocol will be dropped!!!
|
||||
if( pmove->player_index < 0 )
|
||||
{
|
||||
if( cls.legacymode )
|
||||
{
|
||||
pmove->player_index = bound( 0, cl.playernum, cl.maxclients - 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
// if this happens, record a demo and send it to a1ba
|
||||
Host_Error( "%s: ps->number == %d\n", __func__, ps->number );
|
||||
}
|
||||
}
|
||||
|
||||
pmove->multiplayer = (cl.maxclients > 1);
|
||||
pmove->runfuncs = runfuncs;
|
||||
pmove->time = time * 1000.0f;
|
||||
|
||||
@@ -142,8 +142,6 @@ intptr_t CL_RenderGetParm( const int parm, const int arg, const qboolean checkRe
|
||||
return 1;
|
||||
#endif
|
||||
return 0;
|
||||
case PARM_SKY_SPHERE:
|
||||
return FBitSet( world.flags, FWORLD_SKYSPHERE ) && !FBitSet( world.flags, FWORLD_CUSTOM_SKYBOX );
|
||||
case PARAM_GAMEPAUSED:
|
||||
return cl.paused;
|
||||
case PARM_CLIENT_INGAME:
|
||||
@@ -187,28 +185,30 @@ intptr_t CL_RenderGetParm( const int parm, const int arg, const qboolean checkRe
|
||||
return CL_IsThirdPerson();
|
||||
case PARM_QUAKE_COMPATIBLE:
|
||||
return Host_IsQuakeCompatible();
|
||||
case PARM_PLAYER_INDEX:
|
||||
return cl.playernum + 1;
|
||||
case PARM_VIEWENT_INDEX:
|
||||
return cl.viewentity;
|
||||
case PARM_CONNSTATE:
|
||||
return (int)cls.state;
|
||||
case PARM_PLAYING_DEMO:
|
||||
return cls.demoplayback;
|
||||
case PARM_WATER_LEVEL:
|
||||
return cl.local.waterlevel;
|
||||
case PARM_MAX_CLIENTS:
|
||||
return cl.maxclients;
|
||||
case PARM_LOCAL_HEALTH:
|
||||
return cl.local.health;
|
||||
case PARM_LOCAL_GAME:
|
||||
return Host_IsLocalGame();
|
||||
case PARM_NUMENTITIES:
|
||||
return pfnNumberOfEntities();
|
||||
case PARM_NUMMODELS:
|
||||
return cl.nummodels;
|
||||
case PARM_WORLD_VERSION:
|
||||
return world.version;
|
||||
case PARM_GET_CLIENT_PTR:
|
||||
return (intptr_t)&cl.time; // with the offset
|
||||
case PARM_GET_HOST_PTR:
|
||||
return (intptr_t)&host.realtime; // with the offset
|
||||
case PARM_GET_WORLD_PTR:
|
||||
return (intptr_t)&world;
|
||||
case PARM_GET_MOVEVARS_PTR:
|
||||
return (intptr_t)&clgame.movevars;
|
||||
case PARM_GET_PALETTE_PTR:
|
||||
return (intptr_t)&clgame.palette;
|
||||
case PARM_GET_VIEWENT_PTR:
|
||||
return (intptr_t)&clgame.viewent;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -2624,7 +2624,7 @@ CL_UpdateFlashlight
|
||||
update client flashlight
|
||||
================
|
||||
*/
|
||||
void CL_UpdateFlashlight( cl_entity_t *ent )
|
||||
static void CL_UpdateFlashlight( cl_entity_t *ent )
|
||||
{
|
||||
vec3_t forward, view_ofs;
|
||||
vec3_t vecSrc, vecEnd;
|
||||
@@ -2684,6 +2684,41 @@ void CL_UpdateFlashlight( cl_entity_t *ent )
|
||||
dl->radius = 80;
|
||||
}
|
||||
|
||||
static void R_EntityDimlight( cl_entity_t *ent, int key )
|
||||
{
|
||||
dlight_t *dl = CL_AllocDlight( key );
|
||||
|
||||
VectorCopy( ent->origin, dl->origin );
|
||||
dl->color.r = dl->color.g = dl->color.b = 100;
|
||||
dl->radius = COM_RandomFloat( 200.0f, 231.0f );
|
||||
dl->die = cl.time + 0.001;
|
||||
}
|
||||
|
||||
static void R_EntityLight( cl_entity_t *ent, int key )
|
||||
{
|
||||
dlight_t *dl = CL_AllocDlight( key );
|
||||
|
||||
VectorCopy( ent->origin, dl->origin );
|
||||
dl->color.r = dl->color.g = dl->color.b = 100;
|
||||
dl->radius = 200;
|
||||
dl->die = cl.time + 0.001;
|
||||
|
||||
R_RocketFlare( ent->origin );
|
||||
}
|
||||
|
||||
static void R_EntityBrightlight( cl_entity_t *ent, int key, int radius )
|
||||
{
|
||||
dlight_t *dl = CL_AllocDlight( key );
|
||||
|
||||
VectorCopy( ent->origin, dl->origin );
|
||||
dl->origin[2] += 16.0f;
|
||||
dl->color.r = dl->color.g = dl->color.b = 250;
|
||||
if( !radius )
|
||||
dl->radius = COM_RandomFloat( 400.0f, 431.0f );
|
||||
else dl->radius = 400;
|
||||
dl->die = cl.time + 0.001;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
CL_AddEntityEffects
|
||||
@@ -2693,50 +2728,41 @@ apply various effects to entity origin or attachment
|
||||
*/
|
||||
void CL_AddEntityEffects( cl_entity_t *ent )
|
||||
{
|
||||
// yellow flies effect 'monster stuck in the wall'
|
||||
if( FBitSet( ent->curstate.effects, EF_BRIGHTFIELD ) && !RP_LOCALCLIENT( ent ))
|
||||
R_EntityParticles( ent );
|
||||
|
||||
if( FBitSet( ent->curstate.effects, EF_DIMLIGHT ))
|
||||
// players have special set of effects, from CL_LinkPlayers
|
||||
if( ent->player && ent->index != cl.viewentity )
|
||||
{
|
||||
if( ent->player && !Host_IsQuakeCompatible( ))
|
||||
{
|
||||
if( FBitSet( ent->curstate.effects, EF_BRIGHTLIGHT ))
|
||||
R_EntityBrightlight( ent, ent->index /* 4 in GoldSrc */, 0 );
|
||||
|
||||
if( FBitSet( ent->curstate.effects, EF_DIMLIGHT ))
|
||||
R_EntityDimlight( ent, ent->index /* 4 in GoldSrc */ );
|
||||
}
|
||||
else if( RP_LOCALCLIENT( ent ))
|
||||
{
|
||||
// from CL_PlayerFlashlight
|
||||
if( FBitSet( ent->curstate.effects, EF_BRIGHTLIGHT ))
|
||||
R_EntityBrightlight( ent, ent->index /* 1 in GoldSrc */, 400 );
|
||||
else if( FBitSet( ent->curstate.effects, EF_DIMLIGHT ))
|
||||
CL_UpdateFlashlight( ent );
|
||||
}
|
||||
else
|
||||
{
|
||||
dlight_t *dl = CL_AllocDlight( ent->index );
|
||||
dl->color.r = dl->color.g = dl->color.b = 100;
|
||||
dl->radius = COM_RandomFloat( 200, 231 );
|
||||
VectorCopy( ent->origin, dl->origin );
|
||||
dl->die = cl.time + 0.001;
|
||||
}
|
||||
}
|
||||
|
||||
if( FBitSet( ent->curstate.effects, EF_BRIGHTLIGHT ))
|
||||
else
|
||||
{
|
||||
dlight_t *dl = CL_AllocDlight( ent->index );
|
||||
dl->color.r = dl->color.g = dl->color.b = 250;
|
||||
if( ent->player ) dl->radius = 400; // don't flickering
|
||||
else dl->radius = COM_RandomFloat( 400, 431 );
|
||||
VectorCopy( ent->origin, dl->origin );
|
||||
dl->die = cl.time + 0.001;
|
||||
dl->origin[2] += 16.0f;
|
||||
}
|
||||
// from CL_LinkPacketEntities
|
||||
if( FBitSet( ent->curstate.effects, EF_BRIGHTFIELD ))
|
||||
R_EntityParticles( ent );
|
||||
|
||||
// add light effect
|
||||
if( FBitSet( ent->curstate.effects, EF_LIGHT ))
|
||||
{
|
||||
dlight_t *dl = CL_AllocDlight( ent->index );
|
||||
dl->color.r = dl->color.g = dl->color.b = 100;
|
||||
VectorCopy( ent->origin, dl->origin );
|
||||
R_RocketFlare( ent->origin );
|
||||
dl->die = cl.time + 0.001;
|
||||
dl->radius = 200;
|
||||
if( FBitSet( ent->curstate.effects, EF_BRIGHTLIGHT ))
|
||||
R_EntityBrightlight( ent, ent->index, 0 );
|
||||
|
||||
if( FBitSet( ent->curstate.effects, EF_DIMLIGHT ))
|
||||
R_EntityDimlight( ent, ent->index );
|
||||
|
||||
if( FBitSet( ent->curstate.effects, EF_LIGHT ))
|
||||
R_EntityLight( ent, ent->curstate.number );
|
||||
}
|
||||
|
||||
// studio models are handle muzzleflashes difference
|
||||
if( FBitSet( ent->curstate.effects, EF_MUZZLEFLASH ) && Mod_AliasExtradata( ent->model ))
|
||||
if( FBitSet( ent->curstate.effects, EF_MUZZLEFLASH ) && ent->model && ent->model->type == mod_alias )
|
||||
{
|
||||
dlight_t *dl = CL_AllocDlight( ent->index );
|
||||
vec3_t fv;
|
||||
@@ -2765,15 +2791,11 @@ void CL_AddModelEffects( cl_entity_t *ent )
|
||||
vec3_t neworigin;
|
||||
vec3_t oldorigin;
|
||||
|
||||
if( !ent->model ) return;
|
||||
if( !ent->model || ent->player )
|
||||
return;
|
||||
|
||||
switch( ent->model->type )
|
||||
{
|
||||
case mod_alias:
|
||||
case mod_studio:
|
||||
break;
|
||||
default: return;
|
||||
}
|
||||
if( ent->model->type != mod_alias && ent->model->type != mod_studio )
|
||||
return;
|
||||
|
||||
if( cls.demoplayback == DEMO_QUAKE1 )
|
||||
{
|
||||
@@ -2793,19 +2815,15 @@ void CL_AddModelEffects( cl_entity_t *ent )
|
||||
|
||||
if( FBitSet( ent->model->flags, STUDIO_GIB ))
|
||||
R_RocketTrail( oldorigin, neworigin, 2 );
|
||||
|
||||
if( FBitSet( ent->model->flags, STUDIO_ZOMGIB ))
|
||||
else if( FBitSet( ent->model->flags, STUDIO_ZOMGIB ))
|
||||
R_RocketTrail( oldorigin, neworigin, 4 );
|
||||
|
||||
if( FBitSet( ent->model->flags, STUDIO_TRACER ))
|
||||
else if( FBitSet( ent->model->flags, STUDIO_TRACER ))
|
||||
R_RocketTrail( oldorigin, neworigin, 3 );
|
||||
|
||||
if( FBitSet( ent->model->flags, STUDIO_TRACER2 ))
|
||||
else if( FBitSet( ent->model->flags, STUDIO_TRACER2 ))
|
||||
R_RocketTrail( oldorigin, neworigin, 5 );
|
||||
|
||||
if( FBitSet( ent->model->flags, STUDIO_ROCKET ))
|
||||
else if( FBitSet( ent->model->flags, STUDIO_ROCKET ))
|
||||
{
|
||||
dlight_t *dl = CL_AllocDlight( ent->index );
|
||||
dlight_t *dl = CL_AllocDlight( ent->curstate.number );
|
||||
|
||||
dl->color.r = dl->color.g = dl->color.b = 200;
|
||||
VectorCopy( ent->origin, dl->origin );
|
||||
@@ -2819,11 +2837,9 @@ void CL_AddModelEffects( cl_entity_t *ent )
|
||||
|
||||
R_RocketTrail( oldorigin, neworigin, 0 );
|
||||
}
|
||||
|
||||
if( FBitSet( ent->model->flags, STUDIO_GRENADE ))
|
||||
else if( FBitSet( ent->model->flags, STUDIO_GRENADE ))
|
||||
R_RocketTrail( oldorigin, neworigin, 1 );
|
||||
|
||||
if( FBitSet( ent->model->flags, STUDIO_TRACER3 ))
|
||||
else if( FBitSet( ent->model->flags, STUDIO_TRACER3 ))
|
||||
R_RocketTrail( oldorigin, neworigin, 6 );
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,6 @@ void R_DebugParticle( const vec3_t pos, byte r, byte g, byte b );
|
||||
void R_RicochetSound( const vec3_t pos );
|
||||
struct dlight_s *CL_AllocDlight( int key );
|
||||
struct dlight_s *CL_AllocElight( int key );
|
||||
void CL_UpdateFlashlight( cl_entity_t *pEnt );
|
||||
void CL_AddEntityEffects( cl_entity_t *ent );
|
||||
void CL_AddModelEffects( cl_entity_t *ent );
|
||||
void CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags );
|
||||
|
||||
@@ -174,6 +174,26 @@ typedef struct
|
||||
// at every server map change
|
||||
typedef struct
|
||||
{
|
||||
// ==== shared through RefAPI's ref_client_t ====
|
||||
double time; // this is the time value that the client
|
||||
// is rendering at. always <= cls.realtime
|
||||
// a lerp point for other data
|
||||
double oldtime; // previous cl.time, time-oldtime is used
|
||||
// to decay light values and smooth step ups
|
||||
int viewentity;
|
||||
|
||||
// server state information
|
||||
int playernum;
|
||||
int maxclients;
|
||||
|
||||
int nummodels;
|
||||
model_t *models[MAX_MODELS+1]; // precached models (plus sentinel slot)
|
||||
|
||||
qboolean paused;
|
||||
|
||||
vec3_t simorg; // predicted origin
|
||||
// ==== shared through RefAPI's ref_client_t ===
|
||||
|
||||
int servercount; // server identification for prespawns
|
||||
int validsequence; // this is the sequence number of the last good
|
||||
// world snapshot/update we got. If this is 0, we can't
|
||||
@@ -183,7 +203,6 @@ typedef struct
|
||||
|
||||
qboolean video_prepped; // false if on new level or new ref dll
|
||||
qboolean audio_prepped; // false if on new level or new snd dll
|
||||
qboolean paused;
|
||||
|
||||
int delta_sequence; // acknowledged sequence number
|
||||
|
||||
@@ -205,11 +224,6 @@ typedef struct
|
||||
runcmd_t commands[MULTIPLAYER_BACKUP]; // each mesage will send several old cmds
|
||||
local_state_t predicted_frames[MULTIPLAYER_BACKUP]; // local client state
|
||||
|
||||
double time; // this is the time value that the client
|
||||
// is rendering at. always <= cls.realtime
|
||||
// a lerp point for other data
|
||||
double oldtime; // previous cl.time, time-oldtime is used
|
||||
// to decay light values and smooth step ups
|
||||
double timedelta; // floating delta between two updates
|
||||
|
||||
char serverinfo[MAX_SERVERINFO_STRING];
|
||||
@@ -223,7 +237,6 @@ typedef struct
|
||||
|
||||
// player final info
|
||||
usercmd_t *cmd; // cl.commands[outgoing_sequence].cmd
|
||||
int viewentity;
|
||||
vec3_t viewangles;
|
||||
vec3_t viewheight;
|
||||
vec3_t punchangle;
|
||||
@@ -236,14 +249,9 @@ typedef struct
|
||||
float addangletotal;
|
||||
float prevaddangletotal;
|
||||
|
||||
// predicted origin and velocity
|
||||
vec3_t simorg;
|
||||
// predicted velocity
|
||||
vec3_t simvel;
|
||||
|
||||
// server state information
|
||||
int playernum;
|
||||
int maxclients;
|
||||
|
||||
entity_state_t instanced_baseline[MAX_CUSTOM_BASELINES];
|
||||
int instanced_baseline_count;
|
||||
|
||||
@@ -251,8 +259,6 @@ typedef struct
|
||||
char event_precache[MAX_EVENTS][MAX_QPATH];
|
||||
char files_precache[MAX_CUSTOM][MAX_QPATH];
|
||||
lightstyle_t lightstyles[MAX_LIGHTSTYLES];
|
||||
model_t *models[MAX_MODELS+1]; // precached models (plus sentinel slot)
|
||||
int nummodels;
|
||||
int numfiles;
|
||||
|
||||
consistency_t consistency_list[MAX_MODELS];
|
||||
@@ -694,6 +700,7 @@ extern convar_t rate;
|
||||
extern convar_t m_ignore;
|
||||
extern convar_t r_showtree;
|
||||
extern convar_t ui_renderworld;
|
||||
extern convar_t cl_fixmodelinterpolationartifacts;
|
||||
|
||||
//=============================================================================
|
||||
|
||||
|
||||
@@ -18,6 +18,31 @@ CVAR_DEFINE_AUTO( r_showtree, "0", FCVAR_ARCHIVE, "build the graph of visible BS
|
||||
static CVAR_DEFINE_AUTO( r_refdll, "", FCVAR_RENDERINFO, "choose renderer implementation, if supported" );
|
||||
static CVAR_DEFINE_AUTO( r_refdll_loaded, "", FCVAR_READ_ONLY, "currently loaded renderer" );
|
||||
|
||||
// there is no need to expose whole host and cl structs into the renderer
|
||||
// but we still need to update timings accurately as possible
|
||||
// this looks horrible but the only other option would be passing four
|
||||
// time pointers and then it's looks even worse with dereferences everywhere
|
||||
#define STATIC_OFFSET_CHECK( s1, s2, field, base, msg ) \
|
||||
STATIC_ASSERT( offsetof( s1, field ) == offsetof( s2, field ) - offsetof( s2, base ), msg )
|
||||
#define REF_CLIENT_CHECK( field ) \
|
||||
STATIC_OFFSET_CHECK( ref_client_t, client_t, field, time, "broken ref_client_t offset" ); \
|
||||
STATIC_ASSERT_( szchk_##__LINE__, sizeof(((ref_client_t *)0)->field ) == sizeof( cl.field ), "broken ref_client_t size" )
|
||||
#define REF_HOST_CHECK( field ) \
|
||||
STATIC_OFFSET_CHECK( ref_host_t, host_parm_t, field, realtime, "broken ref_client_t offset" ); \
|
||||
STATIC_ASSERT_( szchk_##__LINE__, sizeof(((ref_host_t *)0)->field ) == sizeof( host.field ), "broken ref_client_t size" )
|
||||
|
||||
REF_CLIENT_CHECK( time );
|
||||
REF_CLIENT_CHECK( oldtime );
|
||||
REF_CLIENT_CHECK( viewentity );
|
||||
REF_CLIENT_CHECK( playernum );
|
||||
REF_CLIENT_CHECK( maxclients );
|
||||
REF_CLIENT_CHECK( models );
|
||||
REF_CLIENT_CHECK( paused );
|
||||
REF_CLIENT_CHECK( simorg );
|
||||
REF_HOST_CHECK( realtime );
|
||||
REF_HOST_CHECK( frametime );
|
||||
REF_HOST_CHECK( features );
|
||||
|
||||
void R_GetTextureParms( int *w, int *h, int texnum )
|
||||
{
|
||||
if( w ) *w = REF_GET_PARM( PARM_TEX_WIDTH, texnum );
|
||||
@@ -42,18 +67,8 @@ void GAME_EXPORT GL_FreeImage( const char *name )
|
||||
ref.dllFuncs.GL_FreeTexture( texnum );
|
||||
}
|
||||
|
||||
void R_UpdateRefState( void )
|
||||
{
|
||||
refState.time = cl.time;
|
||||
refState.oldtime = cl.oldtime;
|
||||
refState.realtime = host.realtime;
|
||||
refState.frametime = host.frametime;
|
||||
}
|
||||
|
||||
void GL_RenderFrame( const ref_viewpass_t *rvp )
|
||||
{
|
||||
R_UpdateRefState();
|
||||
|
||||
VectorCopy( rvp->vieworigin, refState.vieworg );
|
||||
VectorCopy( rvp->viewangles, refState.viewangles );
|
||||
|
||||
@@ -65,11 +80,6 @@ static intptr_t pfnEngineGetParm( int parm, int arg )
|
||||
return CL_RenderGetParm( parm, arg, false ); // prevent recursion
|
||||
}
|
||||
|
||||
static world_static_t *pfnGetWorld( void )
|
||||
{
|
||||
return &world;
|
||||
}
|
||||
|
||||
static void pfnStudioEvent( const mstudioevent_t *event, const cl_entity_t *e )
|
||||
{
|
||||
clgame.dllFuncs.pfnStudioEvent( event, e );
|
||||
@@ -99,16 +109,6 @@ static void *pfnMod_Extradata( int type, model_t *m )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void pfnGetPredictedOrigin( vec3_t v )
|
||||
{
|
||||
VectorCopy( cl.simorg, v );
|
||||
}
|
||||
|
||||
static color24 *pfnCL_GetPaletteColor( void ) // clgame.palette[color]
|
||||
{
|
||||
return clgame.palette;
|
||||
}
|
||||
|
||||
static void pfnCL_GetScreenInfo( int *width, int *height ) // clgame.scrInfo, ptrs may be NULL
|
||||
{
|
||||
if( width ) *width = clgame.scrInfo.iWidth;
|
||||
@@ -207,11 +207,6 @@ static qboolean R_Init_Video_( const int type )
|
||||
return R_Init_Video( type );
|
||||
}
|
||||
|
||||
static model_t **pfnGetModels( void )
|
||||
{
|
||||
return cl.models;
|
||||
}
|
||||
|
||||
static ref_api_t gEngfuncs =
|
||||
{
|
||||
pfnEngineGetParm,
|
||||
@@ -246,14 +241,12 @@ static ref_api_t gEngfuncs =
|
||||
Con_DrawString,
|
||||
CL_DrawCenterPrint,
|
||||
|
||||
CL_GetViewModel,
|
||||
R_BeamGetEntity,
|
||||
CL_GetWaterEntity,
|
||||
CL_AddVisibleEntity,
|
||||
|
||||
Mod_SampleSizeForFace,
|
||||
Mod_BoxVisible,
|
||||
pfnGetWorld,
|
||||
Mod_PointInLeaf,
|
||||
Mod_CreatePolygonsForHull,
|
||||
|
||||
@@ -270,7 +263,6 @@ static ref_api_t gEngfuncs =
|
||||
|
||||
Mod_ForName,
|
||||
pfnMod_Extradata,
|
||||
pfnGetModels,
|
||||
|
||||
CL_EntitySetRemapColors,
|
||||
CL_GetRemapInfoForEntity,
|
||||
@@ -281,8 +273,6 @@ static ref_api_t gEngfuncs =
|
||||
COM_RandomFloat,
|
||||
COM_RandomLong,
|
||||
pfnRefGetScreenFade,
|
||||
pfnGetPredictedOrigin,
|
||||
pfnCL_GetPaletteColor,
|
||||
pfnCL_GetScreenInfo,
|
||||
pfnSetLocalLightLevel,
|
||||
Sys_CheckParm,
|
||||
@@ -332,7 +322,6 @@ static ref_api_t gEngfuncs =
|
||||
PM_CL_TraceLine,
|
||||
CL_VisTraceLine,
|
||||
CL_TraceLine,
|
||||
pfnGetMoveVars,
|
||||
|
||||
Image_AddCmdFlags,
|
||||
Image_SetForceFlags,
|
||||
|
||||
@@ -52,7 +52,6 @@ extern convar_t gl_clear;
|
||||
|
||||
qboolean R_Init( void );
|
||||
void R_Shutdown( void );
|
||||
void R_UpdateRefState( void );
|
||||
|
||||
extern triangleapi_t gTriApi;
|
||||
|
||||
|
||||
@@ -302,8 +302,12 @@ typedef struct host_parm_s
|
||||
int argc;
|
||||
char **argv;
|
||||
|
||||
// ==== shared through RefAPI's ref_host_t
|
||||
double realtime; // host.curtime
|
||||
double frametime; // time between engine frames
|
||||
uint features; // custom features that enables by mod-maker request
|
||||
// ==== shared through RefAPI's ref_host_t
|
||||
|
||||
double realframetime; // for some system events, e.g. console animations
|
||||
|
||||
uint framecount; // global framecount
|
||||
@@ -344,8 +348,6 @@ typedef struct host_parm_s
|
||||
poolhandle_t imagepool; // imagelib mempool
|
||||
poolhandle_t soundpool; // soundlib mempool
|
||||
|
||||
uint features; // custom features that enables by mod-maker request
|
||||
|
||||
// for IN_MouseMove() easy access
|
||||
int window_center_x;
|
||||
int window_center_y;
|
||||
@@ -552,7 +554,7 @@ qboolean Host_IsLocalGame( void );
|
||||
qboolean Host_IsLocalClient( void );
|
||||
void Host_ShutdownServer( void );
|
||||
void Host_Error( const char *error, ... ) _format( 1 );
|
||||
void Host_PrintEngineFeatures( int features );
|
||||
void Host_ValidateEngineFeatures( uint32_t features );
|
||||
void Host_Frame( float time );
|
||||
void Host_InitDecals( void );
|
||||
void Host_Credits( void );
|
||||
|
||||
@@ -190,29 +190,68 @@ void Host_ShutdownServer( void )
|
||||
Host_PrintEngineFeatures
|
||||
================
|
||||
*/
|
||||
void Host_PrintEngineFeatures( int features )
|
||||
static void Host_PrintEngineFeatures( int features )
|
||||
{
|
||||
const char *features_str[] =
|
||||
struct
|
||||
{
|
||||
"Big World Support",
|
||||
"Quake Compatibility",
|
||||
"Deluxemap Support",
|
||||
"Improved MOVETYPE_PUSH",
|
||||
"Large Lightmaps",
|
||||
"Stupid Quake Bug Compensation",
|
||||
"Improved Trace Line",
|
||||
"Studio MOVETYPE_STEP Lerping",
|
||||
"Linear Gamma Space"
|
||||
uint32_t mask;
|
||||
const char *msg;
|
||||
} features_str[] =
|
||||
{
|
||||
{ ENGINE_WRITE_LARGE_COORD, "Big World Support" },
|
||||
{ ENGINE_QUAKE_COMPATIBLE, "Quake Compatibility" },
|
||||
{ ENGINE_LOAD_DELUXEDATA, "Deluxemap Support" },
|
||||
{ ENGINE_PHYSICS_PUSHER_EXT, "Improved MOVETYPE_PUSH" },
|
||||
{ ENGINE_LARGE_LIGHTMAPS, "Large Lightmaps" },
|
||||
{ ENGINE_COMPENSATE_QUAKE_BUG, "Stupid Quake Bug Compensation" },
|
||||
{ ENGINE_IMPROVED_LINETRACE, "Improved Trace Line" },
|
||||
{ ENGINE_COMPUTE_STUDIO_LERP, "Studio MOVETYPE_STEP Lerping" },
|
||||
{ ENGINE_LINEAR_GAMMA_SPACE, "Linear Gamma Space" },
|
||||
{ ENGINE_STEP_POSHISTORY_LERP, "MOVETYPE_STEP Position History Based Lerping" },
|
||||
};
|
||||
int i;
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( features_str ); i++ )
|
||||
{
|
||||
if( FBitSet( features, BIT( i )))
|
||||
Con_Reportf( "^3EXT:^7 %s is enabled\n", features_str[i] );
|
||||
if( FBitSet( features, features_str[i].mask ))
|
||||
Con_Reportf( "^3EXT:^7 %s is enabled\n", features_str[i].msg );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
Host_ValidateEngineFeatures
|
||||
|
||||
validate features bits and set host.features
|
||||
==============
|
||||
*/
|
||||
void Host_ValidateEngineFeatures( uint32_t features )
|
||||
{
|
||||
uint32_t mask = ENGINE_FEATURES_MASK;
|
||||
|
||||
#if !HOST_DEDICATED
|
||||
if( !Host_IsDedicated( ) && cls.legacymode )
|
||||
mask = ENGINE_LEGACY_FEATURES_MASK;
|
||||
#endif
|
||||
|
||||
// don't allow unsupported bits
|
||||
features &= mask;
|
||||
|
||||
// force bits for some games
|
||||
if( !Q_stricmp( GI->gamefolder, "cstrike" ) || !Q_stricmp( GI->gamefolder, "czero" ))
|
||||
SetBits( features, ENGINE_STEP_POSHISTORY_LERP );
|
||||
|
||||
// print requested first
|
||||
Host_PrintEngineFeatures( features );
|
||||
|
||||
// now warn about incompatible bits
|
||||
if( FBitSet( features, ENGINE_STEP_POSHISTORY_LERP|ENGINE_COMPUTE_STUDIO_LERP ) == ( ENGINE_STEP_POSHISTORY_LERP|ENGINE_COMPUTE_STUDIO_LERP ))
|
||||
Con_Printf( S_WARN "%s: incompatible ENGINE_STEP_POSHISTORY_LERP and ENGINE_COMPUTE_STUDIO_LERP are enabled!\n", __func__ );
|
||||
|
||||
// finally set global variable
|
||||
host.features = features;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
Host_IsQuakeCompatible
|
||||
@@ -1342,6 +1381,8 @@ Host_Shutdown
|
||||
*/
|
||||
void EXPORT Host_Shutdown( void )
|
||||
{
|
||||
qboolean error = host.status == HOST_ERR_FATAL;
|
||||
|
||||
if( host.shutdown_issued ) return;
|
||||
host.shutdown_issued = true;
|
||||
|
||||
@@ -1349,7 +1390,7 @@ void EXPORT Host_Shutdown( void )
|
||||
if( !host.change_game ) Q_strncpy( host.finalmsg, "Server shutdown", sizeof( host.finalmsg ));
|
||||
|
||||
#if !XASH_DEDICATED
|
||||
if( host.type == HOST_NORMAL )
|
||||
if( host.type == HOST_NORMAL && !error )
|
||||
Host_WriteConfig();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -13,17 +13,15 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifdef SINGLE_BINARY
|
||||
|
||||
#include "build.h"
|
||||
#include "common.h"
|
||||
#ifdef XASH_SDLMAIN
|
||||
#include "SDL.h"
|
||||
#if XASH_ENABLE_MAIN
|
||||
#if XASH_SDLMAIN
|
||||
#include <SDL.h>
|
||||
#endif
|
||||
|
||||
#if XASH_EMSCRIPTEN
|
||||
#include <emscripten.h>
|
||||
#endif
|
||||
#include "build.h"
|
||||
#include "common.h"
|
||||
|
||||
#define E_GAME "XASH3D_GAME" // default env dir to start from
|
||||
#ifndef XASH_GAMEDIR
|
||||
@@ -47,40 +45,35 @@ static void Sys_ChangeGame( const char *progname )
|
||||
exit( Host_Main( szArgc, szArgv, szGameDir, 1, &Sys_ChangeGame ) );
|
||||
}
|
||||
|
||||
_inline int Sys_Start( void )
|
||||
static int Sys_Start( void )
|
||||
{
|
||||
int ret;
|
||||
const char *game = getenv( E_GAME );
|
||||
|
||||
if( !game )
|
||||
game = XASH_GAMEDIR;
|
||||
|
||||
Q_strncpy( szGameDir, game, sizeof( szGameDir ));
|
||||
|
||||
#if XASH_EMSCRIPTEN
|
||||
#ifdef EMSCRIPTEN_LIB_FS
|
||||
// For some unknown reason emscripten refusing to load libraries later
|
||||
COM_LoadLibrary("menu", 0 );
|
||||
COM_LoadLibrary("server", 0 );
|
||||
COM_LoadLibrary("client", 0 );
|
||||
COM_LoadLibrary( "menu", 0 );
|
||||
COM_LoadLibrary( "server", 0 );
|
||||
COM_LoadLibrary( "client", 0 );
|
||||
#endif
|
||||
#if XASH_DEDICATED
|
||||
// NodeJS support for debug
|
||||
EM_ASM(try{
|
||||
FS.mkdir('/xash');
|
||||
FS.mount(NODEFS, { root: '.'}, '/xash' );
|
||||
FS.chdir('/xash');
|
||||
}catch(e){};);
|
||||
EM_ASM(try {
|
||||
FS.mkdir( '/xash' );
|
||||
FS.mount( NODEFS, { root: '.'}, '/xash' );
|
||||
FS.chdir( '/xash' );
|
||||
} catch( e ) { };);
|
||||
#endif
|
||||
#elif XASH_IOS
|
||||
{
|
||||
void IOS_LaunchDialog( void );
|
||||
IOS_LaunchDialog();
|
||||
}
|
||||
IOS_LaunchDialog();
|
||||
#endif
|
||||
|
||||
ret = Host_Main( szArgc, szArgv, game, 0, Sys_ChangeGame );
|
||||
|
||||
return ret;
|
||||
return Host_Main( szArgc, szArgv, game, 0, Sys_ChangeGame );
|
||||
}
|
||||
|
||||
int main( int argc, char **argv )
|
||||
@@ -94,4 +87,4 @@ int main( int argc, char **argv )
|
||||
#endif // XASH_PSVITA
|
||||
return Sys_Start();
|
||||
}
|
||||
#endif // SINGLE_BINARY
|
||||
#endif // XASH_ENABLE_MAIN
|
||||
|
||||
@@ -13,7 +13,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
@@ -24,6 +27,19 @@ GNU General Public License for more details.
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
#include "platform/platform.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 30)
|
||||
// Library support was added in glibc 2.30.
|
||||
// Earlier glibc versions did not provide a wrapper for this system call,
|
||||
// necessitating the use of syscall(2).
|
||||
#include <sys/syscall.h>
|
||||
|
||||
static pid_t gettid( void )
|
||||
{
|
||||
return syscall( SYS_gettid );
|
||||
}
|
||||
#endif
|
||||
|
||||
static void *g_hsystemd;
|
||||
static int (*g_pfn_sd_notify)( int unset_environment, const char *state );
|
||||
|
||||
@@ -40,6 +40,7 @@ void Platform_SetStatus( const char *status );
|
||||
// legacy iOS port functions
|
||||
#if TARGET_OS_IOS
|
||||
const char *IOS_GetDocsDir( void );
|
||||
void IOS_LaunchDialog( void );
|
||||
#endif // TARGET_OS_IOS
|
||||
|
||||
#if XASH_WIN32 || XASH_LINUX
|
||||
|
||||
@@ -28,6 +28,7 @@ GNU General Public License for more details.
|
||||
#include "r_efx.h"
|
||||
#include "com_image.h"
|
||||
#include "filesystem.h"
|
||||
#include "common/protocol.h"
|
||||
|
||||
// RefAPI changelog:
|
||||
// 1. Initial release
|
||||
@@ -38,7 +39,10 @@ GNU General Public License for more details.
|
||||
// Removed previously unused calls
|
||||
// Simplified remapping calls
|
||||
// GetRefAPI is now expected to return REF_API_VERSION
|
||||
#define REF_API_VERSION 5
|
||||
// 6. Removed timing from ref_globals_t.
|
||||
// Renderers are supposed to migrate to ref_client_t/ref_host_t using PARM_GET_CLIENT_PTR and PARM_GET_HOST_PTR
|
||||
// Removed functions to get internal engine structions. Use PARM_GET_*_PTR instead.
|
||||
#define REF_API_VERSION 6
|
||||
|
||||
|
||||
#define TF_SKY (TF_SKYSIDE|TF_NOMIPMAP)
|
||||
@@ -94,11 +98,6 @@ typedef struct ref_globals_s
|
||||
{
|
||||
qboolean developer;
|
||||
|
||||
float time; // cl.time
|
||||
float oldtime; // cl.oldtime
|
||||
double realtime; // host.realtime
|
||||
double frametime; // host.frametime
|
||||
|
||||
// viewport width and height
|
||||
int width;
|
||||
int height;
|
||||
@@ -120,6 +119,26 @@ typedef struct ref_globals_s
|
||||
int desktopBitsPixel;
|
||||
} ref_globals_t;
|
||||
|
||||
typedef struct ref_client_s
|
||||
{
|
||||
double time;
|
||||
double oldtime;
|
||||
int viewentity;
|
||||
int playernum;
|
||||
int maxclients;
|
||||
int nummodels;
|
||||
model_t *models[MAX_MODELS+1];
|
||||
qboolean paused;
|
||||
vec3_t simorg;
|
||||
} ref_client_t;
|
||||
|
||||
typedef struct ref_host_s
|
||||
{
|
||||
double realtime;
|
||||
double frametime;
|
||||
int features;
|
||||
} ref_host_t;
|
||||
|
||||
enum
|
||||
{
|
||||
GL_KEEP_UNIT = -1,
|
||||
@@ -251,17 +270,18 @@ typedef enum
|
||||
PARM_DEV_OVERVIEW = -1,
|
||||
PARM_THIRDPERSON = -2,
|
||||
PARM_QUAKE_COMPATIBLE = -3,
|
||||
PARM_PLAYER_INDEX = -4, // cl.playernum + 1
|
||||
PARM_VIEWENT_INDEX = -5, // cl.viewentity
|
||||
PARM_GET_CLIENT_PTR = -4, // ref_client_t
|
||||
PARM_GET_HOST_PTR = -5, // ref_host_t
|
||||
PARM_CONNSTATE = -6, // cls.state
|
||||
PARM_PLAYING_DEMO = -7, // cls.demoplayback
|
||||
PARM_WATER_LEVEL = -8, // cl.local.water_level
|
||||
PARM_MAX_CLIENTS = -9, // cl.maxclients
|
||||
PARM_GET_WORLD_PTR = -9, // world
|
||||
PARM_LOCAL_HEALTH = -10, // cl.local.health
|
||||
PARM_LOCAL_GAME = -11,
|
||||
PARM_NUMENTITIES = -12, // local game only
|
||||
PARM_NUMMODELS = -13, // cl.nummodels
|
||||
PARM_WORLD_VERSION = -14,
|
||||
PARM_GET_MOVEVARS_PTR = -13, // clgame.movevars
|
||||
PARM_GET_PALETTE_PTR = -14, // clgame.palette
|
||||
PARM_GET_VIEWENT_PTR = -15, // clgame.viewent
|
||||
} ref_parm_e;
|
||||
|
||||
typedef struct ref_api_s
|
||||
@@ -304,7 +324,6 @@ typedef struct ref_api_s
|
||||
void (*CL_DrawCenterPrint)( void );
|
||||
|
||||
// entity management
|
||||
struct cl_entity_s *(*GetViewModel)( void );
|
||||
struct cl_entity_s *(*R_BeamGetEntity)( int index );
|
||||
struct cl_entity_s *(*CL_GetWaterEntity)( const vec3_t p );
|
||||
qboolean (*CL_AddVisibleEntity)( cl_entity_t *ent, int entityType );
|
||||
@@ -312,7 +331,6 @@ typedef struct ref_api_s
|
||||
// brushes
|
||||
int (*Mod_SampleSizeForFace)( const struct msurface_s *surf );
|
||||
qboolean (*Mod_BoxVisible)( const vec3_t mins, const vec3_t maxs, const byte *visbits );
|
||||
struct world_static_s *(*GetWorld)( void ); // returns &world
|
||||
mleaf_t *(*Mod_PointInLeaf)( const vec3_t p, mnode_t *node );
|
||||
void (*Mod_CreatePolygonsForHull)( int hullnum );
|
||||
|
||||
@@ -332,7 +350,6 @@ typedef struct ref_api_s
|
||||
// model management
|
||||
model_t *(*Mod_ForName)( const char *name, qboolean crash, qboolean trackCRC );
|
||||
void *(*Mod_Extradata)( int type, model_t *model );
|
||||
struct model_s **(*pfnGetModels)( void );
|
||||
|
||||
// remap
|
||||
qboolean (*CL_EntitySetRemapColors)( cl_entity_t *e, model_t *mod, int top, int bottom );
|
||||
@@ -345,8 +362,6 @@ typedef struct ref_api_s
|
||||
float (*COM_RandomFloat)( float rmin, float rmax );
|
||||
int (*COM_RandomLong)( int rmin, int rmax );
|
||||
struct screenfade_s *(*GetScreenFade)( void );
|
||||
void (*GetPredictedOrigin)( vec3_t v );
|
||||
color24 *(*CL_GetPaletteColor)( void ); // clgame.palette[color]
|
||||
void (*CL_GetScreenInfo)( int *width, int *height ); // clgame.scrInfo, ptrs may be NULL
|
||||
void (*SetLocalLightLevel)( int level ); // cl.local.light_level
|
||||
int (*Sys_CheckParm)( const char *flag );
|
||||
@@ -407,7 +422,6 @@ typedef struct ref_api_s
|
||||
struct pmtrace_s *(*PM_TraceLine)( float *start, float *end, int flags, int usehull, int ignore_pe );
|
||||
struct pmtrace_s *(*EV_VisTraceLine )( float *start, float *end, int flags );
|
||||
struct pmtrace_s (*CL_TraceLine)( vec3_t start, vec3_t end, int flags );
|
||||
struct movevars_s *(*pfnGetMoveVars)( void );
|
||||
|
||||
// imagelib
|
||||
void (*Image_AddCmdFlags)( uint flags ); // used to check if hardware dxt is supported
|
||||
|
||||
@@ -2139,18 +2139,18 @@ qboolean SV_InitPhysicsAPI( void )
|
||||
if( svgame.physFuncs.SV_CheckFeatures != NULL )
|
||||
{
|
||||
// grab common engine features (it will be shared across the network)
|
||||
host.features = svgame.physFuncs.SV_CheckFeatures() & ENGINE_FEATURES_MASK;
|
||||
Host_PrintEngineFeatures( host.features );
|
||||
Host_ValidateEngineFeatures( svgame.physFuncs.SV_CheckFeatures( ));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// make sure what physic functions is cleared
|
||||
memset( &svgame.physFuncs, 0, sizeof( svgame.physFuncs ));
|
||||
|
||||
Host_ValidateEngineFeatures( 0 );
|
||||
return false; // just tell user about problems
|
||||
}
|
||||
|
||||
// physic interface is missed
|
||||
Host_ValidateEngineFeatures( 0 );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ def configure(conf):
|
||||
conf.define_cond('XASH_ENGINE_TESTS', conf.env.ENGINE_TESTS)
|
||||
conf.define_cond('XASH_STATIC_LIBS', conf.env.STATIC_LINKING)
|
||||
conf.define_cond('XASH_CUSTOM_SWAP', conf.options.CUSTOM_SWAP)
|
||||
conf.define_cond('SINGLE_BINARY', conf.env.SINGLE_BINARY)
|
||||
conf.define_cond('XASH_ENABLE_MAIN', conf.env.DISABLE_LAUNCHER)
|
||||
conf.define_cond('XASH_NO_ASYNC_NS_RESOLVE', conf.options.NO_ASYNC_RESOLVE)
|
||||
conf.define_cond('SUPPORT_BSP2_FORMAT', conf.options.SUPPORT_BSP2_FORMAT)
|
||||
conf.define_cond('XASH_64BIT', conf.env.DEST_SIZEOF_VOID_P != 4)
|
||||
|
||||
@@ -1287,6 +1287,26 @@ static qboolean FS_CheckForCrypt( const char *dllname )
|
||||
return ( key == 0x12345678 ) ? true : false;
|
||||
}
|
||||
|
||||
static int FS_StripIdiotRelativePath( const char *dllname, const char *gamefolder )
|
||||
{
|
||||
string idiot_relpath;
|
||||
int len;
|
||||
|
||||
if(( len = Q_snprintf( idiot_relpath, sizeof( idiot_relpath ), "../%s/", gamefolder )) >= 4 )
|
||||
{
|
||||
if( !Q_strnicmp( dllname, idiot_relpath, len ))
|
||||
return len;
|
||||
|
||||
// try backslashes
|
||||
idiot_relpath[1] = '\\';
|
||||
idiot_relpath[len - 1] = '\\';
|
||||
if( !Q_strnicmp( dllname, idiot_relpath, len ))
|
||||
return len;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
FS_FindLibrary
|
||||
@@ -1306,9 +1326,16 @@ static qboolean FS_FindLibrary( const char *dllname, qboolean directpath, fs_dll
|
||||
|
||||
fs_ext_path = directpath;
|
||||
|
||||
// HACKHACK remove absoulte path to valve folder
|
||||
if( !Q_strnicmp( dllname, "..\\valve\\", 9 ) || !Q_strnicmp( dllname, "../valve/", 9 ))
|
||||
start += 9;
|
||||
// HACKHACK remove relative path to game folder
|
||||
if( !Q_strnicmp( dllname, "..", 2 ))
|
||||
{
|
||||
// some modders put relative path to themselves???
|
||||
len = FS_StripIdiotRelativePath( dllname, GI->gamefolder );
|
||||
|
||||
if( len == 0 ) // or put relative path to Half-Life game libs
|
||||
len = FS_StripIdiotRelativePath( dllname, "valve" );
|
||||
start += len;
|
||||
}
|
||||
|
||||
// replace all backward slashes
|
||||
len = Q_strlen( dllname );
|
||||
|
||||
@@ -765,7 +765,7 @@ similar to R_StudioDynamicLight
|
||||
*/
|
||||
void R_AliasDynamicLight( cl_entity_t *ent, alight_t *plight )
|
||||
{
|
||||
movevars_t *mv = gEngfuncs.pfnGetMoveVars();
|
||||
movevars_t *mv = tr.movevars;
|
||||
vec3_t lightDir, vecSrc, vecEnd;
|
||||
vec3_t origin, dist, finalLight;
|
||||
float add, radius, total;
|
||||
@@ -801,7 +801,7 @@ void R_AliasDynamicLight( cl_entity_t *ent, alight_t *plight )
|
||||
msurface_t *psurf = NULL;
|
||||
pmtrace_t trace;
|
||||
|
||||
if( FBitSet( ENGINE_GET_PARM( PARM_FEATURES ), ENGINE_WRITE_LARGE_COORD ))
|
||||
if( FBitSet( gp_host->features, ENGINE_WRITE_LARGE_COORD ))
|
||||
{
|
||||
vecEnd[0] = origin[0] - mv->skyvec_x * 65536.0f;
|
||||
vecEnd[1] = origin[1] - mv->skyvec_y * 65536.0f;
|
||||
@@ -1332,12 +1332,12 @@ static void R_AliasSetupTimings( void )
|
||||
if( RI.drawWorld )
|
||||
{
|
||||
// synchronize with server time
|
||||
g_alias.time = gpGlobals->time;
|
||||
g_alias.time = gp_cl->time;
|
||||
}
|
||||
else
|
||||
{
|
||||
// menu stuff
|
||||
g_alias.time = gpGlobals->realtime;
|
||||
g_alias.time = gp_host->realtime;
|
||||
}
|
||||
|
||||
m_fDoRemap = false;
|
||||
@@ -1381,7 +1381,7 @@ void R_DrawAliasModel( cl_entity_t *e )
|
||||
|
||||
R_AliasLerpMovement( e );
|
||||
|
||||
if( !FBitSet( ENGINE_GET_PARM( PARM_FEATURES ), ENGINE_COMPENSATE_QUAKE_BUG ))
|
||||
if( !FBitSet( gp_host->features, ENGINE_COMPENSATE_QUAKE_BUG ))
|
||||
e->angles[PITCH] = -e->angles[PITCH]; // stupid quake bug
|
||||
|
||||
// don't rotate clients, only aim
|
||||
|
||||
@@ -608,7 +608,7 @@ void R_DrawBeamFollow( BEAM *pbeam, float frametime )
|
||||
if( pnew )
|
||||
{
|
||||
VectorCopy( pbeam->source, pnew->org );
|
||||
pnew->die = gpGlobals->time + pbeam->amplitude;
|
||||
pnew->die = gp_cl->time + pbeam->amplitude;
|
||||
VectorClear( pnew->vel );
|
||||
|
||||
pnew->next = particles;
|
||||
@@ -655,7 +655,7 @@ void R_DrawBeamFollow( BEAM *pbeam, float frametime )
|
||||
VectorMA( delta, -pbeam->width, normal, last2 );
|
||||
|
||||
div = 1.0f / pbeam->amplitude;
|
||||
fraction = ( pbeam->die - gpGlobals->time ) * div;
|
||||
fraction = ( pbeam->die - gp_cl->time ) * div;
|
||||
|
||||
vLast = 0.0f;
|
||||
vStep = 1.0f;
|
||||
@@ -688,7 +688,7 @@ void R_DrawBeamFollow( BEAM *pbeam, float frametime )
|
||||
|
||||
if( particles->next != NULL )
|
||||
{
|
||||
fraction = (particles->die - gpGlobals->time) * div;
|
||||
fraction = (particles->die - gp_cl->time) * div;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -867,12 +867,8 @@ static qboolean R_BeamComputePoint( int beamEnt, vec3_t pt )
|
||||
// get attachment
|
||||
if( attach > 0 )
|
||||
VectorCopy( ent->attachment[attach - 1], pt );
|
||||
else if( ent->index == ENGINE_GET_PARM( PARM_PLAYER_INDEX ) )
|
||||
{
|
||||
vec3_t simorg;
|
||||
gEngfuncs.GetPredictedOrigin( simorg );
|
||||
VectorCopy( simorg, pt );
|
||||
}
|
||||
else if( ent->index == ( gp_cl->playernum + 1 ))
|
||||
VectorCopy( gp_cl->simorg, pt );
|
||||
else VectorCopy( ent->origin, pt );
|
||||
|
||||
return true;
|
||||
@@ -916,7 +912,7 @@ qboolean R_BeamRecomputeEndpoints( BEAM *pbeam )
|
||||
else if( !FBitSet( pbeam->flags, FBEAM_FOREVER ))
|
||||
{
|
||||
ClearBits( pbeam->flags, FBEAM_ENDENTITY );
|
||||
pbeam->die = gpGlobals->time;
|
||||
pbeam->die = gp_cl->time;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@@ -949,7 +945,7 @@ void R_BeamDraw( BEAM *pbeam, float frametime )
|
||||
if( !model || model->type != mod_sprite )
|
||||
{
|
||||
pbeam->flags &= ~FBEAM_ISACTIVE; // force to ignore
|
||||
pbeam->die = gpGlobals->time;
|
||||
pbeam->die = gp_cl->time;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1007,7 +1003,7 @@ void R_BeamDraw( BEAM *pbeam, float frametime )
|
||||
if( pbeam->flags & ( FBEAM_FADEIN|FBEAM_FADEOUT ))
|
||||
{
|
||||
// update life cycle
|
||||
pbeam->t = pbeam->freq + ( pbeam->die - gpGlobals->time );
|
||||
pbeam->t = pbeam->freq + ( pbeam->die - gp_cl->time );
|
||||
if( pbeam->t != 0.0f ) pbeam->t = 1.0f - pbeam->freq / pbeam->t;
|
||||
}
|
||||
|
||||
@@ -1055,7 +1051,7 @@ void R_BeamDraw( BEAM *pbeam, float frametime )
|
||||
|
||||
TriRenderMode( FBitSet( pbeam->flags, FBEAM_SOLID ) ? kRenderNormal : kRenderTransAdd );
|
||||
|
||||
if( !TriSpriteTexture( model, (int)(pbeam->frame + pbeam->frameRate * gpGlobals->time) % pbeam->frameCount ))
|
||||
if( !TriSpriteTexture( model, (int)(pbeam->frame + pbeam->frameRate * gp_cl->time) % pbeam->frameCount ))
|
||||
{
|
||||
ClearBits( pbeam->flags, FBEAM_ISACTIVE );
|
||||
return;
|
||||
@@ -1160,8 +1156,8 @@ static void R_BeamSetup( BEAM *pbeam, vec3_t start, vec3_t end, int modelIndex,
|
||||
VectorCopy( end, pbeam->target );
|
||||
VectorSubtract( end, start, pbeam->delta );
|
||||
|
||||
pbeam->freq = speed * gpGlobals->time;
|
||||
pbeam->die = life + gpGlobals->time;
|
||||
pbeam->freq = speed * gp_cl->time;
|
||||
pbeam->die = life + gp_cl->time;
|
||||
pbeam->amplitude = amplitude;
|
||||
pbeam->brightness = brightness;
|
||||
pbeam->width = width;
|
||||
@@ -1291,7 +1287,7 @@ void CL_DrawBeams( int fTrans, BEAM *active_beams )
|
||||
if( !fTrans && !FBitSet( pBeam->flags, FBEAM_SOLID ))
|
||||
continue;
|
||||
|
||||
R_BeamDraw( pBeam, gpGlobals->time - gpGlobals->oldtime );
|
||||
R_BeamDraw( pBeam, gp_cl->time - gp_cl->oldtime );
|
||||
}
|
||||
|
||||
pglShadeModel( GL_FLAT );
|
||||
|
||||
@@ -24,6 +24,8 @@ GNU General Public License for more details.
|
||||
|
||||
ref_api_t gEngfuncs;
|
||||
ref_globals_t *gpGlobals;
|
||||
ref_client_t *gp_cl;
|
||||
ref_host_t *gp_host;
|
||||
|
||||
static void R_ClearScreen( void )
|
||||
{
|
||||
@@ -234,7 +236,7 @@ static int GL_RefGetParm( int parm, int arg )
|
||||
case PARM_STENCIL_ACTIVE:
|
||||
return glState.stencilEnabled;
|
||||
case PARM_SKY_SPHERE:
|
||||
return ENGINE_GET_PARM_( parm, arg ) && !tr.fCustomSkybox;
|
||||
return FBitSet( tr.world->flags, FWORLD_SKYSPHERE ) && !FBitSet( tr.world->flags, FWORLD_CUSTOM_SKYBOX );
|
||||
default:
|
||||
return ENGINE_GET_PARM_( parm, arg );
|
||||
}
|
||||
@@ -518,5 +520,8 @@ int EXPORT GetRefAPI( int version, ref_interface_t *funcs, ref_api_t *engfuncs,
|
||||
memcpy( &gEngfuncs, engfuncs, sizeof( ref_api_t ));
|
||||
gpGlobals = globals;
|
||||
|
||||
gp_cl = (ref_client_t *)ENGINE_GET_PARM( PARM_GET_CLIENT_PTR );
|
||||
gp_host = (ref_host_t *)ENGINE_GET_PARM( PARM_GET_HOST_PTR );
|
||||
|
||||
return REF_API_VERSION;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ GNU General Public License for more details.
|
||||
#include "common/cvar.h"
|
||||
#include "gl_export.h"
|
||||
#include "wadfile.h"
|
||||
#include "common/mod_local.h"
|
||||
|
||||
#if XASH_PSVITA
|
||||
int VGL_ShimInit( void );
|
||||
@@ -87,10 +88,10 @@ extern poolhandle_t r_temppool;
|
||||
#define RP_NONVIEWERREF (RP_ENVVIEW)
|
||||
#define R_ModelOpaque( rm ) ( rm == kRenderNormal )
|
||||
#define R_StaticEntity( ent ) ( VectorIsNull( ent->origin ) && VectorIsNull( ent->angles ))
|
||||
#define RP_LOCALCLIENT( e ) ((e) != NULL && (e)->index == ENGINE_GET_PARM( PARM_PLAYER_INDEX ) && e->player )
|
||||
#define RP_LOCALCLIENT( e ) ((e) != NULL && (e)->index == ( gp_cl->playernum + 1 ) && e->player )
|
||||
#define RP_NORMALPASS() ( FBitSet( RI.params, RP_NONVIEWERREF ) == 0 )
|
||||
|
||||
#define CL_IsViewEntityLocalPlayer() ( ENGINE_GET_PARM( PARM_VIEWENT_INDEX ) == ENGINE_GET_PARM( PARM_PLAYER_INDEX ) )
|
||||
#define CL_IsViewEntityLocalPlayer() ( gp_cl->viewentity == ( gp_cl->playernum + 1 ))
|
||||
|
||||
#define CULL_VISIBLE 0 // not culled
|
||||
#define CULL_BACKSIDE 1 // backside of transparent wall
|
||||
@@ -252,13 +253,10 @@ typedef struct
|
||||
// cull info
|
||||
vec3_t modelorg; // relative to viewpoint
|
||||
|
||||
qboolean fCustomSkybox;
|
||||
|
||||
// get from engine
|
||||
struct world_static_s *world;
|
||||
world_static_t *world;
|
||||
cl_entity_t *entities;
|
||||
movevars_t *movevars;
|
||||
model_t **models;
|
||||
color24 *palette;
|
||||
cl_entity_t *viewent;
|
||||
|
||||
@@ -401,6 +399,7 @@ void R_TranslateForEntity( cl_entity_t *e );
|
||||
void R_RotateForEntity( cl_entity_t *e );
|
||||
void R_SetupGL( qboolean set_gl_state );
|
||||
void R_AllowFog( qboolean allowed );
|
||||
qboolean R_OpaqueEntity( cl_entity_t *ent );
|
||||
void R_SetupFrustum( void );
|
||||
void R_FindViewLeaf( void );
|
||||
void R_CheckGamma( void );
|
||||
@@ -725,6 +724,8 @@ extern glstate_t glState;
|
||||
extern glwstate_t glw_state;
|
||||
extern ref_api_t gEngfuncs;
|
||||
extern ref_globals_t *gpGlobals;
|
||||
extern ref_client_t *gp_cl;
|
||||
extern ref_host_t *gp_host;
|
||||
|
||||
#define ENGINE_GET_PARM_ (*gEngfuncs.EngineGetParm)
|
||||
#define ENGINE_GET_PARM( parm ) ENGINE_GET_PARM_( ( parm ), 0 )
|
||||
@@ -734,15 +735,21 @@ extern ref_globals_t *gpGlobals;
|
||||
//
|
||||
static inline cl_entity_t *CL_GetEntityByIndex( int index )
|
||||
{
|
||||
if( unlikely( index < 0 || index >= tr.max_entities || !tr.entities ))
|
||||
return NULL;
|
||||
|
||||
return &tr.entities[index];
|
||||
}
|
||||
|
||||
static inline model_t *CL_ModelHandle( int index )
|
||||
{
|
||||
return tr.models[index];
|
||||
if( unlikely( index < 0 || index >= gp_cl->nummodels ))
|
||||
return NULL;
|
||||
|
||||
return gp_cl->models[index];
|
||||
}
|
||||
|
||||
#define WORLDMODEL (tr.models[1])
|
||||
#define WORLDMODEL (gp_cl->models[1])
|
||||
|
||||
//
|
||||
// renderer cvars
|
||||
|
||||
@@ -1287,11 +1287,10 @@ qboolean R_Init( void )
|
||||
}
|
||||
|
||||
// see R_ProcessEntData for tr.entities initialization
|
||||
tr.world = gEngfuncs.GetWorld();
|
||||
tr.models = gEngfuncs.pfnGetModels();
|
||||
tr.movevars = gEngfuncs.pfnGetMoveVars();
|
||||
tr.palette = gEngfuncs.CL_GetPaletteColor();
|
||||
tr.viewent = gEngfuncs.GetViewModel();
|
||||
tr.world = (struct world_static_s *)ENGINE_GET_PARM( PARM_GET_WORLD_PTR );
|
||||
tr.movevars = (movevars_t *)ENGINE_GET_PARM( PARM_GET_MOVEVARS_PTR );
|
||||
tr.palette = (color24 *)ENGINE_GET_PARM( PARM_GET_PALETTE_PTR );
|
||||
tr.viewent = (cl_entity_t *)ENGINE_GET_PARM( PARM_GET_VIEWENT_PTR );
|
||||
|
||||
GL_SetDefaults();
|
||||
R_CheckVBO();
|
||||
|
||||
@@ -36,7 +36,7 @@ void CL_RunLightStyles( void )
|
||||
{
|
||||
int i, k, flight, clight;
|
||||
float l, lerpfrac, backlerp;
|
||||
float frametime = (gpGlobals->time - gpGlobals->oldtime);
|
||||
float frametime = (gp_cl->time - gp_cl->oldtime);
|
||||
float scale;
|
||||
lightstyle_t *ls;
|
||||
|
||||
@@ -55,7 +55,7 @@ void CL_RunLightStyles( void )
|
||||
continue;
|
||||
}
|
||||
|
||||
if( !ENGINE_GET_PARM( PARAM_GAMEPAUSED ) && frametime <= 0.1f )
|
||||
if( !gp_cl->paused && frametime <= 0.1f )
|
||||
ls->time += frametime; // evaluate local time
|
||||
|
||||
flight = (int)Q_floor( ls->time * 10 );
|
||||
@@ -160,7 +160,7 @@ void R_PushDlights( void )
|
||||
{
|
||||
l = gEngfuncs.GetDynamicLight( i );
|
||||
|
||||
if( l->die < gpGlobals->time || !l->radius )
|
||||
if( l->die < gp_cl->time || !l->radius )
|
||||
continue;
|
||||
|
||||
if( GL_FrustumCullSphere( &RI.frustum, l->origin, l->radius, 15 ))
|
||||
|
||||
@@ -61,7 +61,7 @@ R_OpaqueEntity
|
||||
Opaque entity can be brush or studio model but sprite
|
||||
===============
|
||||
*/
|
||||
static qboolean R_OpaqueEntity( cl_entity_t *ent )
|
||||
qboolean R_OpaqueEntity( cl_entity_t *ent )
|
||||
{
|
||||
if( R_GetEntityRenderMode( ent ) == kRenderNormal )
|
||||
return true;
|
||||
@@ -339,8 +339,8 @@ void R_SetupFrustum( void )
|
||||
|
||||
if( RP_NORMALPASS() && ( ENGINE_GET_PARM( PARM_WATER_LEVEL ) >= 3 ) && ENGINE_GET_PARM( PARM_QUAKE_COMPATIBLE ))
|
||||
{
|
||||
RI.fov_x = atan( tan( DEG2RAD( RI.fov_x ) / 2 ) * ( 0.97f + sin( gpGlobals->time * 1.5f ) * 0.03f )) * 2 / (M_PI_F / 180.0f);
|
||||
RI.fov_y = atan( tan( DEG2RAD( RI.fov_y ) / 2 ) * ( 1.03f - sin( gpGlobals->time * 1.5f ) * 0.03f )) * 2 / (M_PI_F / 180.0f);
|
||||
RI.fov_x = atan( tan( DEG2RAD( RI.fov_x ) / 2 ) * ( 0.97f + sin( gp_cl->time * 1.5f ) * 0.03f )) * 2 / (M_PI_F / 180.0f);
|
||||
RI.fov_y = atan( tan( DEG2RAD( RI.fov_y ) / 2 ) * ( 1.03f - sin( gp_cl->time * 1.5f ) * 0.03f )) * 2 / (M_PI_F / 180.0f);
|
||||
}
|
||||
|
||||
// build the transformation matrix for the given view angles
|
||||
@@ -954,7 +954,7 @@ void R_RenderScene( void )
|
||||
|
||||
// frametime is valid only for normal pass
|
||||
if( RP_NORMALPASS( ))
|
||||
tr.frametime = gpGlobals->time - gpGlobals->oldtime;
|
||||
tr.frametime = gp_cl->time - gp_cl->oldtime;
|
||||
else tr.frametime = 0.0;
|
||||
|
||||
// begin a new frame
|
||||
@@ -1181,16 +1181,16 @@ int CL_FxBlend( cl_entity_t *e )
|
||||
switch( e->curstate.renderfx )
|
||||
{
|
||||
case kRenderFxPulseSlowWide:
|
||||
blend = e->curstate.renderamt + 0x40 * sin( gpGlobals->time * 2 + offset );
|
||||
blend = e->curstate.renderamt + 0x40 * sin( gp_cl->time * 2 + offset );
|
||||
break;
|
||||
case kRenderFxPulseFastWide:
|
||||
blend = e->curstate.renderamt + 0x40 * sin( gpGlobals->time * 8 + offset );
|
||||
blend = e->curstate.renderamt + 0x40 * sin( gp_cl->time * 8 + offset );
|
||||
break;
|
||||
case kRenderFxPulseSlow:
|
||||
blend = e->curstate.renderamt + 0x10 * sin( gpGlobals->time * 2 + offset );
|
||||
blend = e->curstate.renderamt + 0x10 * sin( gp_cl->time * 2 + offset );
|
||||
break;
|
||||
case kRenderFxPulseFast:
|
||||
blend = e->curstate.renderamt + 0x10 * sin( gpGlobals->time * 8 + offset );
|
||||
blend = e->curstate.renderamt + 0x10 * sin( gp_cl->time * 8 + offset );
|
||||
break;
|
||||
case kRenderFxFadeSlow:
|
||||
if( RP_NORMALPASS( ))
|
||||
@@ -1229,27 +1229,27 @@ int CL_FxBlend( cl_entity_t *e )
|
||||
blend = e->curstate.renderamt;
|
||||
break;
|
||||
case kRenderFxStrobeSlow:
|
||||
blend = 20 * sin( gpGlobals->time * 4 + offset );
|
||||
blend = 20 * sin( gp_cl->time * 4 + offset );
|
||||
if( blend < 0 ) blend = 0;
|
||||
else blend = e->curstate.renderamt;
|
||||
break;
|
||||
case kRenderFxStrobeFast:
|
||||
blend = 20 * sin( gpGlobals->time * 16 + offset );
|
||||
blend = 20 * sin( gp_cl->time * 16 + offset );
|
||||
if( blend < 0 ) blend = 0;
|
||||
else blend = e->curstate.renderamt;
|
||||
break;
|
||||
case kRenderFxStrobeFaster:
|
||||
blend = 20 * sin( gpGlobals->time * 36 + offset );
|
||||
blend = 20 * sin( gp_cl->time * 36 + offset );
|
||||
if( blend < 0 ) blend = 0;
|
||||
else blend = e->curstate.renderamt;
|
||||
break;
|
||||
case kRenderFxFlickerSlow:
|
||||
blend = 20 * (sin( gpGlobals->time * 2 ) + sin( gpGlobals->time * 17 + offset ));
|
||||
blend = 20 * (sin( gp_cl->time * 2 ) + sin( gp_cl->time * 17 + offset ));
|
||||
if( blend < 0 ) blend = 0;
|
||||
else blend = e->curstate.renderamt;
|
||||
break;
|
||||
case kRenderFxFlickerFast:
|
||||
blend = 20 * (sin( gpGlobals->time * 16 ) + sin( gpGlobals->time * 23 + offset ));
|
||||
blend = 20 * (sin( gp_cl->time * 16 ) + sin( gp_cl->time * 23 + offset ));
|
||||
if( blend < 0 ) blend = 0;
|
||||
else blend = e->curstate.renderamt;
|
||||
break;
|
||||
|
||||
@@ -87,7 +87,7 @@ void CL_DrawParticles( double frametime, particle_t *cl_active_particles, float
|
||||
p->color = bound( 0, p->color, 255 );
|
||||
color = tr.palette[p->color];
|
||||
|
||||
alpha = 255 * (p->die - gpGlobals->time) * 16.0f;
|
||||
alpha = 255 * (p->die - gp_cl->time) * 16.0f;
|
||||
if( alpha > 255 || p->type == pt_static )
|
||||
alpha = 255;
|
||||
|
||||
@@ -194,7 +194,7 @@ void CL_DrawTracers( double frametime, particle_t *cl_active_tracers )
|
||||
|
||||
for( p = cl_active_tracers; p; p = p->next )
|
||||
{
|
||||
atten = (p->die - gpGlobals->time);
|
||||
atten = (p->die - gp_cl->time);
|
||||
if( atten > 0.1f ) atten = 0.1f;
|
||||
|
||||
VectorScale( p->vel, ( p->ramp * atten ), delta );
|
||||
@@ -259,7 +259,7 @@ void CL_DrawTracers( double frametime, particle_t *cl_active_tracers )
|
||||
p->vel[1] *= scale;
|
||||
p->vel[2] -= gravity;
|
||||
|
||||
p->packedColor = 255 * (p->die - gpGlobals->time) * 2;
|
||||
p->packedColor = 255 * (p->die - gp_cl->time) * 2;
|
||||
if( p->packedColor > 255 ) p->packedColor = 255;
|
||||
}
|
||||
else if( p->type == pt_slowgrav )
|
||||
|
||||
@@ -408,7 +408,7 @@ texture_t *R_TextureAnim( texture_t *b )
|
||||
speed = 10;
|
||||
else speed = 20;
|
||||
|
||||
reletive = (int)(gpGlobals->time * speed) % base->anim_total;
|
||||
reletive = (int)(gp_cl->time * speed) % base->anim_total;
|
||||
}
|
||||
|
||||
|
||||
@@ -500,7 +500,7 @@ texture_t *R_TextureAnimation( msurface_t *s )
|
||||
speed = 10;
|
||||
else speed = 20;
|
||||
|
||||
reletive = (int)(gpGlobals->time * speed) % base->anim_total;
|
||||
reletive = (int)(gp_cl->time * speed) % base->anim_total;
|
||||
}
|
||||
|
||||
count = 0;
|
||||
@@ -828,8 +828,8 @@ void DrawGLPoly( glpoly_t *p, float xScale, float yScale )
|
||||
flAngle = ( flConveyorSpeed >= 0 ) ? 180 : 0;
|
||||
|
||||
SinCos( flAngle * ( M_PI_F / 180.0f ), &sy, &cy );
|
||||
sOffset = gpGlobals->time * cy * flRate;
|
||||
tOffset = gpGlobals->time * sy * flRate;
|
||||
sOffset = gp_cl->time * cy * flRate;
|
||||
tOffset = gp_cl->time * sy * flRate;
|
||||
|
||||
// make sure that we are positive
|
||||
if( sOffset < 0.0f ) sOffset += 1.0f + -(int)sOffset;
|
||||
@@ -1300,7 +1300,7 @@ void R_DrawTextureChains( void )
|
||||
RI.currententity = CL_GetEntityByIndex( 0 );
|
||||
RI.currentmodel = RI.currententity->model;
|
||||
|
||||
if( ENGINE_GET_PARM( PARM_SKY_SPHERE ) )
|
||||
if( FBitSet( tr.world->flags, FWORLD_SKYSPHERE ) && !FBitSet( tr.world->flags, FWORLD_CUSTOM_SKYBOX ))
|
||||
{
|
||||
pglDisable( GL_TEXTURE_2D );
|
||||
pglColor3f( 1.0f, 1.0f, 1.0f );
|
||||
@@ -1310,7 +1310,7 @@ void R_DrawTextureChains( void )
|
||||
for( s = skychain; s != NULL; s = s->texturechain )
|
||||
R_AddSkyBoxSurface( s );
|
||||
|
||||
if( ENGINE_GET_PARM( PARM_SKY_SPHERE ) )
|
||||
if( FBitSet( tr.world->flags, FWORLD_SKYSPHERE ) && !FBitSet( tr.world->flags, FWORLD_CUSTOM_SKYBOX ))
|
||||
{
|
||||
pglEnable( GL_TEXTURE_2D );
|
||||
if( skychain )
|
||||
@@ -1601,7 +1601,7 @@ void R_DrawBrushModel( cl_entity_t *e )
|
||||
{
|
||||
l = gEngfuncs.GetDynamicLight( k );
|
||||
|
||||
if( l->die < gpGlobals->time || !l->radius )
|
||||
if( l->die < gp_cl->time || !l->radius )
|
||||
continue;
|
||||
|
||||
VectorCopy( l->origin, oldorigin ); // save lightorigin
|
||||
@@ -3774,7 +3774,7 @@ void GL_RebuildLightmaps( void )
|
||||
|
||||
LM_InitBlock();
|
||||
|
||||
for( i = 0; i < ENGINE_GET_PARM( PARM_NUMMODELS ); i++ )
|
||||
for( i = 0; i < gp_cl->nummodels; i++ )
|
||||
{
|
||||
if(( m = CL_ModelHandle( i + 1 )) == NULL )
|
||||
continue;
|
||||
@@ -3818,8 +3818,7 @@ void GL_BuildLightmaps( void )
|
||||
memset( &RI, 0, sizeof( RI ));
|
||||
|
||||
// update the lightmap blocksize
|
||||
if( FBitSet( ENGINE_GET_PARM( PARM_FEATURES ), ENGINE_LARGE_LIGHTMAPS )
|
||||
|| ENGINE_GET_PARM( PARM_WORLD_VERSION ) == QBSP2_VERSION )
|
||||
if( FBitSet( gp_host->features, ENGINE_LARGE_LIGHTMAPS ) || tr.world->version == QBSP2_VERSION )
|
||||
tr.block_size = BLOCK_SIZE_MAX;
|
||||
else tr.block_size = BLOCK_SIZE_DEFAULT;
|
||||
|
||||
@@ -3839,7 +3838,7 @@ void GL_BuildLightmaps( void )
|
||||
|
||||
LM_InitBlock();
|
||||
|
||||
for( i = 0; i < ENGINE_GET_PARM( PARM_NUMMODELS ); i++ )
|
||||
for( i = 0; i < gp_cl->nummodels; i++ )
|
||||
{
|
||||
if(( m = CL_ModelHandle( i + 1 )) == NULL )
|
||||
continue;
|
||||
|
||||
@@ -430,7 +430,7 @@ mspriteframe_t *R_GetSpriteFrame( const model_t *pModel, int frame, float yaw )
|
||||
|
||||
// when loading in Mod_LoadSpriteGroup, we guaranteed all interval values
|
||||
// are positive, so we don't have to worry about division by zero
|
||||
targettime = gpGlobals->time - ((int)( gpGlobals->time / fullinterval )) * fullinterval;
|
||||
targettime = gp_cl->time - ((int)( gp_cl->time / fullinterval )) * fullinterval;
|
||||
|
||||
for( i = 0; i < (numframes - 1); i++ )
|
||||
{
|
||||
@@ -494,25 +494,25 @@ float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe,
|
||||
// this can be happens when rendering switched between single and angled frames
|
||||
// or change model on replace delta-entity
|
||||
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
||||
ent->latched.sequencetime = gpGlobals->time;
|
||||
ent->latched.sequencetime = gp_cl->time;
|
||||
lerpFrac = 1.0f;
|
||||
}
|
||||
|
||||
if( ent->latched.sequencetime < gpGlobals->time )
|
||||
if( ent->latched.sequencetime < gp_cl->time )
|
||||
{
|
||||
if( frame != ent->latched.prevblending[1] )
|
||||
{
|
||||
ent->latched.prevblending[0] = ent->latched.prevblending[1];
|
||||
ent->latched.prevblending[1] = frame;
|
||||
ent->latched.sequencetime = gpGlobals->time;
|
||||
ent->latched.sequencetime = gp_cl->time;
|
||||
lerpFrac = 0.0f;
|
||||
}
|
||||
else lerpFrac = (gpGlobals->time - ent->latched.sequencetime) * 11.0f;
|
||||
else lerpFrac = (gp_cl->time - ent->latched.sequencetime) * 11.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
||||
ent->latched.sequencetime = gpGlobals->time;
|
||||
ent->latched.sequencetime = gp_cl->time;
|
||||
lerpFrac = 0.0f;
|
||||
}
|
||||
}
|
||||
@@ -526,7 +526,7 @@ float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe,
|
||||
{
|
||||
// reset interpolation on change model
|
||||
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
||||
ent->latched.sequencetime = gpGlobals->time;
|
||||
ent->latched.sequencetime = gp_cl->time;
|
||||
lerpFrac = 0.0f;
|
||||
}
|
||||
|
||||
@@ -541,7 +541,7 @@ float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe,
|
||||
numframes = pspritegroup->numframes;
|
||||
fullinterval = pintervals[numframes-1];
|
||||
jinterval = pintervals[1] - pintervals[0];
|
||||
time = gpGlobals->time;
|
||||
time = gp_cl->time;
|
||||
jtime = 0.0f;
|
||||
|
||||
// when loading in Mod_LoadSpriteGroup, we guaranteed all interval values
|
||||
@@ -580,25 +580,25 @@ float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe,
|
||||
// this can be happens when rendering switched between single and angled frames
|
||||
// or change model on replace delta-entity
|
||||
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
||||
ent->latched.sequencetime = gpGlobals->time;
|
||||
ent->latched.sequencetime = gp_cl->time;
|
||||
lerpFrac = 1.0f;
|
||||
}
|
||||
|
||||
if( ent->latched.sequencetime < gpGlobals->time )
|
||||
if( ent->latched.sequencetime < gp_cl->time )
|
||||
{
|
||||
if( frame != ent->latched.prevblending[1] )
|
||||
{
|
||||
ent->latched.prevblending[0] = ent->latched.prevblending[1];
|
||||
ent->latched.prevblending[1] = frame;
|
||||
ent->latched.sequencetime = gpGlobals->time;
|
||||
ent->latched.sequencetime = gp_cl->time;
|
||||
lerpFrac = 0.0f;
|
||||
}
|
||||
else lerpFrac = (gpGlobals->time - ent->latched.sequencetime) * ent->curstate.framerate;
|
||||
else lerpFrac = (gp_cl->time - ent->latched.sequencetime) * ent->curstate.framerate;
|
||||
}
|
||||
else
|
||||
{
|
||||
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
||||
ent->latched.sequencetime = gpGlobals->time;
|
||||
ent->latched.sequencetime = gp_cl->time;
|
||||
lerpFrac = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,14 +174,14 @@ static void R_StudioSetupTimings( void )
|
||||
if( RI.drawWorld )
|
||||
{
|
||||
// synchronize with server time
|
||||
g_studio.time = gpGlobals->time;
|
||||
g_studio.frametime = gpGlobals->time - gpGlobals->oldtime;
|
||||
g_studio.time = gp_cl->time;
|
||||
g_studio.frametime = gp_cl->time - gp_cl->oldtime;
|
||||
}
|
||||
else
|
||||
{
|
||||
// menu stuff
|
||||
g_studio.time = gpGlobals->realtime;
|
||||
g_studio.frametime = gpGlobals->frametime;
|
||||
g_studio.time = gp_host->realtime;
|
||||
g_studio.frametime = gp_host->frametime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -424,8 +424,8 @@ pfnGetEngineTimes
|
||||
static void pfnGetEngineTimes( int *framecount, double *current, double *old )
|
||||
{
|
||||
if( framecount ) *framecount = tr.realframecount;
|
||||
if( current ) *current = gpGlobals->time;
|
||||
if( old ) *old = gpGlobals->oldtime;
|
||||
if( current ) *current = gp_cl->time;
|
||||
if( old ) *old = gp_cl->oldtime;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -596,12 +596,12 @@ void R_StudioSetUpTransform( cl_entity_t *e )
|
||||
VectorCopy( e->angles, angles );
|
||||
|
||||
// interpolate monsters position (moved into UpdateEntityFields by user request)
|
||||
if( e->curstate.movetype == MOVETYPE_STEP && !FBitSet( ENGINE_GET_PARM( PARM_FEATURES ), ENGINE_COMPUTE_STUDIO_LERP ))
|
||||
if( e->curstate.movetype == MOVETYPE_STEP && !FBitSet( gp_host->features, ENGINE_COMPUTE_STUDIO_LERP ))
|
||||
{
|
||||
R_StudioLerpMovement( e, g_studio.time, origin, angles );
|
||||
}
|
||||
|
||||
if( !FBitSet( ENGINE_GET_PARM( PARM_FEATURES ), ENGINE_COMPENSATE_QUAKE_BUG ))
|
||||
if( !FBitSet( gp_host->features, ENGINE_COMPENSATE_QUAKE_BUG ))
|
||||
angles[PITCH] = -angles[PITCH]; // stupid quake bug
|
||||
|
||||
// don't rotate clients, only aim
|
||||
@@ -1324,7 +1324,7 @@ R_StudioDynamicLight
|
||||
*/
|
||||
void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight )
|
||||
{
|
||||
movevars_t *mv = gEngfuncs.pfnGetMoveVars();
|
||||
movevars_t *mv = tr.movevars;
|
||||
vec3_t lightDir, vecSrc, vecEnd;
|
||||
vec3_t origin, dist, finalLight;
|
||||
float add, radius, total;
|
||||
@@ -1360,7 +1360,7 @@ void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight )
|
||||
msurface_t *psurf = NULL;
|
||||
pmtrace_t trace;
|
||||
|
||||
if( FBitSet( ENGINE_GET_PARM( PARM_FEATURES ), ENGINE_WRITE_LARGE_COORD ))
|
||||
if( FBitSet( gp_host->features, ENGINE_WRITE_LARGE_COORD ))
|
||||
{
|
||||
vecEnd[0] = origin[0] - mv->skyvec_x * 65536.0f;
|
||||
vecEnd[1] = origin[1] - mv->skyvec_y * 65536.0f;
|
||||
@@ -2242,8 +2242,7 @@ static void R_StudioDrawPoints( void )
|
||||
|
||||
g_studio.numverts = g_studio.numelems = 0;
|
||||
|
||||
// safety bounding the skinnum
|
||||
m_skinnum = bound( 0, RI.currententity->curstate.skin, ( m_pStudioHeader->numskinfamilies - 1 ));
|
||||
m_skinnum = RI.currententity->curstate.skin;
|
||||
ptexture = (mstudiotexture_t *)((byte *)m_pStudioHeader + m_pStudioHeader->textureindex);
|
||||
pvertbone = ((byte *)m_pStudioHeader + m_pSubModel->vertinfoindex);
|
||||
pnormbone = ((byte *)m_pStudioHeader + m_pSubModel->norminfoindex);
|
||||
@@ -2253,7 +2252,8 @@ static void R_StudioDrawPoints( void )
|
||||
pstudionorms = (vec3_t *)((byte *)m_pStudioHeader + m_pSubModel->normindex);
|
||||
|
||||
pskinref = (short *)((byte *)m_pStudioHeader + m_pStudioHeader->skinindex);
|
||||
if( m_skinnum != 0 ) pskinref += (m_skinnum * m_pStudioHeader->numskinref);
|
||||
if( m_skinnum > 0 && m_skinnum < m_pStudioHeader->numskinfamilies )
|
||||
pskinref += (m_skinnum * m_pStudioHeader->numskinref);
|
||||
|
||||
if( FBitSet( m_pStudioHeader->flags, STUDIO_HAS_BONEWEIGHTS ) && m_pSubModel->blendvertinfoindex != 0 && m_pSubModel->blendnorminfoindex != 0 )
|
||||
{
|
||||
@@ -2756,7 +2756,7 @@ static void R_StudioClientEvents( void )
|
||||
|
||||
ClearBits( e->curstate.effects, EF_MUZZLEFLASH );
|
||||
VectorCopy( e->attachment[0], el->origin );
|
||||
el->die = gpGlobals->time + 0.05f;
|
||||
el->die = gp_cl->time + 0.05f;
|
||||
el->color.r = 255;
|
||||
el->color.g = 192;
|
||||
el->color.b = 64;
|
||||
@@ -2772,7 +2772,7 @@ static void R_StudioClientEvents( void )
|
||||
return;
|
||||
|
||||
end = R_StudioEstimateFrame( e, pseqdesc, g_studio.time );
|
||||
start = end - e->curstate.framerate * gpGlobals->frametime * pseqdesc->fps;
|
||||
start = end - e->curstate.framerate * gp_host->frametime * pseqdesc->fps;
|
||||
pevent = (mstudioevent_t *)((byte *)m_pStudioHeader + pseqdesc->eventindex);
|
||||
|
||||
if( e->latched.sequencetime == e->curstate.animtime )
|
||||
@@ -3297,7 +3297,7 @@ static int R_StudioDrawPlayer( int flags, entity_state_t *pplayer )
|
||||
|
||||
m_nPlayerIndex = pplayer->number - 1;
|
||||
|
||||
if( m_nPlayerIndex < 0 || m_nPlayerIndex >= ENGINE_GET_PARM( PARM_MAX_CLIENTS ) )
|
||||
if( m_nPlayerIndex < 0 || m_nPlayerIndex >= gp_cl->maxclients )
|
||||
return 0;
|
||||
|
||||
RI.currentmodel = R_StudioSetupPlayerModel( m_nPlayerIndex );
|
||||
@@ -3379,7 +3379,7 @@ static int R_StudioDrawPlayer( int flags, entity_state_t *pplayer )
|
||||
RI.currententity->curstate.body = 255;
|
||||
}
|
||||
|
||||
if( !( !gpGlobals->developer && ENGINE_GET_PARM( PARM_MAX_CLIENTS ) == 1 ) && ( RI.currentmodel == RI.currententity->model ))
|
||||
if( !( !gpGlobals->developer && gp_cl->maxclients == 1 ) && ( RI.currentmodel == RI.currententity->model ))
|
||||
RI.currententity->curstate.body = 1; // force helmet
|
||||
|
||||
lighting.plightvec = dir;
|
||||
@@ -3442,7 +3442,7 @@ static int R_StudioDrawModel( int flags )
|
||||
int result;
|
||||
|
||||
if( RI.currententity->curstate.renderamt <= 0 ||
|
||||
RI.currententity->curstate.renderamt > ENGINE_GET_PARM( PARM_MAX_CLIENTS ) )
|
||||
RI.currententity->curstate.renderamt > gp_cl->maxclients )
|
||||
return 0;
|
||||
|
||||
// get copy of player
|
||||
@@ -3527,7 +3527,7 @@ static int R_StudioDrawModel( int flags )
|
||||
R_StudioDrawModelInternal
|
||||
=================
|
||||
*/
|
||||
void R_StudioDrawModelInternal( cl_entity_t *e, int flags )
|
||||
static void R_StudioDrawModelInternal( cl_entity_t *e, int flags )
|
||||
{
|
||||
if( !RI.drawWorld )
|
||||
{
|
||||
@@ -3560,22 +3560,42 @@ void R_DrawStudioModel( cl_entity_t *e )
|
||||
{
|
||||
R_StudioDrawModelInternal( e, STUDIO_RENDER|STUDIO_EVENTS );
|
||||
}
|
||||
else
|
||||
else if( e->curstate.movetype == MOVETYPE_FOLLOW && e->curstate.aiment > 0 )
|
||||
{
|
||||
if( e->curstate.movetype == MOVETYPE_FOLLOW && e->curstate.aiment > 0 )
|
||||
{
|
||||
cl_entity_t *parent = CL_GetEntityByIndex( e->curstate.aiment );
|
||||
cl_entity_t *parent = CL_GetEntityByIndex( e->curstate.aiment ), **entities;
|
||||
uint i, num_entities;
|
||||
|
||||
if( parent && parent->model && parent->model->type == mod_studio )
|
||||
{
|
||||
RI.currententity = parent;
|
||||
R_StudioDrawModelInternal( RI.currententity, 0 );
|
||||
VectorCopy( parent->curstate.origin, e->curstate.origin );
|
||||
VectorCopy( parent->origin, e->origin );
|
||||
RI.currententity = e;
|
||||
}
|
||||
if( !parent || !parent->model || parent->model->type != mod_studio )
|
||||
return;
|
||||
|
||||
if( R_OpaqueEntity( parent ))
|
||||
{
|
||||
entities = tr.draw_list->solid_entities;
|
||||
num_entities = tr.draw_list->num_solid_entities;
|
||||
}
|
||||
else
|
||||
{
|
||||
entities = tr.draw_list->trans_entities;
|
||||
num_entities = tr.draw_list->num_solid_entities;
|
||||
}
|
||||
|
||||
for( i = 0; i < num_entities; i++ )
|
||||
{
|
||||
if( (*entities)[i].index != e->curstate.aiment )
|
||||
continue;
|
||||
|
||||
RI.currententity = &(*entities)[i];
|
||||
R_StudioDrawModelInternal( RI.currententity, 0 );
|
||||
VectorCopy( RI.currententity->curstate.origin, e->curstate.origin );
|
||||
VectorCopy( RI.currententity->origin, e->origin );
|
||||
RI.currententity = e;
|
||||
|
||||
R_StudioDrawModelInternal( e, STUDIO_RENDER|STUDIO_EVENTS );
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
R_StudioDrawModelInternal( e, STUDIO_RENDER|STUDIO_EVENTS );
|
||||
}
|
||||
}
|
||||
@@ -3607,7 +3627,7 @@ void R_RunViewmodelEvents( void )
|
||||
|
||||
R_StudioSetupTimings();
|
||||
|
||||
gEngfuncs.GetPredictedOrigin( simorg );
|
||||
VectorCopy( gp_cl->simorg, simorg );
|
||||
for( i = 0; i < 4; i++ )
|
||||
VectorCopy( simorg, RI.currententity->attachment[i] );
|
||||
RI.currentmodel = RI.currententity->model;
|
||||
@@ -3756,7 +3776,7 @@ static void R_StudioLoadTexture( model_t *mod, studiohdr_t *phdr, mstudiotexture
|
||||
gEngfuncs.Image_SetMDLPointer((byte *)phdr + ptexture->index);
|
||||
size = sizeof( mstudiotexture_t ) + ptexture->width * ptexture->height + 768;
|
||||
|
||||
if( FBitSet( ENGINE_GET_PARM( PARM_FEATURES ), ENGINE_IMPROVED_LINETRACE ) && FBitSet( ptexture->flags, STUDIO_NF_MASKED ))
|
||||
if( FBitSet( gp_host->features, ENGINE_IMPROVED_LINETRACE ) && FBitSet( ptexture->flags, STUDIO_NF_MASKED ))
|
||||
flags |= TF_KEEP_SOURCE; // Paranoia2 texture alpha-tracing
|
||||
|
||||
// build the texname
|
||||
|
||||
@@ -332,7 +332,7 @@ void R_AddSkyBoxSurface( msurface_t *fa )
|
||||
float *v;
|
||||
int i;
|
||||
|
||||
if( ENGINE_GET_PARM( PARM_SKY_SPHERE ) && fa->polys && !tr.fCustomSkybox )
|
||||
if( FBitSet( tr.world->flags, FWORLD_SKYSPHERE ) && fa->polys && !FBitSet( tr.world->flags, FWORLD_CUSTOM_SKYBOX ))
|
||||
{
|
||||
glpoly_t *p = fa->polys;
|
||||
|
||||
@@ -376,7 +376,7 @@ void R_UnloadSkybox( void )
|
||||
tr.skyboxbasenum = SKYBOX_BASE_NUM; // set skybox base (to let some mods load hi-res skyboxes)
|
||||
|
||||
memset( tr.skyboxTextures, 0, sizeof( tr.skyboxTextures ));
|
||||
tr.fCustomSkybox = false;
|
||||
ClearBits( tr.world->flags, FWORLD_CUSTOM_SKYBOX );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -478,7 +478,7 @@ void R_SetupSky( const char *skyboxname )
|
||||
|
||||
if( i == 6 )
|
||||
{
|
||||
tr.fCustomSkybox = true;
|
||||
SetBits( tr.world->flags, FWORLD_CUSTOM_SKYBOX );
|
||||
gEngfuncs.Con_DPrintf( "done\n" );
|
||||
return; // loaded
|
||||
}
|
||||
@@ -526,7 +526,7 @@ static void R_CloudTexCoord( vec3_t v, float speed, float *s, float *t )
|
||||
float length, speedscale;
|
||||
vec3_t dir;
|
||||
|
||||
speedscale = gpGlobals->time * speed;
|
||||
speedscale = gp_cl->time * speed;
|
||||
speedscale -= (int)speedscale & ~127;
|
||||
|
||||
VectorSubtract( v, RI.vieworg, dir );
|
||||
@@ -813,8 +813,8 @@ void EmitWaterPolys( msurface_t *warp, qboolean reverse )
|
||||
{
|
||||
if( waveHeight )
|
||||
{
|
||||
nv = r_turbsin[(int)(gpGlobals->time * 160.0f + v[1] + v[0]) & 255] + 8.0f;
|
||||
nv = (r_turbsin[(int)(v[0] * 5.0f + gpGlobals->time * 171.0f - v[1]) & 255] + 8.0f ) * 0.8f + nv;
|
||||
nv = r_turbsin[(int)(gp_cl->time * 160.0f + v[1] + v[0]) & 255] + 8.0f;
|
||||
nv = (r_turbsin[(int)(v[0] * 5.0f + gp_cl->time * 171.0f - v[1]) & 255] + 8.0f ) * 0.8f + nv;
|
||||
nv = nv * waveHeight + v[2];
|
||||
}
|
||||
else nv = v[2];
|
||||
@@ -824,8 +824,8 @@ void EmitWaterPolys( msurface_t *warp, qboolean reverse )
|
||||
|
||||
if( !r_ripple.value )
|
||||
{
|
||||
s = os + r_turbsin[(int)((ot * 0.125f + gpGlobals->time) * TURBSCALE) & 255];
|
||||
t = ot + r_turbsin[(int)((os * 0.125f + gpGlobals->time) * TURBSCALE) & 255];
|
||||
s = os + r_turbsin[(int)((ot * 0.125f + gp_cl->time) * TURBSCALE) & 255];
|
||||
t = ot + r_turbsin[(int)((os * 0.125f + gp_cl->time) * TURBSCALE) & 255];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -865,7 +865,7 @@ void R_ResetRipples( void )
|
||||
{
|
||||
g_ripple.curbuf = g_ripple.buf[0];
|
||||
g_ripple.oldbuf = g_ripple.buf[1];
|
||||
g_ripple.time = g_ripple.oldtime = gpGlobals->time - 0.1;
|
||||
g_ripple.time = g_ripple.oldtime = gp_cl->time - 0.1;
|
||||
memset( g_ripple.buf, 0, sizeof( g_ripple.buf ));
|
||||
}
|
||||
|
||||
@@ -936,14 +936,14 @@ static int MostSignificantBit( unsigned int v )
|
||||
|
||||
void R_AnimateRipples( void )
|
||||
{
|
||||
double frametime = gpGlobals->time - g_ripple.time;
|
||||
double frametime = gp_cl->time - g_ripple.time;
|
||||
|
||||
g_ripple.update = r_ripple.value && frametime >= r_ripple_updatetime.value;
|
||||
|
||||
if( !g_ripple.update )
|
||||
return;
|
||||
|
||||
g_ripple.time = gpGlobals->time;
|
||||
g_ripple.time = gp_cl->time;
|
||||
|
||||
R_SwapBufs();
|
||||
|
||||
|
||||
@@ -611,7 +611,7 @@ void R_DrawBeamFollow( BEAM *pbeam, float frametime )
|
||||
if( pnew )
|
||||
{
|
||||
VectorCopy( pbeam->source, pnew->org );
|
||||
pnew->die = gpGlobals->time + pbeam->amplitude;
|
||||
pnew->die = gp_cl->time + pbeam->amplitude;
|
||||
VectorClear( pnew->vel );
|
||||
|
||||
pnew->next = particles;
|
||||
@@ -658,7 +658,7 @@ void R_DrawBeamFollow( BEAM *pbeam, float frametime )
|
||||
VectorMA( delta, -pbeam->width, normal, last2 );
|
||||
|
||||
div = 1.0f / pbeam->amplitude;
|
||||
fraction = ( pbeam->die - gpGlobals->time ) * div;
|
||||
fraction = ( pbeam->die - gp_cl->time ) * div;
|
||||
|
||||
vLast = 0.0f;
|
||||
vStep = 1.0f;
|
||||
@@ -694,7 +694,7 @@ void R_DrawBeamFollow( BEAM *pbeam, float frametime )
|
||||
|
||||
if( particles->next != NULL )
|
||||
{
|
||||
fraction = (particles->die - gpGlobals->time) * div;
|
||||
fraction = (particles->die - gp_cl->time) * div;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -880,12 +880,8 @@ static qboolean R_BeamComputePoint( int beamEnt, vec3_t pt )
|
||||
// get attachment
|
||||
if( attach > 0 )
|
||||
VectorCopy( ent->attachment[attach - 1], pt );
|
||||
else if( ent->index == ENGINE_GET_PARM( PARM_PLAYER_INDEX ) )
|
||||
{
|
||||
vec3_t simorg;
|
||||
gEngfuncs.GetPredictedOrigin( simorg );
|
||||
VectorCopy( simorg, pt );
|
||||
}
|
||||
else if( ent->index == ( gp_cl->playernum + 1 ))
|
||||
VectorCopy( gp_cl->simorg, pt );
|
||||
else VectorCopy( ent->origin, pt );
|
||||
|
||||
return true;
|
||||
@@ -929,7 +925,7 @@ qboolean R_BeamRecomputeEndpoints( BEAM *pbeam )
|
||||
else if( !FBitSet( pbeam->flags, FBEAM_FOREVER ))
|
||||
{
|
||||
ClearBits( pbeam->flags, FBEAM_ENDENTITY );
|
||||
pbeam->die = gpGlobals->time;
|
||||
pbeam->die = gp_cl->time;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@@ -962,7 +958,7 @@ void R_BeamDraw( BEAM *pbeam, float frametime )
|
||||
if( !model || model->type != mod_sprite )
|
||||
{
|
||||
pbeam->flags &= ~FBEAM_ISACTIVE; // force to ignore
|
||||
pbeam->die = gpGlobals->time;
|
||||
pbeam->die = gp_cl->time;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1020,7 +1016,7 @@ void R_BeamDraw( BEAM *pbeam, float frametime )
|
||||
if( pbeam->flags & ( FBEAM_FADEIN|FBEAM_FADEOUT ))
|
||||
{
|
||||
// update life cycle
|
||||
pbeam->t = pbeam->freq + ( pbeam->die - gpGlobals->time );
|
||||
pbeam->t = pbeam->freq + ( pbeam->die - gp_cl->time );
|
||||
if( pbeam->t != 0.0f ) pbeam->t = 1.0f - pbeam->freq / pbeam->t;
|
||||
}
|
||||
|
||||
@@ -1068,7 +1064,7 @@ void R_BeamDraw( BEAM *pbeam, float frametime )
|
||||
|
||||
TriRenderMode( FBitSet( pbeam->flags, FBEAM_SOLID ) ? kRenderNormal : kRenderTransAdd );
|
||||
|
||||
if( !TriSpriteTexture( model, (int)(pbeam->frame + pbeam->frameRate * gpGlobals->time) % pbeam->frameCount ))
|
||||
if( !TriSpriteTexture( model, (int)(pbeam->frame + pbeam->frameRate * gp_cl->time) % pbeam->frameCount ))
|
||||
{
|
||||
ClearBits( pbeam->flags, FBEAM_ISACTIVE );
|
||||
return;
|
||||
@@ -1173,8 +1169,8 @@ static void R_BeamSetup( BEAM *pbeam, vec3_t start, vec3_t end, int modelIndex,
|
||||
VectorCopy( end, pbeam->target );
|
||||
VectorSubtract( end, start, pbeam->delta );
|
||||
|
||||
pbeam->freq = speed * gpGlobals->time;
|
||||
pbeam->die = life + gpGlobals->time;
|
||||
pbeam->freq = speed * gp_cl->time;
|
||||
pbeam->die = life + gp_cl->time;
|
||||
pbeam->amplitude = amplitude;
|
||||
pbeam->brightness = brightness;
|
||||
pbeam->width = width;
|
||||
@@ -1304,7 +1300,7 @@ void GAME_EXPORT CL_DrawBeams( int fTrans, BEAM *active_beams )
|
||||
if( !fTrans && !FBitSet( pBeam->flags, FBEAM_SOLID ))
|
||||
continue;
|
||||
|
||||
R_BeamDraw( pBeam, gpGlobals->time - gpGlobals->oldtime );
|
||||
R_BeamDraw( pBeam, gp_cl->time - gp_cl->oldtime );
|
||||
}
|
||||
|
||||
//pglShadeModel( GL_FLAT );
|
||||
|
||||
@@ -950,7 +950,7 @@ void R_RenderWorld (void)
|
||||
|
||||
// auto cycle the world frame for texture animation
|
||||
RI.currententity = CL_GetEntityByIndex(0);
|
||||
//RI.currententity->frame = (int)(gpGlobals->time*2);
|
||||
//RI.currententity->frame = (int)(gp_cl->time*2);
|
||||
|
||||
VectorCopy (RI.vieworg, tr.modelorg);
|
||||
RI.currentmodel = WORLDMODEL;
|
||||
|
||||
@@ -17,6 +17,8 @@ GNU General Public License for more details.
|
||||
|
||||
ref_api_t gEngfuncs;
|
||||
ref_globals_t *gpGlobals;
|
||||
ref_client_t *gp_cl;
|
||||
ref_host_t *gp_host;
|
||||
gl_globals_t tr;
|
||||
ref_speeds_t r_stats;
|
||||
poolhandle_t r_temppool;
|
||||
@@ -169,7 +171,7 @@ static int GL_RefGetParm( int parm, int arg )
|
||||
case PARM_STENCIL_ACTIVE:
|
||||
return 0; //glState.stencilEnabled;
|
||||
case PARM_SKY_SPHERE:
|
||||
return ENGINE_GET_PARM_( parm, arg ) && !tr.fCustomSkybox;
|
||||
return 0; // ref_soft doesn't support sky sphere
|
||||
default:
|
||||
return ENGINE_GET_PARM_( parm, arg );
|
||||
}
|
||||
@@ -564,5 +566,8 @@ int EXPORT GAME_EXPORT GetRefAPI( int version, ref_interface_t *funcs, ref_api_t
|
||||
memcpy( &gEngfuncs, engfuncs, sizeof( ref_api_t ));
|
||||
gpGlobals = globals;
|
||||
|
||||
gp_cl = (ref_client_t *)ENGINE_GET_PARM( PARM_GET_CLIENT_PTR );
|
||||
gp_host = (ref_host_t *)ENGINE_GET_PARM( PARM_GET_HOST_PTR );
|
||||
|
||||
return REF_API_VERSION;
|
||||
}
|
||||
|
||||
@@ -864,9 +864,9 @@ void D_CalcGradients (msurface_t *pface)
|
||||
{
|
||||
|
||||
if(pface->flags & SURF_DRAWTURB)
|
||||
sadjust += 0x10000 * (-128 * ( (gpGlobals->time * 0.25f) - (int)(gpGlobals->time * 0.25f) ));
|
||||
sadjust += 0x10000 * (-128 * ( (gp_cl->time * 0.25f) - (int)(gp_cl->time * 0.25f) ));
|
||||
else
|
||||
sadjust += 0x10000 * (-128 * ( (gpGlobals->time * 0.77f) - (int)(gpGlobals->time * 0.77f) ));
|
||||
sadjust += 0x10000 * (-128 * ( (gp_cl->time * 0.77f) - (int)(gp_cl->time * 0.77f) ));
|
||||
bbextents = ((pface->extents[0] << 16) >> miplevel) - 1;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -39,7 +39,7 @@ void GAME_EXPORT CL_RunLightStyles( void )
|
||||
{
|
||||
int i, k, flight, clight;
|
||||
float l, lerpfrac, backlerp;
|
||||
float frametime = (gpGlobals->time - gpGlobals->oldtime);
|
||||
float frametime = (gp_cl->time - gp_cl->oldtime);
|
||||
float scale;
|
||||
lightstyle_t *ls;
|
||||
|
||||
@@ -58,7 +58,7 @@ void GAME_EXPORT CL_RunLightStyles( void )
|
||||
continue;
|
||||
}
|
||||
|
||||
if( !ENGINE_GET_PARM( PARAM_GAMEPAUSED ) && frametime <= 0.1f )
|
||||
if( !gp_cl->paused && frametime <= 0.1f )
|
||||
ls->time += frametime; // evaluate local time
|
||||
|
||||
flight = (int)Q_floor( ls->time * 10 );
|
||||
@@ -163,7 +163,7 @@ void R_PushDlights( void )
|
||||
{
|
||||
l = gEngfuncs.GetDynamicLight( i );
|
||||
|
||||
if( l->die < gpGlobals->time || !l->radius )
|
||||
if( l->die < gp_cl->time || !l->radius )
|
||||
continue;
|
||||
|
||||
//if( GL_FrustumCullSphere( &RI.frustum, l->origin, l->radius, 15 ))
|
||||
|
||||
@@ -78,10 +78,10 @@ extern poolhandle_t r_temppool;
|
||||
#define RP_NONVIEWERREF (RP_ENVVIEW)
|
||||
#define R_ModelOpaque( rm ) ( rm == kRenderNormal )
|
||||
#define R_StaticEntity( ent ) ( VectorIsNull( ent->origin ) && VectorIsNull( ent->angles ))
|
||||
#define RP_LOCALCLIENT( e ) ((e) != NULL && (e)->index == gEngfuncs.GetPlayerIndex() && e->player )
|
||||
#define RP_LOCALCLIENT( e ) ((e) != NULL && (e)->index == ( gp_cl->playernum + 1 ) && e->player )
|
||||
#define RP_NORMALPASS() ( FBitSet( RI.params, RP_NONVIEWERREF ) == 0 )
|
||||
|
||||
#define CL_IsViewEntityLocalPlayer() ( ENGINE_GET_PARM( PARM_VIEWENT_INDEX ) == ENGINE_GET_PARM( PARM_PLAYER_INDEX ) )
|
||||
#define CL_IsViewEntityLocalPlayer() ( gp_cl->viewentity == ( gp_cl->playernum + 1 ))
|
||||
|
||||
#define CULL_VISIBLE 0 // not culled
|
||||
#define CULL_BACKSIDE 1 // backside of transparent wall
|
||||
@@ -289,7 +289,6 @@ typedef struct
|
||||
// cull info
|
||||
vec3_t modelorg; // relative to viewpoint
|
||||
|
||||
qboolean fCustomSkybox;
|
||||
int sample_size;
|
||||
uint sample_bits;
|
||||
qboolean map_unload;
|
||||
@@ -297,7 +296,6 @@ typedef struct
|
||||
// get from engine
|
||||
cl_entity_t *entities;
|
||||
movevars_t *movevars;
|
||||
model_t **models;
|
||||
color24 *palette;
|
||||
cl_entity_t *viewent;
|
||||
|
||||
@@ -478,6 +476,7 @@ void R_SetupRefParams( const struct ref_viewpass_s *rvp );
|
||||
void R_TranslateForEntity( cl_entity_t *e );
|
||||
void R_RotateForEntity( cl_entity_t *e );
|
||||
void R_SetupGL( qboolean set_gl_state );
|
||||
qboolean R_OpaqueEntity( cl_entity_t *ent );
|
||||
void R_AllowFog( qboolean allowed );
|
||||
void R_SetupFrustum( void );
|
||||
void R_FindViewLeaf( void );
|
||||
@@ -676,25 +675,33 @@ void TriBrightness( float brightness );
|
||||
#define ENGINE_GET_PARM_ (*gEngfuncs.EngineGetParm)
|
||||
#define ENGINE_GET_PARM( parm ) ENGINE_GET_PARM_( (parm), 0 )
|
||||
|
||||
extern ref_api_t gEngfuncs;
|
||||
extern ref_globals_t *gpGlobals;
|
||||
extern ref_client_t *gp_cl;
|
||||
extern ref_host_t *gp_host;
|
||||
|
||||
DECLARE_ENGINE_SHARED_CVAR_LIST()
|
||||
|
||||
//
|
||||
// helper funcs
|
||||
//
|
||||
static inline cl_entity_t *CL_GetEntityByIndex( int index )
|
||||
{
|
||||
if( unlikely( index < 0 || index >= tr.max_entities || !tr.entities ))
|
||||
return NULL;
|
||||
|
||||
return &tr.entities[index];
|
||||
}
|
||||
|
||||
static inline model_t *CL_ModelHandle( int index )
|
||||
{
|
||||
return tr.models[index];
|
||||
if( unlikely( index < 0 || index >= gp_cl->nummodels ))
|
||||
return NULL;
|
||||
|
||||
return gp_cl->models[index];
|
||||
}
|
||||
|
||||
#define WORLDMODEL (tr.models[1])
|
||||
|
||||
extern ref_api_t gEngfuncs;
|
||||
extern ref_globals_t *gpGlobals;
|
||||
|
||||
DECLARE_ENGINE_SHARED_CVAR_LIST()
|
||||
#define WORLDMODEL (gp_cl->models[1])
|
||||
|
||||
// todo: gl_cull.c
|
||||
#define R_CullModel(...) 0
|
||||
|
||||
@@ -145,7 +145,7 @@ R_OpaqueEntity
|
||||
Opaque entity can be brush or studio model but sprite
|
||||
===============
|
||||
*/
|
||||
static qboolean R_OpaqueEntity( cl_entity_t *ent )
|
||||
qboolean R_OpaqueEntity( cl_entity_t *ent )
|
||||
{
|
||||
int rendermode = R_GetEntityRenderMode( ent );
|
||||
|
||||
@@ -441,8 +441,8 @@ void R_SetupFrustum( void )
|
||||
|
||||
/*if( RP_NORMALPASS() && ( ENGINE_GET_PARM( PARM_WATER_LEVEL ) >= 3 ) && ENGINE_GET_PARM( PARM_QUAKE_COMPATIBLE ))
|
||||
{
|
||||
RI.fov_x = atan( tan( DEG2RAD( RI.fov_x ) / 2 ) * ( 0.97 + sin( gpGlobals->time * 1.5 ) * 0.03 )) * 2 / (M_PI / 180.0);
|
||||
RI.fov_y = atan( tan( DEG2RAD( RI.fov_y ) / 2 ) * ( 1.03 - sin( gpGlobals->time * 1.5 ) * 0.03 )) * 2 / (M_PI / 180.0);
|
||||
RI.fov_x = atan( tan( DEG2RAD( RI.fov_x ) / 2 ) * ( 0.97 + sin( gp_cl->time * 1.5 ) * 0.03 )) * 2 / (M_PI / 180.0);
|
||||
RI.fov_y = atan( tan( DEG2RAD( RI.fov_y ) / 2 ) * ( 1.03 - sin( gp_cl->time * 1.5 ) * 0.03 )) * 2 / (M_PI / 180.0);
|
||||
}*/
|
||||
|
||||
// build the transformation matrix for the given view angles
|
||||
@@ -1171,7 +1171,7 @@ void R_DrawBEntitiesOnList (void)
|
||||
dlight_t *l = gEngfuncs.GetDynamicLight( k );
|
||||
vec3_t origin_l, oldorigin;
|
||||
|
||||
if( l->die < gpGlobals->time || !l->radius )
|
||||
if( l->die < gp_cl->time || !l->radius )
|
||||
continue;
|
||||
|
||||
VectorCopy( l->origin, oldorigin ); // save lightorigin
|
||||
@@ -1326,7 +1326,7 @@ void R_DrawBrushModel(cl_entity_t *pent)
|
||||
dlight_t *l = gEngfuncs.GetDynamicLight( k );
|
||||
vec3_t origin_l, oldorigin;
|
||||
|
||||
if( l->die < gpGlobals->time || !l->radius )
|
||||
if( l->die < gp_cl->time || !l->radius )
|
||||
continue;
|
||||
|
||||
VectorCopy( l->origin, oldorigin ); // save lightorigin
|
||||
@@ -1561,7 +1561,7 @@ void GAME_EXPORT R_RenderScene( void )
|
||||
|
||||
// frametime is valid only for normal pass
|
||||
if( RP_NORMALPASS( ))
|
||||
tr.frametime = gpGlobals->time - gpGlobals->oldtime;
|
||||
tr.frametime = gp_cl->time - gp_cl->oldtime;
|
||||
else tr.frametime = 0.0;
|
||||
|
||||
// begin a new frame
|
||||
@@ -1939,10 +1939,9 @@ qboolean GAME_EXPORT R_Init( void )
|
||||
}
|
||||
|
||||
// see R_ProcessEntData for tr.entities initialization
|
||||
tr.models = gEngfuncs.pfnGetModels();
|
||||
tr.movevars = gEngfuncs.pfnGetMoveVars();
|
||||
tr.palette = gEngfuncs.CL_GetPaletteColor();
|
||||
tr.viewent = gEngfuncs.GetViewModel();
|
||||
tr.movevars = (movevars_t *)ENGINE_GET_PARM( PARM_GET_MOVEVARS_PTR );
|
||||
tr.palette = (color24 *)ENGINE_GET_PARM( PARM_GET_PALETTE_PTR );
|
||||
tr.viewent = (cl_entity_t *)ENGINE_GET_PARM( PARM_GET_VIEWENT_PTR );
|
||||
|
||||
R_InitBlit( glblit );
|
||||
|
||||
@@ -1985,16 +1984,16 @@ int CL_FxBlend( cl_entity_t *e )
|
||||
switch( e->curstate.renderfx )
|
||||
{
|
||||
case kRenderFxPulseSlowWide:
|
||||
blend = e->curstate.renderamt + 0x40 * sin( gpGlobals->time * 2 + offset );
|
||||
blend = e->curstate.renderamt + 0x40 * sin( gp_cl->time * 2 + offset );
|
||||
break;
|
||||
case kRenderFxPulseFastWide:
|
||||
blend = e->curstate.renderamt + 0x40 * sin( gpGlobals->time * 8 + offset );
|
||||
blend = e->curstate.renderamt + 0x40 * sin( gp_cl->time * 8 + offset );
|
||||
break;
|
||||
case kRenderFxPulseSlow:
|
||||
blend = e->curstate.renderamt + 0x10 * sin( gpGlobals->time * 2 + offset );
|
||||
blend = e->curstate.renderamt + 0x10 * sin( gp_cl->time * 2 + offset );
|
||||
break;
|
||||
case kRenderFxPulseFast:
|
||||
blend = e->curstate.renderamt + 0x10 * sin( gpGlobals->time * 8 + offset );
|
||||
blend = e->curstate.renderamt + 0x10 * sin( gp_cl->time * 8 + offset );
|
||||
break;
|
||||
case kRenderFxFadeSlow:
|
||||
if( RP_NORMALPASS( ))
|
||||
@@ -2033,27 +2032,27 @@ int CL_FxBlend( cl_entity_t *e )
|
||||
blend = e->curstate.renderamt;
|
||||
break;
|
||||
case kRenderFxStrobeSlow:
|
||||
blend = 20 * sin( gpGlobals->time * 4 + offset );
|
||||
blend = 20 * sin( gp_cl->time * 4 + offset );
|
||||
if( blend < 0 ) blend = 0;
|
||||
else blend = e->curstate.renderamt;
|
||||
break;
|
||||
case kRenderFxStrobeFast:
|
||||
blend = 20 * sin( gpGlobals->time * 16 + offset );
|
||||
blend = 20 * sin( gp_cl->time * 16 + offset );
|
||||
if( blend < 0 ) blend = 0;
|
||||
else blend = e->curstate.renderamt;
|
||||
break;
|
||||
case kRenderFxStrobeFaster:
|
||||
blend = 20 * sin( gpGlobals->time * 36 + offset );
|
||||
blend = 20 * sin( gp_cl->time * 36 + offset );
|
||||
if( blend < 0 ) blend = 0;
|
||||
else blend = e->curstate.renderamt;
|
||||
break;
|
||||
case kRenderFxFlickerSlow:
|
||||
blend = 20 * (sin( gpGlobals->time * 2 ) + sin( gpGlobals->time * 17 + offset ));
|
||||
blend = 20 * (sin( gp_cl->time * 2 ) + sin( gp_cl->time * 17 + offset ));
|
||||
if( blend < 0 ) blend = 0;
|
||||
else blend = e->curstate.renderamt;
|
||||
break;
|
||||
case kRenderFxFlickerFast:
|
||||
blend = 20 * (sin( gpGlobals->time * 16 ) + sin( gpGlobals->time * 23 + offset ));
|
||||
blend = 20 * (sin( gp_cl->time * 16 ) + sin( gp_cl->time * 23 + offset ));
|
||||
if( blend < 0 ) blend = 0;
|
||||
else blend = e->curstate.renderamt;
|
||||
break;
|
||||
|
||||
@@ -86,7 +86,7 @@ void GAME_EXPORT CL_DrawParticles( double frametime, particle_t *cl_active_parti
|
||||
p->color = bound( 0, p->color, 255 );
|
||||
color = tr.palette[p->color];
|
||||
|
||||
alpha = 255 * (p->die - gpGlobals->time) * 16.0f;
|
||||
alpha = 255 * (p->die - gp_cl->time) * 16.0f;
|
||||
if( alpha > 255 || p->type == pt_static )
|
||||
alpha = 255;
|
||||
|
||||
@@ -200,7 +200,7 @@ void GAME_EXPORT CL_DrawTracers( double frametime, particle_t *cl_active_tracers
|
||||
|
||||
for( p = cl_active_tracers; p; p = p->next )
|
||||
{
|
||||
atten = (p->die - gpGlobals->time);
|
||||
atten = (p->die - gp_cl->time);
|
||||
if( atten > 0.1f ) atten = 0.1f;
|
||||
|
||||
VectorScale( p->vel, ( p->ramp * atten ), delta );
|
||||
@@ -268,7 +268,7 @@ void GAME_EXPORT CL_DrawTracers( double frametime, particle_t *cl_active_tracers
|
||||
p->vel[1] *= scale;
|
||||
p->vel[2] -= gravity;
|
||||
|
||||
p->packedColor = 255 * (p->die - gpGlobals->time) * 2;
|
||||
p->packedColor = 255 * (p->die - gp_cl->time) * 2;
|
||||
if( p->packedColor > 255 ) p->packedColor = 255;
|
||||
}
|
||||
else if( p->type == pt_slowgrav )
|
||||
|
||||
@@ -100,7 +100,7 @@ void Turbulent8 (espan_t *pspan)
|
||||
float sdivz, tdivz, zi, z, du, dv, spancountminus1;
|
||||
float sdivz16stepu, tdivz16stepu, zi16stepu;
|
||||
|
||||
r_turb_turb = sintable + ((int)(gpGlobals->time*SPEED)&(CYCLE-1));
|
||||
r_turb_turb = sintable + ((int)(gp_cl->time*SPEED)&(CYCLE-1));
|
||||
|
||||
r_turb_sstep = 0; // keep compiler happy
|
||||
r_turb_tstep = 0; // ditto
|
||||
@@ -239,7 +239,7 @@ void TurbulentZ8 (espan_t *pspan, int alpha1)
|
||||
if( alpha == 0 )
|
||||
return;
|
||||
|
||||
r_turb_turb = sintable + ((int)(gpGlobals->time*SPEED)&(CYCLE-1));
|
||||
r_turb_turb = sintable + ((int)(gp_cl->time*SPEED)&(CYCLE-1));
|
||||
|
||||
r_turb_sstep = 0; // keep compiler happy
|
||||
r_turb_tstep = 0; // ditto
|
||||
|
||||
@@ -430,7 +430,7 @@ mspriteframe_t *R_GetSpriteFrame( const model_t *pModel, int frame, float yaw )
|
||||
|
||||
// when loading in Mod_LoadSpriteGroup, we guaranteed all interval values
|
||||
// are positive, so we don't have to worry about division by zero
|
||||
targettime = gpGlobals->time - ((int)( gpGlobals->time / fullinterval )) * fullinterval;
|
||||
targettime = gp_cl->time - ((int)( gp_cl->time / fullinterval )) * fullinterval;
|
||||
|
||||
for( i = 0; i < (numframes - 1); i++ )
|
||||
{
|
||||
@@ -494,25 +494,25 @@ float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe,
|
||||
// this can be happens when rendering switched between single and angled frames
|
||||
// or change model on replace delta-entity
|
||||
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
||||
ent->latched.sequencetime = gpGlobals->time;
|
||||
ent->latched.sequencetime = gp_cl->time;
|
||||
lerpFrac = 1.0f;
|
||||
}
|
||||
|
||||
if( ent->latched.sequencetime < gpGlobals->time )
|
||||
if( ent->latched.sequencetime < gp_cl->time )
|
||||
{
|
||||
if( frame != ent->latched.prevblending[1] )
|
||||
{
|
||||
ent->latched.prevblending[0] = ent->latched.prevblending[1];
|
||||
ent->latched.prevblending[1] = frame;
|
||||
ent->latched.sequencetime = gpGlobals->time;
|
||||
ent->latched.sequencetime = gp_cl->time;
|
||||
lerpFrac = 0.0f;
|
||||
}
|
||||
else lerpFrac = (gpGlobals->time - ent->latched.sequencetime) * 11.0f;
|
||||
else lerpFrac = (gp_cl->time - ent->latched.sequencetime) * 11.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
||||
ent->latched.sequencetime = gpGlobals->time;
|
||||
ent->latched.sequencetime = gp_cl->time;
|
||||
lerpFrac = 0.0f;
|
||||
}
|
||||
}
|
||||
@@ -526,7 +526,7 @@ float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe,
|
||||
{
|
||||
// reset interpolation on change model
|
||||
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
||||
ent->latched.sequencetime = gpGlobals->time;
|
||||
ent->latched.sequencetime = gp_cl->time;
|
||||
lerpFrac = 0.0f;
|
||||
}
|
||||
|
||||
@@ -541,7 +541,7 @@ float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe,
|
||||
numframes = pspritegroup->numframes;
|
||||
fullinterval = pintervals[numframes-1];
|
||||
jinterval = pintervals[1] - pintervals[0];
|
||||
time = gpGlobals->time;
|
||||
time = gp_cl->time;
|
||||
jtime = 0.0f;
|
||||
|
||||
// when loading in Mod_LoadSpriteGroup, we guaranteed all interval values
|
||||
@@ -580,25 +580,25 @@ float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe,
|
||||
// this can be happens when rendering switched between single and angled frames
|
||||
// or change model on replace delta-entity
|
||||
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
||||
ent->latched.sequencetime = gpGlobals->time;
|
||||
ent->latched.sequencetime = gp_cl->time;
|
||||
lerpFrac = 1.0f;
|
||||
}
|
||||
|
||||
if( ent->latched.sequencetime < gpGlobals->time )
|
||||
if( ent->latched.sequencetime < gp_cl->time )
|
||||
{
|
||||
if( frame != ent->latched.prevblending[1] )
|
||||
{
|
||||
ent->latched.prevblending[0] = ent->latched.prevblending[1];
|
||||
ent->latched.prevblending[1] = frame;
|
||||
ent->latched.sequencetime = gpGlobals->time;
|
||||
ent->latched.sequencetime = gp_cl->time;
|
||||
lerpFrac = 0.0f;
|
||||
}
|
||||
else lerpFrac = (gpGlobals->time - ent->latched.sequencetime) * ent->curstate.framerate;
|
||||
else lerpFrac = (gp_cl->time - ent->latched.sequencetime) * ent->curstate.framerate;
|
||||
}
|
||||
else
|
||||
{
|
||||
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
|
||||
ent->latched.sequencetime = gpGlobals->time;
|
||||
ent->latched.sequencetime = gp_cl->time;
|
||||
lerpFrac = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,14 +163,14 @@ static void R_StudioSetupTimings( void )
|
||||
if( RI.drawWorld )
|
||||
{
|
||||
// synchronize with server time
|
||||
g_studio.time = gpGlobals->time;
|
||||
g_studio.frametime = gpGlobals->time - gpGlobals->oldtime;
|
||||
g_studio.time = gp_cl->time;
|
||||
g_studio.frametime = gp_cl->time - gp_cl->oldtime;
|
||||
}
|
||||
else
|
||||
{
|
||||
// menu stuff
|
||||
g_studio.time = gpGlobals->realtime;
|
||||
g_studio.frametime = gpGlobals->frametime;
|
||||
g_studio.time = gp_host->realtime;
|
||||
g_studio.frametime = gp_host->frametime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -413,8 +413,8 @@ pfnGetEngineTimes
|
||||
static void pfnGetEngineTimes( int *framecount, double *current, double *old )
|
||||
{
|
||||
if( framecount ) *framecount = tr.realframecount;
|
||||
if( current ) *current = gpGlobals->time;
|
||||
if( old ) *old = gpGlobals->oldtime;
|
||||
if( current ) *current = gp_cl->time;
|
||||
if( old ) *old = gp_cl->oldtime;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -585,12 +585,12 @@ void R_StudioSetUpTransform( cl_entity_t *e )
|
||||
VectorCopy( e->angles, angles );
|
||||
|
||||
// interpolate monsters position (moved into UpdateEntityFields by user request)
|
||||
if( e->curstate.movetype == MOVETYPE_STEP && !FBitSet( ENGINE_GET_PARM( PARM_FEATURES ), ENGINE_COMPUTE_STUDIO_LERP ))
|
||||
if( e->curstate.movetype == MOVETYPE_STEP && !FBitSet( gp_host->features, ENGINE_COMPUTE_STUDIO_LERP ))
|
||||
{
|
||||
R_StudioLerpMovement( e, g_studio.time, origin, angles );
|
||||
}
|
||||
|
||||
if( !FBitSet( ENGINE_GET_PARM( PARM_FEATURES ), ENGINE_COMPENSATE_QUAKE_BUG ))
|
||||
if( !FBitSet( gp_host->features, ENGINE_COMPENSATE_QUAKE_BUG ))
|
||||
angles[PITCH] = -angles[PITCH]; // stupid quake bug
|
||||
|
||||
// don't rotate clients, only aim
|
||||
@@ -1320,7 +1320,7 @@ R_StudioDynamicLight
|
||||
*/
|
||||
void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight )
|
||||
{
|
||||
movevars_t *mv = gEngfuncs.pfnGetMoveVars();
|
||||
movevars_t *mv = tr.movevars;
|
||||
vec3_t lightDir, vecSrc, vecEnd;
|
||||
vec3_t origin, dist, finalLight;
|
||||
float add, radius, total;
|
||||
@@ -1356,7 +1356,7 @@ void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight )
|
||||
msurface_t *psurf = NULL;
|
||||
pmtrace_t trace;
|
||||
|
||||
if( FBitSet( ENGINE_GET_PARM( PARM_FEATURES ), ENGINE_WRITE_LARGE_COORD ))
|
||||
if( FBitSet( gp_host->features, ENGINE_WRITE_LARGE_COORD ))
|
||||
{
|
||||
vecEnd[0] = origin[0] - mv->skyvec_x * 65536.0f;
|
||||
vecEnd[1] = origin[1] - mv->skyvec_y * 65536.0f;
|
||||
@@ -2023,8 +2023,7 @@ static void R_StudioDrawPoints( void )
|
||||
|
||||
if( !m_pStudioHeader ) return;
|
||||
|
||||
// safety bounding the skinnum
|
||||
m_skinnum = bound( 0, RI.currententity->curstate.skin, ( m_pStudioHeader->numskinfamilies - 1 ));
|
||||
m_skinnum = RI.currententity->curstate.skin;
|
||||
ptexture = (mstudiotexture_t *)((byte *)m_pStudioHeader + m_pStudioHeader->textureindex);
|
||||
pvertbone = ((byte *)m_pStudioHeader + m_pSubModel->vertinfoindex);
|
||||
pnormbone = ((byte *)m_pStudioHeader + m_pSubModel->norminfoindex);
|
||||
@@ -2034,7 +2033,8 @@ static void R_StudioDrawPoints( void )
|
||||
pstudionorms = (vec3_t *)((byte *)m_pStudioHeader + m_pSubModel->normindex);
|
||||
|
||||
pskinref = (short *)((byte *)m_pStudioHeader + m_pStudioHeader->skinindex);
|
||||
if( m_skinnum != 0 ) pskinref += (m_skinnum * m_pStudioHeader->numskinref);
|
||||
if( m_skinnum > 0 && m_skinnum < m_pStudioHeader->numskinfamilies )
|
||||
pskinref += (m_skinnum * m_pStudioHeader->numskinref);
|
||||
|
||||
if( FBitSet( m_pStudioHeader->flags, STUDIO_HAS_BONEWEIGHTS ) && m_pSubModel->blendvertinfoindex != 0 && m_pSubModel->blendnorminfoindex != 0 )
|
||||
{
|
||||
@@ -2516,7 +2516,7 @@ static void R_StudioClientEvents( void )
|
||||
|
||||
ClearBits( e->curstate.effects, EF_MUZZLEFLASH );
|
||||
VectorCopy( e->attachment[0], el->origin );
|
||||
el->die = gpGlobals->time + 0.05f;
|
||||
el->die = gp_cl->time + 0.05f;
|
||||
el->color.r = 255;
|
||||
el->color.g = 192;
|
||||
el->color.b = 64;
|
||||
@@ -2532,7 +2532,7 @@ static void R_StudioClientEvents( void )
|
||||
return;
|
||||
|
||||
end = R_StudioEstimateFrame( e, pseqdesc, g_studio.time );
|
||||
start = end - e->curstate.framerate * gpGlobals->frametime * pseqdesc->fps;
|
||||
start = end - e->curstate.framerate * gp_host->frametime * pseqdesc->fps;
|
||||
pevent = (mstudioevent_t *)((byte *)m_pStudioHeader + pseqdesc->eventindex);
|
||||
|
||||
if( e->latched.sequencetime == e->curstate.animtime )
|
||||
@@ -3063,7 +3063,7 @@ static int R_StudioDrawPlayer( int flags, entity_state_t *pplayer )
|
||||
|
||||
m_nPlayerIndex = pplayer->number - 1;
|
||||
|
||||
if( m_nPlayerIndex < 0 || m_nPlayerIndex >= ENGINE_GET_PARM( PARM_MAX_CLIENTS ) )
|
||||
if( m_nPlayerIndex < 0 || m_nPlayerIndex >= gp_cl->maxclients )
|
||||
return 0;
|
||||
|
||||
RI.currentmodel = R_StudioSetupPlayerModel( m_nPlayerIndex );
|
||||
@@ -3145,7 +3145,7 @@ static int R_StudioDrawPlayer( int flags, entity_state_t *pplayer )
|
||||
RI.currententity->curstate.body = 255;
|
||||
}
|
||||
|
||||
if( !( !gpGlobals->developer && ENGINE_GET_PARM( PARM_MAX_CLIENTS ) == 1 ) && ( RI.currentmodel == RI.currententity->model ))
|
||||
if( !( !gpGlobals->developer && gp_cl->maxclients == 1 ) && ( RI.currentmodel == RI.currententity->model ))
|
||||
RI.currententity->curstate.body = 1; // force helmet
|
||||
|
||||
lighting.plightvec = dir;
|
||||
@@ -3208,7 +3208,7 @@ static int R_StudioDrawModel( int flags )
|
||||
int result;
|
||||
|
||||
if( RI.currententity->curstate.renderamt <= 0 ||
|
||||
RI.currententity->curstate.renderamt > ENGINE_GET_PARM( PARM_MAX_CLIENTS ) )
|
||||
RI.currententity->curstate.renderamt > gp_cl->maxclients )
|
||||
return 0;
|
||||
|
||||
// get copy of player
|
||||
@@ -3293,7 +3293,7 @@ static int R_StudioDrawModel( int flags )
|
||||
R_StudioDrawModelInternal
|
||||
=================
|
||||
*/
|
||||
void R_StudioDrawModelInternal( cl_entity_t *e, int flags )
|
||||
static void R_StudioDrawModelInternal( cl_entity_t *e, int flags )
|
||||
{
|
||||
if( !RI.drawWorld )
|
||||
{
|
||||
@@ -3326,26 +3326,47 @@ void R_DrawStudioModel( cl_entity_t *e )
|
||||
{
|
||||
R_StudioDrawModelInternal( e, STUDIO_RENDER|STUDIO_EVENTS );
|
||||
}
|
||||
else
|
||||
else if( e->curstate.movetype == MOVETYPE_FOLLOW && e->curstate.aiment > 0 )
|
||||
{
|
||||
if( e->curstate.movetype == MOVETYPE_FOLLOW && e->curstate.aiment > 0 )
|
||||
{
|
||||
cl_entity_t *parent = CL_GetEntityByIndex( e->curstate.aiment );
|
||||
cl_entity_t *parent = CL_GetEntityByIndex( e->curstate.aiment ), **entities;
|
||||
uint i, num_entities;
|
||||
|
||||
if( parent && parent->model && parent->model->type == mod_studio )
|
||||
{
|
||||
RI.currententity = parent;
|
||||
R_StudioDrawModelInternal( RI.currententity, 0 );
|
||||
VectorCopy( parent->curstate.origin, e->curstate.origin );
|
||||
VectorCopy( parent->origin, e->origin );
|
||||
RI.currententity = e;
|
||||
}
|
||||
if( !parent || !parent->model || parent->model->type != mod_studio )
|
||||
return;
|
||||
|
||||
if( R_OpaqueEntity( parent ))
|
||||
{
|
||||
entities = tr.draw_list->solid_entities;
|
||||
num_entities = tr.draw_list->num_solid_entities;
|
||||
}
|
||||
else
|
||||
{
|
||||
entities = tr.draw_list->trans_entities;
|
||||
num_entities = tr.draw_list->num_solid_entities;
|
||||
}
|
||||
|
||||
for( i = 0; i < num_entities; i++ )
|
||||
{
|
||||
if( (*entities)[i].index != e->curstate.aiment )
|
||||
continue;
|
||||
|
||||
RI.currententity = &(*entities)[i];
|
||||
R_StudioDrawModelInternal( RI.currententity, 0 );
|
||||
VectorCopy( RI.currententity->curstate.origin, e->curstate.origin );
|
||||
VectorCopy( RI.currententity->origin, e->origin );
|
||||
RI.currententity = e;
|
||||
|
||||
R_StudioDrawModelInternal( e, STUDIO_RENDER|STUDIO_EVENTS );
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
R_StudioDrawModelInternal( e, STUDIO_RENDER|STUDIO_EVENTS );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
R_RunViewmodelEvents
|
||||
@@ -3373,7 +3394,7 @@ void R_RunViewmodelEvents( void )
|
||||
|
||||
R_StudioSetupTimings();
|
||||
|
||||
gEngfuncs.GetPredictedOrigin( simorg );
|
||||
VectorCopy( gp_cl->simorg, simorg );
|
||||
for( i = 0; i < 4; i++ )
|
||||
VectorCopy( simorg, RI.currententity->attachment[i] );
|
||||
RI.currentmodel = RI.currententity->model;
|
||||
@@ -3538,7 +3559,7 @@ static void R_StudioLoadTexture( model_t *mod, studiohdr_t *phdr, mstudiotexture
|
||||
gEngfuncs.Image_SetMDLPointer((byte *)phdr + ptexture->index);
|
||||
size = sizeof( mstudiotexture_t ) + ptexture->width * ptexture->height + 768;
|
||||
|
||||
if( FBitSet( ENGINE_GET_PARM( PARM_FEATURES ), ENGINE_LOAD_DELUXEDATA ) && FBitSet( ptexture->flags, STUDIO_NF_MASKED ))
|
||||
if( FBitSet( gp_host->features, ENGINE_LOAD_DELUXEDATA ) && FBitSet( ptexture->flags, STUDIO_NF_MASKED ))
|
||||
flags |= TF_KEEP_SOURCE; // Paranoia2 texture alpha-tracing
|
||||
|
||||
// build the texname
|
||||
|
||||
@@ -401,7 +401,7 @@ texture_t *R_TextureAnim( texture_t *b )
|
||||
speed = 10;
|
||||
else speed = 20;
|
||||
|
||||
reletive = (int)(gpGlobals->time * speed) % base->anim_total;
|
||||
reletive = (int)(gp_cl->time * speed) % base->anim_total;
|
||||
}
|
||||
|
||||
|
||||
@@ -455,7 +455,7 @@ texture_t *R_TextureAnimation( msurface_t *s )
|
||||
speed = 10;
|
||||
else speed = 20;
|
||||
|
||||
reletive = (int)(gpGlobals->time * speed) % base->anim_total;
|
||||
reletive = (int)(gp_cl->time * speed) % base->anim_total;
|
||||
}
|
||||
|
||||
count = 0;
|
||||
|
||||
@@ -385,7 +385,7 @@ static qboolean LoadMDL( const char *modelname )
|
||||
}
|
||||
}
|
||||
|
||||
if( filesize < sizeof( studiohdr_t ) || filesize != model_hdr->length )
|
||||
if( filesize < sizeof( studiohdr_t ) || filesize != texture_hdr->length )
|
||||
{
|
||||
fprintf( stderr, "ERROR: Wrong file size! File %s may be corrupted!\n", texturename );
|
||||
return false;
|
||||
@@ -427,7 +427,7 @@ static qboolean LoadMDL( const char *modelname )
|
||||
return false;
|
||||
}
|
||||
|
||||
if( filesize < sizeof( studiohdr_t ) || filesize != model_hdr->length )
|
||||
if( filesize < sizeof( studiohdr_t ) || filesize != anim_hdr[i]->length )
|
||||
{
|
||||
fprintf( stderr, "ERROR: Wrong file size! File %s may be corrupted!\n", seqgroupname );
|
||||
return false;
|
||||
|
||||
15
wscript
15
wscript
@@ -78,7 +78,7 @@ SUBDIRS = [
|
||||
Subproject('3rdparty/mainui', lambda x: not x.env.DEDICATED),
|
||||
Subproject('3rdparty/vgui_support', lambda x: not x.env.DEDICATED),
|
||||
Subproject('stub/client', lambda x: not x.env.DEDICATED),
|
||||
Subproject('game_launch', lambda x: not x.env.SINGLE_BINARY and x.env.DEST_OS != 'android'),
|
||||
Subproject('game_launch', lambda x: not x.env.DEDICATED and not x.env.DISABLE_LAUNCHER),
|
||||
|
||||
# disable only by external dependency presense
|
||||
Subproject('3rdparty/opus', lambda x: not x.env.HAVE_SYSTEM_OPUS and not x.env.DEDICATED),
|
||||
@@ -113,9 +113,6 @@ def options(opt):
|
||||
grp.add_option('--gamedir', action = 'store', dest = 'GAMEDIR', default = 'valve',
|
||||
help = 'engine default game directory [default: %default]')
|
||||
|
||||
grp.add_option('--single-binary', action = 'store_true', dest = 'SINGLE_BINARY', default = False,
|
||||
help = 'build single "xash" binary (always enabled for dedicated) [default: %default]')
|
||||
|
||||
grp.add_option('-8', '--64bits', action = 'store_true', dest = 'ALLOW64', default = False,
|
||||
help = 'allow targetting 64-bit engine(Linux/Windows/OSX x86 only) [default: %default]')
|
||||
|
||||
@@ -202,29 +199,23 @@ def configure(conf):
|
||||
conf.options.GL4ES = True
|
||||
conf.options.GLES3COMPAT = True
|
||||
conf.options.GL = False
|
||||
conf.options.SINGLE_BINARY = True
|
||||
conf.define('XASH_SDLMAIN', 1)
|
||||
elif conf.env.MAGX:
|
||||
conf.options.SDL12 = True
|
||||
conf.options.NO_VGUI = True
|
||||
conf.options.GL = False
|
||||
conf.options.LOW_MEMORY = 1
|
||||
conf.options.SINGLE_BINARY = True
|
||||
conf.options.NO_ASYNC_RESOLVE = True
|
||||
conf.define('XASH_SDLMAIN', 1)
|
||||
enforce_pic = False
|
||||
elif conf.env.DEST_OS == 'dos':
|
||||
conf.options.SINGLE_BINARY = True
|
||||
elif conf.env.DEST_OS == 'nswitch':
|
||||
conf.options.NO_VGUI = True
|
||||
conf.options.GL = True
|
||||
conf.options.SINGLE_BINARY = True
|
||||
conf.options.NO_ASYNC_RESOLVE = True
|
||||
conf.options.USE_STBTT = True
|
||||
elif conf.env.DEST_OS == 'psvita':
|
||||
conf.options.NO_VGUI = True
|
||||
conf.options.GL = True
|
||||
conf.options.SINGLE_BINARY = True
|
||||
conf.options.NO_ASYNC_RESOLVE = True
|
||||
conf.options.USE_STBTT = True
|
||||
# we'll specify -fPIC by hand for shared libraries only
|
||||
@@ -357,9 +348,11 @@ def configure(conf):
|
||||
conf.env.ENABLE_UTILS = conf.options.ENABLE_UTILS
|
||||
conf.env.ENABLE_FUZZER = conf.options.ENABLE_FUZZER
|
||||
conf.env.DEDICATED = conf.options.DEDICATED
|
||||
conf.env.SINGLE_BINARY = conf.options.SINGLE_BINARY or conf.env.DEDICATED
|
||||
conf.env.SUPPORT_BSP2_FORMAT = conf.options.SUPPORT_BSP2_FORMAT
|
||||
|
||||
# disable game_launch compiling on platform where it's not needed
|
||||
conf.env.DISABLE_LAUNCHER = conf.env.DEST_OS in ['android', 'nswitch', 'psvita', 'dos'] or conf.env.MAGX
|
||||
|
||||
if conf.env.SAILFISH == 'aurora':
|
||||
conf.env.DEFAULT_RPATH = '/usr/share/su.xash.Engine/lib'
|
||||
elif conf.env.DEST_OS == 'darwin':
|
||||
|
||||
Reference in New Issue
Block a user