mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 11:35:05 +08:00
Compare commits
12 Commits
continuous
...
continuous
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b2273b1bce | ||
|
|
950d210ec5 | ||
|
|
55c1bddac5 | ||
|
|
ac50c762d7 | ||
|
|
5c2ab150b3 | ||
|
|
0870536405 | ||
|
|
b47ede477a | ||
|
|
eef5cc17b3 | ||
|
|
ad2191333d | ||
|
|
a85cac497d | ||
|
|
e0c69d7df5 | ||
|
|
ff3d91ceb4 |
@@ -1,19 +0,0 @@
|
||||
## Lightmapped water
|
||||
|
||||
Xash3D FWGS supports lightmapped water, as an extension. It adds three new cvars and new worldspawn key values.
|
||||
|
||||
### For level designers:
|
||||
|
||||
If you're a level designer and intend to make your level to have lightmapped water, you can put these keyvalues to worldspawn entity description (always first entity in entities list):
|
||||
|
||||
| Key | Value | Description |
|
||||
| ---------------------- | ------- | ----------- |
|
||||
| `_litwater` | integer | Set to any non-zero value to enable lightmapped water. Overrides `gl_litwater_force` cvar value. |
|
||||
| `_litwater_minlight` | integer | Minimal lightmap value water surface will receive. Helps to avoid too dark areas when water isn't properly lit. If not set, defaults to zero. |
|
||||
| `_litwater_scale` | float | Scales up lightmap value for water surfaces. If not set, defaults to 1.0. |
|
||||
|
||||
### For players:
|
||||
|
||||
Some of the maps already have computed lightmap for water surfaces and sometimes water has been properly lit but the support hasn't been declared by the level designer.
|
||||
|
||||
As a player, you can enable it in `Video options` menu or through console with `gl_litwater_force` cvar. There are also `gl_litwater_minlight` and `gl_litwater_scale` cvars that function similar to keys above. The default values has been set to `192` and `1.25` respectively to slightly avoid issues with maps that wasn't intended to have lightmapped water.
|
||||
@@ -14,6 +14,9 @@
|
||||
****/
|
||||
#ifndef CONST_H
|
||||
#define CONST_H
|
||||
|
||||
#include <stddef.h> // ptrdiff_t
|
||||
|
||||
//
|
||||
// Constants shared by the engine and dlls
|
||||
// This header file included by engine files and DLL files.
|
||||
@@ -721,7 +724,7 @@ enum
|
||||
};
|
||||
|
||||
typedef int func_t;
|
||||
typedef int string_t;
|
||||
typedef ptrdiff_t string_t;
|
||||
|
||||
typedef unsigned short word;
|
||||
|
||||
|
||||
@@ -56,6 +56,8 @@ color24 gTracerColors[] =
|
||||
};
|
||||
*/
|
||||
|
||||
#define TRACER_COLORINDEX_DEFAULT 4
|
||||
|
||||
// Temporary entity array
|
||||
#define TENTPRIORITY_LOW 0
|
||||
#define TENTPRIORITY_HIGH 1
|
||||
|
||||
@@ -250,7 +250,7 @@ static particle_t *R_AllocTracer( const vec3_t org, const vec3_t vel, float life
|
||||
VectorCopy( vel, p->vel );
|
||||
p->die = cl.time + life;
|
||||
p->ramp = tracerlength.value;
|
||||
p->color = 4; // select custom color
|
||||
p->color = TRACER_COLORINDEX_DEFAULT; // select custom color
|
||||
p->packedColor = 255; // alpha
|
||||
|
||||
return p;
|
||||
|
||||
@@ -524,9 +524,6 @@ static void SND_Spatialize( channel_t *ch )
|
||||
dist = VectorNormalizeLength( source_vec );
|
||||
dot = DotProduct( s_listener.right, source_vec );
|
||||
|
||||
// don't pan sounds with no attenuation
|
||||
if( ch->dist_mult <= 0.0f ) dot = 0.0f;
|
||||
|
||||
// fill out channel volumes for single location
|
||||
S_SpatializeChannel( &ch->leftvol, &ch->rightvol, ch->master_vol, gain, dot, dist * ch->dist_mult );
|
||||
|
||||
|
||||
@@ -126,14 +126,20 @@ dll_user_t *FS_FindLibrary( const char *dllname, qboolean directpath )
|
||||
=============================================================================
|
||||
*/
|
||||
|
||||
static void COM_GenerateCommonLibraryName( const char *name, const char *ext, char *out, size_t size )
|
||||
static void COM_GenerateCommonLibraryName( const char *name, const char *ext, const char *suffix, char *out, size_t size )
|
||||
{
|
||||
#if ( XASH_WIN32 || XASH_LINUX || XASH_APPLE ) && XASH_X86
|
||||
Q_snprintf( out, size, "%s.%s", name, ext );
|
||||
if( suffix )
|
||||
Q_snprintf( out, size, "%s_%s.%s", name, suffix, ext );
|
||||
else Q_snprintf( out, size, "%s.%s", name, ext );
|
||||
#elif ( XASH_WIN32 || XASH_LINUX || XASH_APPLE )
|
||||
Q_snprintf( out, size, "%s_%s.%s", name, Q_buildarch(), ext );
|
||||
if( suffix )
|
||||
Q_snprintf( out, size, "%s_%s_%s.%s", name, Q_buildarch(), suffix, ext );
|
||||
else Q_snprintf( out, size, "%s_%s.%s", name, Q_buildarch(), ext );
|
||||
#else
|
||||
Q_snprintf( out, size, "%s_%s_%s.%s", name, Q_buildos(), Q_buildarch(), ext );
|
||||
if( suffix )
|
||||
Q_snprintf( out, size, "%s_%s_%s_%s.%s", name, Q_buildos(), Q_buildarch(), suffix, ext );
|
||||
else Q_snprintf( out, size, "%s_%s_%s.%s", name, Q_buildos(), Q_buildarch(), ext );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -154,7 +160,7 @@ static void COM_GenerateClientLibraryPath( const char *name, char *out, size_t s
|
||||
// we don't have any library prefixes, so we can safely append dll_path here
|
||||
Q_snprintf( dllpath, sizeof( dllpath ), "%s/%s", GI->dll_path, name );
|
||||
|
||||
COM_GenerateCommonLibraryName( dllpath, OS_LIB_EXT, out, size );
|
||||
COM_GenerateCommonLibraryName( dllpath, OS_LIB_EXT, NULL, out, size );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -211,7 +217,13 @@ static void COM_GenerateServerLibraryPath( char *out, size_t size )
|
||||
COM_StripExtension( dllpath );
|
||||
COM_StripIntelSuffix( dllpath );
|
||||
|
||||
COM_GenerateCommonLibraryName( dllpath, ext, out, size );
|
||||
#if XASH_ARCH_USES_ONLY_ABI2
|
||||
COM_GenerateCommonLibraryName( dllpath, ext, NULL, out, size );
|
||||
#elif XASH_64BIT
|
||||
COM_GenerateCommonLibraryName( dllpath, ext, "st64", out, size );
|
||||
#else
|
||||
COM_GenerateCommonLibraryName( dllpath, ext, NULL, out, size );
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -420,7 +420,8 @@ void NET_InitMasters( void )
|
||||
// keep main master always there
|
||||
NET_AddMaster( MASTERSERVER_ADR, false );
|
||||
NET_AddMaster( "aaaa.mentality.rip:27010", false ); // IPv6-only
|
||||
NET_AddMaster( "mentality.rip:27011", false );
|
||||
NET_AddMaster( "mentality.rip:27011", false ); // testing server, might be offline
|
||||
NET_AddMaster( "aaaa.mentality.rip:27011", false ); // IPv6-only, testing server, might be offline
|
||||
|
||||
NET_LoadMasters( );
|
||||
}
|
||||
|
||||
@@ -1677,10 +1677,9 @@ static void Mod_SetupSubmodels( model_t *mod, dbspmodel_t *bmod )
|
||||
// mark models that have origin brushes
|
||||
if( !VectorIsNull( bm->origin ))
|
||||
SetBits( mod->flags, MODEL_HAS_ORIGIN );
|
||||
|
||||
#ifdef HACKS_RELATED_HLMODS
|
||||
// c2a1 doesn't have origin brush it's just placed at center of the level
|
||||
if( i == 11 && !Q_stricmp( name, "maps/c2a1.bsp" ))
|
||||
if( !Q_stricmp( name, "maps/c2a1.bsp" ) && ( i == 11 ))
|
||||
SetBits( mod->flags, MODEL_HAS_ORIGIN );
|
||||
#endif
|
||||
}
|
||||
@@ -1836,8 +1835,6 @@ static void Mod_LoadEntities( model_t *mod, dbspmodel_t *bmod )
|
||||
world.generator[0] = '\0';
|
||||
world.compiler[0] = '\0';
|
||||
world.message[0] = '\0';
|
||||
world.litwater_minlight = -1;
|
||||
world.litwater_scale = -1.0f;
|
||||
bmod->wadlist.count = 0;
|
||||
|
||||
// parse all the wads for loading textures in right ordering
|
||||
@@ -1896,15 +1893,6 @@ static void Mod_LoadEntities( model_t *mod, dbspmodel_t *bmod )
|
||||
Q_strncpy( world.compiler, token, sizeof( world.compiler ));
|
||||
else if( !Q_stricmp( keyname, "generator" ) || !Q_stricmp( keyname, "_generator" ))
|
||||
Q_strncpy( world.generator, token, sizeof( world.generator ));
|
||||
else if( !Q_stricmp( keyname, "_litwater" ))
|
||||
{
|
||||
if( Q_atoi( token ) != 0 )
|
||||
SetBits( world.flags, FWORLD_HAS_LITWATER );
|
||||
}
|
||||
else if( !Q_stricmp( keyname, "_litwater_minlight" ))
|
||||
world.litwater_minlight = Q_atoi( token );
|
||||
else if( !Q_stricmp( keyname, "_litwater_scale" ))
|
||||
world.litwater_scale = Q_atof( token );
|
||||
}
|
||||
return; // all done
|
||||
}
|
||||
|
||||
@@ -119,10 +119,6 @@ typedef struct world_static_s
|
||||
// Potentially Hearable Set
|
||||
byte *compressed_phs;
|
||||
size_t *phsofs;
|
||||
|
||||
// lightmapped water extra info
|
||||
float litwater_scale;
|
||||
int litwater_minlight;
|
||||
} world_static_t;
|
||||
|
||||
#ifndef REF_DLL
|
||||
|
||||
@@ -125,7 +125,7 @@ typedef struct enginefuncs_s
|
||||
void (*pfnAngleVectors)( const float *rgflVector, float *forward, float *right, float *up );
|
||||
edict_t* (*pfnCreateEntity)( void );
|
||||
void (*pfnRemoveEntity)( edict_t* e );
|
||||
edict_t* (*pfnCreateNamedEntity)( int className );
|
||||
edict_t* (*pfnCreateNamedEntity)( string_t className );
|
||||
void (*pfnMakeStatic)( edict_t *ent );
|
||||
int (*pfnEntIsOnFloor)( edict_t *e );
|
||||
int (*pfnDropToFloor)( edict_t* e );
|
||||
@@ -168,8 +168,8 @@ typedef struct enginefuncs_s
|
||||
void* (*pfnPvAllocEntPrivateData)( edict_t *pEdict, long cb );
|
||||
void* (*pfnPvEntPrivateData)( edict_t *pEdict );
|
||||
void (*pfnFreeEntPrivateData)( edict_t *pEdict );
|
||||
const char *(*pfnSzFromIndex)( int iString );
|
||||
int (*pfnAllocString)( const char *szValue );
|
||||
const char *(*pfnSzFromIndex)( string_t iString );
|
||||
string_t (*pfnAllocString)( const char *szValue );
|
||||
struct entvars_s *(*pfnGetVarsOfEnt)( edict_t *pEdict );
|
||||
edict_t* (*pfnPEntityOfEntOffset)( int iEntOffset );
|
||||
int (*pfnEntOffsetOfPEntity)( const edict_t *pEdict );
|
||||
|
||||
@@ -85,8 +85,8 @@ typedef struct entvars_s
|
||||
int modelindex;
|
||||
|
||||
string_t model;
|
||||
int viewmodel; // player's viewmodel
|
||||
int weaponmodel; // what other players see
|
||||
string_t viewmodel; // player's viewmodel
|
||||
string_t weaponmodel; // what other players see
|
||||
|
||||
vec3_t absmin; // BB max translated to world coord
|
||||
vec3_t absmax; // BB max translated to world coord
|
||||
@@ -144,7 +144,7 @@ typedef struct entvars_s
|
||||
int flags;
|
||||
|
||||
int colormap; // lowbyte topcolor, highbyte bottomcolor
|
||||
int team;
|
||||
string_t team;
|
||||
|
||||
float max_health;
|
||||
float teleport_time;
|
||||
|
||||
@@ -80,11 +80,10 @@ GNU General Public License for more details.
|
||||
#define MODEL_CLIENT BIT( 30 ) // client sprite
|
||||
|
||||
// goes into world.flags
|
||||
#define FWORLD_SKYSPHERE BIT( 0 )
|
||||
#define FWORLD_CUSTOM_SKYBOX BIT( 1 )
|
||||
#define FWORLD_WATERALPHA BIT( 2 )
|
||||
#define FWORLD_HAS_DELUXEMAP BIT( 3 )
|
||||
#define FWORLD_HAS_LITWATER BIT( 4 )
|
||||
#define FWORLD_SKYSPHERE BIT( 0 )
|
||||
#define FWORLD_CUSTOM_SKYBOX BIT( 1 )
|
||||
#define FWORLD_WATERALPHA BIT( 2 )
|
||||
#define FWORLD_HAS_DELUXEMAP BIT( 3 )
|
||||
|
||||
// special rendermode for screenfade modulate
|
||||
// (probably will be expanded at some point)
|
||||
|
||||
@@ -3000,25 +3000,6 @@ static void *GAME_EXPORT pfnPvEntPrivateData( edict_t *pEdict )
|
||||
}
|
||||
|
||||
|
||||
#ifdef XASH_64BIT
|
||||
static struct str64_s
|
||||
{
|
||||
size_t maxstringarray;
|
||||
qboolean allowdup;
|
||||
char *staticstringarray;
|
||||
char *pstringarray;
|
||||
char *pstringarraystatic;
|
||||
char *pstringbase;
|
||||
char *poldstringbase;
|
||||
char *plast;
|
||||
qboolean dynamic;
|
||||
size_t maxalloc;
|
||||
size_t numdups;
|
||||
size_t numoverflows;
|
||||
size_t totalalloc;
|
||||
} str64;
|
||||
#endif
|
||||
|
||||
/*
|
||||
==================
|
||||
SV_EmptyStringPool
|
||||
@@ -3028,17 +3009,7 @@ Free strings on server stop. Reset string pointer on 64 bits
|
||||
*/
|
||||
void SV_EmptyStringPool( void )
|
||||
{
|
||||
#ifdef XASH_64BIT
|
||||
if( str64.dynamic ) // switch only after array fill (more space for multiplayer games)
|
||||
str64.pstringbase = str64.pstringarray;
|
||||
else
|
||||
{
|
||||
str64.pstringbase = str64.poldstringbase = str64.pstringarraystatic;
|
||||
str64.plast = str64.pstringbase + 1;
|
||||
}
|
||||
#else
|
||||
Mem_EmptyPool( svgame.stringspool );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3052,23 +3023,8 @@ this helps not to lose strings that belongs to static game part
|
||||
*/
|
||||
void SV_SetStringArrayMode( qboolean dynamic )
|
||||
{
|
||||
#ifdef XASH_64BIT
|
||||
Con_Reportf( "%s(%d) %d\n", __func__, dynamic, str64.dynamic );
|
||||
|
||||
if( dynamic == str64.dynamic )
|
||||
return;
|
||||
|
||||
str64.dynamic = dynamic;
|
||||
|
||||
SV_EmptyStringPool();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if XASH_AMD64 && XASH_LINUX && !XASH_ANDROID
|
||||
#define USE_MMAP
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
==================
|
||||
SV_AllocStringPool
|
||||
@@ -3081,104 +3037,13 @@ this case need patched game dll with MAKE_STRING checking ptrdiff size
|
||||
*/
|
||||
static void SV_AllocStringPool( void )
|
||||
{
|
||||
#ifdef XASH_64BIT
|
||||
void *ptr = NULL;
|
||||
string lenstr;
|
||||
|
||||
Con_Reportf( "%s()\n", __func__ );
|
||||
if( Sys_GetParmFromCmdLine( "-str64alloc", lenstr ) )
|
||||
{
|
||||
str64.maxstringarray = Q_atoi( lenstr );
|
||||
if( str64.maxstringarray < 1024 || str64.maxstringarray >= INT_MAX )
|
||||
str64.maxstringarray = 65536;
|
||||
}
|
||||
else str64.maxstringarray = 65536;
|
||||
if( Sys_CheckParm( "-str64dup" ) )
|
||||
str64.allowdup = true;
|
||||
|
||||
#ifdef USE_MMAP
|
||||
{
|
||||
uint flags;
|
||||
size_t pagesize = sysconf( _SC_PAGESIZE );
|
||||
int arrlen = (str64.maxstringarray * 2) & ~(pagesize - 1);
|
||||
void *base = svgame.dllFuncs.pfnGameInit;
|
||||
void *start = svgame.hInstance - arrlen;
|
||||
|
||||
#if defined(MAP_ANON)
|
||||
flags = MAP_ANON | MAP_PRIVATE;
|
||||
#elif defined(MAP_ANONYMOUS)
|
||||
flags = MAP_ANONYMOUS | MAP_PRIVATE;
|
||||
#endif
|
||||
|
||||
while( start - base > INT_MIN )
|
||||
{
|
||||
void *mapptr = mmap((void*)((unsigned long)start & ~(pagesize - 1)), arrlen, PROT_READ | PROT_WRITE, flags, 0, 0 );
|
||||
if( mapptr && mapptr != (void*)-1 && mapptr - base > INT_MIN && mapptr - base < INT_MAX )
|
||||
{
|
||||
ptr = mapptr;
|
||||
break;
|
||||
}
|
||||
if( mapptr ) munmap( mapptr, arrlen );
|
||||
start -= arrlen;
|
||||
}
|
||||
|
||||
if( !ptr )
|
||||
{
|
||||
start = base;
|
||||
while( start - base < INT_MAX )
|
||||
{
|
||||
void *mapptr = mmap((void*)((unsigned long)start & ~(pagesize - 1)), arrlen, PROT_READ | PROT_WRITE, flags, 0, 0 );
|
||||
if( mapptr && mapptr != (void*)-1 && mapptr - base > INT_MIN && mapptr - base < INT_MAX )
|
||||
{
|
||||
ptr = mapptr;
|
||||
break;
|
||||
}
|
||||
if( mapptr ) munmap( mapptr, arrlen );
|
||||
start += arrlen;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( ptr )
|
||||
{
|
||||
Con_Reportf( "%s: Allocated string array near the server library: %p %p\n", __func__, base, ptr );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Con_Reportf( "%s: Failed to allocate string array near the server library!\n", __func__ );
|
||||
ptr = str64.staticstringarray = Mem_Calloc( host.mempool, str64.maxstringarray * 2 );
|
||||
}
|
||||
}
|
||||
#else
|
||||
ptr = str64.staticstringarray = Mem_Calloc( host.mempool, str64.maxstringarray * 2 );
|
||||
#endif
|
||||
|
||||
str64.pstringarray = ptr;
|
||||
str64.pstringarraystatic = (byte*)ptr + str64.maxstringarray;
|
||||
str64.pstringbase = str64.poldstringbase = ptr;
|
||||
str64.plast = (byte*)ptr + 1;
|
||||
svgame.globals->pStringBase = ptr;
|
||||
#else
|
||||
svgame.stringspool = Mem_AllocPool( "Server Strings" );
|
||||
svgame.globals->pStringBase = "";
|
||||
#endif
|
||||
}
|
||||
|
||||
static void SV_FreeStringPool( void )
|
||||
{
|
||||
#ifdef XASH_64BIT
|
||||
Con_Reportf( "%s()\n", __func__ );
|
||||
|
||||
#ifdef USE_MMAP
|
||||
if( str64.pstringarray != str64.staticstringarray )
|
||||
munmap( str64.pstringarray, (str64.maxstringarray * 2) & ~(sysconf( _SC_PAGESIZE ) - 1) );
|
||||
else
|
||||
#endif
|
||||
Mem_Free( str64.staticstringarray );
|
||||
#else
|
||||
Mem_FreePool( &svgame.stringspool );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3249,9 +3114,6 @@ string_t GAME_EXPORT SV_AllocString( const char *szValue )
|
||||
{
|
||||
char *newString = NULL;
|
||||
uint len;
|
||||
#ifdef XASH_64BIT
|
||||
int cmp;
|
||||
#endif
|
||||
|
||||
if( svgame.physFuncs.pfnAllocString != NULL )
|
||||
{
|
||||
@@ -3267,67 +3129,16 @@ string_t GAME_EXPORT SV_AllocString( const char *szValue )
|
||||
return i;
|
||||
}
|
||||
|
||||
#ifdef XASH_64BIT
|
||||
cmp = 1;
|
||||
|
||||
if( !str64.allowdup )
|
||||
{
|
||||
for( newString = str64.poldstringbase + 1;
|
||||
newString < str64.plast && ( cmp = Q_strcmp( newString, szValue ) );
|
||||
newString += Q_strlen( newString ) + 1 );
|
||||
}
|
||||
|
||||
if( cmp )
|
||||
{
|
||||
uint len = SV_ProcessString( NULL, szValue );
|
||||
|
||||
if( str64.plast - str64.poldstringbase + len + 1 > str64.maxstringarray )
|
||||
{
|
||||
str64.plast = str64.pstringbase + 1;
|
||||
str64.poldstringbase = str64.pstringbase;
|
||||
str64.numoverflows++;
|
||||
}
|
||||
|
||||
//MsgDev( D_NOTE, "SV_AllocString: %ld %s\n", str64.plast - svgame.globals->pStringBase, szValue );
|
||||
SV_ProcessString( str64.plast, szValue );
|
||||
str64.totalalloc += len;
|
||||
|
||||
newString = str64.plast;
|
||||
str64.plast += len;
|
||||
}
|
||||
else
|
||||
{
|
||||
str64.numdups++;
|
||||
//MsgDev( D_NOTE, "SV_AllocString: dup %ld %s\n", newString - svgame.globals->pStringBase, szValue );
|
||||
}
|
||||
|
||||
if( newString - str64.pstringarray > str64.maxalloc )
|
||||
str64.maxalloc = newString - str64.pstringarray;
|
||||
|
||||
return newString - svgame.globals->pStringBase;
|
||||
#else
|
||||
len = SV_ProcessString( NULL, szValue );
|
||||
newString = Mem_Malloc( svgame.stringspool, len );
|
||||
SV_ProcessString( newString, szValue );
|
||||
|
||||
return newString - svgame.globals->pStringBase;
|
||||
#endif
|
||||
}
|
||||
|
||||
void SV_PrintStr64Stats_f( void )
|
||||
{
|
||||
#ifdef XASH_64BIT
|
||||
Con_Printf( "====================\n" );
|
||||
Con_Printf( "64 bit string pool statistics\n" );
|
||||
Con_Printf( "====================\n" );
|
||||
Con_Printf( "string array size: %lu\n", str64.maxstringarray );
|
||||
Con_Printf( "total alloc %lu\n", str64.totalalloc );
|
||||
Con_Printf( "maximum array usage: %lu\n", str64.maxalloc );
|
||||
Con_Printf( "overflow counter: %lu\n", str64.numoverflows );
|
||||
Con_Printf( "dup string counter: %lu\n", str64.numdups );
|
||||
#else
|
||||
Con_Printf( "Not implemented\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3341,17 +3152,8 @@ string_t SV_MakeString( const char *szValue )
|
||||
{
|
||||
if( svgame.physFuncs.pfnMakeString != NULL )
|
||||
return svgame.physFuncs.pfnMakeString( szValue );
|
||||
#ifdef XASH_64BIT
|
||||
{
|
||||
long long ptrdiff = szValue - svgame.globals->pStringBase;
|
||||
if( ptrdiff > INT_MAX || ptrdiff < INT_MIN )
|
||||
return SV_AllocString(szValue);
|
||||
else
|
||||
return (int)ptrdiff;
|
||||
}
|
||||
#else
|
||||
|
||||
return szValue - svgame.globals->pStringBase;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -445,6 +445,9 @@ void R_GenerateVBO( void );
|
||||
void R_ClearVBO( void );
|
||||
void R_AddDecalVBO( decal_t *pdecal, msurface_t *surf );
|
||||
void R_LightmapCoord( const vec3_t v, const msurface_t *surf, const float sample_size, vec2_t coords );
|
||||
qboolean R_HasGeneratedVBO( void );
|
||||
void R_EnableVBO( qboolean enable );
|
||||
qboolean R_HasEnabledVBO( void );
|
||||
|
||||
//
|
||||
// gl_rpart.c
|
||||
@@ -494,10 +497,11 @@ void R_ClearSkyBox( void );
|
||||
void R_DrawSkyBox( void );
|
||||
void R_DrawClouds( void );
|
||||
void R_UnloadSkybox( void );
|
||||
void EmitWaterPolys( msurface_t *warp, qboolean reverse );
|
||||
void R_InitRipples( void );
|
||||
void R_ResetRipples( void );
|
||||
void R_AnimateRipples( void );
|
||||
float R_UploadRipples( texture_t *image );
|
||||
void R_UploadRipples( texture_t *image );
|
||||
|
||||
//#include "vid_common.h"
|
||||
|
||||
@@ -748,9 +752,6 @@ extern convar_t gl_test; // cvar to testify new effects
|
||||
extern convar_t gl_msaa;
|
||||
extern convar_t gl_stencilbits;
|
||||
extern convar_t gl_overbright;
|
||||
extern convar_t gl_litwater_force;
|
||||
extern convar_t gl_litwater_minlight;
|
||||
extern convar_t gl_litwater_scale;
|
||||
|
||||
extern convar_t r_lighting_extended;
|
||||
extern convar_t r_lighting_ambient;
|
||||
|
||||
@@ -20,9 +20,6 @@ CVAR_DEFINE_AUTO( gl_test, "0", 0, "engine developer cvar for quick testing new
|
||||
CVAR_DEFINE_AUTO( gl_msaa, "1", FCVAR_GLCONFIG, "enable or disable multisample anti-aliasing" );
|
||||
CVAR_DEFINE_AUTO( gl_stencilbits, "8", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "pixelformat stencil bits (0 - auto)" );
|
||||
CVAR_DEFINE_AUTO( gl_overbright, "1", FCVAR_GLCONFIG, "overbrights" );
|
||||
CVAR_DEFINE_AUTO( gl_litwater_force, "0", FCVAR_GLCONFIG, "force enable lightmapped water, even if support not declared in the map" );
|
||||
CVAR_DEFINE_AUTO( gl_litwater_minlight, "192", FCVAR_GLCONFIG, "minimal light water receives, helps avoid too dark lightmapped water" );
|
||||
CVAR_DEFINE_AUTO( gl_litwater_scale, "1.5", FCVAR_GLCONFIG, "lightmapped water scale factor" );
|
||||
CVAR_DEFINE_AUTO( r_lighting_extended, "1", FCVAR_GLCONFIG, "allow to get lighting from world and bmodels" );
|
||||
CVAR_DEFINE_AUTO( r_lighting_ambient, "0.3", FCVAR_GLCONFIG, "map ambient lighting scale" );
|
||||
CVAR_DEFINE_AUTO( r_detailtextures, "1", FCVAR_ARCHIVE, "enable detail textures support" );
|
||||
@@ -745,10 +742,8 @@ static void R_RenderInfo_f( void )
|
||||
gEngfuncs.Con_Printf( "GL4ES_VERSION: %s\n", version );
|
||||
if( extensions )
|
||||
gEngfuncs.Con_Reportf( "GL4ES_EXTENSIONS: %s\n", extensions );
|
||||
|
||||
}
|
||||
|
||||
|
||||
gEngfuncs.Con_Printf( "GL_MAX_TEXTURE_SIZE: %i\n", glConfig.max_2d_texture_size );
|
||||
|
||||
if( GL_Support( GL_ARB_MULTITEXTURE ))
|
||||
@@ -1153,6 +1148,10 @@ void GL_InitExtensions( void )
|
||||
gEngfuncs.Cvar_SetValue( "gl_finish", 1 );
|
||||
#endif
|
||||
|
||||
// we do not want to write vbo code that does not use multitexture
|
||||
if( !GL_Support( GL_ARB_VERTEX_BUFFER_OBJECT_EXT ) || !GL_Support( GL_ARB_MULTITEXTURE ) || glConfig.max_texture_units < 2 )
|
||||
gEngfuncs.Cvar_FullSet( "gl_vbo", "0", FCVAR_READ_ONLY );
|
||||
|
||||
R_RenderInfo_f();
|
||||
|
||||
tr.framecount = tr.visframecount = 1;
|
||||
@@ -1210,9 +1209,6 @@ static void GL_InitCommands( void )
|
||||
gEngfuncs.Cvar_RegisterVariable( &gl_stencilbits );
|
||||
gEngfuncs.Cvar_RegisterVariable( &gl_round_down );
|
||||
gEngfuncs.Cvar_RegisterVariable( &gl_overbright );
|
||||
gEngfuncs.Cvar_RegisterVariable( &gl_litwater_force );
|
||||
gEngfuncs.Cvar_RegisterVariable( &gl_litwater_minlight );
|
||||
gEngfuncs.Cvar_RegisterVariable( &gl_litwater_scale );
|
||||
|
||||
// these cvar not used by engine but some mods requires this
|
||||
gEngfuncs.Cvar_RegisterVariable( &gl_polyoffset );
|
||||
|
||||
@@ -1010,29 +1010,32 @@ void R_GammaChanged( qboolean do_reset_gamma )
|
||||
}
|
||||
}
|
||||
|
||||
static void R_CheckGamma( void )
|
||||
static void R_CheckCvars( void )
|
||||
{
|
||||
qboolean rebuild = false;
|
||||
|
||||
if( FBitSet( gl_overbright.flags, FCVAR_CHANGED ))
|
||||
{
|
||||
rebuild = true;
|
||||
ClearBits( gl_overbright.flags, FCVAR_CHANGED );
|
||||
rebuild = true;
|
||||
}
|
||||
|
||||
if( gl_overbright.value && FBitSet( r_vbo.flags|r_vbo_overbrightmode.flags, FCVAR_CHANGED ))
|
||||
if( FBitSet( r_vbo.flags, FCVAR_CHANGED ))
|
||||
{
|
||||
rebuild = true;
|
||||
ClearBits( r_vbo.flags, FCVAR_CHANGED );
|
||||
ClearBits( r_vbo_overbrightmode.flags, FCVAR_CHANGED );
|
||||
|
||||
R_EnableVBO( r_vbo.value ? true : false );
|
||||
if( R_HasEnabledVBO( ))
|
||||
R_GenerateVBO();
|
||||
|
||||
if( gl_overbright.value )
|
||||
rebuild = true;
|
||||
}
|
||||
|
||||
// we only recalculate lightmap on the fly if map hasn't declared support for lightmapped water
|
||||
if( !FBitSet( tr.world->flags, FWORLD_HAS_LITWATER ) && FBitSet( gl_litwater_scale.flags|gl_litwater_minlight.flags, FCVAR_CHANGED ))
|
||||
if( FBitSet( r_vbo_overbrightmode.flags, FCVAR_CHANGED ) && gl_overbright.value )
|
||||
{
|
||||
ClearBits( r_vbo_overbrightmode.flags, FCVAR_CHANGED );
|
||||
rebuild = true;
|
||||
ClearBits( gl_litwater_scale.flags, FCVAR_CHANGED );
|
||||
ClearBits( gl_litwater_minlight.flags, FCVAR_CHANGED );
|
||||
}
|
||||
|
||||
if( rebuild )
|
||||
@@ -1054,7 +1057,7 @@ void R_BeginFrame( qboolean clearScene )
|
||||
pglClear( GL_COLOR_BUFFER_BIT );
|
||||
}
|
||||
|
||||
R_CheckGamma();
|
||||
R_CheckCvars();
|
||||
|
||||
R_Set2DMode( true );
|
||||
|
||||
|
||||
@@ -147,7 +147,10 @@ void R_NewMap( void )
|
||||
}
|
||||
|
||||
GL_BuildLightmaps ();
|
||||
R_GenerateVBO();
|
||||
|
||||
R_ClearVBO();
|
||||
if( R_HasEnabledVBO( ))
|
||||
R_GenerateVBO();
|
||||
R_ResetRipples();
|
||||
|
||||
if( gEngfuncs.drawFuncs->R_NewMap != NULL )
|
||||
|
||||
@@ -229,10 +229,9 @@ void CL_DrawTracers( double frametime, particle_t *cl_active_tracers )
|
||||
VectorAdd( verts[0], delta, verts[2] );
|
||||
VectorAdd( verts[1], delta, verts[3] );
|
||||
|
||||
if( p->color > sizeof( gTracerColors ) / sizeof( gTracerColors[0] ))
|
||||
if( p->color < 0 || p->color > sizeof( gTracerColors ) / sizeof( gTracerColors[0] ))
|
||||
{
|
||||
gEngfuncs.Con_Printf( S_ERROR "UserTracer with color(%d) > %zu\n", p->color, sizeof( gTracerColors ) / sizeof( gTracerColors[0] ));
|
||||
p->color = 0;
|
||||
p->color = TRACER_COLORINDEX_DEFAULT;
|
||||
}
|
||||
|
||||
color = gTracerColors[p->color];
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
116
ref/gl/gl_warp.c
116
ref/gl/gl_warp.c
@@ -19,6 +19,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 int r_skyTexOrder[SKYBOX_MAX_SIDES] = { 0, 2, 1, 3, 4, 5 };
|
||||
|
||||
@@ -54,6 +55,12 @@ static const int vec_to_st[SKYBOX_MAX_SIDES][3] =
|
||||
{ -2, 1, -3 }
|
||||
};
|
||||
|
||||
// speed up sin calculations
|
||||
static float r_turbsin[] =
|
||||
{
|
||||
#include "warpsin.h"
|
||||
};
|
||||
|
||||
#define RIPPLES_CACHEWIDTH_BITS 7
|
||||
#define RIPPLES_CACHEWIDTH ( 1 << RIPPLES_CACHEWIDTH_BITS )
|
||||
#define RIPPLES_CACHEWIDTH_MASK (( RIPPLES_CACHEWIDTH ) - 1 )
|
||||
@@ -74,8 +81,10 @@ static struct
|
||||
uint32_t texture[RIPPLES_TEXSIZE];
|
||||
int gl_texturenum;
|
||||
int rippletexturenum;
|
||||
float texturescale; // not all textures are 128x128, scale the texcoords down
|
||||
} g_ripple;
|
||||
|
||||
|
||||
static void DrawSkyPolygon( int nump, vec3_t vecs )
|
||||
{
|
||||
int i, j, axis;
|
||||
@@ -549,6 +558,89 @@ void R_DrawClouds( void )
|
||||
pglFogf( GL_FOG_DENSITY, RI.fogDensity );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
EmitWaterPolys
|
||||
|
||||
Does a water warp on the pre-fragmented glpoly_t chain
|
||||
=============
|
||||
*/
|
||||
void EmitWaterPolys( msurface_t *warp, qboolean reverse )
|
||||
{
|
||||
float *v, nv, waveHeight;
|
||||
float s, t, os, ot;
|
||||
glpoly2_t *p;
|
||||
int i;
|
||||
|
||||
const qboolean useQuads = FBitSet( warp->flags, SURF_DRAWTURB_QUADS ) && glConfig.context == CONTEXT_TYPE_GL;
|
||||
|
||||
if( !warp->polys ) return;
|
||||
|
||||
// set the current waveheight
|
||||
if( warp->polys->verts[0][2] >= RI.vieworg[2] )
|
||||
waveHeight = -RI.currententity->curstate.scale;
|
||||
else waveHeight = RI.currententity->curstate.scale;
|
||||
|
||||
// reset fog color for nonlightmapped water
|
||||
GL_ResetFogColor();
|
||||
|
||||
if( useQuads )
|
||||
pglBegin( GL_QUADS );
|
||||
|
||||
for( p = warp->polys; p; p = p->next )
|
||||
{
|
||||
if( reverse )
|
||||
v = p->verts[0] + ( p->numverts - 1 ) * VERTEXSIZE;
|
||||
else v = p->verts[0];
|
||||
|
||||
if( !useQuads )
|
||||
pglBegin( GL_POLYGON );
|
||||
|
||||
for( i = 0; i < p->numverts; i++ )
|
||||
{
|
||||
if( waveHeight )
|
||||
{
|
||||
nv = r_turbsin[(int)(gp_cl->time * 160.0f + v[1] + v[0]) & 255] + 8.0f;
|
||||
nv = (r_turbsin[(int)(v[0] * 5.0f + gp_cl->time * 171.0f - v[1]) & 255] + 8.0f ) * 0.8f + nv;
|
||||
nv = nv * waveHeight + v[2];
|
||||
}
|
||||
else nv = v[2];
|
||||
|
||||
os = v[3];
|
||||
ot = v[4];
|
||||
|
||||
if( !r_ripple.value )
|
||||
{
|
||||
s = os + r_turbsin[(int)((ot * 0.125f + gp_cl->time) * TURBSCALE) & 255];
|
||||
t = ot + r_turbsin[(int)((os * 0.125f + gp_cl->time) * TURBSCALE) & 255];
|
||||
}
|
||||
else
|
||||
{
|
||||
s = os / g_ripple.texturescale;
|
||||
t = ot / g_ripple.texturescale;
|
||||
}
|
||||
|
||||
s *= ( 1.0f / SUBDIVIDE_SIZE );
|
||||
t *= ( 1.0f / SUBDIVIDE_SIZE );
|
||||
|
||||
pglTexCoord2f( s, t );
|
||||
pglVertex3f( v[0], v[1], nv );
|
||||
|
||||
if( reverse )
|
||||
v -= VERTEXSIZE;
|
||||
else v += VERTEXSIZE;
|
||||
}
|
||||
|
||||
if( !useQuads )
|
||||
pglEnd();
|
||||
}
|
||||
|
||||
if( useQuads )
|
||||
pglEnd();
|
||||
|
||||
GL_SetupFogColorForSurfaces();
|
||||
}
|
||||
|
||||
/*
|
||||
============================================================
|
||||
|
||||
@@ -658,39 +750,43 @@ void R_AnimateRipples( void )
|
||||
R_RunRipplesAnimation( g_ripple.oldbuf, g_ripple.curbuf );
|
||||
}
|
||||
|
||||
float R_UploadRipples( texture_t *image )
|
||||
void R_UploadRipples( texture_t *image )
|
||||
{
|
||||
gl_texture_t *glt;
|
||||
uint32_t *pixels;
|
||||
int wbits, wmask, wshft;
|
||||
int y;
|
||||
float texturescale;
|
||||
|
||||
// discard unuseful textures
|
||||
if( !r_ripple.value || image->width > RIPPLES_CACHEWIDTH || image->width != image->height )
|
||||
{
|
||||
GL_Bind( XASH_TEXTURE0, image->gl_texturenum );
|
||||
return 0.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
glt = R_GetTexture( image->gl_texturenum );
|
||||
if( !glt || !glt->original || !glt->original->buffer || !FBitSet( glt->flags, TF_EXPAND_SOURCE ))
|
||||
{
|
||||
GL_Bind( XASH_TEXTURE0, image->gl_texturenum );
|
||||
return 0.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
GL_Bind( XASH_TEXTURE0, g_ripple.rippletexturenum );
|
||||
|
||||
if( r_ripple.value == 1.0f )
|
||||
texturescale = Q_max( 1.0f, image->width / 64.0f );
|
||||
else texturescale = 1.0f;
|
||||
|
||||
// no updates this frame
|
||||
if( !g_ripple.update && image->gl_texturenum == g_ripple.gl_texturenum )
|
||||
return texturescale;
|
||||
return;
|
||||
|
||||
g_ripple.gl_texturenum = image->gl_texturenum;
|
||||
if( r_ripple.value == 1.0f )
|
||||
{
|
||||
g_ripple.texturescale = Q_max( 1.0f, image->width / 64.0f );
|
||||
}
|
||||
else
|
||||
{
|
||||
g_ripple.texturescale = 1.0f;
|
||||
}
|
||||
|
||||
|
||||
pixels = (uint32_t *)glt->original->buffer;
|
||||
wbits = MostSignificantBit( image->width );
|
||||
@@ -717,6 +813,4 @@ float R_UploadRipples( texture_t *image )
|
||||
|
||||
pglTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, image->width, image->width, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, g_ripple.texture );
|
||||
|
||||
return texturescale;
|
||||
}
|
||||
|
||||
@@ -236,10 +236,9 @@ void GAME_EXPORT CL_DrawTracers( double frametime, particle_t *cl_active_tracers
|
||||
VectorAdd( verts[0], delta, verts[2] );
|
||||
VectorAdd( verts[1], delta, verts[3] );
|
||||
|
||||
if( p->color > sizeof( gTracerColors ) / sizeof( gTracerColors[0] ))
|
||||
if( p->color < 0 || p->color > sizeof( gTracerColors ) / sizeof( gTracerColors[0] ))
|
||||
{
|
||||
gEngfuncs.Con_Printf( S_ERROR "UserTracer with color(%d) > %zu\n", p->color, sizeof( gTracerColors ) / sizeof( gTracerColors[0] ));
|
||||
p->color = 0;
|
||||
p->color = TRACER_COLORINDEX_DEFAULT;
|
||||
}
|
||||
|
||||
color = gTracerColors[p->color];
|
||||
|
||||
@@ -27,7 +27,7 @@ WINSDK_LATEST=$(ls -1 "C:/Program Files (x86)/Windows Kits/10/bin" | grep -E '^1
|
||||
echo "Latest installed Windows SDK is $WINSDK_LATEST"
|
||||
|
||||
"C:/Program Files (x86)/Windows Kits/10/bin/$WINSDK_LATEST/x64/signtool.exe" \
|
||||
/f scripts/fwgs.pfx /fd SHA256 /p "$FWGS_PFX_PASSWORD" *.dll *.exe
|
||||
sign //f scripts/fwgs.pfx //fd SHA256 //p "$FWGS_PFX_PASSWORD" *.dll *.exe
|
||||
|
||||
if [ "$ARCH" = "i386" ]; then # VGUI is already signed
|
||||
cp 3rdparty/vgui_support/vgui-dev/lib/win32_vc6/vgui.dll .
|
||||
|
||||
Reference in New Issue
Block a user