Browse Source

Merge branch 'master' into opfor

opforfixed
Andrey Akhmichin 3 years ago
parent
commit
c4d55a4428
No known key found for this signature in database
GPG Key ID: 1F180D249B0643C0
  1. 6
      .github/workflows/.github.yml
  2. 12
      CMakeLists.txt
  3. 2
      cl_dll/ammo.cpp
  4. 12
      cl_dll/cdll_int.cpp
  5. 65
      cl_dll/ev_hldm.cpp
  6. 2
      cl_dll/hud_spectator.cpp
  7. 4
      cl_dll/in_camera.cpp
  8. 163
      cl_dll/soundsystem.cpp
  9. 2
      cl_dll/vgui_TeamFortressViewport.h
  10. 16
      cmake/LibraryNaming.cmake
  11. 1514
      dlls/AI_BaseNPC_Schedule.cpp
  12. 2
      dlls/CMakeLists.txt
  13. 45
      dlls/agrunt.cpp
  14. 10
      dlls/animating.cpp
  15. 6
      dlls/apache.cpp
  16. 4
      dlls/buttons.cpp
  17. 4
      dlls/egon.cpp
  18. 2
      dlls/func_break.cpp
  19. 59
      dlls/gargantua.cpp
  20. 2
      dlls/h_battery.cpp
  21. 2
      dlls/healthkit.cpp
  22. 4
      dlls/hornetgun.cpp
  23. 29
      dlls/islave.cpp
  24. 12
      dlls/leech.cpp
  25. 2
      dlls/pathcorner.cpp
  26. 2
      dlls/sound.cpp
  27. 1
      dlls/talkmonster.cpp
  28. 2
      dlls/weapons.cpp
  29. 2
      dlls/weapons.h
  30. 45
      dlls/zombie.cpp
  31. 3
      engine/cdll_int.h
  32. 621
      engine/engine.dsp
  33. 6
      public/build.h
  34. 167
      scripts/waifulib/compiler_optimizations.py
  35. 7
      scripts/waifulib/library_naming.py
  36. 64
      scripts/waifulib/xcompile.py
  37. 89
      wscript

6
.github/workflows/.github.yml

@ -14,7 +14,7 @@ jobs: @@ -14,7 +14,7 @@ jobs:
- os: ubuntu-latest
cc: clang
cxx: clang++
- os: windows-2016
- os: windows-2019
cc: cl
cxx: cl
env:
@ -81,12 +81,12 @@ jobs: @@ -81,12 +81,12 @@ jobs:
- name: Build with msvc
if: startsWith(matrix.os, 'windows')
run: |
cmake -G "Visual Studio 15 2017" -B build -DGOLDSOURCE_SUPPORT=ON -DCMAKE_INSTALL_PREFIX="dist"
cmake -G "Visual Studio 16 2019" -A Win32 -B build -DGOLDSOURCE_SUPPORT=ON -DCMAKE_INSTALL_PREFIX="dist"
msbuild -verbosity:normal /property:Configuration=Release build/INSTALL.vcxproj
- name: Build with msvc and vgui
if: startsWith(matrix.os, 'windows')
run: |
cmake -G "Visual Studio 15 2017" -B build -DGOLDSOURCE_SUPPORT=ON -DUSE_VGUI=ON -DCMAKE_INSTALL_PREFIX="dist-vgui"
cmake -G "Visual Studio 16 2019" -A Win32 -B build -DGOLDSOURCE_SUPPORT=ON -DUSE_VGUI=ON -DCMAKE_INSTALL_PREFIX="dist-vgui"
msbuild -verbosity:normal /property:Configuration=Release build/INSTALL.vcxproj
- name: Extract branch name

12
CMakeLists.txt

