From 6e7653eec14c80cc9f21b91c455981f4853f4ec6 Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin Date: Sun, 20 Jun 2021 13:49:04 +0500 Subject: [PATCH 1/9] Move M_PI definition to header. --- cl_dll/view.cpp | 9 +-------- cl_dll/view.h | 8 ++++++++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/cl_dll/view.cpp b/cl_dll/view.cpp index 0c3d3ef6..fdbee778 100644 --- a/cl_dll/view.cpp +++ b/cl_dll/view.cpp @@ -25,6 +25,7 @@ #include "screenfade.h" #include "shake.h" #include "hltv.h" +#include "view.h" // Spectator Mode extern "C" @@ -36,14 +37,6 @@ extern "C" int iIsSpectator; } -#if !defined(M_PI) -#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h -#endif - -#if !defined(M_PI_F) -#define M_PI_F (float)M_PI -#endif - extern "C" { int CL_IsThirdPerson( void ); diff --git a/cl_dll/view.h b/cl_dll/view.h index 6ca818d5..80a2f065 100644 --- a/cl_dll/view.h +++ b/cl_dll/view.h @@ -9,6 +9,14 @@ #define VIEWH #pragma once +#if !defined(M_PI) +#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h +#endif + +#if !defined(M_PI_F) +#define M_PI_F (float)M_PI +#endif + void V_StartPitchDrift( void ); void V_StopPitchDrift( void ); #endif // !VIEWH From dd470d67009ea96358bd629f9d1143c2fe6a4335 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sat, 3 Jul 2021 19:21:13 +0300 Subject: [PATCH 2/9] waifulib: xcompile: upgrade tool --- scripts/waifulib/xcompile.py | 41 +++++++++++++++++++++++++++++++----- wscript | 6 +----- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/scripts/waifulib/xcompile.py b/scripts/waifulib/xcompile.py index 2872306f..5d111d7c 100644 --- a/scripts/waifulib/xcompile.py +++ b/scripts/waifulib/xcompile.py @@ -152,6 +152,8 @@ class Android: def gen_host_toolchain(self): # With host toolchain we don't care about OS # so just download NDK for Linux x86_64 + if 'HOST_TOOLCHAIN' in self.ctx.environ: + return self.ctx.environ['HOST_TOOLCHAIN'] if self.is_host(): return 'linux-x86_64' @@ -198,16 +200,32 @@ class Android: def cc(self): if self.is_host(): - return 'clang --target=%s%d' % (self.ndk_triplet(), self.api) + s = 'clang' + environ = getattr(self.ctx, 'environ', os.environ) + + if 'CC' in environ: + s = environ['CC'] + + return '%s --target=%s%d' % (s, self.ndk_triplet(), self.api) return self.gen_toolchain_path() + ('clang' if self.is_clang() else 'gcc') def cxx(self): if self.is_host(): - return 'clang++ --target=%s%d' % (self.ndk_triplet(), self.api) + s = 'clang++' + environ = getattr(self.ctx, 'environ', os.environ) + + if 'CXX' in environ: + s = environ['CXX'] + + return '%s --target=%s%d' % (s, self.ndk_triplet(), self.api) return self.gen_toolchain_path() + ('clang++' if self.is_clang() else 'g++') def strip(self): if self.is_host(): + environ = getattr(self.ctx, 'environ', os.environ) + + if 'STRIP' in environ: + return environ['STRIP'] return 'llvm-strip' return os.path.join(self.gen_binutils_path(), 'strip') @@ -281,7 +299,7 @@ class Android: cflags += fixup_host_clang_with_old_ndk() # ARMv5 support - cflags += ['-march=armv5te', '-mtune=xscale', '-msoft-float'] + cflags += ['-march=armv5te', '-msoft-float'] elif self.is_x86(): cflags += ['-mtune=atom', '-march=atom', '-mssse3', '-mfpmath=sse', '-DVECTORIZE_SINCOS', '-DHAVE_EFFICIENT_UNALIGNED_ACCESS'] return cflags @@ -300,7 +318,7 @@ class Android: if self.is_clang() or self.is_host(): linkflags += ['-fuse-ld=lld'] - linkflags += ['-Wl,--hash-style=both','-Wl,--no-undefined'] + linkflags += ['-Wl,--hash-style=sysv', '-Wl,--no-undefined', '-no-canonical-prefixes'] return linkflags def ldflags(self): @@ -325,6 +343,10 @@ def options(opt): android.add_option('--android', action='store', dest='ANDROID_OPTS', default=None, help='enable building for android, format: --android=,,, example: --android=armeabi-v7a-hard,4.9,9') + magx = opt.add_option_group('MotoMAGX options') + magx.add_option('--enable-magx', action = 'store_true', dest = 'MAGX', default = False, + help = 'enable targetting for MotoMAGX phones [default: %default]') + def configure(conf): if conf.options.ANDROID_OPTS: values = conf.options.ANDROID_OPTS.split(',') @@ -360,7 +382,16 @@ def configure(conf): # conf.env.ANDROID_OPTS = android conf.env.DEST_OS2 = 'android' - + elif conf.options.MAGX: + # useless to change toolchain path, as toolchain meant to be placed in this path + toolchain_path = '/opt/toolchains/motomagx/arm-eabi2/lib/' + conf.env.INCLUDES_MAGX = [toolchain_path + i for i in ['ezx-z6/include', 'qt-2.3.8/include']] + conf.env.LIBPATH_MAGX = [toolchain_path + i for i in ['ezx-z6/lib', 'qt-2.3.8/lib']] + conf.env.LINKFLAGS_MAGX = ['-Wl,-rpath-link=' + i for i in conf.env.LIBPATH_MAGX] + for lib in ['qte-mt', 'ezxappbase', 'ezxpm', 'log_util']: + conf.check_cc(lib=lib, use='MAGX', uselib_store='MAGX') + + conf.env.MAGX = conf.options.MAGX MACRO_TO_DESTOS = OrderedDict({ '__ANDROID__' : 'android' }) for k in c_config.MACRO_TO_DESTOS: MACRO_TO_DESTOS[k] = c_config.MACRO_TO_DESTOS[k] # ordering is important diff --git a/wscript b/wscript index ded363dd..4fcaef4c 100644 --- a/wscript +++ b/wscript @@ -40,9 +40,6 @@ def options(opt): grp.add_option('--enable-poly-opt', action = 'store_true', dest = 'POLLY', default = False, help = 'enable polyhedral optimization if possible [default: %default]') - grp.add_option('--enable-magx', action = 'store_true', dest = 'MAGX', default = False, - help = 'enable targetting for MotoMAGX phones [default: %default]') - grp.add_option('--enable-simple-mod-hacks', action = 'store_true', dest = 'ENABLE_MOD_HACKS', default = False, help = 'enable hacks for simple mods that mostly compatible with Half-Life but has little changes. Enforced for Android. [default: %default]') @@ -111,8 +108,7 @@ def configure(conf): conf.options.GOLDSRC = False conf.env.SERVER_NAME = 'server' # can't be any other name, until specified - conf.env.MAGX = conf.options.MAGX - if conf.options.MAGX: + if conf.env.MAGX: enforce_pic = False conf.check_pic(enforce_pic) From f0d53af66d2f169d2fbca28a220fb1a892ef39c0 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sat, 3 Jul 2021 19:35:19 +0300 Subject: [PATCH 3/9] waifulib: xcompile: upgrade again from engine tree, fix motomagx build --- scripts/waifulib/xcompile.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/waifulib/xcompile.py b/scripts/waifulib/xcompile.py index 5d111d7c..752a0794 100644 --- a/scripts/waifulib/xcompile.py +++ b/scripts/waifulib/xcompile.py @@ -388,8 +388,6 @@ def configure(conf): conf.env.INCLUDES_MAGX = [toolchain_path + i for i in ['ezx-z6/include', 'qt-2.3.8/include']] conf.env.LIBPATH_MAGX = [toolchain_path + i for i in ['ezx-z6/lib', 'qt-2.3.8/lib']] conf.env.LINKFLAGS_MAGX = ['-Wl,-rpath-link=' + i for i in conf.env.LIBPATH_MAGX] - for lib in ['qte-mt', 'ezxappbase', 'ezxpm', 'log_util']: - conf.check_cc(lib=lib, use='MAGX', uselib_store='MAGX') conf.env.MAGX = conf.options.MAGX MACRO_TO_DESTOS = OrderedDict({ '__ANDROID__' : 'android' }) @@ -406,6 +404,10 @@ def post_compiler_cxx_configure(conf): if conf.android.ndk_rev == 19: conf.env.CXXFLAGS_cxxshlib += ['-static-libstdc++'] conf.env.LDFLAGS_cxxshlib += ['-static-libstdc++'] + elif conf.options.MAGX: + for lib in ['qte-mt', 'ezxappbase', 'ezxpm', 'log_util']: + conf.check_cc(lib=lib, use='MAGX', uselib_store='MAGX') + return def post_compiler_c_configure(conf): From cc4aebd61a9c31d61239c83077dc6124dc1cd80d Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sat, 3 Jul 2021 19:53:46 +0300 Subject: [PATCH 4/9] wscript: remove dead option --- wscript | 3 --- 1 file changed, 3 deletions(-) diff --git a/wscript b/wscript index 4fcaef4c..200b1e82 100644 --- a/wscript +++ b/wscript @@ -40,9 +40,6 @@ def options(opt): grp.add_option('--enable-poly-opt', action = 'store_true', dest = 'POLLY', default = False, help = 'enable polyhedral optimization if possible [default: %default]') - grp.add_option('--enable-simple-mod-hacks', action = 'store_true', dest = 'ENABLE_MOD_HACKS', default = False, - help = 'enable hacks for simple mods that mostly compatible with Half-Life but has little changes. Enforced for Android. [default: %default]') - opt.load('subproject') opt.add_subproject(['cl_dll', 'dlls']) From 201206ccfdc1bdeb7ccf7172b5468f3798356324 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Mon, 5 Jul 2021 21:08:34 +0300 Subject: [PATCH 5/9] Fix potential conflict of monster states in scripted_sequence --- dlls/scripted.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/scripted.cpp b/dlls/scripted.cpp index c62ce846..da495f98 100644 --- a/dlls/scripted.cpp +++ b/dlls/scripted.cpp @@ -664,7 +664,7 @@ void ScriptEntityCancel( edict_t *pentCine ) if( pTarget ) { // make sure their monster is actually playing a script - if( pTarget->m_MonsterState == MONSTERSTATE_SCRIPT ) + if( pTarget->m_MonsterState == MONSTERSTATE_SCRIPT || pTarget->m_IdealMonsterState == MONSTERSTATE_SCRIPT ) { // tell them do die pTarget->m_scriptState = CCineMonster::SCRIPT_CLEANUP; From d86b0bf480f886ec40c93d2cf84e47ba5fd292de Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Sat, 27 Feb 2021 13:36:23 +0300 Subject: [PATCH 6/9] Change ideal monster state in MonsterUse only if monster is idle --- dlls/monsters.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/monsters.cpp b/dlls/monsters.cpp index 9f1f57f2..8b8643a6 100644 --- a/dlls/monsters.cpp +++ b/dlls/monsters.cpp @@ -571,7 +571,8 @@ void CBaseMonster::MonsterThink( void ) //========================================================= void CBaseMonster::MonsterUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { - m_IdealMonsterState = MONSTERSTATE_ALERT; + if (m_MonsterState == MONSTERSTATE_IDLE) + m_IdealMonsterState = MONSTERSTATE_ALERT; } //========================================================= From 3503619bdd24e6acf013a2749bbebc33b2edf6ca Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin Date: Wed, 7 Jul 2021 00:41:17 +0500 Subject: [PATCH 7/9] Merge https://github.com/ValveSoftware/halflife/pull/3099. --- cl_dll/in_camera.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cl_dll/in_camera.cpp b/cl_dll/in_camera.cpp index 5e499ef4..881f0c3c 100644 --- a/cl_dll/in_camera.cpp +++ b/cl_dll/in_camera.cpp @@ -153,6 +153,9 @@ void DLLEXPORT CAM_Think( void ) #endif vec3_t viewangles; + if( gEngfuncs.GetMaxClients() > 1 && CL_IsThirdPerson() ) + CAM_ToFirstPerson(); + switch( (int)cam_command->value ) { case CAM_COMMAND_TOTHIRDPERSON: From 136ee78cfd497c0defa47d667ba0e2bf3bf612ef Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Fri, 27 Aug 2021 11:04:15 +0300 Subject: [PATCH 8/9] Make msvc builds in release mode with static runtime (#185) --- .github/workflows/.github.yml | 2 +- CMakeLists.txt | 4 ++++ appveyor.yml | 1 + cl_dll/CMakeLists.txt | 4 ++++ dlls/CMakeLists.txt | 4 ++++ 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/.github.yml b/.github/workflows/.github.yml index 26151361..8b5b6ecf 100644 --- a/.github/workflows/.github.yml +++ b/.github/workflows/.github.yml @@ -72,7 +72,7 @@ jobs: if: startsWith(matrix.os, 'windows') run: | cmake -G "Visual Studio 15 2017" -B build -DGOLDSOURCE_SUPPORT=ON -DCMAKE_INSTALL_PREFIX="dist" - msbuild build/INSTALL.vcxproj + msbuild -verbosity:normal /property:Configuration=Release build/INSTALL.vcxproj - name: Extract branch name shell: bash diff --git a/CMakeLists.txt b/CMakeLists.txt index 868c5e7f..35b4fad5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,10 @@ cmake_minimum_required(VERSION 2.8.12) +if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.15.0") + cmake_policy(SET CMP0091 NEW) +endif() + # Install custom module path set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") diff --git a/appveyor.yml b/appveyor.yml index bb4ba61d..6616ee57 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -16,6 +16,7 @@ build: configuration: - Debug + - Release before_build: - git submodule update --init --recursive diff --git a/cl_dll/CMakeLists.txt b/cl_dll/CMakeLists.txt index 11cf81cd..07d6b0d0 100644 --- a/cl_dll/CMakeLists.txt +++ b/cl_dll/CMakeLists.txt @@ -147,6 +147,10 @@ if(APPLE OR WIN32 OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") PREFIX "") endif() +if(MSVC) + set_property(TARGET ${CLDLL_LIBRARY} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") +endif() + install( TARGETS ${CLDLL_LIBRARY} DESTINATION "${GAMEDIR}/${CLIENT_INSTALL_DIR}/" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE diff --git a/dlls/CMakeLists.txt b/dlls/CMakeLists.txt index 053bc26b..4f8e60ac 100644 --- a/dlls/CMakeLists.txt +++ b/dlls/CMakeLists.txt @@ -177,6 +177,10 @@ if(APPLE OR WIN32 OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") PREFIX "") endif() +if(MSVC) + set_property(TARGET ${SVDLL_LIBRARY} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") +endif() + install( TARGETS ${SVDLL_LIBRARY} DESTINATION "${GAMEDIR}/${SERVER_INSTALL_DIR}/" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE From 060a6c3269ced26c3c5f8eae8490b9ac5800a514 Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin Date: Mon, 13 Sep 2021 01:13:23 +0500 Subject: [PATCH 9/9] Update README.md. --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 86c9c9c0..32d4fc05 100644 --- a/README.md +++ b/README.md @@ -37,8 +37,6 @@ These scripts also can be ran via wine: The libraries built this way are always GoldSource compatible. -There're dsp projects for Visual Studio 6 in `cl_dll` and `dlls` directories, but we don't keep them up-to-date. You're free to adapt them for yourself and try to import into the newer Visual Studio versions. - #### Using mingw TODO