Browse Source

engine: big refactoring commit, instead of using platform-specific platform-specific macros, use appropriate macros set by public/build.h

pull/2/head
Alibek Omarov 5 years ago
parent
commit
9421457b3a
  1. 2
      common/defaults.h
  2. 6
      common/port.h
  3. 3
      engine/client/avi/avi_stub.c
  4. 3
      engine/client/avi/avi_win.c
  5. 4
      engine/client/cl_game.c
  6. 3
      engine/client/cl_mobile.c
  7. 4
      engine/client/cl_render.c
  8. 4
      engine/client/in_joy.c
  9. 3
      engine/client/in_touch.c
  10. 10
      engine/client/input.c
  11. 2
      engine/client/ref_common.c
  12. 4
      engine/client/vgui/vgui_draw.c
  13. 8
      engine/common/cmd.c
  14. 4
      engine/common/common.h
  15. 8
      engine/common/con_utils.c
  16. 26
      engine/common/crashhandler.c
  17. 2
      engine/common/custom.c
  18. 2
      engine/common/cvar.c
  19. 2
      engine/common/dedicated.c
  20. 30
      engine/common/filesystem.c
  21. 15
      engine/common/host.c
  22. 2
      engine/common/host_state.c
  23. 35
      engine/common/identification.c
  24. 2
      engine/common/imagelib/img_bmp.c
  25. 2
      engine/common/imagelib/img_png.c
  26. 2
      engine/common/infostring.c
  27. 10
      engine/common/launcher.c
  28. 12
      engine/common/mod_bmodel.c
  29. 2
      engine/common/mod_sprite.c
  30. 8
      engine/common/model.c
  31. 2
      engine/common/net_chan.c
  32. 4
      engine/common/net_encode.c
  33. 36
      engine/common/net_ws.c
  34. 2
      engine/common/net_ws.h
  35. 6
      engine/common/pm_debug.c
  36. 4
      engine/common/pm_trace.c
  37. 10
      engine/common/sys_con.c
  38. 30
      engine/common/system.c
  39. 2
      engine/common/system.h
  40. 3
      engine/platform/emscripten/lib_em.h
  41. 4
      engine/platform/linux/in_evdev.c
  42. 2
      engine/platform/linux/vid_fbdev.c
  43. 4
      engine/platform/platform.h
  44. 3
      engine/platform/posix/lib_posix.c
  45. 4
      engine/platform/posix/sys_posix.c
  46. 5
      engine/platform/sdl/events.c
  47. 2
      engine/platform/sdl/in_sdl.c
  48. 4
      engine/platform/sdl/s_sdl.c
  49. 12
      engine/platform/sdl/vid_sdl.c
  50. 6
      engine/server/sv_game.c
  51. 6
      engine/server/sv_phys.c
  52. 12
      engine/server/sv_save.c
  53. 6
      ref_gl/gl_opengl.c
  54. 10
      ref_gl/gl_rsurf.c
  55. 2
      ref_gl/gl_studio.c

2
common/defaults.h

@ -26,7 +26,7 @@ SETUP BACKENDS DEFINITIONS
=================================================================== ===================================================================
*/ */
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
#if XASH_SDL #if XASH_SDL
// we are building using libSDL // we are building using libSDL
#ifndef XASH_VIDEO #ifndef XASH_VIDEO

6
common/port.h

@ -19,13 +19,13 @@ GNU General Public License for more details.
#include "build.h" #include "build.h"
#if !defined(_WIN32) #if !XASH_WIN32
#include <dlfcn.h> #include <dlfcn.h>
#include <unistd.h> #include <unistd.h>
#define PATH_SPLITTER "/" #define PATH_SPLITTER "/"
#if defined(__APPLE__) #if XASH_APPLE
#include <sys/syslimits.h> #include <sys/syslimits.h>
#include "TargetConditionals.h" #include "TargetConditionals.h"
#define OS_LIB_EXT "dylib" #define OS_LIB_EXT "dylib"
@ -37,7 +37,7 @@ GNU General Public License for more details.
#define OS_LIB_PREFIX "lib" #define OS_LIB_PREFIX "lib"
#if defined(__ANDROID__) #if XASH_ANDROID
//#if defined(LOAD_HARDFP) //#if defined(LOAD_HARDFP)
// #define POSTFIX "_hardfp" // #define POSTFIX "_hardfp"
//#else //#else

3
engine/client/avi/avi_stub.c

@ -13,7 +13,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#ifndef _WIN32 #include "build.h"
#if !XASH_WIN32
#include "common.h" #include "common.h"
int AVI_GetVideoFrameNumber( movie_state_t *Avi, float time ) int AVI_GetVideoFrameNumber( movie_state_t *Avi, float time )

3
engine/client/avi/avi_win.c

@ -13,7 +13,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#ifdef _WIN32 #include "build.h"
#if XASH_WIN32
#include "common.h" #include "common.h"
#include "client.h" #include "client.h"
#include <vfw.h> // video for windows #include <vfw.h> // video for windows

4
engine/client/cl_game.c

