03 Feb 2018
This commit is contained in:
parent
534a248cf7
commit
70d9efc3ac
|
@ -30,7 +30,6 @@ BRUSH MODELS
|
||||||
// header
|
// header
|
||||||
#define Q1BSP_VERSION 29 // quake1 regular version (beta is 28)
|
#define Q1BSP_VERSION 29 // quake1 regular version (beta is 28)
|
||||||
#define HLBSP_VERSION 30 // half-life regular version
|
#define HLBSP_VERSION 30 // half-life regular version
|
||||||
#define XTBSP_VERSION 31 // extended lightmaps and expanded clipnodes limit
|
|
||||||
#define QBSP2_VERSION (('B' << 0) | ('S' << 8) | ('P' << 16) | ('2'<<24))
|
#define QBSP2_VERSION (('B' << 0) | ('S' << 8) | ('P' << 16) | ('2'<<24))
|
||||||
|
|
||||||
#define IDEXTRAHEADER (('H'<<24)+('S'<<16)+('A'<<8)+'X') // little-endian "XASH"
|
#define IDEXTRAHEADER (('H'<<24)+('S'<<16)+('A'<<8)+'X') // little-endian "XASH"
|
||||||
|
@ -65,8 +64,9 @@ BRUSH MODELS
|
||||||
#define LS_UNUSED 0xFE
|
#define LS_UNUSED 0xFE
|
||||||
#define LS_NONE 0xFF
|
#define LS_NONE 0xFF
|
||||||
|
|
||||||
|
// these limis not using by modelloader only for display 'mapstats' correctly
|
||||||
#ifdef SUPPORT_BSP2_FORMAT
|
#ifdef SUPPORT_BSP2_FORMAT
|
||||||
#define MAX_MAP_MODELS 2048 // can be increased up to 2048 if needed
|
#define MAX_MAP_MODELS 2048 // embedded models
|
||||||
#define MAX_MAP_ENTSTRING 0x200000 // 2 Mb should be enough
|
#define MAX_MAP_ENTSTRING 0x200000 // 2 Mb should be enough
|
||||||
#define MAX_MAP_PLANES 131072 // can be increased without problems
|
#define MAX_MAP_PLANES 131072 // can be increased without problems
|
||||||
#define MAX_MAP_NODES 262144 // because negative shorts are leafs
|
#define MAX_MAP_NODES 262144 // because negative shorts are leafs
|
||||||
|
@ -76,7 +76,7 @@ BRUSH MODELS
|
||||||
#define MAX_MAP_FACES 262144 // unsigned short limit
|
#define MAX_MAP_FACES 262144 // unsigned short limit
|
||||||
#define MAX_MAP_MARKSURFACES 524288 // unsigned short limit
|
#define MAX_MAP_MARKSURFACES 524288 // unsigned short limit
|
||||||
#else
|
#else
|
||||||
#define MAX_MAP_MODELS 1024 // can be increased up to 2048 if needed
|
#define MAX_MAP_MODELS 512 // embedded models
|
||||||
#define MAX_MAP_ENTSTRING 0x80000 // 512 kB should be enough
|
#define MAX_MAP_ENTSTRING 0x80000 // 512 kB should be enough
|
||||||
#define MAX_MAP_PLANES 65536 // can be increased without problems
|
#define MAX_MAP_PLANES 65536 // can be increased without problems
|
||||||
#define MAX_MAP_NODES 32767 // because negative shorts are leafs
|
#define MAX_MAP_NODES 32767 // because negative shorts are leafs
|
||||||
|
@ -116,16 +116,12 @@ BRUSH MODELS
|
||||||
#define LUMP_MODELS 14 // internal submodels
|
#define LUMP_MODELS 14 // internal submodels
|
||||||
#define HEADER_LUMPS 15
|
#define HEADER_LUMPS 15
|
||||||
|
|
||||||
// version 31
|
// extra lump ordering
|
||||||
#define LUMP_CLIPNODES2 15 // hull0 goes into LUMP_NODES, hull1 goes into LUMP_CLIPNODES,
|
|
||||||
#define LUMP_CLIPNODES3 16 // hull2 goes into LUMP_CLIPNODES2, hull3 goes into LUMP_CLIPNODES3
|
|
||||||
#define HEADER_LUMPS_31 17
|
|
||||||
|
|
||||||
#define LUMP_LIGHTVECS 0 // deluxemap data
|
#define LUMP_LIGHTVECS 0 // deluxemap data
|
||||||
#define LUMP_FACEINFO 1 // landscape and lightmap resolution info
|
#define LUMP_FACEINFO 1 // landscape and lightmap resolution info
|
||||||
#define LUMP_CUBEMAPS 2 // cubemap description
|
#define LUMP_CUBEMAPS 2 // cubemap description
|
||||||
#define LUMP_VERTNORMALS 3 // phong shaded vertex normals
|
#define LUMP_VERTNORMALS 3 // phong shaded vertex normals
|
||||||
#define LUMP_LEAF_LIGHTING 4 // contain compressed light cubes per empty leafs
|
#define LUMP_VERTEX_LIGHT 4 // contain compressed light cubes per empty leafs
|
||||||
#define LUMP_WORLDLIGHTS 5 // list of all the virtual and real lights (used to relight models in-game)
|
#define LUMP_WORLDLIGHTS 5 // list of all the virtual and real lights (used to relight models in-game)
|
||||||
#define LUMP_COLLISION 6 // physics engine collision hull dump
|
#define LUMP_COLLISION 6 // physics engine collision hull dump
|
||||||
#define LUMP_AINODEGRAPH 7 // node graph that stored into the bsp
|
#define LUMP_AINODEGRAPH 7 // node graph that stored into the bsp
|
||||||
|
@ -139,6 +135,7 @@ BRUSH MODELS
|
||||||
#define TEX_SPECIAL BIT( 0 ) // sky or slime, no lightmap or 256 subdivision
|
#define TEX_SPECIAL BIT( 0 ) // sky or slime, no lightmap or 256 subdivision
|
||||||
#define TEX_WORLD_LUXELS BIT( 1 ) // alternative lightmap matrix will be used (luxels per world units instead of luxels per texels)
|
#define TEX_WORLD_LUXELS BIT( 1 ) // alternative lightmap matrix will be used (luxels per world units instead of luxels per texels)
|
||||||
#define TEX_AXIAL_LUXELS BIT( 2 ) // force world luxels to axial positive scales
|
#define TEX_AXIAL_LUXELS BIT( 2 ) // force world luxels to axial positive scales
|
||||||
|
#define TEX_EXTRA_LIGHTMAP BIT( 3 ) // bsp31 legacy - using 8 texels per luxel instead of 16 texels per luxel
|
||||||
|
|
||||||
// ambient sound types
|
// ambient sound types
|
||||||
enum
|
enum
|
||||||
|
@ -168,13 +165,7 @@ typedef struct
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int version;
|
int id; // must be little endian XASH
|
||||||
dlump_t lumps[HEADER_LUMPS_31];
|
|
||||||
} dheader31_t;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
int id; // must be little endian XASH
|
|
||||||
int version;
|
int version;
|
||||||
dlump_t lumps[EXTRA_LUMPS];
|
dlump_t lumps[EXTRA_LUMPS];
|
||||||
} dextrahdr_t;
|
} dextrahdr_t;
|
||||||
|
|
|
@ -46,7 +46,7 @@ GNU General Public License for more details.
|
||||||
#define PARM_TEX_GLFORMAT 13 // get a texture GL-format
|
#define PARM_TEX_GLFORMAT 13 // get a texture GL-format
|
||||||
#define PARM_TEX_ENCODE 14 // custom encoding for DXT image
|
#define PARM_TEX_ENCODE 14 // custom encoding for DXT image
|
||||||
#define PARM_TEX_MIPCOUNT 15 // count of mipmaps (0 - autogenerated, 1 - disabled of mipmapping)
|
#define PARM_TEX_MIPCOUNT 15 // count of mipmaps (0 - autogenerated, 1 - disabled of mipmapping)
|
||||||
#define PARM_WORLD_VERSION 16 // return the version of bsp
|
#define PARM_BSP2_SUPPORTED 16 // tell custom renderer what engine is support BSP2 in this build
|
||||||
#define PARM_SKY_SPHERE 17 // sky is quake sphere ?
|
#define PARM_SKY_SPHERE 17 // sky is quake sphere ?
|
||||||
#define PARM_MAP_HAS_MIRRORS 18 // current map has mirorrs
|
#define PARM_MAP_HAS_MIRRORS 18 // current map has mirorrs
|
||||||
#define PARM_MAP_HAS_DELUXE 19 // map has deluxedata
|
#define PARM_MAP_HAS_DELUXE 19 // map has deluxedata
|
||||||
|
@ -225,7 +225,7 @@ typedef struct render_api_s
|
||||||
void (*pfnMemFree)( void *mem, const char *filename, const int fileline );
|
void (*pfnMemFree)( void *mem, const char *filename, const int fileline );
|
||||||
// find in files
|
// find in files
|
||||||
char **(*pfnGetFilesList)( const char *pattern, int *numFiles, int gamedironly );
|
char **(*pfnGetFilesList)( const char *pattern, int *numFiles, int gamedironly );
|
||||||
unsigned int (*pfnFileBufferCRC32)( const void *buffer, const int length );
|
unsigned long (*pfnFileBufferCRC32)( const void *buffer, const int length );
|
||||||
// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 35
|
// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 35
|
||||||
} render_api_t;
|
} render_api_t;
|
||||||
|
|
||||||
|
|
|
@ -2801,7 +2801,6 @@ void pfnSPR_DrawGeneric( int frame, int x, int y, const wrect_t *prc, int blends
|
||||||
=============
|
=============
|
||||||
pfnDrawString
|
pfnDrawString
|
||||||
|
|
||||||
TODO: implement
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
int pfnDrawString( int x, int y, const char *str, int r, int g, int b )
|
int pfnDrawString( int x, int y, const char *str, int r, int g, int b )
|
||||||
|
@ -2817,7 +2816,6 @@ int pfnDrawString( int x, int y, const char *str, int r, int g, int b )
|
||||||
=============
|
=============
|
||||||
pfnDrawStringReverse
|
pfnDrawStringReverse
|
||||||
|
|
||||||
TODO: implement
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
int pfnDrawStringReverse( int x, int y, const char *str, int r, int g, int b )
|
int pfnDrawStringReverse( int x, int y, const char *str, int r, int g, int b )
|
||||||
|
@ -2847,7 +2845,6 @@ const char *LocalPlayerInfo_ValueForKey( const char* key )
|
||||||
=============
|
=============
|
||||||
pfnVGUI2DrawCharacter
|
pfnVGUI2DrawCharacter
|
||||||
|
|
||||||
TODO: implement
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
int pfnVGUI2DrawCharacter( int x, int y, int ch, unsigned int font )
|
int pfnVGUI2DrawCharacter( int x, int y, int ch, unsigned int font )
|
||||||
|
@ -2859,7 +2856,6 @@ int pfnVGUI2DrawCharacter( int x, int y, int ch, unsigned int font )
|
||||||
=============
|
=============
|
||||||
pfnVGUI2DrawCharacterAdditive
|
pfnVGUI2DrawCharacterAdditive
|
||||||
|
|
||||||
TODO: implement
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
int pfnVGUI2DrawCharacterAdditive( int x, int y, int ch, int r, int g, int b, unsigned int font )
|
int pfnVGUI2DrawCharacterAdditive( int x, int y, int ch, int r, int g, int b, unsigned int font )
|
||||||
|
@ -2975,11 +2971,12 @@ int pfnGetAppID( void )
|
||||||
=============
|
=============
|
||||||
pfnVguiWrap2_GetMouseDelta
|
pfnVguiWrap2_GetMouseDelta
|
||||||
|
|
||||||
TODO: implement
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void pfnVguiWrap2_GetMouseDelta( int *x, int *y )
|
void pfnVguiWrap2_GetMouseDelta( int *x, int *y )
|
||||||
{
|
{
|
||||||
|
if( x ) *x = 0;
|
||||||
|
if( y ) *y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -4076,9 +4073,8 @@ qboolean CL_LoadProgs( const char *name )
|
||||||
clgame.mempool = Mem_AllocPool( "Client Edicts Zone" );
|
clgame.mempool = Mem_AllocPool( "Client Edicts Zone" );
|
||||||
clgame.entities = NULL;
|
clgame.entities = NULL;
|
||||||
|
|
||||||
// NOTE: important stuff!
|
// NOTE: important stuff! vgui must startup BEFORE loading client.dll
|
||||||
// vgui must startup BEFORE loading client.dll to avoid get error ERROR_NOACESS
|
// to avoid get error ERROR_NOACESS during LoadLibrary
|
||||||
// during LoadLibrary
|
|
||||||
VGui_Startup ();
|
VGui_Startup ();
|
||||||
|
|
||||||
clgame.hInstance = Com_LoadLibrary( name, false );
|
clgame.hInstance = Com_LoadLibrary( name, false );
|
||||||
|
|
|
@ -513,6 +513,8 @@ void CL_ParseStaticEntity( sizebuf_t *msg )
|
||||||
state.frame = MSG_ReadByte( msg );
|
state.frame = MSG_ReadByte( msg );
|
||||||
state.colormap = MSG_ReadWord( msg );
|
state.colormap = MSG_ReadWord( msg );
|
||||||
state.skin = MSG_ReadByte( msg );
|
state.skin = MSG_ReadByte( msg );
|
||||||
|
state.body = MSG_ReadByte( msg );
|
||||||
|
state.scale = MSG_ReadCoord( msg );
|
||||||
|
|
||||||
for( i = 0; i < 3; i++ )
|
for( i = 0; i < 3; i++ )
|
||||||
{
|
{
|
||||||
|
@ -693,12 +695,16 @@ void CL_ParseServerData( sizebuf_t *msg )
|
||||||
cl.maxclients = MSG_ReadByte( msg );
|
cl.maxclients = MSG_ReadByte( msg );
|
||||||
clgame.maxEntities = MSG_ReadWord( msg );
|
clgame.maxEntities = MSG_ReadWord( msg );
|
||||||
clgame.maxEntities = bound( 600, clgame.maxEntities, MAX_EDICTS );
|
clgame.maxEntities = bound( 600, clgame.maxEntities, MAX_EDICTS );
|
||||||
|
clgame.maxModels = MSG_ReadWord( msg );
|
||||||
Q_strncpy( clgame.mapname, MSG_ReadString( msg ), MAX_STRING );
|
Q_strncpy( clgame.mapname, MSG_ReadString( msg ), MAX_STRING );
|
||||||
Q_strncpy( clgame.maptitle, MSG_ReadString( msg ), MAX_STRING );
|
Q_strncpy( clgame.maptitle, MSG_ReadString( msg ), MAX_STRING );
|
||||||
background = MSG_ReadOneBit( msg );
|
background = MSG_ReadOneBit( msg );
|
||||||
Q_strncpy( gamefolder, MSG_ReadString( msg ), MAX_STRING );
|
Q_strncpy( gamefolder, MSG_ReadString( msg ), MAX_STRING );
|
||||||
host.features = (uint)MSG_ReadLong( msg );
|
host.features = (uint)MSG_ReadLong( msg );
|
||||||
|
|
||||||
|
if( clgame.maxModels > MAX_MODELS )
|
||||||
|
MsgDev( D_WARN, "server model limit is above client model limit %i > %i\n", clgame.maxModels, MAX_MODELS );
|
||||||
|
|
||||||
if( Con_FixedFont( ))
|
if( Con_FixedFont( ))
|
||||||
{
|
{
|
||||||
// seperate the printfs so the server message can have a color
|
// seperate the printfs so the server message can have a color
|
||||||
|
|
|
@ -92,7 +92,7 @@ void V_SetupViewModel( void )
|
||||||
view->model = Mod_Handle( cl.local.viewmodel );
|
view->model = Mod_Handle( cl.local.viewmodel );
|
||||||
view->curstate.modelindex = cl.local.viewmodel;
|
view->curstate.modelindex = cl.local.viewmodel;
|
||||||
view->curstate.sequence = cl.local.weaponsequence;
|
view->curstate.sequence = cl.local.weaponsequence;
|
||||||
view->curstate.rendermode = kRenderNormal; // EXPERIMENTAL!!!
|
view->curstate.rendermode = kRenderNormal;
|
||||||
|
|
||||||
// alias models has another animation methods
|
// alias models has another animation methods
|
||||||
if( view->model && view->model->type == mod_studio )
|
if( view->model && view->model->type == mod_studio )
|
||||||
|
|
|
@ -243,8 +243,8 @@ typedef struct
|
||||||
char event_precache[MAX_EVENTS][CS_SIZE];
|
char event_precache[MAX_EVENTS][CS_SIZE];
|
||||||
lightstyle_t lightstyles[MAX_LIGHTSTYLES];
|
lightstyle_t lightstyles[MAX_LIGHTSTYLES];
|
||||||
|
|
||||||
int sound_index[MAX_SOUNDS];
|
short sound_index[MAX_SOUNDS];
|
||||||
int decal_index[MAX_DECALS];
|
short decal_index[MAX_DECALS];
|
||||||
|
|
||||||
cl_entity_t *world;
|
cl_entity_t *world;
|
||||||
model_t *worldmodel; // pointer to world
|
model_t *worldmodel; // pointer to world
|
||||||
|
@ -420,7 +420,7 @@ typedef struct
|
||||||
int flags; // FNETAPI_MULTIPLE_RESPONSE etc
|
int flags; // FNETAPI_MULTIPLE_RESPONSE etc
|
||||||
} net_request_t;
|
} net_request_t;
|
||||||
|
|
||||||
// new versions of client dlls have a sanigle export with all callbacks
|
// new versions of client dlls have a single export with all callbacks
|
||||||
typedef void (*CL_EXPORT_FUNCS)( void *pv );
|
typedef void (*CL_EXPORT_FUNCS)( void *pv );
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -440,6 +440,7 @@ typedef struct
|
||||||
int maxEntities;
|
int maxEntities;
|
||||||
int maxRemapInfos; // maxEntities + cl.viewEnt; also used for catch entcount
|
int maxRemapInfos; // maxEntities + cl.viewEnt; also used for catch entcount
|
||||||
int numStatics; // actual static entity count
|
int numStatics; // actual static entity count
|
||||||
|
int maxModels;
|
||||||
|
|
||||||
// movement values from server
|
// movement values from server
|
||||||
movevars_t movevars;
|
movevars_t movevars;
|
||||||
|
|
|
@ -126,8 +126,7 @@ int R_CullSurface( msurface_t *surf, gl_frustum_t *frustum, uint clipflags )
|
||||||
{
|
{
|
||||||
vec3_t orthonormal;
|
vec3_t orthonormal;
|
||||||
|
|
||||||
if( e == clgame.entities || R_StaticEntity( e ))
|
if( e == clgame.entities ) orthonormal[2] = surf->plane->normal[2];
|
||||||
orthonormal[2] = surf->plane->normal[2];
|
|
||||||
else Matrix4x4_VectorRotate( RI.objectMatrix, surf->plane->normal, orthonormal );
|
else Matrix4x4_VectorRotate( RI.objectMatrix, surf->plane->normal, orthonormal );
|
||||||
|
|
||||||
dist = orthonormal[2];
|
dist = orthonormal[2];
|
||||||
|
|
|
@ -36,6 +36,7 @@ extern byte *r_temppool;
|
||||||
#define SUBDIVIDE_SIZE 64
|
#define SUBDIVIDE_SIZE 64
|
||||||
#define MAX_MIRRORS 32 // per one frame!
|
#define MAX_MIRRORS 32 // per one frame!
|
||||||
#define MAX_DECAL_SURFS 4096
|
#define MAX_DECAL_SURFS 4096
|
||||||
|
#define MAX_MIRROR_ENTITIES MAX_MIRRORS
|
||||||
|
|
||||||
#define SHADEDOT_QUANT 16 // precalculated dot products for quantized angles
|
#define SHADEDOT_QUANT 16 // precalculated dot products for quantized angles
|
||||||
#define SHADE_LAMBERT 1.495f
|
#define SHADE_LAMBERT 1.495f
|
||||||
|
@ -194,11 +195,9 @@ typedef struct
|
||||||
int skyboxbasenum; // start with 5800
|
int skyboxbasenum; // start with 5800
|
||||||
|
|
||||||
// entity lists
|
// entity lists
|
||||||
cl_entity_t *static_entities[MAX_VISIBLE_PACKET]; // opaque non-moved brushes
|
gl_entity_t mirror_entities[MAX_MIRROR_ENTITIES]; // an entities that has mirror
|
||||||
gl_entity_t mirror_entities[MAX_VISIBLE_PACKET]; // an entities that has mirror
|
|
||||||
cl_entity_t *solid_entities[MAX_VISIBLE_PACKET]; // opaque moving or alpha brushes
|
cl_entity_t *solid_entities[MAX_VISIBLE_PACKET]; // opaque moving or alpha brushes
|
||||||
cl_entity_t *trans_entities[MAX_VISIBLE_PACKET]; // translucent brushes
|
cl_entity_t *trans_entities[MAX_VISIBLE_PACKET]; // translucent brushes
|
||||||
uint num_static_entities;
|
|
||||||
uint num_mirror_entities;
|
uint num_mirror_entities;
|
||||||
uint num_solid_entities;
|
uint num_solid_entities;
|
||||||
uint num_trans_entities;
|
uint num_trans_entities;
|
||||||
|
@ -258,7 +257,7 @@ extern mleaf_t *r_viewleaf, *r_oldviewleaf;
|
||||||
extern mleaf_t *r_viewleaf2, *r_oldviewleaf2;
|
extern mleaf_t *r_viewleaf2, *r_oldviewleaf2;
|
||||||
extern dlight_t cl_dlights[MAX_DLIGHTS];
|
extern dlight_t cl_dlights[MAX_DLIGHTS];
|
||||||
extern dlight_t cl_elights[MAX_ELIGHTS];
|
extern dlight_t cl_elights[MAX_ELIGHTS];
|
||||||
#define r_numEntities (tr.num_solid_entities + tr.num_trans_entities + tr.num_static_entities)
|
#define r_numEntities (tr.num_solid_entities + tr.num_trans_entities)
|
||||||
#define r_numStatics (r_stats.c_client_ents)
|
#define r_numStatics (r_stats.c_client_ents)
|
||||||
|
|
||||||
extern struct beam_s *cl_active_beams;
|
extern struct beam_s *cl_active_beams;
|
||||||
|
@ -368,7 +367,6 @@ void R_LoadIdentity( void );
|
||||||
void R_RenderScene( void );
|
void R_RenderScene( void );
|
||||||
void R_DrawCubemapView( const vec3_t origin, const vec3_t angles, int size );
|
void R_DrawCubemapView( const vec3_t origin, const vec3_t angles, int size );
|
||||||
void R_SetupRefParams( const struct ref_viewpass_s *rvp );
|
void R_SetupRefParams( const struct ref_viewpass_s *rvp );
|
||||||
qboolean R_StaticEntity( cl_entity_t *ent );
|
|
||||||
void R_TranslateForEntity( cl_entity_t *e );
|
void R_TranslateForEntity( cl_entity_t *e );
|
||||||
void R_RotateForEntity( cl_entity_t *e );
|
void R_RotateForEntity( cl_entity_t *e );
|
||||||
void R_SetupGL( qboolean set_gl_state );
|
void R_SetupGL( qboolean set_gl_state );
|
||||||
|
@ -666,7 +664,6 @@ extern convar_t *gl_lightmap_nearest;
|
||||||
extern convar_t *gl_keeptjunctions;
|
extern convar_t *gl_keeptjunctions;
|
||||||
extern convar_t *gl_detailscale;
|
extern convar_t *gl_detailscale;
|
||||||
extern convar_t *gl_wireframe;
|
extern convar_t *gl_wireframe;
|
||||||
extern convar_t *gl_allow_static;
|
|
||||||
extern convar_t *gl_allow_mirrors;
|
extern convar_t *gl_allow_mirrors;
|
||||||
extern convar_t *gl_polyoffset;
|
extern convar_t *gl_polyoffset;
|
||||||
extern convar_t *gl_finish;
|
extern convar_t *gl_finish;
|
||||||
|
|
|
@ -429,6 +429,9 @@ void R_FindBmodelMirrors( cl_entity_t *e, qboolean static_entity )
|
||||||
gl_frustum_t *frustum = NULL;
|
gl_frustum_t *frustum = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if( tr.num_mirror_entities >= MAX_MIRROR_ENTITIES )
|
||||||
|
return;
|
||||||
|
|
||||||
clmodel = e->model;
|
clmodel = e->model;
|
||||||
|
|
||||||
// don't draw any water reflections if we underwater
|
// don't draw any water reflections if we underwater
|
||||||
|
@ -511,24 +514,7 @@ void R_CheckEntitiesOnList( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// check static entities
|
// world has mirror surfaces
|
||||||
for( i = 0; i < tr.num_static_entities; i++ )
|
|
||||||
{
|
|
||||||
RI.currententity = tr.static_entities[i];
|
|
||||||
RI.currentmodel = RI.currententity->model;
|
|
||||||
|
|
||||||
ASSERT( RI.currententity != NULL );
|
|
||||||
ASSERT( RI.currententity->model != NULL );
|
|
||||||
|
|
||||||
switch( RI.currentmodel->type )
|
|
||||||
{
|
|
||||||
case mod_brush:
|
|
||||||
R_FindBmodelMirrors( RI.currententity, true );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// world or static entities has mirror surfaces
|
|
||||||
if( tr.mirror_entities[0].chain != NULL )
|
if( tr.mirror_entities[0].chain != NULL )
|
||||||
{
|
{
|
||||||
tr.mirror_entities[0].ent = clgame.entities;
|
tr.mirror_entities[0].ent = clgame.entities;
|
||||||
|
|
|
@ -61,40 +61,6 @@ void R_AllowFog( int allowed )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
===============
|
|
||||||
R_StaticEntity
|
|
||||||
|
|
||||||
Static entity is the brush which has no custom origin and not rotated
|
|
||||||
typically is a func_wall, func_breakable, func_ladder etc
|
|
||||||
===============
|
|
||||||
*/
|
|
||||||
qboolean R_StaticEntity( cl_entity_t *ent )
|
|
||||||
{
|
|
||||||
if( !gl_allow_static->value )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if( ent->curstate.rendermode != kRenderNormal )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if( ent->model->type != mod_brush )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if( ent->curstate.effects & ( EF_NOREFLECT|EF_REFLECTONLY ))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if( ent->curstate.frame || ent->model->flags & MODEL_CONVEYOR )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if( ent->curstate.scale ) // waveheight specified
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if( !VectorIsNull( ent->origin ) || !VectorIsNull( ent->angles ))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
R_OpaqueEntity
|
R_OpaqueEntity
|
||||||
|
@ -106,13 +72,6 @@ static qboolean R_OpaqueEntity( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
if( ent->curstate.rendermode == kRenderNormal )
|
if( ent->curstate.rendermode == kRenderNormal )
|
||||||
return true;
|
return true;
|
||||||
#if 0
|
|
||||||
if( ent->model->type != mod_brush )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if( ent->curstate.rendermode == kRenderTransAlpha )
|
|
||||||
return true;
|
|
||||||
#endif
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,7 +196,7 @@ R_ClearScene
|
||||||
void R_ClearScene( void )
|
void R_ClearScene( void )
|
||||||
{
|
{
|
||||||
tr.num_solid_entities = tr.num_trans_entities = 0;
|
tr.num_solid_entities = tr.num_trans_entities = 0;
|
||||||
tr.num_static_entities = tr.num_mirror_entities = 0;
|
tr.num_mirror_entities = 0;
|
||||||
cl.num_custombeams = 0;
|
cl.num_custombeams = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,24 +224,12 @@ qboolean R_AddEntity( struct cl_entity_s *clent, int type )
|
||||||
|
|
||||||
if( R_OpaqueEntity( clent ))
|
if( R_OpaqueEntity( clent ))
|
||||||
{
|
{
|
||||||
if( R_StaticEntity( clent ))
|
// opaque
|
||||||
{
|
if( tr.num_solid_entities >= MAX_VISIBLE_PACKET )
|
||||||
// opaque static
|
return false;
|
||||||
if( tr.num_static_entities >= MAX_VISIBLE_PACKET )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
tr.static_entities[tr.num_static_entities] = clent;
|
tr.solid_entities[tr.num_solid_entities] = clent;
|
||||||
tr.num_static_entities++;
|
tr.num_solid_entities++;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// opaque moving
|
|
||||||
if( tr.num_solid_entities >= MAX_VISIBLE_PACKET )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
tr.solid_entities[tr.num_solid_entities] = clent;
|
|
||||||
tr.num_solid_entities++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -455,7 +402,7 @@ void R_RotateForEntity( cl_entity_t *e )
|
||||||
{
|
{
|
||||||
float scale = 1.0f;
|
float scale = 1.0f;
|
||||||
|
|
||||||
if( e == clgame.entities || R_StaticEntity( e ))
|
if( e == clgame.entities )
|
||||||
{
|
{
|
||||||
R_LoadIdentity();
|
R_LoadIdentity();
|
||||||
return;
|
return;
|
||||||
|
@ -481,7 +428,7 @@ void R_TranslateForEntity( cl_entity_t *e )
|
||||||
{
|
{
|
||||||
float scale = 1.0f;
|
float scale = 1.0f;
|
||||||
|
|
||||||
if( e == clgame.entities || R_StaticEntity( e ))
|
if( e == clgame.entities )
|
||||||
{
|
{
|
||||||
R_LoadIdentity();
|
R_LoadIdentity();
|
||||||
return;
|
return;
|
||||||
|
@ -1209,6 +1156,11 @@ static int GL_RenderGetParm( int parm, int arg )
|
||||||
case PARM_TEX_DEPTH:
|
case PARM_TEX_DEPTH:
|
||||||
glt = R_GetTexture( arg );
|
glt = R_GetTexture( arg );
|
||||||
return glt->depth;
|
return glt->depth;
|
||||||
|
case PARM_BSP2_SUPPORTED:
|
||||||
|
#ifdef SUPPORT_BSP2_FORMAT
|
||||||
|
return 1;
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
case PARM_TEX_SKYBOX:
|
case PARM_TEX_SKYBOX:
|
||||||
ASSERT( arg >= 0 && arg < 6 );
|
ASSERT( arg >= 0 && arg < 6 );
|
||||||
return tr.skyboxTextures[arg];
|
return tr.skyboxTextures[arg];
|
||||||
|
@ -1219,10 +1171,6 @@ static int GL_RenderGetParm( int parm, int arg )
|
||||||
return tr.lightmapTextures[arg];
|
return tr.lightmapTextures[arg];
|
||||||
case PARM_SKY_SPHERE:
|
case PARM_SKY_SPHERE:
|
||||||
return world.sky_sphere && !world.custom_skybox;
|
return world.sky_sphere && !world.custom_skybox;
|
||||||
case PARM_WORLD_VERSION:
|
|
||||||
if( cls.state != ca_active )
|
|
||||||
return bmodel_version;
|
|
||||||
return world.version;
|
|
||||||
case PARM_WIDESCREEN:
|
case PARM_WIDESCREEN:
|
||||||
return glState.wideScreen;
|
return glState.wideScreen;
|
||||||
case PARM_FULLSCREEN:
|
case PARM_FULLSCREEN:
|
||||||
|
|
|
@ -505,6 +505,8 @@ void R_AddDynamicLights( msurface_t *surf )
|
||||||
{
|
{
|
||||||
if( surf->texinfo->faceinfo )
|
if( surf->texinfo->faceinfo )
|
||||||
sample_frac = surf->texinfo->faceinfo->texture_step;
|
sample_frac = surf->texinfo->faceinfo->texture_step;
|
||||||
|
else if( FBitSet( surf->texinfo->flags, TEX_EXTRA_LIGHTMAP ))
|
||||||
|
sample_frac = LM_SAMPLE_EXTRASIZE;
|
||||||
else sample_frac = LM_SAMPLE_SIZE;
|
else sample_frac = LM_SAMPLE_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1607,84 +1609,6 @@ void R_DrawBrushModel( cl_entity_t *e )
|
||||||
R_LoadIdentity(); // restore worldmatrix
|
R_LoadIdentity(); // restore worldmatrix
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=================
|
|
||||||
R_DrawStaticModel
|
|
||||||
|
|
||||||
Merge static model brushes with world surfaces
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
void R_DrawStaticModel( cl_entity_t *e )
|
|
||||||
{
|
|
||||||
int i, k;
|
|
||||||
model_t *clmodel;
|
|
||||||
msurface_t *psurf;
|
|
||||||
dlight_t *l;
|
|
||||||
|
|
||||||
clmodel = e->model;
|
|
||||||
if( R_CullBox( clmodel->mins, clmodel->maxs ))
|
|
||||||
return;
|
|
||||||
|
|
||||||
// calculate dynamic lighting for bmodel
|
|
||||||
for( k = 0, l = cl_dlights; k < MAX_DLIGHTS; k++, l++ )
|
|
||||||
{
|
|
||||||
if( l->die < cl.time || !l->radius )
|
|
||||||
continue;
|
|
||||||
R_MarkLights( l, 1<<k, clmodel->nodes + clmodel->hulls[0].firstclipnode );
|
|
||||||
}
|
|
||||||
|
|
||||||
psurf = &clmodel->surfaces[clmodel->firstmodelsurface];
|
|
||||||
for( i = 0; i < clmodel->nummodelsurfaces; i++, psurf++ )
|
|
||||||
{
|
|
||||||
if( R_CullSurface( psurf, &RI.frustum, 0 ))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if( psurf->flags & SURF_DRAWSKY )
|
|
||||||
{
|
|
||||||
// make sky chain to right clip the skybox
|
|
||||||
psurf->texturechain = skychain;
|
|
||||||
skychain = psurf;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
psurf->texturechain = psurf->texinfo->texture->texturechain;
|
|
||||||
psurf->texinfo->texture->texturechain = psurf;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=================
|
|
||||||
R_DrawStaticBrushes
|
|
||||||
|
|
||||||
Insert static brushes into world texture chains
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
void R_DrawStaticBrushes( void )
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
// draw static entities
|
|
||||||
for( i = 0; i < tr.num_static_entities; i++ )
|
|
||||||
{
|
|
||||||
RI.currententity = tr.static_entities[i];
|
|
||||||
RI.currentmodel = RI.currententity->model;
|
|
||||||
|
|
||||||
ASSERT( RI.currententity != NULL );
|
|
||||||
ASSERT( RI.currententity->model != NULL );
|
|
||||||
|
|
||||||
switch( RI.currententity->model->type )
|
|
||||||
{
|
|
||||||
case mod_brush:
|
|
||||||
R_DrawStaticModel( RI.currententity );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Host_Error( "R_DrawStatics: non bsp model in static list!\n" );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============================================================
|
=============================================================
|
||||||
|
|
||||||
|
@ -1998,15 +1922,9 @@ void R_DrawWorld( void )
|
||||||
R_ClearSkyBox ();
|
R_ClearSkyBox ();
|
||||||
|
|
||||||
if( RI.drawOrtho )
|
if( RI.drawOrtho )
|
||||||
{
|
|
||||||
R_DrawWorldTopView( cl.worldmodel->nodes, RI.frustum.clipFlags );
|
R_DrawWorldTopView( cl.worldmodel->nodes, RI.frustum.clipFlags );
|
||||||
}
|
else R_RecursiveWorldNode( cl.worldmodel->nodes, RI.frustum.clipFlags );
|
||||||
else
|
|
||||||
{
|
|
||||||
R_RecursiveWorldNode( cl.worldmodel->nodes, RI.frustum.clipFlags );
|
|
||||||
}
|
|
||||||
|
|
||||||
R_DrawStaticBrushes();
|
|
||||||
R_DrawTextureChains();
|
R_DrawTextureChains();
|
||||||
|
|
||||||
if( !CL_IsDevOverviewMode( ))
|
if( !CL_IsDevOverviewMode( ))
|
||||||
|
|
|
@ -36,7 +36,6 @@ convar_t *gl_keeptjunctions;
|
||||||
convar_t *gl_showtextures;
|
convar_t *gl_showtextures;
|
||||||
convar_t *gl_detailscale;
|
convar_t *gl_detailscale;
|
||||||
convar_t *gl_check_errors;
|
convar_t *gl_check_errors;
|
||||||
convar_t *gl_allow_static;
|
|
||||||
convar_t *gl_allow_mirrors;
|
convar_t *gl_allow_mirrors;
|
||||||
convar_t *gl_polyoffset;
|
convar_t *gl_polyoffset;
|
||||||
convar_t *gl_wireframe;
|
convar_t *gl_wireframe;
|
||||||
|
@ -1593,7 +1592,6 @@ void GL_InitCommands( void )
|
||||||
gl_texture_anisotropy = Cvar_Get( "gl_anisotropy", "2.0", FCVAR_ARCHIVE, "textures anisotropic filter" );
|
gl_texture_anisotropy = Cvar_Get( "gl_anisotropy", "2.0", FCVAR_ARCHIVE, "textures anisotropic filter" );
|
||||||
gl_texture_lodbias = Cvar_Get( "gl_texture_lodbias", "0.0", FCVAR_ARCHIVE, "LOD bias for mipmapped textures (prefomance|quality)" );
|
gl_texture_lodbias = Cvar_Get( "gl_texture_lodbias", "0.0", FCVAR_ARCHIVE, "LOD bias for mipmapped textures (prefomance|quality)" );
|
||||||
gl_keeptjunctions = Cvar_Get( "gl_keeptjunctions", "1", FCVAR_ARCHIVE, "removing tjuncs causes blinking pixels" );
|
gl_keeptjunctions = Cvar_Get( "gl_keeptjunctions", "1", FCVAR_ARCHIVE, "removing tjuncs causes blinking pixels" );
|
||||||
gl_allow_static = Cvar_Get( "gl_allow_static", "0", FCVAR_ARCHIVE, "force to drawing non-moveable brushes as part of world (save FPS)" );
|
|
||||||
gl_allow_mirrors = Cvar_Get( "gl_allow_mirrors", "1", FCVAR_ARCHIVE, "allow to draw mirror surfaces" );
|
gl_allow_mirrors = Cvar_Get( "gl_allow_mirrors", "1", FCVAR_ARCHIVE, "allow to draw mirror surfaces" );
|
||||||
gl_showtextures = Cvar_Get( "r_showtextures", "0", FCVAR_CHEAT, "show all uploaded textures" );
|
gl_showtextures = Cvar_Get( "r_showtextures", "0", FCVAR_CHEAT, "show all uploaded textures" );
|
||||||
gl_finish = Cvar_Get( "gl_finish", "0", FCVAR_ARCHIVE, "use glFinish instead of glFlush" );
|
gl_finish = Cvar_Get( "gl_finish", "0", FCVAR_ARCHIVE, "use glFinish instead of glFlush" );
|
||||||
|
|
|
@ -94,10 +94,7 @@ qboolean Cmd_GetMapList( const char *s, char *completedname, int length )
|
||||||
{
|
{
|
||||||
case Q1BSP_VERSION:
|
case Q1BSP_VERSION:
|
||||||
case HLBSP_VERSION:
|
case HLBSP_VERSION:
|
||||||
case XTBSP_VERSION:
|
|
||||||
#ifdef SUPPORT_BSP2_FORMAT
|
|
||||||
case QBSP2_VERSION:
|
case QBSP2_VERSION:
|
||||||
#endif
|
|
||||||
if( header->lumps[LUMP_ENTITIES].fileofs <= 1024 && !(header->lumps[LUMP_ENTITIES].filelen % sizeof(dplane_t)))
|
if( header->lumps[LUMP_ENTITIES].fileofs <= 1024 && !(header->lumps[LUMP_ENTITIES].filelen % sizeof(dplane_t)))
|
||||||
{
|
{
|
||||||
lumpofs = header->lumps[LUMP_PLANES].fileofs;
|
lumpofs = header->lumps[LUMP_PLANES].fileofs;
|
||||||
|
@ -113,11 +110,9 @@ qboolean Cmd_GetMapList( const char *s, char *completedname, int length )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ver == XTBSP_VERSION )
|
hdrext = (dextrahdr_t *)((byte *)buf + sizeof( dheader_t ));
|
||||||
hdrext = (dextrahdr_t *)((byte *)buf + sizeof( dheader31_t ));
|
if( hdrext->id == IDEXTRAHEADER )
|
||||||
else hdrext = (dextrahdr_t *)((byte *)buf + sizeof( dheader_t ));
|
version = hdrext->version;
|
||||||
|
|
||||||
if( hdrext->id == IDEXTRAHEADER ) version = hdrext->version;
|
|
||||||
|
|
||||||
Q_strncpy( entfilename, t->filenames[i], sizeof( entfilename ));
|
Q_strncpy( entfilename, t->filenames[i], sizeof( entfilename ));
|
||||||
FS_StripExtension( entfilename );
|
FS_StripExtension( entfilename );
|
||||||
|
@ -169,11 +164,9 @@ qboolean Cmd_GetMapList( const char *s, char *completedname, int length )
|
||||||
if( mapver == 220 ) Q_strncpy( buf, "Half-Life Alpha", sizeof( buf ));
|
if( mapver == 220 ) Q_strncpy( buf, "Half-Life Alpha", sizeof( buf ));
|
||||||
else Q_strncpy( buf, "Quake", sizeof( buf ));
|
else Q_strncpy( buf, "Quake", sizeof( buf ));
|
||||||
break;
|
break;
|
||||||
#ifdef SUPPORT_BSP2_FORMAT
|
|
||||||
case QBSP2_VERSION:
|
case QBSP2_VERSION:
|
||||||
Q_strncpy( buf, "Darkplaces BSP2", sizeof( buf ));
|
Q_strncpy( buf, "Darkplaces BSP2", sizeof( buf ));
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case HLBSP_VERSION:
|
case HLBSP_VERSION:
|
||||||
if( gearbox ) Q_strncpy( buf, "Blue-Shift", sizeof( buf ));
|
if( gearbox ) Q_strncpy( buf, "Blue-Shift", sizeof( buf ));
|
||||||
else if( version == 1 ) Q_strncpy( buf, "XashXT old format", sizeof( buf ));
|
else if( version == 1 ) Q_strncpy( buf, "XashXT old format", sizeof( buf ));
|
||||||
|
@ -182,13 +175,6 @@ qboolean Cmd_GetMapList( const char *s, char *completedname, int length )
|
||||||
else if( version == 4 ) Q_strncpy( buf, "Half-Life extended", sizeof( buf ));
|
else if( version == 4 ) Q_strncpy( buf, "Half-Life extended", sizeof( buf ));
|
||||||
else Q_strncpy( buf, "Half-Life", sizeof( buf ));
|
else Q_strncpy( buf, "Half-Life", sizeof( buf ));
|
||||||
break;
|
break;
|
||||||
case XTBSP_VERSION:
|
|
||||||
if( version == 1 ) Q_strncpy( buf, "XashXT old format", sizeof( buf ));
|
|
||||||
else if( version == 2 ) Q_strncpy( buf, "Paranoia 2: Savior", sizeof( buf ));
|
|
||||||
else if( version == 3 ) Q_strncpy( buf, "not supported", sizeof( buf ));
|
|
||||||
else if( version == 4 ) Q_strncpy( buf, "Xash3D extended", sizeof( buf ));
|
|
||||||
else Q_strncpy( buf, "Xash3D", sizeof( buf ));
|
|
||||||
break;
|
|
||||||
default: Q_strncpy( buf, "??", sizeof( buf )); break;
|
default: Q_strncpy( buf, "??", sizeof( buf )); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -751,10 +737,7 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
|
||||||
{
|
{
|
||||||
case Q1BSP_VERSION:
|
case Q1BSP_VERSION:
|
||||||
case HLBSP_VERSION:
|
case HLBSP_VERSION:
|
||||||
case XTBSP_VERSION:
|
|
||||||
#ifdef SUPPORT_BSP2_FORMAT
|
|
||||||
case QBSP2_VERSION:
|
case QBSP2_VERSION:
|
||||||
#endif
|
|
||||||
header = (dheader_t *)buf;
|
header = (dheader_t *)buf;
|
||||||
if( header->lumps[LUMP_ENTITIES].fileofs <= 1024 )
|
if( header->lumps[LUMP_ENTITIES].fileofs <= 1024 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -234,8 +234,7 @@ qboolean CRC32_MapFile( dword *crcvalue, const char *filename, qboolean multipla
|
||||||
char headbuf[256], buffer[1024];
|
char headbuf[256], buffer[1024];
|
||||||
int i, num_bytes, lumplen;
|
int i, num_bytes, lumplen;
|
||||||
qboolean blue_shift = false;
|
qboolean blue_shift = false;
|
||||||
int NUM_LUMPS, hdr_size;
|
int version, hdr_size;
|
||||||
int version;
|
|
||||||
|
|
||||||
if( !crcvalue ) return false;
|
if( !crcvalue ) return false;
|
||||||
|
|
||||||
|
@ -253,11 +252,7 @@ qboolean CRC32_MapFile( dword *crcvalue, const char *filename, qboolean multipla
|
||||||
FS_Read( f, &version, sizeof( int ));
|
FS_Read( f, &version, sizeof( int ));
|
||||||
FS_Seek( f, 0, SEEK_SET );
|
FS_Seek( f, 0, SEEK_SET );
|
||||||
|
|
||||||
if( version == XTBSP_VERSION )
|
hdr_size = sizeof( int ) + sizeof( dlump_t ) * HEADER_LUMPS;
|
||||||
NUM_LUMPS = 17; // two extra lumps added
|
|
||||||
else NUM_LUMPS = HEADER_LUMPS;
|
|
||||||
|
|
||||||
hdr_size = sizeof( int ) + sizeof( dlump_t ) * NUM_LUMPS;
|
|
||||||
num_bytes = FS_Read( f, headbuf, hdr_size );
|
num_bytes = FS_Read( f, headbuf, hdr_size );
|
||||||
|
|
||||||
// corrupted map ?
|
// corrupted map ?
|
||||||
|
@ -274,7 +269,6 @@ qboolean CRC32_MapFile( dword *crcvalue, const char *filename, qboolean multipla
|
||||||
{
|
{
|
||||||
case Q1BSP_VERSION:
|
case Q1BSP_VERSION:
|
||||||
case HLBSP_VERSION:
|
case HLBSP_VERSION:
|
||||||
case XTBSP_VERSION:
|
|
||||||
case QBSP2_VERSION:
|
case QBSP2_VERSION:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -289,7 +283,7 @@ qboolean CRC32_MapFile( dword *crcvalue, const char *filename, qboolean multipla
|
||||||
if( header->lumps[LUMP_ENTITIES].fileofs <= 1024 && (header->lumps[LUMP_ENTITIES].filelen % sizeof( dplane_t )) == 0 )
|
if( header->lumps[LUMP_ENTITIES].fileofs <= 1024 && (header->lumps[LUMP_ENTITIES].filelen % sizeof( dplane_t )) == 0 )
|
||||||
blue_shift = true;
|
blue_shift = true;
|
||||||
|
|
||||||
for( i = 0; i < NUM_LUMPS; i++ )
|
for( i = 0; i < HEADER_LUMPS; i++ )
|
||||||
{
|
{
|
||||||
if( blue_shift && i == LUMP_PLANES ) continue;
|
if( blue_shift && i == LUMP_PLANES ) continue;
|
||||||
else if( i == LUMP_ENTITIES ) continue;
|
else if( i == LUMP_ENTITIES ) continue;
|
||||||
|
|
|
@ -524,7 +524,7 @@ double Host_CalcFPS( void )
|
||||||
{
|
{
|
||||||
double fps = 0.0;
|
double fps = 0.0;
|
||||||
|
|
||||||
// NOTE: we should play demos with same fps as is was recorded
|
// NOTE: we should play demos with same fps as it was recorded
|
||||||
if( CL_IsPlaybackDemo() || CL_IsRecordDemo( ))
|
if( CL_IsPlaybackDemo() || CL_IsRecordDemo( ))
|
||||||
fps = CL_GetDemoFramerate();
|
fps = CL_GetDemoFramerate();
|
||||||
else if( Host_IsLocalGame( ))
|
else if( Host_IsLocalGame( ))
|
||||||
|
@ -958,7 +958,7 @@ int EXPORT Host_Main( const char *progname, int bChangeGame, pfnChangeGame func
|
||||||
host_limitlocal = Cvar_Get( "host_limitlocal", "0", 0, "apply cl_cmdrate and rate to loopback connection" );
|
host_limitlocal = Cvar_Get( "host_limitlocal", "0", 0, "apply cl_cmdrate and rate to loopback connection" );
|
||||||
con_gamemaps = Cvar_Get( "con_mapfilter", "1", FCVAR_ARCHIVE, "when true show only maps in game folder" );
|
con_gamemaps = Cvar_Get( "con_mapfilter", "1", FCVAR_ARCHIVE, "when true show only maps in game folder" );
|
||||||
build = Cvar_Get( "build", va( "%i", Q_buildnum()), FCVAR_READ_ONLY, "returns a current build number" );
|
build = Cvar_Get( "build", va( "%i", Q_buildnum()), FCVAR_READ_ONLY, "returns a current build number" );
|
||||||
ver = Cvar_Get( "ver", va( "%i/%g (hw build %i)", PROTOCOL_VERSION, XASH_VERSION, Q_buildnum( )), FCVAR_READ_ONLY, "shows an engine version" );
|
ver = Cvar_Get( "ver", va( "%i/%g (hw build %i)", PROTOCOL_VERSION, XASH_VERSION, Q_buildnum()), FCVAR_READ_ONLY, "shows an engine version" );
|
||||||
|
|
||||||
Mod_Init();
|
Mod_Init();
|
||||||
NET_Init();
|
NET_Init();
|
||||||
|
|
|
@ -26,8 +26,6 @@ GNU General Public License for more details.
|
||||||
#define FRAC_EPSILON (1.0f / 1024.0f)
|
#define FRAC_EPSILON (1.0f / 1024.0f)
|
||||||
#define BACKFACE_EPSILON 0.01f
|
#define BACKFACE_EPSILON 0.01f
|
||||||
#define MAX_BOX_LEAFS 256
|
#define MAX_BOX_LEAFS 256
|
||||||
#define DVIS_PVS 0
|
|
||||||
#define DVIS_PHS 1
|
|
||||||
#define ANIM_CYCLE 2
|
#define ANIM_CYCLE 2
|
||||||
#define MOD_FRAMES 20
|
#define MOD_FRAMES 20
|
||||||
|
|
||||||
|
@ -42,7 +40,8 @@ GNU General Public License for more details.
|
||||||
#define PANTS_HUE_START 96
|
#define PANTS_HUE_START 96
|
||||||
#define PANTS_HUE_END 112
|
#define PANTS_HUE_END 112
|
||||||
|
|
||||||
#define LM_SAMPLE_SIZE world.lm_sample_size // lightmap resoultion
|
#define LM_SAMPLE_SIZE 16
|
||||||
|
#define LM_SAMPLE_EXTRASIZE 8
|
||||||
|
|
||||||
#define CHECKVISBIT( vis, b ) ((b) >= 0 ? (byte)((vis)[(b) >> 3] & (1 << ((b) & 7))) : (byte)false )
|
#define CHECKVISBIT( vis, b ) ((b) >= 0 ? (byte)((vis)[(b) >> 3] & (1 << ((b) & 7))) : (byte)false )
|
||||||
#define SETVISBIT( vis, b )( void ) ((b) >= 0 ? (byte)((vis)[(b) >> 3] |= (1 << ((b) & 7))) : (byte)false )
|
#define SETVISBIT( vis, b )( void ) ((b) >= 0 ? (byte)((vis)[(b) >> 3] |= (1 << ((b) & 7))) : (byte)false )
|
||||||
|
@ -79,7 +78,6 @@ typedef struct leaflist_s
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int version; // bsp version
|
|
||||||
int mapversion; // map version (an key-value in worldspawn settings)
|
int mapversion; // map version (an key-value in worldspawn settings)
|
||||||
uint checksum; // current map checksum
|
uint checksum; // current map checksum
|
||||||
int load_sequence; // increace each map change
|
int load_sequence; // increace each map change
|
||||||
|
@ -91,7 +89,6 @@ typedef struct
|
||||||
qboolean has_mirrors; // one or more brush models contain reflective textures
|
qboolean has_mirrors; // one or more brush models contain reflective textures
|
||||||
qboolean custom_skybox; // if sky_sphere is active and custom skybox set
|
qboolean custom_skybox; // if sky_sphere is active and custom skybox set
|
||||||
qboolean water_alpha; // allow translucency water
|
qboolean water_alpha; // allow translucency water
|
||||||
int lm_sample_size; // defaulting to 16 (BSP31 uses 8)
|
|
||||||
int block_size; // lightmap blocksize
|
int block_size; // lightmap blocksize
|
||||||
int lightmap_samples; // samples per pixel
|
int lightmap_samples; // samples per pixel
|
||||||
color24 *deluxedata; // deluxemap data pointer
|
color24 *deluxedata; // deluxemap data pointer
|
||||||
|
@ -127,7 +124,6 @@ extern world_static_t world;
|
||||||
extern byte *com_studiocache;
|
extern byte *com_studiocache;
|
||||||
extern model_t *loadmodel;
|
extern model_t *loadmodel;
|
||||||
extern convar_t *mod_studiocache;
|
extern convar_t *mod_studiocache;
|
||||||
extern int bmodel_version; // only actual during loading
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// model.c
|
// model.c
|
||||||
|
@ -152,7 +148,7 @@ model_t *Mod_LoadModel( model_t *mod, qboolean world );
|
||||||
model_t *Mod_ForName( const char *name, qboolean world );
|
model_t *Mod_ForName( const char *name, qboolean world );
|
||||||
qboolean Mod_RegisterModel( const char *name, int index );
|
qboolean Mod_RegisterModel( const char *name, int index );
|
||||||
mleaf_t *Mod_PointInLeaf( const vec3_t p, mnode_t *node );
|
mleaf_t *Mod_PointInLeaf( const vec3_t p, mnode_t *node );
|
||||||
qboolean Mod_HeadnodeVisible( mnode_t *node, const byte *visbits, short *lastleaf );
|
qboolean Mod_HeadnodeVisible( mnode_t *node, const byte *visbits, int *lastleaf );
|
||||||
int Mod_BoxLeafnums( const vec3_t mins, const vec3_t maxs, short *list, int listsize, int *lastleaf );
|
int Mod_BoxLeafnums( const vec3_t mins, const vec3_t maxs, short *list, int listsize, int *lastleaf );
|
||||||
int Mod_FatPVS( const vec3_t org, float radius, byte *visbuffer, int visbytes, qboolean merge, qboolean fullvis );
|
int Mod_FatPVS( const vec3_t org, float radius, byte *visbuffer, int visbytes, qboolean merge, qboolean fullvis );
|
||||||
qboolean Mod_BoxVisible( const vec3_t mins, const vec3_t maxs, const byte *visbits );
|
qboolean Mod_BoxVisible( const vec3_t mins, const vec3_t maxs, const byte *visbits );
|
||||||
|
|
|
@ -33,7 +33,7 @@ static model_t *com_models[MAX_MODELS]; // shared replacement modeltable
|
||||||
static model_t cm_models[MAX_MODELS];
|
static model_t cm_models[MAX_MODELS];
|
||||||
static int cm_nummodels = 0;
|
static int cm_nummodels = 0;
|
||||||
static byte visdata[MAX_MAP_LEAFS/8]; // intermediate buffer
|
static byte visdata[MAX_MAP_LEAFS/8]; // intermediate buffer
|
||||||
int bmodel_version; // global stuff to detect bsp version
|
static int bmodel_version; // global stuff to detect bsp version
|
||||||
char modelname[64]; // short model name (without path and ext)
|
char modelname[64]; // short model name (without path and ext)
|
||||||
convar_t *mod_studiocache;
|
convar_t *mod_studiocache;
|
||||||
convar_t *r_wadtextures;
|
convar_t *r_wadtextures;
|
||||||
|
@ -445,7 +445,7 @@ qboolean Mod_BoxVisible( const vec3_t mins, const vec3_t maxs, const byte *visbi
|
||||||
Mod_HeadnodeVisible
|
Mod_HeadnodeVisible
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
qboolean Mod_HeadnodeVisible( mnode_t *node, const byte *visbits, short *lastleaf )
|
qboolean Mod_HeadnodeVisible( mnode_t *node, const byte *visbits, int *lastleaf )
|
||||||
{
|
{
|
||||||
if( !node || node->contents == CONTENTS_SOLID )
|
if( !node || node->contents == CONTENTS_SOLID )
|
||||||
return false;
|
return false;
|
||||||
|
@ -499,9 +499,13 @@ int Mod_SampleSizeForFace( msurface_t *surf )
|
||||||
if( !surf || !surf->texinfo )
|
if( !surf || !surf->texinfo )
|
||||||
return LM_SAMPLE_SIZE;
|
return LM_SAMPLE_SIZE;
|
||||||
|
|
||||||
|
// world luxels has more priority
|
||||||
if( FBitSet( surf->texinfo->flags, TEX_WORLD_LUXELS ))
|
if( FBitSet( surf->texinfo->flags, TEX_WORLD_LUXELS ))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
if( FBitSet( surf->texinfo->flags, TEX_EXTRA_LIGHTMAP ))
|
||||||
|
return LM_SAMPLE_EXTRASIZE;
|
||||||
|
|
||||||
if( surf->texinfo->faceinfo )
|
if( surf->texinfo->faceinfo )
|
||||||
return surf->texinfo->faceinfo->texture_step;
|
return surf->texinfo->faceinfo->texture_step;
|
||||||
|
|
||||||
|
@ -758,7 +762,7 @@ static void Mod_LoadSubmodels( const dlump_t *l )
|
||||||
// spread the mins / maxs by a unit
|
// spread the mins / maxs by a unit
|
||||||
out->mins[j] = in->mins[j] - 1.0f;
|
out->mins[j] = in->mins[j] - 1.0f;
|
||||||
out->maxs[j] = in->maxs[j] + 1.0f;
|
out->maxs[j] = in->maxs[j] + 1.0f;
|
||||||
out->origin[j] = in->origin[j];
|
out->origin[j] = in->origin[j]; // new P2 compillers fills the origin field
|
||||||
}
|
}
|
||||||
|
|
||||||
for( j = 0; j < MAX_MAP_HULLS; j++ )
|
for( j = 0; j < MAX_MAP_HULLS; j++ )
|
||||||
|
@ -771,12 +775,6 @@ static void Mod_LoadSubmodels( const dlump_t *l )
|
||||||
if( i == 0 || !world.loading )
|
if( i == 0 || !world.loading )
|
||||||
continue; // skip the world
|
continue; // skip the world
|
||||||
|
|
||||||
if( VectorIsNull( out->origin ))
|
|
||||||
{
|
|
||||||
// NOTE: zero origin after recalculating is indicated included origin brush
|
|
||||||
VectorAverage( out->mins, out->maxs, out->origin );
|
|
||||||
}
|
|
||||||
|
|
||||||
world.max_surfaces = Q_max( world.max_surfaces, out->numfaces );
|
world.max_surfaces = Q_max( world.max_surfaces, out->numfaces );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2426,83 +2424,6 @@ static void Mod_LoadClipnodes( const dlump_t *l )
|
||||||
loadmodel->numclipnodes = count;
|
loadmodel->numclipnodes = count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=================
|
|
||||||
Mod_LoadClipnodes31
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
static void Mod_LoadClipnodes31( const dlump_t *l1, const dlump_t *l2, const dlump_t *l3 )
|
|
||||||
{
|
|
||||||
dclipnode_t *in1, *in2, *in3;
|
|
||||||
int i, count1, count2, count3;
|
|
||||||
dclipnode2_t *out;
|
|
||||||
|
|
||||||
in1 = (dclipnode_t *)(mod_base + l1->fileofs);
|
|
||||||
if( l1->filelen % sizeof( *in1 )) Host_Error( "Mod_LoadClipnodes1: funny lump size\n" );
|
|
||||||
count1 = l1->filelen / sizeof( *in1 );
|
|
||||||
|
|
||||||
in2 = (dclipnode_t *)(mod_base + l2->fileofs);
|
|
||||||
if( l2->filelen % sizeof( *in2 )) Host_Error( "Mod_LoadClipnodes2: funny lump size\n" );
|
|
||||||
count2 = l2->filelen / sizeof( *in2 );
|
|
||||||
|
|
||||||
in3 = (dclipnode_t *)(mod_base + l3->fileofs);
|
|
||||||
if( l3->filelen % sizeof( *in3 )) Host_Error( "Mod_LoadClipnodes3: funny lump size\n" );
|
|
||||||
count3 = l3->filelen / sizeof( *in3 );
|
|
||||||
|
|
||||||
world.clipnodes = out = (dclipnode2_t *)Mem_Alloc( loadmodel->mempool, ( count1 + count2 + count3 ) * sizeof( *out ));
|
|
||||||
if( world.loading ) world.clipnodesize = sizeof( dclipnode_t );
|
|
||||||
world.numclipnodes = 0;
|
|
||||||
|
|
||||||
for( i = 0; i < count1; i++, out++, in1++ )
|
|
||||||
{
|
|
||||||
out->children[0] = in1->children[0];
|
|
||||||
out->children[1] = in1->children[1];
|
|
||||||
out->planenum = in1->planenum;
|
|
||||||
world.numclipnodes++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// merge offsets so we have shared array of clipnodes again
|
|
||||||
for( i = 0; i < count2; i++, out++, in2++ )
|
|
||||||
{
|
|
||||||
out->children[0] = in2->children[0];
|
|
||||||
out->children[1] = in2->children[1];
|
|
||||||
out->planenum = in2->planenum;
|
|
||||||
|
|
||||||
if( out->children[0] >= 0 )
|
|
||||||
out->children[0] += count1;
|
|
||||||
if( out->children[1] >= 0 )
|
|
||||||
out->children[1] += count1;
|
|
||||||
world.numclipnodes++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// merge offsets so we have shared array of clipnodes again
|
|
||||||
for( i = 0; i < count3; i++, out++, in3++ )
|
|
||||||
{
|
|
||||||
out->children[0] = in3->children[0];
|
|
||||||
out->children[1] = in3->children[1];
|
|
||||||
out->planenum = in3->planenum;
|
|
||||||
|
|
||||||
if( out->children[0] >= 0 )
|
|
||||||
out->children[0] += (count1 + count2);
|
|
||||||
if( out->children[1] >= 0 )
|
|
||||||
out->children[1] += (count1 + count2);
|
|
||||||
world.numclipnodes++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// fixup headnode offsets
|
|
||||||
for( i = 0; i < loadmodel->numsubmodels; i++ )
|
|
||||||
{
|
|
||||||
loadmodel->submodels[i].headnode[2] += (count1);
|
|
||||||
loadmodel->submodels[i].headnode[3] += (count1 + count2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( world.numclipnodes != ( count1 + count2 + count3 ))
|
|
||||||
Host_Error( "Mod_LoadClipnodes31: mismatch node count (%i should be %i)\n", world.numclipnodes, ( count1 + count2 + count3 ));
|
|
||||||
|
|
||||||
// FIXME: fill loadmodel->clipnodes?
|
|
||||||
loadmodel->numclipnodes = world.numclipnodes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
Mod_FindModelOrigin
|
Mod_FindModelOrigin
|
||||||
|
@ -2518,7 +2439,10 @@ static void Mod_FindModelOrigin( const char *entities, const char *modelname, ve
|
||||||
qboolean model_found;
|
qboolean model_found;
|
||||||
qboolean origin_found;
|
qboolean origin_found;
|
||||||
|
|
||||||
if( !entities || !modelname || !*modelname || !origin )
|
if( !entities || !modelname || !*modelname )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if( !origin || !VectorIsNull( origin ))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pfile = (char *)entities;
|
pfile = (char *)entities;
|
||||||
|
@ -2644,7 +2568,6 @@ Mod_LoadBrushModel
|
||||||
static void Mod_LoadBrushModel( model_t *mod, const void *buffer, qboolean *loaded )
|
static void Mod_LoadBrushModel( model_t *mod, const void *buffer, qboolean *loaded )
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
int sample_size;
|
|
||||||
char *ents;
|
char *ents;
|
||||||
dheader_t *header;
|
dheader_t *header;
|
||||||
dextrahdr_t *extrahdr;
|
dextrahdr_t *extrahdr;
|
||||||
|
@ -2654,47 +2577,29 @@ static void Mod_LoadBrushModel( model_t *mod, const void *buffer, qboolean *load
|
||||||
if( loaded ) *loaded = false;
|
if( loaded ) *loaded = false;
|
||||||
header = (dheader_t *)buffer;
|
header = (dheader_t *)buffer;
|
||||||
loadmodel->type = mod_brush;
|
loadmodel->type = mod_brush;
|
||||||
|
extrahdr = (dextrahdr_t *)((byte *)buffer + sizeof( dheader_t ));
|
||||||
i = header->version;
|
i = header->version;
|
||||||
|
|
||||||
// BSP31 and BSP30 have different offsets
|
#ifndef SUPPORT_BSP2_FORMAT
|
||||||
if( i == XTBSP_VERSION )
|
if( header->version == QBSP2_VERSION )
|
||||||
extrahdr = (dextrahdr_t *)((byte *)buffer + sizeof( dheader31_t ));
|
{
|
||||||
else extrahdr = (dextrahdr_t *)((byte *)buffer + sizeof( dheader_t ));
|
MsgDev( D_ERROR, "%s can't be loaded in this build. Please rebuild engine with enabled SUPPORT_BSP2_FORMAT\n", loadmodel->name );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
switch( i )
|
switch( i )
|
||||||
{
|
{
|
||||||
case 28: // get support for quake1 beta
|
|
||||||
i = Q1BSP_VERSION;
|
|
||||||
sample_size = 16;
|
|
||||||
break;
|
|
||||||
case Q1BSP_VERSION:
|
case Q1BSP_VERSION:
|
||||||
case HLBSP_VERSION:
|
case HLBSP_VERSION:
|
||||||
case QBSP2_VERSION:
|
case QBSP2_VERSION:
|
||||||
sample_size = 16;
|
|
||||||
break;
|
|
||||||
case XTBSP_VERSION:
|
|
||||||
sample_size = 8;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
MsgDev( D_ERROR, "%s has wrong version number (%i should be %i)", loadmodel->name, i, HLBSP_VERSION );
|
MsgDev( D_ERROR, "%s has wrong version number (%i should be %i)\n", loadmodel->name, i, HLBSP_VERSION );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// will be merged later
|
loadmodel->numframes = 2; // g-cont. why is it necessary?
|
||||||
if( world.loading )
|
bmodel_version = i; // share tp global
|
||||||
{
|
|
||||||
world.lm_sample_size = sample_size;
|
|
||||||
world.version = i;
|
|
||||||
}
|
|
||||||
else if( world.lm_sample_size != sample_size )
|
|
||||||
{
|
|
||||||
// can't mixing world and bmodels with different sample sizes!
|
|
||||||
MsgDev( D_ERROR, "%s has mismatch sample size (%i should be %i)", loadmodel->name, sample_size, world.lm_sample_size );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
loadmodel->numframes = sample_size; // NOTE: world store sample size into model_t->numframes
|
|
||||||
bmodel_version = i; // share it
|
|
||||||
|
|
||||||
// swap all the lumps
|
// swap all the lumps
|
||||||
mod_base = (byte *)header;
|
mod_base = (byte *)header;
|
||||||
|
@ -2730,10 +2635,7 @@ static void Mod_LoadBrushModel( model_t *mod, const void *buffer, qboolean *load
|
||||||
Mod_LoadMarkSurfaces( &header->lumps[LUMP_MARKSURFACES] );
|
Mod_LoadMarkSurfaces( &header->lumps[LUMP_MARKSURFACES] );
|
||||||
Mod_LoadLeafs( &header->lumps[LUMP_LEAFS] );
|
Mod_LoadLeafs( &header->lumps[LUMP_LEAFS] );
|
||||||
Mod_LoadNodes( &header->lumps[LUMP_NODES] );
|
Mod_LoadNodes( &header->lumps[LUMP_NODES] );
|
||||||
|
Mod_LoadClipnodes( &header->lumps[LUMP_CLIPNODES] );
|
||||||
if( bmodel_version == XTBSP_VERSION )
|
|
||||||
Mod_LoadClipnodes31( &header->lumps[LUMP_CLIPNODES], &header->lumps[LUMP_CLIPNODES2], &header->lumps[LUMP_CLIPNODES3] );
|
|
||||||
else Mod_LoadClipnodes( &header->lumps[LUMP_CLIPNODES] );
|
|
||||||
|
|
||||||
Mod_MakeHull0 ();
|
Mod_MakeHull0 ();
|
||||||
|
|
||||||
|
@ -2764,12 +2666,12 @@ static void Mod_LoadBrushModel( model_t *mod, const void *buffer, qboolean *load
|
||||||
|
|
||||||
if( i != 0 )
|
if( i != 0 )
|
||||||
{
|
{
|
||||||
// HACKHACK: c2a1 issues
|
|
||||||
if( !bm->origin[0] && !bm->origin[1] )
|
|
||||||
SetBits( mod->flags, MODEL_HAS_ORIGIN );
|
|
||||||
|
|
||||||
Mod_FindModelOrigin( ents, va( "*%i", i ), bm->origin );
|
Mod_FindModelOrigin( ents, va( "*%i", i ), bm->origin );
|
||||||
|
|
||||||
|
// HACKHACK: c2a1 issues
|
||||||
|
if( !Q_stricmp( loadmodel->name, "maps/c2a1.bsp" ) && ( i == 11 ))
|
||||||
|
SetBits( mod->flags, MODEL_HAS_ORIGIN );
|
||||||
|
|
||||||
// flag 2 is indicated model with origin brush!
|
// flag 2 is indicated model with origin brush!
|
||||||
if( !VectorIsNull( bm->origin ))
|
if( !VectorIsNull( bm->origin ))
|
||||||
SetBits( mod->flags, MODEL_HAS_ORIGIN );
|
SetBits( mod->flags, MODEL_HAS_ORIGIN );
|
||||||
|
@ -2938,10 +2840,7 @@ model_t *Mod_LoadModel( model_t *mod, qboolean crash )
|
||||||
break;
|
break;
|
||||||
case Q1BSP_VERSION:
|
case Q1BSP_VERSION:
|
||||||
case HLBSP_VERSION:
|
case HLBSP_VERSION:
|
||||||
case XTBSP_VERSION:
|
|
||||||
#ifdef SUPPORT_BSP2_FORMAT
|
|
||||||
case QBSP2_VERSION:
|
case QBSP2_VERSION:
|
||||||
#endif
|
|
||||||
Mod_LoadBrushModel( mod, buf, &loaded );
|
Mod_LoadBrushModel( mod, buf, &loaded );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -3293,7 +3192,7 @@ check lump for existing
|
||||||
int Mod_CheckLump( const char *filename, const int lump, int *lumpsize )
|
int Mod_CheckLump( const char *filename, const int lump, int *lumpsize )
|
||||||
{
|
{
|
||||||
file_t *f = FS_Open( filename, "rb", true );
|
file_t *f = FS_Open( filename, "rb", true );
|
||||||
byte buffer[sizeof( dheader31_t ) + sizeof( dextrahdr_t )];
|
byte buffer[sizeof( dheader_t ) + sizeof( dextrahdr_t )];
|
||||||
size_t prefetch_size = sizeof( buffer );
|
size_t prefetch_size = sizeof( buffer );
|
||||||
dextrahdr_t *extrahdr;
|
dextrahdr_t *extrahdr;
|
||||||
dheader_t *header;
|
dheader_t *header;
|
||||||
|
@ -3308,16 +3207,13 @@ int Mod_CheckLump( const char *filename, const int lump, int *lumpsize )
|
||||||
|
|
||||||
header = (dheader_t *)buffer;
|
header = (dheader_t *)buffer;
|
||||||
|
|
||||||
if( header->version != HLBSP_VERSION && header->version != XTBSP_VERSION )
|
if( header->version != HLBSP_VERSION )
|
||||||
{
|
{
|
||||||
FS_Close( f );
|
FS_Close( f );
|
||||||
return LUMP_LOAD_BAD_VERSION;
|
return LUMP_LOAD_BAD_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
// BSP31 and BSP30 have different offsets
|
extrahdr = (dextrahdr_t *)((byte *)buffer + sizeof( dheader_t ));
|
||||||
if( header->version == XTBSP_VERSION )
|
|
||||||
extrahdr = (dextrahdr_t *)((byte *)buffer + sizeof( dheader31_t ));
|
|
||||||
else extrahdr = (dextrahdr_t *)((byte *)buffer + sizeof( dheader_t ));
|
|
||||||
|
|
||||||
if( extrahdr->id != IDEXTRAHEADER || extrahdr->version != EXTRA_VERSION )
|
if( extrahdr->id != IDEXTRAHEADER || extrahdr->version != EXTRA_VERSION )
|
||||||
{
|
{
|
||||||
|
@ -3355,7 +3251,7 @@ reading random lump by user request
|
||||||
int Mod_ReadLump( const char *filename, const int lump, void **lumpdata, int *lumpsize )
|
int Mod_ReadLump( const char *filename, const int lump, void **lumpdata, int *lumpsize )
|
||||||
{
|
{
|
||||||
file_t *f = FS_Open( filename, "rb", true );
|
file_t *f = FS_Open( filename, "rb", true );
|
||||||
byte buffer[sizeof( dheader31_t ) + sizeof( dextrahdr_t )];
|
byte buffer[sizeof( dheader_t ) + sizeof( dextrahdr_t )];
|
||||||
size_t prefetch_size = sizeof( buffer );
|
size_t prefetch_size = sizeof( buffer );
|
||||||
dextrahdr_t *extrahdr;
|
dextrahdr_t *extrahdr;
|
||||||
dheader_t *header;
|
dheader_t *header;
|
||||||
|
@ -3372,16 +3268,13 @@ int Mod_ReadLump( const char *filename, const int lump, void **lumpdata, int *lu
|
||||||
|
|
||||||
header = (dheader_t *)buffer;
|
header = (dheader_t *)buffer;
|
||||||
|
|
||||||
if( header->version != HLBSP_VERSION && header->version != XTBSP_VERSION )
|
if( header->version != HLBSP_VERSION )
|
||||||
{
|
{
|
||||||
FS_Close( f );
|
FS_Close( f );
|
||||||
return LUMP_LOAD_BAD_VERSION;
|
return LUMP_LOAD_BAD_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
// BSP31 and BSP30 have different offsets
|
extrahdr = (dextrahdr_t *)((byte *)buffer + sizeof( dheader_t ));
|
||||||
if( header->version == XTBSP_VERSION )
|
|
||||||
extrahdr = (dextrahdr_t *)((byte *)buffer + sizeof( dheader31_t ));
|
|
||||||
else extrahdr = (dextrahdr_t *)((byte *)buffer + sizeof( dheader_t ));
|
|
||||||
|
|
||||||
if( extrahdr->id != IDEXTRAHEADER || extrahdr->version != EXTRA_VERSION )
|
if( extrahdr->id != IDEXTRAHEADER || extrahdr->version != EXTRA_VERSION )
|
||||||
{
|
{
|
||||||
|
@ -3414,7 +3307,7 @@ int Mod_ReadLump( const char *filename, const int lump, void **lumpdata, int *lu
|
||||||
|
|
||||||
if( FS_Read( f, data, length ) != length )
|
if( FS_Read( f, data, length ) != length )
|
||||||
{
|
{
|
||||||
Mem_Free( data );
|
free( data );
|
||||||
FS_Close( f );
|
FS_Close( f );
|
||||||
return LUMP_LOAD_CORRUPTED;
|
return LUMP_LOAD_CORRUPTED;
|
||||||
}
|
}
|
||||||
|
@ -3440,7 +3333,7 @@ only empty lumps is allows
|
||||||
int Mod_SaveLump( const char *filename, const int lump, void *lumpdata, int lumpsize )
|
int Mod_SaveLump( const char *filename, const int lump, void *lumpdata, int lumpsize )
|
||||||
{
|
{
|
||||||
file_t *f = FS_Open( filename, "e+b", true );
|
file_t *f = FS_Open( filename, "e+b", true );
|
||||||
byte buffer[sizeof( dheader31_t ) + sizeof( dextrahdr_t )];
|
byte buffer[sizeof( dheader_t ) + sizeof( dextrahdr_t )];
|
||||||
size_t prefetch_size = sizeof( buffer );
|
size_t prefetch_size = sizeof( buffer );
|
||||||
dextrahdr_t *extrahdr;
|
dextrahdr_t *extrahdr;
|
||||||
dheader_t *header;
|
dheader_t *header;
|
||||||
|
@ -3458,16 +3351,13 @@ int Mod_SaveLump( const char *filename, const int lump, void *lumpdata, int lump
|
||||||
|
|
||||||
header = (dheader_t *)buffer;
|
header = (dheader_t *)buffer;
|
||||||
|
|
||||||
if( header->version != HLBSP_VERSION && header->version != XTBSP_VERSION )
|
if( header->version != HLBSP_VERSION )
|
||||||
{
|
{
|
||||||
FS_Close( f );
|
FS_Close( f );
|
||||||
return LUMP_SAVE_BAD_VERSION;
|
return LUMP_SAVE_BAD_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
// BSP31 and BSP30 have different offsets
|
extrahdr = (dextrahdr_t *)((byte *)buffer + sizeof( dheader_t ));
|
||||||
if( header->version == XTBSP_VERSION )
|
|
||||||
extrahdr = (dextrahdr_t *)((byte *)buffer + sizeof( dheader31_t ));
|
|
||||||
else extrahdr = (dextrahdr_t *)((byte *)buffer + sizeof( dheader_t ));
|
|
||||||
|
|
||||||
if( extrahdr->id != IDEXTRAHEADER || extrahdr->version != EXTRA_VERSION )
|
if( extrahdr->id != IDEXTRAHEADER || extrahdr->version != EXTRA_VERSION )
|
||||||
{
|
{
|
||||||
|
@ -3500,9 +3390,7 @@ int Mod_SaveLump( const char *filename, const int lump, void *lumpdata, int lump
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the header
|
// update the header
|
||||||
if( header->version == XTBSP_VERSION )
|
FS_Seek( f, sizeof( dheader_t ), SEEK_SET );
|
||||||
FS_Seek( f, sizeof( dheader31_t ), SEEK_SET );
|
|
||||||
else FS_Seek( f, sizeof( dheader_t ), SEEK_SET );
|
|
||||||
|
|
||||||
if( FS_Write( f, extrahdr, sizeof( dextrahdr_t )) != sizeof( dextrahdr_t ))
|
if( FS_Write( f, extrahdr, sizeof( dextrahdr_t )) != sizeof( dextrahdr_t ))
|
||||||
{
|
{
|
||||||
|
|
|
@ -94,11 +94,7 @@ GNU General Public License for more details.
|
||||||
#define clc_requestcvarvalue2 10
|
#define clc_requestcvarvalue2 10
|
||||||
#define clc_lastmsg 10 // end client messages
|
#define clc_lastmsg 10 // end client messages
|
||||||
|
|
||||||
#ifdef SUPPORT_BSP2_FORMAT
|
#define MAX_VISIBLE_PACKET_BITS 11 // 2048 visible entities per frame (hl1 has 256)
|
||||||
#define MAX_VISIBLE_PACKET_BITS 11 // 2048 visible entities per frame
|
|
||||||
#else
|
|
||||||
#define MAX_VISIBLE_PACKET_BITS 10 // 1024 visible entities per frame (hl1 has 256)
|
|
||||||
#endif
|
|
||||||
#define MAX_VISIBLE_PACKET (1<<MAX_VISIBLE_PACKET_BITS)
|
#define MAX_VISIBLE_PACKET (1<<MAX_VISIBLE_PACKET_BITS)
|
||||||
#define MAX_VISIBLE_PACKET_VIS_BYTES ((MAX_VISIBLE_PACKET + 7) / 8)
|
#define MAX_VISIBLE_PACKET_VIS_BYTES ((MAX_VISIBLE_PACKET + 7) / 8)
|
||||||
|
|
||||||
|
@ -106,36 +102,33 @@ GNU General Public License for more details.
|
||||||
#define MAX_CLIENT_BITS 5
|
#define MAX_CLIENT_BITS 5
|
||||||
#define MAX_CLIENTS (1<<MAX_CLIENT_BITS)// 5 bits == 32 clients ( int32 limit )
|
#define MAX_CLIENTS (1<<MAX_CLIENT_BITS)// 5 bits == 32 clients ( int32 limit )
|
||||||
|
|
||||||
#define MAX_WEAPON_BITS 5
|
#define MAX_WEAPON_BITS 6
|
||||||
#define MAX_WEAPONS (1<<MAX_WEAPON_BITS)// 5 bits == 32 weapons ( int32 limit )
|
#define MAX_WEAPONS (1<<MAX_WEAPON_BITS)// 6 bits == 64 predictable weapons
|
||||||
|
|
||||||
#define MAX_EVENT_BITS 10
|
#define MAX_EVENT_BITS 10
|
||||||
#define MAX_EVENTS (1<<MAX_EVENT_BITS) // 10 bits == 1024 events (the original Half-Life limit)
|
#define MAX_EVENTS (1<<MAX_EVENT_BITS) // 10 bits == 1024 events (the original Half-Life limit)
|
||||||
|
|
||||||
|
#define MAX_MODEL_BITS 12 // 12 bits == 4096 models
|
||||||
|
|
||||||
#ifdef SUPPORT_BSP2_FORMAT
|
#ifdef SUPPORT_BSP2_FORMAT
|
||||||
#define MAX_MODEL_BITS 12 // 12 bits == 4096 models
|
#define MAX_MODELS (1<<MAX_MODEL_BITS) // because BSP2 contain too much embedded bsp-models
|
||||||
#else
|
#else
|
||||||
#define MAX_MODEL_BITS 11 // 11 bits == 2048 models
|
#define MAX_MODELS 1024 // g-cont. reduce the memory without breaking proto
|
||||||
#endif
|
#endif
|
||||||
#define MAX_MODELS (1<<MAX_MODEL_BITS)
|
|
||||||
|
|
||||||
#define MAX_SOUND_BITS 11
|
#define MAX_SOUND_BITS 11
|
||||||
#define MAX_SOUNDS (1<<MAX_SOUND_BITS) // 11 bits == 2048 sounds
|
#define MAX_SOUNDS (1<<MAX_SOUND_BITS) // 11 bits == 2048 sounds
|
||||||
|
|
||||||
#ifdef SUPPORT_BSP2_FORMAT
|
#define MAX_ENTITY_BITS 13 // 13 bits = 8192 edicts
|
||||||
#define MAX_ENTITY_BITS 13 // 13 bits = 8192 edicts
|
|
||||||
#else
|
|
||||||
#define MAX_ENTITY_BITS 12 // 12 bits = 4096 edicts
|
|
||||||
#endif
|
|
||||||
#define MAX_EDICTS (1<<MAX_ENTITY_BITS)
|
#define MAX_EDICTS (1<<MAX_ENTITY_BITS)
|
||||||
#define MAX_EDICTS_BYTES ((MAX_EDICTS + 7) / 8)
|
#define MAX_EDICTS_BYTES ((MAX_EDICTS + 7) / 8)
|
||||||
|
|
||||||
#define MAX_CUSTOM 1024 // max custom resources per level
|
#define MAX_CUSTOM 1024 // max custom resources per level
|
||||||
#define MAX_USER_MESSAGES 197 // another 58 messages reserved for engine routines
|
#define MAX_USER_MESSAGES 197 // another 58 messages reserved for engine routines
|
||||||
#define MAX_DLIGHTS 32 // dynamic lights (rendered per one frame)
|
#define MAX_DLIGHTS 32 // dynamic lights (rendered per one frame)
|
||||||
#define MAX_ELIGHTS 64 // entity only point lights
|
#define MAX_ELIGHTS 64 // entity only point lights
|
||||||
#define MAX_LIGHTSTYLES 256 // a byte limit, don't modify
|
#define MAX_LIGHTSTYLES 64 // original quake limit
|
||||||
#define MAX_RENDER_DECALS 4096 // max rendering decals per a level
|
#define MAX_RENDER_DECALS 4096 // max rendering decals per a level
|
||||||
|
|
||||||
// sound proto
|
// sound proto
|
||||||
#define MAX_SND_FLAGS_BITS 14
|
#define MAX_SND_FLAGS_BITS 14
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#define EDICT_H
|
#define EDICT_H
|
||||||
|
|
||||||
#ifdef SUPPORT_BSP2_FORMAT
|
#ifdef SUPPORT_BSP2_FORMAT
|
||||||
#define MAX_ENT_LEAFS 24
|
#define MAX_ENT_LEAFS 24 // Orignally was 16
|
||||||
#else
|
#else
|
||||||
#define MAX_ENT_LEAFS 48
|
#define MAX_ENT_LEAFS 48
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -106,6 +106,8 @@ typedef struct
|
||||||
byte frame;
|
byte frame;
|
||||||
short colormap;
|
short colormap;
|
||||||
byte skin; // can't set contents! only real skin!
|
byte skin; // can't set contents! only real skin!
|
||||||
|
byte body;
|
||||||
|
float scale;
|
||||||
byte rendermode;
|
byte rendermode;
|
||||||
byte renderamt;
|
byte renderamt;
|
||||||
color24 rendercolor;
|
color24 rendercolor;
|
||||||
|
|
|
@ -1245,6 +1245,7 @@ void SV_New_f( sv_client_t *cl )
|
||||||
MSG_WriteByte( &cl->netchan.message, playernum );
|
MSG_WriteByte( &cl->netchan.message, playernum );
|
||||||
MSG_WriteByte( &cl->netchan.message, svgame.globals->maxClients );
|
MSG_WriteByte( &cl->netchan.message, svgame.globals->maxClients );
|
||||||
MSG_WriteWord( &cl->netchan.message, svgame.globals->maxEntities );
|
MSG_WriteWord( &cl->netchan.message, svgame.globals->maxEntities );
|
||||||
|
MSG_WriteWord( &cl->netchan.message, MAX_MODELS );
|
||||||
MSG_WriteString( &cl->netchan.message, sv.name );
|
MSG_WriteString( &cl->netchan.message, sv.name );
|
||||||
MSG_WriteString( &cl->netchan.message, STRING( EDICT_NUM( 0 )->v.message )); // Map Message
|
MSG_WriteString( &cl->netchan.message, STRING( EDICT_NUM( 0 )->v.message )); // Map Message
|
||||||
MSG_WriteOneBit( &cl->netchan.message, sv.background ); // tell client about background map
|
MSG_WriteOneBit( &cl->netchan.message, sv.background ); // tell client about background map
|
||||||
|
|
|
@ -504,6 +504,8 @@ void SV_CreateStaticEntity( sizebuf_t *msg, sv_static_entity_t *ent )
|
||||||
MSG_WriteByte( msg, ent->frame );
|
MSG_WriteByte( msg, ent->frame );
|
||||||
MSG_WriteWord( msg, ent->colormap );
|
MSG_WriteWord( msg, ent->colormap );
|
||||||
MSG_WriteByte( msg, ent->skin );
|
MSG_WriteByte( msg, ent->skin );
|
||||||
|
MSG_WriteByte( msg, ent->body );
|
||||||
|
MSG_WriteCoord( msg, ent->scale );
|
||||||
|
|
||||||
for( i = 0; i < 3; i++ )
|
for( i = 0; i < 3; i++ )
|
||||||
{
|
{
|
||||||
|
@ -587,10 +589,7 @@ void SV_WriteEntityPatch( const char *filename )
|
||||||
{
|
{
|
||||||
case Q1BSP_VERSION:
|
case Q1BSP_VERSION:
|
||||||
case HLBSP_VERSION:
|
case HLBSP_VERSION:
|
||||||
case XTBSP_VERSION:
|
|
||||||
#ifdef SUPPORT_BSP2_FORMAT
|
|
||||||
case QBSP2_VERSION:
|
case QBSP2_VERSION:
|
||||||
#endif
|
|
||||||
header = (dheader_t *)buf;
|
header = (dheader_t *)buf;
|
||||||
if( header->lumps[LUMP_ENTITIES].fileofs <= 1024 && (header->lumps[LUMP_ENTITIES].filelen % sizeof( dplane_t )) == 0 )
|
if( header->lumps[LUMP_ENTITIES].fileofs <= 1024 && (header->lumps[LUMP_ENTITIES].filelen % sizeof( dplane_t )) == 0 )
|
||||||
{
|
{
|
||||||
|
@ -657,10 +656,7 @@ char *SV_ReadEntityScript( const char *filename, int *flags )
|
||||||
{
|
{
|
||||||
case Q1BSP_VERSION:
|
case Q1BSP_VERSION:
|
||||||
case HLBSP_VERSION:
|
case HLBSP_VERSION:
|
||||||
case XTBSP_VERSION:
|
|
||||||
#ifdef SUPPORT_BSP2_FORMAT
|
|
||||||
case QBSP2_VERSION:
|
case QBSP2_VERSION:
|
||||||
#endif
|
|
||||||
header = (dheader_t *)buf;
|
header = (dheader_t *)buf;
|
||||||
if( header->lumps[LUMP_ENTITIES].fileofs <= 1024 && (header->lumps[LUMP_ENTITIES].filelen % sizeof( dplane_t )) == 0 )
|
if( header->lumps[LUMP_ENTITIES].fileofs <= 1024 && (header->lumps[LUMP_ENTITIES].filelen % sizeof( dplane_t )) == 0 )
|
||||||
{
|
{
|
||||||
|
@ -1124,6 +1120,12 @@ void pfnSetModel( edict_t *e, const char *m )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( e == svgame.edicts )
|
||||||
|
{
|
||||||
|
MsgDev( D_ERROR, "SV_SetModel: world model can't be changed\n" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SV_SetModel( e, m );
|
SV_SetModel( e, m );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1689,6 +1691,8 @@ static void pfnMakeStatic( edict_t *ent )
|
||||||
clent->frame = ent->v.frame;
|
clent->frame = ent->v.frame;
|
||||||
clent->colormap = ent->v.colormap;
|
clent->colormap = ent->v.colormap;
|
||||||
clent->skin = ent->v.skin;
|
clent->skin = ent->v.skin;
|
||||||
|
clent->body = ent->v.body;
|
||||||
|
clent->scale = ent->v.scale;
|
||||||
clent->rendermode = ent->v.rendermode;
|
clent->rendermode = ent->v.rendermode;
|
||||||
clent->renderamt = ent->v.renderamt;
|
clent->renderamt = ent->v.renderamt;
|
||||||
clent->rendercolor.r = ent->v.rendercolor[0];
|
clent->rendercolor.r = ent->v.rendercolor[0];
|
||||||
|
@ -4083,7 +4087,7 @@ int pfnCheckVisibility( const edict_t *ent, byte *pset )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
short leafnum;
|
int leafnum;
|
||||||
|
|
||||||
for( i = 0; i < MAX_ENT_LEAFS; i++ )
|
for( i = 0; i < MAX_ENT_LEAFS; i++ )
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,7 +30,7 @@ half-life implementation of saverestore system
|
||||||
#define SAVEFILE_HEADER (('V'<<24)+('L'<<16)+('A'<<8)+'V') // little-endian "VALV"
|
#define SAVEFILE_HEADER (('V'<<24)+('L'<<16)+('A'<<8)+'V') // little-endian "VALV"
|
||||||
#define SAVEGAME_HEADER (('V'<<24)+('A'<<16)+('S'<<8)+'J') // little-endian "JSAV"
|
#define SAVEGAME_HEADER (('V'<<24)+('A'<<16)+('S'<<8)+'J') // little-endian "JSAV"
|
||||||
#define SAVEGAME_VERSION 0x0065 // Version 0.65
|
#define SAVEGAME_VERSION 0x0065 // Version 0.65
|
||||||
#define CLIENT_SAVEGAME_VERSION 0x0068 // Version 0.68
|
#define CLIENT_SAVEGAME_VERSION 0x0070 // Version 0.70
|
||||||
|
|
||||||
#define SAVE_AGED_COUNT 2
|
#define SAVE_AGED_COUNT 2
|
||||||
#define SAVENAME_LENGTH 128 // matches with MAX_OSPATH
|
#define SAVENAME_LENGTH 128 // matches with MAX_OSPATH
|
||||||
|
@ -39,7 +39,7 @@ half-life implementation of saverestore system
|
||||||
#define LUMP_STATIC_OFFSET 1
|
#define LUMP_STATIC_OFFSET 1
|
||||||
#define LUMP_SOUNDS_OFFSET 2
|
#define LUMP_SOUNDS_OFFSET 2
|
||||||
#define LUMP_MUSIC_OFFSET 3
|
#define LUMP_MUSIC_OFFSET 3
|
||||||
#define NUM_CLIENT_OFFSETS 4
|
#define NUM_CLIENT_LUMPS 8
|
||||||
|
|
||||||
void (__cdecl *pfnSaveGameComment)( char *buffer, int max_length ) = NULL;
|
void (__cdecl *pfnSaveGameComment)( char *buffer, int max_length ) = NULL;
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ typedef struct
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int offsets[NUM_CLIENT_OFFSETS];
|
int offsets[NUM_CLIENT_LUMPS];
|
||||||
} ClientSections_t;
|
} ClientSections_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -1147,10 +1147,12 @@ void SV_SaveClientState( SAVERESTOREDATA *pSaveData, const char *level )
|
||||||
{
|
{
|
||||||
sv_static_entity_t *entry;
|
sv_static_entity_t *entry;
|
||||||
byte nameSize;
|
byte nameSize;
|
||||||
|
word entScale;
|
||||||
|
|
||||||
entry = &sv.static_entities[i];
|
entry = &sv.static_entities[i];
|
||||||
|
|
||||||
nameSize = Q_strlen( entry->model ) + 1;
|
nameSize = Q_strlen( entry->model ) + 1;
|
||||||
|
entScale = (entry->scale * 4096);
|
||||||
|
|
||||||
FS_Write( pFile, &nameSize, sizeof( nameSize ));
|
FS_Write( pFile, &nameSize, sizeof( nameSize ));
|
||||||
FS_Write( pFile, entry->model, nameSize );
|
FS_Write( pFile, entry->model, nameSize );
|
||||||
|
@ -1160,6 +1162,8 @@ void SV_SaveClientState( SAVERESTOREDATA *pSaveData, const char *level )
|
||||||
FS_Write( pFile, &entry->frame, sizeof( entry->frame ));
|
FS_Write( pFile, &entry->frame, sizeof( entry->frame ));
|
||||||
FS_Write( pFile, &entry->colormap, sizeof( entry->colormap ));
|
FS_Write( pFile, &entry->colormap, sizeof( entry->colormap ));
|
||||||
FS_Write( pFile, &entry->skin, sizeof( entry->skin ));
|
FS_Write( pFile, &entry->skin, sizeof( entry->skin ));
|
||||||
|
FS_Write( pFile, &entry->body, sizeof( entry->body ));
|
||||||
|
FS_Write( pFile, &entScale, sizeof( entScale ));
|
||||||
FS_Write( pFile, &entry->rendermode, sizeof( entry->rendermode ));
|
FS_Write( pFile, &entry->rendermode, sizeof( entry->rendermode ));
|
||||||
|
|
||||||
if( entry->rendermode != kRenderNormal )
|
if( entry->rendermode != kRenderNormal )
|
||||||
|
@ -1334,6 +1338,7 @@ void SV_LoadClientState( SAVERESTOREDATA *pSaveData, const char *level, qboolean
|
||||||
{
|
{
|
||||||
sv_static_entity_t *entry;
|
sv_static_entity_t *entry;
|
||||||
byte nameSize;
|
byte nameSize;
|
||||||
|
word entScale;
|
||||||
|
|
||||||
if( i >= MAX_STATIC_ENTITIES )
|
if( i >= MAX_STATIC_ENTITIES )
|
||||||
{
|
{
|
||||||
|
@ -1351,8 +1356,12 @@ void SV_LoadClientState( SAVERESTOREDATA *pSaveData, const char *level, qboolean
|
||||||
FS_Read( pFile, &entry->frame, sizeof( entry->frame ));
|
FS_Read( pFile, &entry->frame, sizeof( entry->frame ));
|
||||||
FS_Read( pFile, &entry->colormap, sizeof( entry->colormap ));
|
FS_Read( pFile, &entry->colormap, sizeof( entry->colormap ));
|
||||||
FS_Read( pFile, &entry->skin, sizeof( entry->skin ));
|
FS_Read( pFile, &entry->skin, sizeof( entry->skin ));
|
||||||
|
FS_Read( pFile, &entry->body, sizeof( entry->body ));
|
||||||
|
FS_Read( pFile, &entScale, sizeof( entScale ));
|
||||||
FS_Read( pFile, &entry->rendermode, sizeof( entry->rendermode ));
|
FS_Read( pFile, &entry->rendermode, sizeof( entry->rendermode ));
|
||||||
|
|
||||||
|
entry->scale = ((float)entScale / 4096.0f);
|
||||||
|
|
||||||
if( entry->rendermode != kRenderNormal )
|
if( entry->rendermode != kRenderNormal )
|
||||||
{
|
{
|
||||||
// write additional render data
|
// write additional render data
|
||||||
|
|
Reference in New Issue