Place all a new mod-specific code under MOBILE_HACKS macro.

This commit is contained in:
Andrey Akhmichin 2019-11-30 19:50:50 +05:00
parent 8b5d5b705e
commit 913d732a3f
20 changed files with 115 additions and 3 deletions

View File

@ -111,7 +111,11 @@ int CHudFlashlight::Draw( float flTime )
if( gEngfuncs.IsSpectateOnly() )
return 1;
#ifdef MOBILE_HACKS
if( !( gHUD.m_iWeaponBits & ( 1 << ( WEAPON_FLASHLIGHT ) ) ) )
#else // MOBILE_HACKS
if( !( gHUD.m_iWeaponBits & ( 1 << ( WEAPON_SUIT ) ) ) )
#endif // MOBILE_HACKS
return 1;
if( m_fOn )

View File

@ -1021,8 +1021,10 @@ void CMomentaryRotButton::KeyValue( KeyValueData *pkvd )
if( FStrEq( pkvd->szKeyName, "returnspeed" ) )
{
m_returnSpeed = atof( pkvd->szValue );
#ifdef MOBILE_HACKS
if( m_returnSpeed > 45.0f )
m_returnSpeed = 45.0f;
#endif // MOBILE_HACKS
pkvd->fHandled = TRUE;
}
else if( FStrEq( pkvd->szKeyName, "sounds" ) )

View File

@ -40,6 +40,9 @@
#define HUD_PRINTTALK 3
#define HUD_PRINTCENTER 4
#ifdef MOBILE_HACKS
#define WEAPON_FLASHLIGHT 30
#endif // MOBILE_HACKS
#define WEAPON_SUIT 31
#endif

View File

@ -365,7 +365,9 @@ public:
void Zap( const Vector &vecSrc, const Vector &vecDest );
void EXPORT StrikeUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
void EXPORT ToggleUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
#if 0
static CLightning *LightningCreate( const char *pSpriteName, int width );
#endif
inline BOOL ServerSide( void )
{
if( m_life == 0 && !( pev->spawnflags & SF_BEAM_RING ) )
@ -912,6 +914,7 @@ void CLightning::BeamUpdateVars( void )
SetFlags( BEAM_FSHADEOUT );
}
#if 0
CLightning *CLightning::LightningCreate( const char *pSpriteName, int width )
{
// Create a new entity with CLightning private data
@ -924,6 +927,7 @@ CLightning *CLightning::LightningCreate( const char *pSpriteName, int width )
return pBeam;
}
#endif
LINK_ENTITY_TO_CLASS( env_laser, CLaser )
@ -2247,6 +2251,7 @@ void CItemSoda::CanTouch( CBaseEntity *pOther )
pev->nextthink = gpGlobals->time;
}
#ifdef MOBILE_HACKS
//=========================================================
// env_warpball
//=========================================================
@ -2476,3 +2481,4 @@ CWarpBall *CWarpBall::CreateWarpBall( const Vector &p_VecOrigin )
UTIL_SetOrigin( pWarpBall->pev, p_VecOrigin );
return pWarpBall;
}
#endif // MOBILE_HACKS

View File

@ -232,10 +232,13 @@ cvar_t sk_nihilanth_zap1 = {"sk_nihilanth_zap1","0"};
cvar_t sk_nihilanth_zap2 = {"sk_nihilanth_zap2","0"};
cvar_t sk_nihilanth_zap3 = {"sk_nihilanth_zap3","0"};
#ifdef MOBILE_HACKS
// Absolute Redemption
// Barney
cvar_t sk_roy_health1 = {"sk_roy_health1","0"};
cvar_t sk_roy_health2 = {"sk_roy_health2","0"};
cvar_t sk_roy_health3 = {"sk_roy_health3","0"};
#endif // MOBILE_HACKS
// Scientist
cvar_t sk_scientist_health1 = {"sk_scientist_health1","0"};
@ -663,10 +666,13 @@ void GameDLLInit( void )
CVAR_REGISTER( &sk_nihilanth_zap2 );
CVAR_REGISTER( &sk_nihilanth_zap3 );
#ifdef MOBILE_HACKS
// Absolute Redemption
// Roy
CVAR_REGISTER( &sk_roy_health1 );// {"sk_roy_health1","0"};
CVAR_REGISTER( &sk_roy_health2 );// {"sk_roy_health2","0"};
CVAR_REGISTER( &sk_roy_health3 );// {"sk_roy_health3","0"};
#endif
// Scientist
CVAR_REGISTER( &sk_scientist_health1 );// {"sk_scientist_health1","0"};

