Browse Source

add item_armor and item_helmet implementations.

CAd
Night Owl 7 years ago
parent
commit
6c6733a2c3
  1. 15
      dlls/items.cpp

15
dlls/items.cpp

@ -205,11 +205,21 @@ class CItemBattery : public CItem
void Spawn( void ) void Spawn( void )
{ {
Precache(); Precache();
if( FClassnameIs( pev, "item_helmet" ) )
SET_MODEL( ENT( pev ), "models/w_helmet.mdl" );
else if( FClassnameIs( pev, "item_armor" ) )
SET_MODEL( ENT( pev ), "models/w_armor.mdl" );
else
SET_MODEL( ENT( pev ), "models/w_battery.mdl" ); SET_MODEL( ENT( pev ), "models/w_battery.mdl" );
CItem::Spawn(); CItem::Spawn();
} }
void Precache( void ) void Precache( void )
{ {
if( FClassnameIs( pev, "item_helmet" ) )
PRECACHE_MODEL( "models/w_helmet.mdl" );
else if( FClassnameIs( pev, "item_armor" ) )
PRECACHE_MODEL( "models/w_armor.mdl" );
else
PRECACHE_MODEL( "models/w_battery.mdl" ); PRECACHE_MODEL( "models/w_battery.mdl" );
PRECACHE_SOUND( "items/gunpickup2.wav" ); PRECACHE_SOUND( "items/gunpickup2.wav" );
} }
@ -226,6 +236,9 @@ class CItemBattery : public CItem
int pct; int pct;
char szcharge[64]; char szcharge[64];
if( FClassnameIs( pev, "item_armor" ) )
pPlayer->pev->armorvalue += gSkillData.batteryCapacity * 1.5;
else
pPlayer->pev->armorvalue += gSkillData.batteryCapacity; pPlayer->pev->armorvalue += gSkillData.batteryCapacity;
pPlayer->pev->armorvalue = Q_min( pPlayer->pev->armorvalue, MAX_NORMAL_BATTERY ); pPlayer->pev->armorvalue = Q_min( pPlayer->pev->armorvalue, MAX_NORMAL_BATTERY );
@ -252,7 +265,9 @@ class CItemBattery : public CItem
} }
}; };
LINK_ENTITY_TO_CLASS( item_armor, CItemBattery )
LINK_ENTITY_TO_CLASS( item_battery, CItemBattery ) LINK_ENTITY_TO_CLASS( item_battery, CItemBattery )
LINK_ENTITY_TO_CLASS( item_helmet, CItemBattery )
class CItemAntidote : public CItem class CItemAntidote : public CItem
{ {

Loading…
Cancel
Save