Merge master to gravgun. Hide Voice code under NO_VOICEGAMEMGR macro and enable it in Android.mk

This commit is contained in:
a1batross 2016-06-05 01:47:45 +03:00
commit 472d6b5156
23 changed files with 75 additions and 67 deletions

View File

View File

@ -91,7 +91,7 @@ SRCS+=./input_xash3d.cpp
SRCS+=./scoreboard.cpp SRCS+=./scoreboard.cpp
SRCS+=./MOTD.cpp SRCS+=./MOTD.cpp
INCLUDES = -I../common -I. -I../game_shared -I../pm_shared -I../engine -I../dlls INCLUDES = -I../common -I. -I../game_shared -I../pm_shared -I../engine -I../dlls
DEFINES = -Wextra -Wno-missing-field-initializers -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -fpermissive DEFINES = -Wextra -Wno-missing-field-initializers -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL
LOCAL_C_INCLUDES := $(LOCAL_PATH)/. \ LOCAL_C_INCLUDES := $(LOCAL_PATH)/. \
$(LOCAL_PATH)/../common \ $(LOCAL_PATH)/../common \

View File

@ -167,7 +167,7 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p
char killedwith[32]; char killedwith[32];
strcpy( killedwith, "d_" ); strcpy( killedwith, "d_" );
strncat( killedwith, READ_STRING(), 31 ); strncat( killedwith, READ_STRING(), sizeof(killedwith) );
gHUD.m_Spectator.DeathMessage(victim); gHUD.m_Spectator.DeathMessage(victim);

View File

