Skip to content

Commit

Permalink
Merge branch 'FWGS:master' into android
Browse files Browse the repository at this point in the history
  • Loading branch information
Velaron authored Nov 1, 2023
2 parents 6bab238 + bd969f3 commit 18d769e
Show file tree
Hide file tree
Showing 25 changed files with 373 additions and 73 deletions.
24 changes: 24 additions & 0 deletions Documentation/donate.md
Original file line number Diff line number Diff line change
@@ -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`
42 changes: 18 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -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" />
[![GitHub Actions Status](https://github.com/FWGS/xash3d-fwgs/actions/workflows/c-cpp.yml/badge.svg)](https://github.com/FWGS/xash3d-fwgs/actions/workflows/c-cpp.yml) [![FreeBSD Build Status](https://img.shields.io/cirrus/github/FWGS/xash3d-fwgs?label=freebsd%20build)](https://cirrus-ci.com/github/FWGS/xash3d-fwgs) [![Discord Server](https://img.shields.io/discord/355697768582610945.svg)](http://fwgsdiscord.mentality.rip/) \
[![Download Stable](https://img.shields.io/badge/download-stable-yellow)](https://github.com/FWGS/xash3d-fwgs/releases/latest) [![Download Testing](https://img.shields.io/badge/downloads-testing-orange)](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous)
[![Download Stable](https://img.shields.io/badge/download-stable-yellow)](https://github.com/FWGS/xash3d-fwgs/releases/latest) [![Download Testing](https://img.shields.io/badge/downloads-testing-orange)](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 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.
Read more about Xash3D on ModDB: https://www.moddb.com/engines/xash3d-engine
```
Xash3D FWGS is a heavily modified fork of an original [Xash3D Engine](https://www.moddb.com/engines/xash3d-engine) by Unkle Mike.

## Donate
[![Donate to FWGS button](https://img.shields.io/badge/Donate_to_FWGS-%3C3-magenta)](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
* HLSDK 2.4 support.
* Crossplatform: supported x86 and ARM on Windows/Linux/BSD/Android. ([see docs for more info](Documentation/ports.md))
* Modern compilers support: say no more to MSVC6.
* Better multiplayer support: multiple master servers, headless dedicated server.
* Mobility API: allows better game integration on mobile devices(vibration, touch controls)
* Different input methods: touch, gamepad and classic mouse & keyboard.
* Steam Half-Life (HLSDK 2.4) support.
* Crossplatform and modern compilers support: supports Windows, Linux, BSD & Android on x86 & ARM and [many more](Documentation/ports.md).
* Better multiplayer support: multiple master servers, headless dedicated server, voice chat and IPv6 support.
* Multiple renderers support: OpenGL, GLESv1, GLESv2 and Software.
* Advanced virtual filesystem: `.pk3` and `.pk3dir` support, compatibility with GoldSrc FS module, fast case-insensitivity emulation for crossplatform.
* 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.
* Multiple renderers support: OpenGL, GLESv1, GLESv2, Software.
* Voice support.
* External filesystem module like in GoldSrc engine.
* 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.
* External VGUI support module.
* PNG & KTX2 image format support.
* [A set of small improvements](Documentation/), without broken compatibility.

## 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.
Expand Down
1 change: 1 addition & 0 deletions common/xash3d_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ typedef struct dll_info_s
} dll_info_t;

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
// the server to all connected clients.
Expand Down
11 changes: 1 addition & 10 deletions engine/client/cl_mobile.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

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 )
{
Touch_HideButtons( name, state, true );
Expand Down Expand Up @@ -124,7 +115,7 @@ static mobile_engfuncs_t gpMobileEngfuncs =
Touch_ResetDefaultButtons,
pfnDrawScaledCharacter,
Sys_Warn,
pfnGetNativeObject,
Sys_GetNativeObject,
ID_SetCustomClientID,
pfnParseFileSafe
};
Expand Down
3 changes: 3 additions & 0 deletions engine/client/ref_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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( 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_loaded, "", FCVAR_READ_ONLY, "currently loaded renderer" );

void R_GetTextureParms( int *w, int *h, int texnum )
{
Expand Down Expand Up @@ -519,6 +520,7 @@ static qboolean R_LoadRenderer( const char *refopt )
return false;
}

Cvar_FullSet( "r_refdll_loaded", refopt, FCVAR_READ_ONLY );
Con_Reportf( "Renderer %s initialized\n", refdll );

return true;
Expand Down Expand Up @@ -610,6 +612,7 @@ qboolean R_Init( void )
Cvar_RegisterVariable( &gl_clear );
Cvar_RegisterVariable( &r_showtree );
Cvar_RegisterVariable( &r_refdll );
Cvar_RegisterVariable( &r_refdll_loaded );

// cvars that are expected to exist
Cvar_Get( "r_speeds", "0", FCVAR_ARCHIVE, "shows renderer speeds" );
Expand Down
1 change: 1 addition & 0 deletions engine/common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ typedef void (*xcommand_t)( void );
qboolean FS_LoadProgs( void );
void FS_Init( void );
void FS_Shutdown( void );
void *FS_GetNativeObject( const char *obj );

//
// cmd.c
Expand Down
18 changes: 17 additions & 1 deletion engine/common/filesystem_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,17 @@ GNU General Public License for more details.
fs_api_t g_fsapi;
fs_globals_t *FI;

static pfnCreateInterface_t fs_pfnCreateInterface;
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 )
{
FS_Rescan();
Expand Down Expand Up @@ -53,7 +62,7 @@ static fs_interface_t fs_memfuncs =
_Mem_Realloc,
_Mem_Free,

Platform_GetNativeObject,
Sys_GetNativeObject,
};

