13 Aug 2016

This commit is contained in:
g-cont 2016-08-13 00:00:00 +03:00 committed by Alibek Omarov
parent c4801700e3
commit f0da5370cf
39 changed files with 1052 additions and 5357 deletions

View File

@ -1,5 +1,20 @@
build 3366
Render: get support for custom DXT encoding (custom renderers only)
Render: remove image program stuff (just not used)
Engine: adding support for new wad filetypes (like DDS images) and wad imagetypes (normalmap, glossmap etc)
Render: implement tiling on the studiomodels
Client: do revision of predicting implementation, fix errors, more clean code
Client: implement prediction error to avoid ugly blinking view on moving platforms when predicting is enabled
Render: fixup the DDS loading code (invalid calc for mip-sizes)
Client: fixup parser of detailtextures when texturename contain symbol '{'
Render: added experimental hint for Nvidia drivers for force select Nvidia videocard when engine is running
Engine: rewrote condition to calculate level CRC (singleplayer or multiplayer)
Engine: added cvar r_wadtextures like in HL. First load textures from the wad, then from BSP
Server: fix bug with cl_updaterate variable (always get default values if not changed by user)
Server: recalc the ping time correctly
Server: fix bug with too long player name
GameUI: fix bug with 4-bit bmps buttons (image cutter)
build 3224

View File

@ -65,6 +65,7 @@ GNU General Public License for more details.
#define PARM_MAX_IMAGE_UNITS 29
#define PARM_CLIENT_ACTIVE 30
#define PARM_REBUILD_GAMMA 31 // if true lightmaps rebuilding for gamma change
#define PARM_DEDICATED_SERVER 32
enum
{
@ -257,6 +258,8 @@ typedef struct render_interface_s
qboolean (*R_DrawCubemapView)( const float *origin, const float *angles, int size );
// alloc or destroy studiomodel custom data
void (*Mod_ProcessUserData)( struct model_s *mod, qboolean create, const byte *buffer );
// alloc or destroy entity custom data
void (*R_ProcessEntData)( qboolean allocate );
} render_interface_t;
#endif//RENDER_API_H

View File

