Night Owl
8 years ago
7 changed files with 283 additions and 77 deletions
@ -0,0 +1,93 @@ |
|||||||
|
/***
|
||||||
|
* |
||||||
|
* Copyright (c) 1996-2001, Valve LLC. All rights reserved. |
||||||
|
* |
||||||
|
* This product contains software technology licensed from Id |
||||||
|
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. |
||||||
|
* All Rights Reserved. |
||||||
|
* |
||||||
|
* This source code contains proprietary and confidential information of |
||||||
|
* Valve LLC and its suppliers. Access to this code is restricted to |
||||||
|
* persons who have executed a written SDK license with Valve. Any access, |
||||||
|
* use or distribution of this code by or to any unlicensed person is illegal. |
||||||
|
* |
||||||
|
****/ |
||||||
|
|
||||||
|
#ifndef SCIENTIST_H |
||||||
|
#define SCIENTIST_H |
||||||
|
|
||||||
|
|
||||||
|
#if defined ( TOT_DLL ) |
||||||
|
#define NUM_SCIENTIST_HEADS 4 // four heads available for scientist model
|
||||||
|
enum { HEAD_GLASSES = 0, HEAD_EINSTEIN = 1, HEAD_LUTHER = 2, HEAD_SLICK = 3 }; |
||||||
|
|
||||||
|
//=======================================================
|
||||||
|
// Scientist
|
||||||
|
//=======================================================
|
||||||
|
|
||||||
|
class CScientist : public CTalkMonster |
||||||
|
{ |
||||||
|
public: |
||||||
|
virtual void Spawn(void); |
||||||
|
virtual void Precache(void); |
||||||
|
|
||||||
|
void SetYawSpeed(void); |
||||||
|
int Classify(void); |
||||||
|
void HandleAnimEvent(MonsterEvent_t *pEvent); |
||||||
|
void RunTask(Task_t *pTask); |
||||||
|
void StartTask(Task_t *pTask); |
||||||
|
int ObjectCaps(void) { return CTalkMonster::ObjectCaps() | FCAP_IMPULSE_USE; } |
||||||
|
int TakeDamage(entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType); |
||||||
|
virtual int FriendNumber(int arrayNumber); |
||||||
|
void SetActivity(Activity newActivity); |
||||||
|
Activity GetStoppedActivity(void); |
||||||
|
int ISoundMask(void); |
||||||
|
void DeclineFollowing(void); |
||||||
|
|
||||||
|
float CoverRadius(void) { return 1200; } // Need more room for cover because scientists want to get far away!
|
||||||
|
BOOL DisregardEnemy(CBaseEntity *pEnemy) { return !pEnemy->IsAlive() || (gpGlobals->time - m_fearTime) > 15; } |
||||||
|
|
||||||
|
virtual BOOL CanHeal(void); |
||||||
|
void Heal(void); |
||||||
|
void Scream(void); |
||||||
|
|
||||||
|
// Override these to set behavior
|
||||||
|
Schedule_t *GetScheduleOfType(int Type); |
||||||
|
Schedule_t *GetSchedule(void); |
||||||
|
MONSTERSTATE GetIdealState(void); |
||||||
|
|
||||||
|
void DeathSound(void); |
||||||
|
void PainSound(void); |
||||||
|
|
||||||
|
void TalkInit(void); |
||||||
|
|
||||||
|
void Killed(entvars_t *pevAttacker, int iGib); |
||||||
|
|
||||||
|
virtual int Save(CSave &save); |
||||||
|
virtual int Restore(CRestore &restore); |
||||||
|
static TYPEDESCRIPTION m_SaveData[]; |
||||||
|
|
||||||
|
CUSTOM_SCHEDULES; |
||||||
|
|
||||||
|
private: |
||||||
|
float m_painTime; |
||||||
|
float m_healTime; |
||||||
|
float m_fearTime; |
||||||
|
}; |
||||||
|
|
||||||
|
//=========================================================
|
||||||
|
// Dead Scientist PROP
|
||||||
|
//=========================================================
|
||||||
|
class CDeadScientist : public CBaseMonster |
||||||
|
{ |
||||||
|
public: |
||||||
|
virtual void Spawn(void); |
||||||
|
int Classify(void) { return CLASS_HUMAN_PASSIVE; } |
||||||
|
|
||||||
|
void KeyValue(KeyValueData *pkvd); |
||||||
|
int m_iPose;// which sequence to display
|
||||||
|
static char *m_szPoses[7]; |
||||||
|
}; |
||||||
|
#endif // defined ( TOT_DLL )
|
||||||
|
|
||||||
|
#endif // SCIENTIST_H
|
@ -0,0 +1,143 @@ |
|||||||
|
/***
|
||||||
|
* |
||||||
|
* Copyright (c) 1996-2001, Valve LLC. All rights reserved. |
||||||
|
* |
||||||
|
* This product contains software technology licensed from Id |
||||||
|
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. |
||||||
|
* All Rights Reserved. |
||||||
|
* |
||||||
|
* This source code contains proprietary and confidential information of |
||||||
|
* Valve LLC and its suppliers. Access to this code is restricted to |
||||||
|
* persons who have executed a written SDK license with Valve. Any access, |
||||||
|
* use or distribution of this code by or to any unlicensed person is illegal. |
||||||
|
* |
||||||
|
****/ |
||||||
|
|
||||||
|
#include "extdll.h" |
||||||
|
#include "util.h" |
||||||
|
#include "cbase.h" |
||||||
|
#include "monsters.h" |
||||||
|
#include "talkmonster.h" |
||||||
|
#include "schedule.h" |
||||||
|
#include "defaultai.h" |
||||||
|
#include "scripted.h" |
||||||
|
#include "animation.h" |
||||||
|
#include "soundent.h" |
||||||
|
#include "scientist.h" |
||||||
|
|
||||||
|
class CCivScientist : public CScientist |
||||||
|
{ |
||||||
|
public: |
||||||
|
void Spawn(void); |
||||||
|
void Precache(void); |
||||||
|
|
||||||
|
BOOL CanHeal(void); |
||||||
|
}; |
||||||
|
|
||||||
|
LINK_ENTITY_TO_CLASS(monster_civ, CCivScientist); |
||||||
|
|
||||||
|
|
||||||
|
//=========================================================
|
||||||
|
// Spawn
|
||||||
|
//=========================================================
|
||||||
|
void CCivScientist::Spawn(void) |
||||||
|
{ |
||||||
|
Precache(); |
||||||
|
|
||||||
|
SET_MODEL(ENT(pev), "models/civ_sci.mdl"); |
||||||
|
UTIL_SetSize(pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX); |
||||||
|
|
||||||
|
pev->solid = SOLID_SLIDEBOX; |
||||||
|
pev->movetype = MOVETYPE_STEP; |
||||||
|
m_bloodColor = BLOOD_COLOR_RED; |
||||||
|
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
|
||||||
|
m_MonsterState = MONSTERSTATE_NONE; |
||||||
|
|
||||||
|
// m_flDistTooFar = 256.0;
|
||||||
|
|
||||||
|
m_afCapability = bits_CAP_HEAR | bits_CAP_TURN_HEAD | bits_CAP_OPEN_DOORS | bits_CAP_AUTO_DOORS | bits_CAP_USE; |
||||||
|
|
||||||
|
// White hands
|
||||||
|
pev->skin = 0; |
||||||
|
|
||||||
|
if (pev->body == -1) |
||||||
|
{// -1 chooses a random head
|
||||||
|
pev->body = RANDOM_LONG(0, NUM_SCIENTIST_HEADS - 1);// pick a head, any head
|
||||||
|
} |
||||||
|
|
||||||
|
// Luther is black, make his hands black
|
||||||
|
if (pev->body == HEAD_LUTHER) |
||||||
|
pev->skin = 1; |
||||||
|
|
||||||
|
MonsterInit(); |
||||||
|
SetUse(&CCivScientist::FollowerUse); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
//=========================================================
|
||||||
|
// Precache - precaches all resources this monster needs
|
||||||
|
//=========================================================
|
||||||
|
void CCivScientist::Precache(void) |
||||||
|
{ |
||||||
|
CScientist::Precache(); |
||||||
|
|
||||||
|
PRECACHE_MODEL("models/civ_sci.mdl"); |
||||||
|
} |
||||||
|
|
||||||
|
BOOL CCivScientist::CanHeal(void) |
||||||
|
{ |
||||||
|
return FALSE; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
//=========================================================
|
||||||
|
// Dead Scientist PROP
|
||||||
|
//=========================================================
|
||||||
|
class CDeadCivScientist : public CDeadScientist |
||||||
|
{ |
||||||
|
public: |
||||||
|
void Spawn(void); |
||||||
|
|
||||||
|
static char *m_szPoses[7]; |
||||||
|
}; |
||||||
|
|
||||||
|
char *CDeadCivScientist::m_szPoses[] = { "lying_on_back", "lying_on_stomach", "dead_sitting", "dead_hang", "dead_table1", "dead_table2", "dead_table3" }; |
||||||
|
|
||||||
|
LINK_ENTITY_TO_CLASS(monster_civ_dead, CDeadCivScientist); |
||||||
|
|
||||||
|
//
|
||||||
|
// ********** DeadScientist SPAWN **********
|
||||||
|
//
|
||||||
|
void CDeadCivScientist::Spawn() |
||||||
|
{ |
||||||
|
PRECACHE_MODEL("models/civ_sci.mdl"); |
||||||
|
SET_MODEL(ENT(pev), "models/civ_sci.mdl"); |
||||||
|
|
||||||
|
pev->effects = 0; |
||||||
|
pev->sequence = 0; |
||||||
|
// Corpses have less health
|
||||||
|
pev->health = 8;//gSkillData.scientistHealth;
|
||||||
|
|
||||||
|
m_bloodColor = BLOOD_COLOR_RED; |
||||||
|
|
||||||
|
if (pev->body == -1) |
||||||
|
{// -1 chooses a random head
|
||||||
|
pev->body = RANDOM_LONG(0, NUM_SCIENTIST_HEADS - 1);// pick a head, any head
|
||||||
|
} |
||||||
|
// Luther is black, make his hands black
|
||||||
|
if (pev->body == HEAD_LUTHER) |
||||||
|
pev->skin = 1; |
||||||
|
else |
||||||
|
pev->skin = 0; |
||||||
|
|
||||||
|
pev->sequence = LookupSequence(m_szPoses[m_iPose]); |
||||||
|
if (pev->sequence == -1) |
||||||
|
{ |
||||||
|
ALERT(at_console, "Dead scientist with bad pose\n"); |
||||||
|
} |
||||||
|
|
||||||
|
// pev->skin += 2; // use bloody skin -- UNDONE: Turn this back on when we have a bloody skin again!
|
||||||
|
MonsterInitDead(); |
||||||
|
} |
Loading…
Reference in new issue