static void FS_UnloadProgs( void )
Expand Down Expand Up @@ -98,6 +107,13 @@ qboolean FS_LoadProgs( void )
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" );

return true;
Expand Down
26 changes: 19 additions & 7 deletions engine/common/mod_bmodel.c
Original file line number Diff line number Diff line change
Expand Up @@ -2012,6 +2012,20 @@ static void Mod_LoadMarkSurfaces( model_t *mod, dbspmodel_t *bmod )
}
}

static qboolean Mod_LooksLikeWaterTexture( const char *name )
{
if(( name[0] == '*' && Q_stricmp( name, REF_DEFAULT_TEXTURE )) || name[0] == '!' )
return true;

if( !Host_IsQuakeCompatible( ))
{
if( !Q_strncmp( name, "water", 5 ) || !Q_strnicmp( name, "laser", 5 ))
return true;
}

return false;
}

static void Mod_LoadTextureData( model_t *mod, dbspmodel_t *bmod, int textureIndex )
{
#if !XASH_DEDICATED
Expand All @@ -2032,6 +2046,10 @@ static void Mod_LoadTextureData( model_t *mod, dbspmodel_t *bmod, int textureInd
if( FBitSet( host.features, ENGINE_IMPROVED_LINETRACE ) && mipTex->name[0] == '{' )
SetBits( txFlags, TF_KEEP_SOURCE ); // Paranoia2 texture alpha-tracing

// check if this is water to keep the source texture and expand it to RGBA (so ripple effect works)
if( Mod_LooksLikeWaterTexture( mipTex->name ))
SetBits( txFlags, TF_KEEP_SOURCE | TF_EXPAND_SOURCE );

usesCustomPalette = Mod_CalcMipTexUsesCustomPalette( mod, bmod, textureIndex );

// check for multi-layered sky texture (quake1 specific)
Expand Down Expand Up @@ -2449,15 +2467,9 @@ static void Mod_LoadSurfaces( model_t *mod, dbspmodel_t *bmod )
if( !Q_strncmp( tex->name, "sky", 3 ))
SetBits( out->flags, SURF_DRAWSKY );

if(( tex->name[0] == '*' && Q_stricmp( tex->name, REF_DEFAULT_TEXTURE )) || tex->name[0] == '!' )
if( Mod_LooksLikeWaterTexture( tex->name ))
SetBits( out->flags, SURF_DRAWTURB );

if( !Host_IsQuakeCompatible( ))
{
if( !Q_strncmp( tex->name, "water", 5 ) || !Q_strnicmp( tex->name, "laser", 5 ))
SetBits( out->flags, SURF_DRAWTURB );
}

if( !Q_strncmp( tex->name, "scroll", 6 ))
SetBits( out->flags, SURF_CONVEYOR );

Expand Down
28 changes: 28 additions & 0 deletions engine/common/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -649,3 +649,31 @@ qboolean Sys_NewInstance( const char *gamedir )

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;
}
1 change: 1 addition & 0 deletions engine/common/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ void Sys_InitLog( void );
void Sys_CloseLog( void );
void Sys_Quit( void ) NORETURN;
qboolean Sys_NewInstance( const char *gamedir );
void *Sys_GetNativeObject( const char *obj );

//
// sys_con.c
Expand Down
12 changes: 0 additions & 12 deletions engine/platform/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,6 @@ static inline void Platform_Shutdown( void )
#endif
}

