2
0
mirror of https://github.com/FWGS/hlsdk-xash3d synced 2024-11-22 01:47:45 +01:00
hlsdk-xash3d/dlls/rat.cpp

100 lines
2.7 KiB
C++
Raw Normal View History

2016-06-04 15:24:23 +02:00
/***
*
* 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 );
2016-07-31 15:48:50 +02:00
int Classify( void );
2016-06-04 15:24:23 +02:00
};
LINK_ENTITY_TO_CLASS( monster_rat, CRat )
2016-06-04 15:24:23 +02:00
//=========================================================
// Classify - indicates this monster's place in the
// relationship table.
//=========================================================
2016-07-31 15:48:50 +02:00
int CRat::Classify( void )
2016-06-04 15:24:23 +02:00
{
2016-07-31 15:48:50 +02:00
return CLASS_INSECT;
2016-06-04 15:24:23 +02:00
}
//=========================================================
// SetYawSpeed - allows each sequence to have a different
// turn rate associated with it.
//=========================================================
2016-07-31 15:48:50 +02:00
void CRat::SetYawSpeed( void )
2016-06-04 15:24:23 +02:00
{
int ys;
2016-07-31 15:48:50 +02:00
switch( m_Activity )
2016-06-04 15:24:23 +02:00
{
case ACT_IDLE:
default:
ys = 45;
break;
}
pev->yaw_speed = ys;
}
//=========================================================
// Spawn
//=========================================================
2016-07-31 15:48:50 +02:00
void CRat::Spawn()
2016-06-04 15:24:23 +02:00
{
2016-07-31 15:48:50 +02:00
Precache();
2016-06-04 15:24:23 +02:00
2016-07-31 15:48:50 +02:00
SET_MODEL( ENT( pev ), "models/bigrat.mdl" );
2016-06-04 15:24:23 +02:00
UTIL_SetSize( pev, Vector( 0, 0, 0 ), Vector( 0, 0, 0 ) );
2016-07-31 15:48:50 +02: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;
2016-06-04 15:24:23 +02:00
MonsterInit();
}
//=========================================================
// Precache - precaches all resources this monster needs
//=========================================================
2016-07-31 15:48:50 +02:00
void CRat::Precache()
2016-06-04 15:24:23 +02:00
{
2016-07-31 15:48:50 +02:00
PRECACHE_MODEL( "models/bigrat.mdl" );
}
2016-06-04 15:24:23 +02:00
//=========================================================
// AI Schedules Specific to this monster
//=========================================================