@ -44,11 +44,21 @@ option(USE_VOICEMGR "Enable VOICE MANAGER." OFF) @@ -44,11 +44,21 @@ option(USE_VOICEMGR "Enable VOICE MANAGER." OFF)
option(BUILD_CLIENT "Build client dll" ON)
option(BUILD_SERVER "Build server dll" ON)
option(GOLDSOURCE_SUPPORT "Build goldsource compatible client library" OFF)
if (CMAKE_SIZEOF_VOID_P EQUAL 4 OR
((WIN32 OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
AND (CMAKE_SYSTEM_PROCESSOR STREQUAL "x64"
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64"
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64")))
option(64BIT "Disable auto -m32 appending to compiler flags" OFF)
else()
option(64BIT "Disable auto -m32 appending to compiler flags" ON)
endif()
set(GAMEDIR "gearbox" CACHE STRING "Gamedir path")
set(SERVER_INSTALL_DIR "dlls" CACHE STRING "Where put server dll")
set(CLIENT_INSTALL_DIR "cl_dlls" CACHE STRING "Where put client dll")
set(SERVER_LIBRARY_NAME "opfor" CACHE STRING "Library name for Linux/MacOS/Windows")
set(SERVER_LIBRARY_NAME "opfor" CACHE STRING "Library name for PC platforms")
#-----------------
# MAIN BUILD CODE \

2
cl_dll/ammo.cpp

@ -359,7 +359,7 @@ void CHudAmmo::Think( void ) @@ -359,7 +359,7 @@ void CHudAmmo::Think( void )
{
WEAPON *p = gWR.GetWeapon( i );
if( p )
if( p && p->iId )
{
if( gHUD.m_iWeaponBits & ( 1 << p->iId ) )
gWR.PickupWeapon( p );

12
cl_dll/cdll_int.cpp

@ -167,7 +167,17 @@ int DLLEXPORT Initialize( cl_enginefunc_t *pEnginefuncs, int iVersion ) @@ -167,7 +167,17 @@ int DLLEXPORT Initialize( cl_enginefunc_t *pEnginefuncs, int iVersion )
if( iVersion != CLDLL_INTERFACE_VERSION )
return 0;
memcpy( &gEngfuncs, pEnginefuncs, sizeof(cl_enginefunc_t) );
// for now filterstuffcmd is last in the engine interface
memcpy( &gEngfuncs, pEnginefuncs, sizeof(cl_enginefunc_t) - sizeof( void * ) );
if( gEngfuncs.pfnGetCvarPointer( "cl_filterstuffcmd" ) == 0 )
{
gEngfuncs.pfnFilteredClientCmd = gEngfuncs.pfnClientCmd;
}
else
{
gEngfuncs.pfnFilteredClientCmd = pEnginefuncs->pfnFilteredClientCmd;
}
EV_HookEvents();

65
cl_dll/ev_hldm.cpp

@ -490,7 +490,8 @@ void EV_HLDM_FireBullets( int idx, float *forward, float *right, float *up, int @@ -490,7 +490,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;
@ -532,53 +533,17 @@ void EV_FireGlock1( event_args_t *args ) @@ -532,53 +533,17 @@ void EV_FireGlock1( event_args_t *args )
VectorCopy( forward, vecAiming );
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_9MM, 0, 0, args->fparam1, args->fparam2 );
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_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 ) )
void EV_FireGlock1( event_args_t *args )
{
// 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_FireGlock_Impl( args );
}
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 );
void EV_FireGlock2( event_args_t *args )
{
EV_FireGlock_Impl( args );
}
//======================
// GLOCK END
@ -599,7 +564,7 @@ void EV_FireShotGunDouble( event_args_t *args ) @@ -599,7 +564,7 @@ void EV_FireShotGunDouble( event_args_t *args )
vec3_t ShellOrigin;
int shell;
vec3_t vecSrc, vecAiming;
vec3_t vecSpread;
//vec3_t vecSpread;
vec3_t up, right, forward;
//float flSpread = 0.01;
@ -653,7 +618,7 @@ void EV_FireShotGunSingle( event_args_t *args ) @@ -653,7 +618,7 @@ void EV_FireShotGunSingle( event_args_t *args )
vec3_t ShellOrigin;
int shell;
vec3_t vecSrc, vecAiming;
vec3_t vecSpread;
//vec3_t vecSpread;
vec3_t up, right, forward;
//float flSpread = 0.01;
@ -830,7 +795,7 @@ void EV_FirePython( event_args_t *args ) @@ -830,7 +795,7 @@ void EV_FirePython( event_args_t *args )
VectorCopy( forward, vecAiming );
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_357, 0, 0, args->fparam1, args->fparam2 );
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_357, 0, &g_tracerCount[idx - 1], args->fparam1, args->fparam2 );
}
//======================
// PHYTON END
@ -1182,8 +1147,8 @@ void EV_Crowbar( event_args_t *args ) @@ -1182,8 +1147,8 @@ void EV_Crowbar( event_args_t *args )
{
int idx;
vec3_t origin;
vec3_t angles;
vec3_t velocity;
//vec3_t angles;
//vec3_t velocity;
idx = args->entindex;
VectorCopy( args->origin, origin );
@ -1620,7 +1585,7 @@ enum hgun_e @@ -1620,7 +1585,7 @@ enum hgun_e
void EV_HornetGunFire( event_args_t *args )
{
int idx; //, iFireMode;
vec3_t origin, angles, vecSrc, forward, right, up;
vec3_t origin, angles; //, vecSrc, forward, right, up;
idx = args->entindex;
VectorCopy( args->origin, origin );
@ -1726,7 +1691,7 @@ enum squeak_e @@ -1726,7 +1691,7 @@ enum squeak_e
void EV_SnarkFire( event_args_t *args )
{
int idx;
vec3_t vecSrc, angles, view_ofs, forward;
vec3_t vecSrc, angles, /*view_ofs,*/ forward;
pmtrace_t tr;
idx = args->entindex;

2
cl_dll/hud_spectator.cpp

@ -577,7 +577,7 @@ void CHudSpectator::DirectorMessage( int iSize, void *pbuf ) @@ -577,7 +577,7 @@ void CHudSpectator::DirectorMessage( int iSize, void *pbuf )
case DRC_CMD_FADE:
break;
case DRC_CMD_STUFFTEXT:
ClientCmd( READ_STRING() );
gEngfuncs.pfnFilteredClientCmd( READ_STRING() );
break;
default:
gEngfuncs.Con_DPrintf( "CHudSpectator::DirectorMessage: unknown command %i.\n", cmd );

4
cl_dll/in_camera.cpp

@ -535,9 +535,9 @@ void CAM_Init( void ) @@ -535,9 +535,9 @@ void CAM_Init( void )
cam_command = gEngfuncs.pfnRegisterVariable( "cam_command", "0", 0 ); // tells camera to go to thirdperson
cam_snapto = gEngfuncs.pfnRegisterVariable( "cam_snapto", "0", 0 ); // snap to thirdperson view
cam_idealyaw = gEngfuncs.pfnRegisterVariable( "cam_idealyaw", "90", 0 ); // thirdperson yaw
cam_idealyaw = gEngfuncs.pfnRegisterVariable( "cam_idealyaw", "0", 0 ); // thirdperson yaw
cam_idealpitch = gEngfuncs.pfnRegisterVariable( "cam_idealpitch", "0", 0 ); // thirperson pitch
cam_idealdist = gEngfuncs.pfnRegisterVariable( "cam_idealdist", "64", 0 ); // thirdperson distance
cam_idealdist = gEngfuncs.pfnRegisterVariable( "cam_idealdist", "128", 0 ); // thirdperson distance
cam_contain = gEngfuncs.pfnRegisterVariable( "cam_contain", "0", 0 ); // contain camera to world
c_maxpitch = gEngfuncs.pfnRegisterVariable( "c_maxpitch", "90.0", 0 );

163
cl_dll/soundsystem.cpp

@ -1,163 +0,0 @@ @@ -1,163 +0,0 @@
//======== (C) Copyright 1996-2002 Valve, L.L.C. All rights reserved. ========
//
// The copyright to the contents herein is the property of Valve, L.L.C.
// The contents may be used and/or copied only with the written permission of
// Valve, L.L.C., or in accordance with the terms and conditions stipulated in
// the agreement/contract under which the contents have been supplied.
//
// Purpose:
//
// $Workfile: $
// $Date: $
//
//-----------------------------------------------------------------------------
// $Log: $
//
// $NoKeywords: $
//=============================================================================
#include <windows.h>
#include <dsound.h>
#include <mmsystem.h>
#include "r_studioint.h"
extern engine_studio_api_t IEngineStudio;
#define RENDERTYPE_UNDEFINED 0
#define RENDERTYPE_SOFTWARE 1
#define RENDERTYPE_HARDWARE 2
#define ENGINE_LAUNCHER_API_VERSION 1
LPDIRECTSOUND lpDS = NULL;
LPDIRECTSOUNDBUFFER lpDSBuf = NULL;
LPHWAVEOUT lpHW = NULL;
static HMODULE hEngine = 0;
typedef struct engine_api_s
{
int version;
int rendertype;
int size;
// Functions
void ( *unused1 ) ( void );
void ( *unused2 ) ( void );
void ( *unused3 ) ( void );
void ( *unused4 ) ( void );
void ( *unused5 ) ( void );
void ( *unused6 ) ( void );
void ( *unused7 ) ( void );
void ( *unused8 ) ( void );
void ( *unused9 ) ( void );
void ( *unused10 ) ( void );
void ( *unused11 ) ( void );
void ( *unused12 ) ( void );
void ( *unused13 ) ( void );
void ( *unused14 ) ( void );
void ( *unused15 ) ( void );
void ( *unused16 ) ( void );
void ( *unused17 ) ( void );
void ( *unused18 ) ( void );
void ( *unused19 ) ( void );
void ( *unused20 ) ( void );
void ( *unused21 ) ( void );
void ( *unused22 ) ( void );
void ( *unused23 ) ( void );
void ( *unused24 ) ( void );
void ( *unused25 ) ( void );
void ( *unused26 ) ( void );
void ( *unused27 ) ( void );
void ( *unused28 ) ( void );
void ( *unused29 ) ( void );
void ( *unused30 ) ( void );
void ( *unused31 ) ( void );
void ( *unused32 ) ( void );
void ( *unused33 ) ( void );
void ( *unused34 ) ( void );
void ( *S_GetDSPointer ) ( struct IDirectSound **lpDS, struct IDirectSoundBuffer **lpDSBuf );
void *( *S_GetWAVPointer ) ( void );
void ( *unused35 ) ( void );
void ( *unused36 ) ( void );
void ( *unused37 ) ( void );
void ( *unused38 ) ( void );
void ( *unused39 ) ( void );
void ( *unused40 ) ( void );
void ( *unused41 ) ( void );
void ( *unused42 ) ( void );
void ( *unused43 ) ( void );
void ( *unused44 ) ( void );
void ( *unused45 ) ( void );
void ( *unused46 ) ( void );
void ( *unused47 ) ( void );
void ( *unused48 ) ( void );
void ( *unused49 ) ( void );
void ( *unused50 ) ( void );
void ( *unused51 ) ( void );
void ( *unused52 ) ( void );
void ( *unused53 ) ( void );
void ( *unused54 ) ( void );
void ( *unused55 ) ( void );
} engine_api_t;
static engine_api_t engineapi;
typedef int (*engine_api_func)( int version, int size, struct engine_api_s *api );
//-----------------------------------------------------------------------------
// Purpose: Get launcher/engine interface from engine module
// Input : hMod -
// Output : int
//-----------------------------------------------------------------------------
int Eng_LoadFunctions( HMODULE hMod )
{
engine_api_func pfnEngineAPI;
pfnEngineAPI = ( engine_api_func )GetProcAddress( hMod, "Sys_EngineAPI" );
if( !pfnEngineAPI )
return 0;
if( !(*pfnEngineAPI)( ENGINE_LAUNCHER_API_VERSION, sizeof( engine_api_t ), &engineapi ) )
return 0;
// All is okay
return 1;
}
//-----------------------------------------------------------------------------
// Purpose: Load proper engine .dll and get pointer to either DSound and primary buffer or HWAVEOUT ( NT 4.0, e.g. )
//-----------------------------------------------------------------------------
void LoadSoundAPIs( void )
{
hEngine = ::LoadLibrary( IEngineStudio.IsHardware() ? "hw.dll" : "sw.dll" );
if( hEngine )
{
if( Eng_LoadFunctions( hEngine ) )
{
if( engineapi.S_GetDSPointer && engineapi.S_GetWAVPointer )
{
engineapi.S_GetDSPointer(&lpDS, &lpDSBuf);
lpHW = (HWAVEOUT FAR *)engineapi.S_GetWAVPointer();
}
}
}
}
//-----------------------------------------------------------------------------
// Purpose: Close engine library, release sound pointers
//-----------------------------------------------------------------------------
void ShutdownSoundAPIs( void )
{
if( hEngine )
{
FreeLibrary( hEngine );
hEngine = 0;
}
lpDS = 0;
lpDSBuf = 0;
lpHW = 0;
}

2
cl_dll/vgui_TeamFortressViewport.h

@ -667,7 +667,7 @@ public: @@ -667,7 +667,7 @@ public:
virtual void actionPerformed(Panel *panel)
{
gEngfuncs.pfnClientCmd( m_pszCommand );
gEngfuncs.pfnFilteredClientCmd( m_pszCommand );
if( m_iCloseVGUIMenu )
gViewPort->HideTopMenu();

16
cmake/LibraryNaming.cmake

@ -28,6 +28,7 @@ check_symbol_exists(XASH_LINUX "build.h" XASH_LINUX) @@ -28,6 +28,7 @@ check_symbol_exists(XASH_LINUX "build.h" XASH_LINUX)
check_symbol_exists(XASH_LITTLE_ENDIAN "build.h" XASH_LITTLE_ENDIAN)
check_symbol_exists(XASH_MINGW "build.h" XASH_MINGW)
check_symbol_exists(XASH_MIPS "build.h" XASH_MIPS)
check_symbol_exists(XASH_PPC "build.h" XASH_PPC)
check_symbol_exists(XASH_MOBILE_PLATFORM "build.h" XASH_MOBILE_PLATFORM)
check_symbol_exists(XASH_MSVC "build.h" XASH_MSVC)
check_symbol_exists(XASH_NETBSD "build.h" XASH_NETBSD)
@ -64,7 +65,11 @@ endif() @@ -64,7 +65,11 @@ endif()
if(XASH_AMD64)
set(BUILDARCH "amd64")
elseif(XASH_X86)
set(BUILDARCH "")
if(XASH_WIN32 OR XASH_LINUX OR XASH_APPLE)
set(BUILDARCH "") # no prefix for default OS
else()
set(BUILDARCH "i386")
endif()
elseif(XASH_ARM AND XASH_64BIT)
set(BUILDARCH "arm64")
elseif(XASH_ARM)
@ -97,6 +102,15 @@ elseif(XASH_MIPS) @@ -97,6 +102,15 @@ elseif(XASH_MIPS)
if(XASH_LITTLE_ENDIAN)
set(BUILDARCH "${BUILDARCH}el")
endif()
elseif(XASH_PPC)
set(BUILDARCH "powerpc")
if(XASH_64BIT)
set(BUILDARCH "${BUILDARCH}64")
endif()
if(XASH_LITTLE_ENDIAN)
set(BUILDARCH "${BUILDARCH}le")
endif()
elseif(XASH_RISCV)
set(BUILDARCH "riscv")
if(XASH_64BIT)

1514
dlls/AI_BaseNPC_Schedule.cpp

File diff suppressed because it is too large Load Diff

2
dlls/CMakeLists.txt

@ -220,7 +220,7 @@ add_library (${SVDLL_LIBRARY} SHARED ${SVDLL_SOURCES}) @@ -220,7 +220,7 @@ add_library (${SVDLL_LIBRARY} SHARED ${SVDLL_SOURCES})
set_target_properties (${SVDLL_LIBRARY} PROPERTIES
POSITION_INDEPENDENT_CODE 1)
if(APPLE OR WIN32 OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Android")
set(SVDLL_NAME "${SERVER_LIBRARY_NAME}")
set_target_properties(${SVDLL_LIBRARY} PROPERTIES

45
dlls/agrunt.cpp

@ -337,7 +337,7 @@ void CAGrunt::DeathSound( void ) @@ -337,7 +337,7 @@ void CAGrunt::DeathSound( void )
{
StopTalking();
EMIT_SOUND( ENT( pev ), CHAN_VOICE, pDieSounds[RANDOM_LONG( 0, ARRAYSIZE( pDieSounds ) - 1 )], 1.0f, ATTN_NORM );
EMIT_SOUND( ENT( pev ), CHAN_VOICE, RANDOM_SOUND_ARRAY( pDieSounds ), 1.0f, ATTN_NORM );
}
//=========================================================
@ -347,7 +347,7 @@ void CAGrunt::AlertSound( void ) @@ -347,7 +347,7 @@ void CAGrunt::AlertSound( void )
{
StopTalking();
EMIT_SOUND( ENT( pev ), CHAN_VOICE, pAlertSounds[RANDOM_LONG( 0, ARRAYSIZE( pAlertSounds ) - 1 )], 1.0f, ATTN_NORM );
EMIT_SOUND( ENT( pev ), CHAN_VOICE, RANDOM_SOUND_ARRAY( pAlertSounds ), 1.0f, ATTN_NORM );
}
//=========================================================
@ -357,7 +357,7 @@ void CAGrunt::AttackSound( void ) @@ -357,7 +357,7 @@ void CAGrunt::AttackSound( void )
{
StopTalking();
EMIT_SOUND( ENT( pev ), CHAN_VOICE, pAttackSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackSounds ) - 1 )], 1.0f, ATTN_NORM );
EMIT_SOUND( ENT( pev ), CHAN_VOICE, RANDOM_SOUND_ARRAY( pAttackSounds ), 1.0f, ATTN_NORM );
}
//=========================================================
@ -374,7 +374,7 @@ void CAGrunt::PainSound( void ) @@ -374,7 +374,7 @@ void CAGrunt::PainSound( void )
StopTalking();
EMIT_SOUND( ENT( pev ), CHAN_VOICE, pPainSounds[RANDOM_LONG( 0, ARRAYSIZE( pPainSounds ) - 1 )], 1.0f, ATTN_NORM );
EMIT_SOUND( ENT( pev ), CHAN_VOICE, RANDOM_SOUND_ARRAY( pPainSounds ), 1.0f, ATTN_NORM );
}
//=========================================================
@ -530,7 +530,7 @@ void CAGrunt::HandleAnimEvent( MonsterEvent_t *pEvent ) @@ -530,7 +530,7 @@ void CAGrunt::HandleAnimEvent( MonsterEvent_t *pEvent )
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * 250.0f;
}
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0f, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackHitSounds ), 1.0f, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
Vector vecArmPos, vecArmAng;
GetAttachment( 0, vecArmPos, vecArmAng );
@ -539,7 +539,7 @@ void CAGrunt::HandleAnimEvent( MonsterEvent_t *pEvent ) @@ -539,7 +539,7 @@ void CAGrunt::HandleAnimEvent( MonsterEvent_t *pEvent )
else
{
// Play a random attack miss sound
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0f, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackMissSounds ), 1.0f, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
}
}
break;
@ -559,7 +559,7 @@ void CAGrunt::HandleAnimEvent( MonsterEvent_t *pEvent ) @@ -559,7 +559,7 @@ void CAGrunt::HandleAnimEvent( MonsterEvent_t *pEvent )
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * -250.0f;
}
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0f, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackHitSounds ), 1.0f, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
Vector vecArmPos, vecArmAng;
GetAttachment( 0, vecArmPos, vecArmAng );
@ -568,7 +568,7 @@ void CAGrunt::HandleAnimEvent( MonsterEvent_t *pEvent ) @@ -568,7 +568,7 @@ void CAGrunt::HandleAnimEvent( MonsterEvent_t *pEvent )
else
{
// Play a random attack miss sound
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0f, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackMissSounds ), 1.0f, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
}
}
break;
@ -610,30 +610,15 @@ void CAGrunt::Spawn() @@ -610,30 +610,15 @@ void CAGrunt::Spawn()
//=========================================================
void CAGrunt::Precache()
{
size_t i;
PRECACHE_MODEL( "models/agrunt.mdl" );
for( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ )
PRECACHE_SOUND( pAttackHitSounds[i] );
for( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ )
PRECACHE_SOUND( pAttackMissSounds[i] );
for( i = 0; i < ARRAYSIZE( pIdleSounds ); i++ )
PRECACHE_SOUND( pIdleSounds[i] );
for( i = 0; i < ARRAYSIZE( pDieSounds ); i++ )
PRECACHE_SOUND( pDieSounds[i] );
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
PRECACHE_SOUND( pPainSounds[i] );
for( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
PRECACHE_SOUND( pAttackSounds[i] );
for( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ )
PRECACHE_SOUND( pAlertSounds[i] );
PRECACHE_SOUND_ARRAY( pAttackHitSounds );
PRECACHE_SOUND_ARRAY( pAttackMissSounds );
PRECACHE_SOUND_ARRAY( pIdleSounds );
PRECACHE_SOUND_ARRAY( pDieSounds );
PRECACHE_SOUND_ARRAY( pPainSounds );
PRECACHE_SOUND_ARRAY( pAttackSounds );
PRECACHE_SOUND_ARRAY( pAlertSounds );
PRECACHE_SOUND( "hassault/hw_shoot1.wav" );

10
dlls/animating.cpp

@ -28,11 +28,11 @@ @@ -28,11 +28,11 @@
TYPEDESCRIPTION CBaseAnimating::m_SaveData[] =
{
DEFINE_FIELD( CBaseMonster, m_flFrameRate, FIELD_FLOAT ),
DEFINE_FIELD( CBaseMonster, m_flGroundSpeed, FIELD_FLOAT ),
DEFINE_FIELD( CBaseMonster, m_flLastEventCheck, FIELD_TIME ),
DEFINE_FIELD( CBaseMonster, m_fSequenceFinished, FIELD_BOOLEAN ),
DEFINE_FIELD( CBaseMonster, m_fSequenceLoops, FIELD_BOOLEAN ),
DEFINE_FIELD( CBaseAnimating, m_flFrameRate, FIELD_FLOAT ),
DEFINE_FIELD( CBaseAnimating, m_flGroundSpeed, FIELD_FLOAT ),
DEFINE_FIELD( CBaseAnimating, m_flLastEventCheck, FIELD_TIME ),
DEFINE_FIELD( CBaseAnimating, m_fSequenceFinished, FIELD_BOOLEAN ),
DEFINE_FIELD( CBaseAnimating, m_fSequenceLoops, FIELD_BOOLEAN ),
};
IMPLEMENT_SAVERESTORE( CBaseAnimating, CBaseDelay )

6
dlls/apache.cpp

@ -697,6 +697,9 @@ void CApache::FireRocket( void ) @@ -697,6 +697,9 @@ void CApache::FireRocket( void )
break;
}
CBaseEntity *pRocket = CBaseEntity::Create( "hvr_rocket", vecSrc, pev->angles, edict() );
if( pRocket )
{
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSrc );
WRITE_BYTE( TE_SMOKE );
WRITE_COORD( vecSrc.x );
@ -707,14 +710,13 @@ void CApache::FireRocket( void ) @@ -707,14 +710,13 @@ void CApache::FireRocket( void )
WRITE_BYTE( 12 ); // framerate
MESSAGE_END();
CBaseEntity *pRocket = CBaseEntity::Create( "hvr_rocket", vecSrc, pev->angles, edict() );
if( pRocket )
pRocket->pev->velocity = pev->velocity + gpGlobals->v_forward * 100.0f;
m_iRockets--;
side = - side;
}
}
BOOL CApache::FireGun()
{

4
dlls/buttons.cpp

@ -57,7 +57,7 @@ TYPEDESCRIPTION CEnvGlobal::m_SaveData[] = @@ -57,7 +57,7 @@ TYPEDESCRIPTION CEnvGlobal::m_SaveData[] =
DEFINE_FIELD( CEnvGlobal, m_initialstate, FIELD_INTEGER ),
};
IMPLEMENT_SAVERESTORE( CEnvGlobal, CBaseEntity )
IMPLEMENT_SAVERESTORE( CEnvGlobal, CPointEntity )
LINK_ENTITY_TO_CLASS( env_global, CEnvGlobal )
@ -130,7 +130,7 @@ TYPEDESCRIPTION CMultiSource::m_SaveData[] = @@ -130,7 +130,7 @@ TYPEDESCRIPTION CMultiSource::m_SaveData[] =
DEFINE_FIELD( CMultiSource, m_globalstate, FIELD_STRING ),
};
IMPLEMENT_SAVERESTORE( CMultiSource, CBaseEntity )
IMPLEMENT_SAVERESTORE( CMultiSource, CPointEntity )
LINK_ENTITY_TO_CLASS( multisource, CMultiSource )

