Browse Source

Merge branch 'master' into mobile_hacks

mobile_hacks
Andrey Akhmichin 4 years ago
parent
commit
74f9375f84
  1. 3
      cl_dll/CMakeLists.txt
  2. 18
      cl_dll/wscript
  3. 8
      cmake/LibraryNaming.cmake
  4. 2
      dlls/basemonster.h
  5. 8
      dlls/game.cpp
  6. 1
      dlls/game.h
  7. 14
      dlls/monsters.cpp
  8. 12
      dlls/multiplay_gamerules.cpp
  9. 2
      dlls/player.cpp
  10. 6
      dlls/singleplay_gamerules.cpp
  11. 17
      public/build.h
  12. 8
      scripts/waifulib/library_naming.py

3
cl_dll/CMakeLists.txt

@ -132,6 +132,9 @@ endif()
if(WIN32) if(WIN32)
target_link_libraries( ${CLDLL_LIBRARY} user32.lib ) target_link_libraries( ${CLDLL_LIBRARY} user32.lib )
if (GOLDSOURCE_SUPPORT)
target_link_libraries( ${CLDLL_LIBRARY} winmm.lib )
endif()
endif() endif()
set_target_properties (${CLDLL_LIBRARY} PROPERTIES set_target_properties (${CLDLL_LIBRARY} PROPERTIES

18
cl_dll/wscript

@ -10,12 +10,15 @@ def options(opt):
return return
def configure(conf): def configure(conf):
if conf.env.GOLDSRC and conf.env.DEST_OS != 'win32':
conf.check_cc(lib='dl')
if conf.env.DEST_OS == 'win32': if conf.env.DEST_OS == 'win32':
conf.check_cxx(lib='user32') conf.check_cxx(lib='user32')
if conf.env.GOLDSRC:
if conf.env.DEST_OS == 'win32':
conf.check_cxx(lib='winmm')
else:
conf.check_cc(lib='dl')
def build(bld): def build(bld):
source = bld.path.parent.ant_glob([ source = bld.path.parent.ant_glob([
'pm_shared/*.c' 'pm_shared/*.c'
@ -101,12 +104,15 @@ def build(bld):
defines += ['GOLDSOURCE_SUPPORT'] defines += ['GOLDSOURCE_SUPPORT']
libs = [] libs = []
if bld.env.GOLDSRC and bld.env.DEST_OS != 'win32':
libs += ['DL']
if bld.env.DEST_OS == 'win32': if bld.env.DEST_OS == 'win32':
libs += ["USER32"] libs += ["USER32"]
if bld.env.GOLDSRC:
if bld.env.DEST_OS == 'win32':
libs += ["WINMM"]
else:
libs += ['DL']
if bld.env.DEST_OS not in ['android', 'dos']: if bld.env.DEST_OS not in ['android', 'dos']:
install_path = os.path.join(bld.env.GAMEDIR, bld.env.CLIENT_DIR) install_path = os.path.join(bld.env.GAMEDIR, bld.env.CLIENT_DIR)
else: else:

8
cmake/LibraryNaming.cmake

@ -7,13 +7,13 @@ check_symbol_exists(XASH_AMD64 "build.h" XASH_AMD64)
check_symbol_exists(XASH_ANDROID "build.h" XASH_ANDROID) check_symbol_exists(XASH_ANDROID "build.h" XASH_ANDROID)
check_symbol_exists(XASH_APPLE "build.h" XASH_APPLE) check_symbol_exists(XASH_APPLE "build.h" XASH_APPLE)
check_symbol_exists(XASH_ARM "build.h" XASH_ARM) check_symbol_exists(XASH_ARM "build.h" XASH_ARM)
check_symbol_exists(XASH_ARM64 "build.h" XASH_ARM64)
check_symbol_exists(XASH_ARM_HARDFP "build.h" XASH_ARM_HARDFP) check_symbol_exists(XASH_ARM_HARDFP "build.h" XASH_ARM_HARDFP)
check_symbol_exists(XASH_ARM_SOFTFP "build.h" XASH_ARM_SOFTFP) check_symbol_exists(XASH_ARM_SOFTFP "build.h" XASH_ARM_SOFTFP)
check_symbol_exists(XASH_ARMv4 "build.h" XASH_ARMv4) check_symbol_exists(XASH_ARMv4 "build.h" XASH_ARMv4)
check_symbol_exists(XASH_ARMv5 "build.h" XASH_ARMv5) check_symbol_exists(XASH_ARMv5 "build.h" XASH_ARMv5)
check_symbol_exists(XASH_ARMv6 "build.h" XASH_ARMv6) check_symbol_exists(XASH_ARMv6 "build.h" XASH_ARMv6)
check_symbol_exists(XASH_ARMv7 "build.h" XASH_ARMv7) check_symbol_exists(XASH_ARMv7 "build.h" XASH_ARMv7)
check_symbol_exists(XASH_ARMv8 "build.h" XASH_ARMv8)
check_symbol_exists(XASH_BIG_ENDIAN "build.h" XASH_BIG_ENDIAN) check_symbol_exists(XASH_BIG_ENDIAN "build.h" XASH_BIG_ENDIAN)
check_symbol_exists(XASH_BSD "build.h" XASH_BSD) check_symbol_exists(XASH_BSD "build.h" XASH_BSD)
check_symbol_exists(XASH_E2K "build.h" XASH_E2K) check_symbol_exists(XASH_E2K "build.h" XASH_E2K)
@ -55,11 +55,13 @@ if(XASH_AMD64)
set(BUILDARCH "amd64") set(BUILDARCH "amd64")
elseif(XASH_X86) elseif(XASH_X86)
set(BUILDARCH "") set(BUILDARCH "")
elseif(XASH_ARM64) elseif(XASH_ARM AND XASH_64BIT)
set(BUILDARCH "arm64") set(BUILDARCH "arm64")
elseif(XASH_ARM) elseif(XASH_ARM)
set(BUILDARCH "armv") set(BUILDARCH "armv")
if(XASH_ARMv7) if(XASH_ARMv8)
set(BUILDARCH "${BUILDARCH}8_32")
elseif(XASH_ARMv7)
set(BUILDARCH "${BUILDARCH}7") set(BUILDARCH "${BUILDARCH}7")
elseif(XASH_ARMv6) elseif(XASH_ARMv6)
set(BUILDARCH "${BUILDARCH}6") set(BUILDARCH "${BUILDARCH}6")

2
dlls/basemonster.h

@ -328,5 +328,7 @@ public:
BOOL CineCleanup(); BOOL CineCleanup();
CBaseEntity* DropItem( const char *pszItemName, const Vector &vecPos, const Vector &vecAng );// drop an item. CBaseEntity* DropItem( const char *pszItemName, const Vector &vecPos, const Vector &vecAng );// drop an item.
float m_flLastYawTime;
}; };
#endif // BASEMONSTER_H #endif // BASEMONSTER_H

8
dlls/game.cpp

@ -32,9 +32,10 @@ cvar_t timelimit = { "mp_timelimit","0", FCVAR_SERVER };
cvar_t friendlyfire = { "mp_friendlyfire","0", FCVAR_SERVER }; cvar_t friendlyfire = { "mp_friendlyfire","0", FCVAR_SERVER };
cvar_t falldamage = { "mp_falldamage","0", FCVAR_SERVER }; cvar_t falldamage = { "mp_falldamage","0", FCVAR_SERVER };
cvar_t weaponstay = { "mp_weaponstay","0", FCVAR_SERVER }; cvar_t weaponstay = { "mp_weaponstay","0", FCVAR_SERVER };
cvar_t selfgauss = { "mp_selfgauss", "1", FCVAR_SERVER }; cvar_t selfgauss = { "selfgauss", "1", FCVAR_SERVER };
cvar_t chargerfix = { "mp_chargerfix", "0", FCVAR_SERVER }; cvar_t chargerfix = { "chargerfix", "0", FCVAR_SERVER };
cvar_t satchelfix = { "mp_satchelfix", "0", FCVAR_SERVER }; cvar_t satchelfix = { "satchelfix", "0", FCVAR_SERVER };
cvar_t monsteryawspeedfix = { "monsteryawspeedfix", "0", FCVAR_SERVER };
cvar_t forcerespawn = { "mp_forcerespawn","1", FCVAR_SERVER }; cvar_t forcerespawn = { "mp_forcerespawn","1", FCVAR_SERVER };
cvar_t flashlight = { "mp_flashlight","0", FCVAR_SERVER }; cvar_t flashlight = { "mp_flashlight","0", FCVAR_SERVER };
cvar_t aimcrosshair = { "mp_autocrosshair","1", FCVAR_SERVER }; cvar_t aimcrosshair = { "mp_autocrosshair","1", FCVAR_SERVER };
@ -490,6 +491,7 @@ void GameDLLInit( void )
CVAR_REGISTER( &selfgauss ); CVAR_REGISTER( &selfgauss );
CVAR_REGISTER( &chargerfix ); CVAR_REGISTER( &chargerfix );
CVAR_REGISTER( &satchelfix ); CVAR_REGISTER( &satchelfix );
CVAR_REGISTER( &monsteryawspeedfix );
CVAR_REGISTER( &forcerespawn ); CVAR_REGISTER( &forcerespawn );
CVAR_REGISTER( &flashlight ); CVAR_REGISTER( &flashlight );
CVAR_REGISTER( &aimcrosshair ); CVAR_REGISTER( &aimcrosshair );

1
dlls/game.h

@ -30,6 +30,7 @@ extern cvar_t weaponstay;
extern cvar_t selfgauss; extern cvar_t selfgauss;
extern cvar_t chargerfix; extern cvar_t chargerfix;
extern cvar_t satchelfix; extern cvar_t satchelfix;
extern cvar_t monsteryawspeedfix;
extern cvar_t forcerespawn; extern cvar_t forcerespawn;
extern cvar_t flashlight; extern cvar_t flashlight;
extern cvar_t aimcrosshair; extern cvar_t aimcrosshair;

14
dlls/monsters.cpp

@ -2022,6 +2022,8 @@ void CBaseMonster::MonsterInit( void )
SetThink( &CBaseMonster::MonsterInitThink ); SetThink( &CBaseMonster::MonsterInitThink );
pev->nextthink = gpGlobals->time + 0.1f; pev->nextthink = gpGlobals->time + 0.1f;
SetUse( &CBaseMonster::MonsterUse ); SetUse( &CBaseMonster::MonsterUse );
m_flLastYawTime = gpGlobals->time;
} }
//========================================================= //=========================================================
@ -2504,7 +2506,17 @@ float CBaseMonster::ChangeYaw( int yawSpeed )
ideal = pev->ideal_yaw; ideal = pev->ideal_yaw;
if( current != ideal ) if( current != ideal )
{ {
if( monsteryawspeedfix.value )
{
float delta;
delta = Q_min( gpGlobals->time - m_flLastYawTime, 0.25f );
speed = (float)yawSpeed * delta * 2;
}
else
speed = (float)yawSpeed * gpGlobals->frametime * 10; speed = (float)yawSpeed * gpGlobals->frametime * 10;
move = ideal - current; move = ideal - current;
if( ideal > current ) if( ideal > current )
@ -2548,6 +2560,8 @@ float CBaseMonster::ChangeYaw( int yawSpeed )
else else
move = 0; move = 0;
m_flLastYawTime = gpGlobals->time;
return move; return move;
} }

12
dlls/multiplay_gamerules.cpp

@ -324,6 +324,12 @@ BOOL CHalfLifeMultiplay::FShouldSwitchWeapon( CBasePlayer *pPlayer, CBasePlayerI
return FALSE; return FALSE;
} }
if( pPlayer->m_iAutoWepSwitch == 2
&& pPlayer->m_afButtonLast & ( IN_ATTACK | IN_ATTACK2 ) )
{
return FALSE;
}
if( !pPlayer->m_pActiveItem->CanHolster() ) if( !pPlayer->m_pActiveItem->CanHolster() )
{ {
// can't put away the active item. // can't put away the active item.
@ -573,7 +579,11 @@ void CHalfLifeMultiplay::PlayerSpawn( CBasePlayer *pPlayer )
{ {
BOOL addDefault; BOOL addDefault;
CBaseEntity *pWeaponEntity = NULL; CBaseEntity *pWeaponEntity = NULL;
int iOldAutoWepSwitch;
iOldAutoWepSwitch = pPlayer->m_iAutoWepSwitch;
pPlayer->m_iAutoWepSwitch = 1;
pPlayer->pev->weapons |= ( 1 << WEAPON_SUIT ); pPlayer->pev->weapons |= ( 1 << WEAPON_SUIT );
addDefault = TRUE; addDefault = TRUE;
@ -590,6 +600,8 @@ void CHalfLifeMultiplay::PlayerSpawn( CBasePlayer *pPlayer )
pPlayer->GiveNamedItem( "weapon_9mmhandgun" ); pPlayer->GiveNamedItem( "weapon_9mmhandgun" );
pPlayer->GiveAmmo( 68, "9mm", _9MM_MAX_CARRY );// 4 full reloads pPlayer->GiveAmmo( 68, "9mm", _9MM_MAX_CARRY );// 4 full reloads
} }
pPlayer->m_iAutoWepSwitch = iOldAutoWepSwitch;
} }
//========================================================= //=========================================================

2
dlls/player.cpp

@ -2876,8 +2876,6 @@ void CBasePlayer::Spawn( void )
m_flNextChatTime = gpGlobals->time; m_flNextChatTime = gpGlobals->time;
m_iAutoWepSwitch = 1;
g_pGameRules->PlayerSpawn( this ); g_pGameRules->PlayerSpawn( this );
} }

