14 Apr 2011

This commit is contained in:
g-cont 2011-04-14 00:00:00 +04:00 committed by Alibek Omarov
parent ef4b50cc67
commit 0a36fbcc7c
16 changed files with 129 additions and 51 deletions

View File

@ -9,6 +9,7 @@ Pmove: add sv_clienttrace that shared across network
Render: implement "envshot" and "skyshot" commands for make cubemaps or skyboxes
Server: fix remote connection (rcon)
Render: add glare reduction option in menu
Server: fix FindEntityInSphere bug (satchel issues in multiplayer)
build 1516

View File

@ -998,7 +998,7 @@ void CL_SetEventIndex( const char *szEvName, int ev_index )
ev = clgame.events[i];
if( !ev ) break;
if( !Q_strcmp( ev->name, szEvName ))
if( !Q_stricmp( ev->name, szEvName ))
{
ev->index = ev_index;
return;
@ -2250,14 +2250,26 @@ pfnHookEvent
=============
*/
static void pfnHookEvent( const char *name, pfnEventHook pfn )
static void pfnHookEvent( const char *filename, pfnEventHook pfn )
{
word event_index = CL_EventIndex( name );
word event_index;
char name[64];
user_event_t *ev;
int i;
int i, j;
// ignore blank names
if( !name || !*name ) return;
if( !filename || !*filename ) return;
// eliminate '!' symbol (i'm doesn't know what this doing)
for( i = j = 0; i < Q_strlen( filename ); i++ )
{
if( filename[i] == '\\' ) name[j] = '/';
else name[j] = filename[i];
j++;
}
name[j] = '\0';
event_index = CL_EventIndex( name );
// second call can change EventFunc
for( i = 0; i < MAX_EVENTS; i++ )
@ -2265,7 +2277,7 @@ static void pfnHookEvent( const char *name, pfnEventHook pfn )
ev = clgame.events[i];
if( !ev ) break;
if( !Q_strcmp( name, ev->name ))
if( !Q_stricmp( name, ev->name ))
{
if( ev->func != pfn )
ev->func = pfn;

View File

@ -246,19 +246,7 @@ usercmd_t CL_CreateCmd( void )
if( ++cl.movemessages <= 10 )
return cmd;
switch( cls.state )
{
case ca_connected:
active = 1;
break;
case ca_active:
active = 2; // GoldSrc rules
break;
default:
active = 0;
break;
}
active = ( cls.state == ca_active && !cl.refdef.paused && !cl.refdef.intermission );
clgame.dllFuncs.CL_CreateMove( cl.time - cl.oldtime, &cmd, active );
R_LightForPoint( cl.frame.local.client.origin, &color, false, 128.0f );

View File

@ -606,18 +606,12 @@ void R_ShowTextures( void )
pglClear( GL_COLOR_BUFFER_BIT );
pglFinish();
if( gl_showtextures->integer == TEX_LIGHTMAP )
if( gl_showtextures->integer == TEX_LIGHTMAP || gl_showtextures->integer == TEX_VGUI )
{
// draw lightmaps as big images
base_w = 5;
base_h = 4;
}
else if( gl_showtextures->integer == TEX_VGUI )
{
// draw lightmaps as big images
base_w = 2;
base_h = 1;
}
else
{
base_w = 16;
@ -638,7 +632,7 @@ void R_ShowTextures( void )
y = j / base_w * h;
pglColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
GL_Bind( GL_TEXTURE0, image->texnum );
GL_Bind( GL_TEXTURE0, i );
pglBegin( GL_QUADS );
pglTexCoord2f( 0, 0 );

View File

@ -832,7 +832,8 @@ static void GL_UploadTexture( rgbdata_t *pic, gltexture_t *tex, qboolean subImag
}
}
GL_MBind( tex->texnum );
// critical stuff!!!
GL_MBind( tex - r_textures );
buf = pic->buffer;
bufend = pic->buffer + pic->size;
@ -935,9 +936,12 @@ int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags )
tex = &r_textures[i];
Q_strncpy( tex->name, name, sizeof( tex->name ));
tex->texnum = i; // texnum is used for fast acess into r_textures array too
tex->flags = flags;
if( flags & TF_SKYSIDE )
tex->texnum = tr.skyboxbasenum++;
else tex->texnum = i; // texnum is used for fast acess into r_textures array too
GL_UploadTexture( pic, tex, false );
GL_TexFilter( tex, false ); // update texture filter, wrap etc
FS_FreeImage( pic ); // release source texture
@ -947,7 +951,8 @@ int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags )
tex->nextHash = r_texturesHashTable[hash];
r_texturesHashTable[hash] = tex;
return tex->texnum;
// NOTE: always return texnum as index in array or engine will stop work !!!!
return i;
}
/*
@ -1060,7 +1065,7 @@ void GL_FreeImage( const char *name )
if( !Q_stricmp( tex->name, name ))
{
GL_FreeTexture( tex->texnum );
GL_FreeTexture( tex - r_textures );
return;
}
}
@ -1417,7 +1422,7 @@ void R_ShutdownImages( void )
for( i = 0, image = r_textures; i < r_numTextures; i++, image++ )
{
if( !image->texnum ) continue;
GL_FreeTexture( image->texnum );
GL_FreeTexture( i );
}
Q_memset( tr.lightmapTextures, 0, sizeof( tr.lightmapTextures ));

View File

@ -172,6 +172,8 @@ typedef struct
int skytexturenum; // this not a gl_texturenum!
int skyboxbasenum; // start with 5800
// entity lists
cl_entity_t *static_entities[MAX_VISIBLE_PACKET]; // opaque non-moved brushes
cl_entity_t *solid_entities[MAX_VISIBLE_PACKET]; // opaque moving or alpha brushes

View File

@ -1592,8 +1592,6 @@ void GL_BuildLightmaps( void )
tr.framecount = 1; // no dlight cache
gl_lms.current_lightmap_texture = 0;
// GL_EnableMultitexture();
// setup all the lightstyles
R_AnimateLight();
@ -1629,5 +1627,4 @@ void GL_BuildLightmaps( void )
loadmodel = NULL;
LM_UploadBlock( false );
// GL_DisableMultitexture();
}

View File

@ -324,6 +324,8 @@ void R_UnloadSkybox( void )
GL_FreeTexture( tr.skyboxTextures[i] );
}
tr.skyboxbasenum = 5800; // set skybox base (to let some mods load hi-res skyboxes)
Q_memset( tr.skyboxTextures, 0, sizeof( tr.skyboxTextures ));
}
@ -398,7 +400,7 @@ void R_SetupSky( const char *skyboxname )
for( i = 0; i < 6; i++ )
{
Q_snprintf( sidename, sizeof( sidename ), "%s%s", loadname, r_skyBoxSuffix[i] );
tr.skyboxTextures[i] = GL_LoadTexture( sidename, NULL, 0, TF_CLAMP|TF_SKYSIDE );
tr.skyboxTextures[i] = GL_LoadTexture( sidename, NULL, 0, TF_CLAMP|TF_SKY );
GL_SetTextureType( tr.skyboxTextures[i], TEX_CUBEMAP );
if( !tr.skyboxTextures[i] ) break;
}
@ -411,7 +413,7 @@ void R_SetupSky( const char *skyboxname )
for( i = 0; i < 6; i++ )
{
Q_snprintf( sidename, sizeof( sidename ), "%s_%s", loadname, r_skyBoxSuffix[i] );
tr.skyboxTextures[i] = GL_LoadTexture( sidename, NULL, 0, TF_CLAMP|TF_SKYSIDE );
tr.skyboxTextures[i] = GL_LoadTexture( sidename, NULL, 0, TF_CLAMP|TF_SKY );
GL_SetTextureType( tr.skyboxTextures[i], TEX_CUBEMAP );
if( !tr.skyboxTextures[i] ) break;
}
@ -494,7 +496,7 @@ void R_InitSky( mip_t *mt, texture_t *tx )
r_temp.size = r_temp.width * r_temp.height * 4;
// load it in
tr.solidskyTexture = GL_LoadTextureInternal( "solid_sky", &r_temp, TF_SKY, false );
tr.solidskyTexture = GL_LoadTextureInternal( "solid_sky", &r_temp, TF_UNCOMPRESSED|TF_NOMIPMAP, false );
for( i = 0; i < r_sky->width >> 1; i++ )
{
@ -516,7 +518,7 @@ void R_InitSky( mip_t *mt, texture_t *tx )
r_temp.flags = IMAGE_HAS_COLOR|IMAGE_HAS_ALPHA;
// load it in
tr.alphaskyTexture = GL_LoadTextureInternal( "alpha_sky", &r_temp, TF_SKY, false );
tr.alphaskyTexture = GL_LoadTextureInternal( "alpha_sky", &r_temp, TF_UNCOMPRESSED|TF_NOMIPMAP, false );
GL_SetTextureType( tr.solidskyTexture, TEX_BRUSH );
GL_SetTextureType( tr.alphaskyTexture, TEX_BRUSH );

View File

@ -7,7 +7,7 @@
#include "client.h"
#include "server.h"
#define MAX_CMD_BUFFER 8192
#define MAX_CMD_BUFFER 16384
#define MAX_CMD_LINE 1024
#define MAX_ALIAS_NAME 32

View File

@ -165,7 +165,7 @@ typedef struct gameinfo_s
int max_edicts; // min edicts is 600, max edicts is 4096
int max_tents; // min temp ents is 300, max is 2048
int max_beams; // min beams is 64, max beams is 512
int max_particles; // min particles is 512, max particles is 8192
int max_particles; // min particles is 4096, max particles is 32768
} gameinfo_t;
typedef struct sysinfo_s

View File

@ -1344,7 +1344,7 @@ static qboolean FS_ParseGameInfo( const char *gamedir, gameinfo_t *GameInfo )
else if( !Q_stricmp( token, "max_particles" ))
{
pfile = COM_ParseFile( pfile, token );
GameInfo->max_particles = bound( 1024, Q_atoi( token ), 8192 );
GameInfo->max_particles = bound( 1024, Q_atoi( token ), 32768 );
}
else if( !Q_stricmp( token, "gamemode" ))
{

View File

@ -1167,6 +1167,10 @@ edict_t* pfnFindEntityByString( edict_t *pStartEdict, const char *pszField, cons
ed = EDICT_NUM( e );
if( !SV_IsValidEdict( ed )) continue;
// ignore clients that not in a game
if( e <= sv_maxclients->integer && !SV_ClientFromEdict( ed, true ))
continue;
switch( desc->fieldType )
{
case FIELD_STRING:
@ -1224,9 +1228,15 @@ edict_t *pfnFindEntityInSphere( edict_t *pStartEdict, const float *org, float fl
for( e++; e < svgame.numEntities; e++ )
{
ent = EDICT_NUM( e );
if( !SV_IsValidEdict( ent )) continue;
distSquared = 0;
if( !SV_IsValidEdict( ent ))
continue;
// ignore clients that not in a game
if( e <= sv_maxclients->integer && !SV_ClientFromEdict( ent, true ))
continue;
distSquared = 0.0f;
for( j = 0; j < 3 && distSquared <= flRadius; j++ )
{
if( org[j] < ent->v.absmin[j] )
@ -1237,6 +1247,7 @@ edict_t *pfnFindEntityInSphere( edict_t *pStartEdict, const float *org, float fl
distSquared += eorg * eorg;
}
if( distSquared > flRadius )
continue;
return ent;
@ -1295,11 +1306,12 @@ edict_t *pfnEntitiesInPVS( edict_t *pplayer )
VectorAdd( pplayer->v.origin, pplayer->v.view_ofs, viewpoint );
for( chain = EDICT_NUM( 0 ), i = 1; i < svgame.numEntities; i++ )
for( chain = EDICT_NUM( 0 ), i = svgame.globals->maxClients; i < svgame.numEntities; i++ )
{
pEdict = EDICT_NUM( i );
if( !SV_IsValidEdict( pEdict )) continue;
if( !SV_IsValidEdict( pEdict ))
continue;
if( pEdict->v.movetype == MOVETYPE_FOLLOW && SV_IsValidEdict( pEdict->v.aiment ))
{

View File

@ -110,8 +110,7 @@ int SV_EventIndex( const char *filename )
// eliminate '!' symbol (i'm doesn't know what this doing)
for( i = j = 0; i < Q_strlen( filename ); i++ )
{
if( filename[i] == '!' ) continue;
else if( filename[i] == '\\' ) name[j] = '/';
if( filename[i] == '\\' ) name[j] = '/';
else name[j] = filename[i];
j++;
}

View File

@ -190,6 +190,12 @@ typedef struct
int curItem;
int topItem;
int numRows;
// scrollbar stuff // ADAMIX
int scrollBarX;
int scrollBarY;
int scrollBarWidth;
int scrollBarHeight;
int scrollBarSliding;
} menuScrollList_s;
typedef struct

View File

@ -341,7 +341,11 @@ const char *UI_ScrollList_Key( menuScrollList_s *sl, int key, int down )
int arrowWidth, arrowHeight, upX, upY, downX, downY;
int i, y;
if( !down ) return uiSoundNull;
if( !down )
{
sl->scrollBarSliding = false;
return uiSoundNull;
}
switch( key )
{
@ -361,6 +365,14 @@ const char *UI_ScrollList_Key( menuScrollList_s *sl, int key, int down )
downX = sl->generic.x2 + sl->generic.width2 - arrowWidth;
downY = sl->generic.y2 + (sl->generic.height2 - arrowHeight) - UI_OUTLINE_WIDTH;
// ADAMIX
if( UI_CursorInRect( sl->scrollBarX, sl->scrollBarY, sl->scrollBarWidth, sl->scrollBarHeight ))
{
sl->scrollBarSliding = true;
break;
}
// ADAMIX END
// Now see if either up or down has focus
if( UI_CursorInRect( upX, upY, arrowWidth, arrowHeight ))
{
@ -450,7 +462,7 @@ const char *UI_ScrollList_Key( menuScrollList_s *sl, int key, int down )
break;
case K_DOWNARROW:
case K_MWHEELDOWN:
if( sl->curItem != sl->numItems - 1 )
if( sl->numItems > 0 && sl->curItem != sl->numItems - 1 )
{
sl->curItem++;
sound = uiSoundMove;
@ -487,7 +499,7 @@ void UI_ScrollList_Draw( menuScrollList_s *sl )
int i, x, y, w, h;
int selColor = 0xFF503818; // Red 80, Green 56, Blue 24, Alpha 255
int arrowWidth, arrowHeight, upX, upY, downX, downY;
int upFocus, downFocus;
int upFocus, downFocus, scrollbarFocus;
if( sl->generic.flags & QMF_LEFT_JUSTIFY )
justify = 0;
@ -581,6 +593,46 @@ void UI_ScrollList_Draw( menuScrollList_s *sl )
// draw the arrows base
UI_FillRect( upX, upY + arrowHeight, arrowWidth, downY - upY - arrowHeight, uiInputFgColor );
// ADAMIX
sl->scrollBarX = upX + sl->generic.charHeight/4;
sl->scrollBarWidth = arrowWidth - sl->generic.charHeight/4;
sl->scrollBarHeight = downY - upY - arrowHeight - (((sl->numItems-1)*sl->generic.charHeight)/2);
sl->scrollBarY = upY + arrowHeight + (((sl->curItem)*sl->generic.charHeight)/2);
if( sl->scrollBarSliding )
{
int dist = uiStatic.cursorY - sl->scrollBarY - (sl->scrollBarHeight>>2);
if((((dist / 2) > (sl->generic.charHeight / 2)) || ((dist / 2) < (sl->generic.charHeight / 2))) && sl->curItem <= (sl->numItems - 1) && sl->curItem >= 0)
{
if(sl->generic.callback)
sl->generic.callback( sl, QM_CHANGED );
if((dist / 2) > ( sl->generic.charHeight / 2 ) && sl->curItem < ( sl->numItems - 1 ))
{
sl->curItem++;
}
if((dist / 2) < -(sl->generic.charHeight / 2) && sl->curItem > 0 )
{
sl->curItem--;
}
}
sl->topItem = sl->curItem - sl->numRows + 1;
if( sl->topItem < 0 ) sl->topItem = 0;
if( sl->topItem > ( sl->numItems - sl->numRows ))
sl->topItem = sl->numItems - sl->numRows;
}
if( sl->scrollBarSliding )
{
// Draw scrollbar background
UI_FillRect ( sl->scrollBarX, upY + arrowHeight, sl->scrollBarWidth, downY - upY - arrowHeight, uiColorBlack);
}
// ADAMIX END
// draw the arrows
if( sl->generic.flags & QMF_GRAYED )
{
@ -589,6 +641,14 @@ void UI_ScrollList_Draw( menuScrollList_s *sl )
}
else
{
scrollbarFocus = UI_CursorInRect( sl->scrollBarX, sl->scrollBarY, sl->scrollBarWidth, sl->scrollBarHeight );
// special case if we sliding but lost focus
if( sl->scrollBarSliding ) scrollbarFocus = true;
// Draw scrollbar itself
UI_FillRect( sl->scrollBarX, sl->scrollBarY, sl->scrollBarWidth, sl->scrollBarHeight, scrollbarFocus ? uiInputTextColor : uiColorBlack );
if((menuCommon_s *)sl != (menuCommon_s *)UI_ItemAtCursor(sl->generic.parent))
{
UI_DrawPic( upX, upY, arrowWidth, arrowHeight, uiColorWhite, sl->upArrow );