04 Nov 2013

This commit is contained in:
g-cont 2013-11-04 00:00:00 +04:00 committed by Alibek Omarov
parent 36dfdceff9
commit 0a6c730a97
16 changed files with 177 additions and 71 deletions

View File

@ -1,3 +1,35 @@
build 2463
Engine: reorganize data in texture_t. Release one variable for mod-makers
Engine: change decal_t structure get compatibility with GoldSrc
Engine: expanded mextrasurf_t reserved fields up 32
Engine: update player_info_t (added customization_t like in SDK 2.3)
Engine: increase local_state_t->weapondata up 64 slots
Engine: update IVoiceTweak interface
Engine: new lightstyle system with local time and custom interpolation
Engine: fix bug with lightstyle save\restore (only first 64 symbols of pattern was saved)
Engine: update r_efx_api_t interface
Engine: update engine_studio_api_t, remove uncompatible function StudioGetTexture, added three new (thats came from CS:CZ)
Engine: added ref_overview to support custom overview implementation
Engine: render interface is outdated now. New render interface has version 30 (too much changed)
Engine: update triangleapi_t interface
Engine: update cl_dll interface (also added support for signle export that called 'F')
Engine: a lttle update for enginefuncs_t (server interface)
Client: fixed crash on shutdown when custom renderer uses AVI-files
Engine: applaying scale for decals on brushmodels or world geometry
Engine: update model_state_t thats keep info about studiomodels for studio decals. Include body and skin
Engine: get support for custom studiocache on static and tempents
Engine: write R_Srpite_WallPuff from pEfxAPI
Client: fix bug with beam sorting (solid beams was drawing in translucent pass)
Render: add special flag for decals thats indicated local space (any decal after first shoot)
Render: apply emboss filter on studiomodel textures
Render: rewrite client event system for studiomodels. Get more predictable results
Network: write existing decals and static entities into new demo
Network: protocol was changed to 48
ImageLib: fix old bug with save non-aligned 8-bit bmp files
Server: fix bug with reloading hl.dll when map was changed every time
Server: a client part of save-file is outdated. New version is 0.68
build 2402 build 2402
Engine: added new feature flag for compensate stupid quake bug Engine: added new feature flag for compensate stupid quake bug

View File

@ -77,9 +77,9 @@ typedef struct texture_s
int anim_min, anim_max; // time for this frame min <=time< max int anim_min, anim_max; // time for this frame min <=time< max
struct texture_s *anim_next; // in the animation sequence struct texture_s *anim_next; // in the animation sequence
struct texture_s *alternate_anims; // bmodels in frame 1 use these struct texture_s *alternate_anims; // bmodels in frame 1 use these
int fb_texturenum; // auto-luma texturenum unsigned short fb_texturenum; // auto-luma texturenum
int dt_texturenum; // detail-texture binding unsigned short dt_texturenum; // detail-texture binding
unsigned int unused[2]; // reserved unsigned int unused[3]; // reserved
} texture_t; } texture_t;
typedef struct typedef struct

View File