@ -67,7 +67,6 @@ int CHudGeiger::Draw (float flTime)
float flvol = 0.0f; float flvol = 0.0f;
int rg[3]; int rg[3];
int i = 0; int i = 0;
if (m_iGeigerRange < 1000 && m_iGeigerRange > 0) if (m_iGeigerRange < 1000 && m_iGeigerRange > 0)
{ {
// peicewise linear is better than continuous formula for this // peicewise linear is better than continuous formula for this

View File

@ -867,16 +867,13 @@ bool CHudSpectator::IsActivePlayer(cl_entity_t * ent)
bool CHudSpectator::ParseOverviewFile( ) bool CHudSpectator::ParseOverviewFile( )
{ {
char filename[255]; char filename[255] = { 0 };
char levelname[255]; char levelname[255] = { 0 };
char token[1024]; char token[1024] = { 0 };
float height; float height;
char *pfile = NULL; char *pfile = NULL;
memset( filename, 0, 255 );
memset( levelname, 0, 255 );
memset( token, 0, 1024 );
memset( &m_OverviewData, 0, sizeof(m_OverviewData)); memset( &m_OverviewData, 0, sizeof(m_OverviewData));
// fill in standrd values // fill in standrd values

View File

@ -20,7 +20,6 @@
#define HSPRITE HSPRITE_win32 #define HSPRITE HSPRITE_win32
#include <windows.h> #include <windows.h>
#undef HSPRITE #undef HSPRITE
#else #else
typedef struct point_s{ typedef struct point_s{
int x; int x;

View File

@ -13,10 +13,11 @@ ifeq ($(TARGET_ARCH_ABI),armeabi-v7a-hard)
LOCAL_MODULE_FILENAME = libserver_hardfp LOCAL_MODULE_FILENAME = libserver_hardfp
endif endif
LOCAL_CFLAGS += -D_LINUX -DCLIENT_WEAPONS -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf \ # Xash doesn't have any voice chat, so remove it from gamedll too.
-fno-exceptions -Wextra -Wno-write-strings -fpermissive LOCAL_CFLAGS += -D_LINUX -DCLIENT_WEAPONS -DNO_VOICEGAMEMGR -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf \
-fno-exceptions -Wextra -Wno-write-strings
LOCAL_CPPFLAGS := $(LOCAL_CFLAGS) -frtti -fpermissive LOCAL_CPPFLAGS := $(LOCAL_CFLAGS) -frtti
LOCAL_C_INCLUDES := $(SDL_PATH)/include \ LOCAL_C_INCLUDES := $(SDL_PATH)/include \
$(LOCAL_PATH)/. \ $(LOCAL_PATH)/. \
@ -99,8 +100,8 @@ LOCAL_SRC_FILES := agrunt.cpp airtank.cpp \
rat.cpp \ rat.cpp \
roach.cpp \ roach.cpp \
rpg.cpp \ rpg.cpp \
satchel.cpp \ satchel.cpp \
schedule.cpp \ schedule.cpp \
scientist.cpp \ scientist.cpp \
scripted.cpp \ scripted.cpp \
shotgun.cpp \ shotgun.cpp \

View File

@ -212,8 +212,8 @@ public:
(this->*m_pfnUse)( pActivator, pCaller, useType, value ); (this->*m_pfnUse)( pActivator, pCaller, useType, value );
} }
virtual void Blocked( CBaseEntity *pOther ) { if (m_pfnBlocked) (this->*m_pfnBlocked)( pOther ); } virtual void Blocked( CBaseEntity *pOther ) { if (m_pfnBlocked) (this->*m_pfnBlocked)( pOther ); }
virtual float TouchGravGun( CBaseEntity *attacker, int stage ){ return 0; } virtual float TouchGravGun( CBaseEntity *attacker, int stage ){ return 0; }
// allow engine to allocate instance data // allow engine to allocate instance data
void *operator new( size_t stAllocateBlock, entvars_t *pev ) void *operator new( size_t stAllocateBlock, entvars_t *pev )
{ {

View File

@ -204,8 +204,10 @@ void ClientPutInServer( edict_t *pEntity )
} }
//#include "voice_gamemgr.h" #ifndef NO_VOICEGAMEMGR
//extern CVoiceGameMgr g_VoiceGameMgr; #include "voice_gamemgr.h"
extern CVoiceGameMgr g_VoiceGameMgr;
#endif
//// HOST_SAY //// HOST_SAY
// String comes in as // String comes in as
@ -314,8 +316,10 @@ void Host_Say( edict_t *pEntity, int teamonly )
continue; continue;
// can the receiver hear the sender? or has he muted him? // can the receiver hear the sender? or has he muted him?
//if ( g_VoiceGameMgr.PlayerHasBlockedPlayer( client, player ) ) #ifndef NO_VOICEGAMEMGR
//continue; if ( g_VoiceGameMgr.PlayerHasBlockedPlayer( client, player ) )
continue;
#endif
if ( teamonly && g_pGameRules->PlayerRelationship(client, CBaseEntity::Instance(pEntity)) != GR_TEAMMATE ) if ( teamonly && g_pGameRules->PlayerRelationship(client, CBaseEntity::Instance(pEntity)) != GR_TEAMMATE )
continue; continue;

View File

@ -811,7 +811,9 @@ void CGib :: Spawn( const char *szGibModel )
UTIL_SetSize(pev, Vector( 0, 0, 0), Vector(0, 0, 0)); UTIL_SetSize(pev, Vector( 0, 0, 0), Vector(0, 0, 0));
pev->nextthink = gpGlobals->time + 4; pev->nextthink = gpGlobals->time + 4;
m_lifeTime = 250; m_lifeTime = 250;
SetThink( &CGib::WaitTillLand ); SetThink( &CGib::WaitTillLand );
SetTouch( &CGib::BounceGibTouch ); SetTouch( &CGib::BounceGibTouch );

View File

@ -565,4 +565,4 @@ class CEgonAmmo : public CBasePlayerAmmo
}; };
LINK_ENTITY_TO_CLASS( ammo_egonclip, CEgonAmmo ); LINK_ENTITY_TO_CLASS( ammo_egonclip, CEgonAmmo );
#endif #endif

View File

@ -47,26 +47,10 @@ BOOL WINAPI DllMain(
return TRUE; return TRUE;
} }
extern "C" void DLLEXPORT GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals ) __attribute__((__stdcall__)) ;
extern "C" void DLLEXPORT GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals )
{
memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof(enginefuncs_t));
gpGlobals = pGlobals;
}
#else
extern "C" {
void GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals )
{
memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof(enginefuncs_t));
gpGlobals = pGlobals;
}
}
#endif #endif
extern "C" void DLLEXPORT GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals )
{
memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof(enginefuncs_t));
gpGlobals = pGlobals;
}

