18 May 2012

This commit is contained in:
g-cont 2012-05-18 00:00:00 +04:00 committed by Alibek Omarov
parent c8441638a4
commit 68d3342fd3
16 changed files with 219 additions and 51 deletions

View File

@ -1,6 +1,31 @@
build ????
Server: fix the sound problem with weapons
Render: added rendermode kRenderWorldGlow (6) like in HL2
Server: added new callback into PhysicsInterface that named SV_TriggerTouch
Client: kill a little jitter for monsters that standing on elevators
Client: fix very old bug (initially comes from Quake1) with efrags relinking on a static client entities
Sound: got rid of message "S_PickChannel: no free channels" when breakble objects were broken.
Engine: ignore to load HD-textures when dedicated server is running
Client: count of static entities increased up to 512
Render: fixed bug with wrong clamping on 3D textures
Render: added a new one internal texture - gray cubemap that named as "*grayCube" without quotes
Render: disable depth mask on studiomodels when render mode is "additive" (original HL rules)
Sound: added a new untested feature for cull sounds by PAS on the client. Cvar "s_phs".
Sound: add save\restore for all dynamic sounds in-game
Sound: add save\restore for background track
Engine: added two new cvars called "build" and "ver" for more info
Engine: get support for loading game dlls from packfile
Engine: get support for transparent conveyor belts. Texture name must starting from "{scroll"
Sound: fix bug in wav-streaming code
Server: add save\restore for client static entities (engine function MAKE_STATIC is now useful!)
Server: remove command "map_backgound" in dedicated server mode
Server: disable "Touch" function when playersonly-mode is active
GameUI: don't draw logo.avi from root folder with user mods
Client: added partially HD-textures support for sprites
Server: now custom message code checck all the visible portals (Xash-mod feature)
Server: add quake-style for BSP hulls selection (cvar sv_quakehulls set to 1)
Engine: remove jpeg image support (just unneeded)
build 1905

View File