static inline void *Platform_GetNativeObject( const char *name )
{
void *ptr = NULL;

#if XASH_ANDROID
ptr = Android_GetNativeObject( name );
#endif

return ptr;
}

/*
==============================================================================
Expand All @@ -157,7 +146,6 @@ static inline void *Platform_GetNativeObject( const char *name )
==============================================================================
*/
void Platform_Vibrate( float life, char flags );
void*Platform_GetNativeObject( const char *name );

/*
==============================================================================
Expand Down
2 changes: 0 additions & 2 deletions filesystem/VFileSystem009.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,4 @@ class IVFileSystem009 : public IBaseInterface
virtual void AddSearchPathNoWrite(const char *, const char *) = 0; /* linkage=_ZN11IFileSystem20AddSearchPathNoWriteEPKcS1_ */
};

#define FILESYSTEM_INTERFACE_VERSION "VFileSystem009" // never change this!

#endif // VFILESYSTEM009_H
8 changes: 4 additions & 4 deletions filesystem/filesystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,7 @@ static void _Sys_Error( const char *fmt, ... )
exit( 1 );
}

static void *_Platform_GetNativeObject_stub( const char *object )
static void *Sys_GetNativeObject_stub( const char *object )
{
return NULL;
}
Expand Down Expand Up @@ -2851,7 +2851,7 @@ fs_interface_t g_engfuncs =
_Mem_Alloc,
_Mem_Realloc,
_Mem_Free,
_Platform_GetNativeObject_stub
Sys_GetNativeObject_stub
};

static qboolean FS_InitInterface( int version, fs_interface_t *engfuncs )
Expand Down Expand Up @@ -2893,9 +2893,9 @@ static qboolean FS_InitInterface( int version, fs_interface_t *engfuncs )
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" );
}

Expand Down
5 changes: 3 additions & 2 deletions filesystem/filesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ extern "C"
#endif // __cplusplus

#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
enum
Expand Down Expand Up @@ -210,7 +211,7 @@ typedef struct fs_interface_t
void (*_Mem_Free)( void *data, const char *filename, int fileline );

// platform
void *(*_Platform_GetNativeObject)( const char *object );
void *(*_Sys_GetNativeObject)( const char *object );
} fs_interface_t;

typedef int (*FSAPI)( int version, fs_api_t *api, fs_globals_t **globals, fs_interface_t *interface );
Expand Down
2 changes: 1 addition & 1 deletion filesystem/filesystem_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ extern const fs_archive_t g_archives[];
#define Con_DPrintf (*g_engfuncs._Con_DPrintf)
#define Con_Reportf (*g_engfuncs._Con_Reportf)
#define Sys_Error (*g_engfuncs._Sys_Error)
#define Platform_GetNativeObject (*g_engfuncs._Platform_GetNativeObject)
#define Sys_GetNativeObject (*g_engfuncs._Sys_GetNativeObject)

//
// filesystem.c
Expand Down
1 change: 0 additions & 1 deletion filesystem/tests/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ typedef void *HMODULE;

HMODULE g_hModule;
FSAPI g_pfnGetFSAPI;
typedef void *(*pfnCreateInterface_t)( const char *, int * );
pfnCreateInterface_t g_pfnCreateInterface;
fs_api_t g_fs;
fs_globals_t *g_nullglobals;
Expand Down
3 changes: 3 additions & 0 deletions ref/gl/gl_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ void R_SetTextureParameters( void )
// change all the existing mipmapped texture objects
for( i = 0; i < gl_numTextures; i++ )
GL_UpdateTextureParams( i );

R_UpdateRippleTexParams();
}

/*
Expand Down Expand Up @@ -2317,6 +2319,7 @@ void R_InitImages( void )
// validate cvars
R_SetTextureParameters();
GL_CreateInternalTextures();
R_InitRipples();

gEngfuncs.Cmd_AddCommand( "texturelist", R_TextureList_f, "display loaded textures list" );
}
Expand Down
Loading

0 comments on commit 18d769e

Please sign in to comment.