6
dlls/singleplay_gamerules.cpp

@ -80,6 +80,12 @@ BOOL CHalfLifeRules::FShouldSwitchWeapon( CBasePlayer *pPlayer, CBasePlayerItem
return FALSE; return FALSE;
} }
if( pPlayer->m_iAutoWepSwitch == 2
&& pPlayer->m_afButtonLast & ( IN_ATTACK | IN_ATTACK2 ) )
{
return FALSE;
}
if( !pPlayer->m_pActiveItem->CanHolster() ) if( !pPlayer->m_pActiveItem->CanHolster() )
{ {
return FALSE; return FALSE;

17
public/build.h

@ -45,13 +45,13 @@ For more information, please refer to <http://unlicense.org/>
#undef XASH_ANDROID #undef XASH_ANDROID
#undef XASH_APPLE #undef XASH_APPLE
#undef XASH_ARM #undef XASH_ARM
#undef XASH_ARM64
#undef XASH_ARM_HARDFP #undef XASH_ARM_HARDFP
#undef XASH_ARM_SOFTFP #undef XASH_ARM_SOFTFP
#undef XASH_ARMv4 #undef XASH_ARMv4
#undef XASH_ARMv5 #undef XASH_ARMv5
#undef XASH_ARMv6 #undef XASH_ARMv6
#undef XASH_ARMv7 #undef XASH_ARMv7
#undef XASH_ARMv8
//#undef XASH_BIG_ENDIAN //#undef XASH_BIG_ENDIAN
#undef XASH_BSD #undef XASH_BSD
#undef XASH_E2K #undef XASH_E2K
@ -169,14 +169,13 @@ For more information, please refer to <http://unlicense.org/>
#define XASH_AMD64 1 #define XASH_AMD64 1
#elif defined(__i386__) || defined(_X86_) || defined(_M_IX86) #elif defined(__i386__) || defined(_X86_) || defined(_M_IX86)
#define XASH_X86 1 #define XASH_X86 1
#elif defined __aarch64__ #elif defined __aarch64__ || defined _M_ARM64
#define XASH_64BIT 1 #define XASH_64BIT 1
#define XASH_ARM64 1 #define XASH_ARM 8
#elif defined __arm__ || defined _M_ARM #elif defined __arm__ || defined _M_ARM
#if defined _M_ARM #if __ARM_ARCH == 8 || __ARM_ARCH_8__
// msvc can only armv7 ? #define XASH_ARM 8
#define XASH_ARM 7 #elif __ARM_ARCH == 7 || __ARM_ARCH_7__ || defined _M_ARM // msvc can only armv7 in 32 bit
#elif __ARM_ARCH == 7 || __ARM_ARCH_7__
#define XASH_ARM 7 #define XASH_ARM 7
#elif __ARM_ARCH == 6 || __ARM_ARCH_6__ || __ARM_ARCH_6J__ #elif __ARM_ARCH == 6 || __ARM_ARCH_6__ || __ARM_ARCH_6J__
#define XASH_ARM 6 #define XASH_ARM 6
@ -212,7 +211,9 @@ For more information, please refer to <http://unlicense.org/>
#define XASH_64BIT 1 #define XASH_64BIT 1
#endif #endif
#if XASH_ARM == 7 #if XASH_ARM == 8
#define XASH_ARMv8 1
#elif XASH_ARM == 7
#define XASH_ARMv7 1 #define XASH_ARMv7 1
#elif XASH_ARM == 6 #elif XASH_ARM == 6
#define XASH_ARMv6 1 #define XASH_ARMv6 1

8
scripts/waifulib/library_naming.py

@ -25,13 +25,13 @@ DEFINES = [
'XASH_ANDROID', 'XASH_ANDROID',
'XASH_APPLE', 'XASH_APPLE',
'XASH_ARM', 'XASH_ARM',
'XASH_ARM64',
'XASH_ARM_HARDFP', 'XASH_ARM_HARDFP',
'XASH_ARM_SOFTFP', 'XASH_ARM_SOFTFP',
'XASH_ARMv4', 'XASH_ARMv4',
'XASH_ARMv5', 'XASH_ARMv5',
'XASH_ARMv6', 'XASH_ARMv6',
'XASH_ARMv7', 'XASH_ARMv7',
'XASH_ARMv8',
'XASH_BIG_ENDIAN', 'XASH_BIG_ENDIAN',
'XASH_BSD', 'XASH_BSD',
'XASH_E2K', 'XASH_E2K',
@ -87,11 +87,13 @@ def configure(conf):
buildarch = "amd64" buildarch = "amd64"
elif conf.env.XASH_X86: elif conf.env.XASH_X86:
buildarch = "" buildarch = ""
elif conf.env.XASH_ARM64: elif conf.env.XASH_ARM and conf.env.XASH_64BIT:
buildarch = "arm64" buildarch = "arm64"
elif conf.env.XASH_ARM: elif conf.env.XASH_ARM:
buildarch = "armv" buildarch = "armv"
if conf.env.XASH_ARMv7: if conf.env.XASH_ARMv8:
buildarch += "8_32"
elif conf.env.XASH_ARMv7:
buildarch += "7" buildarch += "7"
elif conf.env.XASH_ARMv6: elif conf.env.XASH_ARMv6:
buildarch += "6" buildarch += "6"

Loading…
Cancel
Save