25 Feb 2013
This commit is contained in:
parent
2b5631a252
commit
cae4942779
|
@ -169,6 +169,13 @@ typedef struct render_api_s
|
|||
// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 26
|
||||
void (*R_EntityRemoveDecals)( struct model_s *mod ); // remove all the decals from specified entity (BSP only)
|
||||
float *(*R_DecalSetupVerts)( struct decal_s *pDecal, struct msurface_s *surf, int texture, int *outCount );
|
||||
|
||||
// find in files
|
||||
char **(*GetFilesList)( const char *pattern, int *numFiles, int gamedironly );
|
||||
|
||||
// engine memory manager (permanent safe pool)
|
||||
void* (*MemAlloc)( size_t cb, const char *filename, const int fileline );
|
||||
void (*MemFree)( void *mem, const char *filename, const int fileline );
|
||||
} render_api_t;
|
||||
|
||||
// render callbacks
|
||||
|
@ -187,6 +194,8 @@ typedef struct render_interface_s
|
|||
int (*R_CreateStudioDecalList)( decallist_t *pList, int count, qboolean changelevel );
|
||||
// grab r_speeds message
|
||||
qboolean (*R_SpeedsMessage)( char *out, size_t size );
|
||||
// replace with built-in R_DrawCubemapView for make skyshots or envshots
|
||||
qboolean (*R_DrawCubemapView)( const float *origin, const float *angles, int size );
|
||||
} render_interface_t;
|
||||
|
||||
#endif//RENDER_API_H
|
|
@ -106,7 +106,7 @@ void CL_DuplicateTexture( mstudiotexture_t *ptexture, int topcolor, int bottomco
|
|||
byte paletteBackup[768];
|
||||
byte *raw, *pal;
|
||||
|
||||
// save of the real texture index
|
||||
// save off the real texture index
|
||||
index = ptexture->index;
|
||||
glt = R_GetTexture( index );
|
||||
Q_snprintf( texname, sizeof( texname ), "#%i_%s", RI.currententity->curstate.number, glt->name + 1 );
|
||||
|
@ -219,7 +219,7 @@ void CL_AllocRemapInfo( int topcolor, int bottomcolor )
|
|||
CL_FreeRemapInfo( clgame.remap_info[i] );
|
||||
clgame.remap_info[i] = NULL;
|
||||
}
|
||||
return; // missed or hided model, ignore it
|
||||
return; // missed or hide model, ignore it
|
||||
}
|
||||
|
||||
// model doesn't contains remap textures
|
||||
|
@ -240,7 +240,7 @@ void CL_AllocRemapInfo( int topcolor, int bottomcolor )
|
|||
src = (mstudiotexture_t *)(((byte *)phdr) + phdr->textureindex);
|
||||
dst = (clgame.remap_info[i] ? clgame.remap_info[i]->ptexture : NULL);
|
||||
|
||||
// NOTE: we must copy all the structures 'mstudiotexture_t' for easy acces when model is rendering
|
||||
// NOTE: we must copy all the structures 'mstudiotexture_t' for easy access when model is rendering
|
||||
if( !CL_CmpStudioTextures( phdr->numtextures, src, dst ) || clgame.remap_info[i]->model != RI.currentmodel )
|
||||
{
|
||||
// this code catches studiomodel change with another studiomodel with remap textures
|
||||
|
|
|
@ -377,7 +377,7 @@ const envmap_t r_envMapInfo[6] =
|
|||
{{ 0, 90, 0}, 0 },
|
||||
{{ 0, 270, 180}, 0 },
|
||||
{{-90, 180, -90}, 0 },
|
||||
{{ 90, 180, 90}, 0 }
|
||||
{{ 90, 0, 90}, 0 }
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -498,10 +498,13 @@ qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qbo
|
|||
r_side = Mem_Alloc( r_temppool, sizeof( rgbdata_t ));
|
||||
|
||||
// use client vieworg
|
||||
if( !vieworg ) vieworg = r_lastRefdef.vieworg;
|
||||
if( !vieworg ) vieworg = cl.refdef.vieworg;
|
||||
|
||||
for( i = 0; i < 6; i++ )
|
||||
{
|
||||
// go into 3d mode
|
||||
R_Set2DMode( false );
|
||||
|
||||
if( skyshot )
|
||||
{
|
||||
R_DrawCubemapView( vieworg, r_skyBoxInfo[i].angles, size );
|
||||
|
|
|
@ -1264,6 +1264,7 @@ void R_RenderFrame( const ref_params_t *fd, qboolean drawWorld )
|
|||
{
|
||||
if( clgame.drawFuncs.GL_RenderFrame( fd, drawWorld ))
|
||||
{
|
||||
RI.drawWorld = drawWorld;
|
||||
tr.fResetVis = true;
|
||||
return;
|
||||
}
|
||||
|
@ -1334,6 +1335,12 @@ void R_DrawCubemapView( const vec3_t origin, const vec3_t angles, int size )
|
|||
{
|
||||
ref_params_t *fd;
|
||||
|
||||
if( clgame.drawFuncs.R_DrawCubemapView != NULL )
|
||||
{
|
||||
if( clgame.drawFuncs.R_DrawCubemapView( origin, angles, size ))
|
||||
return;
|
||||
}
|
||||
|
||||
fd = &RI.refdef;
|
||||
*fd = r_lastRefdef;
|
||||
fd->time = 0;
|
||||
|
@ -1346,8 +1353,6 @@ void R_DrawCubemapView( const vec3_t origin, const vec3_t angles, int size )
|
|||
VectorCopy( angles, fd->viewangles );
|
||||
VectorCopy( fd->vieworg, RI.pvsorigin );
|
||||
|
||||
R_Set2DMode( false );
|
||||
|
||||
// setup scissor
|
||||
RI.scissor[0] = fd->viewport[0];
|
||||
RI.scissor[1] = glState.height - fd->viewport[3] - fd->viewport[1];
|
||||
|
@ -1538,6 +1543,56 @@ static int GL_LoadTextureNoFilter( const char *name, const byte *buf, size_t siz
|
|||
return GL_LoadTexture( name, buf, size, flags, NULL );
|
||||
}
|
||||
|
||||
/*
|
||||
=========
|
||||
R_GetFilesList
|
||||
|
||||
release prev search on a next call
|
||||
=========
|
||||
*/
|
||||
static char **R_GetFilesList( const char *pattern, int *numFiles, int gamedironly )
|
||||
{
|
||||
static search_t *t = NULL;
|
||||
|
||||
if( t ) Mem_Free( t ); // release prev search
|
||||
|
||||
t = FS_Search( pattern, true, gamedironly );
|
||||
|
||||
if( !t )
|
||||
{
|
||||
if( numFiles )
|
||||
*numFiles = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( numFiles )
|
||||
*numFiles = t->numfilenames;
|
||||
|
||||
return t->filenames;
|
||||
}
|
||||
|
||||
/*
|
||||
=========
|
||||
R_MemAlloc
|
||||
|
||||
=========
|
||||
*/
|
||||
static void *R_MemAlloc( size_t cb, const char *filename, const int fileline )
|
||||
{
|
||||
return _Mem_Alloc( cls.mempool, cb, filename, fileline );
|
||||
}
|
||||
|
||||
/*
|
||||
=========
|
||||
R_MemFree
|
||||
|
||||
=========
|
||||
*/
|
||||
static void R_MemFree( void *mem, const char *filename, const int fileline )
|
||||
{
|
||||
_Mem_Free( mem, filename, fileline );
|
||||
}
|
||||
|
||||
static render_api_t gRenderAPI =
|
||||
{
|
||||
GL_RenderGetParm,
|
||||
|
@ -1580,6 +1635,9 @@ static render_api_t gRenderAPI =
|
|||
GL_TexGen,
|
||||
R_EntityRemoveDecals,
|
||||
R_DecalSetupVerts,
|
||||
R_GetFilesList,
|
||||
R_MemAlloc,
|
||||
R_MemFree,
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -217,18 +217,19 @@ R_StudioExtractBbox
|
|||
Extract bbox from current sequence
|
||||
================
|
||||
*/
|
||||
int R_StudioExtractBbox( studiohdr_t *phdr, int sequence, float *mins, float *maxs )
|
||||
void R_StudioExtractBbox( studiohdr_t *phdr, int sequence, float *mins, float *maxs )
|
||||
{
|
||||
mstudioseqdesc_t *pseqdesc;
|
||||
|
||||
if( !phdr || sequence == -1 )
|
||||
return 0;
|
||||
ASSERT( phdr != NULL );
|
||||
|
||||
// check sequence range
|
||||
if( sequence < 0 || sequence >= phdr->numseq )
|
||||
sequence = 0;
|
||||
|
||||
pseqdesc = (mstudioseqdesc_t *)((byte *)phdr + phdr->seqindex);
|
||||
VectorCopy( pseqdesc[sequence].bbmin, mins );
|
||||
VectorCopy( pseqdesc[sequence].bbmax, maxs );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -244,8 +245,7 @@ static qboolean R_StudioComputeBBox( cl_entity_t *e, vec3_t bbox[8] )
|
|||
vec3_t vectors[3], angles, p1, p2;
|
||||
int i, seq = e->curstate.sequence;
|
||||
|
||||
if( !R_StudioExtractBbox( m_pStudioHeader, seq, tmp_mins, tmp_maxs ))
|
||||
return false;
|
||||
R_StudioExtractBbox( m_pStudioHeader, seq, tmp_mins, tmp_maxs );
|
||||
|
||||
// copy original bbox
|
||||
VectorCopy( m_pStudioHeader->bbmin, studio_mins );
|
||||
|
|
|
@ -90,6 +90,7 @@ ref_globals_t tr;
|
|||
glconfig_t glConfig;
|
||||
glstate_t glState;
|
||||
glwstate_t glw_state;
|
||||
uint num_instances;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -746,6 +747,27 @@ static int VID_ChoosePFD( PIXELFORMATDESCRIPTOR *pfd, int colorBits, int alphaBi
|
|||
return pixelFormat;
|
||||
}
|
||||
|
||||
BOOL CALLBACK pfnEnumWnd( HWND hwnd, LPARAM lParam )
|
||||
{
|
||||
string wndname;
|
||||
|
||||
if( GetClassName( hwnd, wndname, sizeof( wndname ) - 1 ))
|
||||
{
|
||||
if( !Q_strcmp( wndname, WINDOW_NAME ))
|
||||
num_instances++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
uint VID_EnumerateInstances( void )
|
||||
{
|
||||
num_instances = 0;
|
||||
|
||||
if( EnumWindows( &pfnEnumWnd, 0 ))
|
||||
return num_instances;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void VID_StartupGamma( void )
|
||||
{
|
||||
size_t gamma_size;
|
||||
|
@ -841,7 +863,12 @@ void VID_StartupGamma( void )
|
|||
|
||||
void VID_RestoreGamma( void )
|
||||
{
|
||||
if( !glw_state.hDC || !glConfig.deviceSupportsGamma ) return;
|
||||
if( !glw_state.hDC || !glConfig.deviceSupportsGamma )
|
||||
return;
|
||||
|
||||
// don't touch gamma if multiple instances was running
|
||||
if( VID_EnumerateInstances( ) > 1 ) return;
|
||||
|
||||
SetDeviceGammaRamp( glw_state.hDC, glState.stateRamp );
|
||||
}
|
||||
|
||||
|
|
|
@ -688,6 +688,7 @@ void Host_InitCommon( const char *progname, qboolean bChangeGame )
|
|||
{
|
||||
// check for duplicate dedicated server
|
||||
host.hMutex = CreateMutex( NULL, 0, "Xash Dedicated Server" );
|
||||
|
||||
if( !host.hMutex )
|
||||
{
|
||||
MSGBOX( "Dedicated server already running" );
|
||||
|
|
|
@ -1040,6 +1040,13 @@ static edict_t *SV_PushRotate( edict_t *pusher, float movetime )
|
|||
Matrix4x4_VectorTransform( end_l, temp, org2 );
|
||||
VectorSubtract( org2, org, lmove );
|
||||
|
||||
if( check->v.movetype == MOVETYPE_PUSHSTEP && lmove[2] < 0.0f )
|
||||
{
|
||||
// pushable sliding
|
||||
check->v.flags &= ~FL_ONGROUND;
|
||||
lmove[2] = 0.0f;
|
||||
}
|
||||
|
||||
// try moving the contacted entity
|
||||
pusher->v.solid = SOLID_NOT;
|
||||
SV_PushEntity( check, lmove, amove, &block );
|
||||
|
@ -1080,15 +1087,16 @@ void SV_Physics_Pusher( edict_t *ent )
|
|||
{
|
||||
float oldtime, oldtime2;
|
||||
float thinktime, movetime;
|
||||
vec3_t last_origin;
|
||||
edict_t *pBlocker;
|
||||
|
||||
pBlocker = NULL;
|
||||
oldtime = ent->v.ltime;
|
||||
thinktime = ent->v.nextthink;
|
||||
|
||||
if( thinktime < ent->v.ltime + host.frametime )
|
||||
if( thinktime < oldtime + host.frametime )
|
||||
{
|
||||
movetime = thinktime - ent->v.ltime;
|
||||
movetime = thinktime - oldtime;
|
||||
if( movetime < 0.0f ) movetime = 0.0f;
|
||||
}
|
||||
else movetime = host.frametime;
|
||||
|
@ -1108,7 +1116,7 @@ void SV_Physics_Pusher( edict_t *ent )
|
|||
// reset the local time to what it was before we rotated
|
||||
ent->v.ltime = oldtime;
|
||||
pBlocker = SV_PushMove( ent, movetime );
|
||||
if( ent->v.ltime < oldtime2 )
|
||||
if( oldtime2 < ent->v.ltime )
|
||||
ent->v.ltime = oldtime2;
|
||||
}
|
||||
}
|
||||
|
@ -1129,10 +1137,23 @@ void SV_Physics_Pusher( edict_t *ent )
|
|||
|
||||
if( thinktime > oldtime && (( ent->v.flags & FL_ALWAYSTHINK ) || thinktime <= ent->v.ltime ))
|
||||
{
|
||||
float diff;
|
||||
|
||||
VectorCopy( ent->v.origin, last_origin );
|
||||
ent->v.nextthink = 0.0f;
|
||||
svgame.globals->time = sv.time;
|
||||
svgame.dllFuncs.pfnThink( ent );
|
||||
if( ent->free ) return;
|
||||
|
||||
diff = fabs( ent->v.origin[2] - last_origin[2] );
|
||||
|
||||
// TESTTEST: remove time glitches to prevent stuck in the trains
|
||||
if( diff > 0.0f && diff <= 0.5f )
|
||||
{
|
||||
Msg( "restore valid origin from %g to %g( %s )\n", ent->v.origin[2], last_origin[2], SV_ClassName( ent ));
|
||||
VectorCopy( last_origin, ent->v.origin );
|
||||
SV_LinkEdict( ent, false );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1155,7 +1176,7 @@ void SV_Physics_Follow( edict_t *ent )
|
|||
|
||||
if( !SV_IsValidEdict( parent ))
|
||||
{
|
||||
MsgDev( D_ERROR, "%s have MOVETYPE_FOLLOW with no corresponding ent!", SV_ClassName( ent ));
|
||||
MsgDev( D_ERROR, "%s have MOVETYPE_FOLLOW with no corresponding ent!\n", SV_ClassName( ent ));
|
||||
ent->v.movetype = MOVETYPE_NONE;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -703,7 +703,7 @@ static void SV_FinishPMove( playermove_t *pmove, sv_client_t *cl )
|
|||
VectorCopy( pmove->movedir, clent->v.movedir );
|
||||
clent->v.flTimeStepSound = pmove->flTimeStepSound;
|
||||
clent->v.flFallVelocity = pmove->flFallVelocity;
|
||||
clent->v.oldbuttons = pmove->cmd.buttons;
|
||||
clent->v.oldbuttons = pmove->oldbuttons;
|
||||
clent->v.waterlevel = pmove->waterlevel;
|
||||
clent->v.watertype = pmove->watertype;
|
||||
clent->v.maxspeed = pmove->clientmaxspeed;
|
||||
|
|
Reference in New Issue