@ -27,7 +27,7 @@ GNU General Public License for more details.
// move misc functions at end of the interface // move misc functions at end of the interface
// added new export for clearing studio decals // added new export for clearing studio decals
#define CL_RENDER_INTERFACE_VERSION 28 #define CL_RENDER_INTERFACE_VERSION 30
#define MAX_STUDIO_DECALS 4096 // + unused space of BSP decals #define MAX_STUDIO_DECALS 4096 // + unused space of BSP decals
#define SURF_INFO( surf, mod ) ((mextrasurf_t *)mod->cache.data + (surf - mod->surfaces)) #define SURF_INFO( surf, mod ) ((mextrasurf_t *)mod->cache.data + (surf - mod->surfaces))
@ -43,18 +43,19 @@ GNU General Public License for more details.
#define PARM_TEX_LIGHTMAP 7 // second arg as number 0 - 128 #define PARM_TEX_LIGHTMAP 7 // second arg as number 0 - 128
#define PARM_SKY_SPHERE 8 // sky is quake sphere ? #define PARM_SKY_SPHERE 8 // sky is quake sphere ?
#define PARM_WORLD_VERSION 9 // return the version of bsp #define PARM_WORLD_VERSION 9 // return the version of bsp
#define PARM_WIDESCREEN 10 #define PARM_WORLD_LOADING 10 // usefully in callback GL_LoadTexture to determine world or external bmodel
#define PARM_FULLSCREEN 11 #define PARM_WIDESCREEN 11
#define PARM_SCREEN_WIDTH 12 #define PARM_FULLSCREEN 12
#define PARM_SCREEN_HEIGHT 13 #define PARM_SCREEN_WIDTH 13
#define PARM_MAP_HAS_MIRRORS 14 // current map has mirorrs #define PARM_SCREEN_HEIGHT 14
#define PARM_CLIENT_INGAME 15 #define PARM_MAP_HAS_MIRRORS 15 // current map has mirorrs
#define PARM_MAX_ENTITIES 16 #define PARM_CLIENT_INGAME 16
#define PARM_TEX_TARGET 17 #define PARM_MAX_ENTITIES 17
#define PARM_TEX_TEXNUM 18 #define PARM_TEX_TARGET 18
#define PARM_TEX_FLAGS 19 #define PARM_TEX_TEXNUM 19
#define PARM_FEATURES 20 // same as movevars->features #define PARM_TEX_FLAGS 20
#define PARM_ACTIVE_TMU 21 // for debug #define PARM_FEATURES 21 // same as movevars->features
#define PARM_ACTIVE_TMU 22 // for debug
enum enum
{ {
@ -67,6 +68,25 @@ enum
SKYBOX_DOWN, SKYBOX_DOWN,
}; };
typedef enum
{
TEX_INVALID = 0, // free slot
TEX_SYSTEM, // generated by engine
TEX_NOMIP, // hud pics, menu etc
TEX_BRUSH, // a map texture
TEX_SPRITE, // sprite frames
TEX_STUDIO, // studio skins
TEX_LIGHTMAP, // lightmap textures
TEX_DECAL, // decals
TEX_VGUI, // vgui fonts or images
TEX_CUBEMAP, // cubemap textures (sky)
TEX_DETAIL, // detail textures
TEX_REMAP, // local copy of remap texture
TEX_SCREENCOPY, // keep screen copy e.g. for mirror
TEX_CUSTOM, // user created texture
TEX_DEPTHMAP // shadowmap texture
} texType_t;
typedef enum typedef enum
{ {
TF_NEAREST = (1<<0), // disable texfilter TF_NEAREST = (1<<0), // disable texfilter
@ -97,6 +117,12 @@ typedef enum
typedef struct beam_s BEAM; typedef struct beam_s BEAM;
typedef struct particle_s particle_t; typedef struct particle_s particle_t;
typedef struct wadlist_s
{
char wadnames[256][32];
int count;
} wadlist_t;
// 12 bytes here // 12 bytes here
typedef struct modelstate_s typedef struct modelstate_s
{ {
@ -146,8 +172,9 @@ typedef struct render_api_s
// Texture tools // Texture tools
int (*GL_FindTexture)( const char *name ); int (*GL_FindTexture)( const char *name );
const char* (*GL_TextureName)( unsigned int texnum ); const char* (*GL_TextureName)( unsigned int texnum );
int (*GL_LoadTexture)( const char *name, const byte *buf, size_t size, int flags ); int (*GL_LoadTexture)( const char *name, const byte *buf, size_t size, int flags, void *filter );
int (*GL_CreateTexture)( const char *name, int width, int height, const void *buffer, int flags ); int (*GL_CreateTexture)( const char *name, int width, int height, const void *buffer, int flags );
void (*GL_SetTextureType)( unsigned int texnum, unsigned int type );
void (*GL_FreeTexture)( unsigned int texnum ); void (*GL_FreeTexture)( unsigned int texnum );
// Decals manipulating (draw & remove) // Decals manipulating (draw & remove)
@ -183,9 +210,12 @@ typedef struct render_api_s
int (*SPR_LoadExt)( const char *szPicName, unsigned int texFlags ); // extended version of SPR_Load int (*SPR_LoadExt)( const char *szPicName, unsigned int texFlags ); // extended version of SPR_Load
struct mstudiotex_s *( *StudioGetTexture )( struct cl_entity_s *e ); struct mstudiotex_s *( *StudioGetTexture )( struct cl_entity_s *e );
const struct ref_overview_s *( *GetOverviewParms )( void ); const struct ref_overview_s *( *GetOverviewParms )( void );
void (*R_InitQuakeSky)( struct mip_s *mt, struct texture_s *tx );
void *(*R_FindTexFilter)( const char *texname ); // only for internal use by imagelib. No acess to private fields
void (*S_FadeMusicVolume)( float fadePercent ); // fade background track (0-100 percents) void (*S_FadeMusicVolume)( float fadePercent ); // fade background track (0-100 percents)
void (*SetRandomSeed)( long lSeed ); // set custom seed for RANDOM_FLOAT\RANDOM_LONG for predictable random void (*SetRandomSeed)( long lSeed ); // set custom seed for RANDOM_FLOAT\RANDOM_LONG for predictable random
// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 28 wadlist_t *(*COM_GetWadsList)( void ); // returns a wadlist for the given map
// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 30
} render_api_t; } render_api_t;
// render callbacks // render callbacks
@ -208,6 +238,8 @@ typedef struct render_interface_s
qboolean (*R_SpeedsMessage)( char *out, size_t size ); qboolean (*R_SpeedsMessage)( char *out, size_t size );
// replace with built-in R_DrawCubemapView for make skyshots or envshots // replace with built-in R_DrawCubemapView for make skyshots or envshots
qboolean (*R_DrawCubemapView)( const float *origin, const float *angles, int size ); qboolean (*R_DrawCubemapView)( const float *origin, const float *angles, int size );
// custom texture loader for worldmodel and bsp-models (as a part of implementation Quake3 shader system)
qboolean (*GL_LoadTextures)( const void *in, model_t *out, int *sky1, int *sky2 );
} render_interface_t; } render_interface_t;
#endif//RENDER_API_H #endif//RENDER_API_H

