24 Aug 2018

This commit is contained in:
g-cont 2018-08-24 00:00:00 +03:00 committed by Alibek Omarov
parent 5e61312f69
commit b70c14463d
34 changed files with 563 additions and 878 deletions

25
common/boneinfo.h Normal file
View File

@ -0,0 +1,25 @@
/*
boneinfo.h - structure that send delta-compressed bones across network
Copyright (C) 2018 Uncle Mike
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#ifndef BONEINFO_H
#define BONEINFO_H
typedef struct
{
vec3_t angles;
vec3_t origin;
} boneinfo_t;
#endif//BONEINFO_H

View File

@ -74,12 +74,13 @@ enum
typedef enum
{
TF_COLORMAP = 0, // just for tabulate source
TF_NEAREST = (1<<0), // disable texfilter
TF_KEEP_SOURCE = (1<<1), // some images keep source
TF_NOFLIP_TGA = (1<<2), // Steam background completely ignore tga attribute 0x20
TF_EXPAND_SOURCE = (1<<3), // Don't keep source as 8-bit expand to RGBA
TF_TEXTURE_2D_ARRAY = (1<<4), // this is 2D texture array (multi-layers)
TF_TEXTURE_RECTANGLE= (1<<5), // this is GL_TEXTURE_RECTANGLE
// reserved
TF_RECTANGLE = (1<<5), // this is GL_TEXTURE_RECTANGLE
TF_CUBEMAP = (1<<6), // it's cubemap texture
TF_DEPTHMAP = (1<<7), // custom texture filter used
TF_QUAKEPAL = (1<<8), // image has an quake1 palette
@ -92,7 +93,7 @@ typedef enum
TF_NORMALMAP = (1<<15), // is a normalmap
TF_HAS_ALPHA = (1<<16), // image has alpha (used only for GL_CreateTexture)
TF_FORCE_COLOR = (1<<17), // force upload monochrome textures as RGB (detail textures)
TF_TEXTURE_1D = (1<<18), // this is GL_TEXTURE_1D
// reserved
TF_BORDER = (1<<19), // zero clamp for projected textures
TF_TEXTURE_3D = (1<<20), // this is GL_TEXTURE_3D
TF_ATLAS_PAGE = (1<<21), // bit who indicate lightmap page or deluxemap page
@ -203,9 +204,9 @@ typedef struct render_api_s
void (*GL_TextureTarget)( unsigned int target ); // change texture unit mode without bind texture
void (*GL_TexCoordArrayMode)( unsigned int texmode );
void* (*GL_GetProcAddress)( const char *name );
void (*GL_UpdateTexSize)( int texnum, int width, int height, int depth ); // recalc statistics
void (*GL_Reserved0)( void ); // for potential interface expansion without broken compatibility
void (*GL_Reserved1)( void );
void (*GL_Reserved2)( void );
// Misc renderer functions
void (*GL_DrawParticles)( const struct ref_viewpass_s *rvp, qboolean trans_pass, float frametime );

View File

@ -82,7 +82,7 @@ const char *svc_strings[svc_lastmsg+1] =
"svc_director",
"svc_voiceinit",
"svc_voicedata",
"svc_unused54",
"svc_deltapacketbones",
"svc_unused55",
"svc_resourcelocation",
"svc_querycvarvalue",

View File

@ -1059,7 +1059,7 @@ void CL_LinkUserMessage( char *pszName, const int svc_num, int iSize )
for( i = 0; i < MAX_USER_MESSAGES && clgame.msg[i].name[0]; i++ )
{
// NOTE: no check for DispatchFunc, check only name
if( !Q_strcmp( clgame.msg[i].name, pszName ))
if( !Q_stricmp( clgame.msg[i].name, pszName ))
{
clgame.msg[i].number = svc_num;
clgame.msg[i].size = iSize;
@ -1685,7 +1685,7 @@ static int pfnHookUserMsg( const char *pszName, pfnUserMsgHook pfn )
for( i = 0; i < MAX_USER_MESSAGES && clgame.msg[i].name[0]; i++ )
{
// see if already hooked
if( !Q_strcmp( clgame.msg[i].name, pszName ))
if( !Q_stricmp( clgame.msg[i].name, pszName ))
return 1;
}
@ -1712,7 +1712,7 @@ static int pfnServerCmd( const char *szCmdString )
{
string buf;
if( !szCmdString || !szCmdString[0] )
if( !COM_CheckString( szCmdString ))
return 0;
// just like the client typed "cmd xxxxx" at the console
@ -1730,11 +1730,20 @@ pfnClientCmd
*/
static int pfnClientCmd( const char *szCmdString )
{
if( !szCmdString || !szCmdString[0] )
if( !COM_CheckString( szCmdString ))
return 0;
Cbuf_AddText( szCmdString );
Cbuf_AddText( "\n" );
if( cls.initialized )
{
Cbuf_AddText( szCmdString );
Cbuf_AddText( "\n" );
}
else
{
// will exec later
Q_strncat( host.deferred_cmd, va( "%s\n", szCmdString ), sizeof( host.deferred_cmd ));
}
return 1;
}

View File