View File

@ -200,8 +200,11 @@ void CGameRules::RefreshSkillData ( void )
gSkillData.nihilanthHealth = GetSkillCvar( "sk_nihilanth_health" );
gSkillData.nihilanthZap = GetSkillCvar( "sk_nihilanth_zap" );
#ifdef MOBILE_HACKS
// Absolute Redeption
// Roy
gSkillData.royHealth = GetSkillCvar( "sk_roy_health" );
#endif // MOBILE_HACKS
// Scientist
gSkillData.scientistHealth = GetSkillCvar( "sk_scientist_health" );

View File

@ -23,7 +23,9 @@
// For holograms, make them not solid so the player can walk through them
#define SF_GENERICMONSTER_NOTSOLID 4
#ifdef MOBILE_HACKS
#define SF_HEAD_CONTROLLER 8
#endif // MOBILE_HACKS
//=========================================================
// Monster's Anim Events Go Here
@ -37,6 +39,7 @@ public:
int Classify( void );
void HandleAnimEvent( MonsterEvent_t *pEvent );
int ISoundMask( void );
#ifdef MOBILE_HACKS
void PlayScriptedSentence( const char *pszSentence, float duration, float volume, float attenuation, BOOL bConcurrent, CBaseEntity *pListener );
void IdleHeadTurn( Vector &vecFriend );
void EXPORT MonsterThink();
@ -50,10 +53,12 @@ private:
EHANDLE m_hTalkTarget;
float m_flIdealYaw;
float m_flCurrentYaw;
#endif // MOBILE_HACKS
};
LINK_ENTITY_TO_CLASS( monster_generic, CGenericMonster )
#ifdef MOBILE_HACKS
TYPEDESCRIPTION CGenericMonster::m_SaveData[] =
{
DEFINE_FIELD( CGenericMonster, m_talkTime, FIELD_FLOAT ),
@ -63,6 +68,7 @@ TYPEDESCRIPTION CGenericMonster::m_SaveData[] =
};
IMPLEMENT_SAVERESTORE( CGenericMonster, CBaseMonster )
#endif // MOBILE_HACKS
//=========================================================
// Classify - indicates this monster's place in the
@ -142,13 +148,15 @@ void CGenericMonster::Spawn()
MonsterInit();
#ifdef MOBILE_HACKS
if( pev->spawnflags & SF_HEAD_CONTROLLER )
{
m_afCapability = bits_CAP_TURN_HEAD;
}
m_flIdealYaw = m_flCurrentYaw = 0;
#endif // MOBILE_HACKS
if( pev->spawnflags & SF_GENERICMONSTER_NOTSOLID )
{
pev->solid = SOLID_NOT;
@ -164,6 +172,7 @@ void CGenericMonster::Precache()
PRECACHE_MODEL( STRING( pev->model ) );
}
#ifdef MOBILE_HACKS
void CGenericMonster::PlayScriptedSentence( const char *pszSentence, float duration, float volume, float attenuation, BOOL bConcurrent, CBaseEntity *pListener )
{
m_talkTime = gpGlobals->time + duration;
@ -221,6 +230,7 @@ void CGenericMonster::MonsterThink()
CBaseMonster::MonsterThink();
}
#endif // MOBILE_HACKS
//=========================================================
// AI Schedules Specific to this monster

View File

