From 792c824052473e5984d8dbf50c3847f1581a7b4a Mon Sep 17 00:00:00 2001 From: Night Owl Date: Fri, 26 Jan 2018 18:03:00 +0500 Subject: [PATCH] Implement "Scientist-o-matic". --- dlls/client.cpp | 3 +++ dlls/player.cpp | 22 ++++++++++++++++++---- dlls/scientist.cpp | 34 +++++++++++++++++----------------- dlls/visitors/kevlar.cpp | 4 ++-- 4 files changed, 40 insertions(+), 23 deletions(-) diff --git a/dlls/client.cpp b/dlls/client.cpp index f33954da..9389af44 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -931,7 +931,10 @@ void ClientPrecache( void ) PRECACHE_SOUND( "player/ear_ringing.wav" ); if( giPrecacheGrunt ) + { UTIL_PrecacheOther( "monster_human_grunt" ); + UTIL_PrecacheOther( "monster_scientist" ); + } } /* diff --git a/dlls/player.cpp b/dlls/player.cpp index 83090b99..a0bb034f 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -1,4 +1,4 @@ -Y/*** +/*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. * @@ -3437,6 +3437,20 @@ void CBasePlayer::CheatImpulseCommands( int iImpulse ) Create( "monster_human_grunt", pev->origin + gpGlobals->v_forward * 128, pev->angles ); } break; + case 77: + if( !giPrecacheGrunt ) + { + giPrecacheGrunt = 1; + ALERT( at_console, "You must now restart to use Scientist-o-matic.\n" ); + } + else + { + UTIL_MakeVectors( Vector( 0, pev->v_angle.y, 0 ) ); + CBaseEntity *pEntity = Create( "monster_scientist", pev->origin + gpGlobals->v_forward * 128, pev->angles ); + pEntity->pev->body = -1; + pEntity->Spawn(); + } + break; case 101: gEvilImpulse101 = TRUE; // GiveNamedItem( "item_suit" ); @@ -3910,14 +3924,14 @@ void CBasePlayer::UpdateClientData( void ) || FStrEq( STRING( gpGlobals->mapname ), "vis06" ) || FStrEq( STRING( gpGlobals->mapname ), "vis_credits" ) ) { - SetBits( m_iHideHUD, HIDEHUD_WEAPONS | HIDEHUD_HEALTH | HIDEHUD_FLASHLIGHT | HIDEHUD_SUIT ) + SetBits( m_iHideHUD, HIDEHUD_WEAPONS | HIDEHUD_HEALTH | HIDEHUD_FLASHLIGHT | HIDEHUD_SUIT ); } else { - ClearBits( m_iHideHUD, HIDEHUD_WEAPONS | HIDEHUD_HEALTH | HIDEHUD_FLASHLIGHT | HIDEHUD_SUIT ) + ClearBits( m_iHideHUD, HIDEHUD_WEAPONS | HIDEHUD_HEALTH | HIDEHUD_FLASHLIGHT | HIDEHUD_SUIT ); if( !( pev->weapons & ( 1 << WEAPON_SUIT ) ) || pev->armorvalue == 0 ) { - SetBits( m_iHideHUD, HIDEHUD_SUIT ) + SetBits( m_iHideHUD, HIDEHUD_SUIT ); } } diff --git a/dlls/scientist.cpp b/dlls/scientist.cpp index 8acd5d6b..bf3e26d6 100644 --- a/dlls/scientist.cpp +++ b/dlls/scientist.cpp @@ -643,23 +643,6 @@ void CScientist::Spawn( void ) const char *pszModel; Precache(); - 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.scientistHealth; - 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 scientists will notice player and say hello - m_MonsterState = MONSTERSTATE_NONE; - - //m_flDistTooFar = 256.0; - - m_afCapability = bits_CAP_HEAR | bits_CAP_TURN_HEAD | bits_CAP_OPEN_DOORS | bits_CAP_AUTO_DOORS | bits_CAP_USE; - - // White hands - pev->skin = 0; - if( pev->body == -1 ) { // -1 chooses a random head @@ -679,10 +662,27 @@ void CScientist::Spawn( void ) SET_MODEL( ENT( pev ), pszModel ); + // White hands + pev->skin = 0; + // Luther is black, make his hands black if( pev->body == HEAD_LUTHER || pev->body == HEAD_NEW_BLACK ) pev->skin = 1; + 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.scientistHealth; + 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 scientists will notice player and say hello + m_MonsterState = MONSTERSTATE_NONE; + + //m_flDistTooFar = 256.0; + + m_afCapability = bits_CAP_HEAR | bits_CAP_TURN_HEAD | bits_CAP_OPEN_DOORS | bits_CAP_AUTO_DOORS | bits_CAP_USE; + MonsterInit(); SetUse( &CTalkMonster::FollowerUse ); } diff --git a/dlls/visitors/kevlar.cpp b/dlls/visitors/kevlar.cpp index 89a956d0..d69f6166 100644 --- a/dlls/visitors/kevlar.cpp +++ b/dlls/visitors/kevlar.cpp @@ -43,11 +43,11 @@ class CItemKevlar : public CItem return FALSE; if( !( pPlayer->pev->weapons & ( 1 << WEAPON_SUIT ) ) ) - pPlayer->pev->weapons |= ( 1 << WEAPON_SUIT ) + pPlayer->pev->weapons |= ( 1 << WEAPON_SUIT ); pPlayer->pev->armorvalue = MAX_NORMAL_BATTERY; - EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "player/kevlar_zipper.wav", 1, ATTN_NORM, 0, RANDOM_LONG( 100, 150 ) ); + EMIT_SOUND_DYN( ENT( pPlayer->pev ), CHAN_ITEM, "player/kevlar_zipper.wav", 1, ATTN_NORM, 0, RANDOM_LONG( 100, 150 ) ); MESSAGE_BEGIN( MSG_ONE, gmsgItemPickup, NULL, pPlayer->pev ); WRITE_STRING( STRING( pev->classname ) );