Portable Half-Life SDK. GoldSource and Xash3D. Crossplatform.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
2.7 KiB

9 years ago
/***
*
* Copyright (c) 1996-2002, 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
//=========================================================
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "schedule.h"
//=========================================================
// Monster's Anim Events Go Here
//=========================================================
class CRat : public CBaseMonster
{
public:
void Spawn( void );
void Precache( void );
void SetYawSpeed( void );
8 years ago
int Classify( void );
9 years ago
};
LINK_ENTITY_TO_CLASS( monster_rat, CRat )
9 years ago
//=========================================================
// Classify - indicates this monster's place in the
// relationship table.
//=========================================================
8 years ago
int CRat::Classify( void )
9 years ago
{
8 years ago
return CLASS_INSECT;
9 years ago
}
//=========================================================
// SetYawSpeed - allows each sequence to have a different
// turn rate associated with it.
//=========================================================
8 years ago
void CRat::SetYawSpeed( void )
9 years ago
{
int ys;
8 years ago
switch( m_Activity )
9 years ago
{
case ACT_IDLE:
default:
ys = 45;
break;
}
pev->yaw_speed = ys;
}
//=========================================================
// Spawn
//=========================================================
8 years ago
void CRat::Spawn()
9 years ago
{
8 years ago
Precache();
9 years ago
8 years ago
SET_MODEL( ENT( pev ), "models/bigrat.mdl" );
9 years ago
UTIL_SetSize( pev, Vector( 0, 0, 0 ), Vector( 0, 0, 0 ) );
8 years ago
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;
9 years ago
MonsterInit();
}
//=========================================================
// Precache - precaches all resources this monster needs
//=========================================================
8 years ago
void CRat::Precache()
9 years ago
{
8 years ago
PRECACHE_MODEL( "models/bigrat.mdl" );
}
9 years ago
//=========================================================
// AI Schedules Specific to this monster
//=========================================================