mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 19:45:05 +08:00
Compare commits
43 Commits
continuous
...
continuous
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd969f3594 | ||
|
|
fb87d7c0b3 | ||
|
|
a69fc87940 | ||
|
|
e481e1d73e | ||
|
|
6c0eed1b2b | ||
|
|
a6c67fdf9f | ||
|
|
03f838e37e | ||
|
|
e21fa4a910 | ||
|
|
46889ed453 | ||
|
|
882fcc152c | ||
|
|
a41902bd46 | ||
|
|
a6af32dafd | ||
|
|
d6dfb83be7 | ||
|
|
597429cf41 | ||
|
|
5ea074a1fd | ||
|
|
29c9393da3 | ||
|
|
bf6829189e | ||
|
|
a62a9429c9 | ||
|
|
f2c080e736 | ||
|
|
ea55e78855 | ||
|
|
f7c536b81c | ||
|
|
6c40104c66 | ||
|
|
4d7d592918 | ||
|
|
c5e91f299b | ||
|
|
cff276db71 | ||
|
|
30d1492b93 | ||
|
|
f07eea5073 | ||
|
|
fe407fbe00 | ||
|
|
78bc177e05 | ||
|
|
8fb908e3d4 | ||
|
|
d8b261370a | ||
|
|
a2c9ac5b1f | ||
|
|
7f9025e178 | ||
|
|
8647110a10 | ||
|
|
48e44f0057 | ||
|
|
e3934af7d1 | ||
|
|
a5ee631191 | ||
|
|
ce39255ef0 | ||
|
|
5aac5d2a52 | ||
|
|
061b50404d | ||
|
|
279cec5ae9 | ||
|
|
83a5648335 | ||
|
|
a8fc9a4c5a |
2
3rdparty/mainui
vendored
2
3rdparty/mainui
vendored
Submodule 3rdparty/mainui updated: adb3e413ec...e456555cf1
24
Documentation/donate.md
Normal file
24
Documentation/donate.md
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Developers donation page
|
||||||
|
|
||||||
|
On this page you can find links where you can support each developer individually, who has provided public sponsorship information.
|
||||||
|
|
||||||
|
### [a1batross](https://github.com/a1batross)
|
||||||
|
|
||||||
|
* Initial Xash3D SDL2/Linux port author, Xash3D FWGS engine maintainer, creator of non-commercial Flying With Gauss organization.
|
||||||
|
* Boosty page: https://boosty.to/a1ba
|
||||||
|
|
||||||
|
### [nekonomicon](https://github.com/nekonomicon)
|
||||||
|
|
||||||
|
* [hlsdk-portable](https://github.com/FWGS/hlsdk-portable), [mdldec](../utils/mdldec), [opensource-mods.md](opensource-mods.md) maintainer and Xash3D FWGS [contributor](https://github.com/FWGS/xash3d-fwgs/commits?author=nekonomicon) (*BSD/clang port, PNG support, etc).
|
||||||
|
* Boosty page: https://boosty.to/nekonomicon
|
||||||
|
|
||||||
|
### [Velaron](https://github.com/Velaron)
|
||||||
|
* [cs16-client](https://github.com/Velaron/cs16-client) & [tf15-client](https://github.com/Velaron/tf15-client) maintainer and Xash3D FWGS [contributor](https://github.com/FWGS/xash3d-fwgs/commits?author=Velaron) (Android port, voice chat, etc).
|
||||||
|
* BuyMeACoffee page: https://www.buymeacoffee.com/velaron
|
||||||
|
|
||||||
|
### [SNMetamorph](https://github.com/SNMetamorph)
|
||||||
|
* [PrimeXT](https://github.com/SNMetamorph/PrimeXT) & [GoldSrc Monitor](https://github.com/SNMetamorph/goldsrc-monitor) maintainer and Xash3D FWGS [contributor](https://github.com/FWGS/xash3d-fwgs/commits?author=SNMetamorph) (Windows port, voice chat, etc).
|
||||||
|
* BTC: `16GAzK3qei5AwBW7sggXp3yNcFHBtdpxXj`
|
||||||
|
* ETH (ERC20): `0xb580eeca9756e3881f9d6d026e28db28eb72a383`
|
||||||
|
* USDT (ERC20): `0xb580eeca9756e3881f9d6d026e28db28eb72a383`
|
||||||
|
* USDC (ERC20): `0xb580eeca9756e3881f9d6d026e28db28eb72a383`
|
||||||
40
README.md
40
README.md
@@ -1,33 +1,27 @@
|
|||||||
# Xash3D FWGS Engine
|
# Xash3D FWGS Engine <img align="right" width="128" height="128" src="https://github.com/FWGS/xash3d-fwgs/raw/master/game_launch/icon-xash-material.png" alt="Xash3D FWGS icon" />
|
||||||
[](https://github.com/FWGS/xash3d-fwgs/actions/workflows/c-cpp.yml) [](https://cirrus-ci.com/github/FWGS/xash3d-fwgs) [](http://fwgsdiscord.mentality.rip/) \
|
[](https://github.com/FWGS/xash3d-fwgs/actions/workflows/c-cpp.yml) [](https://cirrus-ci.com/github/FWGS/xash3d-fwgs) [](http://fwgsdiscord.mentality.rip/) \
|
||||||
[](https://github.com/FWGS/xash3d-fwgs/releases/latest) [](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous)
|
[](https://github.com/FWGS/xash3d-fwgs/releases/latest) [](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous)
|
||||||
|
|
||||||
Xash3D FWGS is a fork of Xash3D Engine by Unkle Mike with extended features and crossplatform.
|
Xash3D FWGS is a game engine, aimed to provide compatibility with Half-Life Engine and extend it, as well as to give game developers well known workflow.
|
||||||
|
|
||||||
```
|
Xash3D FWGS is a heavily modified fork of an original [Xash3D Engine](https://www.moddb.com/engines/xash3d-engine) by Unkle Mike.
|
||||||
Xash3D is a game engine, aimed to provide compatibility with Half-Life Engine,
|
|
||||||
as well as to give game developers well known workflow and extend it.
|
## Donate
|
||||||
Read more about Xash3D on ModDB: https://www.moddb.com/engines/xash3d-engine
|
[](Documentation/donate.md) \
|
||||||
```
|
If you like Xash3D FWGS, consider supporting individual engine maintainers. By supporting us, you help to continue developing this game engine further. The sponsorship links are available in [documentation](Documentation/donate.md).
|
||||||
|
|
||||||
## Fork features
|
## Fork features
|
||||||
* HLSDK 2.4 support.
|
* Steam Half-Life (HLSDK 2.4) support.
|
||||||
* Crossplatform: supported x86 and ARM on Windows/Linux/BSD/Android. ([see docs for more info](Documentation/ports.md))
|
* Crossplatform and modern compilers support: supports Windows, Linux, BSD & Android on x86 & ARM and [many more](Documentation/ports.md).
|
||||||
* Modern compilers support: say no more to MSVC6.
|
* Better multiplayer support: multiple master servers, headless dedicated server, voice chat and IPv6 support.
|
||||||
* Better multiplayer support: multiple master servers, headless dedicated server.
|
* Multiple renderers support: OpenGL, GLESv1, GLESv2 and Software.
|
||||||
* Mobility API: allows better game integration on mobile devices(vibration, touch controls)
|
* Advanced virtual filesystem: `.pk3` and `.pk3dir` support, compatibility with GoldSrc FS module, fast case-insensitivity emulation for crossplatform.
|
||||||
* Different input methods: touch, gamepad and classic mouse & keyboard.
|
* Mobility API: better game integration on mobile devices (vibration, touch controls)
|
||||||
|
* Different input methods: touch and gamepad in addition to mouse & keyboard.
|
||||||
* TrueType font rendering, as a part of mainui_cpp.
|
* TrueType font rendering, as a part of mainui_cpp.
|
||||||
* Multiple renderers support: OpenGL, GLESv1, GLESv2, Software.
|
* External VGUI support module.
|
||||||
* Voice support.
|
* PNG & KTX2 image format support.
|
||||||
* External filesystem module like in GoldSrc engine.
|
* [A set of small improvements](Documentation/), without broken compatibility.
|
||||||
* External vgui support module.
|
|
||||||
* PNG image format support.
|
|
||||||
* A set of small improvements, without broken compatibility.
|
|
||||||
|
|
||||||
## Planned fork features
|
|
||||||
* Virtual Reality support and game API.
|
|
||||||
* Vulkan renderer.
|
|
||||||
|
|
||||||
## Installation & Running
|
## Installation & Running
|
||||||
0) Get Xash3D FWGS binaries: you can use [testing](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous) build or you can compile engine from source code.
|
0) Get Xash3D FWGS binaries: you can use [testing](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous) build or you can compile engine from source code.
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ typedef uint64_t longtime_t;
|
|||||||
#define MAX_USERMSG_LENGTH 2048 // don't modify it's relies on a client-side definitions
|
#define MAX_USERMSG_LENGTH 2048 // don't modify it's relies on a client-side definitions
|
||||||
|
|
||||||
#define BIT( n ) ( 1U << ( n ))
|
#define BIT( n ) ( 1U << ( n ))
|
||||||
|
#define BIT64( n ) ( 1ULL << ( n ))
|
||||||
#define GAMMA ( 2.2f ) // Valve Software gamma
|
#define GAMMA ( 2.2f ) // Valve Software gamma
|
||||||
#define INVGAMMA ( 1.0f / 2.2f ) // back to 1.0
|
#define INVGAMMA ( 1.0f / 2.2f ) // back to 1.0
|
||||||
#define TEXGAMMA ( 0.9f ) // compensate dim textures
|
#define TEXGAMMA ( 0.9f ) // compensate dim textures
|
||||||
@@ -180,6 +181,7 @@ typedef struct dll_info_s
|
|||||||
} dll_info_t;
|
} dll_info_t;
|
||||||
|
|
||||||
typedef void (*setpair_t)( const char *key, const void *value, const void *buffer, void *numpairs );
|
typedef void (*setpair_t)( const char *key, const void *value, const void *buffer, void *numpairs );
|
||||||
|
typedef void *(*pfnCreateInterface_t)( const char *, int * );
|
||||||
|
|
||||||
// config strings are a general means of communication from
|
// config strings are a general means of communication from
|
||||||
// the server to all connected clients.
|
// the server to all connected clients.
|
||||||
|
|||||||
@@ -982,28 +982,21 @@ pfnCheckGameDll
|
|||||||
*/
|
*/
|
||||||
int GAME_EXPORT pfnCheckGameDll( void )
|
int GAME_EXPORT pfnCheckGameDll( void )
|
||||||
{
|
{
|
||||||
string dllpath;
|
#ifdef XASH_INTERNAL_GAMELIBS
|
||||||
void *hInst;
|
|
||||||
|
|
||||||
#if TARGET_OS_IPHONE
|
|
||||||
// loading server library drains too many ram
|
|
||||||
// so 512MB iPod Touch cannot even connect to
|
|
||||||
// to servers in cstrike
|
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#else
|
||||||
|
string dllpath;
|
||||||
|
|
||||||
if( svgame.hInstance )
|
if( svgame.hInstance )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
COM_GetCommonLibraryPath( LIBRARY_SERVER, dllpath, sizeof( dllpath ));
|
COM_GetCommonLibraryPath( LIBRARY_SERVER, dllpath, sizeof( dllpath ));
|
||||||
|
|
||||||
if(( hInst = COM_LoadLibrary( dllpath, true, false )) != NULL )
|
if( FS_FileExists( dllpath, false ))
|
||||||
{
|
|
||||||
COM_FreeLibrary( hInst ); // don't increase linker's reference counter
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
Con_Reportf( S_WARN "Could not load server library: %s\n", COM_GetLibraryError() );
|
|
||||||
return false;
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ GNU General Public License for more details.
|
|||||||
CVAR_DEFINE_AUTO( mp_decals, "300", FCVAR_ARCHIVE, "decals limit in multiplayer" );
|
CVAR_DEFINE_AUTO( mp_decals, "300", FCVAR_ARCHIVE, "decals limit in multiplayer" );
|
||||||
CVAR_DEFINE_AUTO( dev_overview, "0", 0, "draw level in overview-mode" );
|
CVAR_DEFINE_AUTO( dev_overview, "0", 0, "draw level in overview-mode" );
|
||||||
CVAR_DEFINE_AUTO( cl_resend, "6.0", 0, "time to resend connect" );
|
CVAR_DEFINE_AUTO( cl_resend, "6.0", 0, "time to resend connect" );
|
||||||
CVAR_DEFINE_AUTO( cl_allow_download, "1", FCVAR_ARCHIVE, "allow to downloading resources from the server" );
|
CVAR_DEFINE( cl_allow_download, "cl_allowdownload", "1", FCVAR_ARCHIVE, "allow to downloading resources from the server" );
|
||||||
CVAR_DEFINE_AUTO( cl_allow_upload, "1", FCVAR_ARCHIVE, "allow to uploading resources to the server" );
|
CVAR_DEFINE_AUTO( cl_allow_upload, "1", FCVAR_ARCHIVE, "allow to uploading resources to the server" );
|
||||||
CVAR_DEFINE_AUTO( cl_download_ingame, "1", FCVAR_ARCHIVE, "allow to downloading resources while client is active" );
|
CVAR_DEFINE_AUTO( cl_download_ingame, "1", FCVAR_ARCHIVE, "allow to downloading resources while client is active" );
|
||||||
CVAR_DEFINE_AUTO( cl_logofile, "lambda", FCVAR_ARCHIVE, "player logo name" );
|
CVAR_DEFINE_AUTO( cl_logofile, "lambda", FCVAR_ARCHIVE, "player logo name" );
|
||||||
|
|||||||
@@ -87,15 +87,6 @@ static int pfnDrawScaledCharacter( int x, int y, int number, int r, int g, int b
|
|||||||
return CL_DrawCharacter( x, y, number, color, &g_scaled_font, flags );
|
return CL_DrawCharacter( x, y, number, color, &g_scaled_font, flags );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *pfnGetNativeObject( const char *obj )
|
|
||||||
{
|
|
||||||
if( !obj )
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
// Backend should consider that obj is case-sensitive
|
|
||||||
return Platform_GetNativeObject( obj );
|
|
||||||
}
|
|
||||||
|
|
||||||
static void pfnTouch_HideButtons( const char *name, byte state )
|
static void pfnTouch_HideButtons( const char *name, byte state )
|
||||||
{
|
{
|
||||||
Touch_HideButtons( name, state, true );
|
Touch_HideButtons( name, state, true );
|
||||||
@@ -124,7 +115,7 @@ static mobile_engfuncs_t gpMobileEngfuncs =
|
|||||||
Touch_ResetDefaultButtons,
|
Touch_ResetDefaultButtons,
|
||||||
pfnDrawScaledCharacter,
|
pfnDrawScaledCharacter,
|
||||||
Sys_Warn,
|
Sys_Warn,
|
||||||
pfnGetNativeObject,
|
Sys_GetNativeObject,
|
||||||
ID_SetCustomClientID,
|
ID_SetCustomClientID,
|
||||||
pfnParseFileSafe
|
pfnParseFileSafe
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -659,7 +659,7 @@ static void make_hull_windings( hull_t *hull, hull_model_t *model )
|
|||||||
Con_Reportf( "%i hull polys\n", model->num_polys );
|
Con_Reportf( "%i hull polys\n", model->num_polys );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mod_InitDebugHulls( void )
|
void Mod_InitDebugHulls( model_t *loadmodel )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ CVAR_DEFINE_AUTO( gl_msaa_samples, "0", FCVAR_GLCONFIG, "samples number for mult
|
|||||||
CVAR_DEFINE_AUTO( gl_clear, "0", FCVAR_ARCHIVE, "clearing screen after each frame" );
|
CVAR_DEFINE_AUTO( gl_clear, "0", FCVAR_ARCHIVE, "clearing screen after each frame" );
|
||||||
CVAR_DEFINE_AUTO( r_showtree, "0", FCVAR_ARCHIVE, "build the graph of visible BSP tree" );
|
CVAR_DEFINE_AUTO( r_showtree, "0", FCVAR_ARCHIVE, "build the graph of visible BSP tree" );
|
||||||
static CVAR_DEFINE_AUTO( r_refdll, "", FCVAR_RENDERINFO, "choose renderer implementation, if supported" );
|
static CVAR_DEFINE_AUTO( r_refdll, "", FCVAR_RENDERINFO, "choose renderer implementation, if supported" );
|
||||||
|
static CVAR_DEFINE_AUTO( r_refdll_loaded, "", FCVAR_READ_ONLY, "currently loaded renderer" );
|
||||||
|
|
||||||
void R_GetTextureParms( int *w, int *h, int texnum )
|
void R_GetTextureParms( int *w, int *h, int texnum )
|
||||||
{
|
{
|
||||||
@@ -98,16 +99,6 @@ static void *pfnMod_Extradata( int type, model_t *m )
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static model_t *pfnMod_GetCurrentLoadingModel( void )
|
|
||||||
{
|
|
||||||
return loadmodel;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void pfnMod_SetCurrentLoadingModel( model_t *m )
|
|
||||||
{
|
|
||||||
loadmodel = m;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void pfnGetPredictedOrigin( vec3_t v )
|
static void pfnGetPredictedOrigin( vec3_t v )
|
||||||
{
|
{
|
||||||
VectorCopy( cl.simorg, v );
|
VectorCopy( cl.simorg, v );
|
||||||
@@ -282,8 +273,6 @@ static ref_api_t gEngfuncs =
|
|||||||
Mod_ForName,
|
Mod_ForName,
|
||||||
pfnMod_Extradata,
|
pfnMod_Extradata,
|
||||||
CL_ModelHandle,
|
CL_ModelHandle,
|
||||||
pfnMod_GetCurrentLoadingModel,
|
|
||||||
pfnMod_SetCurrentLoadingModel,
|
|
||||||
|
|
||||||
CL_GetRemapInfoForEntity,
|
CL_GetRemapInfoForEntity,
|
||||||
CL_AllocRemapInfo,
|
CL_AllocRemapInfo,
|
||||||
@@ -531,6 +520,7 @@ static qboolean R_LoadRenderer( const char *refopt )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Cvar_FullSet( "r_refdll_loaded", refopt, FCVAR_READ_ONLY );
|
||||||
Con_Reportf( "Renderer %s initialized\n", refdll );
|
Con_Reportf( "Renderer %s initialized\n", refdll );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -622,6 +612,7 @@ qboolean R_Init( void )
|
|||||||
Cvar_RegisterVariable( &gl_clear );
|
Cvar_RegisterVariable( &gl_clear );
|
||||||
Cvar_RegisterVariable( &r_showtree );
|
Cvar_RegisterVariable( &r_showtree );
|
||||||
Cvar_RegisterVariable( &r_refdll );
|
Cvar_RegisterVariable( &r_refdll );
|
||||||
|
Cvar_RegisterVariable( &r_refdll_loaded );
|
||||||
|
|
||||||
// cvars that are expected to exist
|
// cvars that are expected to exist
|
||||||
Cvar_Get( "r_speeds", "0", FCVAR_ARCHIVE, "shows renderer speeds" );
|
Cvar_Get( "r_speeds", "0", FCVAR_ARCHIVE, "shows renderer speeds" );
|
||||||
|
|||||||
@@ -381,6 +381,7 @@ typedef void (*xcommand_t)( void );
|
|||||||
qboolean FS_LoadProgs( void );
|
qboolean FS_LoadProgs( void );
|
||||||
void FS_Init( void );
|
void FS_Init( void );
|
||||||
void FS_Shutdown( void );
|
void FS_Shutdown( void );
|
||||||
|
void *FS_GetNativeObject( const char *obj );
|
||||||
|
|
||||||
//
|
//
|
||||||
// cmd.c
|
// cmd.c
|
||||||
@@ -747,8 +748,6 @@ void SV_ShutdownGame( void );
|
|||||||
void SV_ExecLoadLevel( void );
|
void SV_ExecLoadLevel( void );
|
||||||
void SV_ExecLoadGame( void );
|
void SV_ExecLoadGame( void );
|
||||||
void SV_ExecChangeLevel( void );
|
void SV_ExecChangeLevel( void );
|
||||||
qboolean SV_InitGameProgs( void );
|
|
||||||
void SV_FreeGameProgs( void );
|
|
||||||
void CL_WriteMessageHistory( void );
|
void CL_WriteMessageHistory( void );
|
||||||
void CL_SendCmd( void );
|
void CL_SendCmd( void );
|
||||||
void CL_Disconnect( void );
|
void CL_Disconnect( void );
|
||||||
|
|||||||
@@ -1423,15 +1423,11 @@ save serverinfo variables into server.cfg (using for dedicated server too)
|
|||||||
*/
|
*/
|
||||||
void GAME_EXPORT Host_WriteServerConfig( const char *name )
|
void GAME_EXPORT Host_WriteServerConfig( const char *name )
|
||||||
{
|
{
|
||||||
qboolean already_loaded;
|
|
||||||
file_t *f;
|
file_t *f;
|
||||||
string newconfigfile;
|
string newconfigfile;
|
||||||
|
|
||||||
Q_snprintf( newconfigfile, MAX_STRING, "%s.new", name );
|
Q_snprintf( newconfigfile, MAX_STRING, "%s.new", name );
|
||||||
|
|
||||||
// TODO: remove this mechanism, make it safer for now
|
|
||||||
already_loaded = SV_InitGameProgs(); // collect user variables
|
|
||||||
|
|
||||||
// FIXME: move this out until menu parser is done
|
// FIXME: move this out until menu parser is done
|
||||||
CSCR_LoadDefaultCVars( "settings.scr" );
|
CSCR_LoadDefaultCVars( "settings.scr" );
|
||||||
|
|
||||||
@@ -1448,10 +1444,6 @@ void GAME_EXPORT Host_WriteServerConfig( const char *name )
|
|||||||
Host_FinalizeConfig( f, name );
|
Host_FinalizeConfig( f, name );
|
||||||
}
|
}
|
||||||
else Con_DPrintf( S_ERROR "Couldn't write %s.\n", name );
|
else Con_DPrintf( S_ERROR "Couldn't write %s.\n", name );
|
||||||
|
|
||||||
// don't unload library that wasn't loaded by us
|
|
||||||
if( !already_loaded )
|
|
||||||
SV_FreeGameProgs(); // release progs with all variables
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -23,8 +23,17 @@ GNU General Public License for more details.
|
|||||||
fs_api_t g_fsapi;
|
fs_api_t g_fsapi;
|
||||||
fs_globals_t *FI;
|
fs_globals_t *FI;
|
||||||
|
|
||||||
|
static pfnCreateInterface_t fs_pfnCreateInterface;
|
||||||
static HINSTANCE fs_hInstance;
|
static HINSTANCE fs_hInstance;
|
||||||
|
|
||||||
|
void *FS_GetNativeObject( const char *obj )
|
||||||
|
{
|
||||||
|
if( fs_pfnCreateInterface )
|
||||||
|
return fs_pfnCreateInterface( obj, NULL );
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void FS_Rescan_f( void )
|
static void FS_Rescan_f( void )
|
||||||
{
|
{
|
||||||
FS_Rescan();
|
FS_Rescan();
|
||||||
@@ -53,7 +62,7 @@ static fs_interface_t fs_memfuncs =
|
|||||||
_Mem_Realloc,
|
_Mem_Realloc,
|
||||||
_Mem_Free,
|
_Mem_Free,
|
||||||
|
|
||||||
Platform_GetNativeObject,
|
Sys_GetNativeObject,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void FS_UnloadProgs( void )
|
static void FS_UnloadProgs( void )
|
||||||
@@ -98,6 +107,13 @@ qboolean FS_LoadProgs( void )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !( fs_pfnCreateInterface = (pfnCreateInterface_t)COM_GetProcAddress( fs_hInstance, "CreateInterface" )))
|
||||||
|
{
|
||||||
|
FS_UnloadProgs();
|
||||||
|
Host_Error( "FS_LoadProgs: can't find CreateInterface entry point in %s\n", name );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Con_DPrintf( "FS_LoadProgs: filesystem_stdio successfully loaded\n" );
|
Con_DPrintf( "FS_LoadProgs: filesystem_stdio successfully loaded\n" );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ GNU General Public License for more details.
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "base_cmd.h"
|
#include "base_cmd.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
#include "server.h"
|
||||||
#include "netchan.h"
|
#include "netchan.h"
|
||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
#include "mod_local.h"
|
#include "mod_local.h"
|
||||||
@@ -1017,10 +1018,11 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if TARGET_OS_IOS
|
#if TARGET_OS_IOS
|
||||||
const char *IOS_GetDocsDir();
|
Q_strncpy( host.rootdir, IOS_GetDocsDir(), sizeof( host.rootdir ));
|
||||||
Q_strncpy( host.rootdir, IOS_GetDocsDir(), sizeof(host.rootdir) );
|
#elif XASH_ANDROID && XASH_SDL
|
||||||
|
Q_strncpy( host.rootdir, SDL_AndroidGetExternalStoragePath(), sizeof( host.rootdir ));
|
||||||
#elif XASH_PSVITA
|
#elif XASH_PSVITA
|
||||||
if ( !PSVita_GetBasePath( host.rootdir, sizeof( host.rootdir ) ) )
|
if ( !PSVita_GetBasePath( host.rootdir, sizeof( host.rootdir )))
|
||||||
{
|
{
|
||||||
Sys_Error( "couldn't find xash3d data directory" );
|
Sys_Error( "couldn't find xash3d data directory" );
|
||||||
host.rootdir[0] = 0;
|
host.rootdir[0] = 0;
|
||||||
@@ -1307,6 +1309,7 @@ void EXPORT Host_Shutdown( void )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
SV_Shutdown( "Server shutdown\n" );
|
SV_Shutdown( "Server shutdown\n" );
|
||||||
|
SV_UnloadProgs();
|
||||||
SV_ShutdownFilter();
|
SV_ShutdownFilter();
|
||||||
CL_Shutdown();
|
CL_Shutdown();
|
||||||
|
|
||||||
|
|||||||
@@ -23,15 +23,6 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
#if XASH_EMSCRIPTEN
|
#if XASH_EMSCRIPTEN
|
||||||
#include <emscripten.h>
|
#include <emscripten.h>
|
||||||
#elif XASH_WIN32
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
// Enable NVIDIA High Performance Graphics while using Integrated Graphics.
|
|
||||||
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
|
||||||
|
|
||||||
// Enable AMD High Performance Graphics while using Integrated Graphics.
|
|
||||||
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define E_GAME "XASH3D_GAME" // default env dir to start from
|
#define E_GAME "XASH3D_GAME" // default env dir to start from
|
||||||
@@ -39,6 +30,10 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
|
|||||||
#define XASH_GAMEDIR "valve"
|
#define XASH_GAMEDIR "valve"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if XASH_WIN32
|
||||||
|
#error "Single-binary or dedicated builds aren't supported for Windows!"
|
||||||
|
#endif
|
||||||
|
|
||||||
static char szGameDir[128]; // safe place to keep gamedir
|
static char szGameDir[128]; // safe place to keep gamedir
|
||||||
static int szArgc;
|
static int szArgc;
|
||||||
static char **szArgv;
|
static char **szArgv;
|
||||||
@@ -47,7 +42,7 @@ static void Sys_ChangeGame( const char *progname )
|
|||||||
{
|
{
|
||||||
// a1ba: may never be called within engine
|
// a1ba: may never be called within engine
|
||||||
// if platform supports execv() function
|
// if platform supports execv() function
|
||||||
Q_strncpy( szGameDir, progname, sizeof( szGameDir ) - 1 );
|
Q_strncpy( szGameDir, progname, sizeof( szGameDir ));
|
||||||
Host_Shutdown( );
|
Host_Shutdown( );
|
||||||
exit( Host_Main( szArgc, szArgv, szGameDir, 1, &Sys_ChangeGame ) );
|
exit( Host_Main( szArgc, szArgv, szGameDir, 1, &Sys_ChangeGame ) );
|
||||||
}
|
}
|
||||||
@@ -88,7 +83,6 @@ _inline int Sys_Start( void )
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !XASH_WIN32
|
|
||||||
int main( int argc, char **argv )
|
int main( int argc, char **argv )
|
||||||
{
|
{
|
||||||
#if XASH_PSVITA
|
#if XASH_PSVITA
|
||||||
@@ -100,36 +94,4 @@ int main( int argc, char **argv )
|
|||||||
#endif // XASH_PSVITA
|
#endif // XASH_PSVITA
|
||||||
return Sys_Start();
|
return Sys_Start();
|
||||||
}
|
}
|
||||||
#else
|
#endif // SINGLE_BINARY
|
||||||
int __stdcall WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdLine, int nShow)
|
|
||||||
{
|
|
||||||
LPWSTR* lpArgv;
|
|
||||||
int ret, i;
|
|
||||||
|
|
||||||
lpArgv = CommandLineToArgvW( GetCommandLineW(), &szArgc );
|
|
||||||
szArgv = ( char** )malloc( (szArgc + 1) * sizeof( char* ));
|
|
||||||
|
|
||||||
for( i = 0; i < szArgc; ++i )
|
|
||||||
{
|
|
||||||
size_t size = wcslen(lpArgv[i]) + 1;
|
|
||||||
|
|
||||||
// just in case, allocate some more memory
|
|
||||||
szArgv[i] = ( char * )malloc( size * sizeof( wchar_t ));
|
|
||||||
wcstombs( szArgv[i], lpArgv[i], size );
|
|
||||||
}
|
|
||||||
szArgv[szArgc] = 0;
|
|
||||||
|
|
||||||
LocalFree( lpArgv );
|
|
||||||
|
|
||||||
ret = Sys_Start();
|
|
||||||
|
|
||||||
for( ; i < szArgc; ++i )
|
|
||||||
free( szArgv[i] );
|
|
||||||
free( szArgv );
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#endif // XASH_WIN32
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -118,7 +118,6 @@ typedef struct world_static_s
|
|||||||
#ifndef REF_DLL
|
#ifndef REF_DLL
|
||||||
extern world_static_t world;
|
extern world_static_t world;
|
||||||
extern poolhandle_t com_studiocache;
|
extern poolhandle_t com_studiocache;
|
||||||
extern model_t *loadmodel;
|
|
||||||
extern convar_t mod_studiocache;
|
extern convar_t mod_studiocache;
|
||||||
extern convar_t r_wadtextures;
|
extern convar_t r_wadtextures;
|
||||||
extern convar_t r_showhull;
|
extern convar_t r_showhull;
|
||||||
@@ -164,7 +163,7 @@ void Mod_PrintWorldStats_f( void );
|
|||||||
//
|
//
|
||||||
// mod_dbghulls.c
|
// mod_dbghulls.c
|
||||||
//
|
//
|
||||||
void Mod_InitDebugHulls( void );
|
void Mod_InitDebugHulls( model_t *mod );
|
||||||
void Mod_CreatePolygonsForHull( int hullnum );
|
void Mod_CreatePolygonsForHull( int hullnum );
|
||||||
void Mod_ReleaseHullPolygons( void );
|
void Mod_ReleaseHullPolygons( void );
|
||||||
|
|
||||||
|
|||||||
@@ -851,11 +851,11 @@ void Mod_LoadStudioModel( model_t *mod, const void *buffer, qboolean *loaded )
|
|||||||
char poolname[MAX_VA_STRING];
|
char poolname[MAX_VA_STRING];
|
||||||
studiohdr_t *phdr;
|
studiohdr_t *phdr;
|
||||||
|
|
||||||
Q_snprintf( poolname, sizeof( poolname ), "^2%s^7", loadmodel->name );
|
Q_snprintf( poolname, sizeof( poolname ), "^2%s^7", mod->name );
|
||||||
|
|
||||||
if( loaded ) *loaded = false;
|
if( loaded ) *loaded = false;
|
||||||
loadmodel->mempool = Mem_AllocPool( poolname );
|
mod->mempool = Mem_AllocPool( poolname );
|
||||||
loadmodel->type = mod_studio;
|
mod->type = mod_studio;
|
||||||
|
|
||||||
phdr = R_StudioLoadHeader( mod, buffer );
|
phdr = R_StudioLoadHeader( mod, buffer );
|
||||||
if( !phdr ) return; // bad model
|
if( !phdr ) return; // bad model
|
||||||
@@ -886,9 +886,9 @@ void Mod_LoadStudioModel( model_t *mod, const void *buffer, qboolean *loaded )
|
|||||||
// give space for textures and skinrefs
|
// give space for textures and skinrefs
|
||||||
size1 = thdr->numtextures * sizeof( mstudiotexture_t );
|
size1 = thdr->numtextures * sizeof( mstudiotexture_t );
|
||||||
size2 = thdr->numskinfamilies * thdr->numskinref * sizeof( short );
|
size2 = thdr->numskinfamilies * thdr->numskinref * sizeof( short );
|
||||||
mod->cache.data = Mem_Calloc( loadmodel->mempool, phdr->length + size1 + size2 );
|
mod->cache.data = Mem_Calloc( mod->mempool, phdr->length + size1 + size2 );
|
||||||
memcpy( loadmodel->cache.data, buffer, phdr->length ); // copy main mdl buffer
|
memcpy( mod->cache.data, buffer, phdr->length ); // copy main mdl buffer
|
||||||
phdr = (studiohdr_t *)loadmodel->cache.data; // get the new pointer on studiohdr
|
phdr = (studiohdr_t *)mod->cache.data; // get the new pointer on studiohdr
|
||||||
phdr->numskinfamilies = thdr->numskinfamilies;
|
phdr->numskinfamilies = thdr->numskinfamilies;
|
||||||
phdr->numtextures = thdr->numtextures;
|
phdr->numtextures = thdr->numtextures;
|
||||||
phdr->numskinref = thdr->numskinref;
|
phdr->numskinref = thdr->numskinref;
|
||||||
@@ -905,52 +905,52 @@ void Mod_LoadStudioModel( model_t *mod, const void *buffer, qboolean *loaded )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// NOTE: don't modify source buffer because it's used for CRC computing
|
// NOTE: don't modify source buffer because it's used for CRC computing
|
||||||
loadmodel->cache.data = Mem_Calloc( loadmodel->mempool, phdr->length );
|
mod->cache.data = Mem_Calloc( mod->mempool, phdr->length );
|
||||||
memcpy( loadmodel->cache.data, buffer, phdr->length );
|
memcpy( mod->cache.data, buffer, phdr->length );
|
||||||
phdr = (studiohdr_t *)loadmodel->cache.data; // get the new pointer on studiohdr
|
phdr = (studiohdr_t *)mod->cache.data; // get the new pointer on studiohdr
|
||||||
#if !XASH_DEDICATED
|
#if !XASH_DEDICATED
|
||||||
ref.dllFuncs.Mod_StudioLoadTextures( mod, phdr );
|
ref.dllFuncs.Mod_StudioLoadTextures( mod, phdr );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// NOTE: we wan't keep raw textures in memory. just cutoff model pointer above texture base
|
// NOTE: we wan't keep raw textures in memory. just cutoff model pointer above texture base
|
||||||
loadmodel->cache.data = Mem_Realloc( loadmodel->mempool, loadmodel->cache.data, phdr->texturedataindex );
|
mod->cache.data = Mem_Realloc( mod->mempool, mod->cache.data, phdr->texturedataindex );
|
||||||
phdr = (studiohdr_t *)loadmodel->cache.data; // get the new pointer on studiohdr
|
phdr = (studiohdr_t *)mod->cache.data; // get the new pointer on studiohdr
|
||||||
phdr->length = phdr->texturedataindex; // update model size
|
phdr->length = phdr->texturedataindex; // update model size
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// just copy model into memory
|
// just copy model into memory
|
||||||
loadmodel->cache.data = Mem_Calloc( loadmodel->mempool, phdr->length );
|
mod->cache.data = Mem_Calloc( mod->mempool, phdr->length );
|
||||||
memcpy( loadmodel->cache.data, buffer, phdr->length );
|
memcpy( mod->cache.data, buffer, phdr->length );
|
||||||
|
|
||||||
phdr = loadmodel->cache.data;
|
phdr = mod->cache.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup bounding box
|
// setup bounding box
|
||||||
if( !VectorCompare( vec3_origin, phdr->bbmin ))
|
if( !VectorCompare( vec3_origin, phdr->bbmin ))
|
||||||
{
|
{
|
||||||
// clipping bounding box
|
// clipping bounding box
|
||||||
VectorCopy( phdr->bbmin, loadmodel->mins );
|
VectorCopy( phdr->bbmin, mod->mins );
|
||||||
VectorCopy( phdr->bbmax, loadmodel->maxs );
|
VectorCopy( phdr->bbmax, mod->maxs );
|
||||||
}
|
}
|
||||||
else if( !VectorCompare( vec3_origin, phdr->min ))
|
else if( !VectorCompare( vec3_origin, phdr->min ))
|
||||||
{
|
{
|
||||||
// movement bounding box
|
// movement bounding box
|
||||||
VectorCopy( phdr->min, loadmodel->mins );
|
VectorCopy( phdr->min, mod->mins );
|
||||||
VectorCopy( phdr->max, loadmodel->maxs );
|
VectorCopy( phdr->max, mod->maxs );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// well compute bounds from vertices and round to nearest even values
|
// well compute bounds from vertices and round to nearest even values
|
||||||
Mod_StudioComputeBounds( phdr, loadmodel->mins, loadmodel->maxs, true );
|
Mod_StudioComputeBounds( phdr, mod->mins, mod->maxs, true );
|
||||||
RoundUpHullSize( loadmodel->mins );
|
RoundUpHullSize( mod->mins );
|
||||||
RoundUpHullSize( loadmodel->maxs );
|
RoundUpHullSize( mod->maxs );
|
||||||
}
|
}
|
||||||
|
|
||||||
loadmodel->numframes = Mod_StudioBodyVariations( loadmodel );
|
mod->numframes = Mod_StudioBodyVariations( mod );
|
||||||
loadmodel->radius = RadiusFromBounds( loadmodel->mins, loadmodel->maxs );
|
mod->radius = RadiusFromBounds( mod->mins, mod->maxs );
|
||||||
loadmodel->flags = phdr->flags; // copy header flags
|
mod->flags = phdr->flags; // copy header flags
|
||||||
|
|
||||||
if( loaded ) *loaded = true;
|
if( loaded ) *loaded = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ poolhandle_t com_studiocache; // cache for submodels
|
|||||||
CVAR_DEFINE( mod_studiocache, "r_studiocache", "1", FCVAR_ARCHIVE, "enables studio cache for speedup tracing hitboxes" );
|
CVAR_DEFINE( mod_studiocache, "r_studiocache", "1", FCVAR_ARCHIVE, "enables studio cache for speedup tracing hitboxes" );
|
||||||
CVAR_DEFINE_AUTO( r_wadtextures, "0", 0, "completely ignore textures in the bsp-file if enabled" );
|
CVAR_DEFINE_AUTO( r_wadtextures, "0", 0, "completely ignore textures in the bsp-file if enabled" );
|
||||||
CVAR_DEFINE_AUTO( r_showhull, "0", 0, "draw collision hulls 1-3" );
|
CVAR_DEFINE_AUTO( r_showhull, "0", 0, "draw collision hulls 1-3" );
|
||||||
model_t *loadmodel;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============================================================================
|
===============================================================================
|
||||||
@@ -287,7 +286,6 @@ model_t *Mod_LoadModel( model_t *mod, qboolean crash )
|
|||||||
Con_Reportf( "loading %s\n", mod->name );
|
Con_Reportf( "loading %s\n", mod->name );
|
||||||
mod->needload = NL_PRESENT;
|
mod->needload = NL_PRESENT;
|
||||||
mod->type = mod_bad;
|
mod->type = mod_bad;
|
||||||
loadmodel = mod;
|
|
||||||
|
|
||||||
// call the apropriate loader
|
// call the apropriate loader
|
||||||
switch( *(uint *)buf )
|
switch( *(uint *)buf )
|
||||||
|
|||||||
@@ -649,3 +649,31 @@ qboolean Sys_NewInstance( const char *gamedir )
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
==================
|
||||||
|
Sys_GetNativeObject
|
||||||
|
|
||||||
|
Get platform-specific native object
|
||||||
|
==================
|
||||||
|
*/
|
||||||
|
void *Sys_GetNativeObject( const char *obj )
|
||||||
|
{
|
||||||
|
void *ptr;
|
||||||
|
|
||||||
|
if( !COM_CheckString( obj ))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
ptr = FS_GetNativeObject( obj );
|
||||||
|
|
||||||
|
if( ptr )
|
||||||
|
return ptr;
|
||||||
|
|
||||||
|
// Backend should consider that obj is case-sensitive
|
||||||
|
#if XASH_ANDROID
|
||||||
|
ptr = Android_GetNativeObject( obj );
|
||||||
|
#endif // XASH_ANDROID
|
||||||
|
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ void Sys_InitLog( void );
|
|||||||
void Sys_CloseLog( void );
|
void Sys_CloseLog( void );
|
||||||
void Sys_Quit( void ) NORETURN;
|
void Sys_Quit( void ) NORETURN;
|
||||||
qboolean Sys_NewInstance( const char *gamedir );
|
qboolean Sys_NewInstance( const char *gamedir );
|
||||||
|
void *Sys_GetNativeObject( const char *obj );
|
||||||
|
|
||||||
//
|
//
|
||||||
// sys_con.c
|
// sys_con.c
|
||||||
|
|||||||
@@ -37,6 +37,11 @@ void Platform_MessageBox( const char *title, const char *message, qboolean paren
|
|||||||
qboolean Sys_DebuggerPresent( void ); // optional, see Sys_DebugBreak
|
qboolean Sys_DebuggerPresent( void ); // optional, see Sys_DebugBreak
|
||||||
void Platform_SetStatus( const char *status );
|
void Platform_SetStatus( const char *status );
|
||||||
|
|
||||||
|
// legacy iOS port functions
|
||||||
|
#if TARGET_OS_IOS
|
||||||
|
const char *IOS_GetDocsDir( void );
|
||||||
|
#endif // TARGET_OS_IOS
|
||||||
|
|
||||||
#if XASH_WIN32 || XASH_LINUX
|
#if XASH_WIN32 || XASH_LINUX
|
||||||
#define XASH_PLATFORM_HAVE_STATUS 1
|
#define XASH_PLATFORM_HAVE_STATUS 1
|
||||||
#else
|
#else
|
||||||
@@ -134,17 +139,6 @@ static inline void Platform_Shutdown( void )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void *Platform_GetNativeObject( const char *name )
|
|
||||||
{
|
|
||||||
void *ptr = NULL;
|
|
||||||
|
|
||||||
#if XASH_ANDROID
|
|
||||||
ptr = Android_GetNativeObject( name );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
@@ -153,7 +147,6 @@ static inline void *Platform_GetNativeObject( const char *name )
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
*/
|
*/
|
||||||
void Platform_Vibrate( float life, char flags );
|
void Platform_Vibrate( float life, char flags );
|
||||||
void*Platform_GetNativeObject( const char *name );
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|||||||
@@ -330,8 +330,6 @@ typedef struct ref_api_s
|
|||||||
model_t *(*Mod_ForName)( const char *name, qboolean crash, qboolean trackCRC );
|
model_t *(*Mod_ForName)( const char *name, qboolean crash, qboolean trackCRC );
|
||||||
void *(*Mod_Extradata)( int type, model_t *model );
|
void *(*Mod_Extradata)( int type, model_t *model );
|
||||||
struct model_s *(*pfnGetModelByIndex)( int index ); // CL_ModelHandle
|
struct model_s *(*pfnGetModelByIndex)( int index ); // CL_ModelHandle
|
||||||
struct model_s *(*Mod_GetCurrentLoadingModel)( void ); // loadmodel
|
|
||||||
void (*Mod_SetCurrentLoadingModel)( struct model_s* ); // loadmodel
|
|
||||||
|
|
||||||
// remap
|
// remap
|
||||||
struct remap_info_s *(*CL_GetRemapInfoForEntity)( cl_entity_t *e );
|
struct remap_info_s *(*CL_GetRemapInfoForEntity)( cl_entity_t *e );
|
||||||
@@ -506,7 +504,7 @@ typedef struct ref_interface_s
|
|||||||
|
|
||||||
// bmodel
|
// bmodel
|
||||||
void (*R_InitSkyClouds)( struct mip_s *mt, struct texture_s *tx, qboolean custom_palette );
|
void (*R_InitSkyClouds)( struct mip_s *mt, struct texture_s *tx, qboolean custom_palette );
|
||||||
void (*GL_SubdivideSurface)( msurface_t *fa );
|
void (*GL_SubdivideSurface)( model_t *mod, msurface_t *fa );
|
||||||
void (*CL_RunLightStyles)( void );
|
void (*CL_RunLightStyles)( void );
|
||||||
|
|
||||||
// sprites
|
// sprites
|
||||||
|
|||||||
@@ -360,7 +360,6 @@ typedef struct
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
qboolean initialized; // sv_init has completed
|
qboolean initialized; // sv_init has completed
|
||||||
qboolean game_library_loaded; // is game library loaded in SV_InitGame
|
|
||||||
double timestart; // just for profiling
|
double timestart; // just for profiling
|
||||||
|
|
||||||
int maxclients; // server max clients
|
int maxclients; // server max clients
|
||||||
|
|||||||
@@ -3031,7 +3031,7 @@ void SV_SetStringArrayMode( qboolean dynamic )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if XASH_64BIT && !XASH_WIN32 && !XASH_APPLE && !XASH_NSWITCH
|
#if XASH_64BIT && !XASH_WIN32 && !XASH_APPLE && !XASH_NSWITCH && !XASH_ANDROID
|
||||||
#define USE_MMAP
|
#define USE_MMAP
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -5130,7 +5130,6 @@ void SV_UnloadProgs( void )
|
|||||||
|
|
||||||
Mod_ResetStudioAPI ();
|
Mod_ResetStudioAPI ();
|
||||||
|
|
||||||
svs.game_library_loaded = false;
|
|
||||||
COM_FreeLibrary( svgame.hInstance );
|
COM_FreeLibrary( svgame.hInstance );
|
||||||
Mem_FreePool( &svgame.mempool );
|
Mem_FreePool( &svgame.mempool );
|
||||||
memset( &svgame, 0, sizeof( svgame ));
|
memset( &svgame, 0, sizeof( svgame ));
|
||||||
@@ -5148,7 +5147,14 @@ qboolean SV_LoadProgs( const char *name )
|
|||||||
static playermove_t gpMove;
|
static playermove_t gpMove;
|
||||||
edict_t *e;
|
edict_t *e;
|
||||||
|
|
||||||
if( svgame.hInstance ) SV_UnloadProgs();
|
if( svgame.hInstance )
|
||||||
|
{
|
||||||
|
#if XASH_WIN32
|
||||||
|
SV_UnloadProgs();
|
||||||
|
#else // XASH_WIN32
|
||||||
|
return true;
|
||||||
|
#endif // XASH_WIN32
|
||||||
|
}
|
||||||
|
|
||||||
// fill it in
|
// fill it in
|
||||||
svgame.pmove = &gpMove;
|
svgame.pmove = &gpMove;
|
||||||
|
|||||||
@@ -706,7 +706,7 @@ qboolean SV_InitGame( void )
|
|||||||
{
|
{
|
||||||
string dllpath;
|
string dllpath;
|
||||||
|
|
||||||
if( svs.game_library_loaded )
|
if( svgame.hInstance )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// first initialize?
|
// first initialize?
|
||||||
@@ -721,7 +721,6 @@ qboolean SV_InitGame( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// client frames will be allocated in SV_ClientConnect
|
// client frames will be allocated in SV_ClientConnect
|
||||||
svs.game_library_loaded = true;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1042,8 +1041,9 @@ qboolean SV_SpawnServer( const char *mapname, const char *startspot, qboolean ba
|
|||||||
// force normal player collisions for single player
|
// force normal player collisions for single player
|
||||||
if( svs.maxclients == 1 ) Cvar_SetValue( "sv_clienttrace", 1 );
|
if( svs.maxclients == 1 ) Cvar_SetValue( "sv_clienttrace", 1 );
|
||||||
|
|
||||||
// make sure what server name doesn't contain path and extension
|
// allow loading maps from subdirectories, strip extension anyway
|
||||||
COM_FileBase( mapname, sv.name, sizeof( sv.name ));
|
Q_strncpy( sv.name, mapname, sizeof( sv.name ));
|
||||||
|
COM_StripExtension( sv.name );
|
||||||
|
|
||||||
// precache and static commands can be issued during map initialization
|
// precache and static commands can be issued during map initialization
|
||||||
Host_SetServerState( ss_loading );
|
Host_SetServerState( ss_loading );
|
||||||
@@ -1115,28 +1115,6 @@ int SV_GetMaxClients( void )
|
|||||||
return svs.maxclients;
|
return svs.maxclients;
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean SV_InitGameProgs( void )
|
|
||||||
{
|
|
||||||
string dllpath;
|
|
||||||
|
|
||||||
if( svgame.hInstance ) return true; // already loaded
|
|
||||||
|
|
||||||
COM_GetCommonLibraryPath( LIBRARY_SERVER, dllpath, sizeof( dllpath ));
|
|
||||||
|
|
||||||
// just try to initialize
|
|
||||||
SV_LoadProgs( dllpath );
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SV_FreeGameProgs( void )
|
|
||||||
{
|
|
||||||
if( svs.initialized ) return; // server is active
|
|
||||||
|
|
||||||
// unload progs (free cvars and commands)
|
|
||||||
SV_UnloadProgs();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
SV_ExecLoadLevel
|
SV_ExecLoadLevel
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ CVAR_DEFINE_AUTO( sv_send_logos, "1", 0, "send custom decal logo to other player
|
|||||||
CVAR_DEFINE_AUTO( sv_send_resources, "1", 0, "allow to download missed resources for players" );
|
CVAR_DEFINE_AUTO( sv_send_resources, "1", 0, "allow to download missed resources for players" );
|
||||||
CVAR_DEFINE_AUTO( sv_logbans, "0", 0, "print into the server log info about player bans" );
|
CVAR_DEFINE_AUTO( sv_logbans, "0", 0, "print into the server log info about player bans" );
|
||||||
CVAR_DEFINE_AUTO( sv_allow_upload, "1", FCVAR_SERVER, "allow uploading custom resources on a server" );
|
CVAR_DEFINE_AUTO( sv_allow_upload, "1", FCVAR_SERVER, "allow uploading custom resources on a server" );
|
||||||
CVAR_DEFINE_AUTO( sv_allow_download, "1", FCVAR_SERVER, "allow downloading custom resources to the client" );
|
CVAR_DEFINE( sv_allow_download, "sv_allowdownload", "1", FCVAR_SERVER, "allow downloading custom resources to the client" );
|
||||||
|
static CVAR_DEFINE_AUTO( sv_allow_dlfile, "1", 0, "compatibility cvar, does nothing" );
|
||||||
CVAR_DEFINE_AUTO( sv_uploadmax, "0.5", FCVAR_SERVER, "max size to upload custom resources (500 kB as default)" );
|
CVAR_DEFINE_AUTO( sv_uploadmax, "0.5", FCVAR_SERVER, "max size to upload custom resources (500 kB as default)" );
|
||||||
CVAR_DEFINE_AUTO( sv_downloadurl, "", FCVAR_PROTECTED, "location from which clients can download missing files" );
|
CVAR_DEFINE_AUTO( sv_downloadurl, "", FCVAR_PROTECTED, "location from which clients can download missing files" );
|
||||||
CVAR_DEFINE( sv_consistency, "mp_consistency", "1", FCVAR_SERVER, "enbale consistency check in multiplayer" );
|
CVAR_DEFINE( sv_consistency, "mp_consistency", "1", FCVAR_SERVER, "enbale consistency check in multiplayer" );
|
||||||
@@ -925,6 +926,7 @@ void SV_Init( void )
|
|||||||
Cvar_RegisterVariable( &sv_unlagsamples );
|
Cvar_RegisterVariable( &sv_unlagsamples );
|
||||||
Cvar_RegisterVariable( &sv_allow_upload );
|
Cvar_RegisterVariable( &sv_allow_upload );
|
||||||
Cvar_RegisterVariable( &sv_allow_download );
|
Cvar_RegisterVariable( &sv_allow_download );
|
||||||
|
Cvar_RegisterVariable( &sv_allow_dlfile );
|
||||||
Cvar_RegisterVariable( &sv_send_logos );
|
Cvar_RegisterVariable( &sv_send_logos );
|
||||||
Cvar_RegisterVariable( &sv_send_resources );
|
Cvar_RegisterVariable( &sv_send_resources );
|
||||||
Cvar_RegisterVariable( &sv_uploadmax );
|
Cvar_RegisterVariable( &sv_uploadmax );
|
||||||
@@ -1089,7 +1091,9 @@ void SV_Shutdown( const char *finalmsg )
|
|||||||
if( CL_IsPlaybackDemo( ))
|
if( CL_IsPlaybackDemo( ))
|
||||||
CL_Drop();
|
CL_Drop();
|
||||||
|
|
||||||
SV_UnloadProgs ();
|
#if XASH_WIN32
|
||||||
|
SV_UnloadProgs();
|
||||||
|
#endif // XASH_WIN32
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1106,7 +1110,10 @@ void SV_Shutdown( const char *finalmsg )
|
|||||||
NET_MasterShutdown();
|
NET_MasterShutdown();
|
||||||
|
|
||||||
NET_Config( false, false );
|
NET_Config( false, false );
|
||||||
SV_UnloadProgs ();
|
SV_DeactivateServer();
|
||||||
|
#if XASH_WIN32
|
||||||
|
SV_UnloadProgs();
|
||||||
|
#endif // XASH_WIN32
|
||||||
CL_Drop();
|
CL_Drop();
|
||||||
|
|
||||||
// free current level
|
// free current level
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ static qboolean SV_CopyEdictToPhysEnt( physent_t *pe, edict_t *ed )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// otherwise copy the classname
|
// otherwise copy the modelname
|
||||||
Q_strncpy( pe->name, STRING( ed->v.classname ), sizeof( pe->name ));
|
Q_strncpy( pe->name, mod->name, sizeof( pe->name ));
|
||||||
}
|
}
|
||||||
|
|
||||||
pe->model = pe->studiomodel = NULL;
|
pe->model = pe->studiomodel = NULL;
|
||||||
|
|||||||
@@ -150,7 +150,10 @@ public:
|
|||||||
|
|
||||||
void RemoveFile( const char *path, const char *id ) override
|
void RemoveFile( const char *path, const char *id ) override
|
||||||
{
|
{
|
||||||
FS_Delete( path ); // FS_Delete is aware of slashes
|
char dir[MAX_VA_STRING], fullpath[MAX_VA_STRING];
|
||||||
|
|
||||||
|
Q_snprintf( fullpath, sizeof( fullpath ), "%s/%s", IdToDir( dir, sizeof( dir ), id ), path );
|
||||||
|
FS_Delete( fullpath ); // FS_Delete is aware of slashes
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateDirHierarchy( const char *path, const char *id ) override
|
void CreateDirHierarchy( const char *path, const char *id ) override
|
||||||
|
|||||||
@@ -150,6 +150,4 @@ public:
|
|||||||
virtual void AddSearchPathNoWrite(const char *, const char *) = 0; /* linkage=_ZN11IFileSystem20AddSearchPathNoWriteEPKcS1_ */
|
virtual void AddSearchPathNoWrite(const char *, const char *) = 0; /* linkage=_ZN11IFileSystem20AddSearchPathNoWriteEPKcS1_ */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define FILESYSTEM_INTERFACE_VERSION "VFileSystem009" // never change this!
|
|
||||||
|
|
||||||
#endif // VFILESYSTEM009_H
|
#endif // VFILESYSTEM009_H
|
||||||
|
|||||||
@@ -770,13 +770,13 @@ void FS_ParseGenericGameInfo( gameinfo_t *GameInfo, const char *buf, const qbool
|
|||||||
else if( !Q_stricmp( token, "secure" ))
|
else if( !Q_stricmp( token, "secure" ))
|
||||||
{
|
{
|
||||||
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
GameInfo->secure = Q_atoi( token );
|
GameInfo->secure = Q_atoi( token ) ? true : false;
|
||||||
}
|
}
|
||||||
// valid for both
|
// valid for both
|
||||||
else if( !Q_stricmp( token, "nomodels" ))
|
else if( !Q_stricmp( token, "nomodels" ))
|
||||||
{
|
{
|
||||||
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
GameInfo->nomodels = Q_atoi( token );
|
GameInfo->nomodels = Q_atoi( token ) ? true : false;
|
||||||
}
|
}
|
||||||
else if( !Q_stricmp( token, isGameInfo ? "max_edicts" : "edicts" ))
|
else if( !Q_stricmp( token, isGameInfo ? "max_edicts" : "edicts" ))
|
||||||
{
|
{
|
||||||
@@ -844,17 +844,17 @@ void FS_ParseGenericGameInfo( gameinfo_t *GameInfo, const char *buf, const qbool
|
|||||||
else if( !Q_stricmp( token, "noskills" ))
|
else if( !Q_stricmp( token, "noskills" ))
|
||||||
{
|
{
|
||||||
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
GameInfo->noskills = Q_atoi( token );
|
GameInfo->noskills = Q_atoi( token ) ? true : false;
|
||||||
}
|
}
|
||||||
else if( !Q_stricmp( token, "render_picbutton_text" ))
|
else if( !Q_stricmp( token, "render_picbutton_text" ))
|
||||||
{
|
{
|
||||||
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
GameInfo->render_picbutton_text = Q_atoi( token );
|
GameInfo->render_picbutton_text = Q_atoi( token ) ? true : false;
|
||||||
}
|
}
|
||||||
else if( !Q_stricmp( token, "internal_vgui_support" ))
|
else if( !Q_stricmp( token, "internal_vgui_support" ))
|
||||||
{
|
{
|
||||||
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
GameInfo->internal_vgui_support = Q_atoi( token );
|
GameInfo->internal_vgui_support = Q_atoi( token ) ? true : false;
|
||||||
}
|
}
|
||||||
else if( !Q_stricmp( token, "quicksave_aged_count" ))
|
else if( !Q_stricmp( token, "quicksave_aged_count" ))
|
||||||
{
|
{
|
||||||
@@ -1386,7 +1386,7 @@ static void _Sys_Error( const char *fmt, ... )
|
|||||||
exit( 1 );
|
exit( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *_Platform_GetNativeObject_stub( const char *object )
|
static void *Sys_GetNativeObject_stub( const char *object )
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -2841,7 +2841,7 @@ fs_interface_t g_engfuncs =
|
|||||||
_Mem_Alloc,
|
_Mem_Alloc,
|
||||||
_Mem_Realloc,
|
_Mem_Realloc,
|
||||||
_Mem_Free,
|
_Mem_Free,
|
||||||
_Platform_GetNativeObject_stub
|
Sys_GetNativeObject_stub
|
||||||
};
|
};
|
||||||
|
|
||||||
static qboolean FS_InitInterface( int version, fs_interface_t *engfuncs )
|
static qboolean FS_InitInterface( int version, fs_interface_t *engfuncs )
|
||||||
@@ -2883,9 +2883,9 @@ static qboolean FS_InitInterface( int version, fs_interface_t *engfuncs )
|
|||||||
Con_Reportf( "filesystem_stdio: custom memory allocation functions found\n" );
|
Con_Reportf( "filesystem_stdio: custom memory allocation functions found\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( engfuncs->_Platform_GetNativeObject )
|
if( engfuncs->_Sys_GetNativeObject )
|
||||||
{
|
{
|
||||||
g_engfuncs._Platform_GetNativeObject = engfuncs->_Platform_GetNativeObject;
|
g_engfuncs._Sys_GetNativeObject = engfuncs->_Sys_GetNativeObject;
|
||||||
Con_Reportf( "filesystem_stdio: custom platform-specific functions found\n" );
|
Con_Reportf( "filesystem_stdio: custom platform-specific functions found\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ extern "C"
|
|||||||
|
|
||||||
#define FS_API_VERSION 2 // not stable yet!
|
#define FS_API_VERSION 2 // not stable yet!
|
||||||
#define FS_API_CREATEINTERFACE_TAG "XashFileSystem002" // follow FS_API_VERSION!!!
|
#define FS_API_CREATEINTERFACE_TAG "XashFileSystem002" // follow FS_API_VERSION!!!
|
||||||
|
#define FILESYSTEM_INTERFACE_VERSION "VFileSystem009" // never change this!
|
||||||
|
|
||||||
// search path flags
|
// search path flags
|
||||||
enum
|
enum
|
||||||
@@ -210,7 +211,7 @@ typedef struct fs_interface_t
|
|||||||
void (*_Mem_Free)( void *data, const char *filename, int fileline );
|
void (*_Mem_Free)( void *data, const char *filename, int fileline );
|
||||||
|
|
||||||
// platform
|
// platform
|
||||||
void *(*_Platform_GetNativeObject)( const char *object );
|
void *(*_Sys_GetNativeObject)( const char *object );
|
||||||
} fs_interface_t;
|
} fs_interface_t;
|
||||||
|
|
||||||
typedef int (*FSAPI)( int version, fs_api_t *api, fs_globals_t **globals, fs_interface_t *interface );
|
typedef int (*FSAPI)( int version, fs_api_t *api, fs_globals_t **globals, fs_interface_t *interface );
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ extern const fs_archive_t g_archives[];
|
|||||||
#define Con_DPrintf (*g_engfuncs._Con_DPrintf)
|
#define Con_DPrintf (*g_engfuncs._Con_DPrintf)
|
||||||
#define Con_Reportf (*g_engfuncs._Con_Reportf)
|
#define Con_Reportf (*g_engfuncs._Con_Reportf)
|
||||||
#define Sys_Error (*g_engfuncs._Sys_Error)
|
#define Sys_Error (*g_engfuncs._Sys_Error)
|
||||||
#define Platform_GetNativeObject (*g_engfuncs._Platform_GetNativeObject)
|
#define Sys_GetNativeObject (*g_engfuncs._Sys_GetNativeObject)
|
||||||
|
|
||||||
//
|
//
|
||||||
// filesystem.c
|
// filesystem.c
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ typedef void *HMODULE;
|
|||||||
|
|
||||||
HMODULE g_hModule;
|
HMODULE g_hModule;
|
||||||
FSAPI g_pfnGetFSAPI;
|
FSAPI g_pfnGetFSAPI;
|
||||||
typedef void *(*pfnCreateInterface_t)( const char *, int * );
|
|
||||||
pfnCreateInterface_t g_pfnCreateInterface;
|
pfnCreateInterface_t g_pfnCreateInterface;
|
||||||
fs_api_t g_fs;
|
fs_api_t g_fs;
|
||||||
fs_globals_t *g_nullglobals;
|
fs_globals_t *g_nullglobals;
|
||||||
|
|||||||
@@ -645,10 +645,10 @@ void COM_ExtractFilePath( const char *path, char *dest )
|
|||||||
const char *src = path + Q_strlen( path ) - 1;
|
const char *src = path + Q_strlen( path ) - 1;
|
||||||
|
|
||||||
// back up until a \ or the start
|
// back up until a \ or the start
|
||||||
while( src != path && !(*(src - 1) == '\\' || *(src - 1) == '/' ))
|
while( src > path && !(*(src - 1) == '\\' || *(src - 1) == '/' ))
|
||||||
src--;
|
src--;
|
||||||
|
|
||||||
if( src != path )
|
if( src > path )
|
||||||
{
|
{
|
||||||
memcpy( dest, path, src - path );
|
memcpy( dest, path, src - path );
|
||||||
dest[src - path - 1] = 0; // cutoff backslash
|
dest[src - path - 1] = 0; // cutoff backslash
|
||||||
|
|||||||
40
public/tests/test_efp.c
Normal file
40
public/tests/test_efp.c
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
#include "crtlib.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int Test_ExtractFilePath( void )
|
||||||
|
{
|
||||||
|
char dst[64];
|
||||||
|
const char *strings[] =
|
||||||
|
{
|
||||||
|
"dir/file", "dir",
|
||||||
|
"bark\\meow", "bark",
|
||||||
|
"nopath", "",
|
||||||
|
"knee/deep/in/paths", "knee/deep/in",
|
||||||
|
// yes, it removes the behavior/ even if it might be technically a directory
|
||||||
|
"keep/the/original/func/behavior/", "keep/the/original/func",
|
||||||
|
"backslashes\\are\\annoying\\af", "backslashes\\are\\annoying",
|
||||||
|
"", ""
|
||||||
|
};
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for( i = 0; i < sizeof( strings ) / sizeof( strings[0] ); i += 2 )
|
||||||
|
{
|
||||||
|
COM_ExtractFilePath( strings[i], dst );
|
||||||
|
if( Q_strcmp( dst, strings[i+1] ))
|
||||||
|
{
|
||||||
|
printf( "%s %s %s\n", strings[i], strings[i+1], dst );
|
||||||
|
return (i >> 1) + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main( void )
|
||||||
|
{
|
||||||
|
if( Test_ExtractFilePath( ))
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
@@ -12,8 +12,7 @@ def options(opt):
|
|||||||
return
|
return
|
||||||
|
|
||||||
def configure(conf):
|
def configure(conf):
|
||||||
# stub
|
conf.define('XASH_BUILD_COMMIT', conf.env.GIT_VERSION if conf.env.GIT_VERSION else 'notset')
|
||||||
return
|
|
||||||
|
|
||||||
def build(bld):
|
def build(bld):
|
||||||
bld(name = 'sdk_includes', export_includes = '. ../common ../pm_shared ../engine')
|
bld(name = 'sdk_includes', export_includes = '. ../common ../pm_shared ../engine')
|
||||||
@@ -28,6 +27,7 @@ def build(bld):
|
|||||||
'strings': 'tests/test_strings.c',
|
'strings': 'tests/test_strings.c',
|
||||||
'build': 'tests/test_build.c',
|
'build': 'tests/test_build.c',
|
||||||
'filebase': 'tests/test_filebase.c',
|
'filebase': 'tests/test_filebase.c',
|
||||||
|
'efp': 'tests/test_efp.c',
|
||||||
}
|
}
|
||||||
|
|
||||||
for i in tests:
|
for i in tests:
|
||||||
|
|||||||
@@ -1309,9 +1309,9 @@ static void GL2_Mul4x4( const GLfloat *in0, const GLfloat *in1, GLfloat *out )
|
|||||||
static void GL2_UpdateMVP( gl2wrap_prog_t *prog )
|
static void GL2_UpdateMVP( gl2wrap_prog_t *prog )
|
||||||
{
|
{
|
||||||
// use bitset to determine if need update matrix for this prog
|
// use bitset to determine if need update matrix for this prog
|
||||||
if( FBitSet( gl2wrap_matrix.update, BIT( prog->flags )))
|
if( FBitSet( gl2wrap_matrix.update, BIT64( prog->flags )))
|
||||||
{
|
{
|
||||||
ClearBits( gl2wrap_matrix.update, BIT( prog->flags ));
|
ClearBits( gl2wrap_matrix.update, BIT64( prog->flags ));
|
||||||
GL2_Mul4x4( gl2wrap_matrix.mv, gl2wrap_matrix.pr, gl2wrap_matrix.mvp );
|
GL2_Mul4x4( gl2wrap_matrix.mv, gl2wrap_matrix.pr, gl2wrap_matrix.mvp );
|
||||||
pglUniformMatrix4fvARB( prog->uMVP, 1, false, (void *)gl2wrap_matrix.mvp );
|
pglUniformMatrix4fvARB( prog->uMVP, 1, false, (void *)gl2wrap_matrix.mvp );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -418,7 +418,6 @@ rgbdata_t *Mod_CreateSkinData( model_t *mod, byte *data, int width, int height )
|
|||||||
static rgbdata_t skin;
|
static rgbdata_t skin;
|
||||||
char name[MAX_QPATH];
|
char name[MAX_QPATH];
|
||||||
int i;
|
int i;
|
||||||
model_t *loadmodel = gEngfuncs.Mod_GetCurrentLoadingModel();
|
|
||||||
|
|
||||||
skin.width = width;
|
skin.width = width;
|
||||||
skin.height = height;
|
skin.height = height;
|
||||||
@@ -443,7 +442,7 @@ rgbdata_t *Mod_CreateSkinData( model_t *mod, byte *data, int width, int height )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
COM_FileBase( loadmodel->name, name, sizeof( name ));
|
COM_FileBase( mod->name, name, sizeof( name ));
|
||||||
|
|
||||||
// for alias models only player can have remap textures
|
// for alias models only player can have remap textures
|
||||||
if( mod != NULL && !Q_stricmp( name, "player" ))
|
if( mod != NULL && !Q_stricmp( name, "player" ))
|
||||||
@@ -476,12 +475,11 @@ rgbdata_t *Mod_CreateSkinData( model_t *mod, byte *data, int width, int height )
|
|||||||
return gEngfuncs.FS_CopyImage( &skin );
|
return gEngfuncs.FS_CopyImage( &skin );
|
||||||
}
|
}
|
||||||
|
|
||||||
void *Mod_LoadSingleSkin( daliasskintype_t *pskintype, int skinnum, int size )
|
void *Mod_LoadSingleSkin( model_t *loadmodel, daliasskintype_t *pskintype, int skinnum, int size )
|
||||||
{
|
{
|
||||||
string name, lumaname;
|
string name, lumaname;
|
||||||
string checkname;
|
string checkname;
|
||||||
rgbdata_t *pic;
|
rgbdata_t *pic;
|
||||||
model_t *loadmodel = gEngfuncs.Mod_GetCurrentLoadingModel();
|
|
||||||
|
|
||||||
Q_snprintf( name, sizeof( name ), "%s:frame%i", loadmodel->name, skinnum );
|
Q_snprintf( name, sizeof( name ), "%s:frame%i", loadmodel->name, skinnum );
|
||||||
Q_snprintf( lumaname, sizeof( lumaname ), "%s:luma%i", loadmodel->name, skinnum );
|
Q_snprintf( lumaname, sizeof( lumaname ), "%s:luma%i", loadmodel->name, skinnum );
|
||||||
@@ -508,14 +506,13 @@ void *Mod_LoadSingleSkin( daliasskintype_t *pskintype, int skinnum, int size )
|
|||||||
return ((byte *)(pskintype + 1) + size);
|
return ((byte *)(pskintype + 1) + size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *Mod_LoadGroupSkin( daliasskintype_t *pskintype, int skinnum, int size )
|
void *Mod_LoadGroupSkin( model_t *loadmodel, daliasskintype_t *pskintype, int skinnum, int size )
|
||||||
{
|
{
|
||||||
daliasskininterval_t *pinskinintervals;
|
daliasskininterval_t *pinskinintervals;
|
||||||
daliasskingroup_t *pinskingroup;
|
daliasskingroup_t *pinskingroup;
|
||||||
string name, lumaname;
|
string name, lumaname;
|
||||||
rgbdata_t *pic;
|
rgbdata_t *pic;
|
||||||
int i, j;
|
int i, j;
|
||||||
model_t *loadmodel = gEngfuncs.Mod_GetCurrentLoadingModel();
|
|
||||||
|
|
||||||
// animating skin group. yuck.
|
// animating skin group. yuck.
|
||||||
pskintype++;
|
pskintype++;
|
||||||
@@ -555,7 +552,7 @@ void *Mod_LoadGroupSkin( daliasskintype_t *pskintype, int skinnum, int size )
|
|||||||
Mod_LoadAllSkins
|
Mod_LoadAllSkins
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void *Mod_LoadAllSkins( int numskins, daliasskintype_t *pskintype )
|
void *Mod_LoadAllSkins( model_t *mod, int numskins, daliasskintype_t *pskintype )
|
||||||
{
|
{
|
||||||
int i, size;
|
int i, size;
|
||||||
|
|
||||||
@@ -568,11 +565,11 @@ void *Mod_LoadAllSkins( int numskins, daliasskintype_t *pskintype )
|
|||||||
{
|
{
|
||||||
if( pskintype->type == ALIAS_SKIN_SINGLE )
|
if( pskintype->type == ALIAS_SKIN_SINGLE )
|
||||||
{
|
{
|
||||||
pskintype = (daliasskintype_t *)Mod_LoadSingleSkin( pskintype, i, size );
|
pskintype = (daliasskintype_t *)Mod_LoadSingleSkin( mod, pskintype, i, size );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pskintype = (daliasskintype_t *)Mod_LoadGroupSkin( pskintype, i, size );
|
pskintype = (daliasskintype_t *)Mod_LoadGroupSkin( mod, pskintype, i, size );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -680,7 +677,7 @@ void Mod_LoadAliasModel( model_t *mod, const void *buffer, qboolean *loaded )
|
|||||||
|
|
||||||
// load the skins
|
// load the skins
|
||||||
pskintype = (daliasskintype_t *)&pinmodel[1];
|
pskintype = (daliasskintype_t *)&pinmodel[1];
|
||||||
pskintype = Mod_LoadAllSkins( m_pAliasHeader->numskins, pskintype );
|
pskintype = Mod_LoadAllSkins( mod, m_pAliasHeader->numskins, pskintype );
|
||||||
|
|
||||||
// load base s and t vertices
|
// load base s and t vertices
|
||||||
pinstverts = (stvert_t *)pskintype;
|
pinstverts = (stvert_t *)pskintype;
|
||||||
@@ -725,7 +722,7 @@ void Mod_LoadAliasModel( model_t *mod, const void *buffer, qboolean *loaded )
|
|||||||
GL_MakeAliasModelDisplayLists( mod );
|
GL_MakeAliasModelDisplayLists( mod );
|
||||||
|
|
||||||
// move the complete, relocatable alias model to the cache
|
// move the complete, relocatable alias model to the cache
|
||||||
gEngfuncs.Mod_GetCurrentLoadingModel()->cache.data = m_pAliasHeader;
|
mod->cache.data = m_pAliasHeader;
|
||||||
|
|
||||||
if( loaded ) *loaded = true; // done
|
if( loaded ) *loaded = true; // done
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -342,6 +342,8 @@ void R_SetTextureParameters( void )
|
|||||||
// change all the existing mipmapped texture objects
|
// change all the existing mipmapped texture objects
|
||||||
for( i = 0; i < gl_numTextures; i++ )
|
for( i = 0; i < gl_numTextures; i++ )
|
||||||
GL_UpdateTextureParams( i );
|
GL_UpdateTextureParams( i );
|
||||||
|
|
||||||
|
R_UpdateRippleTexParams();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2317,6 +2319,7 @@ void R_InitImages( void )
|
|||||||
// validate cvars
|
// validate cvars
|
||||||
R_SetTextureParameters();
|
R_SetTextureParameters();
|
||||||
GL_CreateInternalTextures();
|
GL_CreateInternalTextures();
|
||||||
|
R_InitRipples();
|
||||||
|
|
||||||
gEngfuncs.Cmd_AddCommand( "texturelist", R_TextureList_f, "display loaded textures list" );
|
gEngfuncs.Cmd_AddCommand( "texturelist", R_TextureList_f, "display loaded textures list" );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -426,7 +426,7 @@ void R_MarkLeaves( void );
|
|||||||
void R_DrawWorld( void );
|
void R_DrawWorld( void );
|
||||||
void R_DrawWaterSurfaces( void );
|
void R_DrawWaterSurfaces( void );
|
||||||
void R_DrawBrushModel( cl_entity_t *e );
|
void R_DrawBrushModel( cl_entity_t *e );
|
||||||
void GL_SubdivideSurface( msurface_t *fa );
|
void GL_SubdivideSurface( model_t *mod, msurface_t *fa );
|
||||||
void GL_BuildPolygonFromSurface( model_t *mod, msurface_t *fa );
|
void GL_BuildPolygonFromSurface( model_t *mod, msurface_t *fa );
|
||||||
void DrawGLPoly( glpoly_t *p, float xScale, float yScale );
|
void DrawGLPoly( glpoly_t *p, float xScale, float yScale );
|
||||||
texture_t *R_TextureAnimation( msurface_t *s );
|
texture_t *R_TextureAnimation( msurface_t *s );
|
||||||
@@ -489,6 +489,11 @@ void R_ClearSkyBox( void );
|
|||||||
void R_DrawSkyBox( void );
|
void R_DrawSkyBox( void );
|
||||||
void R_DrawClouds( void );
|
void R_DrawClouds( void );
|
||||||
void EmitWaterPolys( msurface_t *warp, qboolean reverse );
|
void EmitWaterPolys( msurface_t *warp, qboolean reverse );
|
||||||
|
void R_InitRipples( void );
|
||||||
|
void R_ResetRipples( void );
|
||||||
|
void R_AnimateRipples( void );
|
||||||
|
void R_UpdateRippleTexParams( void );
|
||||||
|
void R_UploadRipples( texture_t *image );
|
||||||
|
|
||||||
//
|
//
|
||||||
// gl_vgui.c
|
// gl_vgui.c
|
||||||
@@ -750,6 +755,9 @@ extern convar_t r_vbo;
|
|||||||
extern convar_t r_vbo_dlightmode;
|
extern convar_t r_vbo_dlightmode;
|
||||||
extern convar_t r_studio_sort_textures;
|
extern convar_t r_studio_sort_textures;
|
||||||
extern convar_t r_studio_drawelements;
|
extern convar_t r_studio_drawelements;
|
||||||
|
extern convar_t r_ripple;
|
||||||
|
extern convar_t r_ripple_updatetime;
|
||||||
|
extern convar_t r_ripple_spawntime;
|
||||||
|
|
||||||
//
|
//
|
||||||
// engine shared convars
|
// engine shared convars
|
||||||
|
|||||||
@@ -30,6 +30,10 @@ CVAR_DEFINE_AUTO( r_traceglow, "0", FCVAR_GLCONFIG, "cull flares behind models"
|
|||||||
CVAR_DEFINE_AUTO( gl_round_down, "2", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "round texture sizes to nearest POT value" );
|
CVAR_DEFINE_AUTO( gl_round_down, "2", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "round texture sizes to nearest POT value" );
|
||||||
CVAR_DEFINE( r_vbo, "gl_vbo", "0", FCVAR_ARCHIVE, "draw world using VBO (known to be glitchy)" );
|
CVAR_DEFINE( r_vbo, "gl_vbo", "0", FCVAR_ARCHIVE, "draw world using VBO (known to be glitchy)" );
|
||||||
CVAR_DEFINE( r_vbo_dlightmode, "gl_vbo_dlightmode", "1", FCVAR_ARCHIVE, "vbo dlight rendering mode (0-1)" );
|
CVAR_DEFINE( r_vbo_dlightmode, "gl_vbo_dlightmode", "1", FCVAR_ARCHIVE, "vbo dlight rendering mode (0-1)" );
|
||||||
|
CVAR_DEFINE_AUTO( r_ripple, "0", FCVAR_GLCONFIG, "enable software-like water texture ripple simulation" );
|
||||||
|
CVAR_DEFINE_AUTO( r_ripple_updatetime, "0.05", FCVAR_GLCONFIG, "how fast ripple simulation is" );
|
||||||
|
CVAR_DEFINE_AUTO( r_ripple_spawntime, "0.1", FCVAR_GLCONFIG, "how fast new ripples spawn" );
|
||||||
|
|
||||||
|
|
||||||
DEFINE_ENGINE_SHARED_CVAR_LIST()
|
DEFINE_ENGINE_SHARED_CVAR_LIST()
|
||||||
|
|
||||||
@@ -1186,6 +1190,9 @@ void GL_InitCommands( void )
|
|||||||
gEngfuncs.Cvar_RegisterVariable( &r_traceglow );
|
gEngfuncs.Cvar_RegisterVariable( &r_traceglow );
|
||||||
gEngfuncs.Cvar_RegisterVariable( &r_studio_sort_textures );
|
gEngfuncs.Cvar_RegisterVariable( &r_studio_sort_textures );
|
||||||
gEngfuncs.Cvar_RegisterVariable( &r_studio_drawelements );
|
gEngfuncs.Cvar_RegisterVariable( &r_studio_drawelements );
|
||||||
|
gEngfuncs.Cvar_RegisterVariable( &r_ripple );
|
||||||
|
gEngfuncs.Cvar_RegisterVariable( &r_ripple_updatetime );
|
||||||
|
gEngfuncs.Cvar_RegisterVariable( &r_ripple_spawntime );
|
||||||
|
|
||||||
gEngfuncs.Cvar_RegisterVariable( &gl_extensions );
|
gEngfuncs.Cvar_RegisterVariable( &gl_extensions );
|
||||||
gEngfuncs.Cvar_RegisterVariable( &gl_texture_nearest );
|
gEngfuncs.Cvar_RegisterVariable( &gl_texture_nearest );
|
||||||
|
|||||||
@@ -969,6 +969,8 @@ void R_RenderScene( void )
|
|||||||
|
|
||||||
R_MarkLeaves();
|
R_MarkLeaves();
|
||||||
R_DrawFog ();
|
R_DrawFog ();
|
||||||
|
if( RI.drawWorld )
|
||||||
|
R_AnimateRipples();
|
||||||
|
|
||||||
R_CheckGLFog();
|
R_CheckGLFog();
|
||||||
R_DrawWorld();
|
R_DrawWorld();
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ void R_NewMap( void )
|
|||||||
|
|
||||||
GL_BuildLightmaps ();
|
GL_BuildLightmaps ();
|
||||||
R_GenerateVBO();
|
R_GenerateVBO();
|
||||||
|
R_ResetRipples();
|
||||||
|
|
||||||
if( gEngfuncs.drawFuncs->R_NewMap != NULL )
|
if( gEngfuncs.drawFuncs->R_NewMap != NULL )
|
||||||
gEngfuncs.drawFuncs->R_NewMap();
|
gEngfuncs.drawFuncs->R_NewMap();
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ static void BoundPoly( int numverts, float *verts, vec3_t mins, vec3_t maxs )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SubdividePolygon_r( msurface_t *warpface, int numverts, float *verts )
|
static void SubdividePolygon_r( model_t *loadmodel, msurface_t *warpface, int numverts, float *verts )
|
||||||
{
|
{
|
||||||
vec3_t front[SUBDIVIDE_SIZE], back[SUBDIVIDE_SIZE];
|
vec3_t front[SUBDIVIDE_SIZE], back[SUBDIVIDE_SIZE];
|
||||||
mextrasurf_t *warpinfo = warpface->info;
|
mextrasurf_t *warpinfo = warpface->info;
|
||||||
@@ -88,7 +88,6 @@ static void SubdividePolygon_r( msurface_t *warpface, int numverts, float *verts
|
|||||||
float sample_size;
|
float sample_size;
|
||||||
vec3_t mins, maxs;
|
vec3_t mins, maxs;
|
||||||
glpoly_t *poly;
|
glpoly_t *poly;
|
||||||
model_t *loadmodel = gEngfuncs.Mod_GetCurrentLoadingModel();
|
|
||||||
|
|
||||||
if( numverts > ( SUBDIVIDE_SIZE - 4 ))
|
if( numverts > ( SUBDIVIDE_SIZE - 4 ))
|
||||||
gEngfuncs.Host_Error( "Mod_SubdividePolygon: too many vertexes on face ( %i )\n", numverts );
|
gEngfuncs.Host_Error( "Mod_SubdividePolygon: too many vertexes on face ( %i )\n", numverts );
|
||||||
@@ -143,8 +142,8 @@ static void SubdividePolygon_r( msurface_t *warpface, int numverts, float *verts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SubdividePolygon_r( warpface, f, front[0] );
|
SubdividePolygon_r( loadmodel, warpface, f, front[0] );
|
||||||
SubdividePolygon_r( warpface, b, back[0] );
|
SubdividePolygon_r( loadmodel, warpface, b, back[0] );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,7 +204,7 @@ void GL_SetupFogColorForSurfaces( void )
|
|||||||
vec3_t fogColor;
|
vec3_t fogColor;
|
||||||
float factor, div;
|
float factor, div;
|
||||||
|
|
||||||
if( !glState.isFogEnabled)
|
if( !glState.isFogEnabled )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( RI.currententity && RI.currententity->curstate.rendermode == kRenderTransTexture )
|
if( RI.currententity && RI.currententity->curstate.rendermode == kRenderTransTexture )
|
||||||
@@ -238,13 +237,12 @@ boundaries so that turbulent and sky warps
|
|||||||
can be done reasonably.
|
can be done reasonably.
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void GL_SubdivideSurface( msurface_t *fa )
|
void GL_SubdivideSurface( model_t *loadmodel, msurface_t *fa )
|
||||||
{
|
{
|
||||||
vec3_t verts[SUBDIVIDE_SIZE];
|
vec3_t verts[SUBDIVIDE_SIZE];
|
||||||
int numverts;
|
int numverts;
|
||||||
int i, lindex;
|
int i, lindex;
|
||||||
float *vec;
|
float *vec;
|
||||||
model_t *loadmodel = gEngfuncs.Mod_GetCurrentLoadingModel();
|
|
||||||
|
|
||||||
// convert edges back to a normal polygon
|
// convert edges back to a normal polygon
|
||||||
numverts = 0;
|
numverts = 0;
|
||||||
@@ -261,7 +259,7 @@ void GL_SubdivideSurface( msurface_t *fa )
|
|||||||
SetBits( fa->flags, SURF_DRAWTURB_QUADS ); // predict state
|
SetBits( fa->flags, SURF_DRAWTURB_QUADS ); // predict state
|
||||||
|
|
||||||
// do subdivide
|
// do subdivide
|
||||||
SubdividePolygon_r( fa, numverts, verts[0] );
|
SubdividePolygon_r( loadmodel, fa, numverts, verts[0] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -877,7 +875,7 @@ void DrawGLPolyChain( glpoly_t *p, float soffset, float toffset )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_inline qboolean R_HasLightmap( void )
|
static qboolean R_HasLightmap( void )
|
||||||
{
|
{
|
||||||
if( r_fullbright->value || !WORLDMODEL->lightdata )
|
if( r_fullbright->value || !WORLDMODEL->lightdata )
|
||||||
return false;
|
return false;
|
||||||
@@ -1137,14 +1135,15 @@ void R_RenderBrushPoly( msurface_t *fa, int cull_type )
|
|||||||
|
|
||||||
t = R_TextureAnimation( fa );
|
t = R_TextureAnimation( fa );
|
||||||
|
|
||||||
GL_Bind( XASH_TEXTURE0, t->gl_texturenum );
|
|
||||||
|
|
||||||
if( FBitSet( fa->flags, SURF_DRAWTURB ))
|
if( FBitSet( fa->flags, SURF_DRAWTURB ))
|
||||||
{
|
{
|
||||||
|
R_UploadRipples( t );
|
||||||
|
|
||||||
// warp texture, no lightmaps
|
// warp texture, no lightmaps
|
||||||
EmitWaterPolys( fa, (cull_type == CULL_BACKSIDE));
|
EmitWaterPolys( fa, (cull_type == CULL_BACKSIDE));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else GL_Bind( XASH_TEXTURE0, t->gl_texturenum );
|
||||||
|
|
||||||
if( t->fb_texturenum )
|
if( t->fb_texturenum )
|
||||||
{
|
{
|
||||||
@@ -1413,7 +1412,7 @@ void R_DrawWaterSurfaces( void )
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// set modulate mode explicitly
|
// set modulate mode explicitly
|
||||||
GL_Bind( XASH_TEXTURE0, t->gl_texturenum );
|
R_UploadRipples( t );
|
||||||
|
|
||||||
for( ; s; s = s->texturechain )
|
for( ; s; s = s->texturechain )
|
||||||
EmitWaterPolys( s, false );
|
EmitWaterPolys( s, false );
|
||||||
|
|||||||
@@ -1726,7 +1726,7 @@ static void R_LightLambert( vec4_t light[MAX_LOCALLIGHTS], const vec3_t normal,
|
|||||||
out[2] = Q_min( (int)( finalLight[2] ), 255 );
|
out[2] = Q_min( (int)( finalLight[2] ), 255 );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void R_StudioSetColorArray(short *ptricmds, vec3_t *pstudionorms, byte *color )
|
static void R_StudioSetColorArray( short *ptricmds, vec3_t *pstudionorms, byte *color )
|
||||||
{
|
{
|
||||||
float *lv = (float *)g_studio.lightvalues[ptricmds[1]];
|
float *lv = (float *)g_studio.lightvalues[ptricmds[1]];
|
||||||
|
|
||||||
@@ -1896,9 +1896,8 @@ R_StudioDrawNormalMesh
|
|||||||
generic path
|
generic path
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
_inline void R_StudioDrawNormalMesh( short *ptricmds, vec3_t *pstudionorms, float s, float t )
|
static void R_StudioDrawNormalMesh( short *ptricmds, vec3_t *pstudionorms, float s, float t )
|
||||||
{
|
{
|
||||||
float *lv;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
while(( i = *( ptricmds++ )))
|
while(( i = *( ptricmds++ )))
|
||||||
@@ -1929,9 +1928,8 @@ R_StudioDrawNormalMesh
|
|||||||
generic path
|
generic path
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
_inline void R_StudioDrawFloatMesh( short *ptricmds, vec3_t *pstudionorms )
|
static void R_StudioDrawFloatMesh( short *ptricmds, vec3_t *pstudionorms )
|
||||||
{
|
{
|
||||||
float *lv;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
while(( i = *( ptricmds++ )))
|
while(( i = *( ptricmds++ )))
|
||||||
@@ -1961,7 +1959,7 @@ R_StudioDrawNormalMesh
|
|||||||
generic path
|
generic path
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
_inline void R_StudioDrawChromeMesh( short *ptricmds, vec3_t *pstudionorms, float s, float t, float scale )
|
static void R_StudioDrawChromeMesh( short *ptricmds, vec3_t *pstudionorms, float s, float t, float scale )
|
||||||
{
|
{
|
||||||
float *lv, *av;
|
float *lv, *av;
|
||||||
int i, idx;
|
int i, idx;
|
||||||
@@ -2006,7 +2004,7 @@ _inline void R_StudioDrawChromeMesh( short *ptricmds, vec3_t *pstudionorms, floa
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_inline int R_StudioBuildIndices( qboolean tri_strip, int vertexState )
|
static int R_StudioBuildIndices( qboolean tri_strip, int vertexState )
|
||||||
{
|
{
|
||||||
// build in indices
|
// build in indices
|
||||||
if( vertexState++ < 3 )
|
if( vertexState++ < 3 )
|
||||||
@@ -2049,7 +2047,7 @@ R_StudioDrawNormalMesh
|
|||||||
generic path
|
generic path
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
_inline void R_StudioBuildArrayNormalMesh( short *ptricmds, vec3_t *pstudionorms, float s, float t )
|
static void R_StudioBuildArrayNormalMesh( short *ptricmds, vec3_t *pstudionorms, float s, float t )
|
||||||
{
|
{
|
||||||
float *lv;
|
float *lv;
|
||||||
int i;
|
int i;
|
||||||
@@ -2092,7 +2090,7 @@ R_StudioDrawNormalMesh
|
|||||||
generic path
|
generic path
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
_inline void R_StudioBuildArrayFloatMesh( short *ptricmds, vec3_t *pstudionorms )
|
static void R_StudioBuildArrayFloatMesh( short *ptricmds, vec3_t *pstudionorms )
|
||||||
{
|
{
|
||||||
float *lv;
|
float *lv;
|
||||||
int i;
|
int i;
|
||||||
@@ -2135,7 +2133,7 @@ R_StudioDrawNormalMesh
|
|||||||
generic path
|
generic path
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
_inline void R_StudioBuildArrayChromeMesh( short *ptricmds, vec3_t *pstudionorms, float s, float t, float scale )
|
static void R_StudioBuildArrayChromeMesh( short *ptricmds, vec3_t *pstudionorms, float s, float t, float scale )
|
||||||
{
|
{
|
||||||
float *lv, *av;
|
float *lv, *av;
|
||||||
int i, idx;
|
int i, idx;
|
||||||
@@ -2192,7 +2190,7 @@ _inline void R_StudioBuildArrayChromeMesh( short *ptricmds, vec3_t *pstudionorms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_inline void R_StudioDrawArrays( uint startverts, uint startelems )
|
static void R_StudioDrawArrays( uint startverts, uint startelems )
|
||||||
{
|
{
|
||||||
pglEnableClientState( GL_VERTEX_ARRAY );
|
pglEnableClientState( GL_VERTEX_ARRAY );
|
||||||
pglVertexPointer( 3, GL_FLOAT, 12, g_studio.arrayverts );
|
pglVertexPointer( 3, GL_FLOAT, 12, g_studio.arrayverts );
|
||||||
|
|||||||
225
ref/gl/gl_warp.c
225
ref/gl/gl_warp.c
@@ -62,6 +62,29 @@ static float r_turbsin[] =
|
|||||||
#include "warpsin.h"
|
#include "warpsin.h"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define RIPPLES_CACHEWIDTH_BITS 7
|
||||||
|
#define RIPPLES_CACHEWIDTH ( 1 << RIPPLES_CACHEWIDTH_BITS )
|
||||||
|
#define RIPPLES_CACHEWIDTH_MASK (( RIPPLES_CACHEWIDTH ) - 1 )
|
||||||
|
#define RIPPLES_TEXSIZE ( RIPPLES_CACHEWIDTH * RIPPLES_CACHEWIDTH )
|
||||||
|
#define RIPPLES_TEXSIZE_MASK ( RIPPLES_TEXSIZE - 1 )
|
||||||
|
|
||||||
|
STATIC_ASSERT( RIPPLES_TEXSIZE == 0x4000, "fix the algorithm to work with custom resolution" );
|
||||||
|
|
||||||
|
static struct
|
||||||
|
{
|
||||||
|
double time;
|
||||||
|
double oldtime;
|
||||||
|
|
||||||
|
short *curbuf, *oldbuf;
|
||||||
|
short buf[2][RIPPLES_TEXSIZE];
|
||||||
|
qboolean update;
|
||||||
|
|
||||||
|
uint32_t texture[RIPPLES_TEXSIZE];
|
||||||
|
int gl_texturenum;
|
||||||
|
int rippletexturenum;
|
||||||
|
float texturescale; // not all textures are 128x128, scale the texcoords down
|
||||||
|
} g_ripple;
|
||||||
|
|
||||||
static qboolean CheckSkybox( const char *name, char out[6][MAX_STRING] )
|
static qboolean CheckSkybox( const char *name, char out[6][MAX_STRING] )
|
||||||
{
|
{
|
||||||
const char *skybox_ext[3] = { "dds", "tga", "bmp" };
|
const char *skybox_ext[3] = { "dds", "tga", "bmp" };
|
||||||
@@ -799,10 +822,18 @@ void EmitWaterPolys( msurface_t *warp, qboolean reverse )
|
|||||||
os = v[3];
|
os = v[3];
|
||||||
ot = v[4];
|
ot = v[4];
|
||||||
|
|
||||||
|
if( !r_ripple.value )
|
||||||
|
{
|
||||||
s = os + r_turbsin[(int)((ot * 0.125f + gpGlobals->time) * TURBSCALE) & 255];
|
s = os + r_turbsin[(int)((ot * 0.125f + gpGlobals->time) * TURBSCALE) & 255];
|
||||||
s *= ( 1.0f / SUBDIVIDE_SIZE );
|
|
||||||
|
|
||||||
t = ot + r_turbsin[(int)((os * 0.125f + gpGlobals->time) * TURBSCALE) & 255];
|
t = ot + r_turbsin[(int)((os * 0.125f + gpGlobals->time) * TURBSCALE) & 255];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s = os / g_ripple.texturescale;
|
||||||
|
t = ot / g_ripple.texturescale;
|
||||||
|
}
|
||||||
|
|
||||||
|
s *= ( 1.0f / SUBDIVIDE_SIZE );
|
||||||
t *= ( 1.0f / SUBDIVIDE_SIZE );
|
t *= ( 1.0f / SUBDIVIDE_SIZE );
|
||||||
|
|
||||||
pglTexCoord2f( s, t );
|
pglTexCoord2f( s, t );
|
||||||
@@ -822,3 +853,193 @@ void EmitWaterPolys( msurface_t *warp, qboolean reverse )
|
|||||||
|
|
||||||
GL_SetupFogColorForSurfaces();
|
GL_SetupFogColorForSurfaces();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
============================================================
|
||||||
|
|
||||||
|
HALF-LIFE SOFTWARE WATER
|
||||||
|
|
||||||
|
============================================================
|
||||||
|
*/
|
||||||
|
void R_ResetRipples( void )
|
||||||
|
{
|
||||||
|
g_ripple.curbuf = g_ripple.buf[0];
|
||||||
|
g_ripple.oldbuf = g_ripple.buf[1];
|
||||||
|
g_ripple.time = g_ripple.oldtime = gpGlobals->time - 0.1;
|
||||||
|
memset( g_ripple.buf, 0, sizeof( g_ripple.buf ));
|
||||||
|
}
|
||||||
|
|
||||||
|
void R_InitRipples( void )
|
||||||
|
{
|
||||||
|
rgbdata_t pic = { 0 };
|
||||||
|
|
||||||
|
pic.width = pic.height = RIPPLES_CACHEWIDTH;
|
||||||
|
pic.depth = 1;
|
||||||
|
pic.flags = IMAGE_HAS_COLOR;
|
||||||
|
pic.buffer = (byte *)g_ripple.texture;
|
||||||
|
pic.type = PF_RGBA_32;
|
||||||
|
pic.size = sizeof( g_ripple.texture );
|
||||||
|
pic.numMips = 1;
|
||||||
|
memset( pic.buffer, 0, pic.size );
|
||||||
|
|
||||||
|
g_ripple.rippletexturenum = GL_LoadTextureInternal( "*rippletex", &pic, TF_NOMIPMAP );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_SwapBufs( void )
|
||||||
|
{
|
||||||
|
short *tempbufp = g_ripple.curbuf;
|
||||||
|
g_ripple.curbuf = g_ripple.oldbuf;
|
||||||
|
g_ripple.oldbuf = tempbufp;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_SpawnNewRipple( int x, int y, short val )
|
||||||
|
{
|
||||||
|
#define PIXEL( x, y ) ((( x ) & RIPPLES_CACHEWIDTH_MASK ) + ((( y ) & RIPPLES_CACHEWIDTH_MASK) << 7 ))
|
||||||
|
g_ripple.oldbuf[PIXEL( x, y )] += val;
|
||||||
|
|
||||||
|
val >>= 2;
|
||||||
|
g_ripple.oldbuf[PIXEL( x + 1, y )] += val;
|
||||||
|
g_ripple.oldbuf[PIXEL( x - 1, y )] += val;
|
||||||
|
g_ripple.oldbuf[PIXEL( x, y + 1 )] += val;
|
||||||
|
g_ripple.oldbuf[PIXEL( x, y - 1 )] += val;
|
||||||
|
#undef PIXEL
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_RunRipplesAnimation( const short *oldbuf, short *pbuf )
|
||||||
|
{
|
||||||
|
size_t i = 0;
|
||||||
|
const int w = RIPPLES_CACHEWIDTH;
|
||||||
|
const int m = RIPPLES_TEXSIZE_MASK;
|
||||||
|
|
||||||
|
for( i = w; i < m + w; i++, pbuf++ )
|
||||||
|
{
|
||||||
|
*pbuf = (
|
||||||
|
( (int)oldbuf[( i - ( w * 2 )) & m]
|
||||||
|
+ (int)oldbuf[( i - ( w + 1 )) & m]
|
||||||
|
+ (int)oldbuf[( i - ( w - 1 )) & m]
|
||||||
|
+ (int)oldbuf[( i ) & m]) >> 1 ) - (int)*pbuf;
|
||||||
|
|
||||||
|
*pbuf -= ( *pbuf >> 6 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int MostSignificantBit( unsigned int v )
|
||||||
|
{
|
||||||
|
#if __GNUC__
|
||||||
|
return 31 - __builtin_clz( v );
|
||||||
|
#else
|
||||||
|
int i;
|
||||||
|
for( i = 0, v >>= 1; v; v >>= 1, i++ );
|
||||||
|
return i;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void R_AnimateRipples( void )
|
||||||
|
{
|
||||||
|
double frametime = gpGlobals->time - g_ripple.time;
|
||||||
|
|
||||||
|
g_ripple.update = r_ripple.value && frametime >= r_ripple_updatetime.value;
|
||||||
|
|
||||||
|
if( !g_ripple.update )
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_ripple.time = gpGlobals->time;
|
||||||
|
|
||||||
|
R_SwapBufs();
|
||||||
|
|
||||||
|
if( g_ripple.time - g_ripple.oldtime > r_ripple_spawntime.value )
|
||||||
|
{
|
||||||
|
int x, y, val;
|
||||||
|
|
||||||
|
g_ripple.oldtime = g_ripple.time;
|
||||||
|
|
||||||
|
x = rand() & 0x7fff;
|
||||||
|
y = rand() & 0x7fff;
|
||||||
|
val = rand() & 0x3ff;
|
||||||
|
|
||||||
|
R_SpawnNewRipple( x, y, val );
|
||||||
|
}
|
||||||
|
|
||||||
|
R_RunRipplesAnimation( g_ripple.oldbuf, g_ripple.curbuf );
|
||||||
|
}
|
||||||
|
|
||||||
|
void R_UpdateRippleTexParams( void )
|
||||||
|
{
|
||||||
|
gl_texture_t *tex = R_GetTexture( g_ripple.rippletexturenum );
|
||||||
|
|
||||||
|
GL_Bind( XASH_TEXTURE0, g_ripple.rippletexturenum );
|
||||||
|
|
||||||
|
if( gl_texture_nearest.value )
|
||||||
|
{
|
||||||
|
pglTexParameteri( tex->target, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
|
||||||
|
pglTexParameteri( tex->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pglTexParameteri( tex->target, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||||
|
pglTexParameteri( tex->target, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void R_UploadRipples( texture_t *image )
|
||||||
|
{
|
||||||
|
gl_texture_t *glt;
|
||||||
|
uint32_t *pixels;
|
||||||
|
int wbits, wmask, wshft;
|
||||||
|
|
||||||
|
// discard unuseful textures
|
||||||
|
if( !r_ripple.value || image->width > RIPPLES_CACHEWIDTH || image->width != image->height )
|
||||||
|
{
|
||||||
|
GL_Bind( XASH_TEXTURE0, image->gl_texturenum );
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
GL_Bind( XASH_TEXTURE0, g_ripple.rippletexturenum );
|
||||||
|
|
||||||
|
// no updates this frame
|
||||||
|
if( !g_ripple.update && image->gl_texturenum == g_ripple.gl_texturenum )
|
||||||
|
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 );
|
||||||
|
wshft = 7 - wbits;
|
||||||
|
wmask = image->width - 1;
|
||||||
|
|
||||||
|
for( int y = 0; y < image->height; y++ )
|
||||||
|
{
|
||||||
|
int ry = y << ( 7 + wshft );
|
||||||
|
|
||||||
|
for( int x = 0; x < image->width; x++ )
|
||||||
|
{
|
||||||
|
int rx = x << wshft;
|
||||||
|
int val = g_ripple.curbuf[ry + rx] >> 4;
|
||||||
|
|
||||||
|
int py = (y - val) & wmask;
|
||||||
|
int px = (x + val) & wmask;
|
||||||
|
int p = ( py << wbits ) + px;
|
||||||
|
|
||||||
|
g_ripple.texture[(y << wbits) + x] = pixels[p];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pglTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, image->width, image->width, 0,
|
||||||
|
GL_RGBA, GL_UNSIGNED_BYTE, g_ripple.texture );
|
||||||
|
}
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ void R_InitSkyClouds(mip_t *mt, texture_t *tx, qboolean custom_palette)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GAME_EXPORT GL_SubdivideSurface(msurface_t *fa)
|
void GAME_EXPORT GL_SubdivideSurface( model_t *mod, msurface_t *fa )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1891,7 +1891,7 @@ R_StudioDrawNormalMesh
|
|||||||
generic path
|
generic path
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
_inline void R_StudioDrawNormalMesh( short *ptricmds, vec3_t *pstudionorms, float s, float t )
|
static void R_StudioDrawNormalMesh( short *ptricmds, vec3_t *pstudionorms, float s, float t )
|
||||||
{
|
{
|
||||||
float *lv;
|
float *lv;
|
||||||
int i;
|
int i;
|
||||||
@@ -1924,7 +1924,7 @@ R_StudioDrawNormalMesh
|
|||||||
generic path
|
generic path
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
_inline void R_StudioDrawFloatMesh( short *ptricmds, vec3_t *pstudionorms )
|
static void R_StudioDrawFloatMesh( short *ptricmds, vec3_t *pstudionorms )
|
||||||
{
|
{
|
||||||
float *lv;
|
float *lv;
|
||||||
int i;
|
int i;
|
||||||
@@ -1956,7 +1956,7 @@ R_StudioDrawNormalMesh
|
|||||||
generic path
|
generic path
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
_inline void R_StudioDrawChromeMesh( short *ptricmds, vec3_t *pstudionorms, float s, float t, float scale )
|
static void R_StudioDrawChromeMesh( short *ptricmds, vec3_t *pstudionorms, float s, float t, float scale )
|
||||||
{
|
{
|
||||||
float *lv, *av;
|
float *lv, *av;
|
||||||
int i, idx;
|
int i, idx;
|
||||||
|
|||||||
5
wscript
5
wscript
@@ -167,7 +167,7 @@ def configure(conf):
|
|||||||
conf.env.MSVC_TARGETS = ['x86' if not conf.options.ALLOW64 else 'x64']
|
conf.env.MSVC_TARGETS = ['x86' if not conf.options.ALLOW64 else 'x64']
|
||||||
|
|
||||||
# Load compilers early
|
# Load compilers early
|
||||||
conf.load('xshlib xcompile compiler_c compiler_cxx')
|
conf.load('xshlib xcompile compiler_c compiler_cxx cmake gccdeps msvcdeps')
|
||||||
|
|
||||||
if conf.options.NSWITCH:
|
if conf.options.NSWITCH:
|
||||||
conf.load('nswitch')
|
conf.load('nswitch')
|
||||||
@@ -471,12 +471,11 @@ int main(int argc, char **argv) { strchrnul(argv[1], 'x'); return 0; }'''
|
|||||||
if conf.check_cfg(package='opus', uselib_store='opus', args='opus >= 1.4 --cflags --libs', mandatory=False):
|
if conf.check_cfg(package='opus', uselib_store='opus', args='opus >= 1.4 --cflags --libs', mandatory=False):
|
||||||
# now try to link with export that only exists with CUSTOM_MODES defined
|
# now try to link with export that only exists with CUSTOM_MODES defined
|
||||||
frag='''#include <opus_custom.h>
|
frag='''#include <opus_custom.h>
|
||||||
int main(void) { return !opus_custom_encoder_init(0, 0, 0); }'''
|
int main(void) { return !opus_custom_encoder_init((OpusCustomEncoder *)1, (const OpusCustomMode *)1, 1); }'''
|
||||||
|
|
||||||
if conf.check_cc(msg='Checking if opus supports custom modes', defines='CUSTOM_MODES=1', use='opus', fragment=frag, mandatory=False):
|
if conf.check_cc(msg='Checking if opus supports custom modes', defines='CUSTOM_MODES=1', use='opus', fragment=frag, mandatory=False):
|
||||||
conf.env.HAVE_SYSTEM_OPUS = True
|
conf.env.HAVE_SYSTEM_OPUS = True
|
||||||
|
|
||||||
conf.define('XASH_BUILD_COMMIT', conf.env.GIT_VERSION if conf.env.GIT_VERSION else 'notset')
|
|
||||||
conf.define('XASH_LOW_MEMORY', conf.options.LOW_MEMORY)
|
conf.define('XASH_LOW_MEMORY', conf.options.LOW_MEMORY)
|
||||||
|
|
||||||
for i in SUBDIRS:
|
for i in SUBDIRS:
|
||||||
|
|||||||
Reference in New Issue
Block a user