4
dlls/egon.cpp

@ -197,7 +197,7 @@ void CEgon::Attack( void ) @@ -197,7 +197,7 @@ void CEgon::Attack( void )
m_flAmmoUseTime = gpGlobals->time;// start using ammo ASAP.
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usEgonFire, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, m_fireState, m_fireMode, 1, 0 );
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usEgonFire, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, 0, m_fireMode, 1, 0 );
m_shakeTime = 0;
@ -216,7 +216,7 @@ void CEgon::Attack( void ) @@ -216,7 +216,7 @@ void CEgon::Attack( void )
if( pev->fuser1 <= UTIL_WeaponTimeBase() )
{
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usEgonFire, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, m_fireState, m_fireMode, 0, 0 );
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usEgonFire, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, 0, m_fireMode, 0, 0 );
pev->fuser1 = 1000;
}

2
dlls/func_break.cpp

@ -149,7 +149,7 @@ TYPEDESCRIPTION CBreakable::m_SaveData[] = @@ -149,7 +149,7 @@ TYPEDESCRIPTION CBreakable::m_SaveData[] =
// Explosion magnitude is stored in pev->impulse
};
IMPLEMENT_SAVERESTORE( CBreakable, CBaseEntity )
IMPLEMENT_SAVERESTORE( CBreakable, CBaseDelay )
void CBreakable::Spawn( void )
{

59
dlls/gargantua.cpp

@ -473,7 +473,7 @@ void CGargantua::StompAttack( void ) @@ -473,7 +473,7 @@ void CGargantua::StompAttack( void )
UTIL_TraceLine( vecStart, vecEnd, ignore_monsters, edict(), &trace );
CStomp::StompCreate( vecStart, trace.vecEndPos, 0 );
UTIL_ScreenShake( pev->origin, 12.0, 100.0, 2.0, 1000 );
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, pStompSounds[RANDOM_LONG( 0, ARRAYSIZE( pStompSounds ) - 1 )], 1.0, ATTN_GARG, 0, PITCH_NORM + RANDOM_LONG( -10, 10 ) );
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pStompSounds ), 1.0, ATTN_GARG, 0, PITCH_NORM + RANDOM_LONG( -10, 10 ) );
UTIL_TraceLine( pev->origin, pev->origin - Vector(0,0,20), ignore_monsters, edict(), &trace );
if( trace.flFraction < 1.0f )
@ -761,8 +761,6 @@ void CGargantua::Spawn() @@ -761,8 +761,6 @@ void CGargantua::Spawn()
//=========================================================
void CGargantua::Precache()
{
size_t i;
PRECACHE_MODEL( "models/garg.mdl" );
PRECACHE_MODEL( GARG_EYE_SPRITE_NAME );
PRECACHE_MODEL( GARG_BEAM_SPRITE_NAME );
@ -771,38 +769,17 @@ void CGargantua::Precache() @@ -771,38 +769,17 @@ void CGargantua::Precache()
gGargGibModel = PRECACHE_MODEL( GARG_GIB_MODEL );
PRECACHE_SOUND( GARG_STOMP_BUZZ_SOUND );
for( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ )
PRECACHE_SOUND( pAttackHitSounds[i] );
for( i = 0; i < ARRAYSIZE( pBeamAttackSounds ); i++ )
PRECACHE_SOUND( pBeamAttackSounds[i] );
for( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ )
PRECACHE_SOUND( pAttackMissSounds[i] );
for( i = 0; i < ARRAYSIZE( pRicSounds ); i++ )
PRECACHE_SOUND( pRicSounds[i] );
for( i = 0; i < ARRAYSIZE( pFootSounds ); i++ )
PRECACHE_SOUND( pFootSounds[i] );
for( i = 0; i < ARRAYSIZE( pIdleSounds ); i++ )
PRECACHE_SOUND( pIdleSounds[i] );
for( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ )
PRECACHE_SOUND( pAlertSounds[i] );
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
PRECACHE_SOUND( pPainSounds[i] );
for( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
PRECACHE_SOUND( pAttackSounds[i] );
for( i = 0; i < ARRAYSIZE( pStompSounds ); i++ )
PRECACHE_SOUND( pStompSounds[i] );
for( i = 0; i < ARRAYSIZE( pBreatheSounds ); i++ )
PRECACHE_SOUND( pBreatheSounds[i] );
PRECACHE_SOUND_ARRAY( pAttackHitSounds );
PRECACHE_SOUND_ARRAY( pBeamAttackSounds );
PRECACHE_SOUND_ARRAY( pAttackMissSounds );
PRECACHE_SOUND_ARRAY( pRicSounds );
PRECACHE_SOUND_ARRAY( pFootSounds );
PRECACHE_SOUND_ARRAY( pIdleSounds );
PRECACHE_SOUND_ARRAY( pAlertSounds );
PRECACHE_SOUND_ARRAY( pPainSounds );
PRECACHE_SOUND_ARRAY( pAttackSounds );
PRECACHE_SOUND_ARRAY( pStompSounds );
PRECACHE_SOUND_ARRAY( pBreatheSounds );
}
void CGargantua::UpdateOnRemove()
@ -833,7 +810,7 @@ void CGargantua::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vec @@ -833,7 +810,7 @@ void CGargantua::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vec
{
if( m_painSoundTime < gpGlobals->time )
{
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pPainSounds[RANDOM_LONG( 0, ARRAYSIZE( pPainSounds ) - 1 )], 1.0, ATTN_GARG, 0, PITCH_NORM );
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, RANDOM_SOUND_ARRAY( pPainSounds ), 1.0, ATTN_GARG, 0, PITCH_NORM );
m_painSoundTime = gpGlobals->time + RANDOM_FLOAT( 2.5, 4 );
}
}
@ -978,10 +955,10 @@ void CGargantua::HandleAnimEvent( MonsterEvent_t *pEvent ) @@ -978,10 +955,10 @@ void CGargantua::HandleAnimEvent( MonsterEvent_t *pEvent )
//UTIL_MakeVectors( pev->angles ); // called by CheckTraceHullAttack
pHurt->pev->velocity = pHurt->pev->velocity - gpGlobals->v_right * 100;
}
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0, ATTN_NORM, 0, 50 + RANDOM_LONG( 0, 15 ) );
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackHitSounds ), 1.0, ATTN_NORM, 0, 50 + RANDOM_LONG( 0, 15 ) );
}
else // Play a random attack miss sound
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0, ATTN_NORM, 0, 50 + RANDOM_LONG( 0, 15 ) );
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackMissSounds ), 1.0, ATTN_NORM, 0, 50 + RANDOM_LONG( 0, 15 ) );
Vector forward;
UTIL_MakeVectorsPrivate( pev->angles, forward, NULL, NULL );
@ -990,14 +967,14 @@ void CGargantua::HandleAnimEvent( MonsterEvent_t *pEvent ) @@ -990,14 +967,14 @@ void CGargantua::HandleAnimEvent( MonsterEvent_t *pEvent )
case GARG_AE_RIGHT_FOOT:
case GARG_AE_LEFT_FOOT:
UTIL_ScreenShake( pev->origin, 4.0, 3.0, 1.0, 750 );
EMIT_SOUND_DYN( edict(), CHAN_BODY, pFootSounds[RANDOM_LONG( 0, ARRAYSIZE( pFootSounds ) - 1 )], 1.0, ATTN_GARG, 0, PITCH_NORM + RANDOM_LONG( -10, 10 ) );
EMIT_SOUND_DYN( edict(), CHAN_BODY, RANDOM_SOUND_ARRAY( pFootSounds ), 1.0, ATTN_GARG, 0, PITCH_NORM + RANDOM_LONG( -10, 10 ) );
break;
case GARG_AE_STOMP:
StompAttack();
m_seeTime = gpGlobals->time + 12.0f;
break;
case GARG_AE_BREATHE:
EMIT_SOUND_DYN( edict(), CHAN_VOICE, pBreatheSounds[RANDOM_LONG( 0, ARRAYSIZE( pBreatheSounds ) - 1 )], 1.0, ATTN_GARG, 0, PITCH_NORM + RANDOM_LONG( -10, 10 ) );
EMIT_SOUND_DYN( edict(), CHAN_VOICE, RANDOM_SOUND_ARRAY( pBreatheSounds ), 1.0, ATTN_GARG, 0, PITCH_NORM + RANDOM_LONG( -10, 10 ) );
break;
default:
CBaseMonster::HandleAnimEvent( pEvent );
@ -1073,7 +1050,7 @@ void CGargantua::StartTask( Task_t *pTask ) @@ -1073,7 +1050,7 @@ void CGargantua::StartTask( Task_t *pTask )
break;
case TASK_SOUND_ATTACK:
if( RANDOM_LONG( 0, 100 ) < 30 )
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pAttackSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackSounds ) - 1 )], 1.0, ATTN_GARG, 0, PITCH_NORM );
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, RANDOM_SOUND_ARRAY( pAttackSounds ), 1.0, ATTN_GARG, 0, PITCH_NORM );
TaskComplete();
break;
case TASK_DIE:

2
dlls/h_battery.cpp

@ -60,7 +60,7 @@ TYPEDESCRIPTION CRecharge::m_SaveData[] = @@ -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 )

2
dlls/healthkit.cpp

@ -127,7 +127,7 @@ TYPEDESCRIPTION CWallHealth::m_SaveData[] = @@ -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 )

4
dlls/hornetgun.cpp

@ -150,7 +150,7 @@ void CHgun::PrimaryAttack() @@ -150,7 +150,7 @@ void CHgun::PrimaryAttack()
#else
flags = 0;
#endif
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usHornetFire, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, FIREMODE_TRACK, 0, 0, 0 );
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usHornetFire, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, 0, 0, 0, 0 );
// player "shoot" animation
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
@ -231,7 +231,7 @@ void CHgun::SecondaryAttack( void ) @@ -231,7 +231,7 @@ void CHgun::SecondaryAttack( void )
#else
flags = 0;
#endif
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usHornetFire, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, FIREMODE_FAST, 0, 0, 0 );
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usHornetFire, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, 0, 0, 0, 0 );
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;

29
dlls/islave.cpp

@ -237,7 +237,7 @@ void CISlave::PainSound( void ) @@ -237,7 +237,7 @@ void CISlave::PainSound( void )
{
if( RANDOM_LONG( 0, 2 ) == 0 )
{
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pPainSounds[RANDOM_LONG( 0, ARRAYSIZE( pPainSounds ) - 1 )], 1.0, ATTN_NORM, 0, m_voicePitch );
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pPainSounds ), 1.0, ATTN_NORM, 0, m_voicePitch );
}
}
@ -246,7 +246,7 @@ void CISlave::PainSound( void ) @@ -246,7 +246,7 @@ void CISlave::PainSound( void )
//=========================================================
void CISlave::DeathSound( void )
{
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pDeathSounds[RANDOM_LONG( 0, ARRAYSIZE( pDeathSounds ) - 1 )], 1.0, ATTN_NORM, 0, m_voicePitch );
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pDeathSounds ), 1.0, ATTN_NORM, 0, m_voicePitch );
}
//=========================================================
@ -317,12 +317,12 @@ void CISlave::HandleAnimEvent( MonsterEvent_t *pEvent ) @@ -317,12 +317,12 @@ void CISlave::HandleAnimEvent( MonsterEvent_t *pEvent )
pHurt->pev->punchangle.x = 5;
}
// Play a random attack hit sound
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0, ATTN_NORM, 0, m_voicePitch );
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackHitSounds ), 1.0, ATTN_NORM, 0, m_voicePitch );
}
else
{
// Play a random attack miss sound
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0, ATTN_NORM, 0, m_voicePitch );
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackMissSounds ), 1.0, ATTN_NORM, 0, m_voicePitch );
}
}
break;
@ -336,11 +336,11 @@ void CISlave::HandleAnimEvent( MonsterEvent_t *pEvent ) @@ -336,11 +336,11 @@ void CISlave::HandleAnimEvent( MonsterEvent_t *pEvent )
pHurt->pev->punchangle.z = -18;
pHurt->pev->punchangle.x = 5;
}
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0, ATTN_NORM, 0, m_voicePitch );
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackHitSounds ), 1.0, ATTN_NORM, 0, m_voicePitch );
}
else
{
EMIT_SOUND_DYN( ENT(pev), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0, ATTN_NORM, 0, m_voicePitch );
EMIT_SOUND_DYN( ENT(pev), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackMissSounds ), 1.0, ATTN_NORM, 0, m_voicePitch );
}
}
break;
@ -533,8 +533,6 @@ void CISlave::Spawn() @@ -533,8 +533,6 @@ void CISlave::Spawn()
//=========================================================
void CISlave::Precache()
{
size_t i;
PRECACHE_MODEL( "models/islave.mdl" );
PRECACHE_MODEL( "sprites/lgtning.spr" );
PRECACHE_SOUND( "debris/zap1.wav" );
@ -545,17 +543,10 @@ void CISlave::Precache() @@ -545,17 +543,10 @@ void CISlave::Precache()
PRECACHE_SOUND( "headcrab/hc_headbite.wav" );
PRECACHE_SOUND( "weapons/cbar_miss1.wav" );
for( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ )
PRECACHE_SOUND( pAttackHitSounds[i] );
for( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ )
PRECACHE_SOUND( pAttackMissSounds[i] );
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
PRECACHE_SOUND( pPainSounds[i] );
for( i = 0; i < ARRAYSIZE( pDeathSounds ); i++ )
PRECACHE_SOUND( pDeathSounds[i] );
PRECACHE_SOUND_ARRAY( pAttackHitSounds );
PRECACHE_SOUND_ARRAY( pAttackMissSounds );
PRECACHE_SOUND_ARRAY( pPainSounds );
PRECACHE_SOUND_ARRAY( pDeathSounds );
UTIL_PrecacheOther( "test_effect" );
}