@ -49,7 +49,9 @@ public:
int m_iJuice;
int m_iOn; // 0 = off, 1 = startup, 2 = going
float m_flSoundTime;
#ifdef MOBILE_HACKS
BOOL m_bTriggerable;
#endif // MOBILE_HACKS
};
TYPEDESCRIPTION CRecharge::m_SaveData[] =
@ -59,7 +61,9 @@ TYPEDESCRIPTION CRecharge::m_SaveData[] =
DEFINE_FIELD( CRecharge, m_iJuice, FIELD_INTEGER ),
DEFINE_FIELD( CRecharge, m_iOn, FIELD_INTEGER ),
DEFINE_FIELD( CRecharge, m_flSoundTime, FIELD_TIME ),
#ifdef MOBILE_HACKS
DEFINE_FIELD( CRecharge, m_bTriggerable, FIELD_BOOLEAN )
#endif // MOBILE_HACKS
};
IMPLEMENT_SAVERESTORE( CRecharge, CBaseEntity )
@ -96,7 +100,9 @@ void CRecharge::Spawn()
UTIL_SetSize( pev, pev->mins, pev->maxs );
SET_MODEL( ENT( pev ), STRING( pev->model ) );
m_iJuice = (int)gSkillData.suitchargerCapacity;
#ifdef MOBILE_HACKS
m_bTriggerable = !FStringNull( pev->target );
#endif // MOBILE_HACKS
pev->frame = 0;
}
@ -120,12 +126,14 @@ void CRecharge::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use
// if there is no juice left, turn it off
if( m_iJuice <= 0 )
{
pev->frame = 1;
pev->frame = 1;
#ifdef MOBILE_HACKS
if( m_bTriggerable )
{
FireTargets( STRING( pev->target ), pActivator, this, USE_TOGGLE, 0 );
m_bTriggerable = FALSE;
}
#endif // MOBILE_HACKS
Off();
}
@ -180,7 +188,9 @@ void CRecharge::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use
void CRecharge::Recharge( void )
{
m_iJuice = (int)gSkillData.suitchargerCapacity;
#ifdef MOBILE_HACKS
m_bTriggerable = !FStringNull( pev->target );
#endif // MOBILE_HACKS
pev->frame = 0;
SetThink( &CBaseEntity::SUB_DoNothing );
}

View File

@ -116,7 +116,9 @@ public:
int m_iJuice;
int m_iOn; // 0 = off, 1 = startup, 2 = going
float m_flSoundTime;
#ifdef MOBILE_HACKS
BOOL m_bTriggerable;
#endif // MOBILE_HACKS
};
TYPEDESCRIPTION CWallHealth::m_SaveData[] =
@ -126,7 +128,9 @@ TYPEDESCRIPTION CWallHealth::m_SaveData[] =
DEFINE_FIELD( CWallHealth, m_iJuice, FIELD_INTEGER ),
DEFINE_FIELD( CWallHealth, m_iOn, FIELD_INTEGER ),
DEFINE_FIELD( CWallHealth, m_flSoundTime, FIELD_TIME ),
#ifdef MOBILE_HACKS
DEFINE_FIELD( CWallHealth, m_bTriggerable, FIELD_BOOLEAN )
#endif // MOBILE_HACKS
};
IMPLEMENT_SAVERESTORE( CWallHealth, CBaseEntity )
@ -163,7 +167,9 @@ void CWallHealth::Spawn()
UTIL_SetSize( pev, pev->mins, pev->maxs );
SET_MODEL( ENT( pev ), STRING( pev->model ) );
m_iJuice = (int)gSkillData.healthchargerCapacity;
#ifdef MOBILE_HACKS
m_bTriggerable = !FStringNull( pev->target );
#endif // MOBILE_HACKS
pev->frame = 0;
}
@ -186,11 +192,13 @@ void CWallHealth::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u
// if there is no juice left, turn it off
if( m_iJuice <= 0 )
{
#ifdef MOBILE_HACKS
if( m_bTriggerable )
{
FireTargets( STRING( pev->target ), pActivator, this, USE_TOGGLE, 0 );
m_bTriggerable = FALSE;
}
#endif // MOBILE_HACKS
pev->frame = 1;
Off();
}
@ -240,7 +248,9 @@ void CWallHealth::Recharge( void )
{
EMIT_SOUND( ENT( pev ), CHAN_ITEM, "items/medshot4.wav", 1.0, ATTN_NORM );
m_iJuice = (int)gSkillData.healthchargerCapacity;
#ifdef MOBILE_HACKS
m_bTriggerable = !FStringNull( pev->target );
#endif // MOBILE_HACKS
pev->frame = 0;
SetThink( &CBaseEntity::SUB_DoNothing );
}

