2022-12-17 13:32:43 +01:00
|
|
|
/***
|
2013-08-30 13:34:05 -07:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
****/
|
|
|
|
//=========================================================
|
|
|
|
// rat - environmental monster
|
|
|
|
//=========================================================
|
|
|
|
|
2021-11-28 16:54:48 +01:00
|
|
|
#include "extdll.h"
|
|
|
|
#include "util.h"
|
|
|
|
#include "cbase.h"
|
|
|
|
#include "monsters.h"
|
|
|
|
#include "schedule.h"
|
2013-08-30 13:34:05 -07:00
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
// Monster's Anim Events Go Here
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
class CRat : public CBaseMonster
|
|
|
|
{
|
|
|
|
public:
|
2021-03-05 23:07:22 +01:00
|
|
|
void Spawn() override;
|
|
|
|
void Precache() override;
|
|
|
|
void SetYawSpeed() override;
|
2021-11-28 16:54:48 +01:00
|
|
|
int Classify() override;
|
2013-08-30 13:34:05 -07:00
|
|
|
};
|
2021-11-28 16:54:48 +01:00
|
|
|
LINK_ENTITY_TO_CLASS(monster_rat, CRat);
|
2013-08-30 13:34:05 -07:00
|
|
|
|
|
|
|
//=========================================================
|
2021-11-28 16:54:48 +01:00
|
|
|
// Classify - indicates this monster's place in the
|
2013-08-30 13:34:05 -07:00
|
|
|
// relationship table.
|
|
|
|
//=========================================================
|
2021-11-29 20:31:17 +01:00
|
|
|
int CRat::Classify()
|
2013-08-30 13:34:05 -07:00
|
|
|
{
|
2021-11-28 16:54:48 +01:00
|
|
|
return CLASS_INSECT;
|
2013-08-30 13:34:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
// SetYawSpeed - allows each sequence to have a different
|
|
|
|
// turn rate associated with it.
|
|
|
|
//=========================================================
|
2021-11-29 20:31:17 +01:00
|
|
|
void CRat::SetYawSpeed()
|
2013-08-30 13:34:05 -07:00
|
|
|
{
|
|
|
|
int ys;
|
|
|
|
|
2021-11-28 16:54:48 +01:00
|
|
|
switch (m_Activity)
|
2013-08-30 13:34:05 -07:00
|
|
|
{
|
|
|
|
case ACT_IDLE:
|
|
|
|
default:
|
|
|
|
ys = 45;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
pev->yaw_speed = ys;
|
|
|
|
}
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
// Spawn
|
|
|
|
//=========================================================
|
2021-11-29 20:31:17 +01:00
|
|
|
void CRat::Spawn()
|
2013-08-30 13:34:05 -07:00
|
|
|
{
|
2021-11-28 16:54:48 +01:00
|
|
|
Precache();
|
2013-08-30 13:34:05 -07:00
|
|
|
|
|
|
|
SET_MODEL(ENT(pev), "models/bigrat.mdl");
|
2021-11-28 16:54:48 +01:00
|
|
|
UTIL_SetSize(pev, Vector(0, 0, 0), Vector(0, 0, 0));
|
2013-08-30 13:34:05 -07:00
|
|
|
|
2021-11-28 16:54:48 +01:00
|
|
|
pev->solid = SOLID_SLIDEBOX;
|
|
|
|
pev->movetype = MOVETYPE_STEP;
|
|
|
|
m_bloodColor = BLOOD_COLOR_RED;
|
|
|
|
pev->health = 8;
|
|
|
|
pev->view_ofs = Vector(0, 0, 6); // position of the eyes relative to monster's origin.
|
|
|
|
m_flFieldOfView = 0.5; // indicates the width of this monster's forward view cone ( as a dotproduct result )
|
|
|
|
m_MonsterState = MONSTERSTATE_NONE;
|
2013-08-30 13:34:05 -07:00
|
|
|
|
|
|
|
MonsterInit();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
// Precache - precaches all resources this monster needs
|
|
|
|
//=========================================================
|
2021-11-29 20:31:17 +01:00
|
|
|
void CRat::Precache()
|
2013-08-30 13:34:05 -07:00
|
|
|
{
|
|
|
|
PRECACHE_MODEL("models/bigrat.mdl");
|
2021-11-28 16:54:48 +01:00
|
|
|
}
|
2013-08-30 13:34:05 -07:00
|
|
|
|
|
|
|
//=========================================================
|
|
|
|
// AI Schedules Specific to this monster
|
|
|
|
//=========================================================
|