From 82aca8bec800eb6b849b9269ffcb6146e3871dcf Mon Sep 17 00:00:00 2001 From: Night Owl Date: Sat, 19 Nov 2016 20:13:49 +0500 Subject: [PATCH 01/14] Merge Uncle Mike's patches for "Blue Shift". --- cl_dll/ammo.cpp | 32 +++++---- cl_dll/health.cpp | 4 +- cl_dll/hud.h | 4 +- dlls/effects.cpp | 120 +++++++++++++++++++++++++++++++ dlls/genericmonster.cpp | 11 ++- dlls/items.cpp | 73 +++++++++++++++++-- dlls/scientist.cpp | 155 +++++++++++++++++++++++++++------------- dlls/talkmonster.cpp | 3 +- dlls/triggers.cpp | 21 +++++- 9 files changed, 348 insertions(+), 75 deletions(-) diff --git a/cl_dll/ammo.cpp b/cl_dll/ammo.cpp index 988bd6fa..6b02af61 100644 --- a/cl_dll/ammo.cpp +++ b/cl_dll/ammo.cpp @@ -305,6 +305,9 @@ void CHudAmmo::Reset( void ) gHR.Reset(); //VidInit(); + static wrect_t nullrc; + SetCrosshair( 0, nullrc, 0, 0, 0 ); //reset crosshair + m_pWeapon = NULL; //reset last weapon } int CHudAmmo::VidInit( void ) @@ -604,22 +607,25 @@ int CHudAmmo::MsgFunc_CurWeapon( const char *pszName, int iSize, void *pbuf ) m_pWeapon = pWeapon; - if( gHUD.m_iFOV >= 90 ) - { - // normal crosshairs - if( fOnTarget && m_pWeapon->hAutoaim ) - SetCrosshair( m_pWeapon->hAutoaim, m_pWeapon->rcAutoaim, 255, 255, 255 ); - else - SetCrosshair( m_pWeapon->hCrosshair, m_pWeapon->rcCrosshair, 255, 255, 255 ); - } - else + if( !( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL ) ) ) { - // zoomed crosshairs - if( fOnTarget && m_pWeapon->hZoomedAutoaim ) - SetCrosshair( m_pWeapon->hZoomedAutoaim, m_pWeapon->rcZoomedAutoaim, 255, 255, 255 ); + if( gHUD.m_iFOV >= 90 ) + { + // normal crosshairs + if( fOnTarget && m_pWeapon->hAutoaim ) + SetCrosshair( m_pWeapon->hAutoaim, m_pWeapon->rcAutoaim, 255, 255, 255 ); + else + SetCrosshair( m_pWeapon->hCrosshair, m_pWeapon->rcCrosshair, 255, 255, 255 ); + } else - SetCrosshair( m_pWeapon->hZoomedCrosshair, m_pWeapon->rcZoomedCrosshair, 255, 255, 255 ); + { + // zoomed crosshairs + if( fOnTarget && m_pWeapon->hZoomedAutoaim ) + SetCrosshair( m_pWeapon->hZoomedAutoaim, m_pWeapon->rcZoomedAutoaim, 255, 255, 255 ); + else + SetCrosshair( m_pWeapon->hZoomedCrosshair, m_pWeapon->rcZoomedCrosshair, 255, 255, 255 ); + } } m_fFade = 200.0f; //!!! diff --git a/cl_dll/health.cpp b/cl_dll/health.cpp index d4979c35..d66e81ad 100644 --- a/cl_dll/health.cpp +++ b/cl_dll/health.cpp @@ -231,7 +231,9 @@ int CHudHealth::Draw( float flTime ) int iHeight = gHUD.m_iFontHeight; int iWidth = HealthWidth / 10; - FillRGBA( x, y, iWidth, iHeight, 255, 160, 0, a ); + + UnpackRGB( r, g, b, RGB_YELLOWISH ); + FillRGBA( x, y, iWidth, iHeight, r, g, b, a ); } DrawDamage( flTime ); diff --git a/cl_dll/hud.h b/cl_dll/hud.h index ec236003..1884d413 100644 --- a/cl_dll/hud.h +++ b/cl_dll/hud.h @@ -20,8 +20,8 @@ // CHud handles the message, calculation, and drawing the HUD // -#define RGB_YELLOWISH 0x00FFA000 //255,160,0 -#define RGB_REDISH 0x00FF1010 //255,160,0 +#define RGB_YELLOWISH 0x008080FF //128,128,255 +#define RGB_REDISH 0x008080FF //128,128,255 #define RGB_GREENISH 0x0000A000 //0,160,0 #include "wrect.h" diff --git a/dlls/effects.cpp b/dlls/effects.cpp index e9492dd6..fd3875d7 100644 --- a/dlls/effects.cpp +++ b/dlls/effects.cpp @@ -2182,6 +2182,8 @@ public: void CItemSoda::Precache( void ) { + PRECACHE_MODEL( "models/can.mdl" ); + PRECACHE_SOUND( "weapons/g_bounce.wav" ); } LINK_ENTITY_TO_CLASS( item_sodacan, CItemSoda ) @@ -2232,3 +2234,121 @@ void CItemSoda::CanTouch( CBaseEntity *pOther ) SetThink( &CBaseEntity::SUB_Remove ); pev->nextthink = gpGlobals->time; } + +//========================================================= +// env_warpball +//========================================================= +#define SF_REMOVE_ON_FIRE 0x0001 +#define SF_KILL_CENTER 0x0002 + +class CEnvWarpBall : public CBaseEntity +{ +public: + void Precache( void ); + void Spawn( void ) { Precache(); } + void Think( void ); + void KeyValue( KeyValueData *pkvd ); + void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ); + virtual int ObjectCaps( void ) { return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION; } + Vector vecOrigin; +}; + +LINK_ENTITY_TO_CLASS( env_warpball, CEnvWarpBall ) + +void CEnvWarpBall::KeyValue( KeyValueData *pkvd ) +{ + if( FStrEq( pkvd->szKeyName, "radius" ) ) + { + pev->button = atoi( pkvd->szValue ); + pkvd->fHandled = TRUE; + } + if( FStrEq( pkvd->szKeyName, "warp_target" ) ) + { + pev->message = ALLOC_STRING( pkvd->szValue ); + pkvd->fHandled = TRUE; + } + if( FStrEq( pkvd->szKeyName, "damage_delay" ) ) + { + pev->frags = atof( pkvd->szValue ); + pkvd->fHandled = TRUE; + } + else + CBaseEntity::KeyValue( pkvd ); +} + +void CEnvWarpBall::Precache( void ) +{ + PRECACHE_MODEL( "sprites/lgtning.spr" ); + PRECACHE_MODEL( "sprites/Fexplo1.spr" ); + PRECACHE_SOUND( "debris/beamstart2.wav" ); + PRECACHE_SOUND( "debris/beamstart7.wav" ); +} + +void CEnvWarpBall::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) +{ + int iTimes = 0; + int iDrawn = 0; + TraceResult tr; + Vector vecDest; + CBeam *pBeam; + CBaseEntity *pEntity = UTIL_FindEntityByTargetname( NULL, STRING( pev->message ) ); + edict_t *pos; + + if( pEntity )//target found ? + { + vecOrigin = pEntity->pev->origin; + pos = pEntity->edict(); + } + else + { + //use as center + vecOrigin = pev->origin; + pos = edict(); + } + EMIT_SOUND( pos, CHAN_BODY, "debris/beamstart2.wav", 1, ATTN_NORM ); + UTIL_ScreenShake( vecOrigin, 6, 160, 1.0, pev->button ); + CSprite *pSpr = CSprite::SpriteCreate( "sprites/Fexplo1.spr", vecOrigin, TRUE ); + pSpr->AnimateAndDie( 18 ); + pSpr->SetTransparency( kRenderGlow, 77, 210, 130, 255, kRenderFxNoDissipation ); + EMIT_SOUND( pos, CHAN_ITEM, "debris/beamstart7.wav", 1, ATTN_NORM ); + int iBeams = RANDOM_LONG( 20, 40 ); + while( iDrawn < iBeams && iTimes < ( iBeams * 3 ) ) + { + vecDest = pev->button * ( Vector( RANDOM_FLOAT( -1,1 ), RANDOM_FLOAT( -1,1 ), RANDOM_FLOAT( -1,1 ) ).Normalize() ); + UTIL_TraceLine( vecOrigin, vecOrigin + vecDest, ignore_monsters, NULL, &tr ); + if( tr.flFraction != 1.0 ) + { + // we hit something. + iDrawn++; + pBeam = CBeam::BeamCreate( "sprites/lgtning.spr", 200 ); + pBeam->PointsInit( vecOrigin, tr.vecEndPos ); + pBeam->SetColor( 20, 243, 20 ); + pBeam->SetNoise( 65 ); + pBeam->SetBrightness( 220 ); + pBeam->SetWidth( 30 ); + pBeam->SetScrollRate( 35 ); + pBeam->SetThink( &CBeam:: SUB_Remove ); + pBeam->pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 0.5, 1.6 ); + } + iTimes++; + } + pev->nextthink = gpGlobals->time + pev->frags; +} + +void CEnvWarpBall::Think( void ) +{ + SUB_UseTargets( this, USE_TOGGLE, 0 ); + + if( pev->spawnflags & SF_KILL_CENTER ) + { + CBaseEntity *pMonster = NULL; + + while( ( pMonster = UTIL_FindEntityInSphere( pMonster, vecOrigin, 72 ) ) != NULL ) + { + if( FBitSet( pMonster->pev->flags, FL_MONSTER ) || FClassnameIs( pMonster->pev, "player" ) ) + pMonster->TakeDamage( pev, pev, 100, DMG_GENERIC ); + } + } + if( pev->spawnflags & SF_REMOVE_ON_FIRE ) + UTIL_Remove( this ); +} diff --git a/dlls/genericmonster.cpp b/dlls/genericmonster.cpp index c40bb802..782c5a41 100644 --- a/dlls/genericmonster.cpp +++ b/dlls/genericmonster.cpp @@ -20,15 +20,17 @@ #include "cbase.h" #include "monsters.h" #include "schedule.h" +#include "talkmonster.h" // For holograms, make them not solid so the player can walk through them #define SF_GENERICMONSTER_NOTSOLID 4 +#define SF_HEAD_CONTROLLER 8 //========================================================= // Monster's Anim Events Go Here //========================================================= -class CGenericMonster : public CBaseMonster +class CGenericMonster : public CTalkMonster { public: void Spawn( void ); @@ -119,6 +121,11 @@ void CGenericMonster::Spawn() MonsterInit(); + if( pev->spawnflags & SF_HEAD_CONTROLLER ) + { + m_afCapability = bits_CAP_TURN_HEAD; + } + if( pev->spawnflags & SF_GENERICMONSTER_NOTSOLID ) { pev->solid = SOLID_NOT; @@ -131,6 +138,8 @@ void CGenericMonster::Spawn() //========================================================= void CGenericMonster::Precache() { + CTalkMonster::Precache(); + TalkInit(); PRECACHE_MODEL( (char *)STRING( pev->model ) ); } diff --git a/dlls/items.cpp b/dlls/items.cpp index d9cc7871..dcac8adf 100644 --- a/dlls/items.cpp +++ b/dlls/items.cpp @@ -199,6 +199,74 @@ class CItemSuit : public CItem LINK_ENTITY_TO_CLASS( item_suit, CItemSuit ) +class CItemArmorVest : public CItem +{ + void Spawn( void ) + { + Precache(); + SET_MODEL( ENT( pev ), "models/barney_vest.mdl" ); + CItem::Spawn(); + } + void Precache( void ) + { + PRECACHE_MODEL( "models/barney_vest.mdl" ); + PRECACHE_SOUND( "items/gunpickup2.wav" ); + } + BOOL MyTouch( CBasePlayer *pPlayer ) + { + if( ( pPlayer->pev->armorvalue < MAX_NORMAL_BATTERY ) && + ( pPlayer->pev->weapons & ( 1 << WEAPON_SUIT ) ) ) + { + pPlayer->pev->armorvalue += 60; + pPlayer->pev->armorvalue = min( pPlayer->pev->armorvalue, MAX_NORMAL_BATTERY ); + + EMIT_SOUND( pPlayer->edict(), CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_NORM ); + + MESSAGE_BEGIN( MSG_ONE, gmsgItemPickup, NULL, pPlayer->pev ); + WRITE_STRING( STRING( pev->classname ) ); + MESSAGE_END(); + return TRUE; + } + return FALSE; + } +}; + +LINK_ENTITY_TO_CLASS( item_armorvest, CItemArmorVest ) + +class CItemHelmet : public CItem +{ + void Spawn( void ) + { + Precache(); + SET_MODEL( ENT( pev ), "models/barney_helmet.mdl" ); + CItem::Spawn(); + } + void Precache( void ) + { + PRECACHE_MODEL( "models/barney_helmet.mdl" ); + PRECACHE_SOUND( "items/gunpickup2.wav" ); + } + BOOL MyTouch( CBasePlayer *pPlayer ) + { + if( ( pPlayer->pev->armorvalue < MAX_NORMAL_BATTERY ) && + ( pPlayer->pev->weapons & ( 1 << WEAPON_SUIT ) ) ) + { + pPlayer->pev->armorvalue += 40; + pPlayer->pev->armorvalue = min( pPlayer->pev->armorvalue, MAX_NORMAL_BATTERY ); + + EMIT_SOUND( pPlayer->edict(), CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_NORM ); + + MESSAGE_BEGIN( MSG_ONE, gmsgItemPickup, NULL, pPlayer->pev ); + WRITE_STRING( STRING( pev->classname ) ); + MESSAGE_END(); + return TRUE; + } + return FALSE; + } +}; + +LINK_ENTITY_TO_CLASS( item_helmet, CItemHelmet ) + class CItemBattery : public CItem { void Spawn( void ) @@ -214,11 +282,6 @@ class CItemBattery : public CItem } BOOL MyTouch( CBasePlayer *pPlayer ) { - if( pPlayer->pev->deadflag != DEAD_NO ) - { - return FALSE; - } - if( ( pPlayer->pev->armorvalue < MAX_NORMAL_BATTERY ) && ( pPlayer->pev->weapons & ( 1 << WEAPON_SUIT ) ) ) { diff --git a/dlls/scientist.cpp b/dlls/scientist.cpp index 4e60c58e..8f026969 100644 --- a/dlls/scientist.cpp +++ b/dlls/scientist.cpp @@ -119,6 +119,7 @@ private: }; LINK_ENTITY_TO_CLASS( monster_scientist, CScientist ) +LINK_ENTITY_TO_CLASS( monster_rosenberg, CScientist ) TYPEDESCRIPTION CScientist::m_SaveData[] = { @@ -419,7 +420,10 @@ void CScientist::DeclineFollowing( void ) { Talk( 10 ); m_hTalkTarget = m_hEnemy; - PlaySentence( "SC_POK", 2, VOL_NORM, ATTN_NORM ); + if( FClassnameIs( pev, "monster_rosenberg" ) ) + PlaySentence( "RO_POK", 2, VOL_NORM, ATTN_NORM ); + else + PlaySentence( "SC_POK", 2, VOL_NORM, ATTN_NORM ); } void CScientist::Scream( void ) @@ -428,7 +432,10 @@ void CScientist::Scream( void ) { Talk( 10 ); m_hTalkTarget = m_hEnemy; - PlaySentence( "SC_SCREAM", RANDOM_FLOAT( 3, 6 ), VOL_NORM, ATTN_NORM ); + if( FClassnameIs( pev, "monster_rosenberg" ) ) + PlaySentence( "RO_SCREAM", RANDOM_FLOAT( 3, 6 ), VOL_NORM, ATTN_NORM ); + else + PlaySentence( "SC_SCREAM", RANDOM_FLOAT( 3, 6 ), VOL_NORM, ATTN_NORM ); } } @@ -447,7 +454,10 @@ void CScientist::StartTask( Task_t *pTask ) //if( FOkToSpeak() ) Talk( 2 ); m_hTalkTarget = m_hTargetEnt; - PlaySentence( "SC_HEAL", 2, VOL_NORM, ATTN_IDLE ); + if( FClassnameIs( pev, "monster_rosenberg" ) ) + PlaySentence( "RO_HEAL", 2, VOL_NORM, ATTN_IDLE ); + else + PlaySentence( "SC_HEAL", 2, VOL_NORM, ATTN_IDLE ); TaskComplete(); break; case TASK_SCREAM: @@ -464,10 +474,17 @@ void CScientist::StartTask( Task_t *pTask ) { Talk( 2 ); m_hTalkTarget = m_hEnemy; - if( m_hEnemy->IsPlayer() ) - PlaySentence( "SC_PLFEAR", 5, VOL_NORM, ATTN_NORM ); + if( FClassnameIs( pev, "monster_rosenberg" ) ) + { + PlaySentence( "RO_FEAR", 5, VOL_NORM, ATTN_NORM ); + } else - PlaySentence( "SC_FEAR", 5, VOL_NORM, ATTN_NORM ); + { + if( m_hEnemy->IsPlayer() ) + PlaySentence( "SC_PLFEAR", 5, VOL_NORM, ATTN_NORM ); + else + PlaySentence( "SC_FEAR", 5, VOL_NORM, ATTN_NORM ); + } } TaskComplete(); break; @@ -642,7 +659,10 @@ void CScientist::Spawn( void ) pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_STEP; m_bloodColor = BLOOD_COLOR_RED; - pev->health = gSkillData.scientistHealth; + if( FClassnameIs( pev, "monster_rosenberg" ) ) + pev->health = gSkillData.scientistHealth * 2; + else + 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; @@ -679,6 +699,7 @@ void CScientist::Precache( void ) PRECACHE_SOUND( "scientist/sci_pain3.wav" ); PRECACHE_SOUND( "scientist/sci_pain4.wav" ); PRECACHE_SOUND( "scientist/sci_pain5.wav" ); + PRECACHE_SOUND( "rosenberg/ro_pain1.wav" ); // every new scientist must call this, otherwise // when a level is loaded, nobody will talk (time is reset to 0) @@ -699,28 +720,54 @@ void CScientist::TalkInit() m_szFriends[2] = "monster_barney"; // scientists speach group names (group names are in sentences.txt) - - m_szGrp[TLK_ANSWER] = "SC_ANSWER"; - m_szGrp[TLK_QUESTION] = "SC_QUESTION"; - m_szGrp[TLK_IDLE] = "SC_IDLE"; - m_szGrp[TLK_STARE] = "SC_STARE"; - m_szGrp[TLK_USE] = "SC_OK"; - m_szGrp[TLK_UNUSE] = "SC_WAIT"; - m_szGrp[TLK_STOP] = "SC_STOP"; - m_szGrp[TLK_NOSHOOT] = "SC_SCARED"; - m_szGrp[TLK_HELLO] = "SC_HELLO"; - - m_szGrp[TLK_PLHURT1] = "!SC_CUREA"; - m_szGrp[TLK_PLHURT2] = "!SC_CUREB"; - m_szGrp[TLK_PLHURT3] = "!SC_CUREC"; - - m_szGrp[TLK_PHELLO] = "SC_PHELLO"; - m_szGrp[TLK_PIDLE] = "SC_PIDLE"; - m_szGrp[TLK_PQUESTION] = "SC_PQUEST"; - m_szGrp[TLK_SMELL] = "SC_SMELL"; - - m_szGrp[TLK_WOUND] = "SC_WOUND"; - m_szGrp[TLK_MORTAL] = "SC_MORTAL"; + if( FClassnameIs( pev, "monster_rosenberg" ) ) + { + m_szGrp[TLK_ANSWER] = "RO_ANSWER"; + m_szGrp[TLK_QUESTION] = "RO_QUESTION"; + m_szGrp[TLK_IDLE] = "RO_IDLE"; + m_szGrp[TLK_STARE] = "RO_STARE"; + m_szGrp[TLK_USE] = "RO_OK"; + m_szGrp[TLK_UNUSE] = "RO_WAIT"; + m_szGrp[TLK_STOP] = "RO_STOP"; + m_szGrp[TLK_NOSHOOT] = "RO_SCARED"; + m_szGrp[TLK_HELLO] = "RO_HELLO"; + + m_szGrp[TLK_PLHURT1] = "!RO_CUREA"; + m_szGrp[TLK_PLHURT2] = "!RO_CUREB"; + m_szGrp[TLK_PLHURT3] = "!RO_CUREC"; + + m_szGrp[TLK_PHELLO] = "RO_PHELLO"; + m_szGrp[TLK_PIDLE] = "RO_PIDLE"; + m_szGrp[TLK_PQUESTION] = "RO_PQUEST"; + m_szGrp[TLK_SMELL] = "RO_SMELL"; + + m_szGrp[TLK_WOUND] = "RO_WOUND"; + m_szGrp[TLK_MORTAL] = "RO_MORTAL"; + } + else + { + m_szGrp[TLK_ANSWER] = "SC_ANSWER"; + m_szGrp[TLK_QUESTION] = "SC_QUESTION"; + m_szGrp[TLK_IDLE] = "SC_IDLE"; + m_szGrp[TLK_STARE] = "SC_STARE"; + m_szGrp[TLK_USE] = "SC_OK"; + m_szGrp[TLK_UNUSE] = "SC_WAIT"; + m_szGrp[TLK_STOP] = "SC_STOP"; + m_szGrp[TLK_NOSHOOT] = "SC_SCARED"; + m_szGrp[TLK_HELLO] = "SC_HELLO"; + + m_szGrp[TLK_PLHURT1] = "!SC_CUREA"; + m_szGrp[TLK_PLHURT2] = "!SC_CUREB"; + m_szGrp[TLK_PLHURT3] = "!SC_CUREC"; + + m_szGrp[TLK_PHELLO] = "SC_PHELLO"; + m_szGrp[TLK_PIDLE] = "SC_PIDLE"; + m_szGrp[TLK_PQUESTION] = "SC_PQUEST"; + m_szGrp[TLK_SMELL] = "SC_SMELL"; + + m_szGrp[TLK_WOUND] = "SC_WOUND"; + m_szGrp[TLK_MORTAL] = "SC_MORTAL"; + } // get voice for head switch( pev->body % 3 ) @@ -736,7 +783,7 @@ void CScientist::TalkInit() m_voicePitch = 95; break; //luther case HEAD_SLICK: - m_voicePitch = 100; + m_voicePitch = 85; break; //slick } } @@ -745,8 +792,11 @@ int CScientist::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, flo { if( pevInflictor && pevInflictor->flags & FL_CLIENT ) { - Remember( bits_MEMORY_PROVOKED ); - StopFollowing( TRUE ); + if( !FClassnameIs( pev, "monster_rosenberg" ) ) + { + Remember( bits_MEMORY_PROVOKED ); + StopFollowing( TRUE ); + } } // make sure friends talk about it if player hurts scientist... @@ -776,24 +826,27 @@ void CScientist::PainSound( void ) m_painTime = gpGlobals->time + RANDOM_FLOAT( 0.5, 0.75 ); - switch( RANDOM_LONG( 0, 4 ) ) - { - case 0: - EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "scientist/sci_pain1.wav", 1, ATTN_NORM, 0, GetVoicePitch() ); - break; - case 1: - EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "scientist/sci_pain2.wav", 1, ATTN_NORM, 0, GetVoicePitch() ); - break; - case 2: - EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "scientist/sci_pain3.wav", 1, ATTN_NORM, 0, GetVoicePitch() ); - break; - case 3: - EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "scientist/sci_pain4.wav", 1, ATTN_NORM, 0, GetVoicePitch() ); - break; - case 4: - EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "scientist/sci_pain5.wav", 1, ATTN_NORM, 0, GetVoicePitch() ); - break; - } + if( FClassnameIs( pev, "monster_rosenberg" ) ) + EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "rosenberg/ro_pain1.wav", 1, ATTN_NORM, 0, GetVoicePitch() ); + else + switch( RANDOM_LONG( 0, 4 ) ) + { + case 0: + EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "scientist/sci_pain1.wav", 1, ATTN_NORM, 0, GetVoicePitch() ); + break; + case 1: + EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "scientist/sci_pain2.wav", 1, ATTN_NORM, 0, GetVoicePitch() ); + break; + case 2: + EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "scientist/sci_pain3.wav", 1, ATTN_NORM, 0, GetVoicePitch() ); + break; + case 3: + EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "scientist/sci_pain4.wav", 1, ATTN_NORM, 0, GetVoicePitch() ); + break; + case 4: + EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "scientist/sci_pain5.wav", 1, ATTN_NORM, 0, GetVoicePitch() ); + break; + } } //========================================================= @@ -953,7 +1006,7 @@ Schedule_t *CScientist::GetSchedule( void ) } return GetScheduleOfType( SCHED_TARGET_FACE ); // Just face and follow. } - else // UNDONE: When afraid, scientist won't move out of your way. Keep This? If not, write move away scared + else if( !FClassnameIs( pev, "monster_rosenberg" ) ) // UNDONE: When afraid, scientist won't move out of your way. Keep This? If not, write move away scared { if( HasConditions( bits_COND_NEW_ENEMY ) ) // I just saw something new and scary, react return GetScheduleOfType( SCHED_FEAR ); // React to something scary diff --git a/dlls/talkmonster.cpp b/dlls/talkmonster.cpp index a0a52f52..2efb0ed0 100644 --- a/dlls/talkmonster.cpp +++ b/dlls/talkmonster.cpp @@ -879,7 +879,8 @@ int CTalkMonster::FOkToSpeak( void ) if( gpGlobals->time <= CTalkMonster::g_talkWaitTime ) return FALSE; - if( pev->spawnflags & SF_MONSTER_GAG ) + // monster generic can speak always + if( pev->spawnflags & SF_MONSTER_GAG && !FClassnameIs( pev, "monster_generic" ) ) return FALSE; if( m_MonsterState == MONSTERSTATE_PRONE ) diff --git a/dlls/triggers.cpp b/dlls/triggers.cpp index d7f9483c..57d2b42d 100644 --- a/dlls/triggers.cpp +++ b/dlls/triggers.cpp @@ -1190,7 +1190,6 @@ void CBaseTrigger::CounterUse( CBaseEntity *pActivator, CBaseEntity *pCaller, US return; BOOL fTellActivator = - ( m_hActivator != 0 ) && FClassnameIs( m_hActivator->pev, "player" ) && !FBitSet( pev->spawnflags, SPAWNFLAG_NOMESSAGE ); if( m_cTriggersLeft != 0 ) @@ -2039,6 +2038,26 @@ void CTriggerGravity::GravityTouch( CBaseEntity *pOther ) pOther->pev->gravity = pev->gravity; } +class CTriggerPlayerFreeze : public CBaseDelay +{ +public: + void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ); + int ObjectCaps( void ) { return CBaseDelay::ObjectCaps() & ~FCAP_ACROSS_TRANSITION; } +}; + +LINK_ENTITY_TO_CLASS( trigger_playerfreeze, CTriggerPlayerFreeze ) + +void CTriggerPlayerFreeze::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) +{ + if( !pActivator || !pActivator->IsPlayer() ) + pActivator = CBaseEntity::Instance( g_engfuncs.pfnPEntityOfEntIndex( 1 ) ); + + if( pActivator->pev->flags & FL_FROZEN ) + ( (CBasePlayer *)( (CBaseEntity *)pActivator ) )->EnableControl( TRUE ); + else + ( (CBasePlayer *)( (CBaseEntity *)pActivator ) )->EnableControl( FALSE ); +}; + // this is a really bad idea. class CTriggerChangeTarget : public CBaseDelay { From 1285d4834781aead0d99c65784ebb671be5e59e1 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Sun, 17 Dec 2017 02:35:36 +0500 Subject: [PATCH 02/14] Update .travis.yml. --- .travis.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9e165b81..00f3f479 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,20 @@ compiler: os: - linux - osx -sudo: true +addons: + apt: + packages: + - gcc-multilib + - g++-multilib before_script: - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install gcc-multilib g++-multilib; fi + - curl http://libsdl.org/release/SDL2-devel-2.0.7-mingw.tar.gz | tar xzf - + - mv SDL2-2.0.7/i686-w64-mingw32/include/SDL2 cl_dll/ script: - mkdir -p build && cd build - - cmake ../ -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DUSE_VOICEMGR=0 && make -j3 && rm -rf * - - cmake ../ -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DUSE_VOICEMGR=1 && make -j3 && rm -rf * \ No newline at end of file + - cmake ../ -DCMAKE_C_FLAGS="-O2 -pipe -DNDEBUG -march=nocona -fvisibility=hidden -fomit-frame-pointer" -DCMAKE_CXX_FLAGS="-fno-exceptions -fno-rtti" -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined -Wl,--strip-all" -DGOLDSOURCE_SUPPORT=1 -DUSE_VOICEMGR=0 && make -j3 + - mkdir -p gamelibs/cl_dlls + - mkdir -p gamelibs/dlls + - cp cl_dll/libclient.* gamelibs/cl_dlls + - cp dlls/libserver.* gamelibs/dlls + - tar -J -cf gamelibs.txz gamelibs + - curl --upload-file gamelibs.txz https://transfer.sh/gamelibs.txz From e0f475e80e05b00984fb52088f1230d84c724736 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Sun, 17 Dec 2017 22:46:44 +0500 Subject: [PATCH 03/14] Use branch name and OS name as tarball name. --- .travis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 00f3f479..da740958 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,9 +16,9 @@ before_script: script: - mkdir -p build && cd build - cmake ../ -DCMAKE_C_FLAGS="-O2 -pipe -DNDEBUG -march=nocona -fvisibility=hidden -fomit-frame-pointer" -DCMAKE_CXX_FLAGS="-fno-exceptions -fno-rtti" -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined -Wl,--strip-all" -DGOLDSOURCE_SUPPORT=1 -DUSE_VOICEMGR=0 && make -j3 - - mkdir -p gamelibs/cl_dlls - - mkdir -p gamelibs/dlls - - cp cl_dll/libclient.* gamelibs/cl_dlls - - cp dlls/libserver.* gamelibs/dlls - - tar -J -cf gamelibs.txz gamelibs - - curl --upload-file gamelibs.txz https://transfer.sh/gamelibs.txz + - mkdir -p $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC/cl_dlls + - mkdir -p $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC/dlls + - cp cl_dll/libclient.* $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC/cl_dlls + - cp dlls/libserver.* $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC/dlls + - tar -J -cf $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC.txz $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC + - curl --upload-file $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC.txz https://transfer.sh/$TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC.txz From b5650d56108f60d3b7e290edef835610a7d0dc65 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Mon, 18 Dec 2017 04:32:25 +0500 Subject: [PATCH 04/14] Do not use cpu-dependent optimization. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index da740958..dff12df2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ before_script: - mv SDL2-2.0.7/i686-w64-mingw32/include/SDL2 cl_dll/ script: - mkdir -p build && cd build - - cmake ../ -DCMAKE_C_FLAGS="-O2 -pipe -DNDEBUG -march=nocona -fvisibility=hidden -fomit-frame-pointer" -DCMAKE_CXX_FLAGS="-fno-exceptions -fno-rtti" -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined -Wl,--strip-all" -DGOLDSOURCE_SUPPORT=1 -DUSE_VOICEMGR=0 && make -j3 + - cmake ../ -DCMAKE_C_FLAGS="-O2 -pipe -DNDEBUG -fvisibility=hidden -fomit-frame-pointer" -DCMAKE_CXX_FLAGS="-fno-exceptions -fno-rtti" -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined -Wl,--strip-all" -DGOLDSOURCE_SUPPORT=1 -DUSE_VOICEMGR=0 && make -j3 - mkdir -p $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC/cl_dlls - mkdir -p $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC/dlls - cp cl_dll/libclient.* $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC/cl_dlls From df737ff88d5552e7d6fc0ac67ea60520d9f8f4e6 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Thu, 21 Dec 2017 17:12:05 +0500 Subject: [PATCH 05/14] Update .travis.yml --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index dff12df2..fb18612f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ script: - cmake ../ -DCMAKE_C_FLAGS="-O2 -pipe -DNDEBUG -fvisibility=hidden -fomit-frame-pointer" -DCMAKE_CXX_FLAGS="-fno-exceptions -fno-rtti" -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined -Wl,--strip-all" -DGOLDSOURCE_SUPPORT=1 -DUSE_VOICEMGR=0 && make -j3 - mkdir -p $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC/cl_dlls - mkdir -p $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC/dlls - - cp cl_dll/libclient.* $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC/cl_dlls - - cp dlls/libserver.* $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC/dlls + - cp cl_dll/client.* $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC/cl_dlls + - cp dlls/hl.* $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC/dlls - tar -J -cf $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC.txz $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC - curl --upload-file $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC.txz https://transfer.sh/$TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC.txz From c09fb29c931e3412326facb3155467aa1d4188e7 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Sun, 24 Dec 2017 19:06:29 +0500 Subject: [PATCH 06/14] Fix build. --- dlls/items.cpp | 4 ++-- dlls/triggers.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/items.cpp b/dlls/items.cpp index fb855365..b80016a6 100644 --- a/dlls/items.cpp +++ b/dlls/items.cpp @@ -219,7 +219,7 @@ class CItemArmorVest : public CItem ( pPlayer->pev->weapons & ( 1 << WEAPON_SUIT ) ) ) { pPlayer->pev->armorvalue += 60; - pPlayer->pev->armorvalue = min( pPlayer->pev->armorvalue, MAX_NORMAL_BATTERY ); + pPlayer->pev->armorvalue = Q_min( pPlayer->pev->armorvalue, MAX_NORMAL_BATTERY ); EMIT_SOUND( pPlayer->edict(), CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_NORM ); @@ -253,7 +253,7 @@ class CItemHelmet : public CItem ( pPlayer->pev->weapons & ( 1 << WEAPON_SUIT ) ) ) { pPlayer->pev->armorvalue += 40; - pPlayer->pev->armorvalue = min( pPlayer->pev->armorvalue, MAX_NORMAL_BATTERY ); + pPlayer->pev->armorvalue = Q_min( pPlayer->pev->armorvalue, MAX_NORMAL_BATTERY ); EMIT_SOUND( pPlayer->edict(), CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_NORM ); diff --git a/dlls/triggers.cpp b/dlls/triggers.cpp index 06e67cfe..de3929c5 100644 --- a/dlls/triggers.cpp +++ b/dlls/triggers.cpp @@ -2053,9 +2053,9 @@ void CTriggerPlayerFreeze::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, U pActivator = CBaseEntity::Instance( g_engfuncs.pfnPEntityOfEntIndex( 1 ) ); if( pActivator->pev->flags & FL_FROZEN ) - ( (CBasePlayer *)( pActivator )->EnableControl( TRUE ); + ( (CBasePlayer*)( pActivator ) )->EnableControl( TRUE ); else - ( (CBasePlayer *)( pActivator )->EnableControl( FALSE ); + ( (CBasePlayer*)( pActivator ) )->EnableControl( FALSE ); }; // this is a really bad idea. From bd3e21b864bc8c1a676ab0c6227d236d59cdb318 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Sat, 13 Jan 2018 08:57:22 +0500 Subject: [PATCH 07/14] Add gearbox-like env_warpball implementation. --- dlls/effects.cpp | 259 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 192 insertions(+), 67 deletions(-) diff --git a/dlls/effects.cpp b/dlls/effects.cpp index 32e56c4c..aeafe491 100644 --- a/dlls/effects.cpp +++ b/dlls/effects.cpp @@ -365,7 +365,7 @@ public: void Zap( const Vector &vecSrc, const Vector &vecDest ); void EXPORT StrikeUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ); void EXPORT ToggleUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ); - + static CLightning *LightningCreate( const char *pSpriteName, int width ); inline BOOL ServerSide( void ) { if( m_life == 0 && !( pev->spawnflags & SF_BEAM_RING ) ) @@ -912,6 +912,19 @@ void CLightning::BeamUpdateVars( void ) SetFlags( BEAM_FSHADEOUT ); } +CLightning *CLightning::LightningCreate( const char *pSpriteName, int width ) +{ + // Create a new entity with CLightning private data + CLightning *pBeam = GetClassPtr( (CLightning *)NULL ); + + pBeam->BeamInit( pSpriteName, width ); + pBeam->pev->classname = MAKE_STRING( "env_beam" ); + pBeam->m_iszSpriteName = MAKE_STRING( pSpriteName ); + pBeam->m_boltWidth = width; + + return pBeam; +} + LINK_ENTITY_TO_CLASS( env_laser, CLaser ) TYPEDESCRIPTION CLaser::m_SaveData[] = @@ -2240,114 +2253,226 @@ void CItemSoda::CanTouch( CBaseEntity *pOther ) #define SF_REMOVE_ON_FIRE 0x0001 #define SF_KILL_CENTER 0x0002 -class CEnvWarpBall : public CBaseEntity +class CWarpBall : public CBaseEntity { public: - void Precache( void ); - void Spawn( void ) { Precache(); } - void Think( void ); + void Precache(); + void Spawn(); + void EXPORT BallThink(); void KeyValue( KeyValueData *pkvd ); - void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ); - virtual int ObjectCaps( void ) { return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION; } - Vector vecOrigin; + void EXPORT WarpBallUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ); + static CWarpBall *CreateWarpBall( const Vector &p_VecOrigin ); + + int Save( CSave &save ); + int Restore( CRestore &restore ); + static TYPEDESCRIPTION m_SaveData[]; +// private: + CLightning *m_pBeams; + CSprite *m_pSprite; + // int m_iBeams; + float m_flLastTime; + float m_flMaxFrame; + float m_flBeamRadius; + string_t m_iszWarpTarget; + float m_flWarpStart; + float m_flDamageDelay; + // float m_flTargetDelay; + BOOL m_fPlaying; + BOOL m_fDamageApplied; + // BOOL m_fBeamsCleared; }; -LINK_ENTITY_TO_CLASS( env_warpball, CEnvWarpBall ) +LINK_ENTITY_TO_CLASS( env_warpball, CWarpBall ) + +TYPEDESCRIPTION CWarpBall::m_SaveData[] = +{ + // DEFINE_FIELD( CWarpBall, m_iBeams, FIELD_INTEGER ), + DEFINE_FIELD( CWarpBall, m_flLastTime, FIELD_FLOAT ), + DEFINE_FIELD( CWarpBall, m_flMaxFrame, FIELD_FLOAT ), + DEFINE_FIELD( CWarpBall, m_flBeamRadius, FIELD_FLOAT ), + DEFINE_FIELD( CWarpBall, m_iszWarpTarget, FIELD_STRING ), + DEFINE_FIELD( CWarpBall, m_flWarpStart, FIELD_FLOAT ), + DEFINE_FIELD( CWarpBall, m_flDamageDelay, FIELD_FLOAT ), + // DEFINE_FIELD( CWarpBall, m_flTargetDelay, FIELD_FLOAT ), + DEFINE_FIELD( CWarpBall, m_fPlaying, FIELD_BOOLEAN ), + DEFINE_FIELD( CWarpBall, m_fDamageApplied, FIELD_BOOLEAN ), + // DEFINE_FIELD( CWarpBall, m_fBeamsCleared, FIELD_BOOLEAN ), + DEFINE_FIELD( CWarpBall, m_pBeams, FIELD_CLASSPTR ), + DEFINE_FIELD( CWarpBall, m_pSprite, FIELD_CLASSPTR ), +}; + +IMPLEMENT_SAVERESTORE( CWarpBall, CBaseEntity ) -void CEnvWarpBall::KeyValue( KeyValueData *pkvd ) +void CWarpBall::KeyValue( KeyValueData *pkvd ) { if( FStrEq( pkvd->szKeyName, "radius" ) ) { - pev->button = atoi( pkvd->szValue ); + m_flBeamRadius = atof( pkvd->szValue ); pkvd->fHandled = TRUE; } else if( FStrEq( pkvd->szKeyName, "warp_target" ) ) { - pev->message = ALLOC_STRING( pkvd->szValue ); + m_iszWarpTarget = ALLOC_STRING( pkvd->szValue ); pkvd->fHandled = TRUE; } else if( FStrEq( pkvd->szKeyName, "damage_delay" ) ) { - pev->frags = atof( pkvd->szValue ); + m_flDamageDelay = atof( pkvd->szValue ); pkvd->fHandled = TRUE; } else CBaseEntity::KeyValue( pkvd ); } -void CEnvWarpBall::Precache( void ) +void CWarpBall::Spawn() +{ + Precache(); + pev->movetype = MOVETYPE_NONE; + pev->solid = SOLID_NOT; + UTIL_SetOrigin( pev, pev->origin ); + UTIL_SetSize( pev, Vector( 0, 0, 0 ), Vector( 0, 0, 0 ) ); + pev->rendermode = kRenderGlow; + pev->renderamt = 255; + pev->renderfx = kRenderFxNoDissipation; + pev->framerate = 10; + m_pSprite = CSprite::SpriteCreate( "sprites/Fexplo1.spr", pev->origin, 1 ); + m_pSprite->TurnOff(); + SetUse( &CWarpBall::WarpBallUse ); +} + +void CWarpBall::Precache() { PRECACHE_MODEL( "sprites/lgtning.spr" ); PRECACHE_MODEL( "sprites/Fexplo1.spr" ); - PRECACHE_SOUND( "debris/beamstart2.wav" ); - PRECACHE_SOUND( "debris/beamstart7.wav" ); + PRECACHE_MODEL( "sprites/XFlare1.spr" ); + PRECACHE_SOUND( "debris/alien_teleport.wav" ); } -void CEnvWarpBall::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) +void CWarpBall::WarpBallUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { - int iTimes = 0; - int iDrawn = 0; - TraceResult tr; - Vector vecDest; - CBeam *pBeam; - CBaseEntity *pEntity = UTIL_FindEntityByTargetname( NULL, STRING( pev->message ) ); - edict_t *pos; + CBaseEntity *pEntity; + int r = 77, g = 210, b = 130; + + if( m_fPlaying ) + return; - if( pEntity )//target found ? + if( m_iszWarpTarget ) { - vecOrigin = pEntity->pev->origin; - pos = pEntity->edict(); + pEntity = UTIL_FindEntityByTargetname( NULL, STRING( m_iszWarpTarget ) ); + if( pEntity ) + UTIL_SetOrigin( pev, pEntity->pev->origin ); } - else + + SET_MODEL( ENT( pev ), "sprites/XFlare1.spr" ); + m_flMaxFrame = (float)MODEL_FRAMES( pev->modelindex ) - 1; + + pev->rendercolor = Vector( r, g, b ); + pev->scale = 1.2; + pev->frame = 0; + + if( m_pSprite ) { - //use as center - vecOrigin = pev->origin; - pos = edict(); - } - EMIT_SOUND( pos, CHAN_BODY, "debris/beamstart2.wav", 1, ATTN_NORM ); - UTIL_ScreenShake( vecOrigin, 6, 160, 1.0, pev->button ); - CSprite *pSpr = CSprite::SpriteCreate( "sprites/Fexplo1.spr", vecOrigin, TRUE ); - pSpr->AnimateAndDie( 18 ); - pSpr->SetTransparency( kRenderGlow, 77, 210, 130, 255, kRenderFxNoDissipation ); - EMIT_SOUND( pos, CHAN_ITEM, "debris/beamstart7.wav", 1, ATTN_NORM ); - int iBeams = RANDOM_LONG( 20, 40 ); - while( iDrawn < iBeams && iTimes < ( iBeams * 3 ) ) - { - vecDest = pev->button * ( Vector( RANDOM_FLOAT( -1,1 ), RANDOM_FLOAT( -1,1 ), RANDOM_FLOAT( -1,1 ) ).Normalize() ); - UTIL_TraceLine( vecOrigin, vecOrigin + vecDest, ignore_monsters, NULL, &tr ); - if( tr.flFraction != 1.0 ) + m_pSprite->SetTransparency( kRenderGlow, r, g, b, 255, kRenderFxNoDissipation ); + m_pSprite->pev->scale = 1.0; + m_pSprite->TurnOn(); + } + + if( !m_pBeams ) + { + m_pBeams = CLightning::LightningCreate( "sprites/lgtning.spr", 18 ); + + if( m_pBeams ) { - // we hit something. - iDrawn++; - pBeam = CBeam::BeamCreate( "sprites/lgtning.spr", 200 ); - pBeam->PointsInit( vecOrigin, tr.vecEndPos ); - pBeam->SetColor( 20, 243, 20 ); - pBeam->SetNoise( 65 ); - pBeam->SetBrightness( 220 ); - pBeam->SetWidth( 30 ); - pBeam->SetScrollRate( 35 ); - pBeam->SetThink( &CBeam:: SUB_Remove ); - pBeam->pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 0.5, 1.6 ); + UTIL_SetOrigin( m_pBeams->pev, pev->origin ); + m_pBeams->m_restrike = -0.5; + m_pBeams->SetColor( 0, 255, 0 ); + m_pBeams->m_noiseAmplitude = 65; + m_pBeams->m_life = 0.5; + m_pBeams->m_radius = m_flBeamRadius; + m_pBeams->m_iszStartEntity = pev->targetname; + SetBits( m_pBeams->pev->spawnflags, SF_BEAM_TOGGLE | SF_BEAM_SPARKEND ); + m_pBeams->BeamUpdateVars(); } - iTimes++; } - pev->nextthink = gpGlobals->time + pev->frags; + + if( m_pBeams ) + { + m_pBeams->Spawn(); + m_pBeams->pev->solid = SOLID_NOT; + m_pBeams->SetThink( &CLightning::StrikeThink ); + m_pBeams->pev->nextthink = gpGlobals->time + 0.1; + } + + SetThink( &CWarpBall::BallThink ); + pev->nextthink = gpGlobals->time + 0.1; + + m_flLastTime = gpGlobals->time; + // m_fBeamsCleared = FALSE; + m_fPlaying = TRUE; + + if( !m_flDamageDelay ) + { + RadiusDamage( pev->origin, pev, pev, 300.0, 48.0, CLASS_NONE, DMG_SHOCK ); + m_fDamageApplied = TRUE; + } + else + { + m_fDamageApplied = FALSE; + } + + SUB_UseTargets( this, USE_TOGGLE, 0.0 ); + UTIL_ScreenShake( pev->origin, 4.0, 100.0, 2.0, 1000.0 ); + m_flWarpStart = gpGlobals->time; + EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, "debris/alien_teleport.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); } -void CEnvWarpBall::Think( void ) +void CWarpBall::BallThink( void ) { - SUB_UseTargets( this, USE_TOGGLE, 0 ); + pev->frame = ( gpGlobals->time - m_flLastTime ) * pev->framerate + pev->frame; + if( pev->frame > m_flMaxFrame ) + { + SET_MODEL( ENT( pev ), "" ); + SetThink( NULL ); + if( pev->spawnflags & SF_REMOVE_ON_FIRE ) + { + UTIL_Remove( m_pSprite ); + UTIL_Remove( m_pBeams ); + UTIL_Remove( this ); + } - if( pev->spawnflags & SF_KILL_CENTER ) + if( m_pSprite ) + m_pSprite->TurnOff(); + m_fPlaying = 0; + } + else { - CBaseEntity *pMonster = NULL; + if( ( pev->spawnflags & SF_KILL_CENTER ) && !m_fDamageApplied + && gpGlobals->time - m_flWarpStart >= m_flDamageDelay ) + { + RadiusDamage( pev->origin, pev, pev, 300.0, 48.0, CLASS_NONE, DMG_SHOCK ); + m_fDamageApplied = TRUE; + } - while( ( pMonster = UTIL_FindEntityInSphere( pMonster, vecOrigin, 72 ) ) != NULL ) + if( m_pBeams ) { - if( FBitSet( pMonster->pev->flags, FL_MONSTER ) || FClassnameIs( pMonster->pev, "player" ) ) - pMonster->TakeDamage( pev, pev, 100, DMG_GENERIC ); + if( pev->frame >= m_flMaxFrame - 4.0 ) + { + m_pBeams->SetThink( NULL ); + m_pBeams->pev->nextthink = gpGlobals->time; + } } - } - if( pev->spawnflags & SF_REMOVE_ON_FIRE ) - UTIL_Remove( this ); + + pev->nextthink = gpGlobals->time + 0.1; + m_flLastTime = gpGlobals->time; + } +} + +CWarpBall *CWarpBall::CreateWarpBall( const Vector &p_VecOrigin ) +{ + // Create a new entity with CWarpball private data + CWarpBall *pWarpBall = GetClassPtr( (CWarpBall *)NULL ); + pWarpBall->pev->classname = MAKE_STRING( "env_warpball" ); + + UTIL_SetOrigin( pWarpBall->pev, p_VecOrigin ); + return pWarpBall; } From 1e529268980f59c337f0f149fd57b0ecbba4db3e Mon Sep 17 00:00:00 2001 From: Night Owl Date: Sat, 13 Jan 2018 15:04:16 +0500 Subject: [PATCH 08/14] Fix monster_generic. --- dlls/genericmonster.cpp | 89 ++++++++++++++++++++++++++++++++++++++--- dlls/talkmonster.cpp | 2 +- 2 files changed, 85 insertions(+), 6 deletions(-) diff --git a/dlls/genericmonster.cpp b/dlls/genericmonster.cpp index 4483085d..2df9ddc4 100644 --- a/dlls/genericmonster.cpp +++ b/dlls/genericmonster.cpp @@ -20,7 +20,6 @@ #include "cbase.h" #include "monsters.h" #include "schedule.h" -#include "talkmonster.h" // For holograms, make them not solid so the player can walk through them #define SF_GENERICMONSTER_NOTSOLID 4 @@ -29,8 +28,7 @@ //========================================================= // Monster's Anim Events Go Here //========================================================= - -class CGenericMonster : public CTalkMonster +class CGenericMonster : public CBaseMonster { public: void Spawn( void ); @@ -39,10 +37,33 @@ public: int Classify( void ); void HandleAnimEvent( MonsterEvent_t *pEvent ); int ISoundMask( void ); + void PlayScriptedSentence( const char *pszSentence, float duration, float volume, float attenuation, BOOL bConcurrent, CBaseEntity *pListener ); + void IdleHeadTurn( Vector &vecFriend ); + void EXPORT MonsterThink(); + + int Save( CSave &save ); + int Restore( CRestore &restore ); + static TYPEDESCRIPTION m_SaveData[]; + +private: + float m_talkTime; + EHANDLE m_hTalkTarget; + float m_flIdealYaw; + float m_flCurrentYaw; }; LINK_ENTITY_TO_CLASS( monster_generic, CGenericMonster ) +TYPEDESCRIPTION CGenericMonster::m_SaveData[] = +{ + DEFINE_FIELD( CGenericMonster, m_talkTime, FIELD_FLOAT ), + DEFINE_FIELD( CGenericMonster, m_hTalkTarget, FIELD_EHANDLE ), + DEFINE_FIELD( CGenericMonster, m_flIdealYaw, FIELD_FLOAT ), + DEFINE_FIELD( CGenericMonster, m_flCurrentYaw, FIELD_FLOAT ), +}; + +IMPLEMENT_SAVERESTORE( CGenericMonster, CBaseMonster ) + //========================================================= // Classify - indicates this monster's place in the // relationship table. @@ -126,6 +147,8 @@ void CGenericMonster::Spawn() m_afCapability = bits_CAP_TURN_HEAD; } + m_flIdealYaw = m_flCurrentYaw = 0; + if( pev->spawnflags & SF_GENERICMONSTER_NOTSOLID ) { pev->solid = SOLID_NOT; @@ -138,11 +161,67 @@ void CGenericMonster::Spawn() //========================================================= void CGenericMonster::Precache() { - CTalkMonster::Precache(); - TalkInit(); PRECACHE_MODEL( STRING( pev->model ) ); } +void CGenericMonster::PlayScriptedSentence( const char *pszSentence, float duration, float volume, float attenuation, BOOL bConcurrent, CBaseEntity *pListener ) +{ + m_talkTime = gpGlobals->time + duration; + PlaySentence( pszSentence, duration, volume, attenuation ); + + m_hTalkTarget = pListener; +} + +void CGenericMonster::IdleHeadTurn( Vector &vecFriend ) +{ + // turn head in desired direction only if ent has a turnable head + if( m_afCapability & bits_CAP_TURN_HEAD ) + { + float yaw = VecToYaw( vecFriend - pev->origin ) - pev->angles.y; + + if( yaw > 180 ) + yaw -= 360; + if( yaw < -180 ) + yaw += 360; + + m_flIdealYaw = yaw; + } +} + +void CGenericMonster::MonsterThink() +{ + if( m_afCapability & bits_CAP_TURN_HEAD ) + { + if( m_hTalkTarget != 0 ) + { + if( gpGlobals->time > m_talkTime ) + { + m_flIdealYaw = 0; + m_hTalkTarget = 0; + } + else + { + IdleHeadTurn( m_hTalkTarget->pev->origin ); + } + } + + if( m_flCurrentYaw != m_flIdealYaw ) + { + if( m_flCurrentYaw <= m_flIdealYaw ) + { + m_flCurrentYaw += Q_min( m_flIdealYaw - m_flCurrentYaw, 20.0f ); + } + else + { + m_flCurrentYaw -= Q_min( m_flCurrentYaw - m_flIdealYaw, 20.0f ); + } + SetBoneController( 0, m_flCurrentYaw ); + } + } + + CBaseMonster::MonsterThink(); +} + //========================================================= // AI Schedules Specific to this monster //========================================================= diff --git a/dlls/talkmonster.cpp b/dlls/talkmonster.cpp index e755c4b0..03fb40fc 100644 --- a/dlls/talkmonster.cpp +++ b/dlls/talkmonster.cpp @@ -880,7 +880,7 @@ int CTalkMonster::FOkToSpeak( void ) return FALSE; // monster generic can speak always - if( pev->spawnflags & SF_MONSTER_GAG && !FClassnameIs( pev, "monster_generic" ) ) + if( pev->spawnflags & SF_MONSTER_GAG ) return FALSE; if( m_MonsterState == MONSTERSTATE_PRONE ) From c55bdc41ce9fd49ee89c24c95d136b06d6810e5c Mon Sep 17 00:00:00 2001 From: Night Owl Date: Sat, 13 Jan 2018 15:52:06 +0500 Subject: [PATCH 09/14] Fix HUD color. --- cl_dll/hud.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cl_dll/hud.h b/cl_dll/hud.h index adfae025..7ac6a042 100644 --- a/cl_dll/hud.h +++ b/cl_dll/hud.h @@ -22,8 +22,8 @@ #pragma once #ifndef HUD_H #define HUD_H -#define RGB_YELLOWISH 0x008080FF //128,128,255 -#define RGB_REDISH 0x008080FF //128,128,255 +#define RGB_YELLOWISH 0x005F5FFF //95,95,255 +#define RGB_REDISH 0x00FF1010 //255,16,16 #define RGB_GREENISH 0x0000A000 //0,160,0 #include "wrect.h" From 6909ca4f297ce2335f4b3cfe932c5caf1c728a2c Mon Sep 17 00:00:00 2001 From: Night Owl Date: Sat, 13 Jan 2018 18:05:42 +0500 Subject: [PATCH 10/14] Fix monster_rosenberg pain sounds. --- dlls/scientist.cpp | 72 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 59 insertions(+), 13 deletions(-) diff --git a/dlls/scientist.cpp b/dlls/scientist.cpp index 947ad65a..8ee3a3cc 100644 --- a/dlls/scientist.cpp +++ b/dlls/scientist.cpp @@ -697,12 +697,26 @@ void CScientist::Spawn( void ) void CScientist::Precache( void ) { PRECACHE_MODEL( "models/scientist.mdl" ); - PRECACHE_SOUND( "scientist/sci_pain1.wav" ); - PRECACHE_SOUND( "scientist/sci_pain2.wav" ); - PRECACHE_SOUND( "scientist/sci_pain3.wav" ); - PRECACHE_SOUND( "scientist/sci_pain4.wav" ); - PRECACHE_SOUND( "scientist/sci_pain5.wav" ); - PRECACHE_SOUND( "rosenberg/ro_pain1.wav" ); + if( !FClassnameIs( pev, "monster_rosenberg" ) ) + { + PRECACHE_SOUND( "scientist/sci_pain1.wav" ); + PRECACHE_SOUND( "scientist/sci_pain2.wav" ); + PRECACHE_SOUND( "scientist/sci_pain3.wav" ); + PRECACHE_SOUND( "scientist/sci_pain4.wav" ); + PRECACHE_SOUND( "scientist/sci_pain5.wav" ); + } + else + { + PRECACHE_SOUND( "rosenberg/ro_pain0.wav" ); + PRECACHE_SOUND( "rosenberg/ro_pain1.wav" ); + PRECACHE_SOUND( "rosenberg/ro_pain2.wav" ); + PRECACHE_SOUND( "rosenberg/ro_pain3.wav" ); + PRECACHE_SOUND( "rosenberg/ro_pain4.wav" ); + PRECACHE_SOUND( "rosenberg/ro_pain5.wav" ); + PRECACHE_SOUND( "rosenberg/ro_pain6.wav" ); + PRECACHE_SOUND( "rosenberg/ro_pain7.wav" ); + PRECACHE_SOUND( "rosenberg/ro_pain8.wav" ); + } // every new scientist must call this, otherwise // when a level is loaded, nobody will talk (time is reset to 0) @@ -786,7 +800,7 @@ void CScientist::TalkInit() m_voicePitch = 95; break; //luther case HEAD_SLICK: - m_voicePitch = 85; + m_voicePitch = 100; break; //slick } } @@ -824,32 +838,64 @@ int CScientist::ISoundMask( void ) //========================================================= void CScientist::PainSound( void ) { + const char *pszSound; if( gpGlobals->time < m_painTime ) return; m_painTime = gpGlobals->time + RANDOM_FLOAT( 0.5, 0.75 ); if( FClassnameIs( pev, "monster_rosenberg" ) ) - EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "rosenberg/ro_pain1.wav", 1, ATTN_NORM, 0, GetVoicePitch() ); + switch( RANDOM_LONG( 0, 8 ) ) + { + case 0: + pszSound = "rosenberg/ro_pain0.wav"; + break; + case 1: + pszSound = "rosenberg/ro_pain1.wav"; + break; + case 2: + pszSound = "rosenberg/ro_pain2.wav"; + break; + case 3: + pszSound = "rosenberg/ro_pain3.wav"; + break; + case 4: + pszSound = "rosenberg/ro_pain4.wav"; + break; + case 5: + pszSound = "rosenberg/ro_pain5.wav"; + break; + case 6: + pszSound = "rosenberg/ro_pain6.wav"; + break; + case 7: + pszSound = "rosenberg/ro_pain7.wav"; + break; + case 8: + pszSound = "rosenberg/ro_pain8.wav"; + break; + } else switch( RANDOM_LONG( 0, 4 ) ) { case 0: - EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "scientist/sci_pain1.wav", 1, ATTN_NORM, 0, GetVoicePitch() ); + pszSound = "scientist/sci_pain1.wav"; break; case 1: - EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "scientist/sci_pain2.wav", 1, ATTN_NORM, 0, GetVoicePitch() ); + pszSound = "scientist/sci_pain2.wav"; break; case 2: - EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "scientist/sci_pain3.wav", 1, ATTN_NORM, 0, GetVoicePitch() ); + pszSound = "scientist/sci_pain3.wav"; break; case 3: - EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "scientist/sci_pain4.wav", 1, ATTN_NORM, 0, GetVoicePitch() ); + pszSound = "scientist/sci_pain4.wav"; break; case 4: - EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "scientist/sci_pain5.wav", 1, ATTN_NORM, 0, GetVoicePitch() ); + pszSound = "scientist/sci_pain5.wav"; break; } + + EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pszSound, 1, ATTN_NORM, 0, GetVoicePitch() ); } //========================================================= From 8b876213b990e9056e3017b2f92931f5c57e6f32 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Mon, 15 Jan 2018 22:40:50 +0500 Subject: [PATCH 11/14] Revert unneeded changes. --- dlls/items.cpp | 5 +++++ dlls/triggers.cpp | 1 + 2 files changed, 6 insertions(+) diff --git a/dlls/items.cpp b/dlls/items.cpp index b80016a6..a3832ef5 100644 --- a/dlls/items.cpp +++ b/dlls/items.cpp @@ -283,6 +283,11 @@ class CItemBattery : public CItem } BOOL MyTouch( CBasePlayer *pPlayer ) { + if( pPlayer->pev->deadflag != DEAD_NO ) + { + return FALSE; + } + if( ( pPlayer->pev->armorvalue < MAX_NORMAL_BATTERY ) && ( pPlayer->pev->weapons & ( 1 << WEAPON_SUIT ) ) ) { diff --git a/dlls/triggers.cpp b/dlls/triggers.cpp index de3929c5..abf487be 100644 --- a/dlls/triggers.cpp +++ b/dlls/triggers.cpp @@ -1190,6 +1190,7 @@ void CBaseTrigger::CounterUse( CBaseEntity *pActivator, CBaseEntity *pCaller, US return; BOOL fTellActivator = + ( m_hActivator != 0 ) && FClassnameIs( m_hActivator->pev, "player" ) && !FBitSet( pev->spawnflags, SPAWNFLAG_NOMESSAGE ); if( m_cTriggersLeft != 0 ) From 0082093ecbd75293e88390537bd8875a565b711d Mon Sep 17 00:00:00 2001 From: Night Owl Date: Tue, 16 Jan 2018 14:07:18 +0500 Subject: [PATCH 12/14] Give armorvest and helmet when using impulse 101 cheat. --- dlls/player.cpp | 4 +++- dlls/weapons.cpp | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/player.cpp b/dlls/player.cpp index 52f5f546..c8147c68 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -3446,7 +3446,9 @@ void CBasePlayer::CheatImpulseCommands( int iImpulse ) case 101: gEvilImpulse101 = TRUE; GiveNamedItem( "item_suit" ); - GiveNamedItem( "item_battery" ); + GiveNamedItem( "item_armorvest" ); + GiveNamedItem( "item_helmet" ); + // GiveNamedItem( "item_battery" ); GiveNamedItem( "weapon_crowbar" ); GiveNamedItem( "weapon_9mmhandgun" ); GiveNamedItem( "ammo_9mmclip" ); diff --git a/dlls/weapons.cpp b/dlls/weapons.cpp index 5e4f8f78..4cfc8928 100644 --- a/dlls/weapons.cpp +++ b/dlls/weapons.cpp @@ -296,6 +296,8 @@ void W_Precache( void ) // common world objects UTIL_PrecacheOther( "item_suit" ); UTIL_PrecacheOther( "item_healthkit" ); + UTIL_PrecacheOther( "item_armorvest" ); + UTIL_PrecacheOther( "item_helmet" ); UTIL_PrecacheOther( "item_battery" ); UTIL_PrecacheOther( "item_antidote" ); UTIL_PrecacheOther( "item_security" ); From 8fe35e953802dc204fc25444ff1eced606c64afc Mon Sep 17 00:00:00 2001 From: Night Owl Date: Tue, 16 Jan 2018 14:32:55 +0500 Subject: [PATCH 13/14] Use crowbar idle animation. --- cl_dll/Android.mk | 2 +- cl_dll/CMakeLists.txt | 2 +- dlls/Android.mk | 2 +- dlls/CMakeLists.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cl_dll/Android.mk b/cl_dll/Android.mk index 68917633..779c7a27 100755 --- a/cl_dll/Android.mk +++ b/cl_dll/Android.mk @@ -92,7 +92,7 @@ SRCS+=./input_xash3d.cpp SRCS+=./scoreboard.cpp SRCS+=./MOTD.cpp INCLUDES = -I../common -I. -I../game_shared -I../pm_shared -I../engine -I../dlls -I../utils/false_vgui/include -DEFINES = -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -w +DEFINES = -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -DCROWBAR_IDLE_ANIM -w LOCAL_C_INCLUDES := $(LOCAL_PATH)/. \ $(LOCAL_PATH)/../common \ diff --git a/cl_dll/CMakeLists.txt b/cl_dll/CMakeLists.txt index 2d247950..733f8a19 100644 --- a/cl_dll/CMakeLists.txt +++ b/cl_dll/CMakeLists.txt @@ -25,7 +25,7 @@ project (CLDLL) set (CLDLL_LIBRARY client) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -w") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -DCROWBAR_IDLE_ANIM -w") if (GOLDSOURCE_SUPPORT) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGOLDSOURCE_SUPPORT") endif() diff --git a/dlls/Android.mk b/dlls/Android.mk index 1dc79616..34505c4b 100644 --- a/dlls/Android.mk +++ b/dlls/Android.mk @@ -14,7 +14,7 @@ LOCAL_MODULE_FILENAME = libserver_hardfp endif LOCAL_CFLAGS += -D_LINUX -DCLIENT_WEAPONS -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf \ - -fno-exceptions -DNO_VOICEGAMEMGR -w + -fno-exceptions -DNO_VOICEGAMEMGR -DCROWBAR_IDLE_ANIM -w LOCAL_CPPFLAGS := $(LOCAL_CFLAGS) diff --git a/dlls/CMakeLists.txt b/dlls/CMakeLists.txt index 480b61d1..4599e986 100644 --- a/dlls/CMakeLists.txt +++ b/dlls/CMakeLists.txt @@ -25,7 +25,7 @@ project (SVDLL) set (SVDLL_LIBRARY server) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_LINUX -DCLIENT_WEAPONS -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf -fno-exceptions -w") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_LINUX -DCLIENT_WEAPONS -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf -fno-exceptions -DCROWBAR_IDLE_ANIM -w") set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}") set (SVDLL_SOURCES From 5f8afd6e790dcf3cf2544367f185084b6bd98332 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Tue, 29 Oct 2019 04:53:57 +0300 Subject: [PATCH 14/14] Enable more crowbar fixes for Blue Shift --- cl_dll/CMakeLists.txt | 2 +- dlls/CMakeLists.txt | 2 +- dlls/crowbar.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cl_dll/CMakeLists.txt b/cl_dll/CMakeLists.txt index ff57dd24..3ca67a90 100644 --- a/cl_dll/CMakeLists.txt +++ b/cl_dll/CMakeLists.txt @@ -25,7 +25,7 @@ project (CLDLL) set (CLDLL_LIBRARY client) -add_definitions(-DCLIENT_WEAPONS -DCLIENT_DLL -DCROWBAR_IDLE_ANIM) +add_definitions(-DCLIENT_WEAPONS -DCLIENT_DLL -DCROWBAR_IDLE_ANIM -DCROWBAR_FIX_RAPID_CROWBAR -DCROWBAR_DELAY_FIX) if(NOT MSVC) add_compile_options(-fno-exceptions) # GCC/Clang flag diff --git a/dlls/CMakeLists.txt b/dlls/CMakeLists.txt index 7d13d5f3..6bee15ea 100644 --- a/dlls/CMakeLists.txt +++ b/dlls/CMakeLists.txt @@ -25,7 +25,7 @@ project (SVDLL) set (SVDLL_LIBRARY server) -add_definitions(-DCLIENT_WEAPONS -DCROWBAR_IDLE_ANIM) +add_definitions(-DCLIENT_WEAPONS -DCROWBAR_IDLE_ANIM -DCROWBAR_FIX_RAPID_CROWBAR -DCROWBAR_DELAY_FIX) if(NOT MSVC) add_compile_options(-fno-exceptions) # GCC/Clang flag diff --git a/dlls/crowbar.cpp b/dlls/crowbar.cpp index bb7d1e38..acfa0674 100644 --- a/dlls/crowbar.cpp +++ b/dlls/crowbar.cpp @@ -335,7 +335,7 @@ int CCrowbar::Swing( int fFirst ) SetThink( &CCrowbar::Smack ); pev->nextthink = UTIL_WeaponTimeBase() + 0.2; #endif -#if CROWBAR_DELAY_FIX +#ifdef CROWBAR_DELAY_FIX m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25; #else m_flNextPrimaryAttack = GetNextAttackDelay( 0.25 );