View File

@ -70,9 +70,11 @@ void CWorldItem::Spawn( void )
case 45: // ITEM_SUIT:
pEntity = CBaseEntity::Create( "item_suit", pev->origin, pev->angles );
break;
#ifdef MOBILE_HACKS
case 46: // ITEM_FLASHLIGHT:
pEntity = CBaseEntity::Create( "item_flashlight", pev->origin, pev->angles );
break;
#endif // MOBILE_HACKS
}
if( !pEntity )
@ -203,6 +205,7 @@ class CItemSuit : public CItem
LINK_ENTITY_TO_CLASS( item_suit, CItemSuit )
#ifdef MOBILE_HACKS
class CItemArmorVest : public CItem
{
void Spawn( void )
@ -270,6 +273,7 @@ class CItemHelmet : public CItem
};
LINK_ENTITY_TO_CLASS( item_helmet, CItemHelmet )
#endif // MOBILE_HACKS
class CItemBattery : public CItem
{
@ -369,6 +373,7 @@ class CItemSecurity : public CItem
LINK_ENTITY_TO_CLASS( item_security, CItemSecurity )
#ifdef MOBILE_HACKS
class CItemFlashlight : public CItem
{
void Spawn( void )
@ -395,6 +400,7 @@ class CItemFlashlight : public CItem
};
LINK_ENTITY_TO_CLASS( item_flashlight, CItemFlashlight )
#endif // MOBILE_HACKS
class CItemLongJump : public CItem
{

View File

@ -3295,7 +3295,11 @@ void CBasePlayer::FlashlightTurnOn( void )
return;
}
#ifdef MOBILE_HACKS
if( (pev->weapons & ( 1 << WEAPON_FLASHLIGHT ) ) )
#else // MOBILE_HACKS
if( (pev->weapons & ( 1 << WEAPON_SUIT ) ) )
#endif // MOBILE_HACKS
{
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, SOUND_FLASHLIGHT_ON, 1.0, ATTN_NORM, 0, PITCH_NORM );
SetBits( pev->effects, EF_DIMLIGHT );
@ -3458,9 +3462,13 @@ void CBasePlayer::CheatImpulseCommands( int iImpulse )
case 101:
gEvilImpulse101 = TRUE;
GiveNamedItem( "item_suit" );
#ifdef MOBILE_HACKS
GiveNamedItem( "item_armorvest" );
GiveNamedItem( "item_helmet" );
// GiveNamedItem( "item_battery" );
GiveNamedItem( "item_battery" );
#else // MOBILE_HACKS
GiveNamedItem( "item_battery" );
#endif // MOBILE_HACKS
GiveNamedItem( "weapon_crowbar" );
GiveNamedItem( "weapon_9mmhandgun" );
GiveNamedItem( "ammo_9mmclip" );

View File

@ -12,6 +12,8 @@
* use or distribution of this code by or to any unlicensed person is illegal.
*
****/
#ifdef MOBILE_HACKS
//=========================================================
// monster template
//=========================================================
@ -469,3 +471,4 @@ void CDeadRoy::Spawn()
MonsterInitDead();
}
#endif // MOBILE_HACKS

View File