View File

@ -174,6 +174,7 @@ float CItem::TouchGravGun( CBaseEntity *attacker, int stage)
pev->nextthink = g_pGameRules->FlItemRespawnTime( this ); pev->nextthink = g_pGameRules->FlItemRespawnTime( this );
return 200; return 200;
} }
void CItem::Materialize( void ) void CItem::Materialize( void )
{ {
if ( pev->effects & EF_NODRAW ) if ( pev->effects & EF_NODRAW )

View File

@ -154,7 +154,6 @@ public:
static void SpawnHeadGib( entvars_t *pevVictim ); static void SpawnHeadGib( entvars_t *pevVictim );
static void SpawnRandomGibs( entvars_t *pevVictim, int cGibs, int human ); static void SpawnRandomGibs( entvars_t *pevVictim, int cGibs, int human );
static void SpawnStickyGibs( entvars_t *pevVictim, Vector vecOrigin, int cGibs ); static void SpawnStickyGibs( entvars_t *pevVictim, Vector vecOrigin, int cGibs );
virtual float TouchGravGun( CBaseEntity *attacker, int stage ) virtual float TouchGravGun( CBaseEntity *attacker, int stage )
{ {
pev->nextthink = gpGlobals->time + m_lifeTime; pev->nextthink = gpGlobals->time + m_lifeTime;

View File

@ -43,7 +43,9 @@ extern int g_teamplay;
float g_flIntermissionStartTime = 0; float g_flIntermissionStartTime = 0;
//CVoiceGameMgr g_VoiceGameMgr; #ifndef NO_VOICEGAMEMGR
CVoiceGameMgr g_VoiceGameMgr;
#endif
class CMultiplayGameMgrHelper : public IVoiceGameMgrHelper class CMultiplayGameMgrHelper : public IVoiceGameMgrHelper
{ {
@ -69,8 +71,10 @@ static CMultiplayGameMgrHelper g_GameMgrHelper;
CHalfLifeMultiplay :: CHalfLifeMultiplay() CHalfLifeMultiplay :: CHalfLifeMultiplay()
{ {
//g_VoiceGameMgr.Init(&g_GameMgrHelper, gpGlobals->maxClients); #ifndef NO_VOICEGAMEMGR
g_VoiceGameMgr.Init(&g_GameMgrHelper, gpGlobals->maxClients);
#endif
RefreshSkillData(); RefreshSkillData();
m_flIntermissionEndTime = 0; m_flIntermissionEndTime = 0;
g_flIntermissionStartTime = 0; g_flIntermissionStartTime = 0;
@ -116,9 +120,11 @@ CHalfLifeMultiplay :: CHalfLifeMultiplay()
BOOL CHalfLifeMultiplay::ClientCommand( CBasePlayer *pPlayer, const char *pcmd ) BOOL CHalfLifeMultiplay::ClientCommand( CBasePlayer *pPlayer, const char *pcmd )
{ {
//if(g_VoiceGameMgr.ClientCommand(pPlayer, pcmd)) #ifndef NO_VOICEGAMEMGR
//return TRUE; if(g_VoiceGameMgr.ClientCommand(pPlayer, pcmd))
return TRUE;
#endif
return CGameRules::ClientCommand(pPlayer, pcmd); return CGameRules::ClientCommand(pPlayer, pcmd);
} }
@ -186,8 +192,9 @@ extern cvar_t mp_chattime;
//========================================================= //=========================================================
void CHalfLifeMultiplay :: Think ( void ) void CHalfLifeMultiplay :: Think ( void )
{ {
//g_VoiceGameMgr.Update(gpGlobals->frametime); #ifndef NO_VOICEGAMEMGR
g_VoiceGameMgr.Update(gpGlobals->frametime);
#endif
///// Check game rules ///// ///// Check game rules /////
static int last_frags; static int last_frags;
static int last_time; static int last_time;
@ -397,7 +404,9 @@ BOOL CHalfLifeMultiplay :: GetNextBestWeapon( CBasePlayer *pPlayer, CBasePlayerI
//========================================================= //=========================================================
BOOL CHalfLifeMultiplay :: ClientConnected( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] ) BOOL CHalfLifeMultiplay :: ClientConnected( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] )
{ {
//g_VoiceGameMgr.ClientConnected(pEntity); #ifndef NO_VOICEGAMEMGR
g_VoiceGameMgr.ClientConnected(pEntity);
#endif
return TRUE; return TRUE;
} }
@ -573,8 +582,8 @@ void CHalfLifeMultiplay :: PlayerSpawn( CBasePlayer *pPlayer )
{ {
pPlayer->GiveNamedItem( "weapon_crowbar" ); pPlayer->GiveNamedItem( "weapon_crowbar" );
pPlayer->GiveNamedItem( "weapon_9mmhandgun" ); pPlayer->GiveNamedItem( "weapon_9mmhandgun" );
pPlayer->GiveAmmo( 68, "9mm", _9MM_MAX_CARRY );// 4 full reloads
pPlayer->GiveNamedItem( "weapon_gravgun" ); pPlayer->GiveNamedItem( "weapon_gravgun" );
pPlayer->GiveAmmo( 68, "9mm", _9MM_MAX_CARRY );// 4 full reloads
} }
} }

View File

@ -3323,7 +3323,6 @@ void CGraph :: ComputeStaticRoutingTables( void )
if ( BestNextNodes ) delete[] BestNextNodes; if ( BestNextNodes ) delete[] BestNextNodes;
if ( pRoute ) delete[] pRoute; if ( pRoute ) delete[] pRoute;
if ( pMyPath ) delete[] pMyPath; if ( pMyPath ) delete[] pMyPath;
Routes = 0; Routes = 0;
BestNextNodes = 0; BestNextNodes = 0;
pRoute = 0; pRoute = 0;

View File

@ -309,13 +309,13 @@ public:
char m_SbarString1[ SBAR_STRING_SIZE ]; char m_SbarString1[ SBAR_STRING_SIZE ];
float m_flNextChatTime; float m_flNextChatTime;
virtual float TouchGravGun( CBaseEntity *attacker, int stage ) virtual float TouchGravGun( CBaseEntity *attacker, int stage )
{ {
if( stage == 3 ) if( stage == 3 )
return 200; return 200;
return 0; return 0;
} }
}; };
#define AUTOAIM_2DEGREES 0.0348994967025 #define AUTOAIM_2DEGREES 0.0348994967025

View File

@ -68,8 +68,10 @@ CHalfLifeTeamplay :: CHalfLifeTeamplay()
extern cvar_t timeleft, fragsleft; extern cvar_t timeleft, fragsleft;
#ifndef NO_VOICEGAMEMGR
#include "voice_gamemgr.h" #include "voice_gamemgr.h"
//extern CVoiceGameMgr g_VoiceGameMgr; extern CVoiceGameMgr g_VoiceGameMgr;
#endif
void CHalfLifeTeamplay :: Think ( void ) void CHalfLifeTeamplay :: Think ( void )
{ {
@ -80,8 +82,10 @@ void CHalfLifeTeamplay :: Think ( void )
int frags_remaining = 0; int frags_remaining = 0;
int time_remaining = 0; int time_remaining = 0;
//g_VoiceGameMgr.Update(gpGlobals->frametime); #ifndef NO_VOICEGAMEMGR
g_VoiceGameMgr.Update(gpGlobals->frametime);
#endif
if ( g_fGameOver ) // someone else quit the game already if ( g_fGameOver ) // someone else quit the game already
{ {
CHalfLifeMultiplay::Think(); CHalfLifeMultiplay::Think();
@ -145,9 +149,11 @@ void CHalfLifeTeamplay :: Think ( void )
//========================================================= //=========================================================
BOOL CHalfLifeTeamplay :: ClientCommand( CBasePlayer *pPlayer, const char *pcmd ) BOOL CHalfLifeTeamplay :: ClientCommand( CBasePlayer *pPlayer, const char *pcmd )
{ {
//if(g_VoiceGameMgr.ClientCommand(pPlayer, pcmd)) #ifdef NO_VOICEGAMEMGR
//return TRUE; if(g_VoiceGameMgr.ClientCommand(pPlayer, pcmd))
return TRUE;
#endif
if ( FStrEq( pcmd, "menuselect" ) ) if ( FStrEq( pcmd, "menuselect" ) )
{ {
if ( CMD_ARGC() < 2 ) if ( CMD_ARGC() < 2 )

View File

@ -2378,7 +2378,7 @@ int CRestore::ReadField( void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCou
if ( strlen( (char *)pInputData ) == 0 ) if ( strlen( (char *)pInputData ) == 0 )
*((void**)pOutputData) = 0; *((void**)pOutputData) = 0;
else else
*((void**)pOutputData) = FUNCTION_FROM_NAME( (char *)pInputData ); *((void**)pOutputData) = (void**)FUNCTION_FROM_NAME( (char *)pInputData );
break; break;
default: default:

View File

@ -532,10 +532,11 @@ void CBasePlayerItem::Materialize( void )
UTIL_SetOrigin( pev, m_SpawnPoint );// link into world. UTIL_SetOrigin( pev, m_SpawnPoint );// link into world.
else else
UTIL_SetOrigin( pev, m_SpawnPoint = pev->origin ); UTIL_SetOrigin( pev, m_SpawnPoint = pev->origin );
SetTouch( &CBasePlayerItem::DefaultTouch ); SetTouch( &CBasePlayerItem::DefaultTouch );
SetThink( NULL ); SetThink( NULL );
} }
float CBasePlayerItem::TouchGravGun( CBaseEntity *attacker, int stage ) float CBasePlayerItem::TouchGravGun( CBaseEntity *attacker, int stage )
{ {
if( stage == 2 ) if( stage == 2 )
@ -556,6 +557,11 @@ float CBasePlayerItem::TouchGravGun( CBaseEntity *attacker, int stage )
return 200; return 200;
} }
UTIL_SetOrigin( pev, pev->origin );// link into world.
SetTouch( &CBasePlayerItem::DefaultTouch);
SetThink( NULL );
}
//========================================================= //=========================================================
// AttemptToMaterialize - the item is trying to rematerialize, // AttemptToMaterialize - the item is trying to rematerialize,
// should it do so now or wait longer? // should it do so now or wait longer?

View File

@ -98,6 +98,7 @@ typedef struct client_textmessage_s
#else #else
#define longlong_t long long #define longlong_t long long
#endif #endif
typedef struct hud_player_info_s typedef struct hud_player_info_s
{ {
char *name; char *name;

View File

@ -488,4 +488,4 @@ extern NEW_DLL_FUNCTIONS gNewDLLFunctions;
typedef int (*APIFUNCTION)( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion ); typedef int (*APIFUNCTION)( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion );
typedef int (*APIFUNCTION2)( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion ); typedef int (*APIFUNCTION2)( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion );
#endif//EIFACE_H #endif//EIFACE_H

View File

@ -81,6 +81,7 @@ typedef struct physent_s
vec3_t vuser3; vec3_t vuser3;
vec3_t vuser4; vec3_t vuser4;
} physent_t; } physent_t;
typedef struct hull_s hull_t; typedef struct hull_s hull_t;
typedef struct playermove_s typedef struct playermove_s
@ -219,4 +220,4 @@ typedef struct playermove_s
struct pmtrace_s *(*PM_TraceLineEx)( float *start, float *end, int flags, int usehulll, int (*pfnIgnore)( physent_t *pe )); struct pmtrace_s *(*PM_TraceLineEx)( float *start, float *end, int flags, int usehulll, int (*pfnIgnore)( physent_t *pe ));
struct msurface_s *(*PM_TraceSurface)( int ground, float *vstart, float *vend ); struct msurface_s *(*PM_TraceSurface)( int ground, float *vstart, float *vend );
} playermove_t; } playermove_t;
#endif//PM_DEFS_H #endif//PM_DEFS_H