@ -1960,7 +1960,7 @@ GetWindowCenterX
static int pfnGetWindowCenterX( void ) static int pfnGetWindowCenterX( void )
{ {
int x = 0; int x = 0;
#ifdef _WIN32 #if XASH_WIN32
if( m_ignore->value ) if( m_ignore->value )
{ {
POINT pos; POINT pos;
@ -1985,7 +1985,7 @@ GetWindowCenterY
static int pfnGetWindowCenterY( void ) static int pfnGetWindowCenterY( void )
{ {
int y = 0; int y = 0;
#ifdef _WIN32 #if XASH_WIN32
if( m_ignore->value ) if( m_ignore->value )
{ {
POINT pos; POINT pos;

3
engine/client/cl_mobile.c

@ -13,8 +13,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#ifndef XASH_DEDICATED
#include "common.h" #include "common.h"
#include "client.h" #include "client.h"
#include "mobility_int.h" #include "mobility_int.h"
@ -136,4 +134,3 @@ void Mobile_Shutdown( void )
{ {
Cmd_RemoveCommand( "vibrate" ); Cmd_RemoveCommand( "vibrate" );
} }
#endif // XASH_DEDICATED

4
engine/client/cl_render.c

@ -13,8 +13,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#ifndef XASH_DEDICATED
#include "common.h" #include "common.h"
#include "client.h" #include "client.h"
#include "library.h" #include "library.h"
@ -345,5 +343,3 @@ qboolean R_InitRenderAPI( void )
// render interface is missed // render interface is missed
return true; return true;
} }
#endif // XASH_DEDICATED

4
engine/client/in_joy.c

@ -14,8 +14,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#ifndef XASH_DEDICATED
#include "common.h" #include "common.h"
#include "input.h" #include "input.h"
#include "keydefs.h" #include "keydefs.h"
@ -439,5 +437,3 @@ void Joy_Shutdown( void )
{ {
Cvar_FullSet( "joy_found", 0, FCVAR_READ_ONLY ); Cvar_FullSet( "joy_found", 0, FCVAR_READ_ONLY );
} }
#endif // XASH_DEDICATED

3
engine/client/in_touch.c

@ -12,8 +12,6 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#ifndef XASH_DEDICATED
#include "common.h" #include "common.h"
#include "input.h" #include "input.h"
#include "client.h" #include "client.h"
@ -1975,4 +1973,3 @@ void Touch_Shutdown( void )
touch.initialized = false; touch.initialized = false;
Mem_FreePool( &touch.mempool ); Mem_FreePool( &touch.mempool );
} }
#endif

10
engine/client/input.c

@ -225,7 +225,7 @@ void IN_ToggleClientMouse( int newstate, int oldstate )
SDL_SetRelativeMouseMode( SDL_FALSE ); SDL_SetRelativeMouseMode( SDL_FALSE );
#endif #endif
#endif // XASH_SDL #endif // XASH_SDL
#ifdef __ANDROID__ #if XASH_ANDROID
Android_ShowMouse( true ); Android_ShowMouse( true );
#endif #endif
#ifdef XASH_USE_EVDEV #ifdef XASH_USE_EVDEV
@ -234,7 +234,7 @@ void IN_ToggleClientMouse( int newstate, int oldstate )
} }
else else
{ {
#ifdef __ANDROID__ #if XASH_ANDROID
Android_ShowMouse( false ); Android_ShowMouse( false );
#endif #endif
#ifdef XASH_USE_EVDEV #ifdef XASH_USE_EVDEV
@ -422,12 +422,12 @@ void IN_MouseEvent( void )
} }
else else
{ {
#if XASH_SDL && !defined(_WIN32) #if XASH_SDL && !XASH_WIN32
#if SDL_VERSION_ATLEAST( 2, 0, 0 ) #if SDL_VERSION_ATLEAST( 2, 0, 0 )
SDL_SetRelativeMouseMode( SDL_FALSE ); SDL_SetRelativeMouseMode( SDL_FALSE );
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 ) #endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
SDL_ShowCursor( SDL_TRUE ); SDL_ShowCursor( SDL_TRUE );
#endif // XASH_SDL && !defined(_WIN32) #endif // XASH_SDL && !XASH_WIN32
IN_MouseMove(); IN_MouseMove();
} }
} }
@ -579,7 +579,7 @@ void IN_CollectInput( float *forward, float *side, float *pitch, float *yaw, qbo
} }
#endif // INPUT_SDL #endif // INPUT_SDL
#ifdef __ANDROID__ #if XASH_INPUT == INPUT_ANDROID
{ {
float x, y; float x, y;
Android_MouseMove( &x, &y ); Android_MouseMove( &x, &y );

2
engine/client/ref_common.c

@ -566,7 +566,7 @@ static void SetWidthAndHeightFromCommandLine( void )
static void SetFullscreenModeFromCommandLine( void ) static void SetFullscreenModeFromCommandLine( void )
{ {
#ifndef __ANDROID__ #if !XASH_MOBILE_PLATFORM
if ( Sys_CheckParm("-fullscreen") ) if ( Sys_CheckParm("-fullscreen") )
{ {
Cvar_Set( "fullscreen", "1" ); Cvar_Set( "fullscreen", "1" );

4
engine/client/vgui/vgui_draw.c

@ -12,9 +12,6 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#ifndef XASH_DEDICATED
#include <string.h> #include <string.h>
#include "common.h" #include "common.h"
#include "client.h" #include "client.h"
@ -551,4 +548,3 @@ void *GAME_EXPORT VGui_GetPanel( void )
return vgui.GetPanel(); return vgui.GetPanel();
return NULL; return NULL;
} }
#endif

8
engine/common/cmd.c

@ -999,7 +999,7 @@ void Cmd_ExecuteString( char *text )
// forward the command line to the server, so the entity DLL can parse it // forward the command line to the server, so the entity DLL can parse it
if( host.type == HOST_NORMAL ) if( host.type == HOST_NORMAL )
{ {
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
if( cls.state >= ca_connected ) if( cls.state >= ca_connected )
{ {
Cmd_ForwardToServer(); Cmd_ForwardToServer();
@ -1022,7 +1022,7 @@ things like godmode, noclip, etc, are commands directed to the server,
so when they are typed in at the console, they will need to be forwarded. so when they are typed in at the console, they will need to be forwarded.
=================== ===================
*/ */
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
void Cmd_ForwardToServer( void ) void Cmd_ForwardToServer( void )
{ {
char str[MAX_CMD_BUFFER]; char str[MAX_CMD_BUFFER];
@ -1248,9 +1248,9 @@ void Cmd_Init( void )
Cmd_AddCommand( "cmdlist", Cmd_List_f, "display all console commands beginning with the specified prefix" ); Cmd_AddCommand( "cmdlist", Cmd_List_f, "display all console commands beginning with the specified prefix" );
Cmd_AddCommand( "stuffcmds", Cmd_StuffCmds_f, "execute commandline parameters (must be present in .rc script)" ); Cmd_AddCommand( "stuffcmds", Cmd_StuffCmds_f, "execute commandline parameters (must be present in .rc script)" );
Cmd_AddCommand( "apropos", Cmd_Apropos_f, "lists all console variables/commands/aliases containing the specified string in the name or description" ); Cmd_AddCommand( "apropos", Cmd_Apropos_f, "lists all console variables/commands/aliases containing the specified string in the name or description" );
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
Cmd_AddCommand( "cmd", Cmd_ForwardToServer, "send a console commandline to the server" ); Cmd_AddCommand( "cmd", Cmd_ForwardToServer, "send a console commandline to the server" );
#endif #endif // XASH_DEDICATED
Cmd_AddCommand( "alias", Cmd_Alias_f, "create a script function. Without arguments show the list of all alias" ); Cmd_AddCommand( "alias", Cmd_Alias_f, "create a script function. Without arguments show the list of all alias" );
Cmd_AddCommand( "unalias", Cmd_UnAlias_f, "remove a script function" ); Cmd_AddCommand( "unalias", Cmd_UnAlias_f, "remove a script function" );
Cmd_AddCommand( "if", Cmd_If_f, "compare and set condition bits" ); Cmd_AddCommand( "if", Cmd_If_f, "compare and set condition bits" );

4
engine/common/common.h

@ -45,7 +45,7 @@ XASH SPECIFIC - sort of hack that works only in Xash3D not in GoldSrc
#include <stdlib.h> // rand, adbs #include <stdlib.h> // rand, adbs
#include <stdarg.h> // va #include <stdarg.h> // va
#ifndef _WIN32 #if !XASH_WIN32
#include <stddef.h> // size_t #include <stddef.h> // size_t
#else #else
#include <sys/types.h> // off_t #include <sys/types.h> // off_t
@ -60,7 +60,7 @@ XASH SPECIFIC - sort of hack that works only in Xash3D not in GoldSrc
#error "Please select timer backend" #error "Please select timer backend"
#endif #endif
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
#if XASH_VIDEO == VIDEO_NULL #if XASH_VIDEO == VIDEO_NULL
#error "Please select video backend" #error "Please select video backend"
#endif #endif

8
engine/common/con_utils.c

@ -481,7 +481,7 @@ qboolean Cmd_GetSoundList( const char *s, char *completedname, int length )
return true; return true;
} }
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
/* /*
===================================== =====================================
Cmd_GetItemsList Cmd_GetItemsList
@ -986,7 +986,7 @@ autocomplete_list_t cmd_list[] =
{ "music", 1, Cmd_GetMusicList, }, { "music", 1, Cmd_GetMusicList, },
{ "movie", 1, Cmd_GetMovieList }, { "movie", 1, Cmd_GetMovieList },
{ "exec", 1, Cmd_GetConfigList }, { "exec", 1, Cmd_GetConfigList },
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
{ "give", 1, Cmd_GetItemsList }, { "give", 1, Cmd_GetItemsList },
{ "drop", 1, Cmd_GetItemsList }, { "drop", 1, Cmd_GetItemsList },
{ "bind", 1, Cmd_GetKeysList }, { "bind", 1, Cmd_GetKeysList },
@ -1314,9 +1314,7 @@ void Cmd_WriteOpenGLVariables( file_t *f )
Cvar_LookupVars( FCVAR_GLCONFIG, NULL, f, (setpair_t)Cmd_WriteOpenGLCvar ); Cvar_LookupVars( FCVAR_GLCONFIG, NULL, f, (setpair_t)Cmd_WriteOpenGLCvar );
} }
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
void Host_FinalizeConfig( file_t *f, const char *config ) void Host_FinalizeConfig( file_t *f, const char *config )
{ {
string backup, newcfg; string backup, newcfg;

26
engine/common/crashhandler.c

@ -233,7 +233,7 @@ void Sys_RestoreCrashHandler( void )
#include "library.h" #include "library.h"
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__ANDROID__) || defined(__linux__) #if XASH_FREEBSD || XASH_NETBSD || XASH_ANDROID || XASH_LINUX
#define HAVE_UCONTEXT_H 1 #define HAVE_UCONTEXT_H 1
#endif #endif
@ -276,22 +276,22 @@ static void Sys_Crash( int signal, siginfo_t *si, void *context)
int len, logfd, i = 0; int len, logfd, i = 0;
size_t pagesize; size_t pagesize;
#if defined(__OpenBSD__) #if XASH_OPENBSD
struct sigcontext *ucontext = (struct sigcontext*)context; struct sigcontext *ucontext = (struct sigcontext*)context;
#else #else
ucontext_t *ucontext = (ucontext_t*)context; ucontext_t *ucontext = (ucontext_t*)context;
#endif #endif
#if defined(__x86_64__) #if XASH_AMD64
#if defined(__FreeBSD__) #if XASH_FREEBSD
pc = (void*)ucontext->uc_mcontext.mc_rip; pc = (void*)ucontext->uc_mcontext.mc_rip;
bp = (void**)ucontext->uc_mcontext.mc_rbp; bp = (void**)ucontext->uc_mcontext.mc_rbp;
sp = (void**)ucontext->uc_mcontext.mc_rsp; sp = (void**)ucontext->uc_mcontext.mc_rsp;
#elif defined(__NetBSD__) #elif XASH_NETBSD
pc = (void*)ucontext->uc_mcontext.__gregs[REG_RIP]; pc = (void*)ucontext->uc_mcontext.__gregs[REG_RIP];
bp = (void**)ucontext->uc_mcontext.__gregs[REG_RBP]; bp = (void**)ucontext->uc_mcontext.__gregs[REG_RBP];
sp = (void**)ucontext->uc_mcontext.__gregs[REG_RSP]; sp = (void**)ucontext->uc_mcontext.__gregs[REG_RSP];
#elif defined(__OpenBSD__) #elif XASH_OPENBSD
pc = (void*)ucontext->sc_rip; pc = (void*)ucontext->sc_rip;
bp = (void**)ucontext->sc_rbp; bp = (void**)ucontext->sc_rbp;
sp = (void**)ucontext->sc_rsp; sp = (void**)ucontext->sc_rsp;
@ -300,16 +300,16 @@ static void Sys_Crash( int signal, siginfo_t *si, void *context)
bp = (void**)ucontext->uc_mcontext.gregs[REG_RBP]; bp = (void**)ucontext->uc_mcontext.gregs[REG_RBP];
sp = (void**)ucontext->uc_mcontext.gregs[REG_RSP]; sp = (void**)ucontext->uc_mcontext.gregs[REG_RSP];
#endif #endif
#elif defined(__i386__) #elif XASH_X86
#if defined(__FreeBSD__) #if XASH_FREEBSD
pc = (void*)ucontext->uc_mcontext.mc_eip; pc = (void*)ucontext->uc_mcontext.mc_eip;
bp = (void**)ucontext->uc_mcontext.mc_ebp; bp = (void**)ucontext->uc_mcontext.mc_ebp;
sp = (void**)ucontext->uc_mcontext.mc_esp; sp = (void**)ucontext->uc_mcontext.mc_esp;
#elif defined(__NetBSD__) #elif XASH_NETBSD
pc = (void*)ucontext->uc_mcontext.__gregs[REG_EIP]; pc = (void*)ucontext->uc_mcontext.__gregs[REG_EIP];
bp = (void**)ucontext->uc_mcontext.__gregs[REG_EBP]; bp = (void**)ucontext->uc_mcontext.__gregs[REG_EBP];
sp = (void**)ucontext->uc_mcontext.__gregs[REG_ESP]; sp = (void**)ucontext->uc_mcontext.__gregs[REG_ESP];
#elif defined(__OpenBSD__) #elif XASH_OPENBSD
pc = (void*)ucontext->sc_eip; pc = (void*)ucontext->sc_eip;
bp = (void**)ucontext->sc_ebp; bp = (void**)ucontext->sc_ebp;
sp = (void**)ucontext->sc_esp; sp = (void**)ucontext->sc_esp;
@ -318,11 +318,11 @@ static void Sys_Crash( int signal, siginfo_t *si, void *context)
bp = (void**)ucontext->uc_mcontext.gregs[REG_EBP]; bp = (void**)ucontext->uc_mcontext.gregs[REG_EBP];
sp = (void**)ucontext->uc_mcontext.gregs[REG_ESP]; sp = (void**)ucontext->uc_mcontext.gregs[REG_ESP];
#endif #endif
#elif defined(__aarch64__) // arm not tested #elif XASH_ARM64
pc = (void*)ucontext->uc_mcontext.pc; pc = (void*)ucontext->uc_mcontext.pc;
bp = (void*)ucontext->uc_mcontext.regs[29]; bp = (void*)ucontext->uc_mcontext.regs[29];
sp = (void*)ucontext->uc_mcontext.sp; sp = (void*)ucontext->uc_mcontext.sp;
#elif defined(__arm__) #elif XASH_ARM
pc = (void*)ucontext->uc_mcontext.arm_pc; pc = (void*)ucontext->uc_mcontext.arm_pc;
bp = (void*)ucontext->uc_mcontext.arm_fp; bp = (void*)ucontext->uc_mcontext.arm_fp;
sp = (void*)ucontext->uc_mcontext.arm_sp; sp = (void*)ucontext->uc_mcontext.arm_sp;
@ -334,7 +334,7 @@ static void Sys_Crash( int signal, siginfo_t *si, void *context)
len = Q_snprintf( message, sizeof( message ), "Ver: %s %s (build %i-%s, %s-%s)\n", len = Q_snprintf( message, sizeof( message ), "Ver: %s %s (build %i-%s, %s-%s)\n",
XASH_ENGINE_NAME, XASH_VERSION, Q_buildnum(), Q_buildcommit(), Q_buildos(), Q_buildarch() ); XASH_ENGINE_NAME, XASH_VERSION, Q_buildnum(), Q_buildcommit(), Q_buildos(), Q_buildarch() );
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) #if !XASH_BSD
len += Q_snprintf( message + len, sizeof( message ) - len, "Crash: signal %d errno %d with code %d at %p %p\n", signal, si->si_errno, si->si_code, si->si_addr, si->si_ptr ); len += Q_snprintf( message + len, sizeof( message ) - len, "Crash: signal %d errno %d with code %d at %p %p\n", signal, si->si_errno, si->si_code, si->si_addr, si->si_ptr );
#else #else
len += Q_snprintf( message + len, sizeof( message ) - len, "Crash: signal %d errno %d with code %d at %p\n", signal, si->si_errno, si->si_code, si->si_addr ); len += Q_snprintf( message + len, sizeof( message ) - len, "Crash: signal %d errno %d with code %d at %p\n", signal, si->si_errno, si->si_code, si->si_addr );

2
engine/common/custom.c

@ -45,7 +45,7 @@ void COM_ClearCustomizationList( customization_t *pHead, qboolean bCleanDecals )
if( pCurrent->bInUse && pCurrent->pInfo ) if( pCurrent->bInUse && pCurrent->pInfo )
{ {
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
if( pCurrent->resource.type == t_decal ) if( pCurrent->resource.type == t_decal )
{ {
if( bCleanDecals && CL_Active( )) if( bCleanDecals && CL_Active( ))

2
engine/common/cvar.c

@ -113,7 +113,7 @@ static qboolean Cvar_UpdateInfo( convar_t *var, const char *value, qboolean noti
Info_SetValueForKey( SV_Serverinfo(), var->name, value, MAX_SERVERINFO_STRING ), Info_SetValueForKey( SV_Serverinfo(), var->name, value, MAX_SERVERINFO_STRING ),
SV_BroadcastCommand( "fullserverinfo \"%s\"\n", SV_Serverinfo( )); SV_BroadcastCommand( "fullserverinfo \"%s\"\n", SV_Serverinfo( ));
} }
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
else else
{ {
if( !Info_SetValueForKey( CL_Userinfo(), var->name, value, MAX_INFO_STRING )) if( !Info_SetValueForKey( CL_Userinfo(), var->name, value, MAX_INFO_STRING ))

2
engine/common/dedicated.c

@ -12,7 +12,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#ifdef XASH_DEDICATED #if XASH_DEDICATED
#include "common.h" #include "common.h"
#include "mathlib.h" #include "mathlib.h"
#include "ref_api.h" #include "ref_api.h"

30
engine/common/filesystem.c

@ -13,10 +13,11 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#include "build.h"
#include <fcntl.h> #include <fcntl.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#ifdef _WIN32 #if XASH_WIN32
#include <direct.h> #include <direct.h>
#include <io.h> #include <io.h>
#else #else
@ -143,7 +144,7 @@ char fs_gamedir[MAX_SYSPATH]; // game current directory
char fs_writedir[MAX_SYSPATH]; // path that game allows to overwrite, delete and rename files (and create new of course) char fs_writedir[MAX_SYSPATH]; // path that game allows to overwrite, delete and rename files (and create new of course)
qboolean fs_ext_path = false; // attempt to read\write from ./ or ../ pathes qboolean fs_ext_path = false; // attempt to read\write from ./ or ../ pathes
#ifndef _WIN32 #if !XASH_WIN32
qboolean fs_caseinsensitive = true; // try to search missing files qboolean fs_caseinsensitive = true; // try to search missing files
#endif #endif
@ -248,7 +249,7 @@ static void listdirectory( stringlist_t *list, const char *path, qboolean lowerc
{ {
int i; int i;
signed char *c; signed char *c;
#ifdef _WIN32 #if XASH_WIN32
char pattern[4096]; char pattern[4096];
struct _finddata_t n_file; struct _finddata_t n_file;
int hFile; int hFile;
@ -257,7 +258,7 @@ static void listdirectory( stringlist_t *list, const char *path, qboolean lowerc
struct dirent *entry; struct dirent *entry;
#endif #endif
#ifdef _WIN32 #if XASH_WIN32
Q_snprintf( pattern, sizeof( pattern ), "%s*", path ); Q_snprintf( pattern, sizeof( pattern ), "%s*", path );
// ask for the directory listing handle // ask for the directory listing handle
@ -304,7 +305,7 @@ emulate WIN32 FS behaviour when opening local file
*/ */
static const char *FS_FixFileCase( const char *path ) static const char *FS_FixFileCase( const char *path )
{ {
#if !defined _WIN32 && !TARGET_OS_IPHONE // assume case insensitive #if !XASH_WIN32 && !XASH_IOS // assume case insensitive
DIR *dir; struct dirent *entry; DIR *dir; struct dirent *entry;
char path2[PATH_MAX], *fname; char path2[PATH_MAX], *fname;
@ -491,7 +492,7 @@ pack_t *FS_LoadPackPAK( const char *packfile, int *error )
packhandle = open( packfile, O_RDONLY|O_BINARY ); packhandle = open( packfile, O_RDONLY|O_BINARY );
#ifndef _WIN32 #if !XASH_WIN32
if( packhandle < 0 ) if( packhandle < 0 )
{ {
const char *fpackfile = FS_FixFileCase( packfile ); const char *fpackfile = FS_FixFileCase( packfile );
@ -602,7 +603,7 @@ static zip_t *FS_LoadZip( const char *zipfile, int *error )
zip->handle = FS_Open( zipfile, "rb", true ); zip->handle = FS_Open( zipfile, "rb", true );
#ifndef _WIN32 #if !XASH_WIN32
if( !zip->handle ) if( !zip->handle )
{ {
const char *fzipfile = FS_FixFileCase( zipfile ); const char *fzipfile = FS_FixFileCase( zipfile );
@ -1269,16 +1270,11 @@ void FS_Rescan( void )
FS_ClearSearchPath(); FS_ClearSearchPath();
#if TARGET_OS_IPHONE #if XASH_IOS
{ {
FS_AddPak_Fullpath( va( "%sextras.pak", SDL_GetBasePath() ), NULL, extrasFlags ); FS_AddPak_Fullpath( va( "%sextras.pak", SDL_GetBasePath() ), NULL, extrasFlags );
FS_AddPak_Fullpath( va( "%sextras_%s.pak", SDL_GetBasePath(), GI->gamefolder ), NULL, extrasFlags ); FS_AddPak_Fullpath( va( "%sextras_%s.pak", SDL_GetBasePath(), GI->gamefolder ), NULL, extrasFlags );
} }
#elif defined(__SAILFISH__)
{
FS_AddPak_Fullpath( va( SHAREPATH"/extras.pak" ), NULL, extrasFlags );
FS_AddPak_Fullpath( va( SHAREPATH"/%s/extras.pak", GI->gamefolder ), NULL, extrasFlags );
}
#else #else
if( ( str = getenv( "XASH3D_EXTRAS_PAK1" ) ) ) if( ( str = getenv( "XASH3D_EXTRAS_PAK1" ) ) )
FS_AddPak_Fullpath( str, NULL, extrasFlags ); FS_AddPak_Fullpath( str, NULL, extrasFlags );
@ -1922,7 +1918,7 @@ void FS_Init( void )
Cmd_AddCommand( "fs_path", FS_Path_f, "show filesystem search pathes" ); Cmd_AddCommand( "fs_path", FS_Path_f, "show filesystem search pathes" );
Cmd_AddCommand( "fs_clearpaths", FS_ClearPaths_f, "clear filesystem search pathes" ); Cmd_AddCommand( "fs_clearpaths", FS_ClearPaths_f, "clear filesystem search pathes" );
#ifndef _WIN32 #if !XASH_WIN32
if( Sys_CheckParm( "-casesensitive" ) ) if( Sys_CheckParm( "-casesensitive" ) )
fs_caseinsensitive = false; fs_caseinsensitive = false;
@ -2116,7 +2112,7 @@ static file_t *FS_SysOpen( const char *filepath, const char *mode )
file->handle = open( filepath, mod|opt, 0666 ); file->handle = open( filepath, mod|opt, 0666 );
#ifndef _WIN32 #if !XASH_WIN32
if( file->handle < 0 ) if( file->handle < 0 )
{ {
const char *ffilepath = FS_FixFileCase( filepath ); const char *ffilepath = FS_FixFileCase( filepath );
@ -2182,7 +2178,7 @@ Look for a file in the filesystem only
*/ */
qboolean FS_SysFileExists( const char *path, qboolean caseinsensitive ) qboolean FS_SysFileExists( const char *path, qboolean caseinsensitive )
{ {
#ifdef _WIN32 #if XASH_WIN32
int desc; int desc;
if(( desc = open( path, O_RDONLY|O_BINARY )) < 0 ) if(( desc = open( path, O_RDONLY|O_BINARY )) < 0 )
@ -2220,7 +2216,7 @@ Look for a existing folder
*/ */
qboolean FS_SysFolderExists( const char *path ) qboolean FS_SysFolderExists( const char *path )
{ {
#ifdef _WIN32 #if XASH_WIN32
DWORD dwFlags = GetFileAttributes( path ); DWORD dwFlags = GetFileAttributes( path );
return ( dwFlags != -1 ) && ( dwFlags & FILE_ATTRIBUTE_DIRECTORY ); return ( dwFlags != -1 ) && ( dwFlags & FILE_ATTRIBUTE_DIRECTORY );

15
engine/common/host.c

@ -13,19 +13,20 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#include "build.h"
#ifdef XASH_SDL #ifdef XASH_SDL
#include <SDL.h> #include <SDL.h>
#endif // XASH_SDL #endif // XASH_SDL
#include <stdarg.h> // va_args #include <stdarg.h> // va_args
#include <errno.h> // errno #include <errno.h> // errno
#include <string.h> // strerror #include <string.h> // strerror
#ifndef _WIN32 #if !XASH_WIN32
#include <unistd.h> // fork #include <unistd.h> // fork
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#endif #endif
#ifdef __EMSCRIPTEN__ #if XASH_EMSCRIPTEN
#include <emscripten/emscripten.h> #include <emscripten/emscripten.h>
#endif #endif
#include <errno.h> #include <errno.h>
@ -113,7 +114,7 @@ qboolean Host_IsQuakeCompatible( void )
if( FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE )) if( FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE ))
return true; return true;
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
// quake demo playing // quake demo playing
if( cls.demoplayback == DEMO_QUAKE1 ) if( cls.demoplayback == DEMO_QUAKE1 )
return true; return true;
@ -139,7 +140,7 @@ void Host_EndGame( qboolean abort, const char *message, ... )
Con_Printf( "Host_EndGame: %s\n", string ); Con_Printf( "Host_EndGame: %s\n", string );
SV_Shutdown( "\n" ); SV_Shutdown( "\n" );
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
CL_Disconnect(); CL_Disconnect();
// recreate world if needs // recreate world if needs
@ -451,7 +452,7 @@ double Host_CalcFPS( void )
{ {
fps = sys_ticrate.value; fps = sys_ticrate.value;
} }
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
else if( CL_IsPlaybackDemo() || CL_IsRecordDemo( )) // NOTE: we should play demos with same fps as it was recorded else if( CL_IsPlaybackDemo() || CL_IsRecordDemo( )) // NOTE: we should play demos with same fps as it was recorded
{ {
fps = CL_GetDemoFramerate(); fps = CL_GetDemoFramerate();
@ -800,7 +801,7 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
host.con_showalways = true; host.con_showalways = true;
#ifdef XASH_DEDICATED #if XASH_DEDICATED
host.type = HOST_DEDICATED; // predict state host.type = HOST_DEDICATED; // predict state
#else #else
if( Sys_CheckParm("-dedicated") || progname[0] == '#' ) if( Sys_CheckParm("-dedicated") || progname[0] == '#' )
@ -1057,7 +1058,7 @@ void EXPORT Host_Shutdown( void )
if( host.status != HOST_ERR_FATAL ) host.status = HOST_SHUTDOWN; // prepare host to normal shutdown if( host.status != HOST_ERR_FATAL ) host.status = HOST_SHUTDOWN; // prepare host to normal shutdown
if( !host.change_game ) Q_strncpy( host.finalmsg, "Server shutdown", sizeof( host.finalmsg )); if( !host.change_game ) Q_strncpy( host.finalmsg, "Server shutdown", sizeof( host.finalmsg ));
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
if( host.type == HOST_NORMAL ) if( host.type == HOST_NORMAL )
Host_WriteConfig(); Host_WriteConfig();
#endif #endif

2
engine/common/host_state.c

@ -136,7 +136,7 @@ void Host_ShutdownGame( void )
void Host_RunFrame( float time ) void Host_RunFrame( float time )
{ {
// at this time, we don't need to get events from OS on dedicated // at this time, we don't need to get events from OS on dedicated
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
Platform_RunEvents(); Platform_RunEvents();
#endif // XASH_DEDICATED #endif // XASH_DEDICATED

35
engine/common/identification.c

@ -15,7 +15,7 @@ GNU General Public License for more details.
#include "common.h" #include "common.h"
#include <fcntl.h> #include <fcntl.h>
#ifndef _WIN32 #if !XASH_WIN32
#include <dirent.h> #include <dirent.h>
#endif #endif
static char id_md5[33]; static char id_md5[33];
@ -161,8 +161,7 @@ void ID_VerifyHEX_f( void )
Msg( "Bad\n" ); Msg( "Bad\n" );
} }
#ifdef __linux__ #if XASH_LINUX
qboolean ID_ProcessCPUInfo( bloomfilter_t *value ) qboolean ID_ProcessCPUInfo( bloomfilter_t *value )
{ {
int cpuinfofd = open( "/proc/cpuinfo", O_RDONLY ); int cpuinfofd = open( "/proc/cpuinfo", O_RDONLY );
@ -317,7 +316,7 @@ qboolean ID_ProcessFile( bloomfilter_t *value, const char *path )
return true; return true;
} }
#ifndef _WIN32 #if !XASH_WIN32
int ID_ProcessFiles( bloomfilter_t *value, const char *prefix, const char *postfix ) int ID_ProcessFiles( bloomfilter_t *value, const char *prefix, const char *postfix )
{ {
DIR *dir; DIR *dir;
@ -483,7 +482,7 @@ int ID_CheckWMIC( bloomfilter_t value, const char *cmdline )
#endif #endif
#if TARGET_OS_IOS #if XASH_IOS
char *IOS_GetUDID( void ); char *IOS_GetUDID( void );
#endif #endif
@ -492,8 +491,8 @@ bloomfilter_t ID_GenerateRawId( void )
bloomfilter_t value = 0; bloomfilter_t value = 0;
int count = 0; int count = 0;
#ifdef __linux__ #if XASH_LINUX
#if defined(__ANDROID__) && !defined(XASH_DEDICATED) #if XASH_ANDROID && !XASH_DEDICATED
{ {
const char *androidid = Android_GetAndroidID(); const char *androidid = Android_GetAndroidID();
if( androidid && ID_VerifyHEX( androidid ) ) if( androidid && ID_VerifyHEX( androidid ) )
@ -507,11 +506,11 @@ bloomfilter_t ID_GenerateRawId( void )
count += ID_ProcessFiles( &value, "/sys/block", "device/cid" ); count += ID_ProcessFiles( &value, "/sys/block", "device/cid" );
count += ID_ProcessNetDevices( &value ); count += ID_ProcessNetDevices( &value );
#endif #endif
#ifdef _WIN32 #if XASH_WIN32
count += ID_ProcessWMIC( &value, "wmic path win32_physicalmedia get SerialNumber " ); count += ID_ProcessWMIC( &value, "wmic path win32_physicalmedia get SerialNumber " );
count += ID_ProcessWMIC( &value, "wmic bios get serialnumber " ); count += ID_ProcessWMIC( &value, "wmic bios get serialnumber " );
#endif #endif
#if TARGET_OS_IOS #if XASH_IOS
{ {
value |= BloomFilter_ProcessStr(IOS_GetUDID()); value |= BloomFilter_ProcessStr(IOS_GetUDID());
count ++; count ++;
@ -525,8 +524,8 @@ uint ID_CheckRawId( bloomfilter_t filter )
bloomfilter_t value = 0; bloomfilter_t value = 0;
int count = 0; int count = 0;
#ifdef __linux__ #if XASH_LINUX
#if defined(__ANDROID__) && !defined(XASH_DEDICATED) #if XASH_ANDROID && !XASH_DEDICATED
{ {
const char *androidid = Android_GetAndroidID(); const char *androidid = Android_GetAndroidID();
if( androidid && ID_VerifyHEX( androidid ) ) if( androidid && ID_VerifyHEX( androidid ) )
@ -543,12 +542,12 @@ uint ID_CheckRawId( bloomfilter_t filter )
count += (filter & value) == value; count += (filter & value) == value;
#endif #endif
#ifdef _WIN32 #if XASH_WIN32
count += ID_CheckWMIC( filter, "wmic path win32_physicalmedia get SerialNumber" ); count += ID_CheckWMIC( filter, "wmic path win32_physicalmedia get SerialNumber" );
count += ID_CheckWMIC( filter, "wmic bios get serialnumber" ); count += ID_CheckWMIC( filter, "wmic bios get serialnumber" );
#endif #endif
#if TARGET_OS_IOS #if XASH_IOS
{ {
value = BloomFilter_ProcessStr(IOS_GetUDID()); value = BloomFilter_ProcessStr(IOS_GetUDID());
count += (filter & value) == value; count += (filter & value) == value;
@ -617,11 +616,11 @@ void ID_Init( void )
Cmd_AddCommand( "bloomfilter", ID_BloomFilter_f, "print bloomfilter raw value of arguments set"); Cmd_AddCommand( "bloomfilter", ID_BloomFilter_f, "print bloomfilter raw value of arguments set");
Cmd_AddCommand( "verifyhex", ID_VerifyHEX_f, "check if id source seems to be fake" ); Cmd_AddCommand( "verifyhex", ID_VerifyHEX_f, "check if id source seems to be fake" );
#ifdef __linux__ #if XASH_LINUX
Cmd_AddCommand( "testcpuinfo", ID_TestCPUInfo_f, "try read cpu serial" ); Cmd_AddCommand( "testcpuinfo", ID_TestCPUInfo_f, "try read cpu serial" );
#endif #endif
#if defined(__ANDROID__) && !defined(XASH_DEDICATED) #if XASH_ANDROID && !XASH_DEDICATED
sscanf( Android_LoadID(), "%016llX", &id ); sscanf( Android_LoadID(), "%016llX", &id );
if( id ) if( id )
{ {
@ -629,7 +628,7 @@ void ID_Init( void )
ID_Check(); ID_Check();
} }
#elif defined _WIN32 #elif XASH_WIN32
{ {
CHAR szBuf[MAX_PATH]; CHAR szBuf[MAX_PATH];
ID_GetKeyData( HKEY_CURRENT_USER, "Software\\Xash3D\\", "xash_id", szBuf, MAX_PATH ); ID_GetKeyData( HKEY_CURRENT_USER, "Software\\Xash3D\\", "xash_id", szBuf, MAX_PATH );
@ -680,9 +679,9 @@ void ID_Init( void )
for( i = 0; i < 16; i++ ) for( i = 0; i < 16; i++ )
Q_sprintf( &id_md5[i*2], "%02hhx", md5[i] ); Q_sprintf( &id_md5[i*2], "%02hhx", md5[i] );
#if defined(__ANDROID__) && !defined(XASH_DEDICATED) #if XASH_ANDROID && !XASH_DEDICATED
Android_SaveID( va("%016llX", id^SYSTEM_XOR_MASK ) ); Android_SaveID( va("%016llX", id^SYSTEM_XOR_MASK ) );
#elif defined _WIN32 #elif XASH_WIN32
{ {
CHAR Buf[MAX_PATH]; CHAR Buf[MAX_PATH];
sprintf( Buf, "%016llX", id^SYSTEM_XOR_MASK ); sprintf( Buf, "%016llX", id^SYSTEM_XOR_MASK );

2
engine/common/imagelib/img_bmp.c

@ -17,7 +17,7 @@ GNU General Public License for more details.
#include "mathlib.h" #include "mathlib.h"
#define BI_SIZE 40 //size of bitmap info header. #define BI_SIZE 40 //size of bitmap info header.
#ifndef _WIN32 #if !XASH_WIN32
#define BI_RGB 0 #define BI_RGB 0
typedef struct tagRGBQUAD { typedef struct tagRGBQUAD {

2
engine/common/imagelib/img_png.c

@ -17,7 +17,7 @@ GNU General Public License for more details.
#include "miniz.h" #include "miniz.h"
#include "imagelib.h" #include "imagelib.h"
#include "mathlib.h" #include "mathlib.h"
#ifndef _WIN32 #if !XASH_WIN32
#include <netinet/in.h> #include <netinet/in.h>
#endif #endif

2
engine/common/infostring.c

@ -131,7 +131,7 @@ qboolean Info_IsValid( const char *s )
return true; return true;
} }
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
/* /*
============== ==============
Info_WriteVars Info_WriteVars

10
engine/common/launcher.c

@ -17,12 +17,12 @@ GNU General Public License for more details.
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "build.h"
#ifdef XASH_SDLMAIN #ifdef XASH_SDLMAIN
#include "SDL.h" #include "SDL.h"
#endif #endif
#if XASH_EMSCRIPTEN
#ifdef __EMSCRIPTEN__
#include <emscripten.h> #include <emscripten.h>
#endif #endif
typedef void (*pfnChangeGame)( const char *progname ); typedef void (*pfnChangeGame)( const char *progname );
@ -78,14 +78,14 @@ int main( int argc, char** argv )
gamedir = gamedir_buf; gamedir = gamedir_buf;
} }
#ifdef __EMSCRIPTEN__ #if XASH_EMSCRIPTEN
#ifdef EMSCRIPTEN_LIB_FS #ifdef EMSCRIPTEN_LIB_FS
// For some unknown reason emscripten refusing to load libraries later // For some unknown reason emscripten refusing to load libraries later
Com_LoadLibrary("menu", 0 ); Com_LoadLibrary("menu", 0 );
Com_LoadLibrary("server", 0 ); Com_LoadLibrary("server", 0 );
Com_LoadLibrary("client", 0 ); Com_LoadLibrary("client", 0 );
#endif #endif
#ifdef XASH_DEDICATED #if XASH_DEDICATED
// NodeJS support for debug // NodeJS support for debug
EM_ASM(try{ EM_ASM(try{
FS.mkdir('/xash'); FS.mkdir('/xash');
@ -97,7 +97,7 @@ int main( int argc, char** argv )
g_iArgc = argc; g_iArgc = argc;
g_pszArgv = argv; g_pszArgv = argv;
#if TARGET_OS_IPHONE #if XASH_IOS
{ {
void IOS_LaunchDialog( void ); void IOS_LaunchDialog( void );
IOS_LaunchDialog(); IOS_LaunchDialog();

12
engine/common/mod_bmodel.c

@ -1085,7 +1085,7 @@ static void Mod_CalcSurfaceExtents( msurface_t *surf )
info->lightextents[i] = surf->extents[i]; info->lightextents[i] = surf->extents[i];
} }
#if !defined XASH_DEDICATED && 0 // REFTODO: #if !XASH_DEDICATED && 0 // REFTODO:
if( !FBitSet( tex->flags, TEX_SPECIAL ) && ( surf->extents[i] > 16384 ) && ( tr.block_size == BLOCK_SIZE_DEFAULT )) if( !FBitSet( tex->flags, TEX_SPECIAL ) && ( surf->extents[i] > 16384 ) && ( tr.block_size == BLOCK_SIZE_DEFAULT ))
Con_Reportf( S_ERROR "Bad surface extents %i\n", surf->extents[i] ); Con_Reportf( S_ERROR "Bad surface extents %i\n", surf->extents[i] );
#endif // XASH_DEDICATED #endif // XASH_DEDICATED
@ -1912,7 +1912,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
if( bmod->isworld ) if( bmod->isworld )
{ {
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
// release old sky layers first // release old sky layers first
if( !Host_IsDedicated() ) if( !Host_IsDedicated() )
{ {
@ -1944,7 +1944,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
loadmodel->textures[i] = tx; loadmodel->textures[i] = tx;
Q_strncpy( tx->name, "*default", sizeof( tx->name )); Q_strncpy( tx->name, "*default", sizeof( tx->name ));
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
if( !Host_IsDedicated() ) if( !Host_IsDedicated() )
{ {
tx->gl_texturenum = R_GetBuiltinTexture( REF_DEFAULT_TEXTURE ); tx->gl_texturenum = R_GetBuiltinTexture( REF_DEFAULT_TEXTURE );
@ -1993,7 +1993,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
if( remaining >= 770 ) custom_palette = true; if( remaining >= 770 ) custom_palette = true;
} }
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
if( !Host_IsDedicated() ) if( !Host_IsDedicated() )
{ {
// check for multi-layered sky texture (quake1 specific) // check for multi-layered sky texture (quake1 specific)
@ -2370,7 +2370,7 @@ static void Mod_LoadSurfaces( dbspmodel_t *bmod )
next_lightofs = 99999999; next_lightofs = 99999999;
} }
#ifndef XASH_DEDICATED // TODO: Do we need subdivide on server? #if !XASH_DEDICATED // TODO: Do we need subdivide on server?
if( FBitSet( out->flags, SURF_DRAWTURB ) && !Host_IsDedicated() ) if( FBitSet( out->flags, SURF_DRAWTURB ) && !Host_IsDedicated() )
ref.dllFuncs.GL_SubdivideSurface( out ); // cut up polygon for warps ref.dllFuncs.GL_SubdivideSurface( out ); // cut up polygon for warps
#endif #endif
@ -2820,7 +2820,7 @@ qboolean Mod_LoadBmodelLumps( const byte *mod_base, qboolean isworld )
if( isworld ) if( isworld )
{ {
loadmodel = mod; // restore pointer to world loadmodel = mod; // restore pointer to world
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
Mod_InitDebugHulls(); // FIXME: build hulls for separate bmodels (shells, medkits etc) Mod_InitDebugHulls(); // FIXME: build hulls for separate bmodels (shells, medkits etc)
world.deluxedata = bmod->deluxedata_out; // deluxemap data pointer world.deluxedata = bmod->deluxedata_out; // deluxemap data pointer
world.shadowdata = bmod->shadowdata_out; // occlusion data pointer world.shadowdata = bmod->shadowdata_out; // occlusion data pointer

2
engine/common/mod_sprite.c

@ -17,7 +17,7 @@ GNU General Public License for more details.
#include "common.h" #include "common.h"
#include "sprite.h" #include "sprite.h"
#include "studio.h" #include "studio.h"
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
#include "ref_common.h" #include "ref_common.h"
#endif // XASH_DEDICATED #endif // XASH_DEDICATED

8
engine/common/model.c

@ -85,7 +85,7 @@ static void Mod_FreeUserData( model_t *mod )
svgame.physFuncs.Mod_ProcessUserData( mod, false, NULL ); svgame.physFuncs.Mod_ProcessUserData( mod, false, NULL );
} }
} }
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
else else
{ {
ref.dllFuncs.Mod_ProcessRenderData( mod, false, NULL ); ref.dllFuncs.Mod_ProcessRenderData( mod, false, NULL );
@ -154,7 +154,7 @@ void Mod_FreeAll( void )
{ {
int i; int i;
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
Mod_ReleaseHullPolygons(); Mod_ReleaseHullPolygons();
#endif #endif
for( i = 0; i < mod_numknown; i++ ) for( i = 0; i < mod_numknown; i++ )
@ -327,7 +327,7 @@ model_t *Mod_LoadModel( model_t *mod, qboolean crash )
svgame.physFuncs.Mod_ProcessUserData( mod, true, buf ); svgame.physFuncs.Mod_ProcessUserData( mod, true, buf );
} }
} }
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
else else
{ {
loaded = ref.dllFuncs.Mod_ProcessRenderData( mod, true, buf ); loaded = ref.dllFuncs.Mod_ProcessRenderData( mod, true, buf );
@ -404,7 +404,7 @@ static void Mod_PurgeStudioCache( void )
// refresh hull data // refresh hull data
SetBits( r_showhull->flags, FCVAR_CHANGED ); SetBits( r_showhull->flags, FCVAR_CHANGED );
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
Mod_ReleaseHullPolygons(); Mod_ReleaseHullPolygons();
#endif #endif
// release previois map // release previois map

2
engine/common/net_chan.c

@ -1312,7 +1312,7 @@ Netchan_UpdateProgress
*/ */
void Netchan_UpdateProgress( netchan_t *chan ) void Netchan_UpdateProgress( netchan_t *chan )
{ {
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
fragbuf_t *p; fragbuf_t *p;
int i, c = 0; int i, c = 0;
int total = 0; int total = 0;

4
engine/common/net_encode.c

@ -1558,7 +1558,7 @@ Read the clientdata
*/ */
void MSG_ReadClientData( sizebuf_t *msg, clientdata_t *from, clientdata_t *to, float timebase ) void MSG_ReadClientData( sizebuf_t *msg, clientdata_t *from, clientdata_t *to, float timebase )
{ {
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
delta_t *pField; delta_t *pField;
delta_info_t *dt; delta_info_t *dt;
int i; int i;
@ -1779,7 +1779,7 @@ Can go from either a baseline or a previous packet_entity
*/ */
qboolean MSG_ReadDeltaEntity( sizebuf_t *msg, entity_state_t *from, entity_state_t *to, int number, int delta_type, float timebase ) qboolean MSG_ReadDeltaEntity( sizebuf_t *msg, entity_state_t *from, entity_state_t *to, int number, int delta_type, float timebase )
{ {
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
delta_info_t *dt = NULL; delta_info_t *dt = NULL;
delta_t *pField; delta_t *pField;
int i, fRemoveType; int i, fRemoveType;

36
engine/common/net_ws.c

@ -17,7 +17,7 @@ GNU General Public License for more details.
#include "client.h" // ConnectionProgress #include "client.h" // ConnectionProgress
#include "netchan.h" #include "netchan.h"
#include "mathlib.h" #include "mathlib.h"
#ifdef _WIN32 #if XASH_WIN32
// Winsock // Winsock
#include <WS2tcpip.h> #include <WS2tcpip.h>
#else #else
@ -44,7 +44,7 @@ GNU General Public License for more details.
#define SPLITPACKET_MAX_SIZE 64000 #define SPLITPACKET_MAX_SIZE 64000
#define NET_MAX_FRAGMENTS ( NET_MAX_FRAGMENT / (SPLITPACKET_MIN_SIZE - sizeof( SPLITPACKET )) ) #define NET_MAX_FRAGMENTS ( NET_MAX_FRAGMENT / (SPLITPACKET_MIN_SIZE - sizeof( SPLITPACKET )) )
#ifndef _WIN32 // not available in XP #if !XASH_WIN32 // not available in XP
#define HAVE_GETADDRINFO #define HAVE_GETADDRINFO
#define WSAGetLastError() errno #define WSAGetLastError() errno
#define WSAEINTR EINTR #define WSAEINTR EINTR
@ -84,16 +84,16 @@ GNU General Public License for more details.
#define WSAENAMETOOLONG ENAMETOOLONG #define WSAENAMETOOLONG ENAMETOOLONG
#define WSAEHOSTDOWN EHOSTDOWN #define WSAEHOSTDOWN EHOSTDOWN
#ifdef __EMSCRIPTEN__ #if XASH_EMSCRIPTEN
/* All socket operations are non-blocking already */ /* All socket operations are non-blocking already */
static int ioctl_stub( int d, unsigned long r, ... ) static int ioctl_stub( int d, unsigned long r, ... )
{ {
return 0; return 0;
} }
#define ioctlsocket ioctl_stub #define ioctlsocket ioctl_stub
#else // __EMSCRIPTEN__ #else // XASH_EMSCRIPTEN
#define ioctlsocket ioctl #define ioctlsocket ioctl
#endif // __EMSCRIPTEN__ #endif // XASH_EMSCRIPTEN
#define closesocket close #define closesocket close
#define SOCKET int #define SOCKET int
#define INVALID_SOCKET -1 #define INVALID_SOCKET -1
@ -157,7 +157,7 @@ typedef struct
qboolean threads_initialized; qboolean threads_initialized;
qboolean configured; qboolean configured;
qboolean allow_ip; qboolean allow_ip;
#ifdef _WIN32 #if XASH_WIN32
WSADATA winsockdata; WSADATA winsockdata;
#endif #endif
} net_state_t; } net_state_t;
@ -181,7 +181,7 @@ NET_ErrorString
*/ */
char *NET_ErrorString( void ) char *NET_ErrorString( void )
{ {
#ifdef _WIN32 #if XASH_WIN32
int err = WSANOTINITIALISED; int err = WSANOTINITIALISED;
if( net.initialized ) if( net.initialized )
@ -242,7 +242,7 @@ char *NET_ErrorString( void )
_inline qboolean NET_IsSocketError( int retval ) _inline qboolean NET_IsSocketError( int retval )
{ {
#ifdef _WIN32 #if XASH_WIN32
return retval == SOCKET_ERROR ? true : false; return retval == SOCKET_ERROR ? true : false;
#else #else
return retval < 0 ? true : false; return retval < 0 ? true : false;
@ -251,7 +251,7 @@ _inline qboolean NET_IsSocketError( int retval )
_inline qboolean NET_IsSocketValid( int socket ) _inline qboolean NET_IsSocketValid( int socket )
{ {
#ifdef _WIN32 #if XASH_WIN32
return socket != INVALID_SOCKET; return socket != INVALID_SOCKET;
#else #else
return socket >= 0; return socket >= 0;
@ -335,14 +335,14 @@ int NET_GetHostByName( const char *hostname )
#endif #endif
} }
#if !defined XASH_NO_ASYNC_NS_RESOLVE && ( defined _WIN32 || !defined __EMSCRIPTEN__ ) #if !defined XASH_NO_ASYNC_NS_RESOLVE && ( XASH_WIN32 || !XASH_EMSCRIPTEN )
#define CAN_ASYNC_NS_RESOLVE #define CAN_ASYNC_NS_RESOLVE
#endif #endif
#ifdef CAN_ASYNC_NS_RESOLVE #ifdef CAN_ASYNC_NS_RESOLVE
static void NET_ResolveThread( void ); static void NET_ResolveThread( void );
#if !defined _WIN32 #if !XASH_WIN32
#include <pthread.h> #include <pthread.h>
#define mutex_lock pthread_mutex_lock #define mutex_lock pthread_mutex_lock
#define mutex_unlock pthread_mutex_unlock #define mutex_unlock pthread_mutex_unlock
@ -386,12 +386,12 @@ static struct nsthread_s
string hostname; string hostname;
qboolean busy; qboolean busy;
} nsthread } nsthread
#ifndef _WIN32 #if !XASH_WIN32
= { PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER } = { PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER }
#endif #endif
; ;
#ifdef _WIN32 #if XASH_WIN32
static void NET_InitializeCriticalSections( void ) static void NET_InitializeCriticalSections( void )
{ {
net.threads_initialized = true; net.threads_initialized = true;
@ -1107,7 +1107,7 @@ qboolean NET_QueuePacket( netsrc_t sock, netadr_t *from, byte *data, size_t *len
// Transfer data // Transfer data
memcpy( data, buf, ret ); memcpy( data, buf, ret );
*length = ret; *length = ret;
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
if( CL_LegacyMode() ) if( CL_LegacyMode() )
return NET_LagPacket( true, sock, from, length, data ); return NET_LagPacket( true, sock, from, length, data );
@ -1702,7 +1702,7 @@ void NET_Init( void )
net.ip_sockets[i] = INVALID_SOCKET; net.ip_sockets[i] = INVALID_SOCKET;
} }
#ifdef _WIN32 #if XASH_WIN32
if( WSAStartup( MAKEWORD( 1, 1 ), &net.winsockdata )) if( WSAStartup( MAKEWORD( 1, 1 ), &net.winsockdata ))
{ {
Con_DPrintf( S_ERROR "network initialization failed.\n" ); Con_DPrintf( S_ERROR "network initialization failed.\n" );
@ -1748,7 +1748,7 @@ void NET_Shutdown( void )
NET_ClearLagData( true, true ); NET_ClearLagData( true, true );
NET_Config( false ); NET_Config( false );
#ifdef _WIN32 #if XASH_WIN32
WSACleanup(); WSACleanup();
#endif #endif
net.initialized = false; net.initialized = false;
@ -2137,10 +2137,10 @@ void HTTP_Run( void )
// but download will lock engine, maybe you will need to add manual returns // but download will lock engine, maybe you will need to add manual returns
mode = 1; mode = 1;
ioctlsocket( curfile->socket, FIONBIO, &mode ); ioctlsocket( curfile->socket, FIONBIO, &mode );
#ifdef __linux__ #if XASH_LINUX
// SOCK_NONBLOCK is not portable, so use fcntl // SOCK_NONBLOCK is not portable, so use fcntl
fcntl( curfile->socket, F_SETFL, fcntl( curfile->socket, F_GETFL, 0 ) | O_NONBLOCK ); fcntl( curfile->socket, F_SETFL, fcntl( curfile->socket, F_GETFL, 0 ) | O_NONBLOCK );
#endif #endif
curfile->state = HTTP_SOCKET; curfile->state = HTTP_SOCKET;
} }

2
engine/common/net_ws.h

@ -68,7 +68,7 @@ void NET_SendPacket( netsrc_t sock, size_t length, const void *data, netadr_t to
void NET_SendPacketEx( netsrc_t sock, size_t length, const void *data, netadr_t to, size_t splitsize ); void NET_SendPacketEx( netsrc_t sock, size_t length, const void *data, netadr_t to, size_t splitsize );
void NET_ClearLagData( qboolean bClient, qboolean bServer ); void NET_ClearLagData( qboolean bClient, qboolean bServer );
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
qboolean CL_LegacyMode( void ); qboolean CL_LegacyMode( void );
int CL_GetSplitSize( void ); int CL_GetSplitSize( void );
#endif #endif

6
engine/common/pm_debug.c

@ -16,7 +16,7 @@ GNU General Public License for more details.
#include "common.h" #include "common.h"
#include "mathlib.h" #include "mathlib.h"
#include "pm_local.h" #include "pm_local.h"
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
#include "client.h" // CL_Particle #include "client.h" // CL_Particle
#endif #endif
@ -32,7 +32,7 @@ draw line from particles
*/ */
void PM_ParticleLine( const vec3_t start, const vec3_t end, int pcolor, float life, float zvel ) void PM_ParticleLine( const vec3_t start, const vec3_t end, int pcolor, float life, float zvel )
{ {
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
float len, curdist; float len, curdist;
vec3_t diff, pos; vec3_t diff, pos;
@ -72,7 +72,7 @@ PM_DrawBBox
*/ */
void PM_DrawBBox( const vec3_t mins, const vec3_t maxs, const vec3_t origin, int pcolor, float life ) void PM_DrawBBox( const vec3_t mins, const vec3_t maxs, const vec3_t origin, int pcolor, float life )
{ {
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
vec3_t p[8], tmp; vec3_t p[8], tmp;
float gap = BOX_GAP; float gap = BOX_GAP;
int i; int i;

4
engine/common/pm_trace.c

@ -461,7 +461,7 @@ pmtrace_t PM_PlayerTraceExt( playermove_t *pmove, vec3_t start, vec3_t end, int
// run custom sweep callback // run custom sweep callback
if( pmove->server || Host_IsLocalClient( )) if( pmove->server || Host_IsLocalClient( ))
SV_ClipPMoveToEntity( pe, start, mins, maxs, end, &trace_bbox ); SV_ClipPMoveToEntity( pe, start, mins, maxs, end, &trace_bbox );
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
else CL_ClipPMoveToEntity( pe, start, mins, maxs, end, &trace_bbox ); else CL_ClipPMoveToEntity( pe, start, mins, maxs, end, &trace_bbox );
#endif #endif
} }
@ -630,7 +630,7 @@ int PM_TestPlayerPosition( playermove_t *pmove, vec3_t pos, pmtrace_t *ptrace, p
// run custom sweep callback // run custom sweep callback
if( pmove->server || Host_IsLocalClient( )) if( pmove->server || Host_IsLocalClient( ))
SV_ClipPMoveToEntity( pe, pos, mins, maxs, pos, &trace ); SV_ClipPMoveToEntity( pe, pos, mins, maxs, pos, &trace );
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
else CL_ClipPMoveToEntity( pe, pos, mins, maxs, pos, &trace ); else CL_ClipPMoveToEntity( pe, pos, mins, maxs, pos, &trace );
#endif #endif

10
engine/common/sys_con.c

@ -14,11 +14,11 @@ GNU General Public License for more details.
*/ */
#include "common.h" #include "common.h"
#ifdef __ANDROID__ #if XASH_ANDROID
#include <android/log.h> #include <android/log.h>
#endif #endif
#if !defined( _WIN32 ) && !defined( XASH_MOBILE_PLATFORM ) #if !XASH_WIN32 && !XASH_MOBILE_PLATFORM
#define XASH_COLORIZE_CONSOLE #define XASH_COLORIZE_CONSOLE
// use with caution, running engine in Qt Creator may cause a freeze in read() call // use with caution, running engine in Qt Creator may cause a freeze in read() call
// I was never encountered this bug anywhere else, so still enable by default // I was never encountered this bug anywhere else, so still enable by default
@ -68,7 +68,7 @@ char *Sys_Input( void )
} }
} }
#endif #endif
#ifdef _WIN32 #if XASH_WIN32
return Wcon_Input(); return Wcon_Input();
#endif #endif
return NULL; return NULL;
@ -78,7 +78,7 @@ void Sys_DestroyConsole( void )
{ {
// last text message into console or log // last text message into console or log
Con_Reportf( "Sys_DestroyConsole: Exiting!\n" ); Con_Reportf( "Sys_DestroyConsole: Exiting!\n" );
#ifdef _WIN32 #if XASH_WIN32
Wcon_DestroyConsole(); Wcon_DestroyConsole();
#endif #endif
} }
@ -219,7 +219,7 @@ void Sys_PrintLog( const char *pMsg )
} }
#else #else
#if !defined __ANDROID__ || defined XASH_DEDICATED #if !XASH_ANDROID || XASH_DEDICATED
printf( "%s %s", logtime, pMsg ); printf( "%s %s", logtime, pMsg );
fflush( stdout ); fflush( stdout );
#endif #endif

30
engine/common/system.c

@ -22,12 +22,12 @@ GNU General Public License for more details.
#include <SDL.h> #include <SDL.h>
#endif #endif
#ifndef _WIN32 #if !XASH_WIN32
#include <unistd.h> #include <unistd.h>
#include <signal.h> #include <signal.h>
#include <dlfcn.h> #include <dlfcn.h>
#ifndef __ANDROID__ #if !XASH_ANDROID
#include <pwd.h> #include <pwd.h>
#endif #endif
#endif #endif
@ -47,14 +47,14 @@ double GAME_EXPORT Sys_DoubleTime( void )
return Platform_DoubleTime(); return Platform_DoubleTime();
} }
#if defined __linux__ || ( defined _WIN32 && !defined XASH_64BIT ) #if XASH_LINUX || ( XASH_WIN32 && !XASH_64BIT )
#undef DEBUG_BREAK #undef DEBUG_BREAK
qboolean Sys_DebuggerPresent( void ); // see sys_linux.c qboolean Sys_DebuggerPresent( void ); // see sys_linux.c
#ifdef _MSC_VER #if XASH_MSVC
#define DEBUG_BREAK \ #define DEBUG_BREAK \
if( Sys_DebuggerPresent() ) \ if( Sys_DebuggerPresent() ) \
_asm{ int 3 } _asm{ int 3 }
#elif __i386__ #elif XASH_X86
#define DEBUG_BREAK \ #define DEBUG_BREAK \
if( Sys_DebuggerPresent() ) \ if( Sys_DebuggerPresent() ) \
asm volatile("int $3;") asm volatile("int $3;")
@ -65,7 +65,7 @@ double GAME_EXPORT Sys_DoubleTime( void )
#endif #endif
#endif #endif
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
/* /*
================ ================
Sys_GetClipboardData Sys_GetClipboardData
@ -122,13 +122,13 @@ returns username for current profile
*/ */
char *Sys_GetCurrentUser( void ) char *Sys_GetCurrentUser( void )
{ {
#if defined(_WIN32) #if XASH_WIN32
static string s_userName; static string s_userName;
unsigned long size = sizeof( s_userName ); unsigned long size = sizeof( s_userName );
if( GetUserName( s_userName, &size )) if( GetUserName( s_userName, &size ))
return s_userName; return s_userName;
#elif !defined(__ANDROID__) #elif !XASH_ANDROID
uid_t uid = geteuid(); uid_t uid = geteuid();
struct passwd *pw = getpwuid( uid ); struct passwd *pw = getpwuid( uid );
@ -248,7 +248,7 @@ qboolean Sys_GetIntFromCmdLine( const char* argName, int *out )
void Sys_SendKeyEvents( void ) void Sys_SendKeyEvents( void )
{ {
#ifdef _WIN32 #if XASH_WIN32
MSG msg; MSG msg;
while( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE )) while( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ))
@ -353,7 +353,7 @@ wait for 'Esc' key will be hit
*/ */
void Sys_WaitForQuit( void ) void Sys_WaitForQuit( void )
{ {
#ifdef _WIN32 #if XASH_WIN32
MSG msg; MSG msg;
Wcon_RegisterHotkeys(); Wcon_RegisterHotkeys();
@ -433,7 +433,7 @@ void Sys_Error( const char *error, ... )
if( host_developer.value ) if( host_developer.value )
{ {
#ifdef _WIN32 #if XASH_WIN32
Wcon_ShowConsole( true ); Wcon_ShowConsole( true );
Wcon_DisableInput(); // disable input line for dedicated server Wcon_DisableInput(); // disable input line for dedicated server
#endif #endif
@ -442,7 +442,7 @@ void Sys_Error( const char *error, ... )
} }
else else
{ {
#ifdef _WIN32 #if XASH_WIN32
Wcon_ShowConsole( false ); Wcon_ShowConsole( false );
#endif #endif
MSGBOX( text ); MSGBOX( text );
@ -451,7 +451,7 @@ void Sys_Error( const char *error, ... )
Sys_Quit(); Sys_Quit();
} }
#ifdef __EMSCRIPTEN__ #if XASH_EMSCRIPTEN
/* strange glitchy bug on emscripten /* strange glitchy bug on emscripten
_exit->_Exit->asm._exit->_exit _exit->_Exit->asm._exit->_exit
As we do not need atexit(), just throw hidden exception As we do not need atexit(), just throw hidden exception
@ -486,14 +486,14 @@ print into window console
*/ */
void Sys_Print( const char *pMsg ) void Sys_Print( const char *pMsg )
{ {
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
if( !Host_IsDedicated() ) if( !Host_IsDedicated() )
{ {
Con_Print( pMsg ); Con_Print( pMsg );
} }
#endif #endif
#ifdef _WIN32 #if XASH_WIN32
{ {
const char *msg; const char *msg;
static char buffer[MAX_PRINT_MSG]; static char buffer[MAX_PRINT_MSG];

2
engine/common/system.h

@ -83,7 +83,7 @@ int Sys_LogFileNo( void );
// //
// con_win.c // con_win.c
// //
#ifdef _WIN32 #if XASH_WIN32
void Wcon_InitConsoleCommands( void ); void Wcon_InitConsoleCommands( void );
void Wcon_ShowConsole( qboolean show ); void Wcon_ShowConsole( qboolean show );
void Wcon_Init( void ); void Wcon_Init( void );

3
engine/platform/emscripten/lib_em.h

@ -13,7 +13,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#pragma once #pragma once
#ifdef __EMSCRIPTEN__ #include "build.h"
#ifdef XASH_EMSCRIPTEN
#ifndef EM_LIB_H #ifndef EM_LIB_H
#define EM_LIB_H #define EM_LIB_H

4
engine/platform/linux/in_evdev.c

@ -133,7 +133,7 @@ static int KeycodeFromEvdev(int keycode, int value)
} }
static void Evdev_CheckPermissions( void ) static void Evdev_CheckPermissions( void )
{ {
#ifdef __ANDROID__ #if XASH_ANDROID
system( "su 0 chmod 664 /dev/input/event*" ); system( "su 0 chmod 664 /dev/input/event*" );
#endif #endif
} }
@ -142,7 +142,7 @@ void Evdev_Setup( void )
{ {
if( evdev.initialized ) if( evdev.initialized )
return; return;
#ifdef __ANDROID__ #if XASH_ANDROID
system( "su 0 supolicy --live \"allow appdomain input_device dir { ioctl read getattr search open }\" \"allow appdomain input_device chr_file { ioctl read write getattr lock append open }\"" ); system( "su 0 supolicy --live \"allow appdomain input_device dir { ioctl read getattr search open }\" \"allow appdomain input_device chr_file { ioctl read write getattr lock append open }\"" );
system( "su 0 setenforce permissive" ); system( "su 0 setenforce permissive" );
#endif #endif

2
engine/platform/linux/vid_fbdev.c

@ -10,7 +10,7 @@
#include <linux/fb.h> #include <linux/fb.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#ifdef __ANDROID__ #if XASH_ANDROID
#include <linux/kd.h> #include <linux/kd.h>
#else #else
#include <sys/kd.h> #include <sys/kd.h>

4
engine/platform/platform.h

@ -36,7 +36,7 @@ void Platform_MessageBox( const char *title, const char *message, qboolean paren
// see system.c // see system.c
// qboolean Sys_DebuggerPresent( void ); // qboolean Sys_DebuggerPresent( void );
#ifdef __ANDROID__ #if XASH_ANDROID
const char *Android_GetAndroidID( void ); const char *Android_GetAndroidID( void );
const char *Android_LoadID( void ); const char *Android_LoadID( void );
void Android_SaveID( const char *id ); void Android_SaveID( const char *id );
@ -83,7 +83,7 @@ void Platform_SetClipboardText( const char *buffer, size_t size );
#define SDL_VERSION_ATLEAST( x, y, z ) 0 #define SDL_VERSION_ATLEAST( x, y, z ) 0
#endif #endif
#ifdef __ANDROID__ #if XASH_ANDROID
void Android_ShowMouse( qboolean show ); void Android_ShowMouse( qboolean show );
void Android_MouseMove( float *x, float *y ); void Android_MouseMove( float *x, float *y );
#endif #endif

3
engine/platform/posix/lib_posix.c

@ -13,7 +13,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#ifndef _WIN32 // see win_lib.c #include "build.h"
#if !XASH_WIN32 // see win_lib.c
#define _GNU_SOURCE #define _GNU_SOURCE
#include "common.h" #include "common.h"

4
engine/platform/posix/sys_posix.c

@ -66,7 +66,7 @@ static qboolean Sys_FindExecutable( const char *baseName, char *buf, size_t size
return false; return false;
} }
#ifndef __ANDROID__ #if !XASH_ANDROID
void Platform_ShellExecute( const char *path, const char *parms ) void Platform_ShellExecute( const char *path, const char *parms )
{ {
char xdgOpen[128]; char xdgOpen[128];
@ -90,7 +90,7 @@ void Platform_ShellExecute( const char *path, const char *parms )
Con_Reportf( S_WARN "Could not find "OPEN_COMMAND" utility\n" ); Con_Reportf( S_WARN "Could not find "OPEN_COMMAND" utility\n" );
} }
} }
#endif // __ANDROID__ #endif // XASH_ANDROID
#if XASH_MESSAGEBOX == MSGBOX_STDERR #if XASH_MESSAGEBOX == MSGBOX_STDERR
void Platform_MessageBox( const char *title, const char *message, qboolean parentMainWindow ) void Platform_MessageBox( const char *title, const char *message, qboolean parentMainWindow )

5
engine/platform/sdl/events.c

@ -12,8 +12,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#if defined( XASH_SDL ) && !XASH_DEDICATED
#if defined( XASH_SDL ) && !defined( XASH_DEDICATED )
#include <SDL.h> #include <SDL.h>
#include <ctype.h> #include <ctype.h>
@ -627,4 +626,4 @@ void Platform_PreCreateMove( void )
} }
} }
#endif // defined( XASH_SDL ) && !defined( XASH_DEDICATED ) #endif // defined( XASH_SDL ) && !XASH_DEDICATED

2
engine/platform/sdl/in_sdl.c

@ -12,7 +12,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
#include <SDL.h> #include <SDL.h>
#include "common.h" #include "common.h"

4
engine/platform/sdl/s_sdl.c

@ -237,12 +237,12 @@ void SNDDMA_Shutdown( void )
{ {
SNDDMA_Activate( false ); SNDDMA_Activate( false );
#ifndef __EMSCRIPTEN__ #if !XASH_EMSCRIPTEN
SDL_CloseAudioDevice( sdl_dev ); SDL_CloseAudioDevice( sdl_dev );
#endif #endif
} }
#ifndef __EMSCRIPTEN__ #if !XASH_EMSCRIPTEN
if( SDL_WasInit( SDL_INIT_AUDIO ) ) if( SDL_WasInit( SDL_INIT_AUDIO ) )
SDL_QuitSubSystem( SDL_INIT_AUDIO ); SDL_QuitSubSystem( SDL_INIT_AUDIO );
#endif #endif

12
engine/platform/sdl/vid_sdl.c

@ -12,7 +12,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
#include <SDL.h> #include <SDL.h>
#include "common.h" #include "common.h"
#include "client.h" #include "client.h"
@ -597,7 +597,7 @@ void VID_RestoreScreenResolution( void )
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 ) #endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
} }
#if defined(_WIN32) && !defined(XASH_64BIT) // ICO support only for Win32 #if XASH_WIN32 && !XASH_64BIT // ICO support only for Win32
#include "SDL_syswm.h" #include "SDL_syswm.h"
static void WIN_SetWindowIcon( HICON ico ) static void WIN_SetWindowIcon( HICON ico )
{ {
@ -685,7 +685,7 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
VID_RestoreScreenResolution(); VID_RestoreScreenResolution();
} }
#if defined(_WIN32) && !defined(XASH_64BIT) // ICO support only for Win32 #if XASH_WIN32 && !XASH_64BIT // ICO support only for Win32
if( FS_FileExists( GI->iconpath, true ) ) if( FS_FileExists( GI->iconpath, true ) )
{ {
HICON ico; HICON ico;
@ -727,7 +727,7 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
} }
} }
#if defined(_WIN32) && !defined(XASH_64BIT) // ICO support only for Win32 #if XASH_WIN32 && !XASH_64BIT // ICO support only for Win32
if( !iconLoaded ) if( !iconLoaded )
{ {
WIN_SetWindowIcon( LoadIcon( host.hInst, MAKEINTRESOURCE( 101 ) ) ); WIN_SetWindowIcon( LoadIcon( host.hInst, MAKEINTRESOURCE( 101 ) ) );
@ -971,13 +971,13 @@ qboolean R_Init_Video( const int type )
refState.desktopBitsPixel = 16; refState.desktopBitsPixel = 16;
#endif #endif
#if SDL_VERSION_ATLEAST( 2, 0, 0 ) && !defined(_WIN32) #if SDL_VERSION_ATLEAST( 2, 0, 0 ) && !XASH_WIN32
SDL_SetHint( "SDL_VIDEO_X11_XRANDR", "1" ); SDL_SetHint( "SDL_VIDEO_X11_XRANDR", "1" );
SDL_SetHint( "SDL_VIDEO_X11_XVIDMODE", "1" ); SDL_SetHint( "SDL_VIDEO_X11_XVIDMODE", "1" );
#endif #endif
// must be initialized before creating window // must be initialized before creating window
#ifdef _WIN32 #if XASH_WIN32
WIN_SetDPIAwareness(); WIN_SetDPIAwareness();
#endif #endif

6
engine/server/sv_game.c

@ -589,7 +589,7 @@ void SV_RestartAmbientSounds( void )
SV_StartSound( pfnPEntityOfEntIndex( si->entnum ), CHAN_STATIC, si->name, si->volume, si->attenuation, 0, si->pitch ); SV_StartSound( pfnPEntityOfEntIndex( si->entnum ), CHAN_STATIC, si->name, si->volume, si->attenuation, 0, si->pitch );
} }
#ifndef XASH_DEDICATED // TODO: ??? #if !XASH_DEDICATED // TODO: ???
// restart soundtrack // restart soundtrack
if( S_StreamGetCurrentState( curtrack, looptrack, &position )) if( S_StreamGetCurrentState( curtrack, looptrack, &position ))
{ {
@ -618,7 +618,7 @@ void SV_RestartDecals( void )
// g-cont. add space for studiodecals if present // g-cont. add space for studiodecals if present
host.decalList = (decallist_t *)Z_Calloc( sizeof( decallist_t ) * MAX_RENDER_DECALS * 2 ); host.decalList = (decallist_t *)Z_Calloc( sizeof( decallist_t ) * MAX_RENDER_DECALS * 2 );
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
if( !Host_IsDedicated() ) if( !Host_IsDedicated() )
{ {
host.numdecals = ref.dllFuncs.R_CreateDecalList( host.decalList ); host.numdecals = ref.dllFuncs.R_CreateDecalList( host.decalList );
@ -3049,7 +3049,7 @@ void SV_SetStringArrayMode( qboolean dynamic )
} }
#ifdef XASH_64BIT #ifdef XASH_64BIT
#ifndef _WIN32 #if !XASH_WIN32
#define USE_MMAP #define USE_MMAP
#include <sys/mman.h> #include <sys/mman.h>
#endif #endif

6
engine/server/sv_phys.c

@ -21,7 +21,7 @@ GNU General Public License for more details.
#include "ref_common.h" #include "ref_common.h"
typedef int (*PHYSICAPI)( int, server_physics_api_t*, physics_interface_t* ); typedef int (*PHYSICAPI)( int, server_physics_api_t*, physics_interface_t* );
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
extern triangleapi_t gTriApi; extern triangleapi_t gTriApi;
#endif #endif
@ -2005,7 +2005,7 @@ const char* pfnGetModelName( int modelindex )
static const byte *GL_TextureData( unsigned int texnum ) static const byte *GL_TextureData( unsigned int texnum )
{ {
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
return Host_IsDedicated() ? NULL : ref.dllFuncs.GL_TextureData( texnum ); return Host_IsDedicated() ? NULL : ref.dllFuncs.GL_TextureData( texnum );
#else // XASH_DEDICATED #else // XASH_DEDICATED
return NULL; return NULL;
@ -2021,7 +2021,7 @@ static server_physics_api_t gPhysicsAPI =
SV_GetHeadNode, SV_GetHeadNode,
SV_ServerState, SV_ServerState,
Host_Error, Host_Error,
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
&gTriApi, // ouch! &gTriApi, // ouch!
pfnDrawConsoleString, pfnDrawConsoleString,
pfnDrawSetTextColor, pfnDrawSetTextColor,

12
engine/server/sv_save.c

@ -498,7 +498,7 @@ static void AgeSaveList( const char *pName, int count )
FS_Delete( newName ); FS_Delete( newName );
FS_Delete( newShot ); FS_Delete( newShot );
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
// unloading the shot footprint // unloading the shot footprint
GL_FreeImage( newShot ); GL_FreeImage( newShot );
#endif // XASH_DEDICATED #endif // XASH_DEDICATED
@ -521,7 +521,7 @@ static void AgeSaveList( const char *pName, int count )
Q_snprintf( newName, sizeof( newName ), "%s%s%02d.sav", DEFAULT_SAVE_DIRECTORY, pName, count ); Q_snprintf( newName, sizeof( newName ), "%s%s%02d.sav", DEFAULT_SAVE_DIRECTORY, pName, count );
Q_snprintf( newShot, sizeof( newShot ), "%s%s%02d.bmp", DEFAULT_SAVE_DIRECTORY, pName, count ); Q_snprintf( newShot, sizeof( newShot ), "%s%s%02d.bmp", DEFAULT_SAVE_DIRECTORY, pName, count );
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
// unloading the oldshot footprint too // unloading the oldshot footprint too
GL_FreeImage( oldShot ); GL_FreeImage( oldShot );
#endif // XASH_DEDICATED #endif // XASH_DEDICATED
@ -1111,7 +1111,7 @@ static void SaveClientState( SAVERESTOREDATA *pSaveData, const char *level, int
decalList = (decallist_t *)Z_Calloc( sizeof( decallist_t ) * MAX_RENDER_DECALS * 2 ); decalList = (decallist_t *)Z_Calloc( sizeof( decallist_t ) * MAX_RENDER_DECALS * 2 );
// initialize client header // initialize client header
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
if( !Host_IsDedicated() ) if( !Host_IsDedicated() )
{ {
header.decalCount = ref.dllFuncs.R_CreateDecalList( decalList ); header.decalCount = ref.dllFuncs.R_CreateDecalList( decalList );
@ -1128,7 +1128,7 @@ static void SaveClientState( SAVERESTOREDATA *pSaveData, const char *level, int
{ {
// sounds won't going across transition // sounds won't going across transition
header.soundCount = S_GetCurrentDynamicSounds( soundInfo, MAX_CHANNELS ); header.soundCount = S_GetCurrentDynamicSounds( soundInfo, MAX_CHANNELS );
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
// music not reqiured to save position: it's just continue playing on a next level // music not reqiured to save position: it's just continue playing on a next level
S_StreamGetCurrentState( header.introTrack, header.mainTrack, &header.trackPosition ); S_StreamGetCurrentState( header.introTrack, header.mainTrack, &header.trackPosition );
#endif #endif
@ -2104,7 +2104,7 @@ void SV_SaveGame( const char *pName )
} }
else Q_strncpy( savename, pName, sizeof( savename )); else Q_strncpy( savename, pName, sizeof( savename ));
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
// unload previous image from memory (it's will be overwritten) // unload previous image from memory (it's will be overwritten)
GL_FreeImage( va( "%s%s.bmp", DEFAULT_SAVE_DIRECTORY, savename )); GL_FreeImage( va( "%s%s.bmp", DEFAULT_SAVE_DIRECTORY, savename ));
#endif // XASH_DEDICATED #endif // XASH_DEDICATED
@ -2112,7 +2112,7 @@ void SV_SaveGame( const char *pName )
SaveBuildComment( comment, sizeof( comment )); SaveBuildComment( comment, sizeof( comment ));
result = SaveGameSlot( savename, comment ); result = SaveGameSlot( savename, comment );
#ifndef XASH_DEDICATED #if !XASH_DEDICATED
if( result && !FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE )) if( result && !FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE ))
CL_HudMessage( "GAMESAVED" ); // defined in titles.txt CL_HudMessage( "GAMESAVED" ); // defined in titles.txt
#endif // XASH_DEDICATED #endif // XASH_DEDICATED

6
ref_gl/gl_opengl.c

@ -666,7 +666,7 @@ void GL_InitExtensionsBigGL( void )
if( GL_CheckExtension( "GL_EXT_texture_filter_anisotropic", NULL, "gl_texture_anisotropic_filter", GL_ANISOTROPY_EXT )) if( GL_CheckExtension( "GL_EXT_texture_filter_anisotropic", NULL, "gl_texture_anisotropic_filter", GL_ANISOTROPY_EXT ))
pglGetFloatv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glConfig.max_texture_anisotropy ); pglGetFloatv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glConfig.max_texture_anisotropy );
#ifdef _WIN32 // Win32 only drivers? #if XASH_WIN32 // Win32 only drivers?
// g-cont. because lodbias it too glitchy on Intel's cards // g-cont. because lodbias it too glitchy on Intel's cards
if( glConfig.hardware_type != GLHW_INTEL ) if( glConfig.hardware_type != GLHW_INTEL )
#endif #endif
@ -691,7 +691,7 @@ void GL_InitExtensionsBigGL( void )
pglGetIntegerv( GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, &glConfig.max_vertex_uniforms ); pglGetIntegerv( GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, &glConfig.max_vertex_uniforms );
pglGetIntegerv( GL_MAX_VERTEX_ATTRIBS_ARB, &glConfig.max_vertex_attribs ); pglGetIntegerv( GL_MAX_VERTEX_ATTRIBS_ARB, &glConfig.max_vertex_attribs );
#ifdef _WIN32 // Win32 only drivers? #if XASH_WIN32 // Win32 only drivers?
if( glConfig.hardware_type == GLHW_RADEON && glConfig.max_vertex_uniforms > 512 ) if( glConfig.hardware_type == GLHW_RADEON && glConfig.max_vertex_uniforms > 512 )
glConfig.max_vertex_uniforms /= 4; // radeon returns not correct info glConfig.max_vertex_uniforms /= 4; // radeon returns not correct info
#endif #endif
@ -769,7 +769,7 @@ void GL_InitExtensions( void )
gEngfuncs.Image_AddCmdFlags( IL_DDS_HARDWARE ); gEngfuncs.Image_AddCmdFlags( IL_DDS_HARDWARE );
// MCD has buffering issues // MCD has buffering issues
#ifdef _WIN32 #if XASH_WIN32
if( Q_strstr( glConfig.renderer_string, "gdi" )) if( Q_strstr( glConfig.renderer_string, "gdi" ))
gEngfuncs.Cvar_SetValue( "gl_finish", 1 ); gEngfuncs.Cvar_SetValue( "gl_finish", 1 );
#endif #endif

10
ref_gl/gl_rsurf.c

@ -2221,7 +2221,7 @@ static void R_AdditionalPasses( vboarray_t *vbo, int indexlen, void *indexarray,
pglScalef( glt->xscale, glt->yscale, 1 ); pglScalef( glt->xscale, glt->yscale, 1 );
// draw // draw
#if !defined XASH_NANOGL || defined XASH_WES && defined __EMSCRIPTEN__ // WebGL need to know array sizes #if !defined XASH_NANOGL || defined XASH_WES && XASH_EMSCRIPTEN // WebGL need to know array sizes
if( pglDrawRangeElements ) if( pglDrawRangeElements )
pglDrawRangeElements( GL_TRIANGLES, 0, vbo->array_len, indexlen, GL_UNSIGNED_SHORT, indexarray ); pglDrawRangeElements( GL_TRIANGLES, 0, vbo->array_len, indexlen, GL_UNSIGNED_SHORT, indexarray );
else else
@ -2252,7 +2252,7 @@ Draw array for given vbotexture_t. build and draw dynamic lightmaps if present
*/ */
static void R_DrawLightmappedVBO( vboarray_t *vbo, vbotexture_t *vbotex, texture_t *texture, int lightmap, qboolean skiplighting ) static void R_DrawLightmappedVBO( vboarray_t *vbo, vbotexture_t *vbotex, texture_t *texture, int lightmap, qboolean skiplighting )
{ {
#if !defined XASH_NANOGL || defined XASH_WES && defined __EMSCRIPTEN__ // WebGL need to know array sizes #if !defined XASH_NANOGL || defined XASH_WES && XASH_EMSCRIPTEN // WebGL need to know array sizes
if( pglDrawRangeElements ) if( pglDrawRangeElements )
pglDrawRangeElements( GL_TRIANGLES, 0, vbo->array_len, vbotex->curindex, GL_UNSIGNED_SHORT, vbotex->indexarray ); pglDrawRangeElements( GL_TRIANGLES, 0, vbo->array_len, vbotex->curindex, GL_UNSIGNED_SHORT, vbotex->indexarray );
else else
@ -2269,7 +2269,7 @@ static void R_DrawLightmappedVBO( vboarray_t *vbo, vbotexture_t *vbotex, texture
GL_SelectTexture( XASH_TEXTURE0 ); GL_SelectTexture( XASH_TEXTURE0 );
pglDisable( GL_TEXTURE_2D ); pglDisable( GL_TEXTURE_2D );
pglDisable( GL_DEPTH_TEST ); pglDisable( GL_DEPTH_TEST );
#if !defined XASH_NANOGL || defined XASH_WES && defined __EMSCRIPTEN__ // WebGL need to know array sizes #if !defined XASH_NANOGL || defined XASH_WES && XASH_EMSCRIPTEN // WebGL need to know array sizes
if( pglDrawRangeElements ) if( pglDrawRangeElements )
pglDrawRangeElements( GL_LINES, 0, vbo->array_len, vbotex->curindex, GL_UNSIGNED_SHORT, vbotex->indexarray ); pglDrawRangeElements( GL_LINES, 0, vbo->array_len, vbotex->curindex, GL_UNSIGNED_SHORT, vbotex->indexarray );
else else
@ -2340,7 +2340,7 @@ static void R_DrawLightmappedVBO( vboarray_t *vbo, vbotexture_t *vbotex, texture
// out of free block space. Draw all generated index array and clear it // out of free block space. Draw all generated index array and clear it
// upload already generated block // upload already generated block
LM_UploadDynamicBlock(); LM_UploadDynamicBlock();
#if !defined XASH_NANOGL || defined XASH_WES && defined __EMSCRIPTEN__ // WebGL need to know array sizes #if !defined XASH_NANOGL || defined XASH_WES && XASH_EMSCRIPTEN // WebGL need to know array sizes
if( pglDrawRangeElements ) if( pglDrawRangeElements )
pglDrawRangeElements( GL_TRIANGLES, 0, vbo->array_len, dlightindex, GL_UNSIGNED_SHORT, dlightarray ); pglDrawRangeElements( GL_TRIANGLES, 0, vbo->array_len, dlightindex, GL_UNSIGNED_SHORT, dlightarray );
else else
@ -2520,7 +2520,7 @@ static void R_DrawLightmappedVBO( vboarray_t *vbo, vbotexture_t *vbotex, texture
LM_UploadDynamicBlock(); LM_UploadDynamicBlock();
// draw remaining array // draw remaining array
#if !defined XASH_NANOGL || defined XASH_WES && defined __EMSCRIPTEN__ // WebGL need to know array sizes #if !defined XASH_NANOGL || defined XASH_WES && XASH_EMSCRIPTEN // WebGL need to know array sizes
if( pglDrawRangeElements ) if( pglDrawRangeElements )
pglDrawRangeElements( GL_TRIANGLES, 0, vbo->array_len, dlightindex, GL_UNSIGNED_SHORT, dlightarray ); pglDrawRangeElements( GL_TRIANGLES, 0, vbo->array_len, dlightindex, GL_UNSIGNED_SHORT, dlightarray );
else else

2
ref_gl/gl_studio.c

@ -2264,7 +2264,7 @@ _inline void R_StudioDrawArrays( uint startverts, uint startelems )
pglColorPointer( 4, GL_UNSIGNED_BYTE, 0, g_studio.arraycolor ); pglColorPointer( 4, GL_UNSIGNED_BYTE, 0, g_studio.arraycolor );
} }
#if !defined XASH_NANOGL || defined XASH_WES && defined __EMSCRIPTEN__ // WebGL need to know array sizes #if !defined XASH_NANOGL || defined XASH_WES && XASH_EMSCRIPTEN // WebGL need to know array sizes
if( pglDrawRangeElements ) if( pglDrawRangeElements )
pglDrawRangeElements( GL_TRIANGLES, startverts, g_studio.numverts, pglDrawRangeElements( GL_TRIANGLES, startverts, g_studio.numverts,
g_studio.numelems - startelems, GL_UNSIGNED_SHORT, &g_studio.arrayelems[startelems] ); g_studio.numelems - startelems, GL_UNSIGNED_SHORT, &g_studio.arrayelems[startelems] );

Loading…
Cancel
Save