12
dlls/leech.cpp

@ -261,27 +261,23 @@ void CLeech::AttackSound( void ) @@ -261,27 +261,23 @@ void CLeech::AttackSound( void )
{
if( gpGlobals->time > m_attackSoundTime )
{
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pAttackSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackSounds ) - 1 )], 1.0f, ATTN_NORM, 0, PITCH_NORM );
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, RANDOM_SOUND_ARRAY( pAttackSounds ), 1.0f, ATTN_NORM, 0, PITCH_NORM );
m_attackSoundTime = gpGlobals->time + 0.5f;
}
}
void CLeech::AlertSound( void )
{
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pAlertSounds[RANDOM_LONG( 0, ARRAYSIZE( pAlertSounds ) - 1 )], 1.0f, ATTN_NORM * 0.5f, 0, PITCH_NORM );
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, RANDOM_SOUND_ARRAY( pAlertSounds ), 1.0f, ATTN_NORM * 0.5f, 0, PITCH_NORM );
}
void CLeech::Precache( void )
{
size_t i;
//PRECACHE_MODEL( "models/icky.mdl" );
PRECACHE_MODEL( "models/leech.mdl" );
for( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
PRECACHE_SOUND( pAttackSounds[i] );
for( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ )
PRECACHE_SOUND( pAlertSounds[i] );
PRECACHE_SOUND_ARRAY( pAttackSounds );
PRECACHE_SOUND_ARRAY( pAlertSounds );
}
int CLeech::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )

2
dlls/pathcorner.cpp

@ -125,7 +125,7 @@ TYPEDESCRIPTION CPathTrack::m_SaveData[] = @@ -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 )
//

2
dlls/sound.cpp

@ -825,7 +825,7 @@ TYPEDESCRIPTION CEnvSound::m_SaveData[] = @@ -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 )
{

1
dlls/talkmonster.cpp

@ -851,6 +851,7 @@ void CTalkMonster::Touch( CBaseEntity *pOther ) @@ -851,6 +851,7 @@ void CTalkMonster::Touch( CBaseEntity *pOther )
if( speed > 50.0f )
{
SetConditions( bits_COND_CLIENT_PUSH );
if ( m_MonsterState != MONSTERSTATE_SCRIPT )
MakeIdealYaw( pOther->pev->origin );
}
}

2
dlls/weapons.cpp

@ -1632,7 +1632,6 @@ TYPEDESCRIPTION CShotgun::m_SaveData[] = @@ -1632,7 +1632,6 @@ TYPEDESCRIPTION CShotgun::m_SaveData[] =
{
DEFINE_FIELD( CShotgun, m_flNextReload, FIELD_TIME ),
DEFINE_FIELD( CShotgun, m_fInSpecialReload, FIELD_INTEGER ),
DEFINE_FIELD( CShotgun, m_flNextReload, FIELD_TIME ),
// DEFINE_FIELD( CShotgun, m_iShell, FIELD_INTEGER ),
DEFINE_FIELD( CShotgun, m_flPumpTime, FIELD_TIME ),
};
@ -1667,6 +1666,7 @@ IMPLEMENT_SAVERESTORE( CEgon, CBasePlayerWeapon ) @@ -1667,6 +1666,7 @@ IMPLEMENT_SAVERESTORE( CEgon, CBasePlayerWeapon )
TYPEDESCRIPTION CHgun::m_SaveData[] =
{
DEFINE_FIELD( CHgun, m_flRechargeTime, FIELD_TIME ),
DEFINE_FIELD( CHgun, m_iFirePhase, FIELD_INTEGER ),
};
IMPLEMENT_SAVERESTORE( CHgun, CBasePlayerWeapon )

2
dlls/weapons.h

@ -922,7 +922,7 @@ public: @@ -922,7 +922,7 @@ public:
float m_flRechargeTime;
int m_iFirePhase;// don't save me.
int m_iFirePhase;
virtual BOOL UseDecrement( void )
{

45
dlls/zombie.cpp

@ -125,14 +125,14 @@ void CZombie::PainSound( void ) @@ -125,14 +125,14 @@ void CZombie::PainSound( void )
int pitch = 95 + RANDOM_LONG( 0, 9 );
if( RANDOM_LONG( 0, 5 ) < 2 )
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pPainSounds[RANDOM_LONG( 0, ARRAYSIZE( pPainSounds ) - 1 )], 1.0, ATTN_NORM, 0, pitch );
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, RANDOM_SOUND_ARRAY( pPainSounds ), 1.0, ATTN_NORM, 0, pitch );
}
void CZombie::AlertSound( void )
{
int pitch = 95 + RANDOM_LONG( 0, 9 );
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pAlertSounds[ RANDOM_LONG( 0, ARRAYSIZE( pAlertSounds ) - 1 )], 1.0, ATTN_NORM, 0, pitch );
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, RANDOM_SOUND_ARRAY( pAlertSounds ), 1.0, ATTN_NORM, 0, pitch );
}
void CZombie::IdleSound( void )
@ -140,7 +140,7 @@ void CZombie::IdleSound( void ) @@ -140,7 +140,7 @@ void CZombie::IdleSound( void )
int pitch = 95 + RANDOM_LONG( 0, 9 );
// Play a random idle sound
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pIdleSounds[RANDOM_LONG( 0, ARRAYSIZE( pIdleSounds ) -1 )], 1.0, ATTN_NORM, 0, pitch );
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, RANDOM_SOUND_ARRAY( pIdleSounds ), 1.0, ATTN_NORM, 0, pitch );
}
void CZombie::AttackSound( void )
@ -148,7 +148,7 @@ void CZombie::AttackSound( void ) @@ -148,7 +148,7 @@ void CZombie::AttackSound( void )
int pitch = 95 + RANDOM_LONG( 0, 9 );
// Play a random attack sound
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pAttackSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackSounds ) - 1 )], 1.0, ATTN_NORM, 0, pitch );
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, RANDOM_SOUND_ARRAY( pAttackSounds ), 1.0, ATTN_NORM, 0, pitch );
}
//=========================================================
@ -173,10 +173,10 @@ void CZombie::HandleAnimEvent( MonsterEvent_t *pEvent ) @@ -173,10 +173,10 @@ void CZombie::HandleAnimEvent( MonsterEvent_t *pEvent )
pHurt->pev->velocity = pHurt->pev->velocity - gpGlobals->v_right * 100;
}
// Play a random attack hit sound
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5 , 5 ) );
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackHitSounds ), 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5 , 5 ) );
}
else // Play a random attack miss sound
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackMissSounds ), 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
if( RANDOM_LONG( 0, 1 ) )
AttackSound();
@ -195,10 +195,10 @@ void CZombie::HandleAnimEvent( MonsterEvent_t *pEvent ) @@ -195,10 +195,10 @@ void CZombie::HandleAnimEvent( MonsterEvent_t *pEvent )
pHurt->pev->punchangle.x = 5;
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * 100;
}
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackHitSounds ), 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
}
else
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackMissSounds ), 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
if( RANDOM_LONG( 0, 1 ) )
AttackSound();
@ -215,10 +215,10 @@ void CZombie::HandleAnimEvent( MonsterEvent_t *pEvent ) @@ -215,10 +215,10 @@ void CZombie::HandleAnimEvent( MonsterEvent_t *pEvent )
pHurt->pev->punchangle.x = 5;
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_forward * -100;
}
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackHitSounds ), 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
}
else
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackMissSounds ), 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
if( RANDOM_LONG( 0, 1 ) )
AttackSound();
@ -257,27 +257,14 @@ void CZombie::Spawn() @@ -257,27 +257,14 @@ void CZombie::Spawn()
//=========================================================
void CZombie::Precache()
{
size_t i;
PRECACHE_MODEL( "models/zombie.mdl" );
for( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ )
PRECACHE_SOUND( pAttackHitSounds[i] );
for( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ )
PRECACHE_SOUND( pAttackMissSounds[i] );
for( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
PRECACHE_SOUND( pAttackSounds[i] );
for( i = 0; i < ARRAYSIZE( pIdleSounds ); i++ )
PRECACHE_SOUND( pIdleSounds[i] );
for( i = 0; i < ARRAYSIZE( pAlertSounds ); i++ )
PRECACHE_SOUND( pAlertSounds[i] );
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
PRECACHE_SOUND( pPainSounds[i] );
PRECACHE_SOUND_ARRAY( pAttackHitSounds );
PRECACHE_SOUND_ARRAY( pAttackMissSounds );
PRECACHE_SOUND_ARRAY( pAttackSounds );
PRECACHE_SOUND_ARRAY( pIdleSounds );
PRECACHE_SOUND_ARRAY( pAlertSounds );
PRECACHE_SOUND_ARRAY( pPainSounds );
}
//=========================================================

3
engine/cdll_int.h

@ -303,6 +303,9 @@ typedef struct cl_enginefuncs_s @@ -303,6 +303,9 @@ typedef struct cl_enginefuncs_s
int (*pfnGetAppID)( void );
cmdalias_t *(*pfnGetAliases)( void );
void (*pfnVguiWrap2_GetMouseDelta)( int *x, int *y );
// added in 2019 update, not documented yet
int (*pfnFilteredClientCmd)( const char *cmd );
} cl_enginefunc_t;
#define CLDLL_INTERFACE_VERSION 7

