From 59fe50125403b0bddd23ad829ac7e9e4570dc926 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Lortie Date: Wed, 8 Dec 2021 20:02:49 -0500 Subject: [PATCH 1/7] Fixed wrong base class specified. (#222) --- dlls/func_break.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/func_break.cpp b/dlls/func_break.cpp index 98432d06..916913f2 100644 --- a/dlls/func_break.cpp +++ b/dlls/func_break.cpp @@ -139,7 +139,7 @@ TYPEDESCRIPTION CBreakable::m_SaveData[] = // Explosion magnitude is stored in pev->impulse }; -IMPLEMENT_SAVERESTORE( CBreakable, CBaseEntity ) +IMPLEMENT_SAVERESTORE( CBreakable, CBaseDelay ) void CBreakable::Spawn( void ) { From ccfe0c659e2b9d2a44b70c278dc54ad475ed4c62 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Lortie Date: Wed, 8 Dec 2021 20:03:12 -0500 Subject: [PATCH 2/7] Fixed wrong base class specified. (#224) --- dlls/h_battery.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/h_battery.cpp b/dlls/h_battery.cpp index f0cf612b..77559cc5 100644 --- a/dlls/h_battery.cpp +++ b/dlls/h_battery.cpp @@ -60,7 +60,7 @@ TYPEDESCRIPTION CRecharge::m_SaveData[] = DEFINE_FIELD( CRecharge, m_flSoundTime, FIELD_TIME ), }; -IMPLEMENT_SAVERESTORE( CRecharge, CBaseEntity ) +IMPLEMENT_SAVERESTORE( CRecharge, CBaseToggle ) LINK_ENTITY_TO_CLASS( func_recharge, CRecharge ) From 0df2d289bb5a1b0135dc51c674b77eebb89c538e Mon Sep 17 00:00:00 2001 From: Marc-Antoine Lortie Date: Wed, 8 Dec 2021 20:03:47 -0500 Subject: [PATCH 3/7] Fixed wrong base class specified. (#223) --- dlls/healthkit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/healthkit.cpp b/dlls/healthkit.cpp index 9e111300..37e4624a 100644 --- a/dlls/healthkit.cpp +++ b/dlls/healthkit.cpp @@ -127,7 +127,7 @@ TYPEDESCRIPTION CWallHealth::m_SaveData[] = DEFINE_FIELD( CWallHealth, m_flSoundTime, FIELD_TIME ), }; -IMPLEMENT_SAVERESTORE( CWallHealth, CBaseEntity ) +IMPLEMENT_SAVERESTORE( CWallHealth, CBaseToggle ) LINK_ENTITY_TO_CLASS( func_healthcharger, CWallHealth ) From a5344eb4ccaf10c1deaec27e6e10de90aa92438f Mon Sep 17 00:00:00 2001 From: Marc-Antoine Lortie Date: Thu, 9 Dec 2021 21:38:48 -0500 Subject: [PATCH 4/7] Fixed wrong base class specified. (#226) --- dlls/sound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/sound.cpp b/dlls/sound.cpp index 688b4016..3dbd097a 100644 --- a/dlls/sound.cpp +++ b/dlls/sound.cpp @@ -825,7 +825,7 @@ TYPEDESCRIPTION CEnvSound::m_SaveData[] = DEFINE_FIELD( CEnvSound, m_flRoomtype, FIELD_FLOAT ), }; -IMPLEMENT_SAVERESTORE( CEnvSound, CBaseEntity ) +IMPLEMENT_SAVERESTORE( CEnvSound, CPointEntity ) void CEnvSound::KeyValue( KeyValueData *pkvd ) { From f0ed7d1bc194f66be5c5df084d8dc7f76706a56c Mon Sep 17 00:00:00 2001 From: Marc-Antoine Lortie Date: Thu, 9 Dec 2021 21:39:06 -0500 Subject: [PATCH 5/7] Fixed wrong base class specified. (#225) --- dlls/pathcorner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/pathcorner.cpp b/dlls/pathcorner.cpp index bc999675..c563bf69 100644 --- a/dlls/pathcorner.cpp +++ b/dlls/pathcorner.cpp @@ -125,7 +125,7 @@ TYPEDESCRIPTION CPathTrack::m_SaveData[] = DEFINE_FIELD( CPathTrack, m_altName, FIELD_STRING ), }; -IMPLEMENT_SAVERESTORE( CPathTrack, CBaseEntity ) +IMPLEMENT_SAVERESTORE( CPathTrack, CPointEntity ) LINK_ENTITY_TO_CLASS( path_track, CPathTrack ) // From f43961e4d044bbc82dae0c7aac0797008cd7adf4 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Lortie Date: Tue, 14 Dec 2021 09:23:07 -0500 Subject: [PATCH 6/7] Simplify glock fire events (#231) * Refactor EV_FireGlock2. * Moved EV_FireGlock1 implementation to static function. --- cl_dll/ev_hldm.cpp | 51 ++++++++-------------------------------------- 1 file changed, 8 insertions(+), 43 deletions(-) diff --git a/cl_dll/ev_hldm.cpp b/cl_dll/ev_hldm.cpp index c05d6630..6eee0328 100644 --- a/cl_dll/ev_hldm.cpp +++ b/cl_dll/ev_hldm.cpp @@ -458,7 +458,8 @@ void EV_HLDM_FireBullets( int idx, float *forward, float *right, float *up, int //====================== // GLOCK START //====================== -void EV_FireGlock1( event_args_t *args ) +// Shared Glock fire implementation for EV_FireGlock1 and EV_FireGlock2. +static void EV_FireGlock_Impl( event_args_t *args ) { int idx; vec3_t origin; @@ -503,50 +504,14 @@ void EV_FireGlock1( event_args_t *args ) EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_9MM, 0, &g_tracerCount[idx - 1], args->fparam1, args->fparam2 ); } +void EV_FireGlock1( event_args_t *args ) +{ + EV_FireGlock_Impl( args ); +} + void EV_FireGlock2( event_args_t *args ) { - int idx; - vec3_t origin; - vec3_t angles; - vec3_t velocity; - - vec3_t ShellVelocity; - vec3_t ShellOrigin; - int shell; - vec3_t vecSrc, vecAiming; - //vec3_t vecSpread; - vec3_t up, right, forward; - - idx = args->entindex; - VectorCopy( args->origin, origin ); - VectorCopy( args->angles, angles ); - VectorCopy( args->velocity, velocity ); - int empty = args->bparam1; - - AngleVectors( angles, forward, right, up ); - - shell = gEngfuncs.pEventAPI->EV_FindModelIndex( "models/shell.mdl" );// brass shell - - if( EV_IsLocal( idx ) ) - { - // Add muzzle flash to current weapon model - EV_MuzzleFlash(); - gEngfuncs.pEventAPI->EV_WeaponAnimation( empty ? GLOCK_SHOOT_EMPTY : GLOCK_SHOOT, 2 ); - - V_PunchAxis( 0, -2.0 ); - } - - EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20, -12, 4 ); - - EV_EjectBrass ( ShellOrigin, ShellVelocity, angles[YAW], shell, TE_BOUNCE_SHELL ); - - gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/pl_gun3.wav", gEngfuncs.pfnRandomFloat( 0.92, 1.0 ), ATTN_NORM, 0, 98 + gEngfuncs.pfnRandomLong( 0, 3 ) ); - - EV_GetGunPosition( args, vecSrc, origin ); - - VectorCopy( forward, vecAiming ); - - EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_9MM, 0, &g_tracerCount[idx - 1], args->fparam1, args->fparam2 ); + EV_FireGlock_Impl( args ); } //====================== // GLOCK END From 215ac04f7094880c04d5eb40c9c63dd8853b6ed8 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Fri, 17 Dec 2021 03:16:35 +0300 Subject: [PATCH 7/7] waifulib: update xcompile from engine branch --- scripts/waifulib/xcompile.py | 52 +++++++++++++++++------------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/scripts/waifulib/xcompile.py b/scripts/waifulib/xcompile.py index 5d7082b3..0abf53f1 100644 --- a/scripts/waifulib/xcompile.py +++ b/scripts/waifulib/xcompile.py @@ -26,6 +26,8 @@ ANDROID_NDK_GCC_MAX = 17 # latest NDK that ships with GCC ANDROID_NDK_UNIFIED_SYSROOT_MIN = 15 ANDROID_NDK_SYSROOT_FLAG_MAX = 19 # latest NDK that need --sysroot flag ANDROID_NDK_API_MIN = { 10: 3, 19: 16, 20: 16, 23: 16 } # minimal API level ndk revision supports + +ANDROID_STPCPY_API_MIN = 21 # stpcpy() introduced in SDK 21 ANDROID_64BIT_API_MIN = 21 # minimal API level that supports 64-bit targets # This class does support ONLY r10e and r19c/r20 NDK @@ -266,47 +268,43 @@ class Android: '-isystem', '%s/usr/include/' % (self.sysroot()) ] - cflags += ['-I%s' % (self.system_stl()), '-DANDROID', '-D__ANDROID__'] + cflags += ['-I%s' % (self.system_stl())] + if not self.is_clang(): + cflags += ['-DANDROID', '-D__ANDROID__'] if cxx and not self.is_clang() and self.toolchain not in ['4.8','4.9']: cflags += ['-fno-sized-deallocation'] - def fixup_host_clang_with_old_ndk(): - cflags = [] - # Clang builtin redefine w/ different calling convention bug - # NOTE: I did not added complex.h functions here, despite - # that NDK devs forgot to put __NDK_FPABI_MATH__ for complex - # math functions - # I personally don't need complex numbers support, but if you want it - # just run sed to patch header - for f in ['strtod', 'strtof', 'strtold']: - cflags += ['-fno-builtin-%s' % f] - return cflags - + if self.is_clang(): + # stpcpy() isn't available in early Android versions + # disable it here so Clang won't use it + if self.api < ANDROID_STPCPY_API_MIN: + cflags += ['-fno-builtin-stpcpy'] if self.is_arm(): if self.arch == 'armeabi-v7a': # ARMv7 support - cflags += ['-mthumb', '-mfpu=neon', '-mcpu=cortex-a9', '-DHAVE_EFFICIENT_UNALIGNED_ACCESS', '-DVECTORIZE_SINCOS'] - - if not self.is_clang() and not self.is_host(): - cflags += [ '-mvectorize-with-neon-quad' ] - - if self.is_host() and self.ndk_rev <= ANDROID_NDK_HARDFP_MAX: - cflags += fixup_host_clang_with_old_ndk() + cflags += ['-mthumb', '-mfpu=neon', '-mcpu=cortex-a9'] if self.is_hardfp(): cflags += ['-D_NDK_MATH_NO_SOFTFP=1', '-mfloat-abi=hard', '-DLOAD_HARDFP', '-DSOFTFP_LINK'] + + if self.is_host(): + # Clang builtin redefine w/ different calling convention bug + # NOTE: I did not added complex.h functions here, despite + # that NDK devs forgot to put __NDK_FPABI_MATH__ for complex + # math functions + # I personally don't need complex numbers support, but if you want it + # just run sed to patch header + for f in ['strtod', 'strtof', 'strtold']: + cflags += ['-fno-builtin-%s' % f] else: cflags += ['-mfloat-abi=softfp'] else: - if self.is_host() and self.ndk_rev <= ANDROID_NDK_HARDFP_MAX: - cflags += fixup_host_clang_with_old_ndk() - # ARMv5 support cflags += ['-march=armv5te', '-msoft-float'] elif self.is_x86(): - cflags += ['-mtune=atom', '-march=atom', '-mssse3', '-mfpmath=sse', '-DVECTORIZE_SINCOS', '-DHAVE_EFFICIENT_UNALIGNED_ACCESS'] + cflags += ['-mtune=atom', '-march=atom', '-mssse3', '-mfpmath=sse'] return cflags # they go before object list @@ -322,8 +320,9 @@ class Android: if self.is_clang() or self.is_host(): linkflags += ['-fuse-ld=lld'] + else: linkflags += ['-no-canonical-prefixes'] - linkflags += ['-Wl,--hash-style=sysv', '-Wl,--no-undefined', '-no-canonical-prefixes'] + linkflags += ['-Wl,--hash-style=sysv', '-Wl,--no-undefined'] return linkflags def ldflags(self): @@ -332,10 +331,9 @@ class Android: if self.ndk_rev < 23: ldflags += ['-lgcc'] - ldflags += ['-no-canonical-prefixes'] - if self.is_clang() or self.is_host(): ldflags += ['-stdlib=libstdc++'] + else: ldflags += ['-no-canonical-prefixes'] if self.is_arm(): if self.arch == 'armeabi-v7a':