View File

@ -35,7 +35,7 @@ class CApache : public CBaseMonster
void Spawn( void ); void Spawn( void );
void Precache( void ); void Precache( void );
int Classify( void ) { return m_iClass ? m_iClass : CLASS_HUMAN_MILITARY; }; int Classify( void ) { return CLASS_HUMAN_MILITARY; };
int BloodColor( void ) { return DONT_BLEED; } int BloodColor( void ) { return DONT_BLEED; }
void Killed( entvars_t *pevAttacker, int iGib ); void Killed( entvars_t *pevAttacker, int iGib );
void GibMonster( void ); void GibMonster( void );

View File

@ -3214,7 +3214,7 @@ TriForParams
*/ */
void TriFogParams( float flDensity, int iFogSkybox ) void TriFogParams( float flDensity, int iFogSkybox )
{ {
// FIXME: implement // TODO: implement
} }
/* /*

View File

@ -1782,8 +1782,13 @@ Create a wallpuff
*/ */
void CL_Sprite_WallPuff( TEMPENTITY *pTemp, float scale ) void CL_Sprite_WallPuff( TEMPENTITY *pTemp, float scale )
{ {
// UNDONE: g-cont. i'm dont know what this doing if( !pTemp ) return;
Msg( "CL_Sprite_WallPuff: %g\n", scale );
pTemp->entity.curstate.renderamt = 255;
pTemp->entity.curstate.rendermode = kRenderTransAlpha;
pTemp->entity.angles[ROLL] = Com_RandomLong( 0, 359 );
pTemp->entity.curstate.scale = scale;
pTemp->die = cl.time + 0.01f;
} }
/* /*

View File

@ -614,7 +614,6 @@ _inline cl_entity_t *CL_EDICT_NUM( int n )
// //
// cl_parse.c // cl_parse.c
// //
extern const char *svc_strings[256];
void CL_ParseServerMessage( sizebuf_t *msg ); void CL_ParseServerMessage( sizebuf_t *msg );
void CL_ParseTempEntity( sizebuf_t *msg ); void CL_ParseTempEntity( sizebuf_t *msg );
qboolean CL_DispatchUserMessage( const char *pszName, int iSize, void *pbuf ); qboolean CL_DispatchUserMessage( const char *pszName, int iSize, void *pbuf );

View File

@ -56,25 +56,6 @@ extern byte *r_temppool;
#define TF_IMAGE (TF_UNCOMPRESSED|TF_NOPICMIP|TF_NOMIPMAP|TF_CLAMP) #define TF_IMAGE (TF_UNCOMPRESSED|TF_NOPICMIP|TF_NOMIPMAP|TF_CLAMP)
#define TF_DECAL (TF_CLAMP|TF_UNCOMPRESSED) #define TF_DECAL (TF_CLAMP|TF_UNCOMPRESSED)
typedef enum
{
TEX_INVALID = 0, // free slot
TEX_SYSTEM, // generated by engine
TEX_NOMIP, // hud pics, menu etc
TEX_BRUSH, // a map texture
TEX_SPRITE, // sprite frames
TEX_STUDIO, // studio skins
TEX_LIGHTMAP, // lightmap textures
TEX_DECAL, // decals
TEX_VGUI, // vgui fonts or images
TEX_CUBEMAP, // cubemap textures (sky)
TEX_DETAIL, // detail textures
TEX_REMAP, // local copy of remap texture
TEX_SCREENCOPY, // keep screen copy e.g. for mirror
TEX_CUSTOM, // user created texture
TEX_DEPTHMAP // shadowmap texture
} texType_t;
typedef struct gltexture_s typedef struct gltexture_s
{ {
char name[128]; // game path, including extension char name[128]; // game path, including extension
@ -361,6 +342,7 @@ void R_ClearScene( void );
void R_LoadIdentity( void ); void R_LoadIdentity( void );
void R_RenderScene( const ref_params_t *fd ); void R_RenderScene( const ref_params_t *fd );
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 );
qboolean GL_LoadTextures( const void *in, model_t *out );
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 );
int R_ComputeFxBlend( cl_entity_t *e ); int R_ComputeFxBlend( cl_entity_t *e );

View File

@ -1389,6 +1389,33 @@ void R_DrawCubemapView( const vec3_t origin, const vec3_t angles, int size )
r_oldviewleaf = r_viewleaf = NULL; // force markleafs next frame r_oldviewleaf = r_viewleaf = NULL; // force markleafs next frame
} }
/*
===============
GL_LoadTextures
override standart function
for extended RenderAPI
===============
*/
qboolean GL_LoadTextures( const void *in, model_t *out )
{
qboolean result = false;
if( clgame.drawFuncs.GL_LoadTextures != NULL )
{
world.use_worldpool = true;
result = clgame.drawFuncs.GL_LoadTextures( in, out, &tr.solidskyTexture, &tr.alphaskyTexture );
if( result && tr.solidskyTexture && tr.alphaskyTexture )
world.sky_sphere = true;
world.use_worldpool = false;
}
return result;
}
static int GL_RenderGetParm( int parm, int arg ) static int GL_RenderGetParm( int parm, int arg )
{ {
gltexture_t *glt; gltexture_t *glt;
@ -1418,7 +1445,11 @@ static int GL_RenderGetParm( int parm, int arg )
case PARM_SKY_SPHERE: case PARM_SKY_SPHERE:
return world.sky_sphere; return world.sky_sphere;
case PARM_WORLD_VERSION: case PARM_WORLD_VERSION:
if( cls.state != ca_active )
return bmodel_version;
return world.version; return world.version;
case PARM_WORLD_LOADING:
return world.loading;
case PARM_WIDESCREEN: case PARM_WIDESCREEN:
return glState.wideScreen; return glState.wideScreen;
case PARM_FULLSCREEN: case PARM_FULLSCREEN:
@ -1559,11 +1590,6 @@ static const char *GL_TextureName( unsigned int texnum )
return R_GetTexture( texnum )->name; return R_GetTexture( texnum )->name;
} }
static int GL_LoadTextureNoFilter( const char *name, const byte *buf, size_t size, int flags )
{
return GL_LoadTexture( name, buf, size, flags, NULL );
}
static const ref_overview_t *GL_GetOverviewParms( void ) static const ref_overview_t *GL_GetOverviewParms( void )
{ {
return &clgame.overView; return &clgame.overView;
@ -1585,8 +1611,9 @@ static render_api_t gRenderAPI =
R_StoreEfrags, R_StoreEfrags,
GL_FindTexture, GL_FindTexture,
GL_TextureName, GL_TextureName,
GL_LoadTextureNoFilter, GL_LoadTexture,
GL_CreateTexture, GL_CreateTexture,
GL_SetTextureType,
GL_FreeTexture, GL_FreeTexture,
DrawSingleDecal, DrawSingleDecal,
R_DecalSetupVerts, R_DecalSetupVerts,
@ -1614,8 +1641,11 @@ static render_api_t gRenderAPI =
pfnSPR_LoadExt, pfnSPR_LoadExt,
R_StudioGetTexture, R_StudioGetTexture,
GL_GetOverviewParms, GL_GetOverviewParms,
R_InitSky,
R_FindTexFilter,
S_FadeMusicVolume, S_FadeMusicVolume,
Com_SetRandomSeed, Com_SetRandomSeed,
Mod_WadList,
}; };
/* /*

View File

@ -3361,11 +3361,12 @@ load model texture with unique name
*/ */
static void R_StudioLoadTexture( model_t *mod, studiohdr_t *phdr, mstudiotexture_t *ptexture ) static void R_StudioLoadTexture( model_t *mod, studiohdr_t *phdr, mstudiotexture_t *ptexture )
{ {
size_t size; size_t size;
int flags = 0; int flags = 0;
qboolean load_external = false; qboolean load_external = false;
char texname[128], name[128], mdlname[128]; char texname[128], name[128], mdlname[128];
texture_t *tx = NULL; imgfilter_t *filter = NULL;
texture_t *tx = NULL;
if( ptexture->flags & STUDIO_NF_TRANSPARENT ) if( ptexture->flags & STUDIO_NF_TRANSPARENT )
flags |= (TF_CLAMP|TF_NOMIPMAP); flags |= (TF_CLAMP|TF_NOMIPMAP);
@ -3422,6 +3423,10 @@ static void R_StudioLoadTexture( model_t *mod, studiohdr_t *phdr, mstudiotexture
FS_FileBase( ptexture->name, name ); FS_FileBase( ptexture->name, name );
FS_StripExtension( mdlname ); FS_StripExtension( mdlname );
// loading texture filter for studiomodel
if( !( ptexture->flags & STUDIO_NF_COLORMAP ))
filter = R_FindTexFilter( va( "%s.mdl/%s", mdlname, name )); // grab texture filter
// NOTE: colormaps must have the palette for properly work. Ignore it. // NOTE: colormaps must have the palette for properly work. Ignore it.
if( mod_allow_materials != NULL && mod_allow_materials->integer && !( ptexture->flags & STUDIO_NF_COLORMAP )) if( mod_allow_materials != NULL && mod_allow_materials->integer && !( ptexture->flags & STUDIO_NF_COLORMAP ))
{ {
@ -3430,7 +3435,7 @@ static void R_StudioLoadTexture( model_t *mod, studiohdr_t *phdr, mstudiotexture
Q_snprintf( texname, sizeof( texname ), "materials/%s/%s.tga", mdlname, name ); Q_snprintf( texname, sizeof( texname ), "materials/%s/%s.tga", mdlname, name );
if( FS_FileExists( texname, false )) if( FS_FileExists( texname, false ))
gl_texturenum = GL_LoadTexture( texname, NULL, 0, flags, NULL ); gl_texturenum = GL_LoadTexture( texname, NULL, 0, flags, filter );
if( gl_texturenum ) if( gl_texturenum )
{ {
@ -3447,7 +3452,7 @@ static void R_StudioLoadTexture( model_t *mod, studiohdr_t *phdr, mstudiotexture
// build the texname // build the texname
Q_snprintf( texname, sizeof( texname ), "#%s/%s.mdl", mdlname, name ); Q_snprintf( texname, sizeof( texname ), "#%s/%s.mdl", mdlname, name );
ptexture->index = GL_LoadTexture( texname, (byte *)ptexture, size, flags, NULL ); ptexture->index = GL_LoadTexture( texname, (byte *)ptexture, size, flags, filter );
} }
else MsgDev( D_NOTE, "loading HQ: %s\n", texname ); else MsgDev( D_NOTE, "loading HQ: %s\n", texname );

View File

@ -23,7 +23,7 @@ static char mond[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int Q_buildnum( void ) int Q_buildnum( void )
{ {
// do not touch this! Only author of Xash3D can increase buildnumbers! // do not touch this! Only author of Xash3D can increase buildnumbers!
#if 1 #if 0
int m = 0, d = 0, y = 0; int m = 0, d = 0, y = 0;
static int b = 0; static int b = 0;
@ -48,6 +48,6 @@ int Q_buildnum( void )
return b; return b;
#else #else
return 2411; return 2463;
#endif #endif
} }

View File

@ -850,6 +850,7 @@ typedef struct autocomplete_list_s
} autocomplete_list_t; } autocomplete_list_t;
extern autocomplete_list_t cmd_list[]; extern autocomplete_list_t cmd_list[];
extern const char *svc_strings[256];
// soundlib shared exports // soundlib shared exports
qboolean S_Init( void ); qboolean S_Init( void );

View File

@ -90,6 +90,9 @@ void Host_PrintEngineFeatures( void )
if( host.features & ENGINE_LARGE_LIGHTMAPS ) if( host.features & ENGINE_LARGE_LIGHTMAPS )
MsgDev( D_AICONSOLE, "^3EXT:^7 Large lightmaps enabled\n" ); MsgDev( D_AICONSOLE, "^3EXT:^7 Large lightmaps enabled\n" );
if( host.features & ENGINE_COMPENSATE_QUAKE_BUG )
MsgDev( D_AICONSOLE, "^3EXT:^7 Compensate quake bug enabled\n" );
} }
/* /*

View File

@ -75,6 +75,7 @@ typedef struct
qboolean has_mirrors; // one or more brush models contain reflective textures qboolean has_mirrors; // one or more brush models contain reflective textures
int lm_sample_size; // defaulting to 16 (BSP31 uses 8) int lm_sample_size; // defaulting to 16 (BSP31 uses 8)
int block_size; // lightmap blocksize int block_size; // lightmap blocksize
qboolean use_worldpool; // Mod_Calloc temporare change from com_studiocache to use loadmodel->mempool
vec3_t mins; // real accuracy world bounds vec3_t mins; // real accuracy world bounds
vec3_t maxs; vec3_t maxs;
@ -85,6 +86,7 @@ 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
@ -117,6 +119,7 @@ byte *Mod_CompressVis( const byte *in, size_t *size );
byte *Mod_DecompressVis( const byte *in ); byte *Mod_DecompressVis( const byte *in );
modtype_t Mod_GetType( int handle ); modtype_t Mod_GetType( int handle );
model_t *Mod_Handle( int handle ); model_t *Mod_Handle( int handle );
struct wadlist_s *Mod_WadList( void );
// //
// mod_studio.c // mod_studio.c

View File

@ -36,8 +36,7 @@ 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 *mod_allow_materials; convar_t *mod_allow_materials;
static char mod_wadnames[128][32]; // 128 wad names stored static wadlist_t wadlist;
static int mod_numwads;
model_t *loadmodel; model_t *loadmodel;
model_t *worldmodel; model_t *worldmodel;
@ -533,6 +532,7 @@ void Mod_ClearAll( void )
Mod_FreeModel( &cm_models[i] ); Mod_FreeModel( &cm_models[i] );
Q_memset( cm_models, 0, sizeof( cm_models )); Q_memset( cm_models, 0, sizeof( cm_models ));
world.use_worldpool = false; // reset by Host_Error
cm_nummodels = 0; cm_nummodels = 0;
} }
@ -643,6 +643,10 @@ static void Mod_LoadTextures( const dlump_t *l )
in = (void *)(mod_base + l->fileofs); in = (void *)(mod_base + l->fileofs);
// texture loading is overrided?
if( GL_LoadTextures( in, loadmodel ))
return;
loadmodel->numtextures = in->nummiptex; loadmodel->numtextures = in->nummiptex;
loadmodel->textures = (texture_t **)Mem_Alloc( loadmodel->mempool, loadmodel->numtextures * sizeof( texture_t* )); loadmodel->textures = (texture_t **)Mem_Alloc( loadmodel->mempool, loadmodel->numtextures * sizeof( texture_t* ));
@ -784,9 +788,9 @@ load_wad_textures:
qboolean fullpath_loaded = false; qboolean fullpath_loaded = false;
// check wads in reverse order // check wads in reverse order
for( j = mod_numwads - 1; j >= 0; j-- ) for( j = wadlist.count - 1; j >= 0; j-- )
{ {
char *texpath = va( "%s.wad/%s", mod_wadnames[j], texname ); char *texpath = va( "%s.wad/%s", wadlist.wadnames[j], texname );
if( FS_FileExists( texpath, false )) if( FS_FileExists( texpath, false ))
{ {
@ -855,9 +859,9 @@ load_wad_textures:
if( !load_external_luma ) if( !load_external_luma )
{ {
// check wads in reverse order // check wads in reverse order
for( j = mod_numwads - 1; j >= 0; j-- ) for( j = wadlist.count - 1; j >= 0; j-- )
{ {
char *texpath = va( "%s.wad/%s.mip", mod_wadnames[j], tx->name ); char *texpath = va( "%s.wad/%s.mip", wadlist.wadnames[j], tx->name );
if( FS_FileExists( texpath, false )) if( FS_FileExists( texpath, false ))
{ {
@ -2166,7 +2170,7 @@ static void Mod_LoadEntities( const dlump_t *l )
world.entdatasize = l->filelen; world.entdatasize = l->filelen;
pfile = (char *)loadmodel->entities; pfile = (char *)loadmodel->entities;
mod_numwads = 0; wadlist.count = 0;
// parse all the wads for loading textures in right ordering // parse all the wads for loading textures in right ordering
while(( pfile = COM_ParseFile( pfile, token )) != NULL ) while(( pfile = COM_ParseFile( pfile, token )) != NULL )
@ -2201,9 +2205,9 @@ static void Mod_LoadEntities( const dlump_t *l )
char *end = Q_strchr( path, ';' ); char *end = Q_strchr( path, ';' );
if( !end ) break; if( !end ) break;
Q_strncpy( wadpath, path, (end - path) + 1 ); Q_strncpy( wadpath, path, (end - path) + 1 );
FS_FileBase( wadpath, mod_wadnames[mod_numwads++] ); FS_FileBase( wadpath, wadlist.wadnames[wadlist.count++] );
path += (end - path) + 1; // move pointer path += (end - path) + 1; // move pointer
if( mod_numwads >= 128 ) break; // too many wads... if( wadlist.count >= 256 ) break; // too many wads...
} }
} }
else if( !Q_stricmp( keyname, "mapversion" )) else if( !Q_stricmp( keyname, "mapversion" ))
@ -3071,10 +3075,16 @@ Mod_Calloc
*/ */
void *Mod_Calloc( int number, size_t size ) void *Mod_Calloc( int number, size_t size )
{ {
cache_user_t *cu; cache_user_t *cu;
byte *pool;
// IEngineStudio->Mem_Calloc may be used for loading worldtextures
if( world.use_worldpool )
pool = loadmodel->mempool;
else pool = com_studiocache;
if( number <= 0 || size <= 0 ) return NULL; if( number <= 0 || size <= 0 ) return NULL;
cu = (cache_user_t *)Mem_Alloc( com_studiocache, sizeof( cache_user_t ) + number * size ); cu = (cache_user_t *)Mem_Alloc( pool, sizeof( cache_user_t ) + number * size );
cu->data = (void *)cu; // make sure what cu->data is not NULL cu->data = (void *)cu; // make sure what cu->data is not NULL
return cu; return cu;
@ -3172,4 +3182,9 @@ model_t *Mod_Handle( int handle )
return NULL; return NULL;
} }
return com_models[handle]; return com_models[handle];
}
wadlist_t *Mod_WadList( void )
{
return &wadlist;
} }

View File

@ -2457,12 +2457,10 @@ void pfnMessageBegin( int msg_dest, int msg_num, const float *pOrigin, edict_t *
{ {
svgame.msg_name = NULL; svgame.msg_name = NULL;
svgame.msg_index = -msg_num; // this is a system message svgame.msg_index = -msg_num; // this is a system message
svgame.msg_name = svc_strings[msg_num];
if( msg_num == svc_temp_entity ) if( msg_num == svc_temp_entity )
{
svgame.msg_name = "TempEntity";
iSize = -1; // temp entity have variable size iSize = -1; // temp entity have variable size
}
else iSize = 0; else iSize = 0;
} }
else else
@ -2516,6 +2514,7 @@ void pfnMessageEnd( void )
float *org = NULL; float *org = NULL;
if( svgame.msg_name ) name = svgame.msg_name; if( svgame.msg_name ) name = svgame.msg_name;
if( !svgame.msg_started ) Host_Error( "MessageEnd: called with no active message\n" ); if( !svgame.msg_started ) Host_Error( "MessageEnd: called with no active message\n" );
svgame.msg_started = false; svgame.msg_started = false;