621
engine/engine.dsp

@ -1,621 +0,0 @@ @@ -1,621 +0,0 @@
# Microsoft Developer Studio Project File - Name="engine" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=engine - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "engine.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "engine.mak" CFG="engine - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "engine - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "engine - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "engine - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\Release"
# PROP BASE Intermediate_Dir ".\Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\temp\engine\!release"
# PROP Intermediate_Dir "..\temp\engine\!release"
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "common" /I "common/imagelib" /I "common/soundlib" /I "server" /I "client" /I "client/vgui" /I "../common" /I "../game_shared" /I "../pm_shared" /I "../utils/vgui/include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /Fr /YX
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /opt:nowin98
# ADD LINK32 msvcrt.lib user32.lib gdi32.lib shell32.lib advapi32.lib winmm.lib mpeg.lib ../utils/vgui/lib/win32_vc6/vgui.lib /nologo /subsystem:windows /dll /pdb:none /machine:I386 /nodefaultlib:"libc" /out:"..\temp\engine\!release/xash.dll" /libpath:"./common/soundlib" /opt:nowin98
# SUBTRACT LINK32 /debug /nodefaultlib
# Begin Custom Build
TargetDir=\Xash3D\src_main\temp\engine\!release
InputPath=\Xash3D\src_main\temp\engine\!release\xash.dll
SOURCE="$(InputPath)"
"D:\Xash3D\xash.dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(TargetDir)\xash.dll "D:\Xash3D\xash.dll"
# End Custom Build
!ELSEIF "$(CFG)" == "engine - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\Debug"
# PROP BASE Intermediate_Dir ".\Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\temp\engine\!debug"
# PROP Intermediate_Dir "..\temp\engine\!debug"
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "common" /I "common/imagelib" /I "common/soundlib" /I "server" /I "client" /I "client/vgui" /I "../common" /I "../game_shared" /I "../pm_shared" /I "../utils/vgui/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FAs /FR /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386
# ADD LINK32 msvcrtd.lib user32.lib gdi32.lib shell32.lib advapi32.lib winmm.lib mpeg_dbg.lib ../utils/vgui/lib/win32_vc6/vgui.lib /nologo /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libcd.lib" /out:"..\temp\engine\!debug/xash.dll" /pdbtype:sept /libpath:"./common/soundlib"
# SUBTRACT LINK32 /incremental:no /map /nodefaultlib
# Begin Custom Build
TargetDir=\Xash3D\src_main\temp\engine\!debug
InputPath=\Xash3D\src_main\temp\engine\!debug\xash.dll
SOURCE="$(InputPath)"
"D:\Xash3D\xash.dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(TargetDir)\xash.dll "D:\Xash3D\xash.dll"
# End Custom Build
!ENDIF
# Begin Target
# Name "engine - Win32 Release"
# Name "engine - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
# Begin Source File
SOURCE=.\common\avikit.c
# End Source File
# Begin Source File
SOURCE=.\common\build.c
# End Source File
# Begin Source File
SOURCE=.\client\cl_cmds.c
# End Source File
# Begin Source File
SOURCE=.\client\cl_demo.c
# End Source File
# Begin Source File
SOURCE=.\client\cl_events.c
# End Source File
# Begin Source File
SOURCE=.\client\cl_frame.c
# End Source File
# Begin Source File
SOURCE=.\client\cl_game.c
# End Source File
# Begin Source File
SOURCE=.\client\cl_main.c
# End Source File
# Begin Source File
SOURCE=.\client\cl_menu.c
# End Source File
# Begin Source File
SOURCE=.\client\cl_parse.c
# End Source File
# Begin Source File
SOURCE=.\client\cl_pmove.c
# End Source File
# Begin Source File
SOURCE=.\client\cl_remap.c
# End Source File
# Begin Source File
SOURCE=.\client\cl_scrn.c
# End Source File
# Begin Source File
SOURCE=.\client\cl_tent.c
# End Source File
# Begin Source File
SOURCE=.\client\cl_video.c
# End Source File
# Begin Source File
SOURCE=.\client\cl_view.c
# End Source File
# Begin Source File
SOURCE=.\common\cmd.c
# End Source File
# Begin Source File
SOURCE=.\common\common.c
# End Source File
# Begin Source File
SOURCE=.\common\con_utils.c
# End Source File
# Begin Source File
SOURCE=.\common\console.c
# End Source File
# Begin Source File
SOURCE=.\common\crclib.c
# End Source File
# Begin Source File
SOURCE=.\common\crtlib.c
# End Source File
# Begin Source File
SOURCE=.\common\cvar.c
# End Source File
# Begin Source File
SOURCE=.\common\filesystem.c
# End Source File
# Begin Source File
SOURCE=.\common\gamma.c
# End Source File
# Begin Source File
SOURCE=.\client\gl_backend.c
# End Source File
# Begin Source File
SOURCE=.\client\gl_beams.c
# End Source File
# Begin Source File
SOURCE=.\client\gl_cull.c
# End Source File
# Begin Source File
SOURCE=.\client\gl_decals.c
# End Source File
# Begin Source File
SOURCE=.\client\gl_draw.c
# End Source File
# Begin Source File
SOURCE=.\client\gl_image.c
# End Source File
# Begin Source File
SOURCE=.\client\gl_mirror.c
# End Source File
# Begin Source File
SOURCE=.\client\gl_refrag.c
# End Source File
# Begin Source File
SOURCE=.\client\gl_rlight.c
# End Source File
# Begin Source File
SOURCE=.\client\gl_rmain.c
# End Source File
# Begin Source File
SOURCE=.\client\gl_rmath.c
# End Source File
# Begin Source File
SOURCE=.\client\gl_rmisc.c
# End Source File
# Begin Source File
SOURCE=.\client\gl_rpart.c
# End Source File
# Begin Source File
SOURCE=.\client\gl_rsurf.c
# End Source File
# Begin Source File
SOURCE=.\client\gl_sprite.c
# End Source File
# Begin Source File
SOURCE=.\client\gl_studio.c
# End Source File
# Begin Source File
SOURCE=.\client\gl_vidnt.c
# End Source File
# Begin Source File
SOURCE=.\client\gl_warp.c
# End Source File
# Begin Source File
SOURCE=.\common\host.c
# End Source File
# Begin Source File
SOURCE=.\common\hpak.c
# End Source File
# Begin Source File
SOURCE=.\common\imagelib\img_bmp.c
# End Source File
# Begin Source File
SOURCE=.\common\imagelib\img_dds.c
# End Source File
# Begin Source File
SOURCE=.\common\imagelib\img_main.c
# End Source File
# Begin Source File
SOURCE=.\common\imagelib\img_quant.c
# End Source File
# Begin Source File
SOURCE=.\common\imagelib\img_tga.c
# End Source File
# Begin Source File
SOURCE=.\common\imagelib\img_utils.c
# End Source File
# Begin Source File
SOURCE=.\common\imagelib\img_wad.c
# End Source File
# Begin Source File
SOURCE=.\common\infostring.c
# End Source File
# Begin Source File
SOURCE=.\common\input.c
# End Source File
# Begin Source File
SOURCE=.\common\keys.c
# End Source File
# Begin Source File
SOURCE=.\common\library.c
# End Source File
# Begin Source File
SOURCE=.\common\mathlib.c
# End Source File
# Begin Source File
SOURCE=.\common\matrixlib.c
# End Source File
# Begin Source File
SOURCE=.\common\mod_studio.c
# End Source File
# Begin Source File
SOURCE=.\common\model.c
# End Source File
# Begin Source File
SOURCE=.\common\net_buffer.c
# End Source File
# Begin Source File
SOURCE=.\common\net_chan.c
# End Source File
# Begin Source File
SOURCE=.\common\net_encode.c
# End Source File
# Begin Source File
SOURCE=.\common\net_huff.c
# End Source File
# Begin Source File
SOURCE=.\common\network.c
# End Source File
# Begin Source File
SOURCE=.\common\pm_surface.c
# End Source File
# Begin Source File
SOURCE=.\common\pm_trace.c
# End Source File
# Begin Source File
SOURCE=.\common\random.c
# End Source File
# Begin Source File
SOURCE=.\client\s_backend.c
# End Source File
# Begin Source File
SOURCE=.\client\s_dsp.c
# End Source File
# Begin Source File
SOURCE=.\client\s_load.c
# End Source File
# Begin Source File
SOURCE=.\client\s_main.c
# End Source File
# Begin Source File
SOURCE=.\client\s_mix.c
# End Source File
# Begin Source File
SOURCE=.\client\s_mouth.c
# End Source File
# Begin Source File
SOURCE=.\client\s_stream.c
# End Source File
# Begin Source File
SOURCE=.\client\s_utils.c
# End Source File
# Begin Source File
SOURCE=.\client\s_vox.c
# End Source File
# Begin Source File
SOURCE=.\common\soundlib\snd_main.c
# End Source File
# Begin Source File
SOURCE=.\common\soundlib\snd_mp3.c
# End Source File
# Begin Source File
SOURCE=.\common\soundlib\snd_utils.c
# End Source File
# Begin Source File
SOURCE=.\common\soundlib\snd_wav.c
# End Source File
# Begin Source File
SOURCE=.\server\sv_client.c
# End Source File
# Begin Source File
SOURCE=.\server\sv_cmds.c
# End Source File
# Begin Source File
SOURCE=.\server\sv_custom.c
# End Source File
# Begin Source File
SOURCE=.\server\sv_frame.c
# End Source File
# Begin Source File
SOURCE=.\server\sv_game.c
# End Source File
# Begin Source File
SOURCE=.\server\sv_init.c
# End Source File
# Begin Source File
SOURCE=.\server\sv_main.c
# End Source File
# Begin Source File
SOURCE=.\server\sv_move.c
# End Source File
# Begin Source File
SOURCE=.\server\sv_phys.c
# End Source File
# Begin Source File
SOURCE=.\server\sv_pmove.c
# End Source File
# Begin Source File
SOURCE=.\server\sv_save.c
# End Source File
# Begin Source File
SOURCE=.\server\sv_world.c
# End Source File
# Begin Source File
SOURCE=.\common\sys_con.c
# End Source File
# Begin Source File
SOURCE=.\common\sys_win.c
# End Source File
# Begin Source File
SOURCE=.\common\titles.c
# End Source File
# Begin Source File
SOURCE=.\client\vgui\vgui_clip.cpp
# End Source File
# Begin Source File
SOURCE=.\client\vgui\vgui_draw.c
# End Source File
# Begin Source File
SOURCE=.\client\vgui\vgui_font.cpp
# End Source File
# Begin Source File
SOURCE=.\client\vgui\vgui_input.cpp
# End Source File
# Begin Source File
SOURCE=.\client\vgui\vgui_int.cpp
# End Source File
# Begin Source File
SOURCE=.\client\vgui\vgui_surf.cpp
# End Source File
# Begin Source File
SOURCE=.\common\world.c
# End Source File
# Begin Source File
SOURCE=.\common\zone.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# Begin Source File
SOURCE=.\client\cl_tent.h
# End Source File
# Begin Source File
SOURCE=.\client\client.h
# End Source File
# Begin Source File
SOURCE=.\common\common.h
# End Source File
# Begin Source File
SOURCE=.\common\crtlib.h
# End Source File
# Begin Source File
SOURCE=.\common\filesystem.h
# End Source File
# Begin Source File
SOURCE=.\client\gl_export.h
# End Source File
# Begin Source File
SOURCE=.\client\gl_local.h
# End Source File
# Begin Source File
SOURCE=.\common\imagelib\imagelib.h
# End Source File
# Begin Source File
SOURCE=.\common\library.h
# End Source File
# Begin Source File
SOURCE=.\common\mathlib.h
# End Source File
# Begin Source File
SOURCE=.\common\mod_local.h
# End Source File
# Begin Source File
SOURCE=.\common\net_buffer.h
# End Source File
# Begin Source File
SOURCE=.\common\net_encode.h
# End Source File
# Begin Source File
SOURCE=.\common\protocol.h
# End Source File
# Begin Source File
SOURCE=.\server\server.h
# End Source File
# Begin Source File
SOURCE=.\client\sound.h
# End Source File
# Begin Source File
SOURCE=.\common\soundlib\soundlib.h
# End Source File
# Begin Source File
SOURCE=.\client\vgui\vgui_draw.h
# End Source File
# Begin Source File
SOURCE=.\client\vgui\vgui_main.h
# End Source File
# Begin Source File
SOURCE=.\client\vox.h
# End Source File
# Begin Source File
SOURCE=.\common\world.h
# End Source File
# End Group
# End Target
# End Project