@ -395,6 +395,11 @@ void CL_ParseEvent( sizebuf_t *msg )
args.angles[PITCH] = -state->angles[PITCH] * 3;
args.angles[YAW] = state->angles[YAW];
args.angles[ROLL] = 0; // no roll
if( VectorIsNull( args.origin ))
VectorCopy( state->origin, args.origin );
if( VectorIsNull( args.velocity ))
VectorCopy( state->velocity, args.velocity );
}
}
else if( state )
@ -443,6 +448,13 @@ void CL_PlaybackEvent( int flags, const edict_t *pInvoker, word eventindex, floa
MsgDev( D_ERROR, "CL_PlaybackEvent: invalid eventindex %i\n", eventindex );
return;
}
if( flags & FEV_SERVER )
{
MsgDev( D_WARN, "CL_PlaybackEvent: event with FEV_SERVER flag!\n" );
return;
}
// check event for precached
if( !CL_EventIndex( cl.event_precache[eventindex] ))
{
@ -459,15 +471,17 @@ void CL_PlaybackEvent( int flags, const edict_t *pInvoker, word eventindex, floa
args.flags = 0;
args.entindex = invokerIndex;
// TODO: restore checks when predicting will be done
// if( !angles || VectorIsNull( angles ))
if( !angles || VectorIsNull( angles ))
VectorCopy( cl.refdef.cl_viewangles, args.angles );
else VectorCopy( angles, args.angles );
// if( !origin || VectorIsNull( origin ))
if( !origin || VectorIsNull( origin ))
VectorCopy( cl.frame.client.origin, args.origin );
else VectorCopy( origin, args.origin );
VectorCopy( cl.frame.client.velocity, args.velocity );
args.ducking = cl.frame.client.bInDuck;
args.ducking = (cl.frame.playerstate[cl.playernum].usehull == 1);
// args.ducking = cl.frame.client.bInDuck;
args.fparam1 = fparam1;
args.fparam2 = fparam2;

View File

@ -148,7 +148,7 @@ int CL_InterpolateModel( cl_entity_t *e )
if( t - t2 < 0.0f )
return 0;
if( t2 == 0.0f || VectorIsNull( ph1->origin ) && !VectorIsNull( ph0->origin ))
if( t2 == 0.0f || ( VectorIsNull( ph1->origin ) && !VectorIsNull( ph0->origin )))
{
VectorCopy( ph0->origin, e->origin );
VectorCopy( ph0->angles, e->angles );
@ -513,7 +513,12 @@ void CL_WeaponAnim( int iAnim, int body )
{
cl_entity_t *view = &clgame.viewent;
view->curstate.modelindex = cl.frame.client.viewmodel;
cl.weaponstarttime = 0;
cl.weaponsequence = iAnim;
if( Host_IsLocalClient() || cl_predict->value || !cl_lw->value )
view->curstate.modelindex = cl.frame.client.viewmodel;
else view->curstate.modelindex = cl.predicted_viewmodel;
// anim is changed. update latchedvars
if( iAnim != view->curstate.sequence )
@ -652,8 +657,16 @@ void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t
qboolean newent = (old) ? false : true;
qboolean result = true;
ent = CL_EDICT_NUM( newnum );
state = &cls.packet_entities[cls.next_client_entities % cls.num_client_entities];
if(( newnum < 0 ) || ( newnum >= clgame.maxEntities ))
{
if( !unchanged )
MSG_ReadDeltaEntity( msg, old, state, newnum, CL_IsPlayerIndex( newnum ), cl.mtime[0] );
return;
}
ent = CL_EDICT_NUM( newnum );
ent->index = newnum;
if( newent ) old = &ent->baseline;
@ -663,7 +676,21 @@ void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t
if( !result )
{
if( newent ) Host_Error( "Cl_DeltaEntity: tried to release new entity\n" );
if( newent )
{
MsgDev( D_WARN, "Cl_DeltaEntity: tried to release new entity\n" );
// perform remove, entity was created and removed between packets
if( state->number == -1 )
{
MsgDev( D_NOTE, "Entity %i was removed from server\n", newnum );
ent->curstate.messagenum = 0;
ent->baseline.number = 0;
}
else MsgDev( D_NOTE, "Entity %i was removed from delta-message\n", newnum );
return;
}
CL_KillDeadBeams( ent ); // release dead beams
#if 0
@ -788,13 +815,16 @@ void CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
if( subtracted == 0 )
{
Host_Error( "CL_DeltaPacketEntities: update too old, connection dropped.\n" );
MsgDev( D_NOTE, "CL_DeltaPacketEntities: update too old (flush)\n" );
Con_NPrintf( 2, "^3Warning:^1 update too old\n^7\n" );
CL_FlushEntityPacket( msg );
return;
}
if( subtracted >= CL_UPDATE_MASK )
{
// we can't use this, it is too old
MsgDev( D_NOTE, "CL_ParsePacketEntities: delta frame is too old: overflow (flush)\n");
Con_NPrintf( 2, "^3Warning:^1 delta frame is too old^7\n" );
CL_FlushEntityPacket( msg );
return;
@ -804,6 +834,7 @@ void CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
if(( cls.next_client_entities - oldframe->first_entity ) > ( cls.num_client_entities - 128 ))
{
MsgDev( D_NOTE, "CL_ParsePacketEntities: delta frame is too old (flush)\n");
Con_NPrintf( 2, "^3Warning:^1 delta frame is too old^7\n" );
CL_FlushEntityPacket( msg );
return;

View File

@ -30,6 +30,7 @@ GNU General Public License for more details.
#include "vgui_draw.h"
#include "sound.h" // SND_STOP_LOOPING
#define MAX_LINELENGTH 80
#define MAX_TEXTCHANNELS 8 // must be power of two (GoldSrc uses 4 channels)
#define TEXT_MSGNAME "TextMessage%i"
@ -573,7 +574,7 @@ void CL_DrawCenterPrint( void )
char *pText;
int i, j, x, y;
int width, lineLength;
byte *colorDefault, line[80];
byte *colorDefault, line[MAX_LINELENGTH];
int charWidth, charHeight;
if( !clgame.centerPrint.time )
@ -596,7 +597,7 @@ void CL_DrawCenterPrint( void )
lineLength = 0;
width = 0;
while( *pText && *pText != '\n' )
while( *pText && *pText != '\n' && lineLength < MAX_LINELENGTH )
{
byte c = *pText;
line[lineLength] = c;
@ -606,6 +607,9 @@ void CL_DrawCenterPrint( void )
pText++;
}
if( lineLength == MAX_LINELENGTH )
lineLength--;
pText++; // Skip LineFeed
line[lineLength] = 0;
@ -1084,6 +1088,8 @@ void CL_InitEdicts( void )
{
ASSERT( clgame.entities == NULL );
if( !clgame.mempool ) return; // Host_Error without client
CL_UPDATE_BACKUP = ( cl.maxclients == 1 ) ? SINGLEPLAYER_BACKUP : MULTIPLAYER_BACKUP;
cls.num_client_entities = CL_UPDATE_BACKUP * 64;
cls.packet_entities = Z_Realloc( cls.packet_entities, sizeof( entity_state_t ) * cls.num_client_entities );
@ -1097,10 +1103,22 @@ void CL_InitEdicts( void )
clgame.maxRemapInfos = clgame.maxEntities + 1;
clgame.remap_info = (remap_info_t **)Mem_Alloc( clgame.mempool, sizeof( remap_info_t* ) * clgame.maxRemapInfos );
}
if( clgame.drawFuncs.R_ProcessEntData != NULL )
{
// let the client.dll free custom data
clgame.drawFuncs.R_ProcessEntData( true );
}
}
void CL_FreeEdicts( void )
{
if( clgame.drawFuncs.R_ProcessEntData != NULL )
{
// let the client.dll free custom data
clgame.drawFuncs.R_ProcessEntData( false );
}
if( clgame.entities )
Mem_Free( clgame.entities );
clgame.entities = NULL;
@ -2098,7 +2116,7 @@ static void pfnHookEvent( const char *filename, pfnEventHook pfn )
if( !Q_stricmp( name, ev->name ) && ev->func != NULL )
{
MsgDev( D_WARN, "CL_HookEvent: %s already hooked!\n" );
MsgDev( D_WARN, "CL_HookEvent: %s already hooked!\n", name );
return;
}
}
@ -2808,7 +2826,11 @@ TODO: implement
*/
int pfnDrawString( int x, int y, const char *str, int r, int g, int b )
{
return 0;
// draw the string until we hit the null character or a newline character
for( ; *str != 0 && *str != '\n'; str++ )
x += pfnDrawCharacter( x, y, (byte)*str, r, g, b );
return x;
}
/*
@ -2820,7 +2842,14 @@ TODO: implement
*/
int pfnDrawStringReverse( int x, int y, const char *str, int r, int g, int b )
{
return 0;
char *szIt;
// find the end of the string
for( szIt = (char *)str; *szIt != 0; szIt++ )
x -= clgame.scrInfo.charWidths[(byte)*szIt];
pfnDrawString( x, y, str, r, g, b );
return x;
}
/*
@ -2951,7 +2980,7 @@ pfnGetAppID
*/
int pfnGetAppID( void )
{
return 220; // standard Valve value
return 130; // borrowed from SDLash3D
}
/*
@ -4074,7 +4103,7 @@ qboolean CL_LoadProgs( const char *name )
}
Cvar_Get( "cl_nopred", "1", CVAR_ARCHIVE|CVAR_USERINFO, "disable client movement predicting" );
Cvar_Get( "cl_lw", "0", CVAR_ARCHIVE|CVAR_USERINFO, "enable client weapon predicting" );
cl_lw = Cvar_Get( "cl_lw", "0", CVAR_ARCHIVE|CVAR_USERINFO, "enable client weapon predicting" );
Cvar_Get( "cl_lc", "0", CVAR_ARCHIVE|CVAR_USERINFO, "enable lag compensation" );
Cvar_FullSet( "host_clientloaded", "1", CVAR_INIT );
@ -4086,13 +4115,12 @@ qboolean CL_LoadProgs( const char *name )
CL_InitParticles ();
CL_InitViewBeams ();
CL_InitTempEnts ();
CL_InitEdicts (); // initailize local player and world
CL_InitClientMove(); // initialize pm_shared
if( !R_InitRenderAPI()) // Xash3D extension
{
MsgDev( D_WARN, "CL_LoadProgs: couldn't get render API\n" );
}
CL_InitEdicts (); // initailize local player and world
CL_InitClientMove(); // initialize pm_shared
// initialize game
clgame.dllFuncs.pfnInit();

View File

@ -45,6 +45,7 @@ convar_t *cl_solid_players;
convar_t *cl_draw_beams;
convar_t *cl_cmdrate;
convar_t *cl_interp;
convar_t *cl_lw;
//
// userinfo
@ -311,14 +312,20 @@ void CL_CreateCmd( void )
VectorCopy( cl.frame.client.origin, cl.data.origin );
VectorCopy( cl.refdef.cl_viewangles, cl.data.viewangles );
cl.data.iWeaponBits = cl.frame.client.weapons;
cl.data.fov = cl.frame.client.fov;
if( cl.scr_fov < 1.0f || cl.scr_fov > 179.0f )
cl.scr_fov = 90.0f; // reset to default
cl.data.fov = cl.scr_fov;
clgame.dllFuncs.pfnUpdateClientData( &cl.data, cl.time );
// grab changes
VectorCopy( cl.data.viewangles, cl.refdef.cl_viewangles );
cl.frame.client.weapons = cl.data.iWeaponBits;
cl.frame.client.fov = cl.data.fov;
cl.scr_fov = cl.data.fov;
if( cl.scr_fov < 1.0f || cl.scr_fov > 179.0f )
cl.scr_fov = 90.0f; // reset to default
// allways dump the first ten messages,
// because it may contain leftover inputs
@ -430,6 +437,7 @@ void CL_WritePacket( void )
Cvar_SetFloat( "cl_cmdrate", MIN_CMD_RATE );
}
#endif
Q_memset( data, 0, MAX_CMD_BUFFER );
BF_Init( &buf, "ClientData", data, sizeof( data ));
// Determine number of backup commands to send along
@ -814,6 +822,7 @@ void CL_ClearState( void )
Cvar_FullSet( "cl_background", "0", CVAR_READ_ONLY );
cl.refdef.movevars = &clgame.movevars;
cl.maxclients = 1; // allow to drawing player in menu
cl.scr_fov = 90.0f;
Cvar_SetFloat( "scr_download", 0.0f );
Cvar_SetFloat( "scr_loading", 0.0f );

View File

@ -285,6 +285,9 @@ void CL_ParseSoundPacket( sizebuf_t *msg, qboolean is_ambient )
}
else handle = cl.sound_index[sound]; // see precached sound
if( !cl.audio_prepped )
return; // too early
if( is_ambient )
{
S_AmbientSound( pos, entnum, handle, volume, attn, pitch, flags );

View File

@ -550,9 +550,10 @@ static const char *pfnTraceTexture( int ground, float *vstart, float *vend )
static void pfnPlaySound( int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch )
{
sound_t snd = S_RegisterSound( sample );
if( !clgame.pmove->runfuncs )
return;
S_StartSound( NULL, clgame.pmove->player_index + 1, channel, snd, volume, attenuation, pitch, fFlags );
S_StartSound( NULL, clgame.pmove->player_index + 1, channel, S_RegisterSound( sample ), volume, attenuation, pitch, fFlags );
}
static void pfnPlaybackEventFull( int flags, int clientindex, word eventindex, float delay, float *origin,
@ -1007,5 +1008,11 @@ void CL_PredictMovement( void )
VectorCopy( to->client.velocity, cl.predicted_velocity );
VectorCopy( to->client.view_ofs, cl.predicted_viewofs );
VectorCopy( to->client.punchangle, cl.predicted_punchangle );
cl.predicted_viewmodel = to->client.viewmodel;
cl.scr_fov = to->client.fov;
if( cl.scr_fov < 1.0f || cl.scr_fov > 179.0f )
cl.scr_fov = 90.0f;
}
}

View File

@ -442,6 +442,9 @@ void CL_FizzEffect( cl_entity_t *pent, int modelIndex, int density )
if( !pent || Mod_GetType( modelIndex ) == mod_bad )
return;
if( pent->curstate.modelindex <= 0 )
return;
count = density + 1;
density = count * 3 + 6;

View File

@ -81,8 +81,11 @@ void V_SetupRefDef( void )
cl.refdef.viewport[0] = (scr_width->integer - cl.refdef.viewport[2]) / 2;
cl.refdef.viewport[1] = (scr_height->integer - sb_lines - cl.refdef.viewport[3]) / 2;
if( cl.scr_fov < 1.0f || cl.scr_fov > 179.0f )
cl.scr_fov = 90.0f;
// calc FOV
cl.refdef.fov_x = cl.data.fov; // this is a final fov value
cl.refdef.fov_x = cl.scr_fov; // this is a final fov value
cl.refdef.fov_y = V_CalcFov( &cl.refdef.fov_x, cl.refdef.viewport[2], cl.refdef.viewport[3] );
// adjust FOV for widescreen

View File

@ -163,6 +163,12 @@ typedef struct
cl_entity_t *world;
model_t *worldmodel; // pointer to world
// weapon predict stuff
float scr_fov;
int predicted_viewmodel;
float weaponstarttime;
int weaponsequence;
} client_t;
/*
@ -528,6 +534,7 @@ extern convar_t *cl_lightstyle_lerping;
extern convar_t *cl_draw_particles;
extern convar_t *cl_levelshot_name;
extern convar_t *cl_draw_beams;
extern convar_t *cl_lw; // local weapons
extern convar_t *scr_centertime;
extern convar_t *scr_viewsize;
extern convar_t *scr_download;

View File

@ -649,7 +649,7 @@ void R_ShowTextures( void )
if( showHelp )
{
CL_CenterPrint( "use '<-' and '->' keys for view all the textures", 0.25f );
CL_CenterPrint( "use '<-' and '->' keys to view all the textures", 0.25f );
showHelp = false;
}

View File

@ -2166,7 +2166,7 @@ void CL_ReadLineFile_f( void )
if( token[0] != '-' )
{
MsgDev( D_ERROR, "%s is corrupted\n" );
MsgDev( D_ERROR, "%s is corrupted\n", filename );
break;
}

View File

@ -210,7 +210,7 @@ void GL_TexFilter( gltexture_t *tex, qboolean update )
if( tex->flags & ( TF_BORDER|TF_ALPHA_BORDER ) && !GL_Support( GL_CLAMP_TEXBORDER_EXT ))
{
// border is not support, use clamp instead
tex->flags &= ~(TF_BORDER||TF_ALPHA_BORDER);
tex->flags &= ~(TF_BORDER|TF_ALPHA_BORDER);
tex->flags |= TF_CLAMP;
}
@ -1777,7 +1777,7 @@ void GL_FreeImage( const char *name )
if( Q_strlen( name ) >= sizeof( r_textures->name ))
{
MsgDev( D_ERROR, "GL_FreeImage: too long name %s\n", name, sizeof( r_textures->name ));
MsgDev( D_ERROR, "GL_FreeImage: too long name %s\n", name );
return;
}

View File

@ -672,7 +672,6 @@ extern convar_t *r_fastsky;
extern convar_t *vid_displayfrequency;
extern convar_t *vid_fullscreen;
extern convar_t *vid_gamma;
extern convar_t *vid_texgamma;
extern convar_t *vid_mode;
#endif//GL_LOCAL_H

View File

@ -1248,7 +1248,7 @@ void R_BeginFrame( qboolean clearScene )
else
{
glConfig.softwareGammaUpdate = true;
BuildGammaTable( vid_gamma->value, vid_texgamma->value );
BuildGammaTable( vid_gamma->value, GAMMA );
GL_RebuildLightmaps();
glConfig.softwareGammaUpdate = false;
}
@ -1466,6 +1466,8 @@ static int GL_RenderGetParm( int parm, int arg )
return (cls.state == ca_active);
case PARM_REBUILD_GAMMA:
return glConfig.softwareGammaUpdate;
case PARM_DEDICATED_SERVER:
return (host.type == HOST_DEDICATED);
}
return 0;
}

View File

@ -716,6 +716,8 @@ void DrawGLPoly( glpoly_t *p, float xScale, float yScale )
cl_entity_t *e = RI.currententity;
int i, hasScale = false;
if( !p ) return;
// special hack for non-lightmapped surfaces
if( p->flags & SURF_DRAWTILED )
GL_ResetFogColor();

View File

@ -138,7 +138,7 @@ R_StudioInit
*/
void R_StudioInit( void )
{
float pixelAspect;
float pixelAspect, fov_x = 90.0f, fov_y;
r_studio_lambert = Cvar_Get( "r_studio_lambert", "2", CVAR_ARCHIVE, "bonelighting lambert value" );
r_studio_lerping = Cvar_Get( "r_studio_lerping", "1", CVAR_ARCHIVE, "enables studio animation lerping" );
@ -156,7 +156,8 @@ void R_StudioInit( void )
pixelAspect *= (320.0f / 240.0f);
else pixelAspect *= (640.0f / 480.0f);
aliasXscale = (float)scr_width->integer / RI.refdef.fov_y;
fov_y = V_CalcFov( &fov_x, scr_width->integer, scr_height->integer );
aliasXscale = (float)scr_width->integer / fov_y; // stub
aliasYscale = aliasXscale * pixelAspect;
Matrix3x4_LoadIdentity( g_aliastransform );
@ -736,7 +737,7 @@ StudioCalcBoneAdj
void R_StudioCalcBoneAdj( float dadt, float *adj, const byte *pcontroller1, const byte *pcontroller2, byte mouthopen )
{
mstudiobonecontroller_t *pbonecontroller;
float value;
float value = 0.0f;
int i, j;
pbonecontroller = (mstudiobonecontroller_t *)((byte *)m_pStudioHeader + m_pStudioHeader->bonecontrollerindex);
@ -2948,7 +2949,7 @@ R_StudioDrawPlayer
static int R_StudioDrawPlayer( int flags, entity_state_t *pplayer )
{
int m_nPlayerIndex;
float gaitframe, gaityaw;
float gaitframe = 0.0f, gaityaw = 0.0f;
vec3_t dir, prevgaitorigin;
alight_t lighting;
@ -3301,10 +3302,17 @@ void R_RunViewmodelEvents( void )
if( !Mod_Extradata( clgame.viewent.model ))
return;
if( cl_lw->value && cl.frame.client.viewmodel != cl.predicted_viewmodel )
return;
RI.currententity = &clgame.viewent;
RI.currentmodel = RI.currententity->model;
if( !RI.currentmodel ) return;
if( !cl.weaponstarttime ) cl.weaponstarttime = cl.time;
RI.currententity->curstate.animtime = cl.weaponstarttime;
RI.currententity->curstate.sequence = cl.weaponsequence;
pStudioDraw->StudioDrawModel( STUDIO_EVENTS );
RI.currententity = NULL;
@ -3331,6 +3339,9 @@ void R_DrawViewModel( void )
if( !Mod_Extradata( clgame.viewent.model ))
return;
if( cl_lw->value && cl.frame.client.viewmodel != cl.predicted_viewmodel )
return;
RI.currententity = &clgame.viewent;
RI.currentmodel = RI.currententity->model;
if( !RI.currentmodel ) return;
@ -3344,6 +3355,10 @@ void R_DrawViewModel( void )
if( r_lefthand->integer == 1 || g_iBackFaceCull )
GL_FrontFace( !glState.frontFace );
if( !cl.weaponstarttime ) cl.weaponstarttime = cl.time;
RI.currententity->curstate.animtime = cl.weaponstarttime;
RI.currententity->curstate.sequence = cl.weaponsequence;
pStudioDraw->StudioDrawModel( STUDIO_RENDER );
// restore depth range

View File

@ -90,7 +90,6 @@ convar_t *r_fastsky;
convar_t *vid_displayfrequency;
convar_t *vid_fullscreen;
convar_t *vid_gamma;
convar_t *vid_texgamma;
convar_t *vid_mode;
byte *r_temppool;
@ -882,7 +881,7 @@ void VID_StartupGamma( void )
if( gl_ignorehwgamma->integer )
{
glConfig.deviceSupportsGamma = false; // even if supported!
BuildGammaTable( vid_gamma->value, vid_texgamma->value );
BuildGammaTable( vid_gamma->value, GAMMA );
MsgDev( D_NOTE, "VID_StartupGamma: software gamma initialized\n" );
return;
}
@ -1599,7 +1598,7 @@ void R_RenderInfo_f( void )
}
Msg( "\n" );
Msg( "MODE: %i, %i x %i %s\n", vid_mode->integer, r_width->integer, r_height->integer );
Msg( "MODE: %i, %i x %i %s\n", vid_mode->integer, r_width->integer, r_height->integer, vidmode[vid_mode->integer].desc );
Msg( "GAMMA: %s\n", (glConfig.deviceSupportsGamma) ? "hardware" : "software" );
Msg( "\n" );
Msg( "PICMIP: %i\n", gl_picmip->integer );
@ -1680,7 +1679,6 @@ void GL_InitCommands( void )
gl_swapInterval->modified = true;
vid_gamma = Cvar_Get( "gamma", "1.0", CVAR_ARCHIVE, "gamma amount" );
vid_texgamma = Cvar_Get( "texgamma", "2.2", CVAR_GLCONFIG, "texgamma amount (default Half-Life artwork gamma)" );
vid_mode = Cvar_Get( "vid_mode", VID_AUTOMODE, CVAR_RENDERINFO, "display resolution mode" );
vid_fullscreen = Cvar_Get( "fullscreen", "0", CVAR_RENDERINFO, "set in 1 to enable fullscreen mode" );
vid_displayfrequency = Cvar_Get ( "vid_displayfrequency", "0", CVAR_RENDERINFO, "fullscreen refresh rate" );

View File

@ -127,6 +127,8 @@ void DrawSkyPolygon( int nump, vec3_t vecs )
j = vec_to_st[axis][2];
dv = (j > 0) ? vecs[j-1] : -vecs[-j-1];
if( dv == 0.0f ) continue;
j = vec_to_st[axis][0];
s = (j < 0) ? -vecs[-j-1] / dv : vecs[j-1] / dv;
@ -502,7 +504,7 @@ void R_InitSky( mip_t *mt, texture_t *tx )
}
// make sure what sky image is valid
if( !r_sky || !r_sky->palette || r_sky->type != PF_INDEXED_32 )
if( !r_sky || !r_sky->palette || r_sky->type != PF_INDEXED_32 || r_sky->height == 0 )
{
MsgDev( D_ERROR, "R_InitSky: unable to load sky texture %s\n", tx->name );
FS_FreeImage( r_sky );

File diff suppressed because it is too large Load Diff

View File

@ -51,7 +51,6 @@ convar_t *snd_gain_max;
convar_t *snd_gain_min;
convar_t *s_refdist;
convar_t *s_refdb;
convar_t *dsp_off; // set to 1 to disable all dsp processing
convar_t *s_cull; // cull sounds by geometry
convar_t *s_test; // cvar for testing new effects
convar_t *s_phs;
@ -357,8 +356,7 @@ channel_t *SND_PickStaticChannel( int entnum, sfx_t *sfx, const vec3_t pos )
{
channel_t *ch = NULL;
int i, dupe = 0;
#if 1
#if 0
// TODO: remove this code when predicting is will be done
// check for duplicate sounds
for( i = 0; i < total_channels; i++ )
@ -1609,7 +1607,7 @@ void S_RenderFrame( ref_params_t *fd )
else VectorSet( info.color, 1.0f, 1.0f, 1.0f );
info.index = 0;
Con_NXPrintf( &info, "----(%i)---- painted: %i\n", total - 1, paintedtime );
Con_NXPrintf( &info, "room_type: %i ----(%i)---- painted: %i\n", idsp_room, total - 1, paintedtime );
}
S_StreamBackgroundTrack ();
@ -1773,7 +1771,6 @@ qboolean S_Init( void )
s_mixahead = Cvar_Get( "_snd_mixahead", "0.12", 0, "how much sound to mix ahead of time" );
s_show = Cvar_Get( "s_show", "0", CVAR_ARCHIVE, "show playing sounds" );
s_lerping = Cvar_Get( "s_lerping", "0", CVAR_ARCHIVE, "apply interpolation to sound output" );
dsp_off = Cvar_Get( "dsp_off", "0", CVAR_ARCHIVE, "set to 1 to disable all dsp processing" );
s_ambient_level = Cvar_Get( "ambient_level", "0.3", 0, "volume of environment noises (water and wind)" );
s_ambient_fade = Cvar_Get( "ambient_fade", "100", 0, "rate of volume fading when client is moving" );
s_combine_sounds = Cvar_Get( "s_combine_channels", "1", CVAR_ARCHIVE, "combine channels with same sounds" );

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 )
{
// do not touch this! Only author of Xash3D can increase buildnumbers!
#if 0
#if 1
int m = 0, d = 0, y = 0;
static int b = 0;
@ -48,6 +48,6 @@ int Q_buildnum( void )
return b;
#else
return 3366;
return 3387;
#endif
}

View File

@ -17,8 +17,8 @@ GNU General Public License for more details.
#include "client.h"
#include "server.h"
#define MAX_CMD_BUFFER 16384
#define MAX_CMD_LINE 1024
#define MAX_CMD_BUFFER 32768
#define MAX_CMD_LINE 2048
typedef struct
{

View File

@ -39,6 +39,8 @@ extern "C" {
#define MAX_MODS 512 // environment games that engine can keep visible
#define EXPORT __declspec( dllexport )
#define BIT( n ) (1<<( n ))
#define GAMMA ( 2.2 ) // Valve Software gamma
#define INVGAMMA ( 1.0 / 2.2 ) // back to 1.0
#ifndef __cplusplus
#define NULL ((void *)0)
@ -901,6 +903,8 @@ void S_StopAllSounds( void );
void BuildGammaTable( float gamma, float texGamma );
byte TextureToTexGamma( byte b );
byte TextureToGamma( byte b );
float TextureToLinear( int c );
int LinearToTexture( float f );
#ifdef __cplusplus
}

View File

@ -3057,11 +3057,17 @@ char W_HintFromSuf( const char *lumpname )
{
char barename[64];
char suffix[8];
size_t namelen;
const wadtype_t *hint;
// trying to extract hint from the name
FS_FileBase( lumpname, barename );
Q_strncpy( suffix, barename + Q_strlen( barename ) - HINT_NAMELEN, sizeof( suffix ));
namelen = Q_strlen( barename );
if( namelen <= HINT_NAMELEN )
return IMG_DIFFUSE;
Q_strncpy( suffix, barename + namelen - HINT_NAMELEN, sizeof( suffix ));
// we not known about filetype, so match only by filename
for( hint = wad_hints; hint->ext; hint++ )
@ -3079,6 +3085,7 @@ static dlumpinfo_t *W_FindLump( wfile_t *wad, const char *name, const char match
char img_type = IMG_DIFFUSE;
char barename[64], suffix[8];
int left, right;
size_t namelen;
const wadtype_t *hint;
if( !wad || !wad->lumps || matchtype == TYP_NONE )
@ -3086,20 +3093,25 @@ static dlumpinfo_t *W_FindLump( wfile_t *wad, const char *name, const char match
// trying to extract hint from the name
FS_FileBase( name, barename );
Q_strncpy( suffix, barename + Q_strlen( barename ) - HINT_NAMELEN, sizeof( suffix ));
namelen = Q_strlen( barename );
// we not known about filetype, so match only by filename
for( hint = wad_hints; hint->ext; hint++ )
if( namelen > HINT_NAMELEN )
{
if( !Q_stricmp( suffix, hint->ext ))
{
img_type = hint->type;
break;
}
}
Q_strncpy( suffix, barename + namelen - HINT_NAMELEN, sizeof( suffix ));
if( img_type != IMG_DIFFUSE )
barename[Q_strlen( barename ) - HINT_NAMELEN] = '\0'; // kill the suffix
// we not known about filetype, so match only by filename
for( hint = wad_hints; hint->ext; hint++ )
{
if( !Q_stricmp( suffix, hint->ext ))
{
img_type = hint->type;
break;
}
}
if( img_type != IMG_DIFFUSE )
barename[namelen - HINT_NAMELEN] = '\0'; // kill the suffix
}
// look for the file (binary search)
left = 0;

View File

@ -22,6 +22,8 @@ GNU General Public License for more details.
//-----------------------------------------------------------------------------
static byte gammatable[256];
static byte texgammatable[256]; // palette is sent through this to convert to screen gamma
static float texturetolinear[256]; // texture (0..255) to linear (0..1)
static int lineartotexture[1024]; // linear (0..1) to texture (0..255)
void BuildGammaTable( float gamma, float texGamma )
{
@ -47,6 +49,18 @@ void BuildGammaTable( float gamma, float texGamma )
inf = (int)(f + 0.5f);
gammatable[i] = bound( 0, inf, 255 );
}
for( i = 0; i < 256; i++ )
{
// convert from nonlinear texture space (0..255) to linear space (0..1)
texturetolinear[i] = pow( i / 255.0, GAMMA );
}
for( i = 0; i < 1024; i++ )
{
// convert from linear space (0..1) to nonlinear texture space (0..255)
lineartotexture[i] = pow( i / 1023.0, INVGAMMA ) * 255;
}
}
byte TextureToTexGamma( byte b )
@ -65,4 +79,10 @@ byte TextureToGamma( byte b )
b = bound( 0, b, 255 );
return gammatable[b];
}
}
// convert texture to linear 0..1 value
float TextureToLinear( int c ) { return texturetolinear[bound( 0, c, 255 )]; }
// convert texture to linear 0..1 value
int LinearToTexture( float f ) { return lineartotexture[bound( 0, (int)(f * 1023), 1023 )]; }

View File

@ -14,6 +14,7 @@ GNU General Public License for more details.
*/
#include "imagelib.h"
#include "mathlib.h"
/*
=============
@ -26,6 +27,7 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, size_t filesize )
byte palette[256][4];
int i, columns, column, rows, row, bpp = 1;
int cbPalBytes = 0, padSize = 0, bps = 0;
int reflectivity[3] = { 0, 0, 0 };
qboolean load_qfont = false;
bmp_t bhdr;
@ -280,12 +282,18 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, size_t filesize )
Mem_Free( image.rgba );
return false;
}
if( !Image_CheckFlag( IL_KEEP_8BIT ) && ( red != green || green != blue ))
image.flags |= IMAGE_HAS_COLOR;
reflectivity[0] += red;
reflectivity[1] += green;
reflectivity[2] += blue;
}
buf_p += padSize; // actual only for 4-bit bmps
}
VectorDivide( reflectivity, ( image.width * image.height ), image.fogParams );
if( image.palette ) Image_GetPaletteBMP( image.palette );
return true;

View File

@ -175,7 +175,7 @@ size_t Image_DXTCalcMipmapSize( dds_t *hdr )
int i, width, height;
// now correct buffer size
for( i = 0; i < hdr->dwMipMapCount; i++ )
for( i = 0; i < max( 1, ( hdr->dwMipMapCount )); i++ )
{
width = max( 1, ( hdr->dwWidth >> i ));
height = max( 1, ( hdr->dwHeight >> i ));
@ -313,6 +313,15 @@ qboolean Image_LoadDDS( const char *name, const byte *buffer, size_t filesize )
break;
}
if( header.dwReserved1[1] != 0 )
{
// store texture reflectivity
image.fogParams[0] = ((header.dwReserved1[1] & 0x000000FF) >> 0 );
image.fogParams[1] = ((header.dwReserved1[1] & 0x0000FF00) >> 8 );
image.fogParams[2] = ((header.dwReserved1[1] & 0x00FF0000) >> 16);
image.fogParams[3] = ((header.dwReserved1[1] & 0xFF000000) >> 24);
}
// dds files will be uncompressed on a render. requires minimal of info for set this
image.rgba = Mem_Alloc( host.imagepool, image.size );
Q_memcpy( image.rgba, fin, image.size );

View File

@ -14,6 +14,7 @@ GNU General Public License for more details.
*/
#include "imagelib.h"
#include "mathlib.h"
/*
=============
@ -26,6 +27,7 @@ qboolean Image_LoadTGA( const char *name, const byte *buffer, size_t filesize )
byte *buf_p, *pixbuf, *targa_rgba;
byte palette[256][4], red = 0, green = 0, blue = 0, alpha = 0;
int readpixelcount, pixelcount;
int reflectivity[3] = { 0, 0, 0 };
qboolean compressed;
tga_t targa_header;
@ -193,6 +195,10 @@ qboolean Image_LoadTGA( const char *name, const byte *buffer, size_t filesize )
if( red != green || green != blue )
image.flags |= IMAGE_HAS_COLOR;
reflectivity[0] += red;
reflectivity[1] += green;
reflectivity[2] += blue;
*pixbuf++ = red;
*pixbuf++ = green;
*pixbuf++ = blue;
@ -206,6 +212,9 @@ qboolean Image_LoadTGA( const char *name, const byte *buffer, size_t filesize )
}
}
}
VectorDivide( reflectivity, ( image.width * image.height ), image.fogParams );
return true;
}

View File

@ -321,6 +321,7 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, size_t filesize )
byte *fin, *pal;
int ofs[4], rendermode;
int i, pixels, numcolors;
int reflectivity[3] = { 0, 0, 0 };
if( filesize < sizeof( mip ))
{
@ -462,6 +463,17 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, size_t filesize )
// calc the decal reflectivity
image.fogParams[3] = VectorAvg( image.fogParams );
}
else if( pal != NULL )// calc texture reflectivity
{
for( i = 0; i < 256; i++ )
{
reflectivity[0] += pal[i*3+0];
reflectivity[1] += pal[i*3+1];
reflectivity[2] += pal[i*3+2];
}
VectorDivide( reflectivity, 256, image.fogParams );
}
image.type = PF_INDEXED_32; // 32-bit palete
return Image_AddIndexedImageToPack( fin, image.width, image.height );

View File

@ -2210,6 +2210,7 @@ static void Mod_LoadEntities( const dlump_t *l )
char *pfile;
string keyname;
char token[2048];
char wadstring[2048];
// make sure what we really has terminator
loadmodel->entities = Mem_Alloc( loadmodel->mempool, l->filelen + 1 );
@ -2245,23 +2246,19 @@ static void Mod_LoadEntities( const dlump_t *l )
if( !Q_stricmp( keyname, "wad" ))
{
char *path = token;
string wadpath;
char *pszWadFile;
Q_strncpy( wadstring, token, 2046 );
wadstring[2046] = 0;
if( !Q_strchr( wadstring, ';' ))
Q_strcat( wadstring, ";" );
// parse wad pathes
while( path )
for (pszWadFile = strtok( wadstring, ";" ); pszWadFile!= NULL; pszWadFile = strtok( NULL, ";" ))
{
char *end = Q_strchr( path, ';' );
if( !end )
{
// if specified only once wad
if( !wadlist.count )
FS_FileBase( path, wadlist.wadnames[wadlist.count++] );
break;
}
Q_strncpy( wadpath, path, (end - path) + 1 );
FS_FileBase( wadpath, wadlist.wadnames[wadlist.count++] );
path += (end - path) + 1; // move pointer
COM_FixSlashes( pszWadFile );
FS_FileBase( pszWadFile, wadlist.wadnames[wadlist.count++] );
if( wadlist.count >= 256 ) break; // too many wads...
}
}

View File

@ -810,9 +810,9 @@ void Delta_Init( void )
Delta_AddField( "movevars_t", "footsteps", DT_INTEGER, 1, 1.0f, 1.0f );
Delta_AddField( "movevars_t", "rollangle", DT_FLOAT|DT_SIGNED, 16, 32.0f, 1.0f );
Delta_AddField( "movevars_t", "rollspeed", DT_FLOAT|DT_SIGNED, 16, 8.0f, 1.0f );
Delta_AddField( "movevars_t", "skycolor_r", DT_FLOAT|DT_SIGNED, 12, 1.0f, 1.0f ); // 0 - 264
Delta_AddField( "movevars_t", "skycolor_g", DT_FLOAT|DT_SIGNED, 12, 1.0f, 1.0f );
Delta_AddField( "movevars_t", "skycolor_b", DT_FLOAT|DT_SIGNED, 12, 1.0f, 1.0f );
Delta_AddField( "movevars_t", "skycolor_r", DT_FLOAT|DT_SIGNED, 16, 1.0f, 1.0f ); // 0 - 264
Delta_AddField( "movevars_t", "skycolor_g", DT_FLOAT|DT_SIGNED, 16, 1.0f, 1.0f );
Delta_AddField( "movevars_t", "skycolor_b", DT_FLOAT|DT_SIGNED, 16, 1.0f, 1.0f );
Delta_AddField( "movevars_t", "skyvec_x", DT_FLOAT|DT_SIGNED, 16, 32.0f, 1.0f ); // 0 - 1
Delta_AddField( "movevars_t", "skyvec_y", DT_FLOAT|DT_SIGNED, 16, 32.0f, 1.0f );
Delta_AddField( "movevars_t", "skyvec_z", DT_FLOAT|DT_SIGNED, 16, 32.0f, 1.0f );

View File

@ -59,7 +59,7 @@ GNU General Public License for more details.
// bytes will be stripped by the networking channel layer
#define NET_MAX_MESSAGE PAD_NUMBER(( NET_MAX_PAYLOAD + HEADER_BYTES ), 16 )
#define MASTERSERVER_ADR "celest.in:27010"
#define MASTERSERVER_ADR "ms.xash.su:27010"
#define PORT_MASTER 27010
#define PORT_CLIENT 27005
#define PORT_SERVER 27015

View File

@ -443,6 +443,7 @@ void SV_ExecuteUserCommand (char *s);
void SV_InitOperatorCommands( void );
void SV_KillOperatorCommands( void );
void SV_UserinfoChanged( sv_client_t *cl, const char *userinfo );
void SV_RemoteCommand( netadr_t from, sizebuf_t *msg );
void SV_PrepWorldFrame( void );
void SV_ProcessFile( sv_client_t *cl, char *filename );
void SV_SendResourceList( sv_client_t *cl );

View File

@ -1422,7 +1422,7 @@ edict_t *pfnFindEntityInSphere( edict_t *pStartEdict, const float *org, float fl
return ent;
}
return NULL;
return svgame.edicts;
}
/*

View File

@ -356,10 +356,26 @@ void SV_ActivateServer( void )
Host_SetServerState( sv.state );
if( sv_maxclients->integer > 1 && public_server->integer )
if( sv_maxclients->integer > 1 )
{
MsgDev( D_INFO, "Add your server, to master server list\n" );
Master_Add( );
// listenserver is executed on every map change in multiplayer
if( host.type != HOST_DEDICATED )
{
char *plservercfgfile = Cvar_VariableString( "lservercfgfile" );
if( *plservercfgfile ) Cbuf_AddText( va( "exec %s\n", plservercfgfile ));
}
if( public_server->integer )
{
MsgDev( D_INFO, "Adding your server to master server list\n" );
Master_Add( );
}
}
// mapchangecfgfile
{
char *mapchangecfgfile = Cvar_VariableString( "mapchangecfgfile" );
if( *mapchangecfgfile ) Cbuf_AddText( va( "exec %s\n", mapchangecfgfile ));
}
}

View File

@ -329,7 +329,22 @@ void SV_ReadPackets( void )
// check for connectionless packet (0xffffffff) first
if( BF_GetMaxBytes( &net_message ) >= 4 && *(int *)net_message.pData == -1 )
{
SV_ConnectionlessPacket( net_from, &net_message );
if( !svs.initialized )
{
char *args, *c;
BF_Clear( &net_message );
BF_ReadLong( &net_message );// skip the -1 marker
args = BF_ReadStringLine( &net_message );
Cmd_TokenizeString( args );
c = Cmd_Argv( 0 );
if( !Q_strcmp( c, "rcon" ))
SV_RemoteCommand( net_from, &net_message );
}
else SV_ConnectionlessPacket( net_from, &net_message );
continue;
}

View File

@ -31,8 +31,8 @@ Studio models are position independent, so the cache manager can move them.
#define IDSEQGRPHEADER (('Q'<<24)+('S'<<16)+('D'<<8)+'I') // little-endian "IDSQ"
// studio limits
#define MAXSTUDIOTRIANGLES 32768 // max triangles per model
#define MAXSTUDIOVERTS 4096 // max vertices per submodel
#define MAXSTUDIOTRIANGLES 65536 // max triangles per model
#define MAXSTUDIOVERTS 32768 // max vertices per submodel
#define MAXSTUDIOSEQUENCES 256 // total animation sequences
#define MAXSTUDIOSKINS 256 // total textures
#define MAXSTUDIOSRCBONES 512 // bones allowed at source movement