Skip to content

Commit

Permalink
Revert Gonome changes
Browse files Browse the repository at this point in the history
  • Loading branch information
RedSprend committed Dec 1, 2024
1 parent df6c1bd commit e9bff14
Showing 1 changed file with 2 additions and 133 deletions.
135 changes: 2 additions & 133 deletions dlls/monster/CGonome.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class CGonome : public CBaseMonster
BOOL CheckRangeAttack1(float flDot, float flDist);
int LookupActivity(int activity);
void Killed(entvars_t* pevAttacker, int iGib);
Schedule_t* GetSchedule(void);
Schedule_t* GetScheduleOfType(int Type);
void MonsterThink(void);
const char* GetDeathNoticeWeapon() { return "weapon_crowbar"; }
Expand Down Expand Up @@ -149,51 +148,6 @@ const char* CGonome::pEventSounds[] =
"bullchicken/bc_spithit2.wav",
};

// Melee attack schedule
Task_t tlGonomeMeleeAttack1[] =
{
{ TASK_STOP_MOVING, (float)0 },
{ TASK_FACE_ENEMY, (float)0 },
{ TASK_MELEE_ATTACK1, (float)0 },
};

Schedule_t slGonomeMeleeAttack1[] =
{
{
tlGonomeMeleeAttack1,
ARRAYSIZE(tlGonomeMeleeAttack1),
bits_COND_NEW_ENEMY |
bits_COND_ENEMY_DEAD |
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE |
bits_COND_ENEMY_OCCLUDED,
0,
"Gonome Melee Attack1"
},
};

Task_t tlGonomeMeleeAttack2[] =
{
{ TASK_STOP_MOVING, (float)0 },
{ TASK_FACE_ENEMY, (float)0 },
{ TASK_MELEE_ATTACK2, (float)0 },
};

Schedule_t slGonomeMeleeAttack2[] =
{
{
tlGonomeMeleeAttack2,
ARRAYSIZE(tlGonomeMeleeAttack2),
bits_COND_NEW_ENEMY |
bits_COND_ENEMY_DEAD |
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE |
bits_COND_ENEMY_OCCLUDED,
0,
"Gonome Melee Attack2"
},
};

// Chase enemy schedule
Task_t tlGonomeChaseEnemy1[] =
{
Expand Down Expand Up @@ -223,8 +177,6 @@ Schedule_t slGonomeChaseEnemy[] =

DEFINE_CUSTOM_SCHEDULES(CGonome)
{
slGonomeMeleeAttack1,
slGonomeMeleeAttack2,
slGonomeChaseEnemy
};

Expand Down Expand Up @@ -290,9 +242,6 @@ void CGonome:: HandleAnimEvent( MonsterEvent_t *pEvent )
}
else // Play a random attack miss sound
EMIT_SOUND_DYN(ENT(pev), CHAN_WEAPON, RANDOM_SOUND_ARRAY(pAttackMissSounds), 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-5, 5));

m_flNextAttack = gpGlobals->time + 0.2;

break;
}
case GONOME_EVENT_GRAB_BLOOD:
Expand Down Expand Up @@ -399,7 +348,7 @@ void CGonome::Precache()

BOOL CGonome::CheckMeleeAttack1(float flDot, float flDist)
{
if (flDist <= MELEE_ATTACK1_DISTANCE && m_flNextAttack < gpGlobals->time) {
if (flDist <= MELEE_ATTACK1_DISTANCE) {
if (flDist <= GONOME_MELEE_ATTACK2_DISTANCE) {
SetConditions(bits_COND_CAN_MELEE_ATTACK2);
}
Expand Down Expand Up @@ -430,57 +379,9 @@ void CGonome::Killed(entvars_t* pevAttacker, int iGib)
CBaseMonster::Killed(pevAttacker, iGib);
}

Schedule_t *CGonome::GetSchedule( void )
{
switch( m_MonsterState )
{
case MONSTERSTATE_COMBAT:
{
if( HasConditions( bits_COND_ENEMY_DEAD ) )
{
// call base class, all code to handle dead enemies is centralized there.
return CBaseMonster::GetSchedule();
}

if( HasConditions( bits_COND_HEAVY_DAMAGE ) )
return GetScheduleOfType( SCHED_TAKE_COVER_FROM_ENEMY );

pev->movetype = MOVETYPE_STEP;

if( m_hEnemy && m_hEnemy->pev->velocity == g_vecZero )
{
float flDistToEnemy = (pev->origin - m_hEnemy->pev->origin).Length();

if( flDistToEnemy < 64 )
{
if( HasConditions( bits_COND_CAN_MELEE_ATTACK2 ) )
return GetScheduleOfType( SCHED_MELEE_ATTACK2 );
else if( HasConditions( bits_COND_CAN_MELEE_ATTACK1 ) )
return GetScheduleOfType( SCHED_MELEE_ATTACK1 );
}
}

if( !HasConditions( bits_COND_CAN_RANGE_ATTACK1 ) )
return GetScheduleOfType( SCHED_CHASE_ENEMY );
else
return CBaseMonster::GetSchedule();

break;
}
}

return CBaseMonster::GetSchedule();
}

Schedule_t* CGonome::GetScheduleOfType(int Type) {
m_nextBloodSound = 0;

if (Type == SCHED_MELEE_ATTACK1 ) {
return &slGonomeMeleeAttack1[0];
}
if (Type == SCHED_MELEE_ATTACK2 ) {
return &slGonomeMeleeAttack2[0];
}
if (Type == SCHED_CHASE_ENEMY) {
return &slGonomeChaseEnemy[0];
}
Expand All @@ -504,38 +405,6 @@ void CGonome::MonsterThink(void) {
}

CBaseMonster::MonsterThink();

//This if block handles the attack whilst moving functionality by forcing gaitsequences
if( m_pSchedule == GetScheduleOfType( SCHED_CHASE_ENEMY ) )
{
if( m_hEnemy )
{
float flDistToEnemy = (pev->origin - m_hEnemy->pev->origin).Length();

if( pev->gaitsequence != 1 )
pev->gaitsequence = 1;

if( flDistToEnemy <= MELEE_ATTACK1_DISTANCE && FInViewCone(m_hEnemy) && m_flNextAttack < gpGlobals->time )
{
if( HasConditions( bits_COND_CAN_MELEE_ATTACK2 ) )
{
if( pev->sequence != LookupSequence("attack2") )
{
pev->sequence = LookupSequence("attack2");
pev->gaitsequence = 1;
}
}
else if( HasConditions( bits_COND_CAN_MELEE_ATTACK1 ) )
{
if( pev->sequence != LookupSequence("attack1") )
{
pev->sequence = LookupSequence("attack1");
pev->gaitsequence = 1;
}
}
}
}
}
}

// HACK
Expand Down Expand Up @@ -684,4 +553,4 @@ void CGonomeSpit::Touch(CBaseEntity* pOther)

SetThink(&CGonomeSpit::SUB_Remove);
pev->nextthink = gpGlobals->time;
}
}

0 comments on commit e9bff14

Please sign in to comment.