@ -29,6 +29,15 @@ void UI_UpdateMenu( float realtime )
{
if( !gameui.hInstance ) return;
// if some deferred cmds is waiting
if( UI_IsVisible() && COM_CheckString( host.deferred_cmd ))
{
Cbuf_AddText( host.deferred_cmd );
host.deferred_cmd[0] = '\0';
Cbuf_Execute();
return;
}
// menu time (not paused, not clamped)
gameui.globals->time = host.realtime;
gameui.globals->frametime = host.realframetime;

View File

@ -265,7 +265,7 @@ static float CL_LerpPoint( void )
f = 0.1f;
}
#if 1
frac = (cl.time - cl.mtime[1]) / f;
frac = (cl.time - cl.mtime[0]) / f;
if( frac < 0.0f )
{
@ -288,7 +288,7 @@ static float CL_LerpPoint( void )
else if( f > 0.001f )
{
// automatic lerp (classic mode)
frac = ( cl.time - cl.mtime[1] ) / f;
frac = ( cl.time - cl.mtime[0] ) / f;
}
#endif
return frac;
@ -1488,8 +1488,10 @@ CL_InternetServers_f
*/
void CL_InternetServers_f( void )
{
char fullquery[512] = MS_SCAN_REQUEST;
char *info = fullquery + sizeof( MS_SCAN_REQUEST ) - 1;
int remaining = sizeof( fullquery ) - sizeof( MS_SCAN_REQUEST );
netadr_t adr;
char fullquery[512] = "1\xFF" "0.0.0.0:0\0" "\\gamedir\\";
Con_Printf( "Scanning for servers on the internet area...\n" );
NET_Config( true ); // allow remote
@ -1497,9 +1499,10 @@ void CL_InternetServers_f( void )
if( !NET_StringToAdr( MASTERSERVER_ADR, &adr ) )
MsgDev( D_ERROR, "Can't resolve adr: %s\n", MASTERSERVER_ADR );
Q_strcpy( &fullquery[22], GI->gamedir );
Info_SetValueForKey( info, "gamedir", GI->gamefolder, remaining );
Info_SetValueForKey( info, "clver", XASH_VERSION, remaining ); // let master know about client version
NET_SendPacket( NS_CLIENT, Q_strlen( GI->gamedir ) + 23, fullquery, adr );
NET_SendPacket( NS_CLIENT, sizeof( MS_SCAN_REQUEST ) + Q_strlen( info ), fullquery, adr );
// now we clearing the vgui request
if( clgame.master_request != NULL )

View File

@ -324,7 +324,7 @@ void CL_ParseStaticEntity( sizebuf_t *msg )
i = clgame.numStatics;
if( i >= MAX_STATIC_ENTITIES )
{
Con_Printf( S_ERROR, "MAX_STATIC_ENTITIES limit exceeded!\n" );
Con_Printf( S_ERROR "MAX_STATIC_ENTITIES limit exceeded!\n" );
return;
}

View File

@ -596,7 +596,7 @@ static void CL_ParseQuakeStaticEntity( sizebuf_t *msg )
i = clgame.numStatics;
if( i >= MAX_STATIC_ENTITIES )
{
Con_Printf( S_ERROR, "CL_ParseStaticEntity: static entities limit exceeded!\n" );
Con_Printf( S_ERROR "CL_ParseStaticEntity: static entities limit exceeded!\n" );
return;
}

View File

@ -99,7 +99,7 @@ Dupliacte texture with remap pixels
*/
void CL_DuplicateTexture( mstudiotexture_t *ptexture, int topcolor, int bottomcolor )
{
gltexture_t *glt;
gl_texture_t *glt;
texture_t *tx = NULL;
char texname[128];
int i, size, index;
@ -141,7 +141,7 @@ Update texture top and bottom colors
*/
void CL_UpdateStudioTexture( mstudiotexture_t *ptexture, int topcolor, int bottomcolor )
{
gltexture_t *glt;
gl_texture_t *glt;
rgbdata_t *pic;
texture_t *tx = NULL;
char texname[128], name[128], mdlname[128];
@ -183,7 +183,7 @@ void CL_UpdateStudioTexture( mstudiotexture_t *ptexture, int topcolor, int botto
return;
}
index = GL_LoadTextureInternal( glt->name, pic, 0, true );
index = GL_UpdateTextureInternal( glt->name, pic, 0 );
FS_FreeImage( pic );
// restore original palette
@ -224,7 +224,7 @@ void CL_UpdateAliasTexture( unsigned short *texture, int skinnum, int topcolor,
skin.buffer = (byte *)(tx + 1);
skin.palette = skin.buffer + skin.size;
pic = FS_CopyImage( &skin ); // because GL_LoadTextureInternal will freed a rgbdata_t at end
*texture = GL_LoadTextureInternal( texname, pic, TF_KEEP_SOURCE, false );
*texture = GL_LoadTextureInternal( texname, pic, TF_KEEP_SOURCE );
}
// and now we can remap with internal routines

View File

@ -3014,7 +3014,7 @@ void CL_PlayerDecal( int playernum, int customIndex, int entityIndex, float *pos
if( !pCust->nUserData1 && pCust->pInfo != NULL )
{
const char *decalname = va( "player%dlogo%d", playernum, customIndex );
pCust->nUserData1 = GL_LoadTextureInternal( decalname, pCust->pInfo, TF_DECAL, false );
pCust->nUserData1 = GL_LoadTextureInternal( decalname, pCust->pInfo, TF_DECAL );
}
textureIndex = pCust->nUserData1;
}

View File

@ -235,6 +235,7 @@ qboolean SCR_PlayCinematic( const char *arg )
UI_SetActiveMenu( false );
cls.state = ca_cinematic;
Con_FastClose();
cin_time = 0.0f;
cls.signon = 0;

View File

@ -487,7 +487,7 @@ void *Mod_LoadSingleSkin( daliasskintype_t *pskintype, int skinnum, int size )
m_pAliasHeader->gl_texturenum[skinnum][0] =
m_pAliasHeader->gl_texturenum[skinnum][1] =
m_pAliasHeader->gl_texturenum[skinnum][2] =
m_pAliasHeader->gl_texturenum[skinnum][3] = GL_LoadTextureInternal( name, pic, 0, false );
m_pAliasHeader->gl_texturenum[skinnum][3] = GL_LoadTextureInternal( name, pic, 0 );
FS_FreeImage( pic );
if( R_GetTexture( m_pAliasHeader->gl_texturenum[skinnum][0] )->flags & TF_HAS_LUMA )
@ -496,7 +496,7 @@ void *Mod_LoadSingleSkin( daliasskintype_t *pskintype, int skinnum, int size )
m_pAliasHeader->fb_texturenum[skinnum][0] =
m_pAliasHeader->fb_texturenum[skinnum][1] =
m_pAliasHeader->fb_texturenum[skinnum][2] =
m_pAliasHeader->fb_texturenum[skinnum][3] = GL_LoadTextureInternal( lumaname, pic, TF_MAKELUMA, false );
m_pAliasHeader->fb_texturenum[skinnum][3] = GL_LoadTextureInternal( lumaname, pic, TF_MAKELUMA );
FS_FreeImage( pic );
}
@ -521,14 +521,14 @@ void *Mod_LoadGroupSkin( daliasskintype_t *pskintype, int skinnum, int size )
{
Q_snprintf( name, sizeof( name ), "%s_%i_%i", loadmodel->name, skinnum, i );
pic = Mod_CreateSkinData( loadmodel, (byte *)(pskintype), m_pAliasHeader->skinwidth, m_pAliasHeader->skinheight );
m_pAliasHeader->gl_texturenum[skinnum][i & 3] = GL_LoadTextureInternal( name, pic, 0, false );
m_pAliasHeader->gl_texturenum[skinnum][i & 3] = GL_LoadTextureInternal( name, pic, 0 );
FS_FreeImage( pic );
if( R_GetTexture( m_pAliasHeader->gl_texturenum[skinnum][i & 3] )->flags & TF_HAS_LUMA )
{
Q_snprintf( lumaname, sizeof( lumaname ), "%s_%i_%i_luma", loadmodel->name, skinnum, i );
pic = Mod_CreateSkinData( NULL, (byte *)(pskintype), m_pAliasHeader->skinwidth, m_pAliasHeader->skinheight );
m_pAliasHeader->fb_texturenum[skinnum][i & 3] = GL_LoadTextureInternal( lumaname, pic, TF_MAKELUMA, false );
m_pAliasHeader->fb_texturenum[skinnum][i & 3] = GL_LoadTextureInternal( lumaname, pic, TF_MAKELUMA );
FS_FreeImage( pic );
}

View File

@ -249,6 +249,7 @@ GL_CleanupAllTextureUnits
*/
void GL_CleanupAllTextureUnits( void )
{
if( !glw_state.initialized ) return;
// force to cleanup all the units
GL_SelectTexture( GL_MaxTextureUnits() - 1 );
GL_CleanUpTextureUnits( 0 );
@ -644,7 +645,7 @@ was there. This is used to test for texture thrashing.
*/
void R_ShowTextures( void )
{
gltexture_t *image;
gl_texture_t *image;
float x, y, w, h;
int total, start, end;
int i, j, k, base_w, base_h;

View File

@ -24,7 +24,7 @@ R_GetImageParms
*/
void R_GetTextureParms( int *w, int *h, int texnum )
{
gltexture_t *glt;
gl_texture_t *glt;
glt = R_GetTexture( texnum );
if( w ) *w = glt->srcWidth;
@ -94,7 +94,7 @@ refresh window.
void R_DrawTileClear( int x, int y, int w, int h )
{
float tw, th;
gltexture_t *glt;
gl_texture_t *glt;
GL_SetRenderMode( kRenderNormal );
pglColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
@ -124,7 +124,7 @@ R_DrawStretchRaw
void R_DrawStretchRaw( float x, float y, float w, float h, int cols, int rows, const byte *data, qboolean dirty )
{
byte *raw = NULL;
gltexture_t *tex;
gl_texture_t *tex;
if( !GL_Support( GL_ARB_TEXTURE_NPOT_EXT ))
{
@ -196,7 +196,7 @@ R_UploadStretchRaw
void R_UploadStretchRaw( int texture, int cols, int rows, int width, int height, const byte *data )
{
byte *raw = NULL;
gltexture_t *tex;
gl_texture_t *tex;
if( !GL_Support( GL_ARB_TEXTURE_NPOT_EXT ))
{

View File

@ -390,6 +390,7 @@ typedef float GLmatrix[16];
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD
#define GL_COMPRESSED_ALPHA_ARB 0x84E9
#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA
#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB

File diff suppressed because it is too large Load Diff

View File

@ -93,7 +93,7 @@ typedef struct gltexture_s
int servercount;
uint hashValue;
struct gltexture_s *nextHash;
} gltexture_t;
} gl_texture_t;
typedef struct
{
@ -306,16 +306,18 @@ void R_DrawModelHull( void );
// gl_image.c
//
void R_SetTextureParameters( void );
gltexture_t *R_GetTexture( GLenum texnum );
gl_texture_t *R_GetTexture( GLenum texnum );
#define GL_LoadTextureInternal( name, pic, flags ) GL_LoadTextureFromBuffer( name, pic, flags, false )
#define GL_UpdateTextureInternal( name, pic, flags ) GL_LoadTextureFromBuffer( name, pic, flags, true )
int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags, imgfilter_t *filter );
int GL_LoadTextureArray( const char **names, int flags, imgfilter_t *filter );
int GL_LoadTextureInternal( const char *name, rgbdata_t *pic, texFlags_t flags, qboolean update );
int GL_LoadTextureFromBuffer( const char *name, rgbdata_t *pic, texFlags_t flags, qboolean update );
byte *GL_ResampleTexture( const byte *source, int in_w, int in_h, int out_w, int out_h, qboolean isNormalMap );
int GL_CreateTexture( const char *name, int width, int height, const void *buffer, texFlags_t flags );
int GL_CreateTextureArray( const char *name, int width, int height, int depth, const void *buffer, texFlags_t flags );
void GL_ProcessTexture( int texnum, float gamma, int topColor, int bottomColor );
void GL_ApplyTextureParams( gltexture_t *tex );
void R_FreeImage( gltexture_t *image );
void GL_UpdateTexSize( int texnum, int width, int height, int depth );
void GL_ApplyTextureParams( gl_texture_t *tex );
int GL_FindTexture( const char *name );
void GL_FreeTexture( GLenum texnum );
void GL_FreeImage( const char *name );

View File

@ -579,9 +579,9 @@ using to find source waterleaf with
watertexture to grab fog values from it
=============
*/
static gltexture_t *R_RecursiveFindWaterTexture( const mnode_t *node, const mnode_t *ignore, qboolean down )
static gl_texture_t *R_RecursiveFindWaterTexture( const mnode_t *node, const mnode_t *ignore, qboolean down )
{
gltexture_t *tex = NULL;
gl_texture_t *tex = NULL;
// assure the initial node is not null
// we could check it here, but we would rather check it
@ -654,7 +654,7 @@ from underwater leaf (idea: XaeroX)
static void R_CheckFog( void )
{
cl_entity_t *ent;
gltexture_t *tex;
gl_texture_t *tex;
int i, cnt, count;
// quake global fog
@ -1164,7 +1164,7 @@ void R_DrawCubemapView( const vec3_t origin, const vec3_t angles, int size )
static int GL_RenderGetParm( int parm, int arg )
{
gltexture_t *glt;
gl_texture_t *glt;
switch( parm )
{
@ -1265,7 +1265,7 @@ static int GL_RenderGetParm( int parm, int arg )
static void R_GetDetailScaleForTexture( int texture, float *xScale, float *yScale )
{
gltexture_t *glt = R_GetTexture( texture );
gl_texture_t *glt = R_GetTexture( texture );
if( xScale ) *xScale = glt->xscale;
if( yScale ) *yScale = glt->yscale;
@ -1273,7 +1273,7 @@ static void R_GetDetailScaleForTexture( int texture, float *xScale, float *yScal
static void R_GetExtraParmsForTexture( int texture, byte *red, byte *green, byte *blue, byte *density )
{
gltexture_t *glt = R_GetTexture( texture );
gl_texture_t *glt = R_GetTexture( texture );
if( red ) *red = glt->fogParams[0];
if( green ) *green = glt->fogParams[1];
@ -1500,7 +1500,7 @@ static render_api_t gRenderAPI =
GL_TextureTarget,
GL_SetTexCoordArrayMode,
GL_GetProcAddress,
NULL,
GL_UpdateTexSize,
NULL,
NULL,
CL_DrawParticlesExternal,

View File

@ -19,15 +19,6 @@ GNU General Public License for more details.
#include "mod_local.h"
#include "shake.h"
typedef struct
{
const char *texname;
const char *detail;
const char material;
int lMin;
int lMax;
} dmaterial_t;
typedef struct
{
char texname[64]; // shortname
@ -37,188 +28,6 @@ typedef struct
dfilter_t *tex_filters[MAX_TEXTURES];
int num_texfilters;
// default rules for apply detail textures.
// maybe move this to external script?
static const dmaterial_t detail_table[] =
{
{ "crt", "dt_conc", 'C', 0, 0 }, // concrete
{ "rock", "dt_rock1", 'C', 0, 0 },
{ "conc", "dt_conc", 'C', 0, 0 },
{ "brick", "dt_brick", 'C', 0, 0 },
{ "wall", "dt_brick", 'C', 0, 0 },
{ "city", "dt_conc", 'C', 0, 0 },
{ "crete", "dt_conc", 'C', 0, 0 },
{ "generic", "dt_brick", 'C', 0, 0 },
{ "floor", "dt_conc", 'C', 0, 0 },
{ "metal", "dt_metal%i", 'M', 1, 2 }, // metal
{ "mtl", "dt_metal%i", 'M', 1, 2 },
{ "pipe", "dt_metal%i", 'M', 1, 2 },
{ "elev", "dt_metal%i", 'M', 1, 2 },
{ "sign", "dt_metal%i", 'M', 1, 2 },
{ "barrel", "dt_metal%i", 'M', 1, 2 },
{ "bath", "dt_ssteel1", 'M', 1, 2 },
{ "tech", "dt_ssteel1", 'M', 1, 2 },
{ "refbridge", "dt_metal%i", 'M', 1, 2 },
{ "panel", "dt_ssteel1", 'M', 0, 0 },
{ "brass", "dt_ssteel1", 'M', 0, 0 },
{ "rune", "dt_metal%i", 'M', 1, 2 },
{ "car", "dt_metal%i", 'M', 1, 2 },
{ "circuit", "dt_metal%i", 'M', 1, 2 },
{ "steel", "dt_ssteel1", 'M', 0, 0 },
{ "dirt", "dt_ground%i", 'D', 1, 5 }, // dirt
{ "drt", "dt_ground%i", 'D', 1, 5 },
{ "out", "dt_ground%i", 'D', 1, 5 },
{ "grass", "dt_grass1", 'D', 0, 0 },
{ "mud", "dt_carpet1", 'D', 0, 0 },
{ "vent", "dt_ssteel1", 'V', 1, 4 }, // vent
{ "duct", "dt_ssteel1", 'V', 1, 4 },
{ "tile", "dt_smooth%i", 'T', 1, 2 },
{ "labflr", "dt_smooth%i", 'T', 1, 2 },
{ "bath", "dt_smooth%i", 'T', 1, 2 },
{ "grate", "dt_stone%i", 'G', 1, 4 }, // vent
{ "stone", "dt_stone%i", 'G', 1, 4 },
{ "grt", "dt_stone%i", 'G', 1, 4 },
{ "wiz", "dt_wood%i", 'W', 1, 3 },
{ "wood", "dt_wood%i", 'W', 1, 3 },
{ "wizwood", "dt_wood%i", 'W', 1, 3 },
{ "wd", "dt_wood%i", 'W', 1, 3 },
{ "table", "dt_wood%i", 'W', 1, 3 },
{ "board", "dt_wood%i", 'W', 1, 3 },
{ "chair", "dt_wood%i", 'W', 1, 3 },
{ "brd", "dt_wood%i", 'W', 1, 3 },
{ "carp", "dt_carpet1", 'W', 1, 3 },
{ "book", "dt_wood%i", 'W', 1, 3 },
{ "box", "dt_wood%i", 'W', 1, 3 },
{ "cab", "dt_wood%i", 'W', 1, 3 },
{ "couch", "dt_wood%i", 'W', 1, 3 },
{ "crate", "dt_wood%i", 'W', 1, 3 },
{ "poster", "dt_plaster%i", 'W', 1, 2 },
{ "sheet", "dt_plaster%i", 'W', 1, 2 },
{ "stucco", "dt_plaster%i", 'W', 1, 2 },
{ "comp", "dt_smooth1", 'P', 0, 0 },
{ "cmp", "dt_smooth1", 'P', 0, 0 },
{ "elec", "dt_smooth1", 'P', 0, 0 },
{ "vend", "dt_smooth1", 'P', 0, 0 },
{ "monitor", "dt_smooth1", 'P', 0, 0 },
{ "phone", "dt_smooth1", 'P', 0, 0 },
{ "glass", "dt_ssteel1", 'Y', 0, 0 },
{ "window", "dt_ssteel1", 'Y', 0, 0 },
{ "flesh", "dt_rough1", 'F', 0, 0 },
{ "meat", "dt_rough1", 'F', 0, 0 },
{ "fls", "dt_rough1", 'F', 0, 0 },
{ "ground", "dt_ground%i", 'D', 1, 5 },
{ "gnd", "dt_ground%i", 'D', 1, 5 },
{ "snow", "dt_snow%i", 'O', 1, 2 }, // snow
{ "wswamp", "dt_smooth1", 'W', 0, 0 },
{ NULL, NULL, 0, 0, 0 }
};
static const char *R_DetailTextureForName( const char *name )
{
const dmaterial_t *table;
if( !name || !*name ) return NULL;
if( !Q_strnicmp( name, "sky", 3 ))
return NULL; // never details for sky
// never apply details for liquids
if( !Q_strnicmp( name + 1, "!lava", 5 ))
return NULL;
if( !Q_strnicmp( name + 1, "!slime", 6 ))
return NULL;
if( !Q_strnicmp( name, "!cur_90", 7 ))
return NULL;
if( !Q_strnicmp( name, "!cur_0", 6 ))
return NULL;
if( !Q_strnicmp( name, "!cur_270", 8 ))
return NULL;
if( !Q_strnicmp( name, "!cur_180", 8 ))
return NULL;
if( !Q_strnicmp( name, "!cur_up", 7 ))
return NULL;
if( !Q_strnicmp( name, "!cur_dwn", 8 ))
return NULL;
if( name[0] == '!' )
return NULL;
// never apply details to the special textures
if( !Q_strnicmp( name, "origin", 6 ))
return NULL;
if( !Q_strnicmp( name, "clip", 4 ))
return NULL;
if( !Q_strnicmp( name, "hint", 4 ))
return NULL;
if( !Q_strnicmp( name, "skip", 4 ))
return NULL;
if( !Q_strnicmp( name, "translucent", 11 ))
return NULL;
if( !Q_strnicmp( name, "3dsky", 5 )) // xash-mod support :-)
return NULL;
if( !Q_strnicmp( name, "scroll", 6 ))
return NULL;
if( name[0] == '@' )
return NULL;
// last check ...
if( !Q_strnicmp( name, "null", 4 ))
return NULL;
for( table = detail_table; table && table->texname; table++ )
{
if( Q_stristr( name, table->texname ))
{
if(( table->lMin + table->lMax ) > 0 )
return va( table->detail, COM_RandomLong( table->lMin, table->lMax ));
return table->detail;
}
}
return NULL;
}
void R_CreateDetailTexturesList( const char *filename )
{
file_t *detail_txt = NULL;
float xScale, yScale;
const char *detail_name;
texture_t *tex;
rgbdata_t *pic;
int i;
for( i = 0; i < cl.worldmodel->numtextures; i++ )
{
tex = cl.worldmodel->textures[i];
detail_name = R_DetailTextureForName( tex->name );
if( !detail_name ) continue;
// detailtexture detected
if( detail_name )
{
if( !detail_txt ) detail_txt = FS_Open( filename, "w", false );
if( !detail_txt )
{
MsgDev( D_ERROR, "Can't write %s\n", filename );
break;
}
pic = FS_LoadImage( va( "gfx/detail/%s", detail_name ), NULL, 0 );
if( pic )
{
xScale = (pic->width / (float)tex->width) * gl_detailscale->value;
yScale = (pic->height / (float)tex->height) * gl_detailscale->value;
FS_FreeImage( pic );
}
else xScale = yScale = 10.0f;
// store detailtexture description
FS_Printf( detail_txt, "%s detail/%s %.2f %.2f\n", tex->name, detail_name, xScale, yScale );
}
}
if( detail_txt ) FS_Close( detail_txt );
}
void R_ParseDetailTextures( const char *filename )
{
char *afile, *pfile;
@ -229,12 +38,6 @@ void R_ParseDetailTextures( const char *filename )
texture_t *tex;
int i;
if( r_detailtextures->value >= 2 && !FS_FileExists( filename, false ))
{
// use built-in generator for detail textures
R_CreateDetailTexturesList( filename );
}
afile = FS_LoadFile( filename, NULL, false );
if( !afile ) return;
@ -297,7 +100,7 @@ void R_ParseDetailTextures( const char *filename )
// texture is loaded
if( tex->dt_texturenum )
{
gltexture_t *glt;
gl_texture_t *glt;
glt = R_GetTexture( tex->gl_texturenum );
glt->xscale = xScale;
@ -451,7 +254,7 @@ void R_NewMap( void )
R_ClearDecals(); // clear all level decals
// upload detailtextures
if( r_detailtextures->value )
if( CVAR_TO_BOOL( r_detailtextures ))
{
string mapname, filepath;
@ -462,7 +265,7 @@ void R_NewMap( void )
R_ParseDetailTextures( filepath );
}
if( v_dark->value )
if( CVAR_TO_BOOL( v_dark ))
{
screenfade_t *sf = &clgame.fade;
float fadetime = 5.0f;
@ -505,7 +308,7 @@ void R_NewMap( void )
tx = cl.worldmodel->textures[i];
if( !Q_strncmp( tx->name, "sky", 3 ) && tx->width == 256 && tx->height == 128 )
if( !Q_strncmp( tx->name, "sky", 3 ) && tx->width == ( tx->height * 2 ))
tr.skytexturenum = i;
tx->texturechain = NULL;

View File

@ -275,7 +275,7 @@ void GL_BuildPolygonFromSurface( model_t *mod, msurface_t *fa )
float sample_size;
int vertpage;
texture_t *tex;
gltexture_t *glt;
gl_texture_t *glt;
float *vec;
float s, t;
glpoly_t *poly;
@ -645,7 +645,7 @@ static void LM_UploadBlock( qboolean dynamic )
r_lightmap.size = r_lightmap.width * r_lightmap.height * 4;
r_lightmap.flags = IMAGE_HAS_COLOR;
r_lightmap.buffer = gl_lms.lightmap_buffer;
tr.lightmapTextures[i] = GL_LoadTextureInternal( lmName, &r_lightmap, TF_FONT|TF_ATLAS_PAGE, false );
tr.lightmapTextures[i] = GL_LoadTextureInternal( lmName, &r_lightmap, TF_FONT|TF_ATLAS_PAGE );
if( ++gl_lms.current_lightmap_texture == MAX_LIGHTMAPS )
Host_Error( "AllocBlock: full\n" );
@ -734,7 +734,7 @@ void DrawGLPoly( glpoly_t *p, float xScale, float yScale )
if( p->flags & SURF_CONVEYOR )
{
gltexture_t *texture;
gl_texture_t *texture;
float flConveyorSpeed;
float flRate, flAngle;
@ -1005,7 +1005,7 @@ R_RenderDetails
*/
void R_RenderDetails( void )
{
gltexture_t *glt;
gl_texture_t *glt;
mextrasurf_t *es, *p;
msurface_t *fa;
int i;

View File

@ -400,7 +400,7 @@ void Mod_LoadMapSprite( model_t *mod, const void *buffer, size_t size, qboolean
pspriteframe->left = -( w >> 1 );
pspriteframe->down = ( h >> 1 ) - h;
pspriteframe->right = w + -( w >> 1 );
pspriteframe->gl_texturenum = GL_LoadTextureInternal( texname, &temp, TF_IMAGE, false );
pspriteframe->gl_texturenum = GL_LoadTextureInternal( texname, &temp, TF_IMAGE );
xl += w;
if( xl >= pix->width )

View File

@ -21,7 +21,7 @@ GNU General Public License for more details.
#define SKYCLOUDS_QUALITY 12
#define MAX_CLIP_VERTS 128 // skybox clip vertices
#define TURBSCALE ( 256.0f / ( M_PI2 ))
static const char* r_skyBoxSuffix[6] = { "rt", "bk", "lf", "ft", "up", "dn" };
const char* r_skyBoxSuffix[6] = { "rt", "bk", "lf", "ft", "up", "dn" };
static const int r_skyTexOrder[6] = { 0, 2, 1, 3, 4, 5 };
static const vec3_t skyclip[6] =
@ -711,7 +711,7 @@ void R_InitSkyClouds( mip_t *mt, texture_t *tx, qboolean custom_palette )
r_temp.palette = NULL;
// load it in
tr.solidskyTexture = GL_LoadTextureInternal( "solid_sky", &r_temp, TF_NOMIPMAP, false );
tr.solidskyTexture = GL_LoadTextureInternal( "solid_sky", &r_temp, TF_NOMIPMAP );
for( i = 0; i < r_sky->width >> 1; i++ )
{
@ -734,7 +734,7 @@ void R_InitSkyClouds( mip_t *mt, texture_t *tx, qboolean custom_palette )
r_temp.flags = IMAGE_HAS_COLOR|IMAGE_HAS_ALPHA;
// load it in
tr.alphaskyTexture = GL_LoadTextureInternal( "alpha_sky", &r_temp, TF_NOMIPMAP, false );
tr.alphaskyTexture = GL_LoadTextureInternal( "alpha_sky", &r_temp, TF_NOMIPMAP );
// clean up
FS_FreeImage( r_sky );

View File

@ -96,7 +96,7 @@ void VGUI_UploadTexture( int id, const char *buffer, int width, int height )
r_image.flags = IMAGE_HAS_COLOR|IMAGE_HAS_ALPHA;
r_image.buffer = (byte *)buffer;
g_textures[id] = GL_LoadTextureInternal( texName, &r_image, TF_IMAGE, false );
g_textures[id] = GL_LoadTextureInternal( texName, &r_image, TF_IMAGE );
}
/*

View File

@ -123,7 +123,7 @@ typedef enum
#include "crtlib.h"
#include "cvar.h"
#define XASH_VERSION 0.99f // engine current version
#define XASH_VERSION "0.99" // engine current version
// PERFORMANCE INFO
#define MIN_FPS 20.0 // host minimum fps value for maxfps.
@ -379,6 +379,7 @@ typedef struct host_parm_s
string finalmsg; // server shutdown final message
string downloadfile; // filename to be downloading
int downloadcount; // how many files remain to downloading
char deferred_cmd[128]; // deferred commands
host_redirect_t rd; // remote console
// command line parms
@ -503,7 +504,7 @@ NOTE: number at end of pixelformat name it's a total bitscount e.g. PF_RGB_24 ==
========================================================================
*/
#define ImageRAW( type ) (type == PF_RGBA_32 || type == PF_BGRA_32 || type == PF_RGB_24 || type == PF_BGR_24)
#define ImageDXT( type ) (type == PF_DXT1 || type == PF_DXT3 || type == PF_DXT5)
#define ImageDXT( type ) (type == PF_DXT1 || type == PF_DXT3 || type == PF_DXT5 || type == PF_ATI2)
typedef enum
{
@ -517,6 +518,7 @@ typedef enum
PF_DXT1, // s3tc DXT1 format
PF_DXT3, // s3tc DXT3 format
PF_DXT5, // s3tc DXT5 format
PF_ATI2, // latc ATI2N format
PF_TOTALCOUNT, // must be last
} pixformat_t;

View File

@ -2096,7 +2096,7 @@ void Con_DrawSolidConsole( int lines )
memcpy( color, g_color_table[7], sizeof( color ));
Q_snprintf( curbuild, MAX_STRING, "Xash3D %i/%g (hw build %i)", PROTOCOL_VERSION, XASH_VERSION, Q_buildnum( ));
Q_snprintf( curbuild, MAX_STRING, "Xash3D %i/%s (hw build %i)", PROTOCOL_VERSION, XASH_VERSION, Q_buildnum( ));
Con_DrawStringLen( curbuild, &stringLen, &charH );
start = glState.width - stringLen;
stringLen = Con_StringLength( curbuild );
@ -2246,8 +2246,8 @@ void Con_DrawVersion( void )
}
if( host.force_draw_version || draw_version )
Q_snprintf( curbuild, MAX_STRING, "Xash3D v%i/%g (build %i)", PROTOCOL_VERSION, XASH_VERSION, Q_buildnum( ));
else Q_snprintf( curbuild, MAX_STRING, "v%i/%g (build %i)", PROTOCOL_VERSION, XASH_VERSION, Q_buildnum( ));
Q_snprintf( curbuild, MAX_STRING, "Xash3D v%i/%s (build %i)", PROTOCOL_VERSION, XASH_VERSION, Q_buildnum( ));
else Q_snprintf( curbuild, MAX_STRING, "v%i/%s (build %i)", PROTOCOL_VERSION, XASH_VERSION, Q_buildnum( ));
Con_DrawStringLen( curbuild, &stringLen, &charH );
start = glState.width - stringLen * 1.05f;
stringLen = Con_StringLength( curbuild );
@ -2368,7 +2368,7 @@ void Con_VidInit( void )
{
qboolean draw_to_console = false;
int length = 0;
gltexture_t *chars;
gl_texture_t *chars;
// NOTE: only these games want to draw build number into console background
if( !Q_stricmp( FS_Gamedir(), "id1" ))

View File

@ -824,7 +824,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" );
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" );
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/%s (hw build %i)", PROTOCOL_VERSION, XASH_VERSION, Q_buildnum()), FCVAR_READ_ONLY, "shows an engine version" );
Mod_Init();
NET_Init();

View File

@ -117,6 +117,9 @@ void Image_DXTGetPixelFormat( dds_t *hdr )
case TYPE_DXT5:
image.type = PF_DXT5;
break;
case TYPE_ATI2:
image.type = PF_ATI2;
break;
default:
image.type = PF_UNKNOWN; // assume error
break;
@ -157,7 +160,8 @@ size_t Image_DXTGetLinearSize( int type, int width, int height, int depth )
{
case PF_DXT1: return ((( width + 3 ) / 4 ) * (( height + 3 ) / 4 ) * depth * 8 );
case PF_DXT3:
case PF_DXT5: return ((( width + 3 ) / 4 ) * (( height + 3 ) / 4 ) * depth * 16 );
case PF_DXT5:
case PF_ATI2: return ((( width + 3 ) / 4 ) * (( height + 3 ) / 4 ) * depth * 16 );
case PF_BGR_24:
case PF_RGB_24: return (width * height * depth * 3);
case PF_BGRA_32:
@ -214,7 +218,8 @@ uint Image_DXTCalcSize( const char *name, dds_t *hdr, size_t filesize )
if( filesize != buffsize ) // main check
{
MsgDev( D_WARN, "Image_LoadDDS: (%s) probably corrupted(%i should be %i)\n", name, buffsize, filesize );
return false;
if( buffsize > filesize )
return false;
}
return buffsize;
@ -274,7 +279,7 @@ qboolean Image_LoadDDS( const char *name, const byte *buffer, size_t filesize )
Image_DXTGetPixelFormat( &header ); // and image type too :)
Image_DXTAdjustVolume( &header );
if( !Image_CheckFlag( IL_DDS_HARDWARE ) && ( image.type == PF_DXT1 || image.type == PF_DXT3 || image.type == PF_DXT5 ))
if( !Image_CheckFlag( IL_DDS_HARDWARE ) && ImageDXT( image.type ))
return false; // silently rejected
if( image.type == PF_UNKNOWN )
@ -324,7 +329,7 @@ qboolean Image_LoadDDS( const char *name, const byte *buffer, size_t filesize )
// dds files will be uncompressed on a render. requires minimal of info for set this
image.rgba = Mem_Malloc( host.imagepool, image.size );
memcpy( image.rgba, fin, image.size );
image.flags |= IMAGE_DDS_FORMAT;
SetBits( image.flags, IMAGE_DDS_FORMAT );
return true;
}

View File

@ -93,6 +93,7 @@ const bpc_desc_t PFDesc[] =
{PF_DXT1, "DXT 1", 0x83F1, 4 },
{PF_DXT3, "DXT 3", 0x83F2, 4 },
{PF_DXT5, "DXT 5", 0x83F3, 4 },
{PF_ATI2, "ATI 2", 0x8837, 4 },
};
void Image_Reset( void )

View File

@ -69,6 +69,7 @@ GNU General Public License for more details.
#define NET_MAX_MESSAGE PAD_NUMBER(( NET_MAX_PAYLOAD + HEADER_BYTES ), 16 )
#define MASTERSERVER_ADR "ms.xash.su:27010"
#define MS_SCAN_REQUEST "1\xFF" "0.0.0.0:0\0"
#define PORT_MASTER 27010
#define PORT_CLIENT 27005
#define PORT_SERVER 27015

View File

@ -73,7 +73,7 @@ GNU General Public License for more details.
#define svc_director 51 // <variable sized>
#define svc_voiceinit 52 // <see code>
#define svc_voicedata 53 // [byte][short][...]
// reserved
#define svc_deltapacketbones 54 // [short][byte][...]
// reserved
#define svc_resourcelocation 56 // [string]
#define svc_querycvarvalue 57 // [string]

View File

@ -290,7 +290,7 @@ void Con_CreateConsole( void )
rect.top = 0;
rect.bottom = 364;
Q_strncpy( FontName, "Fixedsys", sizeof( FontName ));
Q_strncpy( s_wcd.title, va( "Xash3D %g", XASH_VERSION ), sizeof( s_wcd.title ));
Q_strncpy( s_wcd.title, va( "Xash3D %s", XASH_VERSION ), sizeof( s_wcd.title ));
Q_strncpy( s_wcd.log_path, "engine.log", sizeof( s_wcd.log_path ));
fontsize = 8;
}

View File

@ -1194,24 +1194,29 @@ pfnSetModel
*/
void pfnSetModel( edict_t *e, const char *m )
{
char name[MAX_QPATH];
model_t *mod;
int i;
if( !SV_IsValidEdict( e ))
return;
if( COM_CheckString( m ))
if( *m == '\\' || *m == '/' ) m++;
Q_strncpy( name, m, sizeof( name ));
COM_FixSlashes( name );
if( COM_CheckString( name ))
{
// check to see if model was properly precached
for( i = 1; i < MAX_MODELS && sv.model_precache[i][0]; i++ )
{
if( !Q_stricmp( sv.model_precache[i], m ))
if( !Q_stricmp( sv.model_precache[i], name ))
break;
}
if( i == MAX_MODELS )
{
Con_Printf( S_ERROR "no precache: %s\n", m );
Con_Printf( S_ERROR "no precache: %s\n", name );
return;
}
}
@ -1223,7 +1228,7 @@ void pfnSetModel( edict_t *e, const char *m )
return;
}
if( COM_CheckString( m ))
if( COM_CheckString( name ))
{
e->v.model = MAKE_STRING( sv.model_precache[i] );
e->v.modelindex = i;
@ -1250,18 +1255,23 @@ pfnModelIndex
*/
int pfnModelIndex( const char *m )
{
char name[MAX_QPATH];
int i;
if( !COM_CheckString( m ))
return 0;
if( *m == '\\' || *m == '/' ) m++;
Q_strncpy( name, m, sizeof( name ));
COM_FixSlashes( name );
for( i = 1; i < MAX_MODELS && sv.model_precache[i][0]; i++ )
{
if( !Q_stricmp( sv.model_precache[i], m ))
if( !Q_stricmp( sv.model_precache[i], name ))
return i;
}
Con_Printf( S_ERROR "no precache: %s\n", m );
Con_Printf( S_ERROR "no precache: %s\n", name );
return 0;
}

View File

@ -73,7 +73,7 @@ void Log_Open( void )
}
if( fp ) svs.log.file = fp;
Log_Printf( "Log file started (file \"%s\") (game \"%s\") (version \"%i/%.2f/%d\")\n",
Log_Printf( "Log file started (file \"%s\") (game \"%s\") (version \"%i/%s/%d\")\n",
szTestFile, Info_ValueForKey( SV_Serverinfo(), "*gamedir" ), PROTOCOL_VERSION, XASH_VERSION, Q_buildnum() );
}

View File

@ -739,7 +739,7 @@ void SV_AddToMaster( netadr_t from, sizebuf_t *msg )
Info_SetValueForKey( s, "os", "w", len ); // Windows
Info_SetValueForKey( s, "secure", "0", len ); // server anti-cheat
Info_SetValueForKey( s, "lan", "0", len ); // LAN servers doesn't send info to master
Info_SetValueForKey( s, "version", va( "%g", XASH_VERSION ), len ); // server region. 255 -- all regions
Info_SetValueForKey( s, "version", va( "%s", XASH_VERSION ), len ); // server region. 255 -- all regions
Info_SetValueForKey( s, "region", "255", len ); // server region. 255 -- all regions
Info_SetValueForKey( s, "product", GI->gamefolder, len ); // product? Where is the difference with gamedir?
@ -853,7 +853,7 @@ void SV_Init( void )
MSG_Init( &net_message, "NetMessage", net_message_buffer, sizeof( net_message_buffer ));
Q_snprintf( versionString, sizeof( versionString ), "%s: %.2f,%i,%i", "Xash3D", XASH_VERSION, PROTOCOL_VERSION, Q_buildnum() );
Q_snprintf( versionString, sizeof( versionString ), "%s: %s,%i,%i", "Xash3D", XASH_VERSION, PROTOCOL_VERSION, Q_buildnum() );
Cvar_FullSet( "sv_version", versionString, FCVAR_READ_ONLY );
SV_ClearGameState (); // delete all temporary *.hl files