01 Apr 2011
This commit is contained in:
parent
d1a0a6bcf5
commit
3f821c16f9
|
@ -1,3 +1,7 @@
|
|||
build 1515
|
||||
|
||||
Engine: fix some bugs
|
||||
|
||||
build 1507
|
||||
|
||||
Console: implement Con_NPrintf and Con_NXPrintf
|
||||
|
|
|
@ -25,15 +25,18 @@ BRUSH MODELS
|
|||
// bmodel limits
|
||||
#define MAX_MAP_HULLS 4 // MAX_HULLS
|
||||
|
||||
#define SURF_PLANEBACK BIT( 1 ) // there
|
||||
#define SURF_PLANEBACK BIT( 1 ) // a bit who indicated backplane
|
||||
#define SURF_DRAWSKY BIT( 2 ) // sky surface
|
||||
#define SURF_WATERCSG BIT( 3 ) // culled by csg
|
||||
#define SURF_DRAWSPRITE BIT( 3 ) // legacy (unused)
|
||||
#define SURF_DRAWTURB BIT( 4 ) // warp surface
|
||||
#define SURF_DRAWTILED BIT( 5 ) // face without lighmap
|
||||
#define SURF_CONVEYOR BIT( 6 ) // scrolled texture
|
||||
#define SURF_DRAWBACKGROUND BIT( 6 ) // legacy (unused)
|
||||
#define SURF_UNDERWATER BIT( 7 ) // caustics
|
||||
#define SURF_TRANSPARENT BIT( 8 ) // it's a transparent texture
|
||||
#define SURF_DONTWARP BIT( 8 ) // legacy (unused)
|
||||
|
||||
#define SURF_TRANSPARENT BIT( 28 ) // it's a transparent surface
|
||||
#define SURF_WATERCSG BIT( 29 ) // culled by csg
|
||||
#define SURF_CONVEYOR BIT( 30 ) // scrolled texture
|
||||
#define SURF_NOCULL BIT( 31 ) // two-sided polygon (e.g. 'water4b')
|
||||
|
||||
// lightstyle management
|
||||
|
|
|
@ -113,8 +113,8 @@ struct decal_s
|
|||
{
|
||||
decal_t *pnext; // linked list for each surface
|
||||
msurface_t *psurface; // Surface id for persistence / unlinking
|
||||
float dx; // Offsets into surface texture
|
||||
float dy; // (in world coordinates. FIXME: make shorts ?)
|
||||
short dx; // Offsets into surface texture
|
||||
short dy; // (in texture coordinates, so we don't need floats)
|
||||
short texture; // Decal texture
|
||||
byte scale; // Pixel scale
|
||||
byte flags; // Decal flags FDECAL_*
|
||||
|
|
|
@ -180,8 +180,9 @@ void CL_ScreenShot_f( void )
|
|||
break;
|
||||
}
|
||||
|
||||
Con_ClearNotify();
|
||||
VID_ScreenShot( checkname, VID_SCREENSHOT );
|
||||
Q_strncpy( cls.shotname, checkname, sizeof( cls.shotname ));
|
||||
cls.scrshot_action = scrshot_normal; // build new frame for screenshot
|
||||
cls.envshot_vieworg = NULL; // no custom view
|
||||
}
|
||||
|
||||
void CL_EnvShot_f( void )
|
||||
|
|
|
@ -76,10 +76,13 @@ void CL_UpdateEntityFields( cl_entity_t *ent )
|
|||
vec3_t vecSrc, vecEnd;
|
||||
pmtrace_t trace;
|
||||
|
||||
VectorSet( vecSrc, ent->origin[0], ent->origin[1], ent->origin[2] + ent->model->maxs[2] );
|
||||
VectorSet( vecEnd, vecSrc[0], vecSrc[1], vecSrc[2] - ent->model->mins[2] );
|
||||
trace = PM_PlayerTrace( clgame.pmove, vecSrc, vecEnd, PM_STUDIO_IGNORE, 0, -1, NULL );
|
||||
m_pGround = CL_GetEntityByIndex( pfnIndexFromTrace( &trace ));
|
||||
if( ent->model )
|
||||
{
|
||||
VectorSet( vecSrc, ent->origin[0], ent->origin[1], ent->origin[2] + ent->model->maxs[2] );
|
||||
VectorSet( vecEnd, vecSrc[0], vecSrc[1], vecSrc[2] - ent->model->mins[2] );
|
||||
trace = PM_PlayerTrace( clgame.pmove, vecSrc, vecEnd, PM_STUDIO_IGNORE, 0, -1, NULL );
|
||||
m_pGround = CL_GetEntityByIndex( pfnIndexFromTrace( &trace ));
|
||||
}
|
||||
|
||||
if( m_pGround && m_pGround->curstate.movetype == MOVETYPE_PUSH )
|
||||
{
|
||||
|
@ -434,7 +437,7 @@ void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t
|
|||
wd = cl.predict[cls.lastoutgoingcommand & CL_UPDATE_MASK].weapondata;
|
||||
|
||||
clgame.dllFuncs.pfnTxferPredictionData( ps, pps, pcd, ppcd, wd, pwd );
|
||||
clgame.dllFuncs.pfnTxferLocalOverrides( &ent->curstate, &cl.frame.local.client );
|
||||
clgame.dllFuncs.pfnTxferLocalOverrides( &ent->curstate, pcd );
|
||||
}
|
||||
|
||||
clgame.dllFuncs.pfnProcessPlayerState( &frame->playerstate[ent->index-1], &ent->curstate );
|
||||
|
@ -488,8 +491,9 @@ void CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
|||
frame_t *newframe, *oldframe;
|
||||
int oldindex, newnum, oldnum;
|
||||
int oldpacket, newpacket;
|
||||
cl_entity_t *player;
|
||||
entity_state_t *oldent;
|
||||
int count;
|
||||
int i, count;
|
||||
|
||||
// first, allocate packet for new frame
|
||||
count = BF_ReadWord( msg );
|
||||
|
@ -636,18 +640,18 @@ void CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
|||
}
|
||||
|
||||
cl.frame = *newframe;
|
||||
|
||||
if( !cl.frame.valid ) return;
|
||||
|
||||
player = CL_GetLocalPlayer();
|
||||
|
||||
if( cls.state != ca_active )
|
||||
{
|
||||
cl_entity_t *player;
|
||||
|
||||
// client entered the game
|
||||
cls.state = ca_active;
|
||||
cl.force_refdef = true;
|
||||
cls.changelevel = false; // changelevel is done
|
||||
|
||||
player = CL_GetLocalPlayer();
|
||||
SCR_MakeLevelShot(); // make levelshot if needs
|
||||
|
||||
Cvar_SetFloat( "scr_loading", 0.0f ); // reset progress bar
|
||||
|
@ -660,6 +664,37 @@ void CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
|||
VectorCopy( player->angles, cl.predicted_angles );
|
||||
}
|
||||
|
||||
// update local player states
|
||||
if( player != NULL )
|
||||
{
|
||||
entity_state_t *ps, *pps;
|
||||
clientdata_t *pcd, *ppcd;
|
||||
weapon_data_t *wd, *pwd;
|
||||
|
||||
pps = &player->curstate;
|
||||
ppcd = &newframe->local.client;
|
||||
pwd = newframe->local.weapondata;
|
||||
|
||||
ps = &cl.predict[cl.predictcount & CL_UPDATE_MASK].playerstate;
|
||||
pcd = &cl.predict[cl.predictcount & CL_UPDATE_MASK].client;
|
||||
wd = cl.predict[cl.predictcount & CL_UPDATE_MASK].weapondata;
|
||||
|
||||
clgame.dllFuncs.pfnTxferPredictionData( ps, pps, pcd, ppcd, wd, pwd );
|
||||
clgame.dllFuncs.pfnTxferLocalOverrides( &player->curstate, pcd );
|
||||
}
|
||||
|
||||
// update state for all players
|
||||
for( i = 0; i < cl.maxclients; i++ )
|
||||
{
|
||||
cl_entity_t *ent = CL_GetEntityByIndex( i + 1 );
|
||||
if( !ent ) continue;
|
||||
clgame.dllFuncs.pfnProcessPlayerState( &newframe->playerstate[i], &ent->curstate );
|
||||
newframe->playerstate[i].number = ent->index;
|
||||
}
|
||||
|
||||
cl.frame = *newframe;
|
||||
cl.predict[cl.predictcount & CL_UPDATE_MASK] = cl.frame.local;
|
||||
|
||||
CL_CheckPredictionError();
|
||||
}
|
||||
|
||||
|
|
|
@ -1344,7 +1344,8 @@ pfnSPR_Load
|
|||
*/
|
||||
HSPRITE pfnSPR_Load( const char *szPicName )
|
||||
{
|
||||
int i;
|
||||
int i, j;
|
||||
char name[64];
|
||||
|
||||
if( !szPicName || !*szPicName )
|
||||
{
|
||||
|
@ -1352,10 +1353,20 @@ HSPRITE pfnSPR_Load( const char *szPicName )
|
|||
return 0;
|
||||
}
|
||||
|
||||
// eliminate '!' symbol (i'm doesn't know what this doing)
|
||||
for( i = j = 0; i < Q_strlen( szPicName ); i++ )
|
||||
{
|
||||
if( szPicName[i] == '!' ) continue;
|
||||
else if( szPicName[i] == '\\' ) name[j] = '/';
|
||||
else name[j] = Q_tolower( szPicName[i] );
|
||||
j++;
|
||||
}
|
||||
name[j] = '\0';
|
||||
|
||||
// slot 0 isn't used
|
||||
for( i = 1; i < MAX_IMAGES; i++ )
|
||||
{
|
||||
if( !Q_strcmp( clgame.sprites[i].name, szPicName ))
|
||||
if( !Q_strcmp( clgame.sprites[i].name, name ))
|
||||
{
|
||||
// prolonge registration
|
||||
clgame.sprites[i].needload = clgame.load_sequence;
|
||||
|
@ -1374,7 +1385,7 @@ HSPRITE pfnSPR_Load( const char *szPicName )
|
|||
}
|
||||
|
||||
// load new model
|
||||
if( CL_LoadHudSprite( szPicName, &clgame.sprites[i], false ))
|
||||
if( CL_LoadHudSprite( name, &clgame.sprites[i], false ))
|
||||
{
|
||||
clgame.sprites[i].needload = clgame.load_sequence;
|
||||
return i;
|
||||
|
@ -2341,7 +2352,7 @@ int CL_FindModelIndex( const char *m )
|
|||
if( cls.state == ca_active && Q_strnicmp( m, "models/player/", 14 ))
|
||||
{
|
||||
// tell user about problem (but don't spam console about playermodel)
|
||||
MsgDev( D_ERROR, "CL_ModelIndex: %s not precached\n", m );
|
||||
MsgDev( D_NOTE, "CL_ModelIndex: %s not precached\n", m );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -2620,7 +2631,8 @@ pfnLoadMapSprite
|
|||
*/
|
||||
model_t *pfnLoadMapSprite( const char *filename )
|
||||
{
|
||||
int i;
|
||||
int i, j;
|
||||
char name[64];
|
||||
|
||||
if( !filename || !*filename )
|
||||
{
|
||||
|
@ -2628,10 +2640,20 @@ model_t *pfnLoadMapSprite( const char *filename )
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// eliminate '!' symbol (i'm doesn't know what this doing)
|
||||
for( i = j = 0; i < Q_strlen( filename ); i++ )
|
||||
{
|
||||
if( filename[i] == '!' ) continue;
|
||||
else if( filename[i] == '\\' ) name[j] = '/';
|
||||
else name[j] = Q_tolower( filename[i] );
|
||||
j++;
|
||||
}
|
||||
name[j] = '\0';
|
||||
|
||||
// slot 0 isn't used
|
||||
for( i = 1; i < MAX_IMAGES; i++ )
|
||||
{
|
||||
if( !Q_strcmp( clgame.sprites[i].name, filename ))
|
||||
if( !Q_strcmp( clgame.sprites[i].name, name ))
|
||||
{
|
||||
// prolonge registration
|
||||
clgame.sprites[i].needload = clgame.load_sequence;
|
||||
|
@ -2650,7 +2672,7 @@ model_t *pfnLoadMapSprite( const char *filename )
|
|||
}
|
||||
|
||||
// load new map sprite
|
||||
if( CL_LoadHudSprite( filename, &clgame.sprites[i], true ))
|
||||
if( CL_LoadHudSprite( name, &clgame.sprites[i], true ))
|
||||
{
|
||||
clgame.sprites[i].needload = clgame.load_sequence;
|
||||
return &clgame.sprites[i];
|
||||
|
|
|
@ -1127,6 +1127,8 @@ void CL_PrepVideo( void )
|
|||
// invalidate all decal indexes
|
||||
Q_memset( cl.decal_index, 0, sizeof( cl.decal_index ));
|
||||
|
||||
R_NewMap(); // tell the render about new map
|
||||
|
||||
// release unused SpriteTextures
|
||||
for( i = 1; i < MAX_IMAGES; i++ )
|
||||
{
|
||||
|
@ -1138,8 +1140,6 @@ void CL_PrepVideo( void )
|
|||
Mod_FreeUnused ();
|
||||
CL_ClearWorld ();
|
||||
|
||||
R_NewMap(); // tell the render about new map
|
||||
|
||||
Cvar_SetFloat( "scr_loading", 100.0f ); // all done
|
||||
|
||||
if( host.decalList )
|
||||
|
|
|
@ -748,8 +748,6 @@ void CL_ParseClientData( sizebuf_t *msg )
|
|||
|
||||
MSG_ReadWeaponData( msg, &from_wd[idx], &to_wd[idx], sv_time( ));
|
||||
}
|
||||
|
||||
cl.predict[(cls.lastoutgoingcommand + 1) & CL_UPDATE_MASK] = frame->local;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -40,10 +40,15 @@ void CL_PostRunCmd( usercmd_t *ucmd, int random_seed )
|
|||
{
|
||||
local_state_t *from, *to;
|
||||
|
||||
from = &cl.predict[cls.lastoutgoingcommand & CL_UPDATE_MASK];
|
||||
to = &cl.predict[cls.netchan.outgoing_sequence & CL_UPDATE_MASK];
|
||||
// FIXME: write real predicting code
|
||||
|
||||
from = &cl.predict[cl.predictcount & CL_UPDATE_MASK];
|
||||
to = &cl.predict[(cl.predictcount + 1) & CL_UPDATE_MASK];
|
||||
|
||||
*to = *from;
|
||||
|
||||
clgame.dllFuncs.pfnPostRunCmd( from, to, ucmd, clgame.pmove->runfuncs, cl.time, random_seed );
|
||||
cl.predictcount++;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -178,6 +178,9 @@ void SCR_MakeScreenShot( void )
|
|||
|
||||
switch( cls.scrshot_action )
|
||||
{
|
||||
case scrshot_normal:
|
||||
iRet = VID_ScreenShot( cls.shotname, VID_SCREENSHOT );
|
||||
break;
|
||||
case scrshot_plaque:
|
||||
iRet = VID_ScreenShot( cls.shotname, VID_LEVELSHOT );
|
||||
break;
|
||||
|
|
|
@ -963,7 +963,7 @@ TEMPENTITY *CL_TempModel( const vec3_t pos, const vec3_t dir, const vec3_t angle
|
|||
VectorCopy( dir, pTemp->entity.baseline.origin );
|
||||
|
||||
pTemp->entity.curstate.body = 0;
|
||||
pTemp->flags = (FTENT_COLLIDEWORLD|FTENT_FADEOUT|FTENT_GRAVITY|FTENT_ROTATE);
|
||||
pTemp->flags = (FTENT_COLLIDEWORLD|FTENT_GRAVITY|FTENT_ROTATE);
|
||||
pTemp->entity.baseline.angles[0] = Com_RandomFloat( -255, 255 );
|
||||
pTemp->entity.baseline.angles[1] = Com_RandomFloat( -255, 255 );
|
||||
pTemp->entity.baseline.angles[2] = Com_RandomFloat( -255, 255 );
|
||||
|
|
|
@ -95,10 +95,11 @@ typedef struct
|
|||
client_data_t data; // some clientdata holds
|
||||
|
||||
frame_t frame; // received from server
|
||||
int surpressCount; // number of messages rate supressed
|
||||
frame_t frames[MULTIPLAYER_BACKUP]; // alloced on svc_serverdata
|
||||
usercmd_t cmds[MULTIPLAYER_BACKUP]; // each mesage will send several old cmds
|
||||
local_state_t predict[MULTIPLAYER_BACKUP]; // local client state
|
||||
int predictcount; // advances with next clientdata
|
||||
|
||||
double time; // this is the time value that the client
|
||||
// is rendering at. always <= cls.realtime
|
||||
// a lerp point for other data
|
||||
|
@ -174,6 +175,7 @@ typedef enum
|
|||
typedef enum
|
||||
{
|
||||
scrshot_inactive,
|
||||
scrshot_normal, // in-game screenshot
|
||||
scrshot_plaque, // levelshot
|
||||
scrshot_savegame, // saveshot
|
||||
scrshot_demoshot, // for demos preview
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
// empirically determined constants for minimizing overalpping decals
|
||||
#define MAX_OVERLAP_DECALS 6
|
||||
#define DECAL_OVERLAP_DIST 8
|
||||
#define FLOAT_TO_SHORT( x ) (short)(x * 32)
|
||||
#define SHORT_TO_FLOAT( x ) ((float)x * (1.0f/32.0f))
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -125,11 +127,7 @@ static void R_DecalUnlink( decal_t *pdecal )
|
|||
}
|
||||
}
|
||||
|
||||
// if( pdecal->mesh )
|
||||
// Mem_Free( pdecal->mesh );
|
||||
|
||||
pdecal->psurface = NULL;
|
||||
// pdecal->mesh = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -250,8 +248,8 @@ void R_SetupDecalVertsForMSurface( decal_t *pDecal, msurface_t *surf, vec3_t tex
|
|||
for( j = 0; j < surf->polys->numverts; j++, v += VERTEXSIZE )
|
||||
{
|
||||
VectorCopy( v, pVerts[j].m_vPos ); // copy model space coordinates
|
||||
pVerts[j].m_tCoords[0] = DotProduct( pVerts[j].m_vPos, textureSpaceBasis[0] ) - pDecal->dx + 0.5f;
|
||||
pVerts[j].m_tCoords[1] = DotProduct( pVerts[j].m_vPos, textureSpaceBasis[1] ) - pDecal->dy + 0.5f;
|
||||
pVerts[j].m_tCoords[0] = DotProduct( pVerts[j].m_vPos, textureSpaceBasis[0] ) - SHORT_TO_FLOAT( pDecal->dx ) + 0.5f;
|
||||
pVerts[j].m_tCoords[1] = DotProduct( pVerts[j].m_vPos, textureSpaceBasis[1] ) - SHORT_TO_FLOAT( pDecal->dy ) + 0.5f;
|
||||
pVerts[j].m_LMCoords[0] = pVerts[j].m_LMCoords[1] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
@ -267,8 +265,8 @@ void R_SetupDecalClip( decalvert_t *pOutVerts, decal_t *pDecal, msurface_t *surf
|
|||
// Generate texture coordinates for each vertex in decal s,t space
|
||||
// probably should pre-generate this, store it and use it for decal-decal collisions
|
||||
// as in R_DecalsIntersect()
|
||||
pDecal->dx = DotProduct( pDecal->position, textureSpaceBasis[0] );
|
||||
pDecal->dy = DotProduct( pDecal->position, textureSpaceBasis[1] );
|
||||
pDecal->dx = FLOAT_TO_SHORT( DotProduct( pDecal->position, textureSpaceBasis[0] ));
|
||||
pDecal->dy = FLOAT_TO_SHORT( DotProduct( pDecal->position, textureSpaceBasis[1] ));
|
||||
}
|
||||
|
||||
static int SHClip( decalvert_t *g_DecalClipVerts, int vertCount, decalvert_t *out, decal_clip_t clipFunc )
|
||||
|
@ -478,15 +476,16 @@ static decal_t *R_DecalIntersect( decalinfo_t *decalinfo, msurface_t *surf, int
|
|||
// Here, we project the min and max extents of the decal that got passed in into
|
||||
// this decal's (pDecal's) [0,0,1,1] clip space, just like we would if we were
|
||||
// clipping a triangle into pDecal's clip space.
|
||||
Vector2Set( vDecalMin, DotProduct( testPosition[0], testBasis[0] ) - pDecal->dx + 0.5f,
|
||||
DotProduct( testPosition[1], testBasis[1] ) - pDecal->dy + 0.5f );
|
||||
Vector2Set( vDecalMin,
|
||||
DotProduct( testPosition[0], testBasis[0] ) - SHORT_TO_FLOAT( pDecal->dx ) + 0.5f,
|
||||
DotProduct( testPosition[1], testBasis[1] ) - SHORT_TO_FLOAT( pDecal->dy ) + 0.5f );
|
||||
|
||||
VectorAdd( decalinfo->m_Position, decalExtents[0], testPosition[0] );
|
||||
VectorAdd( decalinfo->m_Position, decalExtents[1], testPosition[1] );
|
||||
|
||||
Vector2Set( vDecalMax,
|
||||
DotProduct( testPosition[0], testBasis[0] ) - pDecal->dx + 0.5f,
|
||||
DotProduct( testPosition[1], testBasis[1] ) - pDecal->dy + 0.5f );
|
||||
DotProduct( testPosition[0], testBasis[0] ) - SHORT_TO_FLOAT( pDecal->dx ) + 0.5f,
|
||||
DotProduct( testPosition[1], testBasis[1] ) - SHORT_TO_FLOAT( pDecal->dy ) + 0.5f );
|
||||
|
||||
// Now figure out the part of the projection that intersects pDecal's
|
||||
// clip box [0,0,1,1].
|
||||
|
@ -564,8 +563,8 @@ static void R_DecalCreate( decalinfo_t *decalinfo, msurface_t *surf, float x, fl
|
|||
if( pdecal->flags & FDECAL_USESAXIS )
|
||||
VectorCopy( decalinfo->m_SAxis, pdecal->saxis );
|
||||
|
||||
pdecal->dx = x;
|
||||
pdecal->dy = y;
|
||||
pdecal->dx = FLOAT_TO_SHORT( x );
|
||||
pdecal->dy = FLOAT_TO_SHORT( y );
|
||||
pdecal->texture = decalinfo->m_iTexture;
|
||||
|
||||
// set scaling
|
||||
|
@ -974,9 +973,9 @@ static int DecalDepthCompare( const void *a, const void *b )
|
|||
elem2 = (const decallist_t *)b;
|
||||
|
||||
if( elem1->depth > elem2->depth )
|
||||
return -1;
|
||||
if( elem1->depth < elem2->depth )
|
||||
return 1;
|
||||
if( elem1->depth < elem2->depth )
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -30,9 +30,10 @@ void GL_Bind( GLenum tmu, GLenum texnum )
|
|||
{
|
||||
gltexture_t *texture;
|
||||
|
||||
ASSERT( texnum > 0 && texnum < MAX_TEXTURES );
|
||||
|
||||
GL_SelectTexture( tmu );
|
||||
|
||||
ASSERT( texnum >= 0 && texnum < MAX_TEXTURES );
|
||||
texture = &r_textures[texnum];
|
||||
if( glState.currentTextures[tmu] == texture->texnum )
|
||||
return;
|
||||
|
@ -53,10 +54,11 @@ void GL_MBind( GLenum texnum )
|
|||
gltexture_t *texture;
|
||||
int tmu = 0;
|
||||
|
||||
ASSERT( texnum > 0 && texnum < MAX_TEXTURES );
|
||||
|
||||
if( glState.mtexEnabled )
|
||||
tmu = 1;
|
||||
|
||||
ASSERT( texnum >= 0 && texnum < MAX_TEXTURES );
|
||||
texture = &r_textures[texnum];
|
||||
if( glState.currentTextures[tmu] == texture->texnum )
|
||||
return;
|
||||
|
@ -85,7 +87,6 @@ Just for debug (r_showtextures uses it)
|
|||
*/
|
||||
void GL_SetTextureType( GLenum texnum, GLenum type )
|
||||
{
|
||||
if( texnum <= 0 ) return;
|
||||
ASSERT( texnum >= 0 && texnum < MAX_TEXTURES );
|
||||
r_textures[texnum].texType = type;
|
||||
}
|
||||
|
@ -1244,6 +1245,21 @@ static rgbdata_t *R_InitBlackTexture( texFlags_t *flags )
|
|||
return R_InitSolidColorTexture( flags, 0 );
|
||||
}
|
||||
|
||||
static rgbdata_t *R_InitDlightTexture( texFlags_t *flags )
|
||||
{
|
||||
// solid color texture
|
||||
r_image.width = BLOCK_WIDTH;
|
||||
r_image.height = BLOCK_HEIGHT;
|
||||
r_image.flags = IMAGE_HAS_COLOR;
|
||||
r_image.type = PF_RGBA_32;
|
||||
r_image.size = r_image.width * r_image.height * 4;
|
||||
r_image.buffer = NULL; // empty for now
|
||||
|
||||
*flags = TF_NOPICMIP|TF_UNCOMPRESSED|TF_NOMIPMAP;
|
||||
|
||||
return &r_image;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
R_InitBuiltinTextures
|
||||
|
@ -1267,6 +1283,7 @@ static void R_InitBuiltinTextures( void )
|
|||
{ "*black", &tr.blackTexture, R_InitBlackTexture },
|
||||
{ "*particle", &tr.particleTexture, R_InitParticleTexture },
|
||||
{ "*cintexture", &tr.cinTexture, R_InitCinematicTexture },
|
||||
{ "*dlight", &tr.dlightTexture, R_InitDlightTexture },
|
||||
{ "*sky", &tr.skyTexture, R_InitSkyTexture },
|
||||
{ NULL, NULL, NULL }
|
||||
};
|
||||
|
@ -1298,6 +1315,7 @@ void R_InitImages( void )
|
|||
r_numTextures = 0;
|
||||
scaledImage = NULL;
|
||||
Q_memset( r_textures, 0, sizeof( r_textures ));
|
||||
Q_memset( tr.lightmapTextures, 0, sizeof( tr.lightmapTextures ));
|
||||
Q_memset( r_texturesHashTable, 0, sizeof( r_texturesHashTable ));
|
||||
|
||||
// create unused 0-entry
|
||||
|
@ -1305,6 +1323,7 @@ void R_InitImages( void )
|
|||
hash = Com_HashKey( r_textures->name, TEXTURES_HASH_SIZE );
|
||||
r_textures->nextHash = r_texturesHashTable[hash];
|
||||
r_texturesHashTable[hash] = r_textures;
|
||||
r_numTextures = 1;
|
||||
|
||||
// build luminance table
|
||||
for( i = 0; i < 256; i++ )
|
||||
|
|
|
@ -152,6 +152,7 @@ typedef struct
|
|||
int solidskyTexture; // quake1 solid-sky layer
|
||||
int alphaskyTexture; // quake1 alpha-sky layer
|
||||
int lightmapTextures[MAX_LIGHTMAPS];
|
||||
int dlightTexture; // custom dlight texture
|
||||
int skyboxTextures[6]; // skybox sides
|
||||
|
||||
int skytexturenum; // this not a gl_texturenum!
|
||||
|
|
|
@ -170,7 +170,7 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, const vec3
|
|||
vec3_t mid;
|
||||
|
||||
// didn't hit anything
|
||||
if( node->contents < 0 )
|
||||
if( !node || node->contents < 0 )
|
||||
return false;
|
||||
|
||||
// calculate mid point
|
||||
|
|
|
@ -39,12 +39,12 @@ static int ramp3[6] = { 0x6d, 0x6b, 6, 5, 4, 3 };
|
|||
|
||||
static int boxpnt[6][4] =
|
||||
{
|
||||
{ 0, 4, 6, 2 }, // +X
|
||||
{ 0, 1, 5, 4 }, // +Y
|
||||
{ 0, 2, 3, 1 }, // +Z
|
||||
{ 7, 5, 1, 3 }, // -X
|
||||
{ 7, 3, 2, 6 }, // -Y
|
||||
{ 7, 6, 4, 5 }, // -Z
|
||||
{ 0, 4, 6, 2 }, // +X
|
||||
{ 0, 1, 5, 4 }, // +Y
|
||||
{ 0, 2, 3, 1 }, // +Z
|
||||
{ 7, 5, 1, 3 }, // -X
|
||||
{ 7, 3, 2, 6 }, // -Y
|
||||
{ 7, 6, 4, 5 }, // -Z
|
||||
};
|
||||
|
||||
static rgb_t gTracerColors[] =
|
||||
|
@ -1340,11 +1340,19 @@ void CL_StreakTracer( const vec3_t pos, const vec3_t velocity, int colorIndex )
|
|||
p = CL_AllocParticle( CL_SparkTracerDraw );
|
||||
if( !p ) return;
|
||||
|
||||
color = gTracerColors[colorIndex];
|
||||
if( colorIndex > ( sizeof( gTracerColors ) / sizeof( gTracerColors[0] )))
|
||||
{
|
||||
p->color = bound( 0, colorIndex, 255 );
|
||||
}
|
||||
else
|
||||
{
|
||||
color = gTracerColors[colorIndex];
|
||||
p->color = CL_LookupColor( color[0], color[1], color[2] );
|
||||
}
|
||||
|
||||
p->die += Com_RandomFloat( 0.5f, 1.0f );
|
||||
VectorCopy( velocity, p->vel );
|
||||
VectorCopy( pos, p->org );
|
||||
p->color = CL_LookupColor( color[0], color[1], color[2] );
|
||||
p->ramp = Com_RandomFloat( 0.05f, 0.08f );
|
||||
}
|
||||
|
||||
|
@ -1390,8 +1398,16 @@ void CL_UserTracerParticle( float *org, float *vel, float life, int colorIndex,
|
|||
p = CL_AllocParticle( CL_BulletTracerDraw );
|
||||
if( !p ) return;
|
||||
|
||||
color = gTracerColors[colorIndex];
|
||||
p->color = CL_LookupColor( color[0], color[1], color[2] );
|
||||
if( colorIndex > ( sizeof( gTracerColors ) / sizeof( gTracerColors[0] )))
|
||||
{
|
||||
p->color = bound( 0, colorIndex, 255 );
|
||||
}
|
||||
else
|
||||
{
|
||||
color = gTracerColors[colorIndex];
|
||||
p->color = CL_LookupColor( color[0], color[1], color[2] );
|
||||
}
|
||||
|
||||
p->ramp = length; // ramp used as length
|
||||
VectorCopy( org, p->org );
|
||||
VectorCopy( vel, p->vel );
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -13,6 +13,10 @@
|
|||
#include "gl_local.h"
|
||||
#include "cl_tent.h"
|
||||
|
||||
// NOTE: enable this if you want merge both 'model' and 'modelT' files into one model slot.
|
||||
// otherwise it's uses two slots in models[] array for models with external textures
|
||||
// #define STUDIO_MERGE_TEXTURES
|
||||
|
||||
#define EVENT_CLIENT 5000 // less than this value it's a server-side studio events
|
||||
|
||||
static vec3_t hullcolor[8] =
|
||||
|
@ -76,6 +80,7 @@ mstudiomodel_t *m_pSubModel;
|
|||
mstudiobodyparts_t *m_pBodyPart;
|
||||
player_info_t *m_pPlayerInfo;
|
||||
studiohdr_t *m_pStudioHeader;
|
||||
studiohdr_t *m_pTextureHeader;
|
||||
float m_flGaitMovement;
|
||||
int g_nTopColor, g_nBottomColor; // remap colors
|
||||
int g_nFaceFlags;
|
||||
|
@ -1227,9 +1232,7 @@ void R_StudioSetupChrome( float *pchrome, int bone, vec3_t normal )
|
|||
}
|
||||
else
|
||||
{
|
||||
if( RI.currententity == &clgame.viewent )
|
||||
CrossProduct( tmp, RI.vright, chromeupvec );
|
||||
else CrossProduct( tmp, RI.vieworg, chromeupvec );
|
||||
CrossProduct( tmp, RI.vright, chromeupvec );
|
||||
VectorNormalize( chromeupvec );
|
||||
CrossProduct( tmp, chromeupvec, chromerightvec );
|
||||
VectorNormalize( chromerightvec );
|
||||
|
@ -1579,10 +1582,12 @@ static void R_StudioSetupSkin( mstudiotexture_t *ptexture, int index )
|
|||
short *pskinref;
|
||||
int m_skinnum;
|
||||
|
||||
if( !m_pTextureHeader ) return;
|
||||
|
||||
m_skinnum = RI.currententity->curstate.skin;
|
||||
pskinref = (short *)((byte *)m_pStudioHeader + m_pStudioHeader->skinindex);
|
||||
if( m_skinnum != 0 && m_skinnum < m_pStudioHeader->numskinfamilies )
|
||||
pskinref += (m_skinnum * m_pStudioHeader->numskinref);
|
||||
pskinref = (short *)((byte *)m_pTextureHeader + m_pTextureHeader->skinindex);
|
||||
if( m_skinnum != 0 && m_skinnum < m_pTextureHeader->numskinfamilies )
|
||||
pskinref += (m_skinnum * m_pTextureHeader->numskinref);
|
||||
|
||||
GL_Bind( GL_TEXTURE0, ptexture[pskinref[index]].index );
|
||||
}
|
||||
|
@ -1605,21 +1610,22 @@ static void R_StudioDrawPoints( void )
|
|||
short *pskinref;
|
||||
float *av, *lv;
|
||||
|
||||
if( !m_pTextureHeader ) return;
|
||||
if( RI.currententity->curstate.renderfx == kRenderFxGlowShell )
|
||||
g_nStudioCount++;
|
||||
|
||||
m_skinnum = RI.currententity->curstate.skin;
|
||||
pvertbone = ((byte *)m_pStudioHeader + m_pSubModel->vertinfoindex);
|
||||
pnormbone = ((byte *)m_pStudioHeader + m_pSubModel->norminfoindex);
|
||||
ptexture = (mstudiotexture_t *)((byte *)m_pStudioHeader + m_pStudioHeader->textureindex);
|
||||
ptexture = (mstudiotexture_t *)((byte *)m_pTextureHeader + m_pTextureHeader->textureindex);
|
||||
|
||||
pmesh = (mstudiomesh_t *)((byte *)m_pStudioHeader + m_pSubModel->meshindex);
|
||||
pstudioverts = (vec3_t *)((byte *)m_pStudioHeader + m_pSubModel->vertindex);
|
||||
pstudionorms = (vec3_t *)((byte *)m_pStudioHeader + m_pSubModel->normindex);
|
||||
|
||||
pskinref = (short *)((byte *)m_pStudioHeader + m_pStudioHeader->skinindex);
|
||||
if( m_skinnum != 0 && m_skinnum < m_pStudioHeader->numskinfamilies )
|
||||
pskinref += (m_skinnum * m_pStudioHeader->numskinref);
|
||||
pskinref = (short *)((byte *)m_pTextureHeader + m_pTextureHeader->skinindex);
|
||||
if( m_skinnum != 0 && m_skinnum < m_pTextureHeader->numskinfamilies )
|
||||
pskinref += (m_skinnum * m_pTextureHeader->numskinref);
|
||||
|
||||
for( i = 0; i < m_pSubModel->numverts; i++ )
|
||||
Matrix3x4_VectorTransform( g_bonestransform[pvertbone[i]], pstudioverts[i], g_xformverts[i] );
|
||||
|
@ -1986,6 +1992,38 @@ void R_StudioSetForceFaceFlags( int flags )
|
|||
g_nFaceFlags = flags;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_StudioSetupTextureHeader
|
||||
|
||||
===============
|
||||
*/
|
||||
void R_StudioSetupTextureHeader( void )
|
||||
{
|
||||
#ifndef STUDIO_MERGE_TEXTURES
|
||||
if( !m_pStudioHeader->numtextures || !m_pStudioHeader->textureindex )
|
||||
{
|
||||
string texturename;
|
||||
model_t *textures;
|
||||
|
||||
Q_strncpy( texturename, R_StudioTexName( RI.currentmodel ), sizeof( texturename ));
|
||||
textures = Mod_ForName( texturename, false );
|
||||
|
||||
if( !textures )
|
||||
{
|
||||
m_pTextureHeader = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
m_pTextureHeader = (studiohdr_t *)Mod_Extradata( textures );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
m_pTextureHeader = m_pStudioHeader;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
pfnStudioSetHeader
|
||||
|
@ -1995,6 +2033,8 @@ pfnStudioSetHeader
|
|||
void R_StudioSetHeader( studiohdr_t *pheader )
|
||||
{
|
||||
m_pStudioHeader = pheader;
|
||||
|
||||
R_StudioSetupTextureHeader ();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2724,7 +2764,7 @@ void Mod_LoadStudioModel( model_t *mod, const void *buffer )
|
|||
if( !phdr ) return; // bad model
|
||||
|
||||
loadmodel->mempool = Mem_AllocPool( va("^2%s^7", loadmodel->name ));
|
||||
|
||||
#ifdef STUDIO_MERGE_TEXTURES
|
||||
if( phdr->numtextures == 0 )
|
||||
{
|
||||
studiohdr_t *thdr;
|
||||
|
@ -2767,7 +2807,11 @@ void Mod_LoadStudioModel( model_t *mod, const void *buffer )
|
|||
Q_memcpy( loadmodel->cache.data, buffer, phdr->texturedataindex );
|
||||
phdr->length = phdr->texturedataindex; // update model size
|
||||
}
|
||||
|
||||
#else
|
||||
// just copy model into memory
|
||||
loadmodel->cache.data = Mem_Alloc( loadmodel->mempool, phdr->length );
|
||||
Q_memcpy( loadmodel->cache.data, buffer, phdr->length );
|
||||
#endif
|
||||
// setup bounding box
|
||||
VectorCopy( phdr->bbmin, loadmodel->mins );
|
||||
VectorCopy( phdr->bbmax, loadmodel->maxs );
|
||||
|
|
|
@ -435,7 +435,7 @@ void S_StartSound( const vec3_t pos, int ent, int chan, sound_t handle, float fv
|
|||
|
||||
if( !target_chan )
|
||||
{
|
||||
MsgDev( D_ERROR, "dropped sound \"sound/%s\"\n", sfx->name );
|
||||
MsgDev( D_NOTE, "^1Error: ^7dropped sound \"sound/%s\"\n", sfx->name );
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -597,7 +597,7 @@ void Host_InitCommon( const char *progname, qboolean bChangeGame )
|
|||
host.type = HOST_CREDITS;
|
||||
host.con_showalways = true;
|
||||
Con_CreateConsole();
|
||||
Sys_Break( show_credits, szTemp );
|
||||
Sys_Break( show_credits, Q_timestamp( TIME_YEAR_ONLY ));
|
||||
}
|
||||
|
||||
Con_CreateConsole();
|
||||
|
|
|
@ -71,12 +71,12 @@ qboolean LibraryLoadSymbols( dll_user_t *hInst )
|
|||
LONG nt_signature;
|
||||
PE_HEADER pe_header;
|
||||
SECTION_HEADER section_header;
|
||||
qboolean edata_found;
|
||||
qboolean rdata_found;
|
||||
OPTIONAL_HEADER optional_header;
|
||||
long edata_offset;
|
||||
long edata_delta;
|
||||
long edata_delta = 0;
|
||||
EXPORT_DIRECTORY export_directory;
|
||||
long name_offset;
|
||||
long exports_offset;
|
||||
long ordinal_offset;
|
||||
long function_offset;
|
||||
string function_name;
|
||||
|
@ -144,36 +144,39 @@ qboolean LibraryLoadSymbols( dll_user_t *hInst )
|
|||
goto table_error;
|
||||
}
|
||||
|
||||
edata_found = false;
|
||||
rdata_found = false;
|
||||
|
||||
for( i = 0; i < pe_header.NumberOfSections; i++ )
|
||||
{
|
||||
|
||||
if( FS_Read( f, §ion_header, sizeof( section_header )) != sizeof( section_header ))
|
||||
{
|
||||
Q_sprintf( errorstring, "%s error during reading section header", hInst->shortPath );
|
||||
goto table_error;
|
||||
}
|
||||
|
||||
if( !Q_strcmp((char *)section_header.Name, ".edata" ))
|
||||
if( !Q_strcmp( section_header.Name, ".rdata" ))
|
||||
{
|
||||
edata_found = true;
|
||||
rdata_found = true;
|
||||
break;
|
||||
}
|
||||
#if 0
|
||||
if((( optional_header.DataDirectory[0].VirtualAddress >= section_header.VirtualAddress ) &&
|
||||
(optional_header.DataDirectory[0].VirtualAddress < (section_header.VirtualAddress + section_header.Misc.VirtualSize))))
|
||||
{
|
||||
rdata_found = true;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if( edata_found )
|
||||
if( rdata_found )
|
||||
{
|
||||
edata_offset = section_header.PointerToRawData;
|
||||
edata_delta = section_header.VirtualAddress - section_header.PointerToRawData;
|
||||
}
|
||||
else
|
||||
{
|
||||
edata_offset = optional_header.DataDirectory[0].VirtualAddress;
|
||||
edata_delta = 0;
|
||||
}
|
||||
|
||||
if( FS_Seek( f, edata_offset, SEEK_SET ) == -1 )
|
||||
exports_offset = optional_header.DataDirectory[0].VirtualAddress - edata_delta;
|
||||
|
||||
if( FS_Seek( f, exports_offset, SEEK_SET ) == -1 )
|
||||
{
|
||||
Q_sprintf( errorstring, "%s does not have a valid exports section", hInst->shortPath );
|
||||
goto table_error;
|
||||
|
@ -189,7 +192,8 @@ qboolean LibraryLoadSymbols( dll_user_t *hInst )
|
|||
|
||||
if( hInst->num_ordinals > MAX_LIBRARY_EXPORTS )
|
||||
{
|
||||
Q_sprintf( errorstring, "%s too many exports", hInst->shortPath );
|
||||
Q_sprintf( errorstring, "%s too many exports %i", hInst->shortPath, hInst->num_ordinals );
|
||||
hInst->num_ordinals = 0;
|
||||
goto table_error;
|
||||
}
|
||||
|
||||
|
@ -210,6 +214,7 @@ qboolean LibraryLoadSymbols( dll_user_t *hInst )
|
|||
}
|
||||
|
||||
function_offset = export_directory.AddressOfFunctions - edata_delta;
|
||||
|
||||
if( FS_Seek( f, function_offset, SEEK_SET ) == -1 )
|
||||
{
|
||||
Q_sprintf( errorstring, "%s does not have a valid export address section", hInst->shortPath );
|
||||
|
|
|
@ -1575,13 +1575,24 @@ Mod_FindName
|
|||
|
||||
==================
|
||||
*/
|
||||
model_t *Mod_FindName( const char *name, qboolean create )
|
||||
model_t *Mod_FindName( const char *filename, qboolean create )
|
||||
{
|
||||
model_t *mod;
|
||||
int i;
|
||||
char name[64];
|
||||
int i, j;
|
||||
|
||||
if( !name || !name[0] )
|
||||
if( !filename || !filename[0] )
|
||||
return NULL;
|
||||
|
||||
// eliminate '!' symbol (i'm doesn't know what this doing)
|
||||
for( i = j = 0; i < Q_strlen( filename ); i++ )
|
||||
{
|
||||
if( filename[i] == '!' ) continue;
|
||||
else if( filename[i] == '\\' ) name[j] = '/';
|
||||
else name[j] = Q_tolower( filename[i] );
|
||||
j++;
|
||||
}
|
||||
name[j] = '\0';
|
||||
|
||||
// search the currently loaded models
|
||||
for( i = 0, mod = cm_models; i < cm_nummodels; i++, mod++ )
|
||||
|
@ -1636,7 +1647,7 @@ model_t *Mod_LoadModel( model_t *mod, qboolean crash )
|
|||
if( mod->mempool || mod->name[0] == '*' )
|
||||
return mod;
|
||||
|
||||
buf = FS_LoadFile( mod->name, NULL, false );
|
||||
buf = COM_LoadFile( mod->name, 0, NULL );
|
||||
if( !buf )
|
||||
{
|
||||
if( crash ) Host_Error( "Mod_ForName: %s couldn't load\n", mod->name );
|
||||
|
|
|
@ -99,7 +99,7 @@ static void SV_AddEntitiesToPacket( edict_t *pViewEnt, edict_t *pClient, client_
|
|||
if( ent->free ) continue;
|
||||
|
||||
// don't double add an entity through portals (already added)
|
||||
if( ent->v.pushmsec == sv.net_framenum )
|
||||
if( ent->v.gamestate == sv.net_framenum )
|
||||
continue;
|
||||
|
||||
if( ent->v.effects & EF_REQUEST_PHS )
|
||||
|
@ -117,7 +117,7 @@ static void SV_AddEntitiesToPacket( edict_t *pViewEnt, edict_t *pClient, client_
|
|||
if( svgame.dllFuncs.pfnAddToFullPack( state, e, ent, pClient, sv.hostflags, player, pset ))
|
||||
{
|
||||
// to prevent adds it twice through portals
|
||||
ent->v.pushmsec = sv.net_framenum;
|
||||
ent->v.gamestate = sv.net_framenum;
|
||||
|
||||
if( netclient && netclient->modelindex ) // apply custom model if present
|
||||
state->modelindex = netclient->modelindex;
|
||||
|
@ -397,8 +397,7 @@ void SV_WriteClientdataToMessage( sv_client_t *cl, sizebuf_t *msg )
|
|||
}
|
||||
|
||||
clent->v.fixangle = 0; // reset fixangle
|
||||
clent->v.pushmsec = 0; // reset pushmsec
|
||||
|
||||
clent->v.gamestate = 0; // reset gamestate
|
||||
Q_memset( &frame->clientdata, 0, sizeof( frame->clientdata ));
|
||||
|
||||
// update clientdata_t
|
||||
|
|
|
@ -299,7 +299,8 @@ void SV_ActivateServer( void )
|
|||
MsgDev( D_INFO, "Game started\n" );
|
||||
}
|
||||
|
||||
Mod_FreeUnused ();
|
||||
if( host.type == HOST_DEDICATED )
|
||||
Mod_FreeUnused ();
|
||||
|
||||
sv.state = ss_active;
|
||||
physinfo->modified = true;
|
||||
|
|
|
@ -590,7 +590,7 @@ trace_t SV_PushEntity( edict_t *ent, const vec3_t lpush, const vec3_t apush, int
|
|||
|
||||
trace = SV_Move( ent->v.origin, ent->v.mins, ent->v.maxs, end, type, ent );
|
||||
|
||||
if( !trace.allsolid && trace.fraction != 0.0f )
|
||||
if( trace.fraction != 0.0f )
|
||||
{
|
||||
VectorCopy( trace.endpos, ent->v.origin );
|
||||
|
||||
|
|
Reference in New Issue