Browse Source

Fix monster_otis (#5)

* Fix monster_otis

* Remove unneeded (and wrong) save-restore for otis
opforfixed
Roman Chistokhodov 7 years ago committed by Andrey Akhmichin
parent
commit
cb93c40380
  1. 41
      dlls/gearbox/otis.cpp

41
dlls/gearbox/otis.cpp

@ -49,9 +49,9 @@
#define OTIS_AE_SHOOT ( 3 ) #define OTIS_AE_SHOOT ( 3 )
#define OTIS_AE_HOLSTER ( 4 ) #define OTIS_AE_HOLSTER ( 4 )
#define OTIS_BODY_GUNHOLSTERED 0 #define OTIS_BODY_GUNHOLSTERED 0
#define OTIS_BODY_GUNDRAWN 1 #define OTIS_BODY_GUNDRAWN 1
#define OTIS_BODY_GUNGONE 2 #define OTIS_BODY_DONUT 2
class COtis : public CBarney class COtis : public CBarney
{ {
@ -77,24 +77,12 @@ public:
void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType); void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType);
void Killed(entvars_t *pevAttacker, int iGib); void Killed(entvars_t *pevAttacker, int iGib);
virtual int Save(CSave &save);
virtual int Restore(CRestore &restore);
static TYPEDESCRIPTION m_SaveData[];
BOOL m_fSuspicious;
int head; int head;
int bodystate;
}; };
LINK_ENTITY_TO_CLASS(monster_otis, COtis); LINK_ENTITY_TO_CLASS(monster_otis, COtis);
TYPEDESCRIPTION COtis::m_SaveData[] =
{
DEFINE_FIELD(COtis, m_fSuspicious, FIELD_INTEGER),
DEFINE_FIELD(COtis, head, FIELD_INTEGER),
};
IMPLEMENT_SAVERESTORE(COtis, CTalkMonster);
//========================================================= //=========================================================
// ALertSound - otis says "Freeze!" // ALertSound - otis says "Freeze!"
//========================================================= //=========================================================
@ -209,6 +197,15 @@ void COtis::Spawn()
SetBodygroup(HEAD_GROUP, head); SetBodygroup(HEAD_GROUP, head);
} }
if (bodystate == -1)
{
SetBodygroup(GUN_GROUP, RANDOM_LONG(OTIS_BODY_GUNHOLSTERED, OTIS_BODY_GUNDRAWN)); // don't random donut
}
else
{
SetBodygroup(GUN_GROUP, bodystate);
}
MonsterInit(); MonsterInit();
SetUse(&COtis::FollowerUse); SetUse(&COtis::FollowerUse);
} }
@ -346,20 +343,20 @@ void COtis::TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, T
ptr->iHitgroup = HITGROUP_HEAD; ptr->iHitgroup = HITGROUP_HEAD;
break; break;
default: default:
CBarney::TraceAttack(pevAttacker, flDamage, vecDir, ptr, bitsDamageType);
break; break;
} }
CTalkMonster::TraceAttack(pevAttacker, flDamage, vecDir, ptr, bitsDamageType);
} }
void COtis::Killed(entvars_t *pevAttacker, int iGib) void COtis::Killed(entvars_t *pevAttacker, int iGib)
{ {
if (pev->body < OTIS_BODY_GUNGONE) if (GetBodygroup(GUN_GROUP) != OTIS_BODY_GUNHOLSTERED)
{// drop the gun! {// drop the gun!
Vector vecGunPos; Vector vecGunPos;
Vector vecGunAngles; Vector vecGunAngles;
pev->body = OTIS_BODY_GUNGONE; SetBodygroup(GUN_GROUP, OTIS_BODY_GUNHOLSTERED);
GetAttachment(0, vecGunPos, vecGunAngles); GetAttachment(0, vecGunPos, vecGunAngles);
@ -367,7 +364,7 @@ void COtis::Killed(entvars_t *pevAttacker, int iGib)
} }
SetUse(NULL); SetUse(NULL);
CBarney::Killed(pevAttacker, iGib); CTalkMonster::Killed(pevAttacker, iGib);
} }
//========================================================= //=========================================================
@ -439,10 +436,10 @@ public:
void KeyValue(KeyValueData *pkvd); void KeyValue(KeyValueData *pkvd);
int m_iPose;// which sequence to display -- temporary, don't need to save int m_iPose;// which sequence to display -- temporary, don't need to save
static char *m_szPoses[3]; static char *m_szPoses[5];
}; };
char *CDeadOtis::m_szPoses[] = { "lying_on_back", "lying_on_side", "lying_on_stomach" }; char *CDeadOtis::m_szPoses[] = { "lying_on_back", "lying_on_side", "lying_on_stomach", "stuffed_in_vent", "dead_sitting" };
void CDeadOtis::KeyValue(KeyValueData *pkvd) void CDeadOtis::KeyValue(KeyValueData *pkvd)
{ {

Loading…
Cancel
Save