Merge pull request #15 from FreeSlave/opfor_fixes

Opfor fixes
This commit is contained in:
Andrey Akhmichin 2018-03-21 09:17:49 +05:00 committed by GitHub
commit 23c4866391
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 92 additions and 52 deletions

View File

@ -639,10 +639,10 @@ void CDisplacer::Teleport( void )
if( !g_pGameRules->IsMultiplayer()) if( !g_pGameRules->IsMultiplayer())
{ {
m_pPlayer->m_fInXen = !m_pPlayer->m_fInXen; m_pPlayer->m_fInXen = !m_pPlayer->m_fInXen;
/*if (m_pPlayer->m_fInXen) if (m_pPlayer->m_fInXen)
m_pPlayer->pev->gravity = 0.5; m_pPlayer->pev->gravity = 0.5;
else else
m_pPlayer->pev->gravity = 1.0;*/ m_pPlayer->pev->gravity = 1.0;
} }
} }
else else

View File

@ -31,7 +31,8 @@ LINK_ENTITY_TO_CLASS(monster_shockroach, CShockRoach);
TYPEDESCRIPTION CShockRoach::m_SaveData[] = TYPEDESCRIPTION CShockRoach::m_SaveData[] =
{ {
DEFINE_FIELD(CShockRoach, m_flDie, FIELD_TIME), DEFINE_FIELD(CShockRoach, m_flBirthTime, FIELD_TIME),
DEFINE_FIELD(CShockRoach, m_fRoachSolid, FIELD_BOOLEAN),
}; };
IMPLEMENT_SAVERESTORE(CShockRoach, CHeadCrab); IMPLEMENT_SAVERESTORE(CShockRoach, CHeadCrab);
@ -75,7 +76,6 @@ void CShockRoach::Spawn()
Precache(); Precache();
SET_MODEL(ENT(pev), "models/w_shock_rifle.mdl"); SET_MODEL(ENT(pev), "models/w_shock_rifle.mdl");
UTIL_SetSize(pev, Vector(-12, -12, 0), Vector(12, 12, 24));
pev->solid = SOLID_SLIDEBOX; pev->solid = SOLID_SLIDEBOX;
pev->movetype = MOVETYPE_STEP; pev->movetype = MOVETYPE_STEP;
@ -87,7 +87,8 @@ void CShockRoach::Spawn()
m_flFieldOfView = 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result ) m_flFieldOfView = 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result )
m_MonsterState = MONSTERSTATE_NONE; m_MonsterState = MONSTERSTATE_NONE;
m_flDie = gpGlobals->time + RANDOM_LONG(10, 15); m_fRoachSolid = 0;
m_flBirthTime = gpGlobals->time;
MonsterInit(); MonsterInit();
} }
@ -152,7 +153,12 @@ void CShockRoach::LeapTouch(CBaseEntity *pOther)
void CShockRoach::PrescheduleThink(void) void CShockRoach::PrescheduleThink(void)
{ {
// explode when ready // explode when ready
if (gpGlobals->time >= m_flDie) if (!m_fRoachSolid && m_flBirthTime + 0.2 >= gpGlobals->time) {
m_fRoachSolid = TRUE;
UTIL_SetSize(pev, Vector(-12, -12, 0), Vector(12, 12, 24));
}
// explode when ready
if (gpGlobals->time >= m_flBirthTime + gSkillData.sroachLifespan)
{ {
pev->health = -1; pev->health = -1;
Killed(pev, 0); Killed(pev, 0);

View File

@ -44,8 +44,9 @@ public:
static const char *pDeathSounds[]; static const char *pDeathSounds[];
static const char *pBiteSounds[]; static const char *pBiteSounds[];
float m_flDie; float m_flBirthTime;
BOOL m_fRoachSolid;
}; };
#endif // SHOCKROACH_H #endif // SHOCKROACH_H

View File

@ -92,7 +92,7 @@ int CSporelauncher::AddToPlayer(CBasePlayer *pPlayer)
int CSporelauncher::GetItemInfo(ItemInfo *p) int CSporelauncher::GetItemInfo(ItemInfo *p)
{ {
p->pszName = STRING(pev->classname); p->pszName = STRING(pev->classname);
p->pszAmmo1 = "spores"; p->pszAmmo1 = "Spores";
p->iMaxAmmo1 = SPORE_MAX_CARRY; p->iMaxAmmo1 = SPORE_MAX_CARRY;
p->pszAmmo2 = NULL; p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1; p->iMaxAmmo2 = -1;
@ -407,4 +407,4 @@ class CSporeAmmo : public CBasePlayerAmmo
} }
}; };
LINK_ENTITY_TO_CLASS(ammo_spore, CSporeAmmo); LINK_ENTITY_TO_CLASS(ammo_spore, CSporeAmmo);

