Browse Source

Update fgrunts

opforfixed
Roman Chistokhodov 5 years ago
parent
commit
1fe1a7fcec
  1. 2
      dlls/CMakeLists.txt
  2. 2
      dlls/barney.cpp
  3. 22
      dlls/gamerules.cpp
  4. 5178
      dlls/gearbox/fgrunt.cpp
  5. 140
      dlls/gearbox/fgrunt.h
  6. 622
      dlls/gearbox/fgrunt_medic.cpp
  7. 59
      dlls/gearbox/fgrunt_torch.cpp
  8. 40
      dlls/gearbox/massn.cpp
  9. 18
      dlls/gearbox/otis.cpp
  10. 20
      dlls/hgrunt.cpp
  11. 7
      dlls/hgrunt.h
  12. 3
      dlls/schedule.h
  13. 8
      dlls/scientist.cpp
  14. 26
      dlls/skill.h
  15. 43
      dlls/talkmonster.cpp
  16. 12
      dlls/talkmonster.h

2
dlls/CMakeLists.txt

@ -47,8 +47,6 @@ set (SVDLL_SOURCES @@ -47,8 +47,6 @@ set (SVDLL_SOURCES
gearbox/displacer.cpp
gearbox/drillsergeant.cpp
gearbox/eagle.cpp
gearbox/fgrunt_medic.cpp
gearbox/fgrunt_torch.cpp
gearbox/fgrunt.cpp
gearbox/func_tank_of.cpp
# gearbox/gearbox_client.cpp

2
dlls/barney.cpp

@ -426,7 +426,7 @@ void CBarney::TalkInit() @@ -426,7 +426,7 @@ void CBarney::TalkInit()
m_voicePitch = 100;
}
static BOOL IsFacing( entvars_t *pevTest, const Vector &reference )
BOOL IsFacing( entvars_t *pevTest, const Vector &reference )
{
Vector vecDir = reference - pevTest->origin;
vecDir.z = 0;

22
dlls/gamerules.cpp

@ -237,21 +237,21 @@ void CGameRules::RefreshSkillData ( void ) @@ -237,21 +237,21 @@ void CGameRules::RefreshSkillData ( void )
gSkillData.pitdroneDmgSpit = GetSkillCvar( "sk_pitdrone_dmg_spit" );
// Hgrunt Ally
gSkillData.hgruntAllyHealth = GetSkillCvar( "sk_hgrunt_ally_health" );
gSkillData.hgruntAllyDmgKick = GetSkillCvar( "sk_hgrunt_ally_kick" );
gSkillData.hgruntAllyShotgunPellets = GetSkillCvar( "sk_hgrunt_ally_pellets" );
gSkillData.hgruntAllyGrenadeSpeed = GetSkillCvar( "sk_hgrunt_ally_gspeed" );
gSkillData.fgruntHealth = GetSkillCvar( "sk_hgrunt_ally_health" );
gSkillData.fgruntDmgKick = GetSkillCvar( "sk_hgrunt_ally_kick" );
gSkillData.fgruntShotgunPellets = GetSkillCvar( "sk_hgrunt_ally_pellets" );
gSkillData.fgruntGrenadeSpeed = GetSkillCvar( "sk_hgrunt_ally_gspeed" );
// Medic Ally
gSkillData.medicAllyHealth = GetSkillCvar( "sk_medic_ally_health" );
gSkillData.medicAllyDmgKick = GetSkillCvar( "sk_medic_ally_kick" );
gSkillData.medicAllyGrenadeSpeed = GetSkillCvar( "sk_medic_ally_gspeed" );
gSkillData.medicAllyHeal = GetSkillCvar( "sk_medic_ally_heal" );
gSkillData.medicHealth = GetSkillCvar( "sk_medic_ally_health" );
gSkillData.medicDmgKick = GetSkillCvar( "sk_medic_ally_kick" );
gSkillData.medicGrenadeSpeed = GetSkillCvar( "sk_medic_ally_gspeed" );
gSkillData.medicHeal = GetSkillCvar( "sk_medic_ally_heal" );
// Torch Ally
gSkillData.torchAllyHealth = GetSkillCvar( "sk_torch_ally_health" );
gSkillData.torchAllyDmgKick = GetSkillCvar( "sk_torch_ally_kick" );
gSkillData.torchAllyGrenadeSpeed = GetSkillCvar( "sk_torch_ally_gspeed" );
gSkillData.torchHealth = GetSkillCvar( "sk_torch_ally_health" );
gSkillData.torchDmgKick = GetSkillCvar( "sk_torch_ally_kick" );
gSkillData.torchGrenadeSpeed = GetSkillCvar( "sk_torch_ally_gspeed" );
// Male Assassin
gSkillData.massnHealth = GetSkillCvar( "sk_massassin_health" );

5178
dlls/gearbox/fgrunt.cpp

File diff suppressed because it is too large Load Diff

140
dlls/gearbox/fgrunt.h

@ -1,140 +0,0 @@ @@ -1,140 +0,0 @@
/***
*
* 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.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#ifndef FGRUNT_H
#define FGRUNT_H
//=========================================================
// CFGrunt
//=========================================================
class CFGrunt : public CTalkMonster
{
public:
#if 1
virtual void KeyValue(KeyValueData *pkvd);
#endif
void Spawn(void);
void Precache(void);
void SetYawSpeed(void);
int ISoundMask(void);
void AlertSound(void);
int Classify(void);
void HandleAnimEvent(MonsterEvent_t *pEvent);
void PrescheduleThink( void );
void RunTask(Task_t *pTask);
void StartTask(Task_t *pTask);
virtual int ObjectCaps(void) { return CTalkMonster::ObjectCaps() | FCAP_IMPULSE_USE; }
int TakeDamage(entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType);
BOOL FCanCheckAttacks(void);
BOOL CheckMeleeAttack1(float flDot, float flDist);
BOOL CheckRangeAttack1(float flDot, float flDist);
BOOL CheckRangeAttack2(float flDot, float flDist);
void DeclineFollowing(void);
// AI functions
void SetActivity(Activity newActivity);
// Override these to set behavior
Schedule_t *GetScheduleOfType(int Type);
Schedule_t *GetSchedule(void);
Schedule_t *GetSquadSchedule(void);
MONSTERSTATE GetIdealState(void);
void DeathSound(void);
void PainSound(void);
virtual void TalkInit(void);
void TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType);
void Killed(entvars_t *pevAttacker, int iGib);
#if 1
virtual BOOL IsMedic(void) const { return FALSE; }
virtual CBaseEntity* DropGun(const Vector& vecSrc, const Vector& vecAngles, char* szClassname = NULL);
void Fire(
const Vector& vecShootOrigin,
const Vector& vecShoorDir,
const Vector& vecSpread,
int model,
int effects = EF_MUZZLEFLASH,
int bulletType = BULLET_MONSTER_MP5,
int soundType = TE_BOUNCE_SHELL);
Vector GetGunPosition(void);
void Shoot(void);
void Shotgun(void);
void Saw(void);
virtual void GibMonster(void);
void SpeakSentence(void);
int IRelationship(CBaseEntity *pTarget);
virtual BOOL FOkToSpeak(void);
void JustSpoke(void);
CBaseEntity *Kick(void);
#endif
virtual int Save(CSave &save);
virtual int Restore(CRestore &restore);
static TYPEDESCRIPTION m_SaveData[];
float m_painTime;
float m_checkAttackTime;
BOOL m_lastAttackCheck;
// UNDONE: What is this for? It isn't used?
float m_flPlayerDamage;// how much pain has the player inflicted on me?
// checking the feasibility of a grenade toss is kind of costly, so we do it every couple of seconds,
// not every server frame.
float m_flNextGrenadeCheck;
float m_flNextPainTime;
float m_flLastEnemySightTime;
Vector m_vecTossVelocity;
BOOL m_fThrowGrenade;
BOOL m_fStanding;
BOOL m_fFirstEncounter;// only put on the handsign show in the squad's first encounter.
int m_cClipSize;
int m_voicePitch;
int m_iBrassShell;
int m_iShotgunShell;
int m_iSawShell;
int m_iSentence;
static const char *pGruntSentences[];
CUSTOM_SCHEDULES;
int head;
int torso;
};
#endif // FGRUNT_H

622
dlls/gearbox/fgrunt_medic.cpp

@ -1,622 +0,0 @@ @@ -1,622 +0,0 @@
/***
*
* 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.
*
****/
//=========================================================
// friendly grunt - medic
//=========================================================
// UNDONE: Holster weapon?
#include "extdll.h"
#include "plane.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "talkmonster.h"
#include "schedule.h"
#include "animation.h"
#include "weapons.h"
#include "talkmonster.h"
#include "soundent.h"
#include "effects.h"
#include "customentity.h"
#include "fgrunt.h"
extern int g_fGruntQuestion;
extern Schedule_t slIdleFgStand[];
extern Schedule_t slFgFaceTarget[];
//=========================================================
// monster-specific DEFINE's
//=========================================================
#define MGRUNT_CLIP_SIZE_EAGLE 7 // how many bullets in a clip? - NOTE: 3 round burst sound, so keep as 3 * x!
#define MGRUNT_CLIP_SIZE_9MMHANDGUN 17 // Same as above
#define MGRUNT_VOL 0.35 // volume of grunt sounds
#define MGRUNT_ATTN ATTN_NORM // attenutation of grunt sentences
#define MGRUNT_LIMP_HEALTH 20
#define MGRUNT_DMG_HEADSHOT ( DMG_BULLET | DMG_CLUB ) // damage types that can kill a grunt with a single headshot.
#define MGRUNT_NUM_HEADS 2 // how many grunt heads are there?
#define MGRUNT_MINIMUM_HEADSHOT_DAMAGE 15 // must do at least this much damage in one shot to head to score a headshot kill
#define MGRUNT_SENTENCE_VOLUME (float)0.35 // volume of grunt sentences
#define MGRUNT_MAX_HEALTH_RESTORE 10 // Maximum health restore. // 200
#define MGRUNT_EAGLE (1 << 0)
#define MGRUNT_9MMHANDGUN (1 << 1)
#define MGRUNT_NEEDLE (1 << 2)
#define HEAD_GROUP 2
#define GUN_GROUP 3
#define HEAD_WHITE 0
#define HEAD_BLACK 1
#define GUN_EAGLE 0
#define GUN_9MMHANDGUN 1
#define GUN_NEEDLE 2
#define GUN_NONE 3
//=========================================================
// Monster's Anim Events Go Here
//=========================================================
#define MGRUNT_AE_BURST1 ( 4 )
#define MGRUNT_AE_BURST2 ( 5 )
#define MGRUNT_AE_BURST3 ( 6 )
#define MGRUNT_AE_GUN_HOLSTER ( 15 )
#define MGRUNT_AE_NEEDLE_DRAW ( 16 )
#define MGRUNT_AE_NEEDLE_STORE ( 17 )
#define MGRUNT_AE_GUN_DRAW ( 18 )
static const char* g_pszDeathSounds[] =
{
"fgrunt/death1.wav",
"fgrunt/death2.wav",
"fgrunt/death3.wav",
"fgrunt/death4.wav",
"fgrunt/death5.wav",
"fgrunt/death6.wav",
};
static const char* g_pszPainSounds[] =
{
"fgrunt/pain1.wav",
"fgrunt/pain2.wav",
"fgrunt/pain3.wav",
"fgrunt/pain4.wav",
"fgrunt/pain5.wav",
"fgrunt/pain6.wav",
};
#define MGRUNT_NUM_DEATH_SOUNDS ARRAYSIZE( g_pszDeathSounds )
#define MGRUNT_NUM_PAIN_SOUNDS ARRAYSIZE( g_pszPainSounds )
/*
MGrunt animations.
*/
/*
pull_needle (23) ACT_SIGNAL3
store_needle (24) ACT_TWITCH
give_shot (25) ACT_COWER
heal_crouch (46) ACT_INSPECT_WALL
*/
class CMGrunt : public CFGrunt
{
public:
void TalkInit(void);
void Spawn(void);
void Precache(void);
void HandleAnimEvent(MonsterEvent_t* pEvent);
void RunTask(Task_t *pTask);
void StartTask(Task_t *pTask);
int Save(CSave &save);
int Restore(CRestore &restore);
static TYPEDESCRIPTION m_SaveData[];
BOOL IsMedic(void) const { return TRUE; }
CBaseEntity* DropGun(const Vector& vecSrc, const Vector& vecAngles, char* szClassname = NULL);
void FireEagle( void );
void FirePistol( void );
CUSTOM_SCHEDULES;
static const char *pMGruntSentences[];
int m_nHealthRestore;
};
LINK_ENTITY_TO_CLASS(monster_human_medic_ally, CMGrunt);
TYPEDESCRIPTION CMGrunt::m_SaveData[] =
{
DEFINE_FIELD(CMGrunt, m_nHealthRestore, FIELD_INTEGER),
};
IMPLEMENT_SAVERESTORE(CMGrunt, CTalkMonster);
//=========================================================
// monster-specific schedule types
//=========================================================
enum
{
SCHED_MGRUNT_FIRST_SCHEDULE = LAST_COMMON_SCHEDULE + 1,
SCHED_MGRUNT_HEAL_ALLY,
SCHED_MGRUNT_HEAL_PLAYER,
};
//=========================================================
// monster-specific tasks
//=========================================================
enum
{
TASK_MGRUNT_NEEDLE_PULL = LAST_COMMON_TASK + 1,
TASK_MGRUNT_NEEDLE_STORE,
TASK_MGRUNT_GIVE_SHOT,
};
//=========================================================
// Medic draws the needle
//=========================================================
Task_t tlMgNeedlePull[] =
{
{ TASK_STOP_MOVING, 0 },
{ TASK_FACE_TARGET, (float)0 },
{ TASK_SET_ACTIVITY, (float)ACT_SIGNAL3 },
};
Schedule_t slMgNeedlePull[] =
{
{
tlMgNeedlePull, // task array pointer.
ARRAYSIZE(tlMgNeedlePull), // task count
0, // COND interrupts (.i.e Light damage, heavy damage)
0, // soundmask (.i.e hear danger...)
"MGrunt Needle Pull" // name
}
};
//=========================================================
// Medic stores the needle
//=========================================================
Task_t tlMgNeedleStore[] =
{
{ TASK_STOP_MOVING, 0 },
{ TASK_FACE_TARGET, (float)0 },
{ TASK_SET_ACTIVITY, (float)ACT_TWITCH },
};
Schedule_t slMgNeedleStore[] =
{
{
tlMgNeedleStore,
ARRAYSIZE(tlMgNeedleStore),
0,
0,
"MGrunt Needle Store"
}
};
//=========================================================
// Medic gives a needle shot
//=========================================================
Task_t tlMgGiveShot[] =
{
{ TASK_STOP_MOVING, 0 },
{ TASK_FACE_TARGET, (float)0 },
{ TASK_SET_ACTIVITY, (float)ACT_COWER },
};
Schedule_t slMgGiveShot[] =
{
{
tlMgGiveShot,
ARRAYSIZE(tlMgGiveShot),
0,
0,
"MGrunt Give Shot"
}
};
//=========================================================
// Medic heals a target (crouched)
//=========================================================
Task_t tlMgHealCrouch[] =
{
{ TASK_STOP_MOVING, 0 },
{ TASK_FACE_TARGET, (float)0 },
{ TASK_SET_ACTIVITY, (float)ACT_INSPECT_WALL },
};
Schedule_t slMgHealCrouch[] =
{
{
tlMgHealCrouch,
ARRAYSIZE(tlMgHealCrouch),
0,
0,
"MGrunt Heal Crouch"
}
};
DEFINE_CUSTOM_SCHEDULES(CMGrunt)
{
slMgNeedlePull,
slMgNeedleStore,
slMgGiveShot,
};
IMPLEMENT_CUSTOM_SCHEDULES(CMGrunt, CFGrunt);
const char *CMGrunt::pMGruntSentences[] =
{
"MG_HEAL",
"MG_NOTHEAL",
};
typedef enum
{
MGRUNT_SENT_NONE = -1,
MGRUNT_SENT_HEAL = 0,
MGRUNT_SENT_NOTHEAL,
} MGRUNT_SENTENCE_TYPES;
//=========================================================
// Spawn
//=========================================================
void CMGrunt::Spawn()
{
Precache();
SET_MODEL(ENT(pev), "models/hgrunt_medic.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.medicAllyHealth;
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 npc will notice player and say hello
m_MonsterState = MONSTERSTATE_NONE;
pev->body = 0; // gun in holster
m_afCapability = bits_CAP_HEAR | bits_CAP_TURN_HEAD | bits_CAP_DOORS_GROUP;
// Medic has no torso support.
torso = 0;
// Select a random head.
if (head == -1)
{
SetBodygroup(HEAD_GROUP, RANDOM_LONG(0, MGRUNT_NUM_HEADS - 1));
}
else
{
SetBodygroup(HEAD_GROUP, head);
}
if (pev->weapons == 0)
{
// initialize to original values
pev->weapons = MGRUNT_9MMHANDGUN;
}
// Setup bodygroups.
if (FBitSet(pev->weapons, MGRUNT_EAGLE))
{
SetBodygroup(GUN_GROUP, GUN_EAGLE);
m_cClipSize = MGRUNT_CLIP_SIZE_EAGLE;
}
else if (FBitSet(pev->weapons, MGRUNT_9MMHANDGUN))
{
SetBodygroup(GUN_GROUP, GUN_9MMHANDGUN);
m_cClipSize = MGRUNT_CLIP_SIZE_9MMHANDGUN;
}
else
{
ALERT(at_console, "ERROR: entity %s uses unsupported weapon flags %d\n", pev->classname, pev->weapons);
m_cClipSize = -1;
}
m_cAmmoLoaded = m_cClipSize;
m_nHealthRestore = MGRUNT_MAX_HEALTH_RESTORE;
#if 0
const char* szSeqName = "pull_needle";
int seq = LookupSequence(szSeqName);
int i;
for (i = 0; i < ACT_FLINCH_RIGHTLEG; i++)
{
if (i == seq)
{
ALERT(at_console, "%s has sequence: %s with activity value (%d).\n", pev->classname, szSeqName, i);
break;
}
}
szSeqName = "store_needle";
seq = LookupSequence(szSeqName);
for (i = 0; i < ACT_FLINCH_RIGHTLEG; i++)
{
if (i == seq)
{
ALERT(at_console, "%s has sequence: %s with activity value (%d).\n", pev->classname, szSeqName, i);
break;
}
}
szSeqName = "give_shot";
seq = LookupSequence(szSeqName);
for (i = 0; i < ACT_FLINCH_RIGHTLEG; i++)
{
if (i == seq)
{
ALERT(at_console, "%s has sequence: %s with activity value (%d).\n", pev->classname, szSeqName, i);
break;
}
}
szSeqName = "heal_crouch";
seq = LookupSequence(szSeqName);
for (i = 0; i < ACT_FLINCH_RIGHTLEG; i++)
{
if (i == seq)
{
ALERT(at_console, "%s has sequence: %s with activity value (%d).\n", pev->classname, szSeqName, i);
break;
}
}
#endif
MonsterInit();
SetUse(&CMGrunt::FollowerUse);
}
//=========================================================
// Precache - precaches all resources this monster needs
//=========================================================
void CMGrunt::Precache()
{
PRECACHE_MODEL("models/hgrunt_medic.mdl");
PRECACHE_SOUND("barney/ba_attack1.wav");
PRECACHE_SOUND("barney/ba_attack2.wav");
PRECACHE_SOUND("barney/desert_eagle_fire.wav");
PRECACHE_SOUND("zombie/claw_miss2.wav");// because we use the basemonster SWIPE animation event
PRECACHE_SOUND("barney/medic_give_shot.wav");
PRECACHE_SOUND_ARRAY( g_pszDeathSounds );
PRECACHE_SOUND_ARRAY( g_pszPainSounds );
// every new barney must call this, otherwise
// when a level is loaded, nobody will talk (time is reset to 0)
TalkInit();
CTalkMonster::Precache();
}
//=========================================================
// Purpose:
//=========================================================
void CMGrunt::TalkInit( void )
{
CFGrunt::TalkInit();
}
//=========================================================
// Purpose:
//=========================================================
void CMGrunt::HandleAnimEvent(MonsterEvent_t* pEvent)
{
switch (pEvent->event)
{
case MGRUNT_AE_BURST1:
{
if (FBitSet(pev->weapons, MGRUNT_EAGLE))
{
FireEagle();
}
else
{
FirePistol();
}
}
break;
case MGRUNT_AE_BURST2:
break;
case MGRUNT_AE_BURST3:
break;
case MGRUNT_AE_GUN_DRAW:
{
if (FBitSet(pev->weapons, MGRUNT_EAGLE))
{
SetBodygroup(GUN_GROUP, GUN_EAGLE);
}
else if (FBitSet(pev->weapons, MGRUNT_9MMHANDGUN))
{
SetBodygroup(GUN_GROUP, MGRUNT_9MMHANDGUN);
}
}
break;
case MGRUNT_AE_GUN_HOLSTER:
case MGRUNT_AE_NEEDLE_STORE:
{
SetBodygroup( GUN_GROUP, GUN_NONE );
}
break;
case MGRUNT_AE_NEEDLE_DRAW:
{
SetBodygroup( GUN_GROUP, GUN_NEEDLE );
}
break;
default:
CFGrunt::HandleAnimEvent( pEvent );
break;
}
}
//=========================================================
// DropGun
//=========================================================
CBaseEntity* CMGrunt::DropGun(const Vector& vecGunPos, const Vector& vecGunAngles, char* szClassname)
{
CBaseEntity* pGun = NULL;
if (szClassname && *szClassname)
{
pGun = DropItem(szClassname, vecGunPos, vecGunAngles);
if (pGun)
{
return pGun;
}
else
{
ALERT(at_console, "ERROR: Could not find classname %s. No such class.\n", szClassname);
}
}
if (FBitSet(pev->weapons, MGRUNT_EAGLE))
{
pGun = DropItem("weapon_eagle", vecGunPos, vecGunAngles);
}
else
{
pGun = DropItem("weapon_9mmhandgun", vecGunPos, vecGunAngles);
}
return pGun;
}
//=========================================================
// Shoot
//=========================================================
void CMGrunt::FireEagle(void)
{
Vector vecShootOrigin;
UTIL_MakeVectors(pev->angles);
vecShootOrigin = pev->origin + Vector(0, 0, 55);
Vector vecShootDir = ShootAtEnemy(vecShootOrigin);
Vector angDir = UTIL_VecToAngles(vecShootDir);
SetBlending(0, angDir.x);
pev->effects = EF_MUZZLEFLASH;
FireBullets(1, vecShootOrigin, vecShootDir, VECTOR_CONE_1DEGREES, 1024, BULLET_PLAYER_357);
int pitchShift = RANDOM_LONG(0, 20);
// Only shift about half the time
if (pitchShift > 10)
pitchShift = 0;
else
pitchShift -= 5;
EMIT_SOUND_DYN(ENT(pev), CHAN_WEAPON, "weapons/desert_eagle_fire.wav", 1, ATTN_NORM, 0, 100 + pitchShift);
CSoundEnt::InsertSound(bits_SOUND_COMBAT, pev->origin, 384, 0.3);
// UNDONE: Reload?
m_cAmmoLoaded--;// take away a bullet!
}
//=========================================================
// Shoot
//=========================================================
void CMGrunt::FirePistol(void)
{
Vector vecShootOrigin;
UTIL_MakeVectors(pev->angles);
vecShootOrigin = pev->origin + Vector(0, 0, 55);
Vector vecShootDir = ShootAtEnemy(vecShootOrigin);
Vector angDir = UTIL_VecToAngles(vecShootDir);
SetBlending(0, angDir.x);
pev->effects = EF_MUZZLEFLASH;
FireBullets(1, vecShootOrigin, vecShootDir, VECTOR_CONE_2DEGREES, 1024, BULLET_MONSTER_9MM);
int pitchShift = RANDOM_LONG(0, 20);
// Only shift about half the time
if (pitchShift > 10)
pitchShift = 0;
else
pitchShift -= 5;
EMIT_SOUND_DYN(ENT(pev), CHAN_WEAPON, "barney/ba_attack2.wav", 1, ATTN_NORM, 0, 100 + pitchShift);
CSoundEnt::InsertSound(bits_SOUND_COMBAT, pev->origin, 384, 0.3);
// UNDONE: Reload?
m_cAmmoLoaded--;// take away a bullet!
}
void CMGrunt::StartTask(Task_t *pTask)
{
switch (pTask->iTask)
{
case 0:
default:
break;
}
}
void CMGrunt::RunTask(Task_t *pTask)
{
switch (pTask->iTask)
{
case 0:
default:
break;
}
}

59
dlls/gearbox/fgrunt_torch.cpp

@ -1,59 +0,0 @@ @@ -1,59 +0,0 @@
/***
*
* 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.
*
****/
//=========================================================
// friendly grunt - torch
//=========================================================
// UNDONE: Holster weapon?
#include "extdll.h"
#include "plane.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "talkmonster.h"
#include "schedule.h"
#include "animation.h"
#include "weapons.h"
#include "talkmonster.h"
#include "soundent.h"
#include "effects.h"
#include "customentity.h"
#include "fgrunt.h"
#if 0
class CHTorch : public CFGrunt
{
public:
void Spawn(void);
void Precache(void);
int Save(CSave &save);
int Restore(CRestore &restore);
static TYPEDESCRIPTION m_SaveData[];
int m_iTemp;
};
LINK_ENTITY_TO_CLASS(monster_human_torch_ally, CHTorch);
TYPEDESCRIPTION CHTorch::m_SaveData[] =
{
DEFINE_FIELD(CHTorch, m_iTemp, FIELD_INTEGER),
};
IMPLEMENT_SAVERESTORE(CHTorch, CFGrunt);
#endif

40
dlls/gearbox/massn.cpp

@ -336,41 +336,9 @@ void CMassn::DeathSound(void) @@ -336,41 +336,9 @@ void CMassn::DeathSound(void)
class CAssassinRepel : public CHGruntRepel
{
public:
void Precache(void);
void EXPORT RepelUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
const char* TrooperName() {
return "monster_male_assassin";
}
};
LINK_ENTITY_TO_CLASS(monster_assassin_repel, CAssassinRepel);
void CAssassinRepel::Precache(void)
{
UTIL_PrecacheOther("monster_male_assassin");
m_iSpriteTexture = PRECACHE_MODEL("sprites/rope.spr");
}
void CAssassinRepel::RepelUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
TraceResult tr;
UTIL_TraceLine(pev->origin, pev->origin + Vector(0, 0, -4096.0), dont_ignore_monsters, ENT(pev), &tr);
/*
if ( tr.pHit && Instance( tr.pHit )->pev->solid != SOLID_BSP)
return NULL;
*/
CBaseEntity *pEntity = Create("monster_male_assassin", pev->origin, pev->angles);
CBaseMonster *pGrunt = pEntity->MyMonsterPointer();
pGrunt->pev->movetype = MOVETYPE_FLY;
pGrunt->pev->velocity = Vector(0, 0, RANDOM_FLOAT(-196, -128));
pGrunt->SetActivity(ACT_GLIDE);
// UNDONE: position?
pGrunt->m_vecLastPosition = tr.vecEndPos;
CBeam *pBeam = CBeam::BeamCreate("sprites/rope.spr", 10);
pBeam->PointEntInit(pev->origin + Vector(0, 0, 112), pGrunt->entindex());
pBeam->SetFlags(BEAM_FSOLID);
pBeam->SetColor(255, 255, 255);
pBeam->SetThink(&CBeam::SUB_Remove);
pBeam->pev->nextthink = gpGlobals->time + -4096.0 * tr.flFraction / pGrunt->pev->velocity.z + 0.5;
UTIL_Remove(this);
}
LINK_ENTITY_TO_CLASS(monster_assassin_repel, CAssassinRepel)

18
dlls/gearbox/otis.cpp

@ -269,24 +269,6 @@ void COtis::TalkInit() @@ -269,24 +269,6 @@ void COtis::TalkInit()
}
static BOOL IsFacing(entvars_t *pevTest, const Vector &reference)
{
Vector vecDir = (reference - pevTest->origin);
vecDir.z = 0;
vecDir = vecDir.Normalize();
Vector forward, angle;
angle = pevTest->v_angle;
angle.x = 0;
UTIL_MakeVectorsPrivate(angle, forward, NULL, NULL);
// He's facing me, he meant it
if (DotProduct(forward, vecDir) > 0.96) // +/- 15 degrees or so
{
return TRUE;
}
return FALSE;
}
int COtis::TakeDamage(entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType)
{
// make sure friends talk about it if player hurts talkmonsters...

20
dlls/hgrunt.cpp

@ -118,7 +118,7 @@ enum @@ -118,7 +118,7 @@ enum
//=========================================================
// monster-specific conditions
//=========================================================
#define bits_COND_GRUNT_NOFIRE ( bits_COND_SPECIAL1 )
#define bits_COND_GRUNT_NOFIRE ( bits_COND_NOFIRE )
LINK_ENTITY_TO_CLASS( monster_human_grunt, CHGrunt )
@ -2285,13 +2285,19 @@ void CHGruntRepel::Spawn( void ) @@ -2285,13 +2285,19 @@ void CHGruntRepel::Spawn( void )
{
Precache();
pev->solid = SOLID_NOT;
pev->effects |= EF_NODRAW;
SetUse( &CHGruntRepel::RepelUse );
}
const char* CHGruntRepel::TrooperName()
{
return "monster_human_grunt";
}
void CHGruntRepel::Precache( void )
{
UTIL_PrecacheOther( "monster_human_grunt" );
UTIL_PrecacheOther( TrooperName() );
m_iSpriteTexture = PRECACHE_MODEL( "sprites/rope.spr" );
}
@ -2304,8 +2310,16 @@ void CHGruntRepel::RepelUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_ @@ -2304,8 +2310,16 @@ void CHGruntRepel::RepelUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_
return NULL;
*/
CBaseEntity *pEntity = Create( "monster_human_grunt", pev->origin, pev->angles );
CBaseEntity *pEntity = Create( TrooperName(), pev->origin, pev->angles );
if (!pEntity) {
UTIL_Remove( this );
return;
}
CBaseMonster *pGrunt = pEntity->MyMonsterPointer();
if (!pGrunt) {
UTIL_Remove( this );
return;
}
pGrunt->pev->movetype = MOVETYPE_FLY;
pGrunt->pev->velocity = Vector( 0, 0, RANDOM_FLOAT( -196, -128 ) );
pGrunt->SetActivity( ACT_GLIDE );

7
dlls/hgrunt.h

@ -97,10 +97,11 @@ public: @@ -97,10 +97,11 @@ public:
class CHGruntRepel : public CBaseMonster
{
public:
virtual void Spawn(void);
virtual void Precache(void);
virtual void EXPORT RepelUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
void Spawn( void );
void Precache( void );
void EXPORT RepelUse ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
int m_iSpriteTexture; // Don't save, precache
virtual const char* TrooperName();
};
#endif // HGRUNT_H

3
dlls/schedule.h

@ -274,6 +274,9 @@ struct WayPoint_t @@ -274,6 +274,9 @@ struct WayPoint_t
#define bits_COND_SEE_CLIENT ( 1 << 21) // see a client
#define bits_COND_SEE_NEMESIS ( 1 << 22) // see my nemesis
#define bits_COND_CLIENT_PUSH ( 1 << 26 ) // Clients can push ally monsters out of their way
#define bits_COND_NOFIRE ( 1 << 27) // no friendly fire
#define bits_COND_SPECIAL1 ( 1 << 28) // Defined by individual monster
#define bits_COND_SPECIAL2 ( 1 << 29) // Defined by individual monster

8
dlls/scientist.cpp

@ -991,8 +991,8 @@ void CScientist::Heal( void ) @@ -991,8 +991,8 @@ void CScientist::Heal( void )
int CScientist::FriendNumber( int arrayNumber )
{
static int array[3] = { 1, 2, 0 };
if( arrayNumber < 3 )
static int array[6] = { 1, 4, 2, 5, 0, 3 };
if( arrayNumber < 6 )
return array[arrayNumber];
return arrayNumber;
}
@ -1146,8 +1146,8 @@ int CSittingScientist::Classify( void ) @@ -1146,8 +1146,8 @@ int CSittingScientist::Classify( void )
int CSittingScientist::FriendNumber( int arrayNumber )
{
static int array[3] = { 2, 1, 0 };
if( arrayNumber < 3 )
static int array[6] = { 2, 5, 1, 4, 0, 3 };
if( arrayNumber < 6 )
return array[arrayNumber];
return arrayNumber;
}

26
dlls/skill.h

@ -145,19 +145,19 @@ struct skilldata_t @@ -145,19 +145,19 @@ struct skilldata_t
float pitdroneDmgWhip;
float pitdroneDmgSpit;
float hgruntAllyHealth;
float hgruntAllyDmgKick;
float hgruntAllyShotgunPellets;
float hgruntAllyGrenadeSpeed;
float medicAllyHealth;
float medicAllyDmgKick;
float medicAllyGrenadeSpeed;
float medicAllyHeal;
float torchAllyHealth;
float torchAllyDmgKick;
float torchAllyGrenadeSpeed;
float fgruntHealth;
float fgruntDmgKick;
float fgruntShotgunPellets;
float fgruntGrenadeSpeed;
float medicHealth;
float medicDmgKick;
float medicGrenadeSpeed;
float medicHeal;
float torchHealth;
float torchDmgKick;
float torchGrenadeSpeed;
float massnHealth;
float massnDmgKick;

43
dlls/talkmonster.cpp

@ -48,7 +48,7 @@ TYPEDESCRIPTION CTalkMonster::m_SaveData[] = @@ -48,7 +48,7 @@ TYPEDESCRIPTION CTalkMonster::m_SaveData[] =
DEFINE_FIELD( CTalkMonster, m_hTalkTarget, FIELD_EHANDLE ),
};
IMPLEMENT_SAVERESTORE( CTalkMonster, CBaseMonster )
IMPLEMENT_SAVERESTORE( CTalkMonster, CSquadMonster )
// array of friend names
const char *CTalkMonster::m_szFriends[TLK_CFRIENDS] =
@ -56,6 +56,9 @@ const char *CTalkMonster::m_szFriends[TLK_CFRIENDS] = @@ -56,6 +56,9 @@ const char *CTalkMonster::m_szFriends[TLK_CFRIENDS] =
"monster_barney",
"monster_scientist",
"monster_sitting_scientist",
"monster_otis",
"monster_cleansuit_scientist",
"monster_sitting_cleansuit_scientist",
};
//=========================================================
@ -69,7 +72,7 @@ Task_t tlIdleResponse[] = @@ -69,7 +72,7 @@ Task_t tlIdleResponse[] =
{ TASK_TLK_RESPOND, (float)0 }, // Wait and then say my response
{ TASK_TLK_IDEALYAW, (float)0 }, // look at who I'm talking to
{ TASK_FACE_IDEAL, (float)0 },
{ TASK_SET_ACTIVITY, (float)ACT_SIGNAL3 },
{ TASK_SET_ACTIVITY, (float)ACT_IDLE },
{ TASK_TLK_EYECONTACT, (float)0 }, // Wait until speaker is done
};
@ -91,7 +94,7 @@ Task_t tlIdleSpeak[] = @@ -91,7 +94,7 @@ Task_t tlIdleSpeak[] =
{ TASK_TLK_SPEAK, (float)0 },// question or remark
{ TASK_TLK_IDEALYAW, (float)0 },// look at who I'm talking to
{ TASK_FACE_IDEAL, (float)0 },
{ TASK_SET_ACTIVITY, (float)ACT_SIGNAL3 },
{ TASK_SET_ACTIVITY, (float)ACT_IDLE },
{ TASK_TLK_EYECONTACT, (float)0 },
{ TASK_WAIT_RANDOM, (float)0.5 },
};
@ -112,7 +115,7 @@ Schedule_t slIdleSpeak[] = @@ -112,7 +115,7 @@ Schedule_t slIdleSpeak[] =
Task_t tlIdleSpeakWait[] =
{
{ TASK_SET_ACTIVITY, (float)ACT_SIGNAL3 },// Stop and talk
{ TASK_SET_ACTIVITY, (float)ACT_IDLE },// Stop and talk
{ TASK_TLK_SPEAK, (float)0 },// question or remark
{ TASK_TLK_EYECONTACT, (float)0 },//
{ TASK_WAIT, (float)2 },// wait - used when sci is in 'use' mode to keep head turned
@ -134,7 +137,7 @@ Schedule_t slIdleSpeakWait[] = @@ -134,7 +137,7 @@ Schedule_t slIdleSpeakWait[] =
Task_t tlIdleHello[] =
{
{ TASK_SET_ACTIVITY, (float)ACT_SIGNAL3 },// Stop and talk
{ TASK_SET_ACTIVITY, (float)ACT_IDLE },// Stop and talk
{ TASK_TLK_HELLO, (float)0 },// Try to say hello to player
{ TASK_TLK_EYECONTACT, (float)0 },
{ TASK_WAIT, (float)0.5 },// wait a bit
@ -259,7 +262,7 @@ Task_t tlTlkIdleWatchClientStare[] = @@ -259,7 +262,7 @@ Task_t tlTlkIdleWatchClientStare[] =
{ TASK_TLK_STARE, (float)0 },
{ TASK_TLK_IDEALYAW, (float)0 },// look at who I'm talking to
{ TASK_FACE_IDEAL, (float)0 },
{ TASK_SET_ACTIVITY, (float)ACT_SIGNAL3 },
{ TASK_SET_ACTIVITY, (float)ACT_IDLE },
{ TASK_TLK_EYECONTACT, (float)0 },
};
@ -312,7 +315,7 @@ Task_t tlTlkIdleEyecontact[] = @@ -312,7 +315,7 @@ Task_t tlTlkIdleEyecontact[] =
{
{ TASK_TLK_IDEALYAW, (float)0 },// look at who I'm talking to
{ TASK_FACE_IDEAL, (float)0 },
{ TASK_SET_ACTIVITY, (float)ACT_SIGNAL3 },
{ TASK_SET_ACTIVITY, (float)ACT_IDLE },
{ TASK_TLK_EYECONTACT, (float)0 },// Wait until speaker is done
};
@ -345,15 +348,15 @@ DEFINE_CUSTOM_SCHEDULES( CTalkMonster ) @@ -345,15 +348,15 @@ DEFINE_CUSTOM_SCHEDULES( CTalkMonster )
slTlkIdleEyecontact,
};
IMPLEMENT_CUSTOM_SCHEDULES( CTalkMonster, CBaseMonster )
IMPLEMENT_CUSTOM_SCHEDULES( CTalkMonster, CSquadMonster )
void CTalkMonster::SetActivity( Activity newActivity )
{
if( newActivity == ACT_IDLE && IsTalking() )
newActivity = ACT_SIGNAL3;
// if( newActivity == ACT_IDLE && IsTalking() )
// newActivity = ACT_SIGNAL3;
if( newActivity == ACT_SIGNAL3 && ( LookupActivity( ACT_SIGNAL3 ) == ACTIVITY_NOT_AVAILABLE ) )
newActivity = ACT_IDLE;
// if( newActivity == ACT_SIGNAL3 && ( LookupActivity( ACT_SIGNAL3 ) == ACTIVITY_NOT_AVAILABLE ) )
// newActivity = ACT_IDLE;
CBaseMonster::SetActivity( newActivity );
}
@ -617,7 +620,7 @@ CBaseEntity *CTalkMonster::EnumFriends( CBaseEntity *pPrevious, int listNumber, @@ -617,7 +620,7 @@ CBaseEntity *CTalkMonster::EnumFriends( CBaseEntity *pPrevious, int listNumber,
TraceResult tr;
Vector vecCheck;
pszFriend = m_szFriends[FriendNumber( listNumber )];
pszFriend = FriendByNumber( listNumber );
while( ( pFriend = UTIL_FindEntityByClassname( pFriend, pszFriend ) ) )
{
if( pFriend == this || !pFriend->IsAlive() )
@ -648,7 +651,7 @@ void CTalkMonster::AlertFriends( void ) @@ -648,7 +651,7 @@ void CTalkMonster::AlertFriends( void )
int i;
// for each friend in this bsp...
for( i = 0; i < TLK_CFRIENDS; i++ )
for( i = 0; i < NumberOfFriends(); i++ )
{
while( ( pFriend = EnumFriends( pFriend, i, TRUE ) ) )
{
@ -668,7 +671,7 @@ void CTalkMonster::ShutUpFriends( void ) @@ -668,7 +671,7 @@ void CTalkMonster::ShutUpFriends( void )
int i;
// for each friend in this bsp...
for( i = 0; i < TLK_CFRIENDS; i++ )
for( i = 0; i < NumberOfFriends(); i++ )
{
while( ( pFriend = EnumFriends( pFriend, i, TRUE ) ) )
{
@ -691,7 +694,7 @@ void CTalkMonster::LimitFollowers( CBaseEntity *pPlayer, int maxFollowers ) @@ -691,7 +694,7 @@ void CTalkMonster::LimitFollowers( CBaseEntity *pPlayer, int maxFollowers )
count = 0;
// for each friend in this bsp...
for( i = 0; i < TLK_CFRIENDS; i++ )
for( i = 0; i < NumberOfFriends(); i++ )
{
while( ( pFriend = EnumFriends( pFriend, i, FALSE ) ) )
{
@ -772,7 +775,7 @@ CBaseEntity *CTalkMonster::FindNearestFriend( BOOL fPlayer ) @@ -772,7 +775,7 @@ CBaseEntity *CTalkMonster::FindNearestFriend( BOOL fPlayer )
if( fPlayer )
cfriends = 1;
else
cfriends = TLK_CFRIENDS;
cfriends = NumberOfFriends();
// for each type of friend...
for( i = cfriends-1; i > -1; i-- )
@ -780,7 +783,7 @@ CBaseEntity *CTalkMonster::FindNearestFriend( BOOL fPlayer ) @@ -780,7 +783,7 @@ CBaseEntity *CTalkMonster::FindNearestFriend( BOOL fPlayer )
if( fPlayer )
pszFriend = "player";
else
pszFriend = m_szFriends[FriendNumber( i )];
pszFriend = FriendByNumber( i );
if( !pszFriend )
continue;
@ -1246,7 +1249,7 @@ Schedule_t *CTalkMonster::GetScheduleOfType( int Type ) @@ -1246,7 +1249,7 @@ Schedule_t *CTalkMonster::GetScheduleOfType( int Type )
break;
}
return CBaseMonster::GetScheduleOfType( Type );
return CSquadMonster::GetScheduleOfType( Type );
}
//=========================================================
@ -1369,7 +1372,7 @@ void CTalkMonster::FollowerUse( CBaseEntity *pActivator, CBaseEntity *pCaller, U @@ -1369,7 +1372,7 @@ void CTalkMonster::FollowerUse( CBaseEntity *pActivator, CBaseEntity *pCaller, U
}
else if( CanFollow() )
{
LimitFollowers( pCaller, 1 );
LimitFollowers( pCaller, MaxFollowers() );
if( m_afMemory & bits_MEMORY_PROVOKED )
ALERT( at_console, "I'm not following you, you evil person!\n" );

12
dlls/talkmonster.h

@ -19,6 +19,7 @@ @@ -19,6 +19,7 @@
#ifndef MONSTERS_H
#include "monsters.h"
#endif
#include "squadmonster.h"
//=========================================================
// Talking monster base class
@ -38,7 +39,7 @@ @@ -38,7 +39,7 @@
#define bit_saidHeard (1<<6)
#define bit_saidSmelled (1<<7)
#define TLK_CFRIENDS 3
#define TLK_CFRIENDS 6
typedef enum
{
@ -95,7 +96,7 @@ enum @@ -95,7 +96,7 @@ enum
LAST_TALKMONSTER_TASK // MUST be last
};
class CTalkMonster : public CBaseMonster
class CTalkMonster : public CSquadMonster
{
public:
void TalkInit( void );
@ -149,6 +150,9 @@ public: @@ -149,6 +150,9 @@ public:
virtual void SetAnswerQuestion( CTalkMonster *pSpeaker );
virtual int FriendNumber( int arrayNumber ) { return arrayNumber; }
virtual const char* FriendByNumber( int arrayNumber ) { return m_szFriends[FriendNumber(arrayNumber)]; }
virtual int NumberOfFriends() { return TLK_CFRIENDS; }
virtual int MaxFollowers() { return 3; }
virtual int Save( CSave &save );
virtual int Restore( CRestore &restore );
@ -174,8 +178,8 @@ public: @@ -174,8 +178,8 @@ public:
CUSTOM_SCHEDULES
};
// Clients can push talkmonsters out of their way
#define bits_COND_CLIENT_PUSH ( bits_COND_SPECIAL1 )
BOOL IsFacing( entvars_t *pevTest, const Vector &reference );
// Don't see a client right now.
#define bits_COND_CLIENT_UNSEEN ( bits_COND_SPECIAL2 )

Loading…
Cancel
Save