6
public/build.h

@ -65,6 +65,7 @@ For more information, please refer to <http://unlicense.org/> @@ -65,6 +65,7 @@ For more information, please refer to <http://unlicense.org/>
#undef XASH_LITTLE_ENDIAN
#undef XASH_MINGW
#undef XASH_MIPS
#undef XASH_PPC
#undef XASH_MOBILE_PLATFORM
#undef XASH_MSVC
#undef XASH_NETBSD
@ -212,6 +213,11 @@ For more information, please refer to <http://unlicense.org/> @@ -212,6 +213,11 @@ For more information, please refer to <http://unlicense.org/>
#endif // __SOFTFP__
#elif defined __mips__
#define XASH_MIPS 1
#elif defined __powerpc__
#define XASH_PPC 1
#if defined __powerpc64__
#define XASH_64BIT 1
#endif
#elif defined __EMSCRIPTEN__
#define XASH_JS 1
#elif defined __e2k__

167
scripts/waifulib/compiler_optimizations.py

@ -0,0 +1,167 @@ @@ -0,0 +1,167 @@
# encoding: utf-8
# compiler_optimizations.py -- main entry point for configuring C/C++ compilers
# Copyright (C) 2021 a1batross
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
try: from fwgslib import get_flags_by_type, get_flags_by_compiler
except: from waflib.extras.fwgslib import get_flags_by_type, get_flags_by_compiler
from waflib.Configure import conf
from waflib import Logs
'''
Flags can be overriden and new types can be added
by importing this as normal Python module
Example:
#!/usr/bin/env python
from waflib.extras import compiler_optimizations
compiler_optimizations.VALID_BUILD_TYPES += 'gottagofast'
compiler_optimizations.CFLAGS['gottagofast'] = {
'gcc': ['-Ogentoo']
}
'''
VALID_BUILD_TYPES = ['fastnative', 'fast', 'release', 'debug', 'nooptimize', 'sanitize', 'none']
LINKFLAGS = {
'common': {
'msvc': ['/DEBUG'], # always create PDB, doesn't affect result binaries
'gcc': ['-Wl,--no-undefined'],
'owcc': ['-Wl,option stack=512k']
},
'sanitize': {
'clang': ['-fsanitize=undefined', '-fsanitize=address', '-pthread'],
'gcc': ['-fsanitize=undefined', '-fsanitize=address', '-pthread'],
},
'debug': {
'msvc': ['/INCREMENTAL', '/SAFESEH:NO']
}
}
CFLAGS = {
'common': {
# disable thread-safe local static initialization for C++11 code, as it cause crashes on Windows XP
'msvc': ['/D_USING_V110_SDK71_', '/FS', '/Zc:threadSafeInit-', '/MT'],
'clang': ['-g', '-gdwarf-2', '-fvisibility=hidden', '-fno-threadsafe-statics'],
'gcc': ['-g', '-fvisibility=hidden'],
'owcc': ['-fno-short-enum', '-ffloat-store', '-g3']
},
'fast': {
'msvc': ['/O2', '/Oy', '/Zi'],
'gcc': {
'3': ['-O3', '-fomit-frame-pointer'],
'default': ['-Ofast', '-funsafe-math-optimizations', '-funsafe-loop-optimizations', '-fomit-frame-pointer']
},
'clang': ['-Ofast'],
'default': ['-O3']
},
'fastnative': {
'msvc': ['/O2', '/Oy', '/Zi'],
'gcc': ['-Ofast', '-march=native', '-funsafe-math-optimizations', '-funsafe-loop-optimizations', '-fomit-frame-pointer'],
'clang': ['-Ofast', '-march=native'],
'default': ['-O3']
},
'release': {
'msvc': ['/O2', '/Zi'],
'owcc': ['-O3', '-foptimize-sibling-calls', '-fomit-leaf-frame-pointer', '-fomit-frame-pointer', '-fschedule-insns', '-funsafe-math-optimizations', '-funroll-loops', '-frerun-optimizer', '-finline-functions', '-finline-limit=512', '-fguess-branch-probability', '-fno-strict-aliasing', '-floop-optimize'],
'default': ['-O3']
},
'debug': {
'msvc': ['/Od', '/ZI'],
'owcc': ['-O0', '-fno-omit-frame-pointer', '-funwind-tables', '-fno-omit-leaf-frame-pointer'],
'default': ['-O0']
},
'sanitize': {
'msvc': ['/Od', '/RTC1', '/Zi'],
'gcc': ['-Og', '-fsanitize=undefined', '-fsanitize=address', '-pthread'],
'clang': ['-O0', '-fsanitize=undefined', '-fsanitize=address', '-pthread'],
'default': ['-O0']
},
'nooptimize': {
'msvc': ['/Od', '/Zi'],
'default': ['-O0']
}
}
LTO_CFLAGS = {
'msvc': ['/GL'],
'gcc': ['-flto'],
'clang': ['-flto']
}
LTO_LINKFLAGS = {
'msvc': ['/LTCG'],
'gcc': ['-flto'],
'clang': ['-flto']
}
POLLY_CFLAGS = {
'gcc': ['-fgraphite-identity'],
'clang': ['-mllvm', '-polly']
# msvc sosat :(
}
def options(opt):
grp = opt.add_option_group('Compiler optimization options')
grp.add_option('-T', '--build-type', action='store', dest='BUILD_TYPE', default=None,
help = 'build type: debug, release or none(custom flags)')
grp.add_option('--enable-lto', action = 'store_true', dest = 'LTO', default = False,
help = 'enable Link Time Optimization if possible [default: %default]')
grp.add_option('--enable-poly-opt', action = 'store_true', dest = 'POLLY', default = False,
help = 'enable polyhedral optimization if possible [default: %default]')
def configure(conf):
conf.start_msg('Build type')
if conf.options.BUILD_TYPE == None:
conf.end_msg('not set', color='RED')
conf.fatal('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' % ', '.join(VALID_BUILD_TYPES))
conf.end_msg(conf.options.BUILD_TYPE)
conf.msg('LTO build', 'yes' if conf.options.LTO else 'no')
conf.msg('PolyOpt build', 'yes' if conf.options.POLLY else 'no')
# -march=native should not be used
if conf.options.BUILD_TYPE.startswith('fast'):
Logs.warn('WARNING: \'%s\' build type should not be used in release builds', conf.options.BUILD_TYPE)
try:
conf.env.CC_VERSION[0]
except IndexError:
conf.env.CC_VERSION = (0,)
@conf
def get_optimization_flags(conf):
'''Returns a list of compile flags,
depending on build type and options set by user
NOTE: it doesn't filter out unsupported flags
:returns: tuple of cflags and linkflags
'''
linkflags = conf.get_flags_by_type(LINKFLAGS, conf.options.BUILD_TYPE, conf.env.COMPILER_CC, conf.env.CC_VERSION[0])
cflags = conf.get_flags_by_type(CFLAGS, conf.options.BUILD_TYPE, conf.env.COMPILER_CC, conf.env.CC_VERSION[0])
if conf.options.LTO:
linkflags+= conf.get_flags_by_compiler(LTO_LINKFLAGS, conf.env.COMPILER_CC)
cflags += conf.get_flags_by_compiler(LTO_CFLAGS, conf.env.COMPILER_CC)
if conf.options.POLLY:
cflags += conf.get_flags_by_compiler(POLLY_CFLAGS, conf.env.COMPILER_CC)
return cflags, linkflags

