Browse Source

Merge pull request #95 from FreeSlave/opfor-update

Opfor update
opforfixed
Andrey Akhmichin 5 years ago committed by GitHub
parent
commit
b669960b49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 53
      dlls/gearbox/fgrunt.cpp
  2. 11
      dlls/gearbox/generic_items.cpp

53
dlls/gearbox/fgrunt.cpp

@ -163,6 +163,7 @@ public:
// Override these to set behavior // Override these to set behavior
Schedule_t *GetScheduleOfType ( int Type ); Schedule_t *GetScheduleOfType ( int Type );
Schedule_t *GetSchedule ( void ); Schedule_t *GetSchedule ( void );
Schedule_t *PrioritizedSchedule();
MONSTERSTATE GetIdealState ( void ); MONSTERSTATE GetIdealState ( void );
void AlertSound( void ); void AlertSound( void );
@ -2619,8 +2620,27 @@ void CHFGrunt :: SetActivity ( Activity NewActivity )
// monster's member function to get a pointer to a schedule // monster's member function to get a pointer to a schedule
// of the proper type. // of the proper type.
//========================================================= //=========================================================
Schedule_t *CHFGrunt :: GetSchedule ( void ) Schedule_t* CHFGrunt::PrioritizedSchedule()
{ {
// flying? If PRONE, barnacle has me. IF not, it's assumed I am rapelling.
if ( pev->movetype == MOVETYPE_FLY && m_MonsterState != MONSTERSTATE_PRONE )
{
if (pev->flags & FL_ONGROUND)
{
// just landed
pev->movetype = MOVETYPE_STEP;
return GetScheduleOfType ( SCHED_HGRUNT_ALLY_REPEL_LAND );
}
else
{
// repel down a rope,
if ( m_MonsterState == MONSTERSTATE_COMBAT )
return GetScheduleOfType ( SCHED_HGRUNT_ALLY_REPEL_ATTACK );
else
return GetScheduleOfType ( SCHED_HGRUNT_ALLY_REPEL );
}
}
// grunts place HIGH priority on running away from danger sounds. // grunts place HIGH priority on running away from danger sounds.
if ( HasConditions(bits_COND_HEAR_SOUND) ) if ( HasConditions(bits_COND_HEAR_SOUND) )
{ {
@ -2649,24 +2669,15 @@ Schedule_t *CHFGrunt :: GetSchedule ( void )
} }
} }
} }
// flying? If PRONE, barnacle has me. IF not, it's assumed I am rapelling. return NULL;
if ( pev->movetype == MOVETYPE_FLY && m_MonsterState != MONSTERSTATE_PRONE ) }
{
if (pev->flags & FL_ONGROUND) Schedule_t *CHFGrunt :: GetSchedule ( void )
{ {
// just landed Schedule_t* prioritizedSchedule = PrioritizedSchedule();
pev->movetype = MOVETYPE_STEP; if (prioritizedSchedule)
return GetScheduleOfType ( SCHED_HGRUNT_ALLY_REPEL_LAND ); return prioritizedSchedule;
}
else
{
// repel down a rope,
if ( m_MonsterState == MONSTERSTATE_COMBAT )
return GetScheduleOfType ( SCHED_HGRUNT_ALLY_REPEL_ATTACK );
else
return GetScheduleOfType ( SCHED_HGRUNT_ALLY_REPEL );
}
}
if ( HasConditions( bits_COND_ENEMY_DEAD ) && FOkToSpeak() ) if ( HasConditions( bits_COND_ENEMY_DEAD ) && FOkToSpeak() )
{ {
PlaySentence( "FG_KILL", 4, VOL_NORM, ATTN_NORM ); PlaySentence( "FG_KILL", 4, VOL_NORM, ATTN_NORM );
@ -3617,6 +3628,10 @@ Schedule_t *CMedic::GetSchedule()
if (m_fHealing) { if (m_fHealing) {
StopHealing(); StopHealing();
} }
Schedule_t* prioritizedSchedule = PrioritizedSchedule();
if (prioritizedSchedule)
return prioritizedSchedule;
if ( FBitSet( pev->weapons, MEDIC_EAGLE|MEDIC_HANDGUN ) && if ( FBitSet( pev->weapons, MEDIC_EAGLE|MEDIC_HANDGUN ) &&
(GetBodygroup(MEDIC_GUN_GROUP) == MEDIC_GUN_NEEDLE || GetBodygroup(MEDIC_GUN_GROUP) == MEDIC_GUN_NONE)) { (GetBodygroup(MEDIC_GUN_GROUP) == MEDIC_GUN_NEEDLE || GetBodygroup(MEDIC_GUN_GROUP) == MEDIC_GUN_NONE)) {
return slMedicDrawGun; return slMedicDrawGun;

11
dlls/gearbox/generic_items.cpp

@ -21,6 +21,8 @@
//========================================================= //=========================================================
// Generic item // Generic item
//========================================================= //=========================================================
#define SF_ITEM_GENERIC_DROP_TO_FLOOR 1
class CItemGeneric : public CBaseAnimating class CItemGeneric : public CBaseAnimating
{ {
public: public:
@ -62,6 +64,15 @@ void CItemGeneric::Spawn(void)
// Call startup sequence to look for a sequence to play. // Call startup sequence to look for a sequence to play.
SetThink(&CItemGeneric::StartupThink); SetThink(&CItemGeneric::StartupThink);
pev->nextthink = gpGlobals->time + 0.1f; pev->nextthink = gpGlobals->time + 0.1f;
if (FBitSet(pev->spawnflags, SF_ITEM_GENERIC_DROP_TO_FLOOR))
{
if( DROP_TO_FLOOR(ENT( pev ) ) == 0 )
{
ALERT(at_error, "Item %s fell out of level at %f,%f,%f\n", STRING( pev->classname ), pev->origin.x, pev->origin.y, pev->origin.z);
UTIL_Remove( this );
}
}
} }
void CItemGeneric::Precache(void) void CItemGeneric::Precache(void)

Loading…
Cancel
Save