@ -60,7 +60,9 @@ enum
// Scientist
//=======================================================
LINK_ENTITY_TO_CLASS( monster_scientist, CScientist )
#ifdef MOBILE_HACKS
LINK_ENTITY_TO_CLASS( monster_rosenberg, CScientist )
#endif // MOBILE_HACKS
TYPEDESCRIPTION CScientist::m_SaveData[] =
{
@ -361,9 +363,11 @@ void CScientist::DeclineFollowing( void )
{
Talk( 10 );
m_hTalkTarget = m_hEnemy;
#ifdef MOBILE_HACKS
if( FClassnameIs( pev, "monster_rosenberg" ) )
PlaySentence( "RO_POK", 2, VOL_NORM, ATTN_NORM );
else
#endif // MOBILE_HACKS
PlaySentence( "SC_POK", 2, VOL_NORM, ATTN_NORM );
}
@ -373,9 +377,11 @@ void CScientist::Scream( void )
{
Talk( 10 );
m_hTalkTarget = m_hEnemy;
#ifdef MOBILE_HACKS
if( FClassnameIs( pev, "monster_rosenberg" ) )
PlaySentence( "RO_SCREAM", RANDOM_FLOAT( 3.0f, 6.0f ), VOL_NORM, ATTN_NORM );
else
#endif // MOBILE_HACKS
PlaySentence( "SC_SCREAM", RANDOM_FLOAT( 3.0f, 6.0f ), VOL_NORM, ATTN_NORM );
}
}
@ -416,11 +422,13 @@ void CScientist::StartTask( Task_t *pTask )
Talk( 2 );
m_hTalkTarget = m_hEnemy;
#ifdef MOBILE_HACKS
if( FClassnameIs( pev, "monster_rosenberg" ) )
{
PlaySentence( "RO_FEAR", 5, VOL_NORM, ATTN_NORM );
}
else
#endif // MOBILE_HACKS
{
//The enemy can be null here. - Solokiller
//Discovered while testing the barnacle grapple on headcrabs with scientists in view.
@ -605,9 +613,12 @@ void CScientist::Spawn( void )
pev->solid = SOLID_SLIDEBOX;
pev->movetype = MOVETYPE_STEP;
m_bloodColor = BLOOD_COLOR_RED;
#ifdef MOBILE_HACKS
if( FClassnameIs( pev, "monster_rosenberg" ) )
pev->health = gSkillData.scientistHealth * 2;
else
#endif // MOBILE_HACKS
pev->health = gSkillData.scientistHealth;
pev->view_ofs = Vector( 0, 0, 50 );// position of the eyes relative to monster's origin.
m_flFieldOfView = VIEW_FIELD_WIDE; // NOTE: we need a wide field of view so scientists will notice player and say hello
@ -640,7 +651,9 @@ void CScientist::Spawn( void )
void CScientist::Precache( void )
{
PRECACHE_MODEL( "models/scientist.mdl" );
#ifdef MOBILE_HACKS
if( !FClassnameIs( pev, "monster_rosenberg" ) )
#endif // MOBILE_HACKS
{
PRECACHE_SOUND( "scientist/sci_pain1.wav" );
PRECACHE_SOUND( "scientist/sci_pain2.wav" );
@ -648,6 +661,7 @@ void CScientist::Precache( void )
PRECACHE_SOUND( "scientist/sci_pain4.wav" );
PRECACHE_SOUND( "scientist/sci_pain5.wav" );
}
#ifdef MOBILE_HACKS
else
{
PRECACHE_SOUND( "rosenberg/ro_pain0.wav" );
@ -660,6 +674,7 @@ void CScientist::Precache( void )
PRECACHE_SOUND( "rosenberg/ro_pain7.wav" );
PRECACHE_SOUND( "rosenberg/ro_pain8.wav" );
}
#endif // MOBILE_HACKS
// every new scientist must call this, otherwise
// when a level is loaded, nobody will talk (time is reset to 0)
@ -674,6 +689,7 @@ void CScientist::TalkInit()
CTalkMonster::TalkInit();
// scientists speach group names (group names are in sentences.txt)
#ifdef MOBILE_HACKS
if( FClassnameIs( pev, "monster_rosenberg" ) )
{
m_szGrp[TLK_ANSWER] = "RO_ANSWER";
@ -699,6 +715,7 @@ void CScientist::TalkInit()
m_szGrp[TLK_MORTAL] = "RO_MORTAL";
}
else
#endif // MOBILE_HACKS
{
m_szGrp[TLK_ANSWER] = "SC_ANSWER";
m_szGrp[TLK_QUESTION] = "SC_QUESTION";
@ -746,7 +763,9 @@ int CScientist::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, flo
{
if( pevInflictor && pevInflictor->flags & FL_CLIENT )
{
#ifdef MOBILE_HACKS
if( !FClassnameIs( pev, "monster_rosenberg" ) )
#endif // MOBILE_HACKS
{
Remember( bits_MEMORY_PROVOKED );
StopFollowing( TRUE );
@ -781,6 +800,7 @@ void CScientist::PainSound( void )
m_painTime = gpGlobals->time + RANDOM_FLOAT( 0.5f, 0.75f );
#ifdef MOBILE_HACKS
if( FClassnameIs( pev, "monster_rosenberg" ) )
switch( RANDOM_LONG( 0, 8 ) )
{
@ -813,6 +833,7 @@ void CScientist::PainSound( void )
break;
}
else
#endif // MOBILE_HACKS
switch( RANDOM_LONG( 0, 4 ) )
{
case 0:
@ -992,7 +1013,11 @@ Schedule_t *CScientist::GetSchedule( void )
}
return GetScheduleOfType( SCHED_TARGET_FACE ); // Just face and follow.
}
#ifdef MOBILE_HACKS
else if( !FClassnameIs( pev, "monster_rosenberg" ) ) // UNDONE: When afraid, scientist won't move out of your way. Keep This? If not, write move away scared
#else // MOBILE_HACKS
else
#endif // MOBILE_HACKS
{
if( HasConditions( bits_COND_NEW_ENEMY ) ) // I just saw something new and scary, react
return GetScheduleOfType( SCHED_FEAR ); // React to something scary

View File

@ -373,6 +373,7 @@ void CCineMonster::PossessEntity( void )
}
}
#ifdef MOBILE_HACKS
//
// Fix a bug where barney would not run to the osprey on map 7.
//
@ -398,6 +399,7 @@ void CCineMonster::PossessEntity( void )
}
}
}
#endif // MOBILE_HACKS
}
}