7
scripts/waifulib/library_naming.py

@ -47,6 +47,7 @@ DEFINES = [ @@ -47,6 +47,7 @@ DEFINES = [
'XASH_LITTLE_ENDIAN',
'XASH_MINGW',
'XASH_MIPS',
'XASH_PPC',
'XASH_MOBILE_PLATFORM',
'XASH_MSVC',
'XASH_NETBSD',
@ -123,6 +124,12 @@ def configure(conf): @@ -123,6 +124,12 @@ def configure(conf):
buildarch += "64"
if conf.env.XASH_LITTLE_ENDIAN:
buildarch += "el"
elif conf.env.XASH_PPC:
buildarch = "powerpc"
if conf.env.XASH_64BIT:
buildarch += "64"
if conf.env.XASH_LITTLE_ENDIAN:
buildarch += "le"
elif conf.env.XASH_RISCV:
buildarch = "riscv"
if conf.env.XASH_64BIT:

64
scripts/waifulib/xcompile.py

@ -20,12 +20,14 @@ import os @@ -20,12 +20,14 @@ import os
import sys
ANDROID_NDK_ENVVARS = ['ANDROID_NDK_HOME', 'ANDROID_NDK']
ANDROID_NDK_SUPPORTED = [10, 19, 20]
ANDROID_NDK_SUPPORTED = [10, 19, 20, 23]
ANDROID_NDK_HARDFP_MAX = 11 # latest version that supports hardfp
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 } # minimal API level ndk revision supports
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
@ -196,6 +198,8 @@ class Android: @@ -196,6 +198,8 @@ class Android:
return os.path.join(self.gen_gcc_toolchain_path(), 'bin', triplet)
def gen_binutils_path(self):
if self.ndk_rev >= 23:
return os.path.join(self.gen_gcc_toolchain_path(), 'bin')
return os.path.join(self.gen_gcc_toolchain_path(), self.ndk_triplet(), 'bin')
def cc(self):
@ -227,6 +231,9 @@ class Android: @@ -227,6 +231,9 @@ class Android:
if 'STRIP' in environ:
return environ['STRIP']
return 'llvm-strip'
if self.ndk_rev >= 23:
return os.path.join(self.gen_binutils_path(), 'llvm-strip')
return os.path.join(self.gen_binutils_path(), 'strip')
def system_stl(self):
@ -261,13 +268,28 @@ class Android: @@ -261,13 +268,28 @@ 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 = []
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']
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
@ -276,32 +298,13 @@ class Android: @@ -276,32 +298,13 @@ class Android:
# just run sed to patch header
for f in ['strtod', 'strtof', 'strtold']:
cflags += ['-fno-builtin-%s' % f]
return cflags
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()
if self.is_hardfp():
cflags += ['-D_NDK_MATH_NO_SOFTFP=1', '-mfloat-abi=hard', '-DLOAD_HARDFP', '-DSOFTFP_LINK']
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
@ -317,14 +320,21 @@ class Android: @@ -317,14 +320,21 @@ 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):
ldflags = ['-lgcc', '-no-canonical-prefixes']
ldflags = []
if self.ndk_rev < 23:
ldflags += ['-lgcc']
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':
ldflags += ['-march=armv7-a', '-mthumb']

89
wscript

@ -22,9 +22,6 @@ def get_taskgen_count(self): @@ -22,9 +22,6 @@ def get_taskgen_count(self):
def options(opt):
grp = opt.add_option_group('Common options')
grp.add_option('-T', '--build-type', action='store', dest='BUILD_TYPE', default = None,
help = 'build type: debug, release or none(custom flags)')
grp.add_option('-8', '--64bits', action = 'store_true', dest = 'ALLOW64', default = False,
help = 'allow targetting 64-bit engine(Linux/Windows/OSX x86 only) [default: %default]')
@ -34,13 +31,7 @@ def options(opt): @@ -34,13 +31,7 @@ def options(opt):
grp.add_option('--enable-goldsrc-support', action = 'store_true', dest = 'GOLDSRC', default = False,
help = 'enable GoldSource engine support [default: %default]')
grp.add_option('--enable-lto', action = 'store_true', dest = 'LTO', default = False,
help = 'enable Link Time Optimization [default: %default]')
grp.add_option('--enable-poly-opt', action = 'store_true', dest = 'POLLY', default = False,
help = 'enable polyhedral optimization if possible [default: %default]')
opt.load('subproject')
opt.load('compiler_optimizations subproject')
opt.add_subproject(['cl_dll', 'dlls'])
@ -57,23 +48,9 @@ def configure(conf): @@ -57,23 +48,9 @@ def configure(conf):
conf.env.SERVER_NAME = 'opfor'
conf.env.PREFIX = ''
conf.load('fwgslib reconfigure enforce_pic')
conf.load('fwgslib reconfigure compiler_optimizations enforce_pic')
enforce_pic = True # modern defaults
valid_build_types = ['fastnative', 'fast', 'release', 'debug', 'nooptimize', 'sanitize', 'none']
conf.load('fwgslib reconfigure')
conf.start_msg('Build type')
if conf.options.BUILD_TYPE == None:
conf.end_msg('not set', color='RED')
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' % ', '.join(valid_build_types))
conf.end_msg(conf.options.BUILD_TYPE)
# -march=native should not be used
if conf.options.BUILD_TYPE == 'fast':
Logs.warn('WARNING: \'fast\' build type should not be used in release builds')
conf.env.VOICEMGR = conf.options.VOICEMGR
conf.env.GOLDSRC = conf.options.GOLDSRC
@ -96,11 +73,6 @@ def configure(conf): @@ -96,11 +73,6 @@ def configure(conf):
conf.load('msvs msdev strip_on_install')
try:
conf.env.CC_VERSION[0]
except IndexError:
conf.env.CC_VERSION = (0, )
if conf.env.DEST_OS == 'android':
conf.options.GOLDSRC = False
conf.env.SERVER_NAME = 'server' # can't be any other name, until specified
@ -121,60 +93,6 @@ def configure(conf): @@ -121,60 +93,6 @@ def configure(conf):
conf.env.BIT32_MANDATORY = not conf.env.BIT32_ALLOW64
conf.load('force_32bit library_naming')
linker_flags = {
'common': {
'msvc': ['/DEBUG'], # always create PDB, doesn't affect result binaries
'gcc': ['-Wl,--no-undefined']
},
'sanitize': {
'clang': ['-fsanitize=undefined', '-fsanitize=address'],
'gcc': ['-fsanitize=undefined', '-fsanitize=address'],
}
}
compiler_c_cxx_flags = {
'common': {
# disable thread-safe local static initialization for C++11 code, as it cause crashes on Windows XP
'msvc': ['/D_USING_V110_SDK71_', '/Zi', '/FS', '/Zc:threadSafeInit-', '/MT'],
'clang': ['-g', '-gdwarf-2', '-fvisibility=hidden'],
'gcc': ['-g']
},
'fast': {
'msvc': ['/O2', '/Oy'],
'gcc': {
'3': ['-O3', '-Os', '-funsafe-math-optimizations', '-fomit-frame-pointer'],
'default': ['-Ofast', '-funsafe-math-optimizations', '-funsafe-loop-optimizations', '-fomit-frame-pointer']
},
'clang': ['-Ofast'],
'default': ['-O3']
},
'fastnative': {
'msvc': ['/O2', '/Oy'],
'gcc': ['-Ofast', '-march=native', '-funsafe-math-optimizations', '-funsafe-loop-optimizations', '-fomit-frame-pointer'],
'clang': ['-Ofast', '-march=native'],
'default': ['-O3']
},
'release': {
'msvc': ['/O2'],
'default': ['-O3']
},
'debug': {
'msvc': ['/O1'],
'gcc': ['-Og'],
'default': ['-O1']
},
'sanitize': {
'msvc': ['/Od', '/RTC1'],
'gcc': ['-Og', '-fsanitize=undefined', '-fsanitize=address'],
'clang': ['-O0', '-fsanitize=undefined', '-fsanitize=address'],
'default': ['-O0']
},
'nooptimize': {
'msvc': ['/Od'],
'default': ['-O0']
}
}
compiler_optional_flags = [
'-fdiagnostics-color=always',
'-Werror=return-type',
@ -194,8 +112,7 @@ def configure(conf): @@ -194,8 +112,7 @@ def configure(conf):
'-Werror=declaration-after-statement'
]
linkflags = conf.get_flags_by_type(linker_flags, conf.options.BUILD_TYPE, conf.env.COMPILER_CC, conf.env.CC_VERSION[0])
cflags = conf.get_flags_by_type(compiler_c_cxx_flags, conf.options.BUILD_TYPE, conf.env.COMPILER_CC, conf.env.CC_VERSION[0])
cflags, linkflags = conf.get_optimization_flags()
# Here we don't differentiate C or C++ flags
if conf.options.LTO:

Loading…
Cancel
Save