View File

@ -112,6 +112,7 @@ class CStrooper : public CHGrunt
{ {
public: public:
void Spawn(void); void Spawn(void);
void MonsterThink();
void Precache(void); void Precache(void);
int Classify(void); int Classify(void);
void HandleAnimEvent(MonsterEvent_t *pEvent); void HandleAnimEvent(MonsterEvent_t *pEvent);
@ -134,6 +135,9 @@ public:
static TYPEDESCRIPTION m_SaveData[]; static TYPEDESCRIPTION m_SaveData[];
BOOL m_fRightClaw; BOOL m_fRightClaw;
float m_rechargeTime;
float m_blinkTime;
float m_eyeChangeTime;
static const char *pGruntSentences[]; static const char *pGruntSentences[];
}; };
@ -143,6 +147,9 @@ LINK_ENTITY_TO_CLASS(monster_shocktrooper, CStrooper);
TYPEDESCRIPTION CStrooper::m_SaveData[] = TYPEDESCRIPTION CStrooper::m_SaveData[] =
{ {
DEFINE_FIELD(CStrooper, m_fRightClaw, FIELD_BOOLEAN), DEFINE_FIELD(CStrooper, m_fRightClaw, FIELD_BOOLEAN),
DEFINE_FIELD(CStrooper, m_rechargeTime, FIELD_TIME),
DEFINE_FIELD(CStrooper, m_blinkTime, FIELD_TIME),
DEFINE_FIELD(CStrooper, m_eyeChangeTime, FIELD_TIME),
}; };
IMPLEMENT_SAVERESTORE(CStrooper, CHGrunt); IMPLEMENT_SAVERESTORE(CStrooper, CHGrunt);
@ -336,41 +343,38 @@ void CStrooper::HandleAnimEvent(MonsterEvent_t *pEvent)
case STROOPER_AE_BURST1: case STROOPER_AE_BURST1:
{ {
//Shoot();
Vector vecGunPos;
Vector vecGunAngles;
GetAttachment(0, vecGunPos, vecGunAngles);
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecGunPos );
WRITE_BYTE( TE_SPRITE );
WRITE_COORD( vecGunPos.x ); // pos
WRITE_COORD( vecGunPos.y );
WRITE_COORD( vecGunPos.z );
WRITE_SHORT( iStrooperMuzzleFlash ); // model
WRITE_BYTE( 4 ); // size * 10
WRITE_BYTE( 196 ); // brightness
MESSAGE_END();
if (m_hEnemy) if (m_hEnemy)
{ {
vecGunAngles = (m_hEnemy->EyePosition() - vecGunPos).Normalize(); Vector vecGunPos;
Vector vecGunAngles;
GetAttachment(0, vecGunPos, vecGunAngles);
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecGunPos );
WRITE_BYTE( TE_SPRITE );
WRITE_COORD( vecGunPos.x ); // pos
WRITE_COORD( vecGunPos.y );
WRITE_COORD( vecGunPos.z );
WRITE_SHORT( iStrooperMuzzleFlash ); // model
WRITE_BYTE( 4 ); // size * 10
WRITE_BYTE( 128 ); // brightness
MESSAGE_END();
Vector vecShootOrigin = GetGunPosition();
Vector vecShootDir = ShootAtEnemy( vecShootOrigin );
vecGunAngles = UTIL_VecToAngles(vecShootDir);
CBaseEntity *pShock = CBaseEntity::Create("shock_beam", vecShootOrigin, vecGunAngles, edict());
vecGunAngles.z += RANDOM_FLOAT( -0.05, 0 );
pShock->pev->velocity = vecShootDir * 2000;
pShock->pev->nextthink = gpGlobals->time;
m_cAmmoLoaded--;
SetBlending( 0, vecGunAngles.x );
// Play fire sound.
EMIT_SOUND(ENT(pev), CHAN_WEAPON, "weapons/shock_fire.wav", 1, ATTN_NORM);
CSoundEnt::InsertSound(bits_SOUND_COMBAT, pev->origin, 384, 0.3);
} }
else
{
vecGunAngles = (m_vecEnemyLKP - vecGunPos).Normalize();
}
CBaseEntity *pShock = CBaseEntity::Create("shock_beam", vecGunPos, pev->angles, edict());
vecGunAngles.z += RANDOM_FLOAT( -0.05, 0 );
pShock->pev->velocity = vecGunAngles * 2000;
pShock->pev->nextthink = gpGlobals->time;
// Play fire sound.
EMIT_SOUND(ENT(pev), CHAN_WEAPON, "weapons/shock_fire.wav", 1, ATTN_NORM);
CSoundEnt::InsertSound(bits_SOUND_COMBAT, pev->origin, 384, 0.3);
} }
break; break;
@ -419,13 +423,13 @@ void CStrooper::Spawn()
Precache(); Precache();
SET_MODEL(ENT(pev), "models/strooper.mdl"); SET_MODEL(ENT(pev), "models/strooper.mdl");
UTIL_SetSize(pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX); UTIL_SetSize( pev, Vector(-24, -24, 0), Vector(24, 24, 72) );
pev->solid = SOLID_SLIDEBOX; pev->solid = SOLID_SLIDEBOX;
pev->movetype = MOVETYPE_STEP; pev->movetype = MOVETYPE_STEP;
m_bloodColor = BLOOD_COLOR_GREEN; m_bloodColor = BLOOD_COLOR_GREEN;
pev->effects = 0; pev->effects = 0;
pev->health = gSkillData.strooperHealth; pev->health = gSkillData.strooperHealth * 2.5;
m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result ) m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result )
m_MonsterState = MONSTERSTATE_NONE; m_MonsterState = MONSTERSTATE_NONE;
m_flNextGrenadeCheck = gpGlobals->time + 1; m_flNextGrenadeCheck = gpGlobals->time + 1;
@ -445,17 +449,46 @@ void CStrooper::Spawn()
pev->weapons = STROOPER_SHOCKRIFLE | STROOPER_HANDGRENADE; pev->weapons = STROOPER_SHOCKRIFLE | STROOPER_HANDGRENADE;
} }
m_cClipSize = SHOCKRIFLE_MAX_CLIP; m_cClipSize = gSkillData.strooperMaxCharge;
m_cAmmoLoaded = m_cClipSize; m_cAmmoLoaded = m_cClipSize;
m_fRightClaw = FALSE; m_fRightClaw = FALSE;
CTalkMonster::g_talkWaitTime = 0; CTalkMonster::g_talkWaitTime = 0;
m_rechargeTime = gpGlobals->time + gSkillData.strooperRchgSpeed;
m_blinkTime = gpGlobals->time + RANDOM_FLOAT(3.0f, 7.0f);
MonsterInit(); MonsterInit();
} }
void CStrooper::MonsterThink()
{
if (m_cAmmoLoaded < m_cClipSize)
{
if (m_rechargeTime < gpGlobals->time)
{
m_cAmmoLoaded++;
m_rechargeTime = gpGlobals->time + gSkillData.strooperRchgSpeed;
}
}
if (m_blinkTime <= gpGlobals->time && pev->skin == 0) {
pev->skin = 1;
m_blinkTime = gpGlobals->time + RANDOM_FLOAT(3.0f, 7.0f);
m_eyeChangeTime = gpGlobals->time + 0.1;
}
if (pev->skin != 0) {
if (m_eyeChangeTime <= gpGlobals->time) {
m_eyeChangeTime = gpGlobals->time + 0.1;
pev->skin++;
if (pev->skin > 3) {
pev->skin = 0;
}
}
}
CHGrunt::MonsterThink();
}
//========================================================= //=========================================================
// Precache - precaches all resources this monster needs // Precache - precaches all resources this monster needs
//========================================================= //=========================================================