@ -56,14 +56,41 @@ static dframetype_t *R_SpriteLoadFrame( model_t *mod, void *pin, mspriteframe_t
{
dspriteframe_t *pinframe;
mspriteframe_t *pspriteframe;
char texname[128];
char texname[128], sprname[128];
qboolean load_external = false;
int gl_texturenum = 0;
pinframe = (dspriteframe_t *)pin;
// build uinque frame name
if( mod->flags & 256 ) // it's a HUD sprite
{
Q_snprintf( texname, sizeof( texname ), "#HUD/%s_%s_%i%i.spr", mod->name, group_suffix, num / 10, num % 10 );
else Q_snprintf( texname, sizeof( texname ), "#%s_%s_%i%i.spr", mod->name, group_suffix, num / 10, num % 10 );
pinframe = (dspriteframe_t *)pin;
gl_texturenum = GL_LoadTexture( texname, pin, pinframe->width * pinframe->height, r_texFlags );
}
else
{
// partially HD-textures support
if( mod_allow_materials != NULL && mod_allow_materials->integer && !Q_strcmp( group_suffix, "one" ))
{
Q_strncpy( sprname, mod->name, sizeof( sprname ));
FS_StripExtension( sprname );
Q_snprintf( texname, sizeof( texname ), "materials/%s/frame%i%i.tga", sprname, num / 10, num % 10 );
if( FS_FileExists( texname, false ))
gl_texturenum = GL_LoadTexture( texname, NULL, 0, r_texFlags );
if( gl_texturenum )
load_external = true; // sucessfully loaded
}
if( !load_external )
{
Q_snprintf( texname, sizeof( texname ), "#%s_%s_%i%i.spr", mod->name, group_suffix, num / 10, num % 10 );
gl_texturenum = GL_LoadTexture( texname, pin, pinframe->width * pinframe->height, r_texFlags );
}
}
// setup frame description
pspriteframe = Mem_Alloc( mod->mempool, sizeof( mspriteframe_t ));
@ -73,7 +100,7 @@ static dframetype_t *R_SpriteLoadFrame( model_t *mod, void *pin, mspriteframe_t
pspriteframe->left = pinframe->origin[0];
pspriteframe->down = pinframe->origin[1] - pinframe->height;
pspriteframe->right = pinframe->width + pinframe->origin[0];
pspriteframe->gl_texturenum = GL_LoadTexture( texname, pin, pinframe->width * pinframe->height, r_texFlags );
pspriteframe->gl_texturenum = gl_texturenum;
*ppframe = pspriteframe;
GL_SetTextureType( pspriteframe->gl_texturenum, TEX_SPRITE );
@ -752,9 +779,12 @@ static float R_SpriteGlowBlend( vec3_t origin, int rendermode, int renderfx, int
brightness = GLARE_FALLOFF / ( dist * dist );
brightness = bound( 0.01f, brightness, 1.0f );
// make the glow fixed size in screen space, taking into consideration the scale setting.
if( *pscale == 0.0f ) *pscale = 1.0f;
*pscale *= dist * ( 1.0f / bound( 100.0f, r_flaresize->value, 300.0f ));
if( rendermode != kRenderWorldGlow )
{
// make the glow fixed size in screen space, taking into consideration the scale setting.
if( *pscale == 0.0f ) *pscale = 1.0f;
*pscale *= dist * ( 1.0f / bound( 100.0f, r_flaresize->value, 300.0f ));
}
return brightness;
}
@ -768,7 +798,7 @@ Do occlusion test for glow-sprites
*/
qboolean R_SpriteOccluded( cl_entity_t *e, vec3_t origin, int *alpha, float *pscale )
{
if( e->curstate.rendermode == kRenderGlow )
if( e->curstate.rendermode == kRenderGlow || e->curstate.rendermode == kRenderWorldGlow )
{
float blend = 1.0f;
vec3_t v;

View File

@ -22,7 +22,6 @@ GNU General Public License for more details.
#include "pm_local.h"
#include "gl_local.h"
#include "cl_tent.h"
#include "cl_tent.h"
// NOTE: enable this if you want merge both 'model' and 'modelT' files into one model slot.
// otherwise it's uses two slots in models[] array for models with external textures

View File

@ -1290,7 +1290,7 @@ int S_GetCurrentDynamicSounds( soundlist_t *pout, int size )
if( channels[i].isSentence && channels[i].name[0] )
Q_strncpy( pout->name, channels[i].name, sizeof( pout->name ));
else Q_strncpy( pout->name, channels[i].sfx->name, sizeof( pout->name ));
pout->entnum = channels[i].entnum;
pout->entnum = (channels[i].entnum < 0) ? 0 : channels[i].entnum;
VectorCopy( channels[i].origin, pout->origin );
pout->volume = (float)channels[i].master_vol / 255.0f;
pout->attenuation = channels[i].dist_mult * SND_CLIP_DISTANCE;

View File

@ -264,7 +264,6 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, size_t filesize );
qboolean Image_LoadFNT( const char *name, const byte *buffer, size_t filesize );
qboolean Image_LoadLMP( const char *name, const byte *buffer, size_t filesize );
qboolean Image_LoadPAL( const char *name, const byte *buffer, size_t filesize );
qboolean Image_LoadJPG( const char *name, const byte *buffer, size_t filesize );
//
// formats save

View File

@ -98,7 +98,6 @@ static const loadpixformat_t load_game[] =
{
{ "%s%s.%s", "bmp", Image_LoadBMP, IL_HINT_NO }, // WON menu images
{ "%s%s.%s", "tga", Image_LoadTGA, IL_HINT_NO }, // hl vgui menus
{ "%s%s.%s", "jpg", Image_LoadJPG, IL_HINT_NO }, // hl skyboxes
{ "%s%s.%s", "mip", Image_LoadMIP, IL_HINT_NO }, // hl textures from wad or buffer
{ "%s%s.%s", "mdl", Image_LoadMDL, IL_HINT_HL }, // hl studio model skins
{ "%s%s.%s", "spr", Image_LoadSPR, IL_HINT_HL }, // hl sprite frames

View File

@ -298,10 +298,6 @@ SOURCE=.\common\imagelib\img_bmp.c
# End Source File
# Begin Source File
SOURCE=.\common\imagelib\img_jpg.c
# End Source File
# Begin Source File
SOURCE=.\common\imagelib\img_main.c
# End Source File
# Begin Source File

View File

@ -53,6 +53,7 @@ extern int SV_UPDATE_BACKUP;
#define MAKE_STRING(str) (int)(str - svgame.globals->pStringBase)
#define MAX_PUSHED_ENTS 256
#define MAX_CAMERAS 32
#define DVIS_PVS 0
#define DVIS_PHS 1
@ -227,6 +228,9 @@ typedef struct sv_client_s
char name[32]; // extracted from userinfo, color string allowed
int messagelevel; // for filtering printed messages
edict_t *cameras[MAX_CAMERAS]; // list of portal cameras in player PVS
int num_cameras; // num of portal cameras that can merge PVS
// the datagram is written to by sound calls, prints, temp ents, etc.
// it can be harmlessly overflowed.
sizebuf_t datagram;
@ -412,6 +416,7 @@ extern convar_t *sv_send_logos;
extern convar_t *sv_sendvelocity;
extern convar_t *sv_skyspeed;
extern convar_t *sv_skyangle;
extern convar_t *sv_quakehulls;
extern convar_t *mp_consistency;
extern convar_t *public_server;
extern convar_t *physinfo;

View File

@ -60,28 +60,32 @@ static void SV_AddEntitiesToPacket( edict_t *pViewEnt, edict_t *pClient, client_
edict_t *ent;
byte *pset;
qboolean fullvis = false;
sv_client_t *cl, *netclient;
sv_client_t *netclient;
sv_client_t *cl = NULL;
entity_state_t *state;
int e, player;
// during an error shutdown message we may need to transmit
// the shutdown message after the server has shutdown, so
// specfically check for it
// specifically check for it
if( !sv.state ) return;
cl = SV_ClientFromEdict( pClient, true );
ASSERT( cl );
if( pClient && !( sv.hostflags & SVF_PORTALPASS ))
{
// portals can't change hostflags
sv.hostflags &= ~SVF_SKIPLOCALHOST;
cl = SV_ClientFromEdict( pClient, true );
ASSERT( cl );
// setup hostflags
if( cl->local_weapons )
{
sv.hostflags |= SVF_SKIPLOCALHOST;
}
// reset cameras each frame
cl->num_cameras = 0;
}
svgame.dllFuncs.pfnSetupVisibility( pViewEnt, pClient, &clientpvs, &clientphs );
@ -114,6 +118,15 @@ static void SV_AddEntitiesToPacket( edict_t *pViewEnt, edict_t *pClient, client_
if( netclient && netclient->modelindex ) // apply custom model if present
state->modelindex = netclient->modelindex;
if( SV_IsValidEdict( ent->v.aiment ) && ( ent->v.aiment->v.effects & EF_MERGE_VISIBILITY ))
{
if( cl != NULL && cl->num_cameras < MAX_CAMERAS )
{
cl->cameras[cl->num_cameras] = ent->v.aiment;
cl->num_cameras++;
}
}
// if we are full, silently discard entities
if( ents->num_entities < MAX_VISIBLE_PACKET )
{

View File

@ -208,6 +208,50 @@ void SV_ConvertTrace( TraceResult *dst, trace_t *src )
svgame.globals->trace_flags = 0;
}
/*
=============
SV_CheckClientVisiblity
Check visibility through client camera, portal camera, etc
=============
*/
qboolean SV_CheckClientVisiblity( sv_client_t *cl, const byte *mask )
{
int i, leafnum, clientnum;
float *viewOrg = NULL;
if( !mask ) return true; // full visibility
clientnum = cl - svs.clients;
viewOrg = viewPoint[clientnum];
// Invasion issues: wrong camera position received in ENGINE_SET_PVS
if( cl->pViewEntity && !VectorCompare( viewOrg, cl->pViewEntity->v.origin ))
viewOrg = cl->pViewEntity->v.origin;
// -1 is because pvs rows are 1 based, not 0 based like leafs
leafnum = Mod_PointLeafnum( viewOrg ) - 1;
if( leafnum == -1 || (mask[leafnum>>3] & (1<<( leafnum & 7 ))))
return true; // visible from player view of camera view
#if 1
// now check all the portal cameras
for( i = 0; i < cl->num_cameras; i++ )
{
edict_t *cam = cl->cameras[i];
if( !SV_IsValidEdict( cam ))
continue;
leafnum = Mod_PointLeafnum( cam->v.origin ) - 1;
// g-cont. probably camera in bad leaf... allow to send message here?
if( leafnum == -1 || (mask[leafnum>>3] & (1<<( leafnum & 7 ))))
return true;
}
#endif
// not visible from any viewpoint
return false;
}
/*
=================
SV_Send
@ -304,22 +348,8 @@ qboolean SV_Send( int dest, const vec3_t origin, const edict_t *ent )
continue;
}
if( mask )
{
int leafnum, clientnum;
clientnum = cl - svs.clients;
viewOrg = viewPoint[clientnum];
// Invasion issues: wrong camera position received in ENGINE_SET_PVS
if( cl->pViewEntity && !VectorCompare( viewOrg, cl->pViewEntity->v.origin ))
viewOrg = cl->pViewEntity->v.origin;
// -1 is because pvs rows are 1 based, not 0 based like leafs
leafnum = Mod_PointLeafnum( viewOrg ) - 1;
if( leafnum != -1 && (!(mask[leafnum>>3] & (1<<( leafnum & 7 )))))
continue;
}
if( !SV_CheckClientVisiblity( cl, mask ))
continue;
if( specproxy ) BF_WriteBits( &sv.spectator_datagram, BF_GetData( &sv.multicast ), BF_GetNumBitsWritten( &sv.multicast ));
else if( reliable ) BF_WriteBits( &cl->netchan.message, BF_GetData( &sv.multicast ), BF_GetNumBitsWritten( &sv.multicast ));

View File

@ -332,9 +332,12 @@ void SV_ActivateServer( void )
if( svgame.globals->maxClients > 1 )
{
MsgDev( D_INFO, "%i player server started\n", svgame.globals->maxClients );
Cvar_Reset( "clockwindow" );
}
else
{
// clear the ugly moving delay in singleplayer
Cvar_SetFloat( "clockwindow", 0.0f );
MsgDev( D_INFO, "Game started\n" );
}

View File

@ -65,6 +65,7 @@ convar_t *sv_send_logos;
convar_t *sv_sendvelocity;
convar_t *sv_airmove;
convar_t *sv_fix_pushstep;
convar_t *sv_quakehulls;
convar_t *mp_consistency;
convar_t *serverinfo;
convar_t *physinfo;
@ -709,6 +710,7 @@ void SV_Init( void )
sv_send_resources = Cvar_Get( "sv_send_resources", "1", 0, "send generic resources that specified in 'mapname.res'" );
sv_sendvelocity = Cvar_Get( "sv_sendvelocity", "1", CVAR_ARCHIVE, "force to send velocity for event_t structure across network" );
sv_fix_pushstep = Cvar_Get( "sv_fix_pushstep", "0", CVAR_ARCHIVE, "allow the 'func_pushable' push the clients which standing on when the entity is floating in water" );
sv_quakehulls = Cvar_Get( "sv_quakehulls", "0", CVAR_ARCHIVE, "using quake style hull select instead of half-life style hull select" );
mp_consistency = Cvar_Get( "mp_consistency", "1", CVAR_SERVERNOTIFY, "enbale consistency check in multiplayer" );
clockwindow = Cvar_Get( "clockwindow", "0.5", 0, "timewindow to execute client moves" );
sv_novis = Cvar_Get( "sv_novis", "0", 0, "force to ignore server visibility" );

View File

@ -129,6 +129,44 @@ hull_t *SV_HullForBox( const vec3_t mins, const vec3_t maxs )
return &box_hull;
}
/*
==================
SV_HullAutoSelect
select the apropriate hull automatically
==================
*/
hull_t *SV_HullAutoSelect( model_t *model, const vec3_t mins, const vec3_t maxs, const vec3_t size, vec3_t offset )
{
float curdiff;
float lastdiff = 999;
int i, hullNumber = 0; // assume we fail
hull_t *hull;
// select the hull automatically
for( i = 0; i < 4; i++ )
{
curdiff = floor( VectorAvg( size )) - floor( VectorAvg( world.hull_sizes[i] ));
curdiff = fabs( curdiff );
if( curdiff < lastdiff )
{
hullNumber = i;
lastdiff = curdiff;
}
}
// TraceHull stuff
hull = &model->hulls[hullNumber];
// calculate an offset value to center the origin
// NOTE: never get offset of drawing hull
if( !hullNumber ) VectorCopy( hull->clip_mins, offset );
else VectorSubtract( hull->clip_mins, mins, offset );
return hull;
}
/*
==================
SV_HullForBsp
@ -154,23 +192,42 @@ hull_t *SV_HullForBsp( edict_t *ent, const vec3_t mins, const vec3_t maxs, float
// author: The FiEctro
hull = &model->hulls[Com_RandomLong( 0, 0 )];
#endif
if( size[0] <= 8.0f || model->flags & MODEL_LIQUID )
if( sv_quakehulls->integer == 1 )
{
hull = &model->hulls[0];
VectorCopy( hull->clip_mins, offset );
}
else
{
if( size[0] <= 36.0f )
{
if( size[2] <= 36.0f )
hull = &model->hulls[3];
else hull = &model->hulls[1];
}
// Using quake-style hull select for my Quake remake
if( size[0] < 3.0f || model->flags & MODEL_LIQUID )
hull = &model->hulls[0];
else if( size[0] <= 32.0f )
hull = &model->hulls[1];
else hull = &model->hulls[2];
VectorSubtract( hull->clip_mins, mins, offset );
}
else if( sv_quakehulls->integer == 2 )
{
// undocumented feature: auto hull select
hull = SV_HullAutoSelect( model, mins, maxs, size, offset );
}
else
{
if( size[0] <= 8.0f || model->flags & MODEL_LIQUID )
{
hull = &model->hulls[0];
VectorCopy( hull->clip_mins, offset );
}
else
{
if( size[0] <= 36.0f )
{
if( size[2] <= 36.0f )
hull = &model->hulls[3];
else hull = &model->hulls[1];
}
else hull = &model->hulls[2];
VectorSubtract( hull->clip_mins, mins, offset );
}
}
VectorAdd( offset, ent->v.origin, offset );

View File

@ -406,6 +406,15 @@ void UI_LoadBackgroundImage( void )
}
}
}
else
{
if( g_engfuncs.pfnFileExists( "gfx/shell/splash.bmp", TRUE ))
{
// if we doesn't have logo.avi in gamedir we don't want to draw it
if( !g_engfuncs.pfnFileExists( "media/logo.avi", TRUE ))
uiStatic.m_fDisableLogo = TRUE;
}
}
}
/*

View File

@ -346,6 +346,7 @@ typedef struct
float m_flTotalWidth;
float m_flTotalHeight;
bool m_fHaveSteamBackground;
bool m_fDisableLogo;
float scaleX;
float scaleY;

View File

@ -105,7 +105,7 @@ static void UI_Background_Ownerdraw( void *self )
UI_DrawBackground_Callback( self );
if (uiStatic.m_fHaveSteamBackground)
if (uiStatic.m_fHaveSteamBackground || uiStatic.m_fDisableLogo)
return; // no logos for steam background
if( GetLogoLength() <= 0.1 || GetLogoWidth() <= 32 )