Browse Source

Merge branch 'master' into mobile_hacks

mobile_hacks
Andrey Akhmichin 5 years ago
parent
commit
e9da5ef68d
  1. 2
      cl_dll/GameStudioModelRenderer.cpp
  2. 2
      cl_dll/GameStudioModelRenderer_Sample.cpp
  3. 2
      cl_dll/StudioModelRenderer.cpp
  4. 9
      cl_dll/cl_dll.h
  5. 1
      cl_dll/demo.cpp
  6. 2
      cl_dll/entity.cpp
  7. 1
      cl_dll/hl/hl_baseentity.cpp
  8. 4
      cl_dll/hud_iface.h
  9. 1
      cl_dll/hud_update.cpp
  10. 1
      cl_dll/studio_util.cpp
  11. 4
      cl_dll/util.cpp
  12. 5
      cl_dll/util_vector.h
  13. 3
      cl_dll/wscript
  14. 4
      common/mathlib.h
  15. 16
      dlls/animation.cpp
  16. 3
      dlls/bullsquid.cpp
  17. 6
      dlls/extdll.h
  18. 7
      dlls/nodes.cpp
  19. 2
      dlls/util.cpp
  20. 3
      dlls/wscript
  21. 12
      public/build.h
  22. 12
      scripts/waifulib/library_naming.py
  23. 12
      wscript

2
cl_dll/GameStudioModelRenderer.cpp

@ -18,8 +18,6 @@ @@ -18,8 +18,6 @@
#include <stdio.h>
#include <string.h>
#include <memory.h>
#include <cmath>
#include "studio_util.h"
#include "r_studioint.h"

2
cl_dll/GameStudioModelRenderer_Sample.cpp

@ -18,8 +18,6 @@ @@ -18,8 +18,6 @@
#include <stdio.h>
#include <string.h>
#include <memory.h>
#include <cmath>
#include "studio_util.h"
#include "r_studioint.h"

2
cl_dll/StudioModelRenderer.cpp

@ -20,8 +20,6 @@ @@ -20,8 +20,6 @@
#include <stdio.h>
#include <string.h>
#include <memory.h>
#include <cmath>
#include "studio_util.h"
#include "r_studioint.h"

9
cl_dll/cl_dll.h

@ -31,7 +31,8 @@ @@ -31,7 +31,8 @@
typedef unsigned char byte;
typedef unsigned short word;
typedef float vec_t;
typedef int ( *pfnUserMsgHook )( const char *pszName, int iSize, void *pbuf );
// redefine
//typedef int ( *pfnUserMsgHook )( const char *pszName, int iSize, void *pbuf );
#include "util_vector.h"
@ -43,7 +44,11 @@ typedef int ( *pfnUserMsgHook )( const char *pszName, int iSize, void *pbuf ); @@ -43,7 +44,11 @@ typedef int ( *pfnUserMsgHook )( const char *pszName, int iSize, void *pbuf );
#endif
#include "exportdef.h"
#include <string.h>
#if HAVE_CMATH
#include <cmath>
#else
#include <math.h>
#endif
#if defined(__LP64__) || defined(__LLP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
#define XASH_64BIT
#endif

1
cl_dll/demo.cpp

@ -17,7 +17,6 @@ @@ -17,7 +17,6 @@
#include "cl_util.h"
#include "demo.h"
#include "demo_api.h"
#include <memory.h>
int g_demosniper = 0;
int g_demosniperdamage = 0;

2
cl_dll/entity.cpp

@ -7,8 +7,6 @@ @@ -7,8 +7,6 @@
// Client side entity management functions
#include <memory.h>
#include "hud.h"
#include "cl_util.h"
#include "const.h"

1
cl_dll/hl/hl_baseentity.cpp