View File

@ -126,7 +126,9 @@ float CHalfLifeRules::FlPlayerFallDamage( CBasePlayer *pPlayer )
//=========================================================
void CHalfLifeRules::PlayerSpawn( CBasePlayer *pPlayer )
{
#ifdef MOBILE_HACKS
pPlayer->GiveNamedItem( "item_suit" );
#endif // MOBILE_HACKS
}
//=========================================================

View File

@ -78,7 +78,10 @@ struct skilldata_t
float nihilanthHealth;
float nihilanthZap;
#ifdef MOBILE_HACKS
// Absolute Redemption
float royHealth;
#endif // MOBILE_HACKS
float scientistHealth;

View File

@ -13,6 +13,7 @@
*
****/
#ifdef MOBILE_HACKS
#include "extdll.h"
#include "util.h"
#include "cbase.h"
@ -141,3 +142,4 @@ void CDeadCivScientist::Spawn()
// pev->skin += 2; // use bloody skin -- UNDONE: Turn this back on when we have a bloody skin again!
MonsterInitDead();
}
#endif // MOBILE_HACKS

View File

@ -2039,6 +2039,7 @@ void CTriggerGravity::GravityTouch( CBaseEntity *pOther )
pOther->pev->gravity = pev->gravity;
}
#ifdef MOBILE_HACKS
class CTriggerPlayerFreeze : public CBaseDelay
{
public:
@ -2058,6 +2059,7 @@ void CTriggerPlayerFreeze::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, U
else
( (CBasePlayer*)( pActivator ) )->EnableControl( FALSE );
};
#endif // MOBILE_HACKS
// this is a really bad idea.
class CTriggerChangeTarget : public CBaseDelay

View File

@ -296,8 +296,10 @@ void W_Precache( void )
// common world objects
UTIL_PrecacheOther( "item_suit" );
UTIL_PrecacheOther( "item_healthkit" );
#ifdef MOBILE_HACKS
UTIL_PrecacheOther( "item_armorvest" );
UTIL_PrecacheOther( "item_helmet" );
#endif // MOBILE_HACKS
UTIL_PrecacheOther( "item_battery" );
UTIL_PrecacheOther( "item_antidote" );
UTIL_PrecacheOther( "item_security" );

View File

@ -81,7 +81,10 @@ public:
#define WEAPON_ALLWEAPONS (~(1<<WEAPON_SUIT))
#ifdef MOBILE_HACKS
#define WEAPON_FLASHLIGHT 30
#endif // MOBILE_HACKS
#define WEAPON_SUIT 31 // ?????
#define MAX_WEAPONS 32