View File

@ -1132,7 +1132,7 @@ void CBasePlayer::TabulateAmmo()
ammo_556 = AmmoInventory( GetAmmoIndex( "556" ) ); ammo_556 = AmmoInventory( GetAmmoIndex( "556" ) );
ammo_762 = AmmoInventory( GetAmmoIndex( "762" ) ); ammo_762 = AmmoInventory( GetAmmoIndex( "762" ) );
ammo_shocks = AmmoInventory( GetAmmoIndex( "Shocks" ) ); ammo_shocks = AmmoInventory( GetAmmoIndex( "Shocks" ) );
ammo_spores = AmmoInventory( GetAmmoIndex( "Spore" ) ); ammo_spores = AmmoInventory( GetAmmoIndex( "Spores" ) );
} }
/* /*

View File

@ -337,11 +337,11 @@ void CTentacle::KeyValue( KeyValueData *pkvd )
int CTentacle::Level( float dz ) int CTentacle::Level( float dz )
{ {
if( dz < 216 ) if( dz < 96 )
return 0; return 0;
if( dz < 408 ) if( dz < 150 )
return 1; return 1;
if( dz < 600 ) if( dz < 288 )
return 2; return 2;
return 3; return 3;
} }
@ -351,11 +351,11 @@ float CTentacle::MyHeight()
switch( MyLevel() ) switch( MyLevel() )
{ {
case 1: case 1:
return 256; return 136;
case 2: case 2:
return 448; return 190;
case 3: case 3:
return 640; return 328;
} }
return 0; return 0;
} }