@ -347,3 +347,4 @@ int CBasePlayerWeapon::ExtractClipAmmo( CBasePlayerWeapon *pWeapon ) { return 0; @@ -347,3 +347,4 @@ int CBasePlayerWeapon::ExtractClipAmmo( CBasePlayerWeapon *pWeapon ) { return 0;
void CBasePlayerWeapon::RetireWeapon( void ) { }
void CSoundEnt::InsertSound( int iType, const Vector &vecOrigin, int iVolume, float flDuration ) {}
void RadiusDamage( Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType ){}
void CSprite::AnimateUntilDead( void ) {}

4
cl_dll/hud_iface.h

@ -10,8 +10,8 @@ @@ -10,8 +10,8 @@
#define HUD_IFACEH
#include "exportdef.h"
typedef int (*pfnUserMsgHook)( const char *pszName, int iSize, void *pbuf );
// redefine
// typedef int (*pfnUserMsgHook)( const char *pszName, int iSize, void *pbuf );
#include "wrect.h"
#include "../engine/cdll_int.h"
extern cl_enginefunc_t gEngfuncs;

1
cl_dll/hud_update.cpp

@ -20,7 +20,6 @@ @@ -20,7 +20,6 @@
#include "hud.h"
#include "cl_util.h"
#include <stdlib.h>
#include <memory.h>
int CL_ButtonBits( int );
void CL_ResetButtonBits( int bits );

1
cl_dll/studio_util.cpp

@ -5,7 +5,6 @@ @@ -5,7 +5,6 @@
// $NoKeywords: $
//=============================================================================
#include <memory.h>
#include "hud.h"
#include "cl_util.h"
#include "const.h"

4
cl_dll/util.cpp

@ -33,10 +33,10 @@ @@ -33,10 +33,10 @@
#ifndef M_PI_F
#define M_PI_F (float)M_PI
#endif
extern vec3_t vec3_origin;
#ifdef _MSC_VER
// if C++ mangling differs from C symbol name
#if defined _MSC_VER || defined __WATCOMC__
vec3_t vec3_origin;
#endif

5
cl_dll/util_vector.h

@ -22,8 +22,11 @@ @@ -22,8 +22,11 @@
// Misc C-runtime library headers
#include <stdio.h>
#include <stdlib.h>
#if HAVE_CMATH
#include <cmath>
#else
#include <math.h>
#endif
// Header file containing definition of globalvars_t and entvars_t
typedef unsigned int func_t; //
typedef int string_t; // from engine's pr_comp.h;

3
cl_dll/wscript

@ -53,7 +53,7 @@ def build(bld): @@ -53,7 +53,7 @@ def build(bld):
if bld.env.DEST_OS == 'win32':
libs += ["USER32"]
if bld.env.DEST_OS not in ['android']:
if bld.env.DEST_OS not in ['android', 'dos']:
install_path = os.path.join(bld.env.GAMEDIR, bld.env.CLIENT_DIR)
else:
install_path = bld.env.PREFIX
@ -61,6 +61,7 @@ def build(bld): @@ -61,6 +61,7 @@ def build(bld):
bld.shlib(
source = source,
target = 'client' + bld.env.POSTFIX,
name = 'client',
features = 'c cxx',
includes = includes,
defines = defines,

4
common/mathlib.h

@ -22,7 +22,11 @@ @@ -22,7 +22,11 @@
#include <tgmath.h>
#endif // HAVE_TGMATH_H
#else // __cplusplus
#if HAVE_CMATH
#include <cmath>
#else
#include <math.h>
#endif
#endif // __cplusplus
typedef float vec_t;

16
dlls/animation.cpp

@ -13,6 +13,10 @@ @@ -13,6 +13,10 @@
*
****/
/* all this mess was here to use quake mathlib instead of hlsdk vectors
* it may break debug info or even build because global symbols types differ
* it's better to define VectorCopy macro for Vector class */
#if 0
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -50,7 +54,17 @@ typedef unsigned char byte; @@ -50,7 +54,17 @@ typedef unsigned char byte;
#include "enginecallback.h"
#endif
extern globalvars_t *gpGlobals;
//extern globalvars_t *gpGlobals;
#else
#include "extdll.h"
#include "util.h"
#include "activity.h"
#include "activitymap.h"
#include "animation.h"
#include "scriptevent.h"
#include "studio.h"
#define VectorCopy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];}
#endif
#pragma warning( disable : 4244 )

3
dlls/bullsquid.cpp

@ -536,6 +536,9 @@ void CBullsquid::HandleAnimEvent( MonsterEvent_t *pEvent ) @@ -536,6 +536,9 @@ void CBullsquid::HandleAnimEvent( MonsterEvent_t *pEvent )
{
case BSQUID_AE_SPIT:
{
if( m_hEnemy == 0 )
return;
Vector vecSpitOffset;
Vector vecSpitDir;

6
dlls/extdll.h

@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@
#define NOMCX
#define NOIME
#define HSPRITE HSPRITE_win32
#include "windows.h"
#include <windows.h>
#undef HSPRITE
#else // _WIN32
#ifndef FALSE
@ -66,7 +66,11 @@ typedef int BOOL; @@ -66,7 +66,11 @@ typedef int BOOL;
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#if HAVE_CMATH
#include <cmath>
#else
#include <math.h>
#endif
#ifndef M_PI_F
#define M_PI_F (float)M_PI

7
dlls/nodes.cpp

@ -42,10 +42,13 @@ CGraph WorldGraph; @@ -42,10 +42,13 @@ CGraph WorldGraph;
LINK_ENTITY_TO_CLASS( info_node, CNodeEnt )
LINK_ENTITY_TO_CLASS( info_node_air, CNodeEnt )
#if !defined _WIN32
#ifdef __DOS__
#include <direct.h>
#define CreateDirectoryA(p, n) mkdir(p)
#elif !defined _WIN32
#include <unistd.h>
#include <sys/stat.h>
#define CreateDirectoryA(p, n) mkdir(p, 0777)
#define CreateDirectoryA(p, n) mkdir(p,777)
#endif
//=========================================================

2
dlls/util.cpp

@ -1729,7 +1729,7 @@ void CSaveRestoreBuffer::BufferRewind( int size ) @@ -1729,7 +1729,7 @@ void CSaveRestoreBuffer::BufferRewind( int size )
m_pdata->size -= size;
}
#ifndef _WIN32
#if !defined _WIN32 && !defined __WATCOMC__
extern "C" {
unsigned _rotr( unsigned val, int shift )
{

3
dlls/wscript

@ -61,7 +61,7 @@ def build(bld): @@ -61,7 +61,7 @@ def build(bld):
libs = []
if bld.env.DEST_OS not in ['android']:
if bld.env.DEST_OS not in ['android', 'dos']:
install_path = os.path.join(bld.env.GAMEDIR, bld.env.SERVER_DIR)
else:
install_path = bld.env.PREFIX
@ -69,6 +69,7 @@ def build(bld): @@ -69,6 +69,7 @@ def build(bld):
bld.shlib(
source = source,
target = bld.env.SERVER_NAME + bld.env.POSTFIX,
name = 'server',
features = 'c cxx',
includes = includes,
defines = defines,

12
public/build.h

@ -52,7 +52,7 @@ For more information, please refer to <http://unlicense.org/> @@ -52,7 +52,7 @@ For more information, please refer to <http://unlicense.org/>
#undef XASH_ARMv5
#undef XASH_ARMv6
#undef XASH_ARMv7
#undef XASH_BIG_ENDIAN
//#undef XASH_BIG_ENDIAN
#undef XASH_BSD
#undef XASH_E2K
#undef XASH_EMSCRIPTEN
@ -60,7 +60,7 @@ For more information, please refer to <http://unlicense.org/> @@ -60,7 +60,7 @@ For more information, please refer to <http://unlicense.org/>
#undef XASH_IOS
#undef XASH_JS
#undef XASH_LINUX
#undef XASH_LITTLE_ENDIAN
//#undef XASH_LITTLE_ENDIAN
#undef XASH_MINGW
#undef XASH_MIPS
#undef XASH_MOBILE_PLATFORM
@ -92,12 +92,14 @@ For more information, please refer to <http://unlicense.org/> @@ -92,12 +92,14 @@ For more information, please refer to <http://unlicense.org/>
#if defined(__ANDROID__)
#define XASH_ANDROID 1
#endif // defined(__ANDROID__)
#define XASH_POSIX 1
#elif defined(__APPLE__)
#include <TargetConditionals.h>
#define XASH_APPLE 1
#if TARGET_OS_IOS
#define XASH_IOS 1
#endif // TARGET_OS_IOS
#define XASH_POSIX 1
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#define XASH_BSD 1
#if defined(__FreeBSD__)
@ -107,8 +109,12 @@ For more information, please refer to <http://unlicense.org/> @@ -107,8 +109,12 @@ For more information, please refer to <http://unlicense.org/>
#elif defined(__OpenBSD__)
#define XASH_OPENBSD 1
#endif
#define XASH_POSIX 1
#elif defined __EMSCRIPTEN__
#define XASH_EMSCRIPTEN 1
#elif defined __WATCOMC__ && defined __DOS__
#define XASH_DOS4GW 1
#define XASH_LITTLE_ENDIAN
#else
#error "Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug"
#endif
@ -127,7 +133,7 @@ For more information, please refer to <http://unlicense.org/> @@ -127,7 +133,7 @@ For more information, please refer to <http://unlicense.org/>
#error "Both XASH_LITTLE_ENDIAN and XASH_BIG_ENDIAN are defined"
#endif
#if !defined(XASH_LITTLE_ENDIAN) || !defined(XASH_BIG_ENDIAN)
#if !defined(XASH_LITTLE_ENDIAN) && !defined(XASH_BIG_ENDIAN)
#if defined XASH_MSVC || __LITTLE_ENDIAN__
//!!! Probably all WinNT installations runs in little endian
#define XASH_LITTLE_ENDIAN 1

12
scripts/waifulib/library_naming.py

@ -49,7 +49,9 @@ DEFINES = [ @@ -49,7 +49,9 @@ DEFINES = [
'XASH_OPENBSD',
'XASH_WIN32',
'XASH_WIN64',
'XASH_X86'
'XASH_X86',
'XASH_DOS4GW',
'XASH_POSIX'
]
def configure(conf):
@ -75,8 +77,11 @@ def configure(conf): @@ -75,8 +77,11 @@ def configure(conf):
buildos = "openbsd"
elif conf.env.XASH_EMSCRIPTEN:
buildos = "emscripten"
elif conf.env.XASH_DOS4GW:
buildos = "dos4gw" # unused, just in case
else:
conf.fatal("Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug")
conf.fatal("Place your operating system name in build.h and library_naming.py!\n"
"If this is a mistake, try to fix conditions above and report a bug")
if conf.env.XASH_AMD64:
buildarch = "amd64"
@ -110,7 +115,8 @@ def configure(conf): @@ -110,7 +115,8 @@ def configure(conf):
elif conf.env.XASH_E2K:
buildarch = "e2k"
else:
raise conf.fatal("Place your architecture name here! If this is a mistake, try to fix conditions above and report a bug")
raise conf.fatal("Place your architecture name in build.h and library_naming.py!\n"
"If this is a mistake, try to fix conditions above and report a bug")
conf.env.revert()

12
wscript

@ -73,7 +73,7 @@ def configure(conf): @@ -73,7 +73,7 @@ def configure(conf):
conf.fatal('Please set a build type, for example "-T release"')
elif not conf.options.BUILD_TYPE in valid_build_types:
conf.end_msg(conf.options.BUILD_TYPE, color='RED')
conf.fatal('Invalid build type. Valid are: %s' % valid_build_types.join(', '))
conf.fatal('Invalid build type. Valid are: %s' % ', '.join(valid_build_types))
conf.end_msg(conf.options.BUILD_TYPE)
# -march=native should not be used
@ -183,8 +183,6 @@ def configure(conf): @@ -183,8 +183,6 @@ def configure(conf):
compiler_optional_flags = [
'-fdiagnostics-color=always',
'-Werror=implicit-function-declaration',
'-Werror=int-conversion',
'-Werror=return-type',
'-Werror=parentheses',
'-Werror=vla',
@ -196,6 +194,8 @@ def configure(conf): @@ -196,6 +194,8 @@ def configure(conf):
]
c_compiler_optional_flags = [
'-Werror=implicit-function-declaration',
'-Werror=int-conversion',
'-Werror=implicit-int',
'-Werror=declaration-after-statement'
]
@ -249,10 +249,16 @@ def configure(conf): @@ -249,10 +249,16 @@ def configure(conf):
conf.define_cond('HAVE_TGMATH_H', tgmath_usable)
else:
conf.undefine('HAVE_TGMATH_H')
cmath_usable = conf.check_cxx(fragment='''#include<cmath>
int main(void){ return (int)sqrt(2.0f); }''',
msg='Checking if cmath is usable', mandatory = False)
conf.define_cond('HAVE_CMATH', cmath_usable)
if conf.env.COMPILER_CC == 'msvc':
conf.define('_CRT_SECURE_NO_WARNINGS', 1)
conf.define('_CRT_NONSTDC_NO_DEPRECATE', 1)
elif conf.env.COMPILER_CC == 'owcc':
pass
else:
conf.env.append_unique('DEFINES', ['stricmp=strcasecmp', 'strnicmp=strncasecmp', '_snprintf=snprintf', '_vsnprintf=vsnprintf', '_LINUX', 'LINUX'])
conf.env.append_unique('CXXFLAGS', ['-Wno-invalid-offsetof', '-fno-rtti', '-fno-exceptions'])

Loading…
Cancel
Save