From 2ad83a9adaaa03890e628c96b8eecbd2468c2806 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Mon, 9 Jan 2017 03:10:08 +0500 Subject: [PATCH] Merge original "BubbleMOD" source code. --- dlls/client.cpp | 273 ++++++++++++ dlls/combat.cpp | 47 +- dlls/crossbow.cpp | 64 ++- dlls/crowbar.cpp | 96 +++- dlls/doors.cpp | 5 + dlls/egon.cpp | 19 +- dlls/func_tank.cpp | 4 + dlls/game.cpp | 783 +++++++++++++++++++++++++++++++++ dlls/game.h | 109 +++++ dlls/gamerules.h | 17 + dlls/gauss.cpp | 14 +- dlls/ggrenade.cpp | 140 +++++- dlls/globals.cpp | 8 + dlls/h_battery.cpp | 6 + dlls/handgrenade.cpp | 13 + dlls/healthkit.cpp | 8 + dlls/hornetgun.cpp | 831 ++++++++++++++++++++++++++++++++++- dlls/items.cpp | 6 + dlls/mp5.cpp | 40 +- dlls/multiplay_gamerules.cpp | 393 ++++++++++++++++- dlls/player.cpp | 170 ++++++- dlls/player.h | 52 +++ dlls/python.cpp | 2 +- dlls/rpg.cpp | 15 +- dlls/satchel.cpp | 50 +++ dlls/shotgun.cpp | 53 ++- dlls/squeakgrenade.cpp | 120 +++-- dlls/teamplay_gamerules.cpp | 57 ++- dlls/triggers.cpp | 6 + dlls/tripmine.cpp | 88 ++-- dlls/util.h | 18 + dlls/weapons.cpp | 84 +++- dlls/weapons.h | 24 +- dlls/world.cpp | 59 ++- 34 files changed, 3510 insertions(+), 164 deletions(-) diff --git a/dlls/client.cpp b/dlls/client.cpp index 21e5d810..61459b5d 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -50,6 +50,15 @@ extern int gmsgSayText; extern int g_teamplay; +// BMOD Begin - Extra funtions and vars +extern DLL_GLOBAL int g_VoteStatus; +extern DLL_GLOBAL float g_VoteTimer; +extern cvar_t bm_voting; +extern cvar_t bm_votetime; +extern cvar_t timeleft, fragsleft; +extern int CountPlayers( void ); +// BMOD End - Extra funtions and vars + void LinkUserMessages( void ); /* @@ -287,6 +296,31 @@ void Host_Say( edict_t *pEntity, int teamonly ) if( (int)strlen( p ) > j ) p[j] = 0; + / BMOD Start - Llamas!! + if( ( (CBasePlayer*)CBasePlayer::Instance( pEntity ) )->m_IsLlama ) + { + switch( RANDOM_LONG( 0, 3 ) ) + { + case 0: + strcpy( p, "Bleeeet!" ); + break; + case 1: + strcpy( p, "Blaaaaa!!" ); + break; + case 2: + strcpy( p, "Snort!" ); + break; + case 3: + strcpy( p, "Blleehhaa!" ); + break; + } + } + // BMOD End - Llamas!! + + // BMOD Edit - L33t Sp33k!! + if( ( (CBasePlayer*)CBasePlayer::Instance( pEntity ) )->m_LeetSpeak ) + UTIL_Speak_2_l33t( text, p ); + else strcat( text, p ); strcat( text, "\n" ); @@ -358,6 +392,198 @@ void Host_Say( edict_t *pEntity, int teamonly ) temp, p ); } + // BMOD Begin - client say commands + CBasePlayer *talker = (CBasePlayer*)CBasePlayer::Instance( pEntity ); + + // BMOD Begin - Anti Spam + talker->m_iSpamSay++; + // BMOD End - Anti Spam + if( !strcmp( p, "timeleft" ) ) + { + if( timeleft.value ) + UTIL_ClientPrintAll( HUD_PRINTTALK, UTIL_VarArgs( " %i:%0.2i left on this map.\n", + (int)timeleft.value / 60, (int)timeleft.value % 60 ) ); + else + UTIL_ClientPrintAll( HUD_PRINTTALK, " No time limit on this map.\n" ); + } + else if( !strcmp( p, "gagform" ) ) + { + UTIL_ClientPrintAll( HUD_PRINTTALK, " I was just kidding Form. :)\n" ); + } + else if( !strcmp( p, "fragsleft" ) ) + { + if( fragsleft.value ) + UTIL_ClientPrintAll( HUD_PRINTTALK, UTIL_VarArgs( " %i frags left on this map.\n", + (int)fragsleft.value ) ); + else + UTIL_ClientPrintAll( HUD_PRINTTALK, " No frag limit on this map.\n" ); + } + else if( !strcmp( p, "map" ) ) + { + // g_pGameRules->BMOD_PreChangeLevel(); + UTIL_ClientPrintAll( HUD_PRINTTALK, UTIL_VarArgs( " Current map is: \"%s\", next is: \"%s\"\n", + STRING( gpGlobals->mapname ), + CVAR_GET_STRING( "bm_nextmap" ) ) ); + } + else if( !strcmp( p, "status" ) ) + { + // g_pGameRules->BMOD_PreChangeLevel(); + UTIL_ClientPrintAll( HUD_PRINTTALK, UTIL_VarArgs( " Timeleft: %i:%0.2i Fragsleft: %i Map: \"%s\" Next: \"%s\"\n", + (int)timeleft.value / 60, + (int)timeleft.value % 60, + (int)fragsleft.value, + STRING( gpGlobals->mapname ), + CVAR_GET_STRING( "bm_nextmap" ) ) ); + } + else if( !strcmp( p, "time" ) ) + { + UTIL_SayTime(); + } + // map voting + else if( !strcmp( p, "rockthevote" ) && ( g_VoteStatus == 1 ) ) + { + int players = CountPlayers(); + int votesNeeded = ( players * 3 / 4 ) + ( ( players < 3 ) ? 1 : 0 ); + + char winner[81]; + strcpy( winner, UTIL_CountVotes() ); + int winvotes = winner[0]; + + if( winvotes ) + UTIL_ClientPrintAll( HUD_PRINTTALK, UTIL_VarArgs( " %i:%0.2i remaining in current vote. \"%s\" is leading with %i vote(s). (needs %i to win with %i players)\n", + (int)( g_VoteTimer - gpGlobals->time ) / 60, + (int)( g_VoteTimer - gpGlobals->time ) % 60, + &(winner[1]), + winvotes, + votesNeeded, + players ) ); + else + UTIL_ClientPrintAll( HUD_PRINTTALK, UTIL_VarArgs( " %i:%0.2i remaining in current vote. No votes have been cast. (winner needs %i to win with %i players)\n", + (int)( g_VoteTimer - gpGlobals->time ) / 60, + (int)( g_VoteTimer - gpGlobals->time ) % 60, + votesNeeded, + players ) ); + } + else if( !strcmp( p, "rockthevote" ) && ( g_VoteStatus == 0 ) ) + { + if( !bm_voting.value ) + { + UTIL_ClientPrintAll( HUD_PRINTTALK, " Voting is disabled on this server.\n" ); + } + else if( timeleft.value > 0 && timeleft.value < bm_votetime.value ) + { + UTIL_ClientPrintAll( HUD_PRINTTALK, " Not enough time left for a vote!\n" ); + + } + else + { + g_VoteStatus = 1; + int players = CountPlayers(); + int votesNeeded = ( players * 3 / 4 ) + ( ( players < 3 ) ? 1 : 0 ); + + UTIL_SpeakAll( "dadeda" ); + UTIL_ClientPrintAll( HUD_PRINTTALK, " *** Vote mode enabled! ***\n" ); + UTIL_ClientPrintAll( HUD_PRINTTALK, " Say \"vote \" to vote for a map.\n" ); + UTIL_ClientPrintAll( HUD_PRINTTALK, " Say \"vote extend\" to extend the current map.\n" ); + UTIL_ClientPrintAll( HUD_PRINTTALK, UTIL_VarArgs( " Maps need %i votes with %i players to win.\n", + votesNeeded, players ) ); + UTIL_LogPrintf( "// \"%s<%i><%s><%s>\" started a new map vote.\n", + STRING( talker->pev->netname ), + GETPLAYERUSERID( pEntity ), + GETPLAYERAUTHID( pEntity ), + g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( pEntity ), "model" ) + ); + + client = NULL; + while( ( ( client = (CBasePlayer*)UTIL_FindEntityByClassname( client, "player" ) ) != NULL ) + && ( !FNullEnt( client->edict() ) ) ) + { + strcpy( client->m_sMapVote, "" ); + } + g_VoteTimer = gpGlobals->time + bm_votetime.value; + } + } + else if( ( g_VoteStatus == 1 ) && ( strlen( p ) > 5 ) && ( !strncmp( p, "vote ", 5 ) ) ) + { + BOOL isVote = TRUE; + int index = 5; + while( p[index] ) + { + if( p[index++] == ' ' ) + isVote = FALSE; + } + if( isVote ) + { + char *map = p + 5; + /*if( !strcmp( map, "extend" ) ) + { + strcpy( talker->m_sMapVote, "extend" ); + + char winner[81]; + strcpy( winner, UTIL_CountVotes() ); + int players = CountPlayers(); + int votesNeeded = ( players * 3 / 4 ) + ( ( players < 3 ) ? 1 : 0 ); + + UTIL_ClientPrintAll( HUD_PRINTTALK, UTIL_VarArgs( " %s voted to extend this map. (%s has %i votes, needs %i to win.)\n", + STRING( talker->pev->netname ), + &( winner[1] ), + winner[0], + votesNeeded) ); + UTIL_LogPrintf( "// \"%s<%i><%s><%s>\" voted to extend the current map.\n", + STRING( talker->pev->netname ), + GETPLAYERUSERID( pEntity ), + GETPLAYERAUTHID( pEntity ), + g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( pEntity ), "model" ) + ); + + if( winner[0] >= votesNeeded ) + { + g_VoteTimer = gpGlobals->time; + } + }*/ + if( IS_MAP_VALID( map ) || !strcmp( map, "extend" ) ) + { + strcpy( talker->m_sMapVote, map ); + + char winner[81]; + strcpy( winner, UTIL_CountVotes() ); + int players = CountPlayers(); + int votesNeeded = ( players * 3 / 4 ) + ( ( players < 3 ) ? 1 : 0 ); + + UTIL_ClientPrintAll( HUD_PRINTTALK, UTIL_VarArgs( " %s voted for \"%s\". (%s has %i votes, needs %i to win.)\n", + STRING( talker->pev->netname ), + map, + &( winner[1] ), + winner[0], + votesNeeded) ); + UTIL_LogPrintf( "// \"%s<%i><%s><%s>\" voted for map \"%s\".\n", + STRING( talker->pev->netname ), + GETPLAYERUSERID( pEntity ), + GETPLAYERAUTHID( pEntity ), + g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( pEntity ), "model" ), + map); + + if( winner[0] >= votesNeeded ) + { + g_VoteTimer = gpGlobals->time; + } + } + else + { + UTIL_ClientPrintAll( HUD_PRINTTALK, UTIL_VarArgs( " Sorry %s, \"%s\" is not on this server.\n", + STRING( talker->pev->netname ), + map ) ); + UTIL_LogPrintf( "// \"%s<%i><%s><%s>\" voted for non-existant map \"%s\".\n", + STRING( talker->pev->netname ), + GETPLAYERUSERID( pEntity ), + GETPLAYERAUTHID( pEntity ), + g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( pEntity ), "model" ), + map); + } + } + } + + // BMOD End - client say commands } /* @@ -475,6 +701,25 @@ void ClientCommand( edict_t *pEntity ) // clear 'Unknown command: VModEnable' in singleplayer return; } + else if( FStrEq( pcmd, "locate" ) ) + { + if( CMD_ARGC() > 1 ) + { + GetClassPtr( (CBasePlayer *)pev )->m_LocateMode = strcmp( CMD_ARGV( 1 ), "0" ); + } + } + else if( FStrEq( pcmd, "leetspeak" ) ) + { + if( CMD_ARGC() > 1 ) + { + GetClassPtr( (CBasePlayer *)pev )->m_LeetSpeak = strcmp( CMD_ARGV( 1 ), "0" ); + + if( GetClassPtr( (CBasePlayer *)pev )->m_LeetSpeak ) + ClientPrint( &pEntity->v, HUD_PRINTCONSOLE, "Leet-Speak enabled!\n" ); + else + ClientPrint( &pEntity->v, HUD_PRINTCONSOLE, "Leet-Speak disabled. (lamer!)\n" ); + } + } else { // tell the user they entered an unknown command @@ -669,6 +914,30 @@ void StartFrame( void ) if( g_pGameRules ) g_pGameRules->Think(); + // BMOD Begin - Multikills + CBasePlayer *client = NULL; + while( ( (client = (CBasePlayer*)UTIL_FindEntityByClassname( client, "player" ) ) != NULL ) + && ( client->IsPlayer() ) ) + { + if( client->m_iKillsThisFrame > 1 && ( client->m_bIsConnected ) ) + { + UTIL_LogPrintf( "// \"%s<%i><%s><%s>\" multi-killed %d players.\n", + STRING( client->pev->netname ), + GETPLAYERUSERID( client->edict() ), + GETPLAYERAUTHID( client->edict() ), + g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( client->edict() ), "model" ), + client->m_iKillsThisFrame + ); + + UTIL_ClientPrintAll( HUD_PRINTTALK, UTIL_VarArgs( " %s got a %d-fer!!\n", + STRING( client->pev->netname ), + client->m_iKillsThisFrame + ) ); + } + client->m_iKillsThisFrame = 0; + } + // BMOD End - Multikills + if( g_fGameOver ) return; @@ -1582,6 +1851,10 @@ void UpdateClientData( const struct edict_s *ent, int sendweapons, struct client cd->pushmsec = ent->v.pushmsec; + // BMOD Begin - Spectator Mode + cd->iuser1 = ent->v.iuser1; + cd->iuser2 = ent->v.iuser2; + // BMOD End - Spectator Mode #if defined( CLIENT_WEAPONS ) if( sendweapons ) { diff --git a/dlls/combat.cpp b/dlls/combat.cpp index 3a59844f..1c31d6e2 100644 --- a/dlls/combat.cpp +++ b/dlls/combat.cpp @@ -29,6 +29,7 @@ #include "animation.h" #include "weapons.h" #include "func_break.h" +#include "player.h" extern DLL_GLOBAL Vector g_vecAttackDir; extern DLL_GLOBAL int g_iSkillLevel; @@ -1484,10 +1485,15 @@ Vector CBaseEntity::FireBulletsPlayer( ULONG cShots, Vector vecSrc, Vector vecDi Vector vecRight = gpGlobals->v_right; Vector vecUp = gpGlobals->v_up; float x, y, z; + int tracer; if( pevAttacker == NULL ) pevAttacker = pev; // the default attacker is ourselves + CBasePlayer *pThisPlayer = NULL; + if( IsPlayer() ) + pThisPlayer = (CBasePlayer *)this; + ClearMultiDamage(); gMultiDamage.type = DMG_BULLET | DMG_NEVERGIB; @@ -1507,6 +1513,42 @@ Vector CBaseEntity::FireBulletsPlayer( ULONG cShots, Vector vecSrc, Vector vecDi vecEnd = vecSrc + vecDir * flDistance; UTIL_TraceLine( vecSrc, vecEnd, dont_ignore_monsters, ENT( pev )/*pentIgnore*/, &tr ); + tracer = 0; + if( iTracerFreq != 0 && ( tracerCount++ % iTracerFreq ) == 0 ) + { + Vector vecTracerSrc; + + if( IsPlayer() ) + { + // adjust tracer position for player + vecTracerSrc = vecSrc + Vector( 0, 0, -4 ) + gpGlobals->v_right * 2 + gpGlobals->v_forward * 16; + } + else + { + vecTracerSrc = vecSrc; + } + + if( iTracerFreq != 1 ) // guns that always trace also always decal + tracer = 1; + switch( iBulletType ) + { + case BULLET_MONSTER_MP5: + case BULLET_MONSTER_9MM: + case BULLET_MONSTER_12MM: + default: + MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, vecTracerSrc ); + WRITE_BYTE( TE_TRACER ); + WRITE_COORD( vecTracerSrc.x ); + WRITE_COORD( vecTracerSrc.y ); + WRITE_COORD( vecTracerSrc.z ); + WRITE_COORD( tr.vecEndPos.x ); + WRITE_COORD( tr.vecEndPos.y ); + WRITE_COORD( tr.vecEndPos.z ); + MESSAGE_END(); + break; + } + } + // do damage, paint decals if( tr.flFraction != 1.0 ) { @@ -1533,7 +1575,10 @@ Vector CBaseEntity::FireBulletsPlayer( ULONG cShots, Vector vecSrc, Vector vecDi pEntity->TraceAttack( pevAttacker, gSkillData.plrDmgBuckshot, vecDir, &tr, DMG_BULLET ); break; case BULLET_PLAYER_357: - pEntity->TraceAttack( pevAttacker, gSkillData.plrDmg357, vecDir, &tr, DMG_BULLET ); + if( pThisPlayer->m_RuneFlags == RUNE_357 ) + pEntity->TraceAttack( pevAttacker, gSkillData.plrDmg357 * 2.5, vecDir, &tr, DMG_BULLET ); + else + pEntity->TraceAttack( pevAttacker, gSkillData.plrDmg357, vecDir, &tr, DMG_BULLET ); break; case BULLET_NONE: // FIX pEntity->TraceAttack( pevAttacker, 50, vecDir, &tr, DMG_CLUB ); diff --git a/dlls/crossbow.cpp b/dlls/crossbow.cpp index d34ad25d..4318f1e9 100644 --- a/dlls/crossbow.cpp +++ b/dlls/crossbow.cpp @@ -22,11 +22,15 @@ #include "nodes.h" #include "player.h" #include "gamerules.h" +#include "BMOD_messaging.h" #ifndef CLIENT_DLL #define BOLT_AIR_VELOCITY 2000 #define BOLT_WATER_VELOCITY 1000 +extern cvar_t bm_xbow_mod; +extern cvar_t bm_xbowtracers; + // UNDONE: Save/restore this? Don't forget to set classname and LINK_ENTITY_TO_CLASS() // // OVERLOADS SOME ENTVARS: @@ -75,6 +79,21 @@ void CCrossbowBolt::Spawn() SetTouch( &CCrossbowBolt::BoltTouch ); SetThink( &CCrossbowBolt::BubbleThink ); pev->nextthink = gpGlobals->time + 0.2; + + if( bm_xbowtracers.value ) + { + MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY ); + WRITE_BYTE( TE_BEAMFOLLOW ); + WRITE_SHORT( entindex() ); // entity + WRITE_SHORT( g_sModelIndexSmoke ); // model + WRITE_BYTE( 5 ); // life + WRITE_BYTE( 1 ); // width + WRITE_BYTE( 100 ); // r, g, b + WRITE_BYTE( 100 ); // r, g, b + WRITE_BYTE( 200 ); // r, g, b + WRITE_BYTE( 255 ); // brightness + MESSAGE_END(); // move PHS/PVS data sending into here (SEND_ALL, SEND_PVS, SEND_PHS) + } } void CCrossbowBolt::Precache() @@ -310,6 +329,9 @@ int CCrossbow::GetItemInfo( ItemInfo *p ) BOOL CCrossbow::Deploy() { + if( bm_xbow_mod.value ) + PrintMessage( m_pPlayer, BMOD_CHAN_WEAPON, Vector( 20, 250, 20 ), Vector( 1, 4, 2 ), "\nCROSSBOW\nSniper bolt damage lowered." ); + if( m_iClip ) return DefaultDeploy( "models/v_crossbow.mdl", "models/p_crossbow.mdl", CROSSBOW_DRAW1, "bow" ); return DefaultDeploy( "models/v_crossbow.mdl", "models/p_crossbow.mdl", CROSSBOW_DRAW2, "bow" ); @@ -384,10 +406,50 @@ void CCrossbow::FireSniperBolt() #ifndef CLIENT_DLL if( tr.pHit->v.takedamage ) { + // BMOD - fix crossbow hit sounds. + switch( RANDOM_LONG( 0, 1 ) ) + { + case 0: + EMIT_SOUND( tr.pHit, CHAN_BODY, "weapons/xbow_hitbod1.wav", 1, ATTN_NORM ); + break; + case 1: + EMIT_SOUND( tr.pHit, CHAN_BODY, "weapons/xbow_hitbod2.wav", 1, ATTN_NORM ); + break; + } + ClearMultiDamage(); - CBaseEntity::Instance( tr.pHit )->TraceAttack( m_pPlayer->pev, 120, vecDir, &tr, DMG_BULLET | DMG_NEVERGIB ); + if( bm_xbow_mod.value ) + CBaseEntity::Instance( tr.pHit )->TraceAttack( m_pPlayer->pev, 90, vecDir, &tr, DMG_BULLET | DMG_NEVERGIB ); + else + CBaseEntity::Instance( tr.pHit )->TraceAttack( m_pPlayer->pev, 120, vecDir, &tr, DMG_BULLET | DMG_NEVERGIB ); ApplyMultiDamage( pev, m_pPlayer->pev ); } + + if( bm_xbowtracers.value ) + { + // BMOD Begin - sniper bolt tracer + MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY ); + WRITE_BYTE( TE_BEAMPOINTS ); + WRITE_COORD( vecSrc.x ); + WRITE_COORD( vecSrc.y ); + WRITE_COORD( vecSrc.z ); + WRITE_COORD( tr.vecEndPos.x ); + WRITE_COORD( tr.vecEndPos.y ); + WRITE_COORD( tr.vecEndPos.z ); + WRITE_SHORT( g_sModelIndexLaser ); // model + WRITE_BYTE( 0 ); // framestart? + WRITE_BYTE( 0 ); // framerate? + WRITE_BYTE( 1 ); // life + WRITE_BYTE( 2 ); // width + WRITE_BYTE( 0 ); // noise + WRITE_BYTE( 100 ); // r, g, b + WRITE_BYTE( 100 ); // r, g, b + WRITE_BYTE( 200 ); // r, g, b + WRITE_BYTE( 200 ); // brightness + WRITE_BYTE( 0 ); // speed? + MESSAGE_END(); + // BMOD End - sniper bolt tracer + } #endif } diff --git a/dlls/crowbar.cpp b/dlls/crowbar.cpp index 94f0066b..deb4c91f 100644 --- a/dlls/crowbar.cpp +++ b/dlls/crowbar.cpp @@ -22,6 +22,12 @@ #include "player.h" #include "gamerules.h" +// BMOD Begin - Flying Crowbar +#include "BMOD_flyingcrowbar.h" +#include "BMOD_messaging.h" +extern cvar_t bm_cbar_mod; +// BMOD End - Flying Crowbar + #define CROWBAR_BODYHIT_VOLUME 128 #define CROWBAR_WALLHIT_VOLUME 512 @@ -63,6 +69,10 @@ void CCrowbar::Precache( void ) PRECACHE_SOUND( "weapons/cbar_hitbod3.wav" ); PRECACHE_SOUND( "weapons/cbar_miss1.wav" ); + // BMOD Edit - Flying Crowbar + UTIL_PrecacheOther( "flying_crowbar" ); + PRECACHE_MODEL( "models/w_weaponbox.mdl" ); + m_usCrowbar = PRECACHE_EVENT( 1, "events/crowbar.sc" ); } @@ -83,6 +93,10 @@ int CCrowbar::GetItemInfo( ItemInfo *p ) BOOL CCrowbar::Deploy() { + // BMOD Edit - Modified crowbar message + if( bm_cbar_mod.value ) + PrintMessage( m_pPlayer, BMOD_CHAN_WEAPON, Vector( 20, 250, 20 ), Vector( 1, 4, 2 ), "\nCROWBAR\nSECONDARY FIRE: Throw crowbar." ); + return DefaultDeploy( "models/v_crowbar.mdl", "models/p_crowbar.mdl", CROWBAR_DRAW, "crowbar" ); } @@ -216,6 +230,10 @@ int CCrowbar::Swing( int fFirst ) m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); #ifndef CLIENT_DLL + int tempDamage = gSkillData.plrDmgCrowbar; + if( m_pPlayer->m_RuneFlags == RUNE_CROWBAR ) + tempDamage = 300; + // hit fDidHit = TRUE; CBaseEntity *pEntity = CBaseEntity::Instance( tr.pHit ); @@ -225,12 +243,12 @@ int CCrowbar::Swing( int fFirst ) if( ( m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() ) { // first swing does full damage - pEntity->TraceAttack( m_pPlayer->pev, gSkillData.plrDmgCrowbar, gpGlobals->v_forward, &tr, DMG_CLUB ); + pEntity->TraceAttack( m_pPlayer->pev, tempDamage, gpGlobals->v_forward, &tr, DMG_CLUB ); } else { // subsequent swings do half - pEntity->TraceAttack( m_pPlayer->pev, gSkillData.plrDmgCrowbar / 2, gpGlobals->v_forward, &tr, DMG_CLUB ); + pEntity->TraceAttack( m_pPlayer->pev, tempDamage / 2, gpGlobals->v_forward, &tr, DMG_CLUB ); } ApplyMultiDamage( m_pPlayer->pev, m_pPlayer->pev ); @@ -304,3 +322,77 @@ int CCrowbar::Swing( int fFirst ) } return fDidHit; } + +// BMOD Begin - Flying Crowbar +void CCrowbar::SecondaryAttack() +{ + if( !bm_cbar_mod.value ) + { + return; + } + + // Don't throw underwater, and only throw if we were able to detatch + // from player. + if( ( m_pPlayer->pev->waterlevel != 3 ) )//&& + //( m_pPlayer->RemovePlayerItem( this ) ) ) + { + // Get the origin, direction, and fix the angle of the throw. + Vector vecSrc = m_pPlayer->GetGunPosition() + gpGlobals->v_right * 8 + gpGlobals->v_forward * 16; + + Vector vecDir = gpGlobals->v_forward; + Vector vecAng = UTIL_VecToAngles( vecDir ); + vecAng.z = vecDir.z - 90; + + // Create a flying crowbar. + CFlyingCrowbar *pFCBar = (CFlyingCrowbar *)Create( "flying_crowbar", vecSrc, Vector( 0, 0, 0 ), m_pPlayer->edict() ); + + // Give the crowbar its velocity, angle, and spin. + // Lower the gravity a bit, so it flys. + pFCBar->pev->velocity = vecDir * 500 + m_pPlayer->pev->velocity; + pFCBar->pev->angles = vecAng; + pFCBar->pev->avelocity.x = -1000; + pFCBar->pev->gravity = .5; + pFCBar->m_pPlayer = m_pPlayer; + + // Do player weapon anim and sound effect. + m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); + EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/cbar_miss1.wav", 1, ATTN_NORM, 0, 94 + RANDOM_LONG( 0, 0xF ) ); + + // Control the speed of the next crowbar toss if + // this is a rune. + m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + .5; + + // Crowbar Rune? + if( m_pPlayer->m_RuneFlags != RUNE_CROWBAR ) + { + // Nope! take away the crowbar + m_pPlayer->RemovePlayerItem( this ); + + // take item off hud + m_pPlayer->pev->weapons &= ~( 1 << this->m_iId ); + + // Destroy this weapon + DestroyItem(); + + // They no longer have an active item. + m_pPlayer->m_pActiveItem = NULL; + } + else + { + // We have RUNE! Make a swing animation + switch( ( ( m_iSwing++ ) % 2 ) + 1 ) + { + case 0: + SendWeaponAnim( CROWBAR_ATTACK1HIT ); + break; + case 1: + SendWeaponAnim( CROWBAR_ATTACK1HIT ); + break; + case 2: + SendWeaponAnim( CROWBAR_DRAW ); + break; + } + } + } +} +// BMOD End - Flying Crowbar diff --git a/dlls/doors.cpp b/dlls/doors.cpp index bf7205ee..7761b2d9 100644 --- a/dlls/doors.cpp +++ b/dlls/doors.cpp @@ -750,6 +750,11 @@ void CBaseDoor::Blocked( CBaseEntity *pOther ) // so let it just squash the object to death real fast if( m_flWait >= 0 ) { + // BMod Start - Door sound fix. + if( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) ) + STOP_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseMoving ) ); + // BMod End + if( m_toggle_state == TS_GOING_DOWN ) { DoorGoUp(); diff --git a/dlls/egon.cpp b/dlls/egon.cpp index 433704ce..a040891e 100644 --- a/dlls/egon.cpp +++ b/dlls/egon.cpp @@ -24,6 +24,7 @@ #include "effects.h" #include "customentity.h" #include "gamerules.h" +#include "egon.h" #define EGON_PRIMARY_VOLUME 450 #define EGON_BEAM_SPRITE "sprites/xbeam1.spr" @@ -75,6 +76,10 @@ void CEgon::Precache( void ) PRECACHE_SOUND( EGON_SOUND_RUN ); PRECACHE_SOUND( EGON_SOUND_STARTUP ); + PRECACHE_SOUND( BUBBLE_SOUND_OFF ); + PRECACHE_SOUND( BUBBLE_SOUND_RUN ); + PRECACHE_SOUND( BUBBLE_SOUND_STARTUP ); + PRECACHE_MODEL( EGON_BEAM_SPRITE ); PRECACHE_MODEL( EGON_FLARE_SPRITE ); @@ -232,8 +237,18 @@ void CEgon::Attack( void ) void CEgon::PrimaryAttack( void ) { - m_fireMode = FIRE_WIDE; - Attack(); + // BMOD Begin - bubblegun + if( bm_gluon_mod.value ) + { + FireBubbles(); + m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + .05; + } + else + { + m_fireMode = FIRE_WIDE; + Attack(); + } + // BMOD End - bubblegun } void CEgon::Fire( const Vector &vecOrigSrc, const Vector &vecDir ) diff --git a/dlls/func_tank.cpp b/dlls/func_tank.cpp index eab9e621..7183a522 100644 --- a/dlls/func_tank.cpp +++ b/dlls/func_tank.cpp @@ -427,6 +427,10 @@ void CFuncTank::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use else if( !m_pController && useType != USE_OFF ) { ( (CBasePlayer*)pActivator )->m_pTank = this; + + // BMOD + ( (CBasePlayer*)pActivator )->BMOD_ResetSpawnKill(); + StartControl( (CBasePlayer*)pActivator ); } else diff --git a/dlls/game.cpp b/dlls/game.cpp index 3aec1810..01524671 100644 --- a/dlls/game.cpp +++ b/dlls/game.cpp @@ -16,6 +16,10 @@ #include "eiface.h" #include "util.h" #include "game.h" +#include "cbase.h" +#include "player.h" +#include "weapons.h" +#include "BMOD_boxmarker.h" cvar_t displaysoundlist = {"displaysoundlist","0"}; @@ -441,6 +445,102 @@ cvar_t sk_player_leg3 = { "sk_player_leg3","1" }; // END Cvars for Skill Level settings +// BMOD Begin - CVARs +cvar_t bm_ver = { "bm_ver", "", FCVAR_SERVER | FCVAR_UNLOGGED }; +cvar_t bm_url = { "bm_url", "", FCVAR_SERVER | FCVAR_UNLOGGED }; + +cvar_t bm_bver = { "bm_bver", "", FCVAR_SERVER | FCVAR_UNLOGGED }; +cvar_t bm_bname = { "bm_bname", "", FCVAR_SERVER | FCVAR_UNLOGGED }; +cvar_t bm_burl = { "bm_burl", "", FCVAR_SERVER | FCVAR_UNLOGGED }; + +cvar_t bm_guns = { "bm_guns", "crowbar;357;9mmhandgun" }; +cvar_t bm_ammo = { "bm_ammo", "9mmclip;9mmclip;357;357" }; +cvar_t bm_g = { "bm_g", "7", FCVAR_SERVER | FCVAR_UNLOGGED }; +cvar_t bm_dmg_messages = { "bm_dmg_messages", "1" }; +cvar_t bm_matchkills = { "bm_matchkills", "1" }; + +cvar_t bm_freezetime = { "bm_freezetime", "4.5", FCVAR_SERVER }; +cvar_t bm_thrust = { "bm_thrust", "0" }; +cvar_t bm_spawneffects = { "bm_spawneffects", "1" }; +//cvar_t bm_snarktrails = { "bm_snarktrails", "1" }; +cvar_t bm_snarktrails = { "bm_snarktrails", "0AE00AC8" }; +cvar_t bm_xbowtracers = { "bm_xbowtracers", "1" }; + +cvar_t bm_spawnkilltime = { "bm_spawnkilltime", "10", FCVAR_SERVER }; +cvar_t bm_maxspawnkills = { "bm_maxspawnkills", "3" }; +cvar_t bm_typekills = { "bm_typekills", "0", FCVAR_SERVER }; +cvar_t bm_maxtypekills = { "bm_maxtypekills", "3" }; +cvar_t bm_typecam = { "bm_typecam", "1" }; + +cvar_t bm_bantime = { "bm_bantime", "30" }; + +cvar_t bm_spamlimit = { "bm_spamlimit", "4" }; +cvar_t bm_antispam = { "bm_antispam", "1" }; + +cvar_t bm_spawnmines = { "bm_spawnmines", "0", FCVAR_SERVER }; +cvar_t bm_spawnsatchels = { "bm_spawnsatchels", "0", FCVAR_SERVER }; +cvar_t bm_voting = { "bm_voting", "1", FCVAR_SERVER }; +cvar_t bm_votetime = { "bm_votetime", "180", FCVAR_SERVER }; +cvar_t bm_maxtime = { "bm_maxtime", "120" }; +cvar_t bm_maxfrags = { "bm_maxfrags", "100" }; + +cvar_t bm_mods = { "bm_mods", "", FCVAR_SERVER }; +cvar_t bm_rpg_mod = { "bm_rpg_mod", "1" }; +cvar_t bm_shotty_mod = { "bm_shotty_mod", "0" }; +cvar_t bm_xbow_mod = { "bm_xbow_mod", "1" }; +cvar_t bm_mp5_mod = { "bm_mp5_mod", "1" }; +cvar_t bm_cbar_mod = { "bm_cbar_mod", "1" }; +cvar_t bm_tau_mod = { "bm_tau_mod", "1" }; +cvar_t bm_snarks_mod = { "bm_snarks_mod", "1" }; +cvar_t bm_gluon_mod = { "bm_gluon_mod", "1" }; +cvar_t bm_hornet_mod = { "bm_hornet_mod", "1" }; +cvar_t bm_trip_mod = { "bm_trip_mod", "1" }; +/* +cvar_t bm_score_crowbar = { "bm_score_crowbar", "1" }; +cvar_t bm_score_throwncbar = { "bm_score_throwncbar", "1" }; +cvar_t bm_score_9mm = { "bm_score_9mm", "1" }; +cvar_t bm_score_357 = { "bm_score_357", "1" }; +cvar_t bm_score_mp5 = { "bm_score_mp5", "1" }; +cvar_t bm_score_shotgun = { "bm_score_shotgun", "1" }; +cvar_t bm_score_squidspit = { "bm_score_squidspit", "1" }; +cvar_t bm_score_zapgun = { "bm_score_zapgun", "1" }; +cvar_t bm_score_mp5grenade = { "bm_score_mp5grenade", "1" }; +cvar_t bm_score_gluon = { "bm_score_gluon", "1" }; +cvar_t bm_score_tau = { "bm_score_tau", "1" }; +cvar_t bm_score_bolt = { "bm_score_bolt", "1" }; +cvar_t bm_score_crossbow = { "bm_score_crossbow", "1" }; +cvar_t bm_score_satchel = { "bm_score_satchel", "1" }; +cvar_t bm_score_handgrenade = { "bm_score_handgrenade", "1" }; +cvar_t bm_score_rpg = { "bm_score_rpg", "1" }; +cvar_t bm_score_snarks = { "bm_score_snarks", "1" }; +cvar_t bm_score_tripmine = { "bm_score_tripmine", "1" }; +*/ +cvar_t bm_map = { "bm_map", "" }; +cvar_t bm_nextmap = { "bm_nextmap", "", FCVAR_SERVER | FCVAR_UNLOGGED }; + +cvar_t bm_rune_rand = { "bm_rune_rand", "0", FCVAR_SERVER }; +cvar_t bm_runemask = { "bm_runemask", "63", FCVAR_SERVER }; + +cvar_t bm_rune_cbar = { "bm_rune_cbar", "1", FCVAR_SERVER }; +cvar_t bm_rune_cbar_t = { "bm_rune_cbar_t", "30" }; +cvar_t bm_rune_cbar_r = { "bm_rune_cbar_r", "60" }; +cvar_t bm_rune_gren = { "bm_rune_gren", "1", FCVAR_SERVER }; +cvar_t bm_rune_gren_t = { "bm_rune_gren_t", "30" }; +cvar_t bm_rune_gren_r = { "bm_rune_gren_r", "120" }; +cvar_t bm_rune_357 = { "bm_rune_357", "1", FCVAR_SERVER }; +cvar_t bm_rune_357_t = { "bm_rune_357_t", "30" }; +cvar_t bm_rune_357_r = { "bm_rune_357_r", "60" }; +cvar_t bm_rune_health = { "bm_rune_health", "1", FCVAR_SERVER }; +cvar_t bm_rune_health_t = { "bm_rune_health_t", "30" }; +cvar_t bm_rune_health_r = { "bm_rune_health_r", "60" }; +cvar_t bm_rune_armor = { "bm_rune_armor", "1", FCVAR_SERVER }; +cvar_t bm_rune_armor_t = { "bm_rune_armor_t", "30" }; +cvar_t bm_rune_armor_r = { "bm_rune_armor_r", "60" }; +cvar_t bm_rune_shotty = { "bm_rune_shotty", "1", FCVAR_SERVER }; +cvar_t bm_rune_shotty_t = { "bm_rune_shotty_t", "30" }; +cvar_t bm_rune_shotty_r = { "bm_rune_shotty_r", "180" }; +// BMOD End - CVARs + // Register your console variables here // This gets called one time when the game is initialied void GameDLLInit( void ) @@ -849,6 +949,689 @@ void GameDLLInit( void ) CVAR_REGISTER( &sk_player_leg3 ); // END REGISTER CVARS FOR SKILL LEVEL STUFF + // BMOD Begin - CVARs + CVAR_REGISTER( &bm_bver ); + CVAR_REGISTER( &bm_bname ); + CVAR_REGISTER( &bm_burl ); + CVAR_REGISTER( &bm_ver ); + CVAR_REGISTER( &bm_url ); + //CVAR_REGISTER( &bm_plat ); + CVAR_REGISTER( &bm_guns ); + CVAR_REGISTER( &bm_ammo ); + CVAR_REGISTER( &bm_g ); + CVAR_REGISTER( &bm_dmg_messages ); + CVAR_REGISTER( &bm_matchkills ); + //CVAR_REGISTER( &bm_trips ); + CVAR_REGISTER( &bm_freezetime ); + CVAR_REGISTER( &bm_thrust ); + CVAR_REGISTER( &bm_spawneffects ); + CVAR_REGISTER( &bm_snarktrails ); + CVAR_REGISTER( &bm_xbowtracers ); + + CVAR_REGISTER( &bm_spawnkilltime ); + CVAR_REGISTER( &bm_maxspawnkills ); + CVAR_REGISTER( &bm_typekills ); + CVAR_REGISTER( &bm_maxtypekills ); + CVAR_REGISTER( &bm_typecam ); + + CVAR_REGISTER( &bm_bantime ); + + CVAR_REGISTER( &bm_spamlimit ); + CVAR_REGISTER( &bm_antispam ); + + CVAR_REGISTER( &bm_spawnmines ); + CVAR_REGISTER( &bm_spawnsatchels ); + CVAR_REGISTER( &bm_voting ); + CVAR_REGISTER( &bm_votetime ); + CVAR_REGISTER( &bm_maxtime ); + CVAR_REGISTER( &bm_maxfrags ); + //CVAR_REGISTER( &bm_cbmad ); + //CVAR_REGISTER( &bm_cheatdetect ); + +/* CVAR_REGISTER( &bm_score_crowbar ); + CVAR_REGISTER( &bm_score_throwncbar ); + CVAR_REGISTER( &bm_score_9mm ); + CVAR_REGISTER( &bm_score_357 ); + CVAR_REGISTER( &bm_score_mp5 ); + CVAR_REGISTER( &bm_score_shotgun ); + CVAR_REGISTER( &bm_score_squidspit ); + CVAR_REGISTER( &bm_score_zapgun ); + CVAR_REGISTER( &bm_score_mp5grenade ); + CVAR_REGISTER( &bm_score_gluon ); + CVAR_REGISTER( &bm_score_tau ); + CVAR_REGISTER( &bm_score_bolt ); + CVAR_REGISTER( &bm_score_crossbow ); + CVAR_REGISTER( &bm_score_satchel ); + CVAR_REGISTER( &bm_score_handgrenade ); + CVAR_REGISTER( &bm_score_rpg ); + CVAR_REGISTER( &bm_score_snarks ); + CVAR_REGISTER( &bm_score_tripmine ); +*/ + CVAR_REGISTER( &bm_mods ); + CVAR_REGISTER( &bm_rpg_mod ); + CVAR_REGISTER( &bm_shotty_mod ); + CVAR_REGISTER( &bm_xbow_mod ); + CVAR_REGISTER( &bm_mp5_mod ); + CVAR_REGISTER( &bm_cbar_mod ); + CVAR_REGISTER( &bm_tau_mod ); + CVAR_REGISTER( &bm_snarks_mod ); + CVAR_REGISTER( &bm_gluon_mod ); + CVAR_REGISTER( &bm_hornet_mod ); + CVAR_REGISTER( &bm_trip_mod ); + CVAR_REGISTER( &bm_map ); + CVAR_REGISTER( &bm_nextmap ); + CVAR_REGISTER( &bm_rune_rand ); + CVAR_REGISTER( &bm_runemask ); + CVAR_REGISTER( &bm_rune_cbar ); + CVAR_REGISTER( &bm_rune_cbar_t ); + CVAR_REGISTER( &bm_rune_cbar_r ); + CVAR_REGISTER( &bm_rune_gren ); + CVAR_REGISTER( &bm_rune_gren_t ); + CVAR_REGISTER( &bm_rune_gren_r ); + CVAR_REGISTER( &bm_rune_357 ); + CVAR_REGISTER( &bm_rune_357_t ); + CVAR_REGISTER( &bm_rune_357_r ); + CVAR_REGISTER( &bm_rune_health ); + CVAR_REGISTER( &bm_rune_health_t ); + CVAR_REGISTER( &bm_rune_health_r ); + CVAR_REGISTER( &bm_rune_armor ); + CVAR_REGISTER( &bm_rune_armor_t ); + CVAR_REGISTER( &bm_rune_armor_r ); + CVAR_REGISTER( &bm_rune_shotty ); + CVAR_REGISTER( &bm_rune_shotty_t ); + CVAR_REGISTER( &bm_rune_shotty_r ); + // BMOD End - CVARs + + // BMOD Begin - Server commands + ADD_SERVER_COMMAND( "s", BModCmd_AdminSay ); + ADD_SERVER_COMMAND( "w", BModCmd_AdminWhisper ); + ADD_SERVER_COMMAND( "markspawnpoints", BModCmd_ShowSpawns ); + ADD_SERVER_COMMAND( "sspeak", BModCmd_SpeakAll ); + ADD_SERVER_COMMAND( "create", BModCmd_Create ); + ADD_SERVER_COMMAND( "remove", BModCmd_Remove ); + ADD_SERVER_COMMAND( "delete", BModCmd_Delete ); + ADD_SERVER_COMMAND( "replace", BModCmd_Replace ); + ADD_SERVER_COMMAND( "info", BModCmd_Info ); + ADD_SERVER_COMMAND( "llama", BModCmd_Llama ); + ADD_SERVER_COMMAND( "unllama", BModCmd_Unllama ); + // BMOD End - Server commands + SERVER_COMMAND( "exec skill.cfg\n" ); } +// ++BMod +// New bubble mod commands +// +// CMD_ARGC () - number of arguments +// CMD_ARGV(n) - nth argument. 0=actual command. +// CMD_ARGS () - + +// Helper function for finding a player pointer by UID. +CBasePlayer* GetPlayerByUID( int userId ) +{ + CBasePlayer *client = NULL; + + while( ( ( client = (CBasePlayer*)UTIL_FindEntityByClassname( client, "player" ) ) != NULL ) + && ( client->IsPlayer() ) ) + { + if( userId == GETPLAYERUSERID( client->edict() ) ) + return client; + } + + return 0; +} + +// Admin Say +void BModCmd_AdminSay( void ) +{ + int j; + char *p; + char text[128]; + const char *cpSay = "say"; + const char *cpSayTeam = "say_team"; + const char *pcmd = CMD_ARGV(0); + + // We can get a raw string now, without the "say " prepended + if( CMD_ARGC() < 2 ) + { + g_engfuncs.pfnServerPrint( "Not enough arguments.\nUSAGE: s \"\"\n" ); + return; + } + + p = (char *)CMD_ARGS(); + + // make sure the text has content + for( char *pc = p; pc != NULL && *pc != 0; pc++ ) + { + if( isprint( *pc ) && !isspace( *pc ) ) + { + pc = NULL; // we've found an alphanumeric character, so text is valid + break; + } + } + if( pc != NULL ) + return; // no character found, so say nothing + + sprintf( text, "%c%s ", 2, "" ); + + j = sizeof(text) - 2 - strlen( text ); // -2 for /n and null terminator + if( (int)strlen( p ) > j ) + p[j] = 0; + + strcat( text, p ); + strcat( text, "\n" ); + + UTIL_ClientPrintAll( HUD_PRINTTALK, text ); + + // echo to server console + g_engfuncs.pfnServerPrint( text ); + + UTIL_LogPrintf( "\"ADMIN<-1><-1><>\" say \"%s\"\n", p ); +} + +// Admin Whisper +void BModCmd_AdminWhisper( void ) +{ + int j; + char *p; + char text[128]; + const char *cpSay = "say"; + const char *cpSayTeam = "say_team"; + const char *pcmd = CMD_ARGV( 0 ); + + // We can get a raw string now, without the "say " prepended + if( CMD_ARGC() < 3 ) + { + g_engfuncs.pfnServerPrint( "Not enough arguments.\nUSAGE: w \"\"\n" ); + return; + } + + int UID = atoi( CMD_ARGV( 1 ) ); + + CBasePlayer *Player = GetPlayerByUID( UID ); + if( Player == NULL ) + { + g_engfuncs.pfnServerPrint( "Invalid Player UID.\n" ); + return; + } + + p = (char *)CMD_ARGS(); + + // Skip over the UID + while( *p != ' ') + p++; + while( *p == ' ') + p++; + + // make sure the text has content + for( char *pc = p; pc != NULL && *pc != 0; pc++ ) + { + if( isprint( *pc ) && !isspace( *pc ) ) + { + pc = NULL; // we've found an alphanumeric character, so text is valid + break; + } + } + + if( pc != NULL ) + return; // no character found, so say nothing + + sprintf( text, "%c%s ", 2, "(whispers)" ); + + j = sizeof(text) - 2 - strlen( text ); // -2 for /n and null terminator + if( (int)strlen( p ) > j ) + p[j] = 0; + + strcat( text, p ); + strcat( text, "\n" ); + + ClientPrint( Player->pev, HUD_PRINTTALK, text ); + + // echo to server console + g_engfuncs.pfnServerPrint( text ); + + UTIL_LogPrintf( "\"ADMIN<-1><-1><>\" say \"(to %s) %s\"\n", STRING( Player->pev->netname ), p ); +} + +// Show Spawn Points +void BModCmd_ShowSpawns( void ) +{ + BOOL marked = UTIL_FindEntityByClassname( NULL, "boxmarker" ) ? TRUE : FALSE; + + if( marked ) + { + g_engfuncs.pfnServerPrint( "Spawn points already marked!\n" ); + return; + } + + marked = TRUE; + + CBaseEntity *pSpot = NULL; + CBaseEntity *pEnt = NULL; + CBoxMarker *pBox = NULL; + + TraceResult tr; + + while( ( ( pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_deathmatch" ) ) != NULL ) ) + { + UTIL_TraceLine( pSpot->pev->origin, pSpot->pev->origin - Vector( 0, 0, 1024 ), ignore_monsters, pSpot->edict(), &tr ); + Vector vecTop = pSpot->pev->origin + Vector( 0, 0, 36 ); + float height = fabs( vecTop.z - tr.vecEndPos.z ) / 2; + + pEnt = CBaseEntity::Create( "boxmarker", Vector( vecTop.x, vecTop.y, ( vecTop.z + tr.vecEndPos.z ) / 2), g_vecZero, NULL ); + // CBaseEntity *pEnt2 = CBaseEntity::Create( "zaprift", Vector( vecTop.x, vecTop.y, ( vecTop.z + tr.vecEndPos.z ) / 2 ), g_vecZero, NULL ); + pBox = (CBoxMarker *)pEnt; + pBox->m_vecExtents = Vector(16,16,height); + } +} + +// Speak to all players using vox. +void BModCmd_SpeakAll( void ) +{ + int j; + char *p; + char text[128]; + + if( CMD_ARGC() < 2 ) + { + g_engfuncs.pfnServerPrint( "Not enough arguments.\nUSAGE: sspeak \"\"\n" ); + return; + } + + p = (char *)CMD_ARGS(); + + // remove quotes if present + if( *p == '"' ) + { + p++; + p[strlen( p ) - 1] = 0; + } + + // make sure the text has content + for( char *pc = p; pc != NULL && *pc != 0; pc++ ) + { + if( isprint( *pc ) && !isspace( *pc ) ) + { + pc = NULL; // we've found an alphanumeric character, so text is valid + break; + } + } + if( pc != NULL ) + return; // no character found, so say nothing + + strcpy( text, ""); + + j = sizeof( text ) - 2 - strlen( text ); // -2 for /n and null terminator + if( (int)strlen( p ) > j ) + p[j] = 0; + + strcat( text, p ); + //strcat( text, "\n" ); + + UTIL_SpeakAll( text ); +} + +// create entity x y z ay +void BModCmd_Create( void ) +{ + if( ( CMD_ARGC() < 6 ) ) + { + g_engfuncs.pfnServerPrint( "Not enough arguments.\nUSAGE: create \n" ); + return; + } + + char *entity = (char *)CMD_ARGV( 1 ); + Vector position = Vector( atoi( CMD_ARGV( 2 ) ), atoi( CMD_ARGV( 3 ) ), atoi( CMD_ARGV( 4 ) ) ); + Vector angle = Vector( 0, atoi( CMD_ARGV( 5 ) ), 0 ); + + if( angle.y < 0 ) + { + angle.y = RANDOM_LONG( 0, 360 ); + } + + // Fix weapon names + if( !strcmp( entity, "weapon_9mmhandgun" ) ) + { + strcpy( entity, "weapon_glock" ); + } + else if( !strcmp( entity, "weapon_9mmAR" ) ) + { + strcpy( entity, "weapon_mp5" ); + } + else if( !strcmp( entity, "weapon_python" ) ) + { + strcpy( entity, "weapon_357" ); + } + + // Fix ammo names + if( !strcmp( entity, "ammo_9mmclip" ) ) + { + strcpy( entity, "ammo_glockclip" ); + } + else if( !strcmp( entity, "ammo_9mmAR" ) ) + { + strcpy( entity, "ammo_mp5clip" ); + } + else if( !strcmp( entity, "ammo_ARgrenades" ) ) + { + strcpy( entity, "ammo_mp5grenades" ); + } + + if( !strncmp( entity, "weapon_", 7 ) || + !strcmp( entity, "item_healthkit" ) || + !strcmp( entity, "item_battery" ) || + !strcmp( entity, "item_longjump" ) || + !strncmp( entity, "ammo_", 5 ) || + !strcmp( entity, "info_player_deathmatch" ) ) + { + CBaseEntity *ent = CBaseEntity::Create(entity, position, angle, NULL ); + + if( !strcmp( entity, "info_player_deathmatch" ) ) + ent->pev->classname = MAKE_STRING( "info_player_deathmatch" ); + } + else + { + g_engfuncs.pfnServerPrint( "You only add items, ammo, weapons, or spawn points with this command.\n" ); + } +} + +// remove entity +void BModCmd_Remove( void ) +{ + if( ( CMD_ARGC() < 2 ) ) + { + g_engfuncs.pfnServerPrint( "Not enough arguments.\nUSAGE: remove \n" ); + return; + } + + char *entity = (char *)CMD_ARGV( 1 ); + CBaseEntity *target = NULL; + + // Fix weapon names + if( !strcmp(entity, "weapon_glock" ) ) + { + strcpy(entity, "weapon_9mmhandgun" ); + } + else if( !strcmp( entity, "weapon_mp5" ) ) + { + strcpy( entity, "weapon_9mmAR" ); + } + else if( !strcmp( entity, "weapon_python" ) ) + { + strcpy( entity, "weapon_357" ); + } + + // Fix ammo names + if( !strcmp( entity, "ammo_9mmclip" ) ) + { + strcpy( entity, "ammo_glockclip" ); + } + else if( !strcmp( entity, "ammo_9mmAR") ) + { + strcpy( entity, "ammo_mp5clip"); + } + else if( !strcmp( entity, "ammo_ARgrenades") ) + { + strcpy( entity, "ammo_mp5grenades"); + } + + if( !strncmp( entity, "weapon_", 7 ) || + !strcmp( entity, "item_healthkit" ) || + !strcmp( entity, "item_battery" ) || + !strcmp( entity, "item_longjump" ) || + !strncmp( entity, "ammo_", 5 ) ) + { + while( ( target = UTIL_FindEntityInSphere( target, Vector( 0, 0, 0 ), 4096 ) ) != NULL ) + { + if( !strcmp( STRING( target->pev->classname ), entity ) && ( target->pev->owner == NULL ) ) + { + target->Killed( NULL, 0 ); + } + } + } + else + { + g_engfuncs.pfnServerPrint( "You only remove items, ammo, or weapons with this command.\n" ); + } +} + +// delete a single entity +void BModCmd_Delete( void ) +{ + if( ( CMD_ARGC() < 5 ) ) + { + g_engfuncs.pfnServerPrint( "Not enough arguments.\nUSAGE: delete \n" ); + return; + } + + char *entity = (char *)CMD_ARGV( 1 ); + Vector position = Vector( atoi( CMD_ARGV( 2 ) ), atoi( CMD_ARGV( 3 ) ), atoi( CMD_ARGV( 4 ) ) ); + CBaseEntity *target = NULL; + + // Fix weapon names + if( !strcmp( entity, "weapon_glock" ) ) + { + strcpy( entity, "weapon_9mmhandgun" ); + } + else if( !strcmp( entity, "weapon_mp5" ) ) + { + strcpy( entity, "weapon_9mmAR" ); + } + else if( !strcmp( entity, "weapon_python" ) ) + { + strcpy( entity, "weapon_357" ); + } + + // Fix ammo names + if( !strcmp( entity, "ammo_9mmclip" ) ) + { + strcpy( entity, "ammo_glockclip" ); + } + else if( !strcmp( entity, "ammo_9mmAR" ) ) + { + strcpy( entity, "ammo_mp5clip" ); + } + else if( !strcmp( entity, "ammo_ARgrenades" ) ) + { + strcpy( entity, "ammo_mp5grenades" ); + } + + if( !strncmp( entity, "weapon_", 7 ) || + !strcmp( entity, "item_healthkit" ) || + !strcmp( entity, "item_battery" ) || + !strcmp( entity, "item_longjump" ) || + !strncmp( entity, "ammo_", 5 ) || + !strcmp( entity, "info_player_deathmatch" ) ) + { + bool deleted = FALSE; + while( !deleted && ( target = UTIL_FindEntityInSphere( target, position, 64 ) ) != NULL ) + { + if( !strcmp( STRING( target->pev->classname ), entity ) && ( target->pev->owner == NULL ) ) + { + target->Killed( NULL, 0 ); + deleted = TRUE; + g_engfuncs.pfnServerPrint( "Entity deleted.\n" ); + } + } + + if( !deleted ) + { + g_engfuncs.pfnServerPrint( "Entity not found.\n" ); + } + } + else + { + g_engfuncs.pfnServerPrint( "You only delete items, ammo, weapons, or spawn points with this command.\n" ); + } +} + +// replace entity +void BModCmd_Replace( void ) +{ + if( ( CMD_ARGC() < 3 ) ) + { + g_engfuncs.pfnServerPrint( "Not enough arguments.\nUSAGE: replace \n" ); + return; + } + + char *entity = (char *)CMD_ARGV( 1 ); + char *entity2 = (char *)CMD_ARGV( 2 ); + CBaseEntity *target = NULL; + + // Fix weapon names + if( !strcmp( entity, "weapon_glock" ) ) + { + strcpy( entity, "weapon_9mmhandgun" ); + } + else if( !strcmp( entity, "weapon_mp5" ) ) + { + strcpy( entity, "weapon_9mmAR" ); + } + else if( !strcmp( entity, "weapon_python" ) ) + { + strcpy( entity, "weapon_357" ); + } + + if( !strcmp( entity2, "weapon_9mmhandgun" ) ) + { + strcpy( entity2, "weapon_glock" ); + } + else if( !strcmp( entity2, "weapon_9mmAR" ) ) + { + strcpy( entity2, "weapon_mp5" ); + } + else if( !strcmp( entity2, "weapon_python" ) ) + { + strcpy( entity2, "weapon_357" ); + } + + // Fix ammo names + if( !strcmp( entity, "ammo_9mmclip" ) ) + { + strcpy( entity, "ammo_glockclip" ); + } + else if( !strcmp( entity, "ammo_9mmAR") ) + { + strcpy( entity, "ammo_mp5clip"); + } + else if( !strcmp( entity, "ammo_ARgrenades") ) + { + strcpy( entity, "ammo_mp5grenades" ); + } + + if( !strcmp( entity2, "ammo_9mmclip") ) + { + strcpy( entity2, "ammo_glockclip" ); + } + else if( !strcmp( entity2, "ammo_9mmAR" ) ) + { + strcpy( entity2, "ammo_mp5clip" ); + } + else if( !strcmp( entity2, "ammo_ARgrenades" ) ) + { + strcpy( entity2, "ammo_mp5grenades" ); + } + + if( ( !strncmp( entity, "weapon_", 7 ) || + !strcmp( entity, "item_healthkit" ) || + !strcmp( entity, "item_battery" ) || + !strcmp( entity, "item_longjump" ) || + !strncmp( entity, "ammo_", 5 ) ) && + ( !strncmp( entity2, "weapon_", 7 ) || + !strcmp( entity2, "item_healthkit" ) || + !strcmp( entity2, "item_battery" ) || + !strcmp( entity2, "item_longjump" ) || + !strncmp( entity2, "ammo_", 5 ) ) ) + { + + while( ( target = UTIL_FindEntityInSphere( target, Vector( 0, 0, 0 ), 4096 ) ) != NULL ) + { + if( !strcmp( STRING( target->pev->classname ), entity ) && ( target->pev->owner == NULL ) ) + { + CBaseEntity::Create(entity2, target->pev->origin, target->pev->angles, NULL ); + target->Killed(NULL, 0); + } + } + } + else + { + g_engfuncs.pfnServerPrint( "You only replace items, ammo, or weapons with this command.\n" ); + } +} + +// info on a player +void BModCmd_Info( void ) +{ + if( CMD_ARGC() < 2 ) + { + g_engfuncs.pfnServerPrint( "Not enough arguments.\nUSAGE: info \n" ); + return; + } + + int UID = atoi( CMD_ARGV( 1 ) ); + + CBasePlayer *Player = GetPlayerByUID( UID ); + if( Player == NULL ) + { + g_engfuncs.pfnServerPrint( "Invalid Player UID.\n" ); + return; + } + + g_engfuncs.pfnServerPrint( UTIL_VarArgs( "Player: %s\n",STRING( Player->pev->netname ) ) ); + g_engfuncs.pfnServerPrint( UTIL_VarArgs( "Health/Armor: %d/%d\n",(int)Player->pev->health, (int)Player->pev->armorvalue ) ); + + g_engfuncs.pfnServerPrint( UTIL_VarArgs( "Spawn Kills: %d\n",Player->m_iSpawnKills ) ); + g_engfuncs.pfnServerPrint( UTIL_VarArgs( "Type Kills: %d\n",Player->m_iTypeKills ) ); + g_engfuncs.pfnServerPrint( UTIL_VarArgs( "Leet: %d\n",Player->m_LeetSpeak ) ); + g_engfuncs.pfnServerPrint( UTIL_VarArgs( "Locate: %d\n",Player->m_LocateMode ) ); + g_engfuncs.pfnServerPrint( UTIL_VarArgs( "Llama: %d\n",Player->m_IsLlama ) ); + g_engfuncs.pfnServerPrint( "\n" ); +} + +// Llamafy a player +void BModCmd_Llama( void ) +{ + if( CMD_ARGC() < 2 ) + { + g_engfuncs.pfnServerPrint( "Not enough arguments.\nUSAGE: llama \n" ); + return; + } + + int UID = atoi( CMD_ARGV( 1 ) ); + + CBasePlayer *Player = GetPlayerByUID( UID ); + if( Player == NULL ) + { + g_engfuncs.pfnServerPrint( "Invalid Player UID.\n" ); + return; + } + + Player->m_IsLlama = TRUE; + + UTIL_ClientPrintAll( HUD_PRINTTALK, UTIL_VarArgs( " %s is now a llama! Bleeet!\n", STRING( Player->pev->netname ) ) ); + g_engfuncs.pfnServerPrint( UTIL_VarArgs( "%s is now a llama! Bleeet!\n", STRING( Player->pev->netname ) ) ); +} + +// Unllamafy a player +void BModCmd_Unllama( void ) +{ + if( CMD_ARGC() < 2 ) + { + g_engfuncs.pfnServerPrint( "Not enough arguments.\nUSAGE: unllama \n" ); + return; + } + + int UID = atoi( CMD_ARGV( 1 ) ); + + CBasePlayer *Player = GetPlayerByUID( UID ); + if( Player == NULL ) + { + g_engfuncs.pfnServerPrint( "Invalid Player UID.\n" ); + return; + } + + Player->m_IsLlama = FALSE; + + UTIL_ClientPrintAll( HUD_PRINTTALK, UTIL_VarArgs( " %s is unllamafied.\n", STRING( Player->pev->netname ) ) ); + g_engfuncs.pfnServerPrint( UTIL_VarArgs( "%s is unllamafied.\n", STRING( Player->pev->netname ) ) ); +} diff --git a/dlls/game.h b/dlls/game.h index 925010f3..f7b0ca51 100644 --- a/dlls/game.h +++ b/dlls/game.h @@ -41,3 +41,112 @@ extern cvar_t *g_psv_gravity; extern cvar_t *g_psv_aim; extern cvar_t *g_footsteps; #endif // GAME_H + +// BMOD Begin - CVARs +extern cvar_t bm_ver; +extern cvar_t bm_url; +extern cvar_t bm_bver; +extern cvar_t bm_bname; +extern cvar_t bm_burl; +//extern cvar_t bm_plat; +//extern cvar_t bm_trips; +extern cvar_t bm_guns; +extern cvar_t bm_ammo; +extern cvar_t bm_g; +extern cvar_t bm_dmg_messages; +extern cvar_t bm_matchkills; +extern cvar_t bm_freezetime; +extern cvar_t bm_thrust; +extern cvar_t bm_spawneffects; +extern cvar_t bm_snarktrails; +extern cvar_t bm_xbowtracers; + +extern cvar_t bm_spawnkilltime; +extern cvar_t bm_maxspawnkills; + +extern cvar_t bm_typekills; +extern cvar_t bm_maxtypekills; +extern cvar_t bm_typecam; + +extern cvar_t bm_bantime; + +extern cvar_t bm_antispam; +extern cvar_t bm_spamlimit; + +extern cvar_t bm_spawnmines; +extern cvar_t bm_spawnsatchels; +extern cvar_t bm_voting; +extern cvar_t bm_votetime; +extern cvar_t bm_maxtime; +extern cvar_t bm_maxfrags; +// extern cvar_t bm_cbmad; +// extern cvar_t bm_cheatdetect; +extern cvar_t bm_mods; +extern cvar_t bm_cbar_mod; +extern cvar_t bm_mp5_mod; +extern cvar_t bm_shotty_mod; +extern cvar_t bm_xbow_mod; +extern cvar_t bm_rpg_mod; +extern cvar_t bm_tau_mod; +extern cvar_t bm_gluon_mod; +extern cvar_t bm_hornet_mod; +extern cvar_t bm_trip_mod; +extern cvar_t bm_snarks_mod; +/* +extern cvar_t bm_score_crowbar; +extern cvar_t bm_score_throwncbar; +extern cvar_t bm_score_9mm; +extern cvar_t bm_score_357; +extern cvar_t bm_score_mp5; +extern cvar_t bm_score_shotgun; +extern cvar_t bm_score_squidspit; +extern cvar_t bm_score_zapgun; +extern cvar_t bm_score_mp5grenade; +extern cvar_t bm_score_gluon; +extern cvar_t bm_score_tau; +extern cvar_t bm_score_bolt; +extern cvar_t bm_score_crossbow; +extern cvar_t bm_score_satchel; +extern cvar_t bm_score_handgrenade; +extern cvar_t bm_score_rpg; +extern cvar_t bm_score_snarks; +extern cvar_t bm_score_tripmine; +*/ +extern cvar_t bm_map; +extern cvar_t bm_nextmap; + +extern cvar_t bm_rune_rand; +extern cvar_t bm_runemask; +extern cvar_t bm_rune_cbar; +extern cvar_t bm_rune_cbar_t; +extern cvar_t bm_rune_cbar_r; +extern cvar_t bm_rune_gren; +extern cvar_t bm_rune_gren_t; +extern cvar_t bm_rune_gren_r; +extern cvar_t bm_rune_357; +extern cvar_t bm_rune_357_t; +extern cvar_t bm_rune_357_r; +extern cvar_t bm_rune_health; +extern cvar_t bm_rune_health_t; +extern cvar_t bm_rune_health_r; +extern cvar_t bm_rune_armor; +extern cvar_t bm_rune_armor_t; +extern cvar_t bm_rune_armor_r; +extern cvar_t bm_rune_shotty; +extern cvar_t bm_rune_shotty_t; +extern cvar_t bm_rune_shotty_r; +// BMOD End - CVARs + +// BMOD Begin - server commands +void BModCmd_AdminSay( void ); +void BModCmd_AdminWhisper( void ); +void BModCmd_ShowSpawns( void ); +void BModCmd_SpeakAll( void ); +void BModCmd_Create( void ); +void BModCmd_Remove( void ); +void BModCmd_Delete( void ); +void BModCmd_Replace( void ); +void BModCmd_Info( void ); +void BModCmd_Llama( void ); +void BModCmd_Unllama( void ); +// BMOD End - server commands diff --git a/dlls/gamerules.h b/dlls/gamerules.h index 6ad470d0..4e1725c8 100644 --- a/dlls/gamerules.h +++ b/dlls/gamerules.h @@ -99,6 +99,8 @@ public: virtual void ClientUserInfoChanged( CBasePlayer *pPlayer, char *infobuffer ) {} // the player has changed userinfo; can change it now // Client kills/scoring + // BMOD + //virtual int BMOD_IPointsForKill( CBasePlayer *pAttacker, CBasePlayer *pKilled, entvars_t *pInflictor);// how many points do I award whoever kills this player? virtual int IPointsForKill( CBasePlayer *pAttacker, CBasePlayer *pKilled ) = 0;// how many points do I award whoever kills this player? virtual void PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor ) = 0;// Called each time a player dies virtual void DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor )= 0;// Call this from within a GameRules class to report an obituary. @@ -160,6 +162,10 @@ public: // Immediately end a multiplayer game virtual void EndMultiplayerGame( void ) {} + + // BMOD Begin - Extra gamerules + virtual void BMOD_PreChangeLevel( void ); + // BMOD End - Extra gamerules }; extern CGameRules *InstallGameRules( void ); @@ -352,6 +358,17 @@ public: // Immediately end a multiplayer game virtual void EndMultiplayerGame( void ) { GoToIntermission(); } + // BMOD Begin - Extra gamerules + virtual void BMOD_ClientDisconnected( edict_t *pClient, CBasePlayer *pPlayer ); + virtual void BMOD_PlayerSpawn( CBasePlayer *pPlayer ); + virtual void BMOD_InitHUD( CBasePlayer *pl ); + virtual void BMOD_PreChangeLevel( void ); + virtual void BMOD_Think( void ); + virtual void BMOD_GiveGunsAndAmmo( CBasePlayer *pPlayer ); + virtual void BMOD_UpdateGuns( void ); + virtual void BMOD_UpdateMods( void ); + // BMOD End - Extra gamerules + protected: virtual void ChangeLevel( void ); virtual void GoToIntermission( void ); diff --git a/dlls/gauss.cpp b/dlls/gauss.cpp index 14aac39b..bc830ef6 100644 --- a/dlls/gauss.cpp +++ b/dlls/gauss.cpp @@ -25,6 +25,10 @@ #include "shake.h" #include "gamerules.h" +// BMOD Edit - tau mod +extern cvar_t bm_tau_mod; +#include "BMOD_messaging.h" + #define GAUSS_PRIMARY_CHARGE_VOLUME 256// how loud gauss is while charging #define GAUSS_PRIMARY_FIRE_VOLUME 450// how loud gauss is when discharged @@ -125,6 +129,10 @@ int CGauss::GetItemInfo( ItemInfo *p ) BOOL CGauss::Deploy() { + // BMOD Edit - tau mod + if( bm_tau_mod.value ) + PrintMessage( m_pPlayer, BMOD_CHAN_WEAPON, Vector( 20, 250, 20 ), Vector( 1, 4, 2 ), "\nTAU\nOnly does direct fire damage through walls." ); + m_pPlayer->m_flPlayAftershock = 0.0; return DefaultDeploy( "models/v_gauss.mdl", "models/p_gauss.mdl", GAUSS_DRAW, "gauss" ); } @@ -493,7 +501,11 @@ void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage ) damage_radius = flDamage * 2.5; } - ::RadiusDamage( beam_tr.vecEndPos + vecDir * 8, pev, m_pPlayer->pev, flDamage, damage_radius, CLASS_NONE, DMG_BLAST ); + // BMOD Edit - tau mod + if( bm_tau_mod.value ) + ::RadiusDamage( beam_tr.vecEndPos + vecDir * 8, pev, m_pPlayer->pev, 2, damage_radius, CLASS_NONE, DMG_BLAST ); + else + ::RadiusDamage( beam_tr.vecEndPos + vecDir * 8, pev, m_pPlayer->pev, flDamage, damage_radius, CLASS_NONE, DMG_BLAST ); CSoundEnt::InsertSound( bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3.0 ); diff --git a/dlls/ggrenade.cpp b/dlls/ggrenade.cpp index 64d9f3cf..52ba6b86 100644 --- a/dlls/ggrenade.cpp +++ b/dlls/ggrenade.cpp @@ -26,6 +26,10 @@ #include "nodes.h" #include "soundent.h" #include "decals.h" +#include "player.h" + +// BMOD Edit - mp5 mod +extern cvar_t bm_mp5_mod; //===================grenade @@ -51,6 +55,23 @@ void CGrenade::Explode( TraceResult *pTrace, int bitsDamageType ) { float flRndSound;// sound randomizer + // BMOD Begin - Grenade Rune + CBasePlayer *pPlayer = UTIL_CastPlayer( pev->owner ); + + if( !strcmp( STRING( pev->classname ), "hand_grenade" ) && pPlayer && ( pPlayer->m_RuneFlags == RUNE_GRENADE ) ) + { + pev->nextthink = gpGlobals->time + 0.1; + pev->dmg = 150; + m_iMegaSmokeFrame = 0; + SetThink( MegaSmoke ); + } + else + { + pev->nextthink = gpGlobals->time + 0.3; + SetThink( Smoke ); + } + // BMOD End - Grenade Rune + pev->model = iStringNull;//invisible pev->solid = SOLID_NOT;// intangible @@ -118,9 +139,7 @@ void CGrenade::Explode( TraceResult *pTrace, int bitsDamageType ) } pev->effects |= EF_NODRAW; - SetThink( &CGrenade::Smoke ); pev->velocity = g_vecZero; - pev->nextthink = gpGlobals->time + 0.3; if( iContents != CONTENTS_WATER ) { @@ -130,6 +149,115 @@ void CGrenade::Explode( TraceResult *pTrace, int bitsDamageType ) } } +void CGrenade::MegaSmoke( void ) +{ + m_iMegaSmokeFrame++; + + if( m_iMegaSmokeFrame == 1 ) + { + MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY ); + WRITE_BYTE( TE_BEAMTORUS ); + WRITE_COORD( pev->origin.x ); + WRITE_COORD( pev->origin.y ); + WRITE_COORD( pev->origin.z - 50 ); + WRITE_COORD( pev->origin.x ); + WRITE_COORD( pev->origin.y ); + WRITE_COORD( pev->origin.z - 50 + ( pev->dmg * 2.5 ) ); + WRITE_SHORT( g_sModelIndexLaser ); + WRITE_BYTE( 0 ); // start frame? + WRITE_BYTE( 10 ); // rame rate? + WRITE_BYTE( 5 ); // life + WRITE_BYTE( 40 ); // width + WRITE_BYTE( 0 ); // noise + WRITE_BYTE( 250 ); //Color + WRITE_BYTE( 120 ); + WRITE_BYTE( 20 ); + WRITE_BYTE( 255 ); // brightness + WRITE_BYTE( 0 ); // scroll speed + MESSAGE_END(); + } +// coord coord coord (center position) +// coord coord coord (axis and radius) +// short (sprite index) +// byte (starting frame) +// byte (frame rate in 0.1's) +// byte (life in 0.1's) +// byte (line width in 0.1's) +// byte (noise amplitude in 0.01's) +// byte,byte,byte (color) +// byte (brightness) +// byte (scroll speed in 0.1's) + if( UTIL_PointContents( pev->origin ) == CONTENTS_WATER ) + { + UTIL_Bubbles( pev->origin - Vector( 64, 64, 64 ), pev->origin + Vector( 64, 64, 64 ), 100 ); + } + else + { + MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin ); + WRITE_BYTE( TE_SMOKE ); + WRITE_COORD( pev->origin.x ); + WRITE_COORD( pev->origin.y ); + WRITE_COORD( pev->origin.z ); + WRITE_SHORT( g_sModelIndexSmoke ); + WRITE_BYTE( ( pev->dmg - 50 ) * 0.80 ); // scale * 10 + WRITE_BYTE( 12 ); // framerate + MESSAGE_END(); + } + + pev->dmg *= .80; + pev->origin.z += pev->dmg / 2; + + if( m_iMegaSmokeFrame < 4 ) + { + + int iContents = UTIL_PointContents( pev->origin ); + + MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, pev->origin ); + WRITE_BYTE( TE_EXPLOSION ); // This makes a dynamic light and the explosion sprites/sound + WRITE_COORD( pev->origin.x ); // Send to PAS because of the sound + WRITE_COORD( pev->origin.y ); + WRITE_COORD( pev->origin.z ); + if( iContents != CONTENTS_WATER ) + { + WRITE_SHORT( g_sModelIndexFireball ); + } + else + { + WRITE_SHORT( g_sModelIndexWExplosion ); + } + WRITE_BYTE( ( pev->dmg - 50 ) * .60 ); // scale * 10 + WRITE_BYTE( 15 ); // framerate + WRITE_BYTE( TE_EXPLFLAG_NONE ); + MESSAGE_END(); + + CSoundEnt::InsertSound ( bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3.0 ); + + switch( RANDOM_LONG( 0, 2 ) ) + { + case 0: + EMIT_SOUND( ENT( pev ), CHAN_VOICE, "weapons/debris1.wav", 0.55, ATTN_NORM ); + break; + case 1: + EMIT_SOUND( ENT( pev ), CHAN_VOICE, "weapons/debris2.wav", 0.55, ATTN_NORM ); + break; + case 2: + EMIT_SOUND( ENT( pev ), CHAN_VOICE, "weapons/debris3.wav", 0.55, ATTN_NORM ); + break; + } + + if( iContents != CONTENTS_WATER ) + { + int sparkCount = RANDOM_LONG( 1, 4 ); + for( int i = 0; i < sparkCount; i++ ) + Create( "spark_shower", pev->origin, Vector( 0, 0, 1 ), NULL ); + } + } + pev->nextthink = gpGlobals->time + 0.1; + + if( m_iMegaSmokeFrame == 4 ) + UTIL_Remove( this ); +} + void CGrenade::Smoke( void ) { if( UTIL_PointContents( pev->origin ) == CONTENTS_WATER ) @@ -377,7 +505,13 @@ CGrenade *CGrenade::ShootContact( entvars_t *pevOwner, Vector vecStart, Vector v // Explode on contact pGrenade->SetTouch( &CGrenade::ExplodeTouch ); - pGrenade->pev->dmg = gSkillData.plrDmgM203Grenade; + // BMOD Begin - mp5 mod + // pGrenade->pev->dmg = gSkillData.plrDmgM203Grenade; + if( bm_mp5_mod.value ) + pGrenade->pev->dmg = 80; + else + pGrenade->pev->dmg = gSkillData.plrDmgM203Grenade; + // BMOD End - mp5 mod return pGrenade; } diff --git a/dlls/globals.cpp b/dlls/globals.cpp index 28280887..7acd8046 100644 --- a/dlls/globals.cpp +++ b/dlls/globals.cpp @@ -37,3 +37,11 @@ DLL_GLOBAL int gDisplayTitle; DLL_GLOBAL BOOL g_fGameOver; DLL_GLOBAL const Vector g_vecZero = Vector( 0, 0, 0 ); DLL_GLOBAL int g_Language; + +// BMOD Begin - Map Voting +DLL_GLOBAL int g_VoteStatus = 0; // 0 = ready to start votes + // 1 = voting is session + // 2 = map won vote +DLL_GLOBAL float g_VoteTimer = 0; +DLL_GLOBAL BOOL g_runes_exist = 0; +DLL_GLOBAL BOOL g_runes_learn = 0; diff --git a/dlls/h_battery.cpp b/dlls/h_battery.cpp index fdb7c645..99a27983 100644 --- a/dlls/h_battery.cpp +++ b/dlls/h_battery.cpp @@ -26,6 +26,7 @@ #include "saverestore.h" #include "skill.h" #include "gamerules.h" +#include "player.h" class CRecharge : public CBaseToggle { @@ -143,6 +144,8 @@ void CRecharge::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use if( !m_hActivator->IsPlayer() ) return; + CBasePlayer *pPlayer = (CBasePlayer *)pActivator; + // Play the on sound or the looping charging sound if( !m_iOn ) { @@ -162,6 +165,9 @@ void CRecharge::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use m_iJuice--; m_hActivator->pev->armorvalue += 1; + if( pPlayer->m_RuneFlags == RUNE_BATTERY ) + pPlayer->pev->armorvalue += 1; + if( m_hActivator->pev->armorvalue > 100 ) m_hActivator->pev->armorvalue = 100; } diff --git a/dlls/handgrenade.cpp b/dlls/handgrenade.cpp index 063b2886..388f06d9 100644 --- a/dlls/handgrenade.cpp +++ b/dlls/handgrenade.cpp @@ -103,6 +103,19 @@ void CHandGrenade::Holster( int skiplocal /* = 0 */ ) pev->nextthink = gpGlobals->time + 0.1; } + //BMOD Begin - fix for short fuse hand grenades. + if( m_flStartThrow ) + { + Vector vecSrc = m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_forward * 16; + float time = m_flStartThrow - gpGlobals->time + 3.0; + if( time < 0 ) + time = 0; + CGrenade::ShootTimed( m_pPlayer->pev, vecSrc, Vector( 0, 0, 0 ), time ); + m_flStartThrow = 0; + m_flReleaseThrow = 0; + } + //BMOD End - fix for short fuse hand grenades. + EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "common/null.wav", 1.0, ATTN_NORM ); } diff --git a/dlls/healthkit.cpp b/dlls/healthkit.cpp index e1b22467..b1a347c2 100644 --- a/dlls/healthkit.cpp +++ b/dlls/healthkit.cpp @@ -71,6 +71,9 @@ BOOL CHealthKit::MyTouch( CBasePlayer *pPlayer ) if( pPlayer->TakeHealth( gSkillData.healthkitCapacity, DMG_GENERIC ) ) { + if( pPlayer->m_RuneFlags == RUNE_HEALTH ) + pPlayer->TakeHealth( gSkillData.healthkitCapacity, DMG_GENERIC ); + MESSAGE_BEGIN( MSG_ONE, gmsgItemPickup, NULL, pPlayer->pev ); WRITE_STRING( STRING( pev->classname ) ); MESSAGE_END(); @@ -179,6 +182,8 @@ void CWallHealth::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u if( !pActivator->IsPlayer() ) return; + CBasePlayer *pPlayer = (CBasePlayer *)pActivator; + // if there is no juice left, turn it off if( m_iJuice <= 0 ) { @@ -220,6 +225,9 @@ void CWallHealth::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u // charge the player if( pActivator->TakeHealth( 1, DMG_GENERIC ) ) { + if( pPlayer->m_RuneFlags == RUNE_HEALTH ) + pPlayer->TakeHealth( 1, DMG_GENERIC ); + m_iJuice--; } diff --git a/dlls/hornetgun.cpp b/dlls/hornetgun.cpp index cc63d6db..e37db8ca 100644 --- a/dlls/hornetgun.cpp +++ b/dlls/hornetgun.cpp @@ -23,6 +23,17 @@ #include "player.h" #include "hornet.h" #include "gamerules.h" +#include "effects.h" +#include "BMOD_messaging.h" +#include "decals.h" +#include "BMOD_zapgunrift.h" +#include "shake.h" +#include "squeakgrenade.h" + +short iBSquidSpitSprite; + +extern cvar_t bm_freezetime; +extern cvar_t bm_hornet_mod; enum hgun_e { @@ -34,14 +45,424 @@ enum hgun_e HGUN_SHOOT }; +enum hgun_phase +{ + HGUN_IDLE = 0, + HGUN_CHARGE, + HGUN_ZAP, + HGUN_ZAP_DONE, + HGUN_SPIT +}; + enum firemode_e { FIREMODE_TRACK = 0, FIREMODE_FAST }; +//========================================================= +// Bullsquid's spit projectile +//========================================================= +class BMODSquidSpit : public CBaseEntity +{ +public: + void Spawn( void ); + + static void Shoot( entvars_t *Owner, Vector vecStart, Vector vecVelocity ); + void Touch( CBaseEntity *pOther ); + void EXPORT Animate( void ); + + static TYPEDESCRIPTION m_SaveData[]; + + int m_maxFrame; + entvars_t *pevOwner; + +}; + +LINK_ENTITY_TO_CLASS( squidspit, BMODSquidSpit ); + +void BMODSquidSpit:: Spawn( void ) +{ + pev->movetype = MOVETYPE_FLY; + pev->classname = MAKE_STRING( "squidspit" ); + + pev->solid = SOLID_BBOX; + pev->rendermode = kRenderTransAlpha; + pev->renderamt = 255; + + SET_MODEL( ENT( pev ), "sprites/bigspit.spr" ); + pev->frame = 0; + pev->scale = 0.5; + + UTIL_SetSize( pev, Vector( -4, -4, -4 ), Vector( 4, 4, 4 ) ); + + m_maxFrame = (float)MODEL_FRAMES( pev->modelindex ) - 1; + + MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY ); + WRITE_BYTE( TE_BEAMFOLLOW ); + WRITE_SHORT( entindex() ); // entity + WRITE_SHORT( g_sModelIndexLightning ); // model + WRITE_BYTE( 2 ); // life + WRITE_BYTE( 4 ); // width + WRITE_BYTE( 128 ); // r, g, b + WRITE_BYTE( 200 ); // r, g, b + WRITE_BYTE( 0 ); // r, g, b + WRITE_BYTE( 255 ); // brightness + MESSAGE_END(); // move PHS/PVS data sending into here (SEND_ALL, SEND_PVS, SEND_PHS) +} + +void BMODSquidSpit::Animate( void ) +{ + pev->nextthink = gpGlobals->time + 0.1; + + if( pev->frame++ ) + { + if( pev->frame > m_maxFrame ) + { + pev->frame = 0; + } + } +} + +void BMODSquidSpit::Shoot( entvars_t *Owner, Vector vecStart, Vector vecVelocity ) +{ + BMODSquidSpit *pSpit = GetClassPtr( (BMODSquidSpit *)NULL ); + pSpit->Spawn(); + + UTIL_SetOrigin( pSpit->pev, vecStart ); + pSpit->pev->velocity = vecVelocity; + pSpit->pev->owner = ENT( Owner ); + pSpit->pevOwner = Owner; + + pSpit->SetThink( Animate ); + pSpit->pev->nextthink = gpGlobals->time + 0.1; +} + +void BMODSquidSpit::Touch( CBaseEntity *pOther ) +{ + TraceResult tr; + int iPitch; + + // splat sound + iPitch = RANDOM_FLOAT( 90, 110 ); + + EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "bullchicken/bc_acid1.wav", 1, ATTN_NORM, 0, iPitch ); + + switch( RANDOM_LONG( 0, 1 ) ) + { + case 0: + EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, "bullchicken/bc_spithit1.wav", 1, ATTN_NORM, 0, iPitch ); + break; + case 1: + EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, "bullchicken/bc_spithit2.wav", 1, ATTN_NORM, 0, iPitch ); + break; + } + + // make a splat on the wall + UTIL_TraceLine( pev->origin, pev->origin + pev->velocity, dont_ignore_monsters, ENT( pev ), &tr ); + UTIL_DecalTrace( &tr, DECAL_SPIT1 + RANDOM_LONG( 0, 1 ) ); + + // make some flecks + MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, tr.vecEndPos ); + WRITE_BYTE( TE_SPRITE_SPRAY ); + WRITE_COORD( tr.vecEndPos.x ); // pos + WRITE_COORD( tr.vecEndPos.y ); + WRITE_COORD( tr.vecEndPos.z ); + WRITE_COORD( tr.vecPlaneNormal.x ); // dir + WRITE_COORD( tr.vecPlaneNormal.y ); + WRITE_COORD( tr.vecPlaneNormal.z ); + WRITE_SHORT( iBSquidSpitSprite ); // model + WRITE_BYTE( 5 ); // count + WRITE_BYTE( 30 ); // speed + WRITE_BYTE( 80 ); // noise ( client will divide by 100 ) + MESSAGE_END(); + + if( pOther->IsPlayer() ) + { + ClearMultiDamage(); + pOther->TraceAttack( pevOwner, 30, pev->origin + pev->velocity, &tr, DMG_GENERIC ); + ApplyMultiDamage( pev, pevOwner ); + } + + SetThink( SUB_Remove ); + pev->nextthink = gpGlobals->time; +} + +#include "BMOD_hornetgun.h" + LINK_ENTITY_TO_CLASS( weapon_hornetgun, CHgun ) +//========================================================= +// ClearBeams - remove all beams +//========================================================= +void CHgun::ClearBeams() +{ + for( int i = 0; i < HGUN_MAX_BEAMS; i++ ) + { + if( m_pBeam[i] ) + { + UTIL_Remove( m_pBeam[i] ); + m_pBeam[i] = NULL; + } + } + m_iBeams = 0; + + STOP_SOUND( ENT(m_pPlayer->pev), CHAN_WEAPON, "debris/zap4.wav" ); +} + +//========================================================= +// ArmBeam - small beam from arm to nearby geometry +//========================================================= + +void CHgun::ArmBeam( Vector color ) +{ + TraceResult tr; + float flDist = 1.0; + + if( m_iBeams >= HGUN_MAX_BEAMS ) + return; + + // UTIL_MakeAimVectors( pev->angles ); + Vector vecSrc = m_pPlayer->GetGunPosition() + gpGlobals->v_forward * 16 + gpGlobals->v_right * 8 + gpGlobals->v_up * -12; + + for( int i = 0; i < 3; i++ ) + { + Vector vecAim = gpGlobals->v_right * RANDOM_FLOAT( -1, 1 ) + gpGlobals->v_up * RANDOM_FLOAT( -1, 1 ); + TraceResult tr1; + UTIL_TraceLine( vecSrc, vecSrc + vecAim * 512, dont_ignore_monsters, ENT( m_pPlayer->pev ), &tr1 ); + if( flDist > tr1.flFraction ) + { + tr = tr1; + flDist = tr.flFraction; + } + } + + // Couldn't find anything close enough + if( flDist == 1.0 ) + return; + + // DecalGunshot( &tr, BULLET_PLAYER_CROWBAR ); + + m_pBeam[m_iBeams] = CBeam::BeamCreate( "sprites/lgtning.spr", 30 ); + if( !m_pBeam[m_iBeams] ) + return; + + m_pBeam[m_iBeams]->PointEntInit( tr.vecEndPos, m_pPlayer->entindex() ); + m_pBeam[m_iBeams]->SetEndAttachment( 1 ); + // m_pBeam[m_iBeams]->SetColor( 96, 128, 16 ); + m_pBeam[m_iBeams]->SetColor( color.x, color.y, color.z ); + m_pBeam[m_iBeams]->SetBrightness( 64 ); + m_pBeam[m_iBeams]->SetNoise( 80 ); + m_pBeam[m_iBeams]->pev->spawnflags |= SF_BEAM_TEMPORARY; + m_iBeams++; +} + +//========================================================= +// ZapBeam - heavy damage directly forward +//========================================================= +void CHgun::ZapBeam( void ) +{ + Vector vecSrc, vecAim, vecOrig; + TraceResult tr; + CBaseEntity *pEntity; + + /* + if (m_iBeams >= HGUN_MAX_BEAMS) + return; + */ + + // UTIL_MakeVectors( m_pPlayer->pev->v_angle ); + vecOrig = m_pPlayer->GetGunPosition(); + vecSrc = m_pPlayer->GetGunPosition() + gpGlobals->v_forward * 16 + gpGlobals->v_right * 8 + gpGlobals->v_up * -12; + vecAim = gpGlobals->v_forward; + + UTIL_TraceLine( vecOrig, vecOrig + vecAim * 2048, dont_ignore_monsters, ENT( m_pPlayer->pev ), &tr ); + + for( int i = 0; i < 2; i++ ) + { + MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY ); + WRITE_BYTE( TE_BEAMPOINTS ); + WRITE_COORD( vecSrc.x ); + WRITE_COORD( vecSrc.y ); + WRITE_COORD( vecSrc.z ); + WRITE_COORD( tr.vecEndPos.x ); + WRITE_COORD( tr.vecEndPos.y ); + WRITE_COORD( tr.vecEndPos.z ); + WRITE_SHORT( iZapBeamSpr ); + WRITE_BYTE( 0 ); // Starting frame + WRITE_BYTE( 0 ); // framerate * 0.1 + WRITE_BYTE( 2 ); // life * 0.1 + WRITE_BYTE( 50 ); // width + WRITE_BYTE( 20 ); // noise + WRITE_BYTE( 180 ); // color r,g,b + WRITE_BYTE( 255 ); // color r,g,b + WRITE_BYTE( 96 ); // color r,g,b + WRITE_BYTE( 255 ); // brightness + WRITE_BYTE( 0 ); // scroll speed + MESSAGE_END(); + } + + UTIL_DecalTrace( &tr, DECAL_SMALLSCORCH1 + RANDOM_LONG( 0, 2 ) ); + + /* + m_pBeam[m_iBeams] = CBeam::BeamCreate( "sprites/lgtning.spr", 50 ); + if( !m_pBeam[m_iBeams] ) + return; + m_pBeam[m_iBeams]->PointEntInit( tr.vecEndPos, m_pPlayer->entindex() ); + m_pBeam[m_iBeams]->SetEndAttachment( 1 ); + m_pBeam[m_iBeams]->SetColor( 180, 255, 96 ); + m_pBeam[m_iBeams]->SetBrightness( 255 ); + m_pBeam[m_iBeams]->SetNoise( 20 ); + m_pBeam[m_iBeams]->pev->spawnflags |= SF_BEAM_TEMPORARY; + m_iBeams++; + */ + + pEntity = CBaseEntity::Instance(tr.pHit); + if( pEntity != NULL && pEntity->pev->takedamage ) + { + // pEntity->TakeDamage( pev, VARS (pev->owner), 45, DMG_SHOCK ); + ClearMultiDamage(); + entvars_t *Owner; + Owner = VARS( pev->owner ); + pEntity->TraceAttack( Owner, 90, vecAim, &tr, DMG_SHOCK | DMG_ALWAYSGIB ); + ApplyMultiDamage( pev, Owner ); + UTIL_ScreenFade( pEntity, Vector(180,255,96), 2, 0.5, 128, FFADE_IN ); + } + + UTIL_EmitAmbientSound( ENT( m_pPlayer->pev ), tr.vecEndPos, "weapons/electro4.wav", 0.5, ATTN_NORM, 0, RANDOM_LONG( 140, 160 ) ); + + if( UTIL_PointContents( tr.vecEndPos ) == CONTENTS_WATER ) + { + CBaseEntity *pRift = CBaseEntity::Create( "zaprift", tr.vecEndPos, UTIL_VecToAngles( tr.vecPlaneNormal ), m_pPlayer->edict() ); + // UTIL_EmitAmbientSound( ENT(m_pPlayer->pev), tr.vecEndPos, "weapons/electro4.wav", 50, ATTN_NORM, 0, 300 ); + } +} + +//========================================================= +// Freeze Ray - +//========================================================= +void CHgun::FreezeRay( void ) +{ + Vector vecSrc, vecAim, vecOrig; + TraceResult tr; + CBaseEntity *pEntity; + + if( ( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] < 12 ) || m_pPlayer->pev->waterlevel == 3 ) + { + return; + } + + vecOrig = m_pPlayer->GetGunPosition(); + vecSrc = m_pPlayer->GetGunPosition() + gpGlobals->v_forward * 16 + gpGlobals->v_right * 8 + gpGlobals->v_up * -12; + vecAim = gpGlobals->v_forward; + UTIL_TraceLine( vecOrig, vecOrig + vecAim * 2048, dont_ignore_monsters, ENT( m_pPlayer->pev ), &tr ); + + MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY ); + WRITE_BYTE( TE_BEAMPOINTS ); + WRITE_COORD( vecSrc.x ); + WRITE_COORD( vecSrc.y ); + WRITE_COORD( vecSrc.z ); + WRITE_COORD( tr.vecEndPos.x ); + WRITE_COORD( tr.vecEndPos.y ); + WRITE_COORD( tr.vecEndPos.z ); + WRITE_SHORT( iZapBeamSpr ); + WRITE_BYTE( 0 ); // Starting frame + WRITE_BYTE( 0 ); // framerate * 0.1 + WRITE_BYTE( 3 ); // life * 0.1 + WRITE_BYTE( 200 ); // width + WRITE_BYTE( 2 ); // noise + WRITE_BYTE( 220 ); // color r,g,b + WRITE_BYTE( 220 ); // color r,g,b + WRITE_BYTE( 255 ); // color r,g,b + WRITE_BYTE( 255 ); // brightness + WRITE_BYTE( 0 ); // scroll speed + MESSAGE_END(); + + UTIL_DecalTrace( &tr, DECAL_MOMMASPLAT ); + + MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY ); + WRITE_BYTE( TE_SPRITETRAIL );// TE_RAILTRAIL); + WRITE_COORD( vecSrc.x ); + WRITE_COORD( vecSrc.y ); + WRITE_COORD( vecSrc.z ); + WRITE_COORD( tr.vecEndPos.x ); + WRITE_COORD( tr.vecEndPos.y ); + WRITE_COORD( tr.vecEndPos.z ); + WRITE_SHORT( m_sGlowSpr ); // model + WRITE_BYTE( 20 ); // count + WRITE_BYTE( 10 ); // life * 10 + WRITE_BYTE( RANDOM_LONG( 1, 2 ) ); // size * 10 + WRITE_BYTE( 10 ); // amplitude * 0.1 + WRITE_BYTE( 0 ); // speed * 100 + MESSAGE_END(); + + pEntity = CBaseEntity::Instance( tr.pHit ); + if( pEntity != NULL && pEntity->pev->takedamage && pEntity->IsPlayer() ) + { + CBasePlayer *pPlayer = (CBasePlayer *)pEntity; + + UTIL_ScreenFade( pPlayer, Vector( 0, 0, 255 ), 2.0, 1.0, 128, FFADE_IN ); + + pPlayer->pev->rendermode = kRenderNormal; + pPlayer->pev->renderfx = kRenderFxGlowShell; + + pPlayer->pev->rendercolor.x = 240; // red + pPlayer->pev->rendercolor.y = 240; // green + pPlayer->pev->rendercolor.z = 255; // blue + + pPlayer->pev->renderamt = 60; // glow shell distance from entity + + float freezetime = max (.6, bm_freezetime.value); + + // freeze the player and set the "unfreeze" time... + pPlayer->EnableControl(FALSE); + pPlayer->m_vFreezeAngle = pPlayer->pev->v_angle; + // pPlayer->pev->movetype = MOVETYPE_TOSS; + + pPlayer->m_flFreezeTime = gpGlobals->time + freezetime; + //RuneMsg( pPlayer, "YOU ARE FROZEN!!!", Vector(100,100,255), freezetime - .5); + PrintMessage( pPlayer, BMOD_CHAN_RUNE, Vector(100,100,255), Vector (.1, freezetime - .5, .1), "YOU ARE FROZEN!!!"); + + } + + UTIL_EmitAmbientSound( ENT(m_pPlayer->pev), tr.vecEndPos, "weapons/electro4.wav", 0.5, ATTN_NORM, 0, RANDOM_LONG( 140, 160 )); + + m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] = 0; + m_flNextPrimaryAttack = gpGlobals->time + .25; + + m_flRechargeTime = gpGlobals->time + 0.5; + + m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME; + m_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH; + + SendWeaponAnim( HGUN_SHOOT ); + + // player "shoot" animation + m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); + + m_flTimeWeaponIdle = gpGlobals->time + RANDOM_FLOAT( 10, 15 ); + m_pPlayer->pev->punchangle.x = RANDOM_FLOAT( 0, 2 ); +} + + +//========================================================= +// BeamGlow - brighten all beams +//========================================================= +void CHgun::BeamGlow() +{ + int b = m_iBeams * 32; + if( b > 255 ) + b = 255; + + for( int i = 0; i < m_iBeams; i++ ) + { + if( m_pBeam[i]->GetBrightness() != 255 ) + { + m_pBeam[i]->SetBrightness( b ); + } + } +} + BOOL CHgun::IsUseable( void ) { return TRUE; @@ -55,6 +476,7 @@ void CHgun::Spawn() m_iDefaultAmmo = HIVEHAND_DEFAULT_GIVE; m_iFirePhase = 0; + m_iFireMode = 0; FallInit();// get ready to fall down. } @@ -68,6 +490,23 @@ void CHgun::Precache( void ) m_usHornetFire = PRECACHE_EVENT( 1, "events/firehornet.sc" ); UTIL_PrecacheOther( "hornet" ); + UTIL_PrecacheOther( "zaprift" ); + UTIL_PrecacheOther( "zapbounce" ); + PRECACHE_SOUND( "debris/zap4.wav" ); + PRECACHE_SOUND( "weapons/electro4.wav" ); + PRECACHE_SOUND( "hassault/hw_shoot1.wav" ); + iZapBeamSpr = PRECACHE_MODEL( "sprites/lgtning.spr" ); + + PRECACHE_MODEL( "sprites/bigspit.spr" ); + iBSquidSpitSprite = PRECACHE_MODEL( "sprites/tinyspit.spr" );// client side spittle. + PRECACHE_SOUND( "bullchicken/bc_acid1.wav" ); + PRECACHE_SOUND( "bullchicken/bc_spithit1.wav" ); + PRECACHE_SOUND( "bullchicken/bc_spithit2.wav" ); + PRECACHE_SOUND( "bullchicken/bc_attack2.wav" ); + PRECACHE_SOUND( "bullchicken/bc_attack3.wav" ); + PRECACHE_SOUND( "leech/leech_bite1.wav" ); + + m_sGlowSpr = PRECACHE_MODEL( "sprites/glow04.spr" ); } int CHgun::AddToPlayer( CBasePlayer *pPlayer ) @@ -78,7 +517,7 @@ int CHgun::AddToPlayer( CBasePlayer *pPlayer ) if( g_pGameRules->IsMultiplayer() ) { // in multiplayer, all hivehands come full. - pPlayer->m_rgAmmo[PrimaryAmmoIndex()] = HORNET_MAX_CARRY; + pPlayer->m_rgAmmo[PrimaryAmmoIndex()] = 12; } #endif MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev ); @@ -93,7 +532,7 @@ int CHgun::GetItemInfo( ItemInfo *p ) { p->pszName = STRING( pev->classname ); p->pszAmmo1 = "Hornets"; - p->iMaxAmmo1 = HORNET_MAX_CARRY; + p->iMaxAmmo1 = m_iMaxammo; p->pszAmmo2 = NULL; p->iMaxAmmo2 = -1; p->iMaxClip = WEAPON_NOCLIP; @@ -108,11 +547,18 @@ int CHgun::GetItemInfo( ItemInfo *p ) BOOL CHgun::Deploy() { + // BMOD Edit - Modified hornet message + if( bm_hornet_mod.value ) + PrintMessage( m_pPlayer, BMOD_CHAN_WEAPON, Vector( 20, 250, 20 ), Vector( 1, 4, 2 ), "HORNET GUN\nACID SPIT - LIGHTNING - FREEZE RAY - SNARKS\nSECONDARY FIRE: Switches modes." ); + return DefaultDeploy( "models/v_hgun.mdl", "models/p_hgun.mdl", HGUN_UP, "hive" ); } void CHgun::Holster( int skiplocal /* = 0 */ ) { + ClearBeams(); + m_iFirePhase = HGUN_IDLE; + m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5; SendWeaponAnim( HGUN_DOWN ); @@ -123,7 +569,376 @@ void CHgun::Holster( int skiplocal /* = 0 */ ) } } -void CHgun::PrimaryAttack() +void CHgun::SecondaryAttack() +{ + if( !bm_hornet_mod.value ) + { + OldSecondaryAttack(); + return; + } + + m_iFireMode = ( m_iFireMode + 1 ) % 5; + + switch( m_iFireMode ) + { + case 0: + PrintMessage( m_pPlayer, BMOD_CHAN_WEAPON, Vector( 20, 250, 20 ), Vector( 1, 4, 2 ), "\n\nAcid Spit Mode - 3 per shot"); + break; + case 1: + PrintMessage( m_pPlayer, BMOD_CHAN_WEAPON, Vector( 20, 250, 20 ), Vector( 1, 4, 2 ), "\n\nLightning Mode - 4 per shot"); + break; + case 2: + PrintMessage( m_pPlayer, BMOD_CHAN_WEAPON, Vector( 20, 250, 20 ), Vector( 1, 4, 2 ), "\n\nMultizap Mode - 12 per shot"); + break; + case 3: + PrintMessage( m_pPlayer, BMOD_CHAN_WEAPON, Vector( 20, 250, 20 ), Vector( 1, 4, 2 ), "\n\nFreeze Ray Mode - 12 per shot"); + break; + case 4: + PrintMessage( m_pPlayer, BMOD_CHAN_WEAPON, Vector( 20, 250, 20 ), Vector( 1, 4, 2 ), "\n\nSnark Launcher Mode - 1 Snark per shot"); + break; + } + + EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "leech/leech_bite1.wav", 1, ATTN_NORM ); + m_flNextSecondaryAttack = gpGlobals->time + .5; +} + +void CHgun::ZapGun() +{ + if( m_iFirePhase == HGUN_IDLE ) + Reload(); + + if( ( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] < 4 ) || ( m_fNextPhaseTime > gpGlobals->time ) ) + { + return; + } + + if( m_pPlayer->pev->waterlevel > 0 ) + { + + // m_pPlayer->TakeDamage( VARS( eoNullEntity ), VARS( eoNullEntity ), 50, DMG_SHOCK ); + UTIL_ScreenFade( this, Vector( 180, 255, 96 ), 2, 0.5, 128, FFADE_IN ); + + CBaseEntity *pRift = CBaseEntity::Create( "zaprift", pev->origin, pev->angles, ENT( pev ) ); + + m_pPlayer->TakeDamage( m_pPlayer->pev, m_pPlayer->pev, 100, DMG_SHOCK ); + EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_WEAPON, "debris/zap4.wav", 1, ATTN_NORM, 0, 100 + m_iBeams * 10 ); + m_flNextPrimaryAttack = m_flNextPrimaryAttack + 1.5; + return; + } + + switch( m_iFirePhase ) + { + case HGUN_IDLE: + m_flTimeWeaponIdle = gpGlobals->time; + m_iFirePhase = HGUN_CHARGE; + m_fNextPhaseTime = 0; + m_pPlayer->m_iWeaponVolume = QUIET_GUN_VOLUME; + m_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH; + case HGUN_CHARGE: + if( m_fNextPhaseTime < gpGlobals->time ) + { + if( m_iBeams < HGUN_MAX_BEAMS ) + { + ArmBeam( Vector( 96, 128, 16 ) ); + BeamGlow(); + m_fNextPhaseTime = gpGlobals->time + HGUN_CHARGE_TIME; + EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_WEAPON, "debris/zap4.wav", 1, ATTN_NORM, 0,100 + m_iBeams * 10 ); + } + else + { + m_iFirePhase = HGUN_ZAP; + m_fNextPhaseTime = gpGlobals->time + .1; + } + } + break; + case HGUN_ZAP: + ClearBeams(); + ZapBeam(); + m_iFirePhase = HGUN_ZAP_DONE; + m_fNextPhaseTime = gpGlobals->time + HGUN_ZAP_TIME; + EMIT_SOUND_DYN( ENT(m_pPlayer->pev), CHAN_WEAPON, "hassault/hw_shoot1.wav", 1, ATTN_NORM, 0, RANDOM_LONG( 130, 160 ) ); + SendWeaponAnim( HGUN_SHOOT ); + + // player "shoot" animation + m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); + + m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= 4; + m_flRechargeTime = gpGlobals->time + 0.5; + m_pPlayer->pev->punchangle.x = RANDOM_FLOAT( 0, 2 ); + break; + case HGUN_ZAP_DONE: + ClearBeams(); + m_flNextPrimaryAttack = gpGlobals->time + .25; + m_flTimeWeaponIdle = gpGlobals->time + .1; + break; + } +} + +void CHgun::MultiZapGun() +{ + CZapBounce *pRift = NULL; + + if( m_iFirePhase == HGUN_IDLE ) + Reload(); + + if( ( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] < 12 ) || ( m_fNextPhaseTime > gpGlobals->time ) ) + { + return; + } + + if( m_pPlayer->pev->waterlevel > 0 ) + { + UTIL_ScreenFade( this, Vector( 180, 255, 96 ), 2, 0.5, 128, FFADE_IN ); + m_pPlayer->TakeDamage( m_pPlayer->pev, m_pPlayer->pev, 100, DMG_SHOCK ); + EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_WEAPON, "debris/zap4.wav", 1, ATTN_NORM, 0, 100 + m_iBeams * 10 ); + m_flNextPrimaryAttack = m_flNextPrimaryAttack + 1.5; + return; + } + + switch( m_iFirePhase ) + { + case HGUN_IDLE: + m_flTimeWeaponIdle = gpGlobals->time; + m_iFirePhase = HGUN_CHARGE; + m_fNextPhaseTime = 0; + m_pPlayer->m_iWeaponVolume = QUIET_GUN_VOLUME; + m_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH; + case HGUN_CHARGE: + if( m_fNextPhaseTime < gpGlobals->time ) + { + if( m_iBeams < HGUN_MAX_BEAMS / 2 ) + { + ArmBeam( Vector( 16, 96, 128 ) ); + BeamGlow(); + m_fNextPhaseTime = gpGlobals->time + HGUN_CHARGE_TIME; + EMIT_SOUND_DYN( ENT(m_pPlayer->pev), CHAN_WEAPON, "debris/zap4.wav", 1, ATTN_NORM, 0,100 + m_iBeams * 10 ); + } + else + m_iFirePhase = HGUN_ZAP; + m_fNextPhaseTime = gpGlobals->time + .1; + } + break; + case HGUN_ZAP: + ClearBeams(); + pRift = (CZapBounce*)CBaseEntity::Create( "zapbounce", + m_pPlayer->GetGunPosition( ) + gpGlobals->v_forward * 16 + gpGlobals->v_right * 8 + gpGlobals->v_up * -12, + gpGlobals->v_forward, + m_pPlayer->edict() ); + if( pRift ) + { + pRift->m_fDamage = 90; + pRift->m_iBounce = 5; + pRift->pentIgnore = ENT( m_pPlayer->pev ); + pRift->m_bFirstZap = TRUE; + pRift->BounceThink(); + } + m_iFirePhase = HGUN_ZAP_DONE; + m_fNextPhaseTime = gpGlobals->time + HGUN_ZAP_TIME; + EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_WEAPON, "hassault/hw_shoot1.wav", 1, ATTN_NORM, 0, RANDOM_LONG( 130, 160 ) ); + SendWeaponAnim( HGUN_SHOOT ); + // player "shoot" animation + m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); + + m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= 12; + m_flRechargeTime = gpGlobals->time + 0.5; + m_pPlayer->pev->punchangle.x = RANDOM_FLOAT( 0, 2 ); + break; + case HGUN_ZAP_DONE: + ClearBeams(); + m_flNextPrimaryAttack = gpGlobals->time + .25; + m_flTimeWeaponIdle = gpGlobals->time + .1; + break; + } +} + +void CHgun::PrimaryAttack( void ) +{ + if( !bm_hornet_mod.value ) + { + OldPrimaryAttack(); + return; + } + + Reload(); + + switch( m_iFireMode ) + { + case 0: + SquidSpit(); + break; + case 1: + ZapGun(); + break; + case 2: + MultiZapGun(); + break; + case 3: + FreezeRay(); + break; + case 4: + LaunchSnark(); + break; + } +} + +void CHgun::SquidSpit( void ) +{ + if( ( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] < 3 ) || ( m_iFirePhase != HGUN_IDLE ) ) + { + return; + } + + Vector vecSrc, vecDir, vecOrig; + int iSpittle, iSpitSpeed; + TraceResult tr; + + // UTIL_MakeVectors( m_pPlayer->pev->v_angle ); + + // Vector anglesAim = m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle; + // UTIL_MakeVectors( anglesAim ); + + vecOrig = m_pPlayer->GetGunPosition(); + vecSrc = m_pPlayer->GetGunPosition() + gpGlobals->v_forward * 16 + gpGlobals->v_right * 8 + gpGlobals->v_up * -12; + // vecDir = m_pPlayer->pev->v_angle; + // vecDir = m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES ); + vecDir = gpGlobals->v_forward; + UTIL_TraceLine( vecOrig, vecOrig + vecDir * 2048, dont_ignore_monsters, ENT( m_pPlayer->pev ), &tr ); + vecDir = ( tr.vecEndPos - vecSrc ).Normalize(); + + if( m_pPlayer->pev->waterlevel == 3 ) + { + iSpittle = 15; + iSpitSpeed = 120; + } + else + { + // CSquidSpit::Shoot( m_pPlayer->edict(), vecSrc, vecDir * 900 ); + // CBaseEntity *pSpit = CBaseEntity::Create( "squidspit", vecSrc, vecDir , pev->owner ); + BMODSquidSpit::Shoot( m_pPlayer->pev, vecSrc, vecDir * 1100 ); + iSpittle = 5; + iSpitSpeed = 80; + } + + m_flNextPrimaryAttack = gpGlobals->time + .25; + + // spew the spittle temporary ents. + MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSrc ); + WRITE_BYTE( TE_SPRITE_SPRAY ); + WRITE_COORD( vecSrc.x ); // pos + WRITE_COORD( vecSrc.y ); + WRITE_COORD( vecSrc.z ); + WRITE_COORD( vecDir.x ); // dir + WRITE_COORD( vecDir.y ); + WRITE_COORD( vecDir.z ); + WRITE_SHORT( iBSquidSpitSprite ); // model + WRITE_BYTE( iSpittle ); // count + WRITE_BYTE( iSpitSpeed ); // speed + WRITE_BYTE( 25 ); // noise ( client will divide by 100 ) + MESSAGE_END(); + + switch( RANDOM_LONG( 0, 1 ) ) + { + case 0: + EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "bullchicken/bc_attack2.wav", 1, ATTN_NORM ); + break; + case 1: + EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "bullchicken/bc_attack3.wav", 1, ATTN_NORM ); + break; + } + + m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= 3; + m_flRechargeTime = gpGlobals->time + 0.5; + + m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME; + m_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH; + + SendWeaponAnim( HGUN_SHOOT ); + + // player "shoot" animation + m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); + + m_flTimeWeaponIdle = gpGlobals->time + RANDOM_FLOAT ( 10, 15 ); + m_pPlayer->pev->punchangle.x = RANDOM_FLOAT( 0, 2 ); +} + +void CHgun::LaunchSnark( void ) +{ + if( ( m_pPlayer->m_rgAmmo[m_pPlayer->GetAmmoIndex( "Snarks" )] < 1 ) || ( m_iFirePhase != HGUN_IDLE ) ) + { + return; + } + + Vector vecSrc, vecDir, vecOrig; + int iSpittle, iSpitSpeed; + TraceResult tr; + + vecOrig = m_pPlayer->GetGunPosition(); + vecSrc = m_pPlayer->GetGunPosition() + gpGlobals->v_forward * 16 + gpGlobals->v_right * 8 + gpGlobals->v_up * -12; + // vecDir = m_pPlayer->pev->v_angle; + // vecDir = m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES ); + vecDir = gpGlobals->v_forward; + UTIL_TraceLine( vecSrc + gpGlobals->v_forward * 20, vecSrc + gpGlobals->v_forward * 40, dont_ignore_monsters, NULL, &tr ); + vecDir = ( tr.vecEndPos - vecSrc ).Normalize(); + + if( m_pPlayer->pev->waterlevel == 3 ) + { + iSpittle = 15; + iSpitSpeed = 120; + } + else + { + CBaseEntity *pSqueak = CBaseEntity::Create( "monster_snark", tr.vecEndPos, m_pPlayer->pev->v_angle, m_pPlayer->edict() ); + pSqueak->pev->velocity = gpGlobals->v_forward * 1500 + m_pPlayer->pev->velocity; + ( (CSqueakGrenade*)pSqueak )->m_bWasLaunched = TRUE; + EMIT_SOUND_DYN( ENT( pSqueak->pev ), CHAN_VOICE, "squeek/sqk_hunt2.wav", 1, ATTN_NORM, 0, 105 ); + + iSpittle = 5; + iSpitSpeed = 80; + } + + m_flNextPrimaryAttack = gpGlobals->time + .4; + + // spew the spittle temporary ents. + MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSrc ); + WRITE_BYTE( TE_SPRITE_SPRAY ); + WRITE_COORD( vecSrc.x ); // pos + WRITE_COORD( vecSrc.y ); + WRITE_COORD( vecSrc.z ); + WRITE_COORD( vecDir.x ); // dir + WRITE_COORD( vecDir.y ); + WRITE_COORD( vecDir.z ); + WRITE_SHORT( iBSquidSpitSprite ); // model + WRITE_BYTE( iSpittle ); // count + WRITE_BYTE( iSpitSpeed ); // speed + WRITE_BYTE( 25 ); // noise ( client will divide by 100 ) + MESSAGE_END(); + + switch( RANDOM_LONG( 0, 1 ) ) + { + case 0: + EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "bullchicken/bc_attack2.wav", 1, ATTN_NORM ); + break; + case 1: + EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "bullchicken/bc_attack3.wav", 1, ATTN_NORM ); + break; + } + + m_pPlayer->m_rgAmmo[m_pPlayer->GetAmmoIndex( "Snarks" )] -= 1; + m_flRechargeTime = gpGlobals->time + 0.5; + + m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME; + m_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH; + + SendWeaponAnim( HGUN_SHOOT ); + + // player "shoot" animation + m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); + + m_flTimeWeaponIdle = gpGlobals->time + RANDOM_FLOAT( 10, 15 ); + m_pPlayer->pev->punchangle.x = RANDOM_FLOAT( 0, 2 ); +} + +void CHgun::OldPrimaryAttack() { Reload(); @@ -165,7 +980,7 @@ void CHgun::PrimaryAttack() m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); } -void CHgun::SecondaryAttack( void ) +void CHgun::OldSecondaryAttack( void ) { Reload(); @@ -246,10 +1061,11 @@ void CHgun::SecondaryAttack( void ) void CHgun::Reload( void ) { - if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] >= HORNET_MAX_CARRY ) + m_iMaxammo = (bm_hornet_mod.value) ? 12 : 8 + if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] >= m_iMaxammo ) return; - while( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] < HORNET_MAX_CARRY && m_flRechargeTime < gpGlobals->time ) + while( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] < m_iMaxammo && m_flRechargeTime < gpGlobals->time ) { m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]++; m_flRechargeTime += 0.5; @@ -259,6 +1075,9 @@ void CHgun::Reload( void ) void CHgun::WeaponIdle( void ) { Reload(); + m_iFirePhase = HGUN_IDLE; + if( m_iBeams ) + ClearBeams(); if( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() ) return; diff --git a/dlls/items.cpp b/dlls/items.cpp index d9cc7871..001f2e75 100644 --- a/dlls/items.cpp +++ b/dlls/items.cpp @@ -121,6 +121,8 @@ void CItem::ItemTouch( CBaseEntity *pOther ) return; } + pPlayer->BMOD_ResetTypeKill(); + if( MyTouch( pPlayer ) ) { SUB_UseTargets( pOther, USE_TOGGLE, 0 ); @@ -226,6 +228,10 @@ class CItemBattery : public CItem char szcharge[64]; pPlayer->pev->armorvalue += gSkillData.batteryCapacity; + + if( pPlayer->m_RuneFlags == RUNE_BATTERY ) + pPlayer->pev->armorvalue += gSkillData.batteryCapacity; + pPlayer->pev->armorvalue = min( pPlayer->pev->armorvalue, MAX_NORMAL_BATTERY ); EMIT_SOUND( pPlayer->edict(), CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_NORM ); diff --git a/dlls/mp5.cpp b/dlls/mp5.cpp index 7d05d5e1..690bd2e6 100644 --- a/dlls/mp5.cpp +++ b/dlls/mp5.cpp @@ -35,6 +35,10 @@ enum mp5_e MP5_FIRE3 }; +// BMOD Edit - mp5 mod +extern cvar_t bm_mp5_mod; +#include "BMOD_messaging.h" + LINK_ENTITY_TO_CLASS( weapon_mp5, CMP5 ) LINK_ENTITY_TO_CLASS( weapon_9mmAR, CMP5 ) @@ -92,7 +96,15 @@ int CMP5::GetItemInfo( ItemInfo *p ) p->pszAmmo1 = "9mm"; p->iMaxAmmo1 = _9MM_MAX_CARRY; p->pszAmmo2 = "ARgrenades"; - p->iMaxAmmo2 = M203_GRENADE_MAX_CARRY; + + // BMOD Begin - mp5 mod + // p->iMaxAmmo2 = M203_GRENADE_MAX_CARRY; + if( bm_mp5_mod.value ) + p->iMaxAmmo2 = 5; + else + p->iMaxAmmo2 = 10; + // BMOD End - mp5 mod + p->iMaxClip = MP5_MAX_CLIP; p->iSlot = 2; p->iPosition = 0; @@ -117,6 +129,12 @@ int CMP5::AddToPlayer( CBasePlayer *pPlayer ) BOOL CMP5::Deploy() { + // BMOD Begin - mp5 mod + if( bm_mp5_mod.value ) + PrintMessage( m_pPlayer, BMOD_CHAN_WEAPON, Vector( 20, 250, 20 ), Vector( 1, 4, 2 ), "MP5\nContact grenade damage is lowered.\nGrenade carry capacity is 5." ); + + // BMOD End - mp5 mod + return DefaultDeploy( "models/v_9mmAR.mdl", "models/p_9mmAR.mdl", MP5_DEPLOY, "mp5" ); } @@ -228,7 +246,14 @@ void CMP5::SecondaryAttack( void ) PLAYBACK_EVENT( flags, m_pPlayer->edict(), m_usMP52 ); m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1; - m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1; + + // BMOD Begin - mp5 mod + if( bm_mp5_mod.value ) + m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.5; + else + m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1; + // BMOD End - mp5 mod + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5;// idle pretty soon after shooting. if( !m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType] ) @@ -338,7 +363,16 @@ class CMP5AmmoGrenade : public CBasePlayerAmmo } BOOL AddAmmo( CBaseEntity *pOther ) { - int bResult = ( pOther->GiveAmmo( AMMO_M203BOX_GIVE, "ARgrenades", M203_GRENADE_MAX_CARRY ) != -1 ); + //int bResult = ( pOther->GiveAmmo( AMMO_M203BOX_GIVE, "ARgrenades", M203_GRENADE_MAX_CARRY ) != -1 ); + + // BMOD Begin - mp5 mod + int bResult; + + if( bm_mp5_mod.value ) + bResult = ( pOther->GiveAmmo( 1, "ARgrenades", 5 ) != -1 ); + else + bResult = ( pOther->GiveAmmo( 2, "ARgrenades", 10 ) != -1 ); + // BMOD End - mp5 mod if( bResult ) { diff --git a/dlls/multiplay_gamerules.cpp b/dlls/multiplay_gamerules.cpp index 929c2bf6..9eb37aa1 100644 --- a/dlls/multiplay_gamerules.cpp +++ b/dlls/multiplay_gamerules.cpp @@ -22,10 +22,11 @@ #include "player.h" #include "weapons.h" #include "gamerules.h" - +#include "monsters.h" #include "skill.h" #include "game.h" #include "items.h" +#include "BMOD_hornetgun.h" #ifndef NO_VOICEGAMEMGR #include "voice_gamemgr.h" #endif @@ -38,8 +39,13 @@ extern int gmsgScoreInfo; extern int gmsgMOTD; extern int gmsgServerName; +extern cvar_t bm_bantime; +extern cvar_t bm_matchkills; + extern int g_teamplay; +extern edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer ); + #define ITEM_RESPAWN_TIME 30 #define WEAPON_RESPAWN_TIME 20 #define AMMO_RESPAWN_TIME 20 @@ -79,6 +85,9 @@ CHalfLifeMultiplay::CHalfLifeMultiplay() RefreshSkillData(); m_flIntermissionEndTime = 0; g_flIntermissionStartTime = 0; + + // BMOD Edit - Precalculate the bm_map and bm_nextmap vars + BMOD_PreChangeLevel(); // 11/8/98 // Modified by YWB: Server .cfg file is now a cvar, so that @@ -117,6 +126,23 @@ CHalfLifeMultiplay::CHalfLifeMultiplay() SERVER_COMMAND( szCommand ); } } + + // BMOD Config files + char bmodcfgfile[81]; + strcpy( bmodcfgfile, CVAR_GET_STRING( "bm_map" ) ); + strcat( bmodcfgfile, ".cfg" ); + + if( bmodcfgfile && bmodcfgfile[0] ) + { + char szCommand[256]; + + ALERT( at_console, "Executing map config file\n" ); + sprintf( szCommand, "exec maps/%s\n", bmodcfgfile ); + SERVER_COMMAND( szCommand ); + } + + // BMOD Init save slots. + UTIL_SaveRestorePlayer( NULL, 0, 1 ); } BOOL CHalfLifeMultiplay::ClientCommand( CBasePlayer *pPlayer, const char *pcmd ) @@ -203,6 +229,9 @@ void CHalfLifeMultiplay::Think( void ) int frags_remaining = 0; int time_remaining = 0; + // BMOD Edit - Extra Game Think stuff + BMOD_Think(); + if( g_fGameOver ) // someone else quit the game already { // bounds check @@ -311,6 +340,13 @@ BOOL CHalfLifeMultiplay::FShouldSwitchWeapon( CBasePlayer *pPlayer, CBasePlayerI return FALSE; } + // BMOD - if this player is typing, dont switch weapons + if( pPlayer->BMOD_IsTyping() ) + { + return FALSE; + } + // BMOD + if( !pPlayer->m_pActiveItem ) { // player doesn't have an active item! @@ -478,6 +514,10 @@ void CHalfLifeMultiplay::InitHUD( CBasePlayer *pl ) MESSAGE_BEGIN( MSG_ONE, SVC_INTERMISSION, NULL, pl->edict() ); MESSAGE_END(); } + + // BMOD Begin - extra gamerules InitHUD + BMOD_InitHUD( pl ); + // BMOD End - extra gamerules InitHUD } //========================================================= @@ -511,6 +551,10 @@ void CHalfLifeMultiplay::ClientDisconnected( edict_t *pClient ) } pPlayer->RemoveAllItems( TRUE );// destroy all of the players weapons and items + + // BMOD Begin - extra client disconnect + BMOD_ClientDisconnected( pClient, pPlayer ); + // BMOD End - extra client disconnect } } } @@ -540,6 +584,10 @@ float CHalfLifeMultiplay::FlPlayerFallDamage( CBasePlayer *pPlayer ) //========================================================= BOOL CHalfLifeMultiplay::FPlayerCanTakeDamage( CBasePlayer *pPlayer, CBaseEntity *pAttacker ) { + // BMOD Edit - Freeze ray + if( pPlayer->m_flFreezeTime > 0 ) + return FALSE; + return TRUE; } @@ -569,9 +617,13 @@ void CHalfLifeMultiplay::PlayerSpawn( CBasePlayer *pPlayer ) pPlayer->pev->weapons |= ( 1 << WEAPON_SUIT ); - addDefault = TRUE; + // BMOD Begin - extra Playerspawn stuff + BMOD_PlayerSpawn( pPlayer ); + // BMOD End - extra Playerspawn stuff - while( ( pWeaponEntity = UTIL_FindEntityByClassname( pWeaponEntity, "game_player_equip" ) ) ) + addDefault = pPlayer->IsObserver() ? FALSE : TRUE; + + while( !addDefault && ( pWeaponEntity = UTIL_FindEntityByClassname( pWeaponEntity, "game_player_equip" ) ) ) { pWeaponEntity->Touch( pPlayer ); addDefault = FALSE; @@ -579,10 +631,27 @@ void CHalfLifeMultiplay::PlayerSpawn( CBasePlayer *pPlayer ) if( addDefault ) { - pPlayer->GiveNamedItem( "weapon_crowbar" ); + /*pPlayer->GiveNamedItem( "weapon_crowbar" ); pPlayer->GiveNamedItem( "weapon_9mmhandgun" ); pPlayer->GiveAmmo( 68, "9mm", _9MM_MAX_CARRY );// 4 full reloads - } + */ + // BMOD Begin - Starting weapons + //pPlayer->GiveNamedItem( "weapon_crowbar" ); + //pPlayer->GiveNamedItem( "weapon_9mmhandgun" ); + //pPlayer->GiveAmmo( GLOCK_MAX_CLIP * 2, "9mm", _9MM_MAX_CARRY );// 2 full reloads + //pPlayer->GiveNamedItem( "weapon_357" ); + // pPlayer->GiveNamedItem( "weapon_rpg" ); + //pPlayer->GiveAmmo( PYTHON_MAX_CLIP * 2, "357", _357_MAX_CARRY );// 2 full reloads + // BMOD End - Starting weapons + BMOD_GiveGunsAndAmmo( pPlayer ); + //pPlayer->SelectItem( "weapon_9mmhandgun" ); + } + + // BMOD Edit - spawn kills + pPlayer->m_fSpawnTimeStamp = gpGlobals->time + .1; + pPlayer->pev->rendermode = kRenderTransAdd; + pPlayer->pev->renderfx = kRenderFxHologram; + pPlayer->pev->renderamt = 255; } //========================================================= @@ -646,6 +715,30 @@ void CHalfLifeMultiplay::PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, pKiller->frags -= 1; } + // BMOD Begin - Llamas do not count! + if( peKiller && peKiller != pVictim && pVictim->m_IsLlama ) + { + pVictim->m_iDeaths -= 1; + pKiller->frags -= IPointsForKill( peKiller, pVictim ); + } + // BMOD End - Llamas do not count! + + // BMOD Begin - spawn kills do not count! + if( peKiller && peKiller != pVictim && pVictim->BMOD_WasSpawnKilled() ) + { + pVictim->m_iDeaths -= 1; + pKiller->frags -= IPointsForKill( peKiller, pVictim ); + } + // BMOD End - spawn kills do not count! + + // BMOD Begin - type kills do not count! + if( peKiller && peKiller != pVictim && pVictim->BMOD_WasTypeKilled() ) + { + pVictim->m_iDeaths -= 1; + pKiller->frags -= IPointsForKill( peKiller, pVictim ); + } + // BMOD End - type kills do not count! + // update the scores // killed scores MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo ); @@ -690,11 +783,48 @@ void CHalfLifeMultiplay::DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller, CBaseEntity *Killer = CBaseEntity::Instance( pKiller ); const char *killer_weapon_name = "world"; // by default, the player is killed by the world + const char *killer_weapon_name_client = "world"; // by default, the player is killed by the world int killer_index = 0; // Hack to fix name change char *tau = "tau_cannon"; char *gluon = "gluon gun"; + char *grenade = "grenade"; + char *zapgun = "zapgun"; + char *multizapper = "multizapper"; + char *squidspit = "squidspit"; + char *freezeray = "freezeray"; + char *snarklauncher = "snarklauncher"; + + char keyvalues[81] = ""; + + switch( pVictim->m_LastHitGroup ) + { + case HITGROUP_HEAD: + strcat( keyvalues, " (location \"head\")" ); + break; + case HITGROUP_CHEST: + strcat( keyvalues, " (location \"chest\")" ); + break; + case HITGROUP_STOMACH: + strcat( keyvalues, " (location \"stomach\")" ); + break; + case HITGROUP_LEFTARM: + strcat( keyvalues, " (location \"left arm\")" ); + break; + case HITGROUP_RIGHTARM: + strcat( keyvalues, " (location \"right arm\")" ); + break; + case HITGROUP_LEFTLEG: + strcat( keyvalues, " (location \"left leg\")" ); + break; + case HITGROUP_RIGHTLEG: + strcat( keyvalues, " (location \"right leg\")" ); + break; + default: + strcat( keyvalues, " (location \"generic\")" ); + break; + }; if( pKiller->flags & FL_CLIENT ) { @@ -731,10 +861,43 @@ void CHalfLifeMultiplay::DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller, else if( strncmp( killer_weapon_name, "func_", 5 ) == 0 ) killer_weapon_name += 5; + if( !strcmp( killer_weapon_name, "hornetgun" ) && bm_hornet_mod.value ) + { + //CHgun* gun = (CHgun*)CBaseEntity::Instance( pKiller ); + //UTIL_ClientPrintAll( HUD_PRINTTALK, UTIL_VarArgs( " Firemode: %i.\n", + // gun->m_iFireMode + // ) ); + switch( ( ( (CHgun*)( (CBasePlayerWeapon*)( (CBasePlayer*)CBaseEntity::Instance( pKiller ) )->m_pActiveItem ) )->m_iFireMode ) ) + { + case 0: + killer_weapon_name = squidspit; + break; + case 1: + killer_weapon_name = zapgun; + break; + case 2: + killer_weapon_name = multizapper; + break; + case 3: + killer_weapon_name = freezeray; + break; + case 4: + killer_weapon_name = snarklauncher; + break; + default: + break; + } + } + + killer_weapon_name_client = killer_weapon_name; + + if( !strcmp( killer_weapon_name_client, "hand_grenade" ) ) + killer_weapon_name_client = grenade; + MESSAGE_BEGIN( MSG_ALL, gmsgDeathMsg ); WRITE_BYTE( killer_index ); // the killer WRITE_BYTE( ENTINDEX( pVictim->edict() ) ); // the victim - WRITE_STRING( killer_weapon_name ); // what they were killed by (should this be a string?) + WRITE_STRING( killer_weapon_name_client ); // what they were killed by (should this be a string?) MESSAGE_END(); // replace the code names with the 'real' names @@ -769,10 +932,212 @@ void CHalfLifeMultiplay::DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller, } else if( pKiller->flags & FL_CLIENT ) { + ( (CBasePlayer *)Killer )->m_iKillsThisFrame++; + + // BMOD Begin - Spawn kills + if( pVictim->BMOD_WasSpawnKilled() && strcmp( killer_weapon_name, "tripmine" ) ) + { + strcat( keyvalues, " (spawn)" ); + ( (CBasePlayer *)Killer )->m_iKillsThisFrame--; + ( (CBasePlayer *)Killer )->m_iSpawnKills++; + char szKills[81] = ""; + int iLeft = (int)bm_maxspawnkills.value - (int)( (CBasePlayer *)Killer )->m_iSpawnKills; + + if( bm_maxspawnkills.value ) + { + if( iLeft > 0 ) + { + sprintf( szKills, "(%d more and you're banned)", iLeft ); + } + + } + UTIL_ClientPrintAll( HUD_PRINTTALK, UTIL_VarArgs( "%s is a spawn-killing ninny! No points! %s\n", STRING( pKiller->netname ), szKills ) ); + + if( bm_maxspawnkills.value && iLeft < 1 ) + { + UTIL_ClientPrintAll( HUD_PRINTTALK, UTIL_VarArgs( " %s was banned %d minutes for spawn-killing.\n", + STRING( pKiller->netname ), (int)bm_bantime.value ) ); + UTIL_LogPrintf( "\"SERVER<-1><-1><>\" say \"%s was banned %d minutes for spawn-killing.\"\n", + STRING( pKiller->netname ), (int)bm_bantime.value); + UTIL_LogPrintf( "// \"%s<%i><%s><%s>\" was banned %d mins for spawn-killing.\n", + STRING( pKiller->netname ), + GETPLAYERUSERID( ENT( pKiller ) ), + GETPLAYERAUTHID( ENT( pKiller ) ), + g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( ENT( pKiller ) ), "model" ), + (int)bm_bantime.value ); + ( (CBasePlayer *)Killer )->m_bBanMe = TRUE; + ( (CBasePlayer *)Killer )->m_fMessageTimer = gpGlobals->time + .1; + } + } + // BMOD End - Spawn kills + + // BMOD Begin - Type kills + if( pVictim->BMOD_WasTypeKilled() ) + { + strcat( keyvalues, " (typekill)" ); + ( (CBasePlayer *)Killer )->m_iKillsThisFrame--; + ( (CBasePlayer *)Killer )->m_iTypeKills++; + char szKills[81] = ""; + int iLeft = (int)bm_maxtypekills.value - (int)( (CBasePlayer *)Killer )->m_iTypeKills; + + if( bm_maxtypekills.value ) + { + if( iLeft > 0 ) + { + sprintf( szKills, "(%d more and you're banned)", iLeft ); + } + } + + UTIL_ClientPrintAll( HUD_PRINTTALK, UTIL_VarArgs( "%s is a type-killing lamer! No points! %s\n", + STRING( pKiller->netname ), szKills ) ); + + if( bm_maxtypekills.value && iLeft < 1 ) + { + UTIL_ClientPrintAll( HUD_PRINTTALK, UTIL_VarArgs( " %s was banned %d minutes for type-killing.\n", + STRING( pKiller->netname ), (int)bm_bantime.value ) ); + UTIL_LogPrintf( "\"SERVER<-1><-1><>\" say \"%s was banned %d minutes for type-killing.\"\n", + STRING( pKiller->netname ), (int)bm_bantime.value ); + UTIL_LogPrintf( "// \"%s<%i><%s><%s>\" was banned %d mins for type-killing.\n", + STRING( pKiller->netname ), + GETPLAYERUSERID( ENT( pKiller ) ), + GETPLAYERAUTHID( ENT( pKiller ) ), + g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( ENT( pKiller ) ), "model" ), + (int)bm_bantime.value ); + ( (CBasePlayer *)Killer )->m_bBanMe = TRUE; + ( (CBasePlayer *)Killer )->m_fMessageTimer = gpGlobals->time + .1; + } + } + // BMOD End - Type kills + + // BMOD Start - match kills. + // tag kills where killer matched weapons with victim. + if( bm_matchkills.value && strcmp( killer_weapon_name, "tripmine" ) && strcmp( killer_weapon_name, "snark" ) && + ( pVictim->m_pActiveItem && + ( (CBasePlayer *)Killer )->m_pActiveItem && + !strcmp( STRING( ( (CBasePlayer *)Killer )->m_pActiveItem->pev->classname ), + STRING( pVictim->m_pActiveItem->pev->classname ) ) && + ( (CBasePlayer *)Killer )->m_RuneFlags == RUNE_NONE ) + || // OR... + ( !strcmp( killer_weapon_name, "flying_crowbar" ) && + ( !pVictim->m_pActiveItem || + !strcmp( STRING( pVictim->m_pActiveItem->pev->classname ), + "weapon_crowbar" ) ) ) + || // OR... + ( !pVictim->m_pActiveItem && + ( (CBasePlayer *)Killer )->m_pActiveItem && + !strcmp( STRING( ( (CBasePlayer *)Killer )->m_pActiveItem->pev->classname ), + "weapon_crowbar" ) ) ) + { + strcat(keyvalues, " (match)" ); + ClientPrint( ( (CBasePlayer *)Killer )->pev, HUD_PRINTNOTIFY, "Match kill!\n" ); + } + // BMOD End - match kills. + + // BMOD Start - log opponent gun + // tag kills where killer matched weapons with victim. + if( !pVictim->m_pActiveItem ) + { + strcat( keyvalues, " (defgun \"flying_crowbar\")" ); + } + else + { + const char *weapon_name; + weapon_name = STRING( pVictim->m_pActiveItem->pev->classname ); + + // Hack to fix name change + char *tau = "tau_cannon"; + char *gluon = "gluon gun"; + char *zapgun = "zapgun"; + char *multizapper = "multizapper"; + char *squidspit = "squidspit"; + char *freezeray = "freezeray"; + char *snarklauncher = "snarklauncher"; + char *rpg = "rpg_rocket"; + char *hand_grenade = "hand_grenade"; + + // strip the monster_* or weapon_* from the classname + if( strncmp( weapon_name, "weapon_", 7 ) == 0 ) + weapon_name += 7; + else if( strncmp( weapon_name, "monster_", 8 ) == 0 ) + weapon_name += 8; + else if( strncmp( weapon_name, "func_", 5 ) == 0 ) + weapon_name += 5; + + // fix some names for better matches. + if( !strcmp( weapon_name, "egon" ) ) + weapon_name = gluon; + else if( !strcmp( weapon_name, "gauss" ) ) + weapon_name = tau; + else if( !strcmp( weapon_name, "rpg" ) ) + weapon_name = rpg; + else if( !strcmp( weapon_name, "handgrenade" ) ) + weapon_name = hand_grenade; + else if( !strcmp( weapon_name, "hornetgun" ) && bm_hornet_mod.value ) + { + //weapon_name = zapgun; + switch( ( ( (CHgun*)( (CBasePlayerWeapon*)pVictim->m_pActiveItem ) )->m_iFireMode ) ) + { + case 0: + weapon_name = squidspit; + break; + case 1: + weapon_name = zapgun; + break; + case 2: + weapon_name = multizapper; + break; + case 3: + weapon_name = freezeray; + break; + case 4: + weapon_name = snarklauncher; + break; + default: + break; + } + } + + strcat( keyvalues, UTIL_VarArgs( " (defgun \"%s\")", weapon_name ) ); + } + // BMOD End - log opponent gun + + // BMOD Start - Log runes + if( ( (CBasePlayer *)Killer )->m_RuneFlags ) + { + strcat( keyvalues, " (rune \"" ); + switch( ( (CBasePlayer *)Killer )->m_RuneFlags ) + { + case RUNE_CROWBAR: + strcat( keyvalues, "crowbar" ); + break; + case RUNE_HEALTH: + strcat( keyvalues, "health" ); + break; + case RUNE_BATTERY: + strcat( keyvalues, "armor" ); + break; + case RUNE_357: + strcat( keyvalues, "357" ); + break; + case RUNE_SHOTGUN: + strcat( keyvalues, "shotgun" ); + break; + case RUNE_GRENADE: + strcat( keyvalues, "grenade" ); + break; + } + strcat( keyvalues, "\")" ); + } + // BMOD End - Log runes + + // BMOD Llamas don't count. + if( pVictim->m_IsLlama ) + return; + // team match? if( g_teamplay ) { - UTIL_LogPrintf( "\"%s<%i><%s><%s>\" killed \"%s<%i><%s><%s>\" with \"%s\"\n", + UTIL_LogPrintf( "\"%s<%i><%s><%s>\" killed \"%s<%i><%s><%s>\" with \"%s\"%s\n", STRING( pKiller->netname ), GETPLAYERUSERID( ENT(pKiller) ), GETPLAYERAUTHID( ENT(pKiller) ), @@ -781,11 +1146,11 @@ void CHalfLifeMultiplay::DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller, GETPLAYERUSERID( pVictim->edict() ), GETPLAYERAUTHID( pVictim->edict() ), g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( pVictim->edict() ), "model" ), - killer_weapon_name ); + killer_weapon_name, keyvalues ); } else { - UTIL_LogPrintf( "\"%s<%i><%s><%i>\" killed \"%s<%i><%s><%i>\" with \"%s\"\n", + UTIL_LogPrintf( "\"%s<%i><%s><%i>\" killed \"%s<%i><%s><%i>\" with \"%s\"%s\n", STRING( pKiller->netname ), GETPLAYERUSERID( ENT(pKiller) ), GETPLAYERAUTHID( ENT(pKiller) ), @@ -794,13 +1159,12 @@ void CHalfLifeMultiplay::DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller, GETPLAYERUSERID( pVictim->edict() ), GETPLAYERAUTHID( pVictim->edict() ), GETPLAYERUSERID( pVictim->edict() ), - killer_weapon_name ); + killer_weapon_name, keyvalues ); } } else { // killed by the world - // team match? if( g_teamplay ) { @@ -1449,7 +1813,9 @@ int CountPlayers( void ) { CBaseEntity *pEnt = UTIL_PlayerByIndex( i ); - if( pEnt ) + // BMOD Edit - Only count connected players. + //if( pEnt ) + if( pEnt && ( !FNullEnt( pEnt->edict() ) ) && pEnt->m_bIsConnected ) { num = num + 1; } @@ -1520,6 +1886,7 @@ ChangeLevel Server is changing to a new level, check mapcycle.txt for map name and setup info ============== */ +/* void CHalfLifeMultiplay::ChangeLevel( void ) { static char szPreviousMapCycleFile[256]; @@ -1646,7 +2013,7 @@ void CHalfLifeMultiplay::ChangeLevel( void ) SERVER_COMMAND( szCommands ); } } - +*/ #define MAX_MOTD_CHUNK 60 #define MAX_MOTD_LENGTH 1536 // (MAX_MOTD_CHUNK * 4) diff --git a/dlls/player.cpp b/dlls/player.cpp index 2f097072..ce3a11b4 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -34,6 +34,7 @@ #include "decals.h" #include "gamerules.h" #include "game.h" +#include "BMOD_rune.h" #include "hltv.h" // #define DUCKFIX @@ -43,7 +44,9 @@ extern DLL_GLOBAL BOOL g_fGameOver; extern DLL_GLOBAL BOOL g_fDrawLines; int gEvilImpulse101; extern DLL_GLOBAL int g_iSkillLevel, gDisplayTitle; +extern DLL_GLOBAL BOOL g_runes_exist; +extern cvar_t bm_dmg_messages; BOOL gInitHUD = TRUE; extern void CopyToBodyQue( entvars_t *pev); @@ -183,6 +186,7 @@ int gmsgTeamNames = 0; int gmsgStatusText = 0; int gmsgStatusValue = 0; +int gmsgSpectator = 0; void LinkUserMessages( void ) { @@ -225,6 +229,7 @@ void LinkUserMessages( void ) gmsgFade = REG_USER_MSG( "ScreenFade", sizeof(ScreenFade) ); gmsgAmmoX = REG_USER_MSG( "AmmoX", 2 ); gmsgTeamNames = REG_USER_MSG( "TeamNames", -1 ); + gmsgSpectator = REG_USER_MSG( "Spectator", 2 ); gmsgStatusText = REG_USER_MSG( "StatusText", -1 ); gmsgStatusValue = REG_USER_MSG( "StatusValue", 3 ); @@ -456,6 +461,9 @@ int CBasePlayer::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, fl return 0; } + float flArmor = 0; + float flArmorDone = 0; + // keep track of amount of damage last sustained m_lastDamageAmount = flDamage; @@ -464,8 +472,6 @@ int CBasePlayer::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, fl { float flNew = flDamage * flRatio; - float flArmor; - flArmor = ( flDamage - flNew ) * flBonus; // Does this use more armor than we have? @@ -474,14 +480,45 @@ int CBasePlayer::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, fl flArmor = pev->armorvalue; flArmor *= ( 1 / flBonus ); flNew = flDamage - flArmor; + flArmorDone = pev->armorvalue; pev->armorvalue = 0; } else + { pev->armorvalue -= flArmor; - + flArmorDone = pev->armorvalue; + } flDamage = flNew; } + char AttackerText[128]; + char DefenderText[128]; + char HitGroup[128] = ""; + + if( m_LastHitGroup == HITGROUP_HEAD ) + strcpy( HitGroup, "HEADSHOT!" ); + + if( bm_dmg_messages.value > 0 ) + { + if( pAttacker == this ) + { + sprintf( DefenderText, "Did %i/%i damage to yourself. %s\n", (int)flDamage, (int)flArmorDone, HitGroup ); + ClientPrint( pev, HUD_PRINTNOTIFY, DefenderText ); + } + else if( pAttacker->IsPlayer() ) + { + sprintf( DefenderText, "Took %i/%i damage from %s. %s\n", (int)flDamage, (int)flArmorDone, STRING( pAttacker->pev->netname ), HitGroup ); + sprintf( AttackerText, "Did %i/%i damage to %s. %s\n", (int)flDamage, (int)flArmorDone, STRING( pev->netname ), HitGroup ); + ClientPrint( pev, HUD_PRINTNOTIFY, DefenderText ); + ClientPrint( pAttacker->pev, HUD_PRINTNOTIFY, AttackerText ); + } + else + { + sprintf( DefenderText, "Took %i/%i damage.\n", (int)flDamage, (int)flArmorDone ); + ClientPrint( pev, HUD_PRINTNOTIFY, DefenderText ); + } + } + // this cast to INT is critical!!! If a player ends up with 0.5 health, the engine will get that // as an int (zero) and think the player is dead! (this will incite a clientside screentilt, etc) fTookDamage = CBaseMonster::TakeDamage( pevInflictor, pevAttacker, (int)flDamage, bitsDamageType ); @@ -671,7 +708,7 @@ void CBasePlayer::PackDeadPlayerItems( void ) iWeaponRules = g_pGameRules->DeadPlayerWeapons( this ); iAmmoRules = g_pGameRules->DeadPlayerAmmo( this ); - if( iWeaponRules == GR_PLR_DROP_GUN_NO && iAmmoRules == GR_PLR_DROP_AMMO_NO ) + if( ( iWeaponRules == GR_PLR_DROP_GUN_NO && iAmmoRules == GR_PLR_DROP_AMMO_NO ) || BMOD_WasTypeKilled() ) { // nothing to pack. Remove the weapons and return. Don't call create on the box! RemoveAllItems( TRUE ); @@ -897,6 +934,34 @@ void CBasePlayer::Killed( entvars_t *pevAttacker, int iGib ) pev->solid = SOLID_NOT; GibMonster(); // This clears pev->model pev->effects |= EF_NODRAW; + + if( ( RANDOM_LONG( 0, 100 ) < 15 ) || ( m_LastHitGroup == HITGROUP_HEAD ) ) + { + switch( RANDOM_LONG( 0, 6 ) ) + { + case 0: + UTIL_SpeakAll( "buzwarn buzwarn, cleanup in sector alpha" ); + break; + case 1: + UTIL_SpeakAll( "buzwarn buzwarn, cleanup in sector zulu" ); + break; + case 2: + UTIL_SpeakAll( "buzwarn buzwarn, cleanup in sector delta" ); + break; + case 3: + UTIL_SpeakAll( "buzwarn buzwarn, cleanup in sector thirteen" ); + break; + case 4: + UTIL_SpeakAll( "buzwarn buzwarn, cleanup in sector b" ); + break; + case 5: + UTIL_SpeakAll( "buzwarn buzwarn, cleanup in sector c" ); + break; + case 6: + UTIL_SpeakAll( "buzwarn buzwarn, cleanup in sector d" ); + break; + } + } return; } @@ -1231,6 +1296,18 @@ void CBasePlayer::PlayerDeathThink( void ) { float flForward; + // BMOD Begin - Freeze Ray + if( m_flFreezeTime > 0 ) + { + EnableControl( TRUE ); + pev->rendermode = kRenderNormal; + pev->renderfx = kRenderFxNone; + pev->renderamt = 0; + + m_flFreezeTime = 0; + } + // BMOD End - Freeze Ray + if( FBitSet( pev->flags, FL_ONGROUND ) ) { flForward = pev->velocity.Length() - 20; @@ -1264,8 +1341,16 @@ void CBasePlayer::PlayerDeathThink( void ) pev->movetype = MOVETYPE_NONE; if( pev->deadflag == DEAD_DYING ) + { pev->deadflag = DEAD_DEAD; + // Fix for spinning corpses. + StopAnimation(); + pev->effects |= EF_NOINTERP; + pev->framerate = 0.0; + CopyToBodyQue( pev ); + pev->effects |= EF_NODRAW; + } StopAnimation(); pev->effects |= EF_NOINTERP; @@ -1344,20 +1429,22 @@ void CBasePlayer::StartDeathCam( void ) iRand--; } - CopyToBodyQue( pev ); + //CopyToBodyQue( pev ); StartObserver( pSpot->v.origin, pSpot->v.v_angle ); } else { // no intermission spot. Push them up in the air, looking down at their corpse TraceResult tr; - CopyToBodyQue( pev ); + //CopyToBodyQue( pev ); UTIL_TraceLine( pev->origin, pev->origin + Vector( 0, 0, 128 ), ignore_monsters, edict(), &tr ); StartObserver( tr.vecEndPos, UTIL_VecToAngles( tr.vecEndPos - pev->origin ) ); return; } } +// Replaced by BMOD Observer code +/* void CBasePlayer::StartObserver( Vector vecPosition, Vector vecViewAngle ) { m_afPhysicsFlags |= PFLAG_OBSERVER; @@ -1371,7 +1458,7 @@ void CBasePlayer::StartObserver( Vector vecPosition, Vector vecViewAngle ) pev->modelindex = 0; UTIL_SetOrigin( pev, vecPosition ); } - +*/ // // PlayerUse - handles USE keypress // @@ -1745,6 +1832,19 @@ void CBasePlayer::PreThink( void ) CheckTimeBasedDamage(); + m_iMessageFire = FALSE; + BMOD_Think(); + + // BMOD Begin - Extra Player Prethink + BMOD_Identify(); + if( IsObserver() ) + { + Observer_HandleButtons(); + return; + } + BMOD_PreThink(); + // BMOD End - Extra Player Prethink + CheckSuitUpdate(); if( pev->deadflag >= DEAD_DYING ) @@ -2563,6 +2663,8 @@ pt_end: #else return; #endif + // BMOD + BMOD_PostThink(); } // checks if the spot is clear of players @@ -2775,6 +2877,60 @@ void CBasePlayer::Spawn( void ) m_flNextChatTime = gpGlobals->time; + // BMOD Begin - Extra Player Spawn + m_hObserverTarget = NULL; + m_flFreezeTime = 0; + m_RuneFlags = RUNE_NONE; + pev->rendermode = kRenderNormal; + pev->renderfx = kRenderFxNone; + pev->renderamt = 0; + //m_LocateMode = FALSE; + //m_LeetSpeak = FALSE; + + // Spawn Runes + if (!g_runes_exist) + { + g_runes_exist = true; + + CBaseEntity *pSpot = NULL; + do + pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_deathmatch" ); + while( !pSpot ); + + // Spawn random runes + for( int i = 0; i < CVAR_GET_FLOAT( "bm_rune_rand" ); i++ ) + { + CRune *rune = (CRune *)CBaseEntity::Create( "item_CrowbarRune", pSpot->pev->origin, Vector( 0, 0, 0 ), edict() ); + rune->m_randomize = TRUE; + rune->Respawn(); + } + + // Spawn crowbar runes + for( i = 0; i < CVAR_GET_FLOAT( "bm_rune_cbar" ); i++ ) + CBaseEntity::Create( "item_CrowbarRune", pSpot->pev->origin, Vector( 0, 0, 0 ), edict() ); + + // Spawn grenade runes + for( i = 0; i < CVAR_GET_FLOAT( "bm_rune_gren" ); i++ ) + CBaseEntity::Create( "item_GrenadeRune", pSpot->pev->origin, Vector( 0, 0, 0 ), edict() ); + + // Spawn 357 runes + for( i = 0; i < CVAR_GET_FLOAT( "bm_rune_357" ); i++ ) + CBaseEntity::Create( "item_357Rune", pSpot->pev->origin, Vector( 0, 0, 0 ), edict() ); + + // Spawn health runes + for( i = 0; i < CVAR_GET_FLOAT( "bm_rune_health" ); i++ ) + CBaseEntity::Create( "item_HealthRune", pSpot->pev->origin, Vector( 0, 0, 0 ), edict() ); + + // Spawn armor runes + for( i = 0; i < CVAR_GET_FLOAT( "bm_rune_armor" ); i++ ) + CBaseEntity::Create( "item_BatteryRune", pSpot->pev->origin, Vector( 0, 0, 0 ), edict() ); + + // Spawn shotgun runes + for( i = 0; i < CVAR_GET_FLOAT( "bm_rune_shotty" ); i++ ) + CBaseEntity::Create( "item_ShotgunRune", pSpot->pev->origin, Vector( 0, 0, 0 ), edict() ); + } + // BMOD End - Extra Player Spawn + g_pGameRules->PlayerSpawn( this ); } diff --git a/dlls/player.h b/dlls/player.h index e75787ee..e4e5f527 100644 --- a/dlls/player.h +++ b/dlls/player.h @@ -15,6 +15,8 @@ #ifndef PLAYER_H #define PLAYER_H +#include "BMOD_player.h" + #include "pm_materials.h" #define PLAYER_FATAL_FALL_SPEED 1024// approx 60 feet @@ -308,6 +310,56 @@ public: char m_SbarString1[ SBAR_STRING_SIZE ]; float m_flNextChatTime; + + // BMOD Begin - extra player functions + void StopObserver( void ); + void Observer_FindNextPlayer( bool bReverse ); + void Observer_HandleButtons(); + void Observer_SetMode( int iMode ); + int IsObserver() { return pev->iuser1; }; + void BMOD_PreThink(void); + void BMOD_Think(void); + void BMOD_PostThink(void); + void BMOD_Identify( void ); + int BMOD_WasSpawnKilled( void ); + int BMOD_IsASpawn( void ); + void BMOD_ResetSpawnKill( void ); + int m_iSpawnKills; + + float m_fMessageTimer; + BOOL m_iMessageFire; + int m_iMessageCounter; + + EHANDLE m_hObserverTarget; + BOOL m_iFirstSpawn; + BOOL m_bIsConnected; + float m_fMsgTimer; + BOOL m_bSentMsg; + float m_fSpawnTimeStamp; + Vector m_vFreezeAngle; + float m_flFreezeTime; + + float m_flTypeKillStamp; + BOOL m_bTypeMode; + void BMOD_ResetTypeKill( void ); + int BMOD_WasTypeKilled( void ); + int BMOD_IsTyping( void ); + int m_iTypeKills; + BOOL m_bBanMe; + + int m_iKillsThisFrame; + int m_iSpamSay; + + BOOL m_LocateMode; + BOOL m_LeetSpeak; + BOOL m_IsLlama; + + char m_sMapVote[81]; + + int m_RuneFlags; // Holds which runes this player owns. + float m_RuneTime; // Time at which this rune wears off. + + // BMOD End - extra player functions }; #define AUTOAIM_2DEGREES 0.0348994967025 diff --git a/dlls/python.cpp b/dlls/python.cpp index 7bb71325..1364f522 100644 --- a/dlls/python.cpp +++ b/dlls/python.cpp @@ -192,7 +192,7 @@ void CPython::PrimaryAttack() Vector vecAiming = m_pPlayer->GetAutoaimVector( AUTOAIM_10DEGREES ); Vector vecDir; - vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, VECTOR_CONE_1DEGREES, 8192, BULLET_PLAYER_357, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); + vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, VECTOR_CONE_1DEGREES, 8192, BULLET_PLAYER_357, 1, 0, m_pPlayer->pev, m_pPlayer->random_seed ); int flags; #if defined( CLIENT_WEAPONS ) diff --git a/dlls/rpg.cpp b/dlls/rpg.cpp index 1fec5cf1..d973a6ed 100644 --- a/dlls/rpg.cpp +++ b/dlls/rpg.cpp @@ -23,6 +23,10 @@ #include "player.h" #include "gamerules.h" +// BMOD Edit - RPG mod +extern cvar_t bm_rpg_mod; +#include "BMOD_messaging.h" + enum rpg_e { RPG_IDLE = 0, @@ -143,7 +147,12 @@ void CRpgRocket::Spawn( void ) pev->nextthink = gpGlobals->time + 0.4; - pev->dmg = gSkillData.plrDmgRPG; + // BMOD Begin - RPG mod + if( bm_rpg_mod.value ) + pev->dmg = 100; + else + pev->dmg = gSkillData.plrDmgRPG;; + // BMOD End - RPG mod } //========================================================= @@ -394,6 +403,10 @@ int CRpg::AddToPlayer( CBasePlayer *pPlayer ) BOOL CRpg::Deploy() { + // BMOD Edit - RPG mod + if( bm_rpg_mod.value ) + PrintMessage( m_pPlayer, BMOD_CHAN_WEAPON, Vector( 20, 250, 20 ), Vector( 1, 4, 2 ), "\nRPG\nDamage is lowered." ); + if( m_iClip == 0 ) { return DefaultDeploy( "models/v_rpg.mdl", "models/p_rpg.mdl", RPG_DRAW_UL, "rpg" ); diff --git a/dlls/satchel.cpp b/dlls/satchel.cpp index 48ec5b9a..bfdb0444 100644 --- a/dlls/satchel.cpp +++ b/dlls/satchel.cpp @@ -40,6 +40,9 @@ enum satchel_radio_e SATCHEL_RADIO_HOLSTER }; +// BMOD Edit - spawn satchels +extern cvar_t bm_spawnsatchels; + class CSatchelCharge : public CGrenade { void Spawn( void ); @@ -49,6 +52,10 @@ class CSatchelCharge : public CGrenade void EXPORT SatchelSlide( CBaseEntity *pOther ); void EXPORT SatchelThink( void ); + // BMOD Begin - extra satchel charge stuff + BOOL IsSpawnSatchel( void ); + // BMOD End - extra satchel charge stuff + public: void Deactivate( void ); }; @@ -145,6 +152,21 @@ void CSatchelCharge::SatchelThink( void ) { pev->velocity.z -= 8; } + + // BMOD Begin - spawn satchels + if( !( bm_spawnsatchels.value ) && ( pev->flags & FL_ONGROUND ) && !( pev->velocity.Length() ) ) + { + SetThink( NULL ); + if( IsSpawnSatchel() ) + { + Use( UTIL_CastPlayer(pev->owner), UTIL_CastPlayer( pev->owner ), USE_ON, 0 ); + + UTIL_SpeakBadWeapon(); + + UTIL_ClientPrintAll( HUD_PRINTTALK, UTIL_VarArgs( "%s tried to place a spawn satchel!\n", STRING( VARS( pev->owner )->netname ) ) ); + } + } + // BMOD End - spawn satchels } void CSatchelCharge::Precache( void ) @@ -478,4 +500,32 @@ void DeactivateSatchels( CBasePlayer *pOwner ) pFind = FIND_ENTITY_BY_CLASSNAME( pFind, "monster_satchel" ); } } + +BOOL CSatchelCharge::IsSpawnSatchel() +{ + if( bm_spawnsatchels.value ) + return FALSE; + + BOOL result = FALSE; + CBaseEntity *pEntity = NULL; + TraceResult tr; + Vector vecTop; + Vector vecSrc = pev->origin; + + int bInWater = ( UTIL_PointContents( vecSrc ) == CONTENTS_WATER ); + + vecSrc.z += 1;// in case grenade is lying on the ground + + // iterate on all entities in the vicinity. + while( ( pEntity = UTIL_FindEntityByClassname( pEntity, "info_player_deathmatch" ) ) != NULL ) + { + UTIL_TraceLine( pEntity->pev->origin, pEntity->pev->origin - Vector( 0, 0, 1024 ), ignore_monsters, ENT( pev ), &tr ); + Vector vecTop = pEntity->pev->origin + Vector( 0, 0, 36 ); + float height = fabs( vecTop.z - tr.vecEndPos.z ) / 2; + + if( UTIL_OBB_PointTest( vecSrc, Vector( vecTop.x, vecTop.y, ( vecTop.z + tr.vecEndPos.z ) / 2 ), Vector( 16, 16, height ) ) ) + result = TRUE; + } + return result; +} #endif diff --git a/dlls/shotgun.cpp b/dlls/shotgun.cpp index 8c96e99c..419733ca 100644 --- a/dlls/shotgun.cpp +++ b/dlls/shotgun.cpp @@ -21,6 +21,9 @@ #include "nodes.h" #include "player.h" #include "gamerules.h" +#include "BMOD_messaging.h" + +extern cvar_t bm_shotty_mod; // special deathmatch shotgun spreads #define VECTOR_CONE_DM_SHOTGUN Vector( 0.08716, 0.04362, 0.00 )// 10 degrees by 5 degrees @@ -110,6 +113,9 @@ int CShotgun::GetItemInfo( ItemInfo *p ) BOOL CShotgun::Deploy() { + if( bm_shotty_mod.value == 1 ) + PrintMessage( m_pPlayer, BMOD_CHAN_WEAPON, Vector( 20, 250, 20), Vector( 1, 4, 2 ), "\nSHOTGUN\nFast fire rate / fast reload." ); + return DefaultDeploy( "models/v_shotgun.mdl", "models/p_shotgun.mdl", SHOTGUN_DRAW, "shotgun" ); } @@ -155,12 +161,12 @@ void CShotgun::PrimaryAttack() if( g_pGameRules->IsMultiplayer() ) #endif { - vecDir = m_pPlayer->FireBulletsPlayer( 4, vecSrc, vecAiming, VECTOR_CONE_DM_SHOTGUN, 2048, BULLET_PLAYER_BUCKSHOT, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); + vecDir = m_pPlayer->FireBulletsPlayer( 4, vecSrc, vecAiming, VECTOR_CONE_DM_SHOTGUN, 2048, BULLET_PLAYER_BUCKSHOT, 1, 0, m_pPlayer->pev, m_pPlayer->random_seed ); } else { // regular old, untouched spread. - vecDir = m_pPlayer->FireBulletsPlayer( 6, vecSrc, vecAiming, VECTOR_CONE_10DEGREES, 2048, BULLET_PLAYER_BUCKSHOT, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); + vecDir = m_pPlayer->FireBulletsPlayer( 6, vecSrc, vecAiming, VECTOR_CONE_10DEGREES, 2048, BULLET_PLAYER_BUCKSHOT, 1, 0, m_pPlayer->pev, m_pPlayer->random_seed ); } PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usSingleFire, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 ); @@ -174,6 +180,19 @@ void CShotgun::PrimaryAttack() m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.75; m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.75; + + if( bm_shotty_mod.value ) + { + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.6; + m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.6; + } + + if( m_pPlayer->m_RuneFlags == RUNE_SHOTGUN ) + { + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25; + m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.25; + } + if( m_iClip != 0 ) m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5.0; else @@ -226,12 +245,12 @@ void CShotgun::SecondaryAttack( void ) #endif { // tuned for deathmatch - vecDir = m_pPlayer->FireBulletsPlayer( 8, vecSrc, vecAiming, VECTOR_CONE_DM_DOUBLESHOTGUN, 2048, BULLET_PLAYER_BUCKSHOT, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); + vecDir = m_pPlayer->FireBulletsPlayer( 8, vecSrc, vecAiming, VECTOR_CONE_DM_DOUBLESHOTGUN, 2048, BULLET_PLAYER_BUCKSHOT, 1, 0, m_pPlayer->pev, m_pPlayer->random_seed ); } else { // untouched default single player - vecDir = m_pPlayer->FireBulletsPlayer( 12, vecSrc, vecAiming, VECTOR_CONE_10DEGREES, 2048, BULLET_PLAYER_BUCKSHOT, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); + vecDir = m_pPlayer->FireBulletsPlayer( 12, vecSrc, vecAiming, VECTOR_CONE_10DEGREES, 2048, BULLET_PLAYER_BUCKSHOT, 1, 0, m_pPlayer->pev, m_pPlayer->random_seed ); } PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usDoubleFire, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 ); @@ -245,6 +264,19 @@ void CShotgun::SecondaryAttack( void ) m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1.5; m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.5; + + if( bm_shotty_mod.value ) + { + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + .9; + m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + .9; + } + + if( m_pPlayer->m_RuneFlags == RUNE_SHOTGUN ) + { + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5; + m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5; + } + if( m_iClip != 0 ) m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 6.0; else @@ -293,8 +325,17 @@ void CShotgun::Reload( void ) else { // Add them to the clip - m_iClip += 1; - m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= 1; + if( m_pPlayer->m_RuneFlags == RUNE_SHOTGUN || bm_shotty_mod.value ) + { + int ammo = min( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType], SHOTGUN_MAX_CLIP - m_iClip ); + m_iClip += ammo; + m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= ammo; + } + else + { + m_iClip += 1; + m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= 1; + } m_fInSpecialReload = 1; } } diff --git a/dlls/squeakgrenade.cpp b/dlls/squeakgrenade.cpp index 22200b74..e9f33949 100644 --- a/dlls/squeakgrenade.cpp +++ b/dlls/squeakgrenade.cpp @@ -13,63 +13,10 @@ * ****/ #if !defined( OEM_BUILD ) && !defined( HLDEMO_BUILD ) - -#include "extdll.h" -#include "util.h" -#include "cbase.h" -#include "monsters.h" -#include "weapons.h" -#include "nodes.h" -#include "player.h" -#include "soundent.h" -#include "gamerules.h" - -enum w_squeak_e -{ - WSQUEAK_IDLE1 = 0, - WSQUEAK_FIDGET, - WSQUEAK_JUMP, - WSQUEAK_RUN -}; - -enum squeak_e -{ - SQUEAK_IDLE1 = 0, - SQUEAK_FIDGETFIT, - SQUEAK_FIDGETNIP, - SQUEAK_DOWN, - SQUEAK_UP, - SQUEAK_THROW -}; - #ifndef CLIENT_DLL -class CSqueakGrenade : public CGrenade -{ - void Spawn( void ); - void Precache( void ); - int Classify( void ); - void EXPORT SuperBounceTouch( CBaseEntity *pOther ); - void EXPORT HuntThink( void ); - int BloodColor( void ) { return BLOOD_COLOR_YELLOW; } - void Killed( entvars_t *pevAttacker, int iGib ); - void GibMonster( void ); - - virtual int Save( CSave &save ); - virtual int Restore( CRestore &restore ); - - static TYPEDESCRIPTION m_SaveData[]; - - static float m_flNextBounceSoundTime; - - // CBaseEntity *m_pTarget; - float m_flDie; - Vector m_vecTarget; - float m_flNextHunt; - float m_flNextHit; - Vector m_posPrev; - EHANDLE m_hOwner; - int m_iMyClass; -}; + +// BMOD Edit +#include "squeakgrenade.h" float CSqueakGrenade::m_flNextBounceSoundTime = 0; @@ -134,6 +81,8 @@ void CSqueakGrenade::Spawn( void ) pev->gravity = 0.5; pev->friction = 0.5; + m_bWasLaunched = FALSE; + pev->dmg = gSkillData.snarkDmgPop; m_flDie = gpGlobals->time + SQUEEK_DETONATE_DELAY; @@ -147,6 +96,29 @@ void CSqueakGrenade::Spawn( void ) pev->sequence = WSQUEAK_RUN; ResetSequenceInfo(); + + // +BubbleMod + char color[3]; + int alp = UTIL_axtoi(strncpy( color, bm_snarktrails.string + 6, 2 )); + if( alp ) + { + int red = UTIL_axtoi( strncpy( color, bm_snarktrails.string, 2 ) ); + int grn = UTIL_axtoi( strncpy( color, bm_snarktrails.string + 2, 2 ) ); + int blu = UTIL_axtoi( strncpy( color, bm_snarktrails.string + 4, 2 ) ); + + MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY ); + WRITE_BYTE( TE_BEAMFOLLOW ); + WRITE_SHORT( entindex() ); // entity + WRITE_SHORT( g_sModelIndexSmokeTrail ); // model + WRITE_BYTE( 40 ); // life + WRITE_BYTE( 5 ); // width + WRITE_BYTE( red ); // r, g, b + WRITE_BYTE( grn ); // r, g, b + WRITE_BYTE( blu ); // r, g, b + WRITE_BYTE( alp ); // brightness + MESSAGE_END(); // move PHS/PVS data sending into here (SEND_ALL, SEND_PVS, SEND_PHS) + } + // -BubbleMod } void CSqueakGrenade::Precache( void ) @@ -201,7 +173,7 @@ void CSqueakGrenade::HuntThink( void ) { // ALERT( at_console, "think\n" ); - if( !IsInWorld() ) + if( !IsInWorld() && !m_bWasLaunched ) { SetTouch( NULL ); UTIL_Remove( this ); @@ -221,7 +193,7 @@ void CSqueakGrenade::HuntThink( void ) } // float - if( pev->waterlevel != 0 ) + if( pev->waterlevel != 0 && !m_bWasLaunched ) { if( pev->movetype == MOVETYPE_BOUNCE ) { @@ -255,7 +227,18 @@ void CSqueakGrenade::HuntThink( void ) { // find target, bounce a bit towards it. Look( 512 ); - m_hEnemy = BestVisibleEnemy(); + m_hEnemy = BMOD_BestVisibleEnemy(); + } + + if( m_hEnemy!= NULL && m_hEnemy->IsPlayer() ) + { + CBasePlayer* pPlayer = (CBasePlayer*)( (CBaseEntity *)m_hEnemy ); + if( pPlayer->BMOD_IsTyping() ) + { + // find target, bounce a bit towards it. + Look( 512 ); + m_hEnemy = BMOD_BestVisibleEnemy(); + } } // squeek if it's about time blow up @@ -320,6 +303,14 @@ void CSqueakGrenade::SuperBounceTouch( CBaseEntity *pOther ) { float flpitch; + // BMOD - Snark Launcher + if( m_bWasLaunched ) + { + pev->velocity = pev->velocity.Normalize() * 200; + m_bWasLaunched = FALSE; + } + // BMOD - Snark Launcher + TraceResult tr = UTIL_GetGlobalTrace(); // don't hit the guy that launched this grenade @@ -433,6 +424,9 @@ void CSqueak::Precache( void ) PRECACHE_SOUND( "squeek/sqk_hunt3.wav" ); UTIL_PrecacheOther( "monster_snark" ); + // BMOD Edit - snark mod + UTIL_PrecacheOther( "monster_tripsnark" ); + m_usSnarkFire = PRECACHE_EVENT( 1, "events/snarkfire.sc" ); } @@ -465,6 +459,10 @@ BOOL CSqueak::Deploy() m_pPlayer->m_iWeaponVolume = QUIET_GUN_VOLUME; + // BMOD Edit - snark mod + if( bm_snarks_mod.value ) + PrintMessage( m_pPlayer, BMOD_CHAN_WEAPON, Vector( 20, 250, 20 ), Vector( 1, 4, 2 ), "\nSNARKS\nSECONDAY FIRE: Place a snark mine." ); + return DefaultDeploy( "models/v_squeak.mdl", "models/p_squeak.mdl", SQUEAK_UP, "squeak" ); } @@ -538,12 +536,12 @@ void CSqueak::PrimaryAttack() } } } - +/* void CSqueak::SecondaryAttack( void ) { } - +*/ void CSqueak::WeaponIdle( void ) { if( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() ) diff --git a/dlls/teamplay_gamerules.cpp b/dlls/teamplay_gamerules.cpp index 614bd7bb..70ab4b93 100644 --- a/dlls/teamplay_gamerules.cpp +++ b/dlls/teamplay_gamerules.cpp @@ -85,6 +85,9 @@ void CHalfLifeTeamplay::Think( void ) #ifndef NO_VOICEGAMEMGR g_VoiceGameMgr.Update(gpGlobals->frametime); #endif + // BMOD Edit - Extra Game Think stuff + BMOD_Think(); + if( g_fGameOver ) // someone else quit the game already { CHalfLifeMultiplay::Think(); @@ -211,19 +214,19 @@ const char *CHalfLifeTeamplay::SetDefaultPlayerTeam( CBasePlayer *pPlayer ) //========================================================= void CHalfLifeTeamplay::InitHUD( CBasePlayer *pPlayer ) { - int i; + //int i; SetDefaultPlayerTeam( pPlayer ); CHalfLifeMultiplay::InitHUD( pPlayer ); // Send down the team names - MESSAGE_BEGIN( MSG_ONE, gmsgTeamNames, NULL, pPlayer->edict() ); + /*MESSAGE_BEGIN( MSG_ONE, gmsgTeamNames, NULL, pPlayer->edict() ); WRITE_BYTE( num_teams ); for( i = 0; i < num_teams; i++ ) { WRITE_STRING( team_names[i] ); } - MESSAGE_END(); + MESSAGE_END();*/ RecountTeams(); @@ -245,7 +248,7 @@ void CHalfLifeTeamplay::InitHUD( CBasePlayer *pPlayer ) RecountTeams(); // update this player with all the other players team info // loop through all active players and send their team info to the new client - for( i = 1; i <= gpGlobals->maxClients; i++ ) + /*for( i = 1; i <= gpGlobals->maxClients; i++ ) { CBaseEntity *plr = UTIL_PlayerByIndex( i ); if( plr && IsValidTeam( plr->TeamID() ) ) @@ -255,7 +258,7 @@ void CHalfLifeTeamplay::InitHUD( CBasePlayer *pPlayer ) WRITE_STRING( plr->TeamID() ); MESSAGE_END(); } - } + }*/ } void CHalfLifeTeamplay::ChangePlayerTeam( CBasePlayer *pPlayer, const char *pTeamName, BOOL bKill, BOOL bGib ) @@ -293,7 +296,7 @@ void CHalfLifeTeamplay::ChangePlayerTeam( CBasePlayer *pPlayer, const char *pTea g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "team", pPlayer->m_szTeamName ); // notify everyone's HUD of the team change - MESSAGE_BEGIN( MSG_ALL, gmsgTeamInfo ); + /*MESSAGE_BEGIN( MSG_ALL, gmsgTeamInfo ); WRITE_BYTE( clientIndex ); WRITE_STRING( pPlayer->m_szTeamName ); MESSAGE_END(); @@ -304,7 +307,7 @@ void CHalfLifeTeamplay::ChangePlayerTeam( CBasePlayer *pPlayer, const char *pTea WRITE_SHORT( pPlayer->m_iDeaths ); WRITE_SHORT( 0 ); WRITE_SHORT( g_pGameRules->GetTeamIndex( pPlayer->m_szTeamName ) + 1 ); - MESSAGE_END(); + MESSAGE_END();*/ } //========================================================= @@ -609,17 +612,39 @@ void CHalfLifeTeamplay::RecountTeams( bool bResendInfo ) { team_scores[tm] += plr->pev->frags; } + } + } - if( bResendInfo ) //Someone's info changed, let's send the team info again. + if( bResendInfo ) //Someone's info changed, let's send the team info again. + { + MESSAGE_BEGIN( MSG_ALL, gmsgTeamNames ); + WRITE_BYTE( num_teams ); + for( i = 0; i < num_teams; i++ ) { - if( plr && IsValidTeam( plr->TeamID() ) ) - { - MESSAGE_BEGIN( MSG_ALL, gmsgTeamInfo, NULL ); - WRITE_BYTE( plr->entindex() ); - WRITE_STRING( plr->TeamID() ); - MESSAGE_END(); - } + WRITE_STRING( team_names[i] ); } - } + MESSAGE_END(); + + for( i = 1; i <= gpGlobals->maxClients; i++ ) + { + CBaseEntity *plr = UTIL_PlayerByIndex( i ); + CBasePlayer *pPlayer = (CBasePlayer*)plr; + + if ( plr && IsValidTeam( plr->TeamID() ) ) + { + MESSAGE_BEGIN( MSG_ALL, gmsgTeamInfo); + WRITE_BYTE( plr->entindex() ); + WRITE_STRING( plr->TeamID() ); + MESSAGE_END(); + + MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo ); + WRITE_BYTE( plr->entindex() ); + WRITE_SHORT( pPlayer->pev->frags ); + WRITE_SHORT( pPlayer->m_iDeaths ); + WRITE_SHORT( 0 ); + WRITE_SHORT( g_pGameRules->GetTeamIndex( pPlayer->m_szTeamName ) + 1 ); + MESSAGE_END(); + } + } } } diff --git a/dlls/triggers.cpp b/dlls/triggers.cpp index d7f9483c..76cb3ab3 100644 --- a/dlls/triggers.cpp +++ b/dlls/triggers.cpp @@ -27,6 +27,7 @@ #include "saverestore.h" #include "trains.h" // trigger_camera has train functionality #include "gamerules.h" +#include "BMOD_rune.h" #define SF_TRIGGER_PUSH_START_OFF 2//spawnflag that makes trigger_push spawn turned OFF #define SF_TRIGGER_HURT_TARGETONCE 1// Only fire hurt target once @@ -884,6 +885,11 @@ void CBaseTrigger::HurtTouch( CBaseEntity *pOther ) { float fldmg; + if( !strcmp( STRING( pOther->pev->classname ), "rune" ) ) + { + (CRune*)pOther->Respawn(); + } + if( !pOther->pev->takedamage ) return; diff --git a/dlls/tripmine.cpp b/dlls/tripmine.cpp index f04d906a..2d72cff5 100644 --- a/dlls/tripmine.cpp +++ b/dlls/tripmine.cpp @@ -22,9 +22,13 @@ #include "player.h" #include "effects.h" #include "gamerules.h" +#include "tripmine.h" +#include "BMOD_messaging.h" #define TRIPMINE_PRIMARY_VOLUME 450 +extern cvar_t bm_trip_mod; + enum tripmine_e { TRIPMINE_IDLE1 = 0, @@ -39,39 +43,6 @@ enum tripmine_e }; #ifndef CLIENT_DLL -class CTripmineGrenade : public CGrenade -{ - void Spawn( void ); - void Precache( void ); - - virtual int Save( CSave &save ); - virtual int Restore( CRestore &restore ); - - static TYPEDESCRIPTION m_SaveData[]; - - int TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ); - - void EXPORT WarningThink( void ); - void EXPORT PowerupThink( void ); - void EXPORT BeamBreakThink( void ); - void EXPORT DelayDeathThink( void ); - void Killed( entvars_t *pevAttacker, int iGib ); - - void MakeBeam( void ); - void KillBeam( void ); - - float m_flPowerUp; - Vector m_vecDir; - Vector m_vecEnd; - float m_flBeamLength; - - EHANDLE m_hOwner; - CBeam *m_pBeam; - Vector m_posOwner; - Vector m_angleOwner; - edict_t *m_pRealOwner;// tracelines don't hit PEV->OWNER, which means a player couldn't detonate his own trip mine, so we store the owner here. -}; - LINK_ENTITY_TO_CLASS( monster_tripmine, CTripmineGrenade ) TYPEDESCRIPTION CTripmineGrenade::m_SaveData[] = @@ -252,6 +223,28 @@ void CTripmineGrenade::MakeBeam( void ) m_pBeam->SetColor( 0, 214, 198 ); m_pBeam->SetScrollRate( 255 ); m_pBeam->SetBrightness( 64 ); + + // BMOD Begin - no trip spawn mines and flashbang + if( m_bIsFlashbang ) + { + m_pBeam->SetColor( 120, 180, 180 ); + m_pBeam->SetBrightness( 25 ); + } + + if( BMOD_IsSpawnMine() ) + { + pev->owner = m_pRealOwner; + pev->health = 0; + Killed( VARS( pev->owner ), GIB_NORMAL ); + + UTIL_SpeakBadWeapon(); + + if( m_bIsFlashbang ) + UTIL_ClientPrintAll( HUD_PRINTTALK, UTIL_VarArgs( "%s tried to place a spawn flash mine!\n", STRING( VARS( pev->owner )->netname ) ) ); + else + UTIL_ClientPrintAll( HUD_PRINTTALK, UTIL_VarArgs( "%s tried to place a spawn mine!\n", STRING( VARS( pev->owner )->netname ) ) ); + } + // BMOD Begin - no trip spawn mines no trip spawn mines and flashbang } void CTripmineGrenade::BeamBreakThink( void ) @@ -339,7 +332,12 @@ void CTripmineGrenade::DelayDeathThink( void ) TraceResult tr; UTIL_TraceLine( pev->origin + m_vecDir * 8, pev->origin - m_vecDir * 64, dont_ignore_monsters, ENT( pev ), &tr ); - Explode( &tr, DMG_BLAST ); + // BMod Begin - flashbang + if( m_bIsFlashbang ) + FlashBang(); + else + Explode( &tr, DMG_BLAST ); + // BMod Begin - flashbang } #endif @@ -398,6 +396,10 @@ int CTripmine::GetItemInfo( ItemInfo *p ) BOOL CTripmine::Deploy() { + // BMOD Edit - tripmine mod + if( bm_trip_mod.value ) + PrintMessage( m_pPlayer, BMOD_CHAN_WEAPON, Vector( 20, 250, 20 ), Vector( 1, 4, 2 ), "\nTRIPMINES\nSECONDAY FIRE: Place a flash mine." ); + pev->body = 0; return DefaultDeploy( "models/v_tripmine.mdl", "models/p_tripmine.mdl", TRIPMINE_DRAW, "trip" ); } @@ -419,6 +421,17 @@ void CTripmine::Holster( int skiplocal /* = 0 */ ) } void CTripmine::PrimaryAttack( void ) +{ + BModAttack( FALSE ); +} + +void CTripmine::SecondaryAttack( void ) +{ + if( bm_trip_mod.value ) + BModAttack( TRUE ); +} + +void CTripmine::BModAttack( BOOL flashbang ) { if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 ) return; @@ -448,6 +461,11 @@ void CTripmine::PrimaryAttack( void ) CBaseEntity *pEnt = CBaseEntity::Create( "monster_tripmine", tr.vecEndPos + tr.vecPlaneNormal * 8, angles, m_pPlayer->edict() ); + // BMOD Begin - flshbang + CTripmineGrenade *pMine = (CTripmineGrenade *)pEnt; + pMine->m_bIsFlashbang = flashbang; + // BMOD End - flshbang + m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--; // player "shoot" animation @@ -470,7 +488,7 @@ void CTripmine::PrimaryAttack( void ) }*/ - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.3; + m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); } diff --git a/dlls/util.h b/dlls/util.h index e8aee878..e89d8c32 100644 --- a/dlls/util.h +++ b/dlls/util.h @@ -567,3 +567,21 @@ int UTIL_SharedRandomLong( unsigned int seed, int low, int high ); float UTIL_SharedRandomFloat( unsigned int seed, float low, float high ); float UTIL_WeaponTimeBase( void ); + +// BMOD Begin - Custom UTIL functions +CBasePlayer* UTIL_CastPlayer( CBaseEntity *pEnt ); +CBasePlayer* UTIL_CastPlayer( entvars_t *pev ); +CBasePlayer* UTIL_CastPlayer( edict_t *pEdict ); +CBasePlayer* UTIL_CastPlayer( int index ); + +BOOL UTIL_OBB_LineTest( Vector vecSrc, Vector vecDst, Vector boxP, Vector boxE ); +BOOL UTIL_OBB_PointTest( Vector vecSrc, Vector boxP, Vector boxE ); +void UTIL_SpeakAll( char *message ); +char *UTIL_CountVotes( void ); +void UTIL_SpeakBadWeapon( void ); +char *UTIL_CountVotes( void ); +void UTIL_SaveRestorePlayer( CBasePlayer *pPlayer, BOOL save, BOOL resetall ); +void UTIL_Speak_2_l33t( char *szTarget, char *szString ); +void UTIL_SayTime( void ); +int UTIL_axtoi( char *hexStg ); +// BMOD End - Custom UTIL functions diff --git a/dlls/weapons.cpp b/dlls/weapons.cpp index 3e2ef386..64b1de8a 100644 --- a/dlls/weapons.cpp +++ b/dlls/weapons.cpp @@ -30,6 +30,7 @@ #include "soundent.h" #include "decals.h" #include "gamerules.h" +#include "egon.h" extern CGraph WorldGraph; extern int gEvilImpulse101; @@ -45,6 +46,11 @@ DLL_GLOBAL short g_sModelIndexWExplosion;// holds the index for the underwater e DLL_GLOBAL short g_sModelIndexBubbles;// holds the index for the bubbles model DLL_GLOBAL short g_sModelIndexBloodDrop;// holds the sprite index for the initial blood DLL_GLOBAL short g_sModelIndexBloodSpray;// holds the sprite index for splattered blood +DLL_GLOBAL short g_sModelIndexSpit;// holds the sprite index for blood spray (bigger) +DLL_GLOBAL short g_sModelIndexLightning;// holds the sprite index for blood spray (bigger) +DLL_GLOBAL short g_sModelIndexSmokeTrail;// holds the sprite index for blood spray (bigger) +DLL_GLOBAL short g_sModelIndexFire;// holds the index for the smoke cloud +DLL_GLOBAL short g_sModelIndexFlare; ItemInfo CBasePlayerItem::ItemInfoArray[MAX_WEAPONS]; AmmoInfo CBasePlayerItem::AmmoInfoArray[MAX_AMMO_SLOTS]; @@ -299,6 +305,13 @@ void W_Precache( void ) UTIL_PrecacheOther( "item_antidote" ); UTIL_PrecacheOther( "item_security" ); UTIL_PrecacheOther( "item_longjump" ); + UTIL_PrecacheOther( "item_rune" ); + UTIL_PrecacheOther( "item_CrowbarRune" ); + UTIL_PrecacheOther( "item_HealthRune" ); + UTIL_PrecacheOther( "item_BatteryRune" ); + UTIL_PrecacheOther( "item_ShotgunRune" ); + UTIL_PrecacheOther( "item_357Rune" ); + UTIL_PrecacheOther( "item_GrenadeRune" ); // shotgun UTIL_PrecacheOtherWeapon( "weapon_shotgun" ); @@ -315,6 +328,7 @@ void W_Precache( void ) UTIL_PrecacheOtherWeapon( "weapon_9mmAR" ); UTIL_PrecacheOther( "ammo_9mmAR" ); UTIL_PrecacheOther( "ammo_ARgrenades" ); + UTIL_PrecacheOther( "ammo_9mmbox" ); #if !defined( OEM_BUILD ) && !defined( HLDEMO_BUILD ) // python @@ -362,6 +376,11 @@ void W_Precache( void ) g_sModelIndexBubbles = PRECACHE_MODEL( "sprites/bubble.spr" );//bubbles g_sModelIndexBloodSpray = PRECACHE_MODEL( "sprites/bloodspray.spr" ); // initial blood g_sModelIndexBloodDrop = PRECACHE_MODEL( "sprites/blood.spr" ); // splattered blood + g_sModelIndexSpit = PRECACHE_MODEL( "sprites/tinyspit.spr" ); + g_sModelIndexLightning = PRECACHE_MODEL( "sprites/lgtning.spr" ); + g_sModelIndexSmokeTrail= PRECACHE_MODEL( "sprites/smoke.spr" ); + g_sModelIndexFire = PRECACHE_MODEL( "sprites/fire.spr" ); + g_sModelIndexFlare = PRECACHE_MODEL( "sprites/flare6.spr" ); g_sModelIndexLaser = PRECACHE_MODEL( (char *)g_pModelNameLaser ); g_sModelIndexLaserDot = PRECACHE_MODEL( "sprites/laserdot.spr" ); @@ -382,6 +401,9 @@ void W_Precache( void ) PRECACHE_SOUND( "weapons/bullet_hit2.wav" ); // hit by bullet PRECACHE_SOUND( "items/weapondrop1.wav" );// weapon falls to the ground + + PRECACHE_SOUND( "debris/beamstart8.wav" ); + PRECACHE_SOUND( "fvox/alert.wav" ); } TYPEDESCRIPTION CBasePlayerItem::m_SaveData[] = @@ -438,6 +460,11 @@ void CBasePlayerItem::FallInit( void ) SetThink( &CBasePlayerItem::FallThink ); pev->nextthink = gpGlobals->time + 0.1; + + // BMOD Begin - Weapon Box Models + m_WeaponModelIndex = pev->modelindex; + m_WeaponModel = pev->model; + // BMOD End - Weapon Box Models } //========================================================= @@ -620,6 +647,10 @@ void CBasePlayerWeapon::ItemPostFrame( void ) } m_pPlayer->TabulateAmmo(); + + // BMOD Edit - Spawn killing + m_pPlayer->BMOD_ResetSpawnKill(); + SecondaryAttack(); m_pPlayer->pev->button &= ~IN_ATTACK2; } @@ -631,6 +662,10 @@ void CBasePlayerWeapon::ItemPostFrame( void ) } m_pPlayer->TabulateAmmo(); + + // BMOD Edit - Spawn killing + m_pPlayer->BMOD_ResetSpawnKill(); + PrimaryAttack(); } else if( m_pPlayer->pev->button & IN_RELOAD && iMaxClip() != WEAPON_NOCLIP && !m_fInReload ) @@ -688,6 +723,9 @@ int CBasePlayerItem::AddToPlayer( CBasePlayer *pPlayer ) { m_pPlayer = pPlayer; + // BMOD Edit - Pikcing up stuff cancels typing. + pPlayer->BMOD_ResetTypeKill(); + return TRUE; } @@ -935,6 +973,9 @@ BOOL CBasePlayerWeapon::DefaultDeploy( char *szViewModel, char *szWeaponModel, i if( !CanDeploy() ) return FALSE; + // BMOD Edit - Spawn killing + m_pPlayer->BMOD_ResetSpawnKill(); + m_pPlayer->TabulateAmmo(); m_pPlayer->pev->viewmodel = MAKE_STRING( szViewModel ); m_pPlayer->pev->weaponmodel = MAKE_STRING( szWeaponModel ); @@ -1269,6 +1310,27 @@ void CWeaponBox::Touch( CBaseEntity *pOther ) //ALERT( at_console, "trying to give %s\n", STRING( m_rgpPlayerItems[i]->pev->classname ) ); pItem = m_rgpPlayerItems[i]; + + // BMOD Begin - Flying Crowbar + // Hack for flying_crowbar. Dont pickup if player already + // has crowbar. + if( pItem->m_iId == WEAPON_CROWBAR ) + { + // check if the player already has this weapon + for( int i = 0; i < MAX_ITEM_TYPES; i++ ) + { + CBasePlayerItem *it = pPlayer->m_rgpPlayerItems[i]; + while( it != NULL ) + { + if( it->m_iId == WEAPON_CROWBAR ) + return; + + it = it->m_pNext; + } + } + } + // BMOD End - Flying Crowbar + m_rgpPlayerItems[i] = m_rgpPlayerItems[i]->m_pNext;// unlink this weapon from the box if( pPlayer->AddPlayerItem( pItem ) ) @@ -1319,6 +1381,24 @@ BOOL CWeaponBox::PackWeapon( CBasePlayerItem *pWeapon ) pWeapon->m_pNext = NULL; } + // BMOD Edit - Weapon Box Models + SET_MODEL( ENT( pev ), STRING( pWeapon->m_WeaponModel ) ); + + if( !strcmp( STRING( pWeapon->pev->classname ), "weapon_tripmine" ) ) + { + // SET_MODEL( ENT( pev ), "models/v_tripmine.mdl" ); + pev->frame = 0; + pev->body = 3; + pev->sequence = 7; + pev->framerate = 0; + UTIL_SetSize( pev, Vector( -8, -8, -4 ), Vector( 8, 8, 4 ) ); + UTIL_SetOrigin( pev, pev->origin ); + } + else if( !strcmp( STRING( pWeapon->pev->classname ), "weapon_crowbar" ) ) + { + pev->nextthink = gpGlobals->time + 240; + } + pWeapon->pev->spawnflags |= SF_NORESPAWN;// never respawn pWeapon->pev->movetype = MOVETYPE_NONE; pWeapon->pev->solid = SOLID_NOT; @@ -1506,7 +1586,7 @@ TYPEDESCRIPTION CGauss::m_SaveData[] = }; IMPLEMENT_SAVERESTORE( CGauss, CBasePlayerWeapon ) - +/* TYPEDESCRIPTION CEgon::m_SaveData[] = { //DEFINE_FIELD( CEgon, m_pBeam, FIELD_CLASSPTR ), @@ -1520,7 +1600,7 @@ TYPEDESCRIPTION CEgon::m_SaveData[] = }; IMPLEMENT_SAVERESTORE( CEgon, CBasePlayerWeapon ) - +*/ TYPEDESCRIPTION CSatchel::m_SaveData[] = { DEFINE_FIELD( CSatchel, m_chargeReady, FIELD_INTEGER ), diff --git a/dlls/weapons.h b/dlls/weapons.h index 5112254a..529d7d7b 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -21,6 +21,8 @@ class CBasePlayer; extern int gmsgWeapPickup; void DeactivateSatchels( CBasePlayer *pOwner ); +void DeactivateTrips( CBasePlayer *pOwner ); +void DeactivateSnarkTrips( CBasePlayer *pOwner ); // Contact Grenade / Timed grenade / Satchel Charge class CGrenade : public CBaseMonster @@ -38,6 +40,7 @@ public: void Explode( Vector vecSrc, Vector vecAim ); void Explode( TraceResult *pTrace, int bitsDamageType ); void EXPORT Smoke( void ); + void EXPORT MegaSmoke( void ); void EXPORT BounceTouch( CBaseEntity *pOther ); void EXPORT SlideTouch( CBaseEntity *pOther ); @@ -53,6 +56,7 @@ public: virtual void Killed( entvars_t *pevAttacker, int iGib ); BOOL m_fRegisteredSound;// whether or not this grenade has issued its DANGER sound to the world sound list yet. + int m_iMegaSmokeFrame; }; // constant items @@ -274,6 +278,11 @@ public: // int m_iIdPrimary; // Unique Id for primary ammo // int m_iIdSecondary; // Unique Id for secondary ammo + + // BMOD Begin - Weapon Box Models + int m_WeaponModelIndex; + string_t m_WeaponModel; + // BMOD End - Weapon Box Models }; // inventory items that @@ -368,6 +377,11 @@ extern DLL_GLOBAL short g_sModelIndexWExplosion;// holds the index for the under extern DLL_GLOBAL short g_sModelIndexBubbles;// holds the index for the bubbles model extern DLL_GLOBAL short g_sModelIndexBloodDrop;// holds the sprite index for blood drops extern DLL_GLOBAL short g_sModelIndexBloodSpray;// holds the sprite index for blood spray (bigger) +extern DLL_GLOBAL short g_sModelIndexSpit;// holds the sprite index for blood spray (bigger) +extern DLL_GLOBAL short g_sModelIndexLightning;// holds the sprite index for blood spray (bigger) +extern DLL_GLOBAL short g_sModelIndexSmokeTrail;// holds the sprite index for blood spray (bigger) +extern DLL_GLOBAL short g_sModelIndexFire; +extern DLL_GLOBAL short g_sModelIndexFlare; extern void ClearMultiDamage(void); extern void ApplyMultiDamage(entvars_t* pevInflictor, entvars_t* pevAttacker ); @@ -493,6 +507,10 @@ public: int GetItemInfo(ItemInfo *p); void PrimaryAttack( void ); + + // BMOD Edit - Flying Crowbar + void SecondaryAttack( void ); + int Swing( int fFirst ); BOOL Deploy( void ); void Holster( int skiplocal = 0 ); @@ -766,7 +784,7 @@ private: unsigned short m_usGaussFire; unsigned short m_usGaussSpin; }; - +/* class CEgon : public CBasePlayerWeapon { public: @@ -864,7 +882,7 @@ public: private: unsigned short m_usHornetFire; }; - +*/ class CHandGrenade : public CBasePlayerWeapon { public: @@ -938,6 +956,8 @@ public: } void PrimaryAttack( void ); + void SecondaryAttack( void ); + void BModAttack( BOOL flashbang ); BOOL Deploy( void ); void Holster( int skiplocal = 0 ); void WeaponIdle( void ); diff --git a/dlls/world.cpp b/dlls/world.cpp index fe119919..5b2f3922 100644 --- a/dlls/world.cpp +++ b/dlls/world.cpp @@ -227,7 +227,7 @@ static void InitBodyQue( void ) // void CopyToBodyQue( entvars_t *pev ) { - if( pev->effects & EF_NODRAW ) +/* if( pev->effects & EF_NODRAW ) return; entvars_t *pevHead = VARS( g_pBodyQueueHead ); @@ -255,6 +255,50 @@ void CopyToBodyQue( entvars_t *pev ) UTIL_SetOrigin( pevHead, pev->origin ); UTIL_SetSize( pevHead, pev->mins, pev->maxs ); g_pBodyQueueHead = pevHead->owner; +*/ + + TraceResult tr; + + if( pev->effects & EF_NODRAW ) + return; + + entvars_t *pevHead = VARS( g_pBodyQueueHead ); + + pevHead->angles = pev->angles; + pevHead->model = pev->model; + pevHead->modelindex = pev->modelindex; + pevHead->frame = pev->frame; + pevHead->colormap = pev->colormap; + pevHead->movetype = MOVETYPE_TOSS; + pevHead->velocity = pev->velocity; + pevHead->flags = 0; + pevHead->deadflag = pev->deadflag; + pevHead->renderfx = kRenderFxDeadPlayer; + pevHead->renderamt = ENTINDEX( ENT( pev ) ); + + pevHead->effects = pev->effects | EF_NOINTERP; + //pevHead->goalstarttime = pev->goalstarttime; + //pevHead->goalframe = pev->goalframe; + //pevHead->goalendtime = pev->goalendtime ; + + pevHead->sequence = pev->sequence; + pevHead->animtime = pev->animtime; + + if( pev->flags & FL_DUCKING ) + UTIL_SetOrigin( pevHead, pev->origin + Vector( 0, 0, 20 ) ); + else + UTIL_SetOrigin( pevHead, pev->origin ); + + UTIL_SetSize( pevHead, VEC_HULL_MIN, VEC_HULL_MAX ); + g_pBodyQueueHead = pevHead->owner; + + UTIL_TraceLine( pev->origin + Vector( 0, 0, 5 ), pev->origin - Vector( 0, 0, 500 ), ignore_monsters, ENT( pevHead ), &tr ); + + pevHead->angles.x = 0; + pevHead->angles.z = 0; + + //pevHead->angles.x = UTIL_VecToAngles( tr.vecPlaneNormal ).x; + //pevHead->angles.z = UTIL_VecToAngles( tr.vecPlaneNormal ).z; } CGlobalState::CGlobalState( void ) @@ -450,12 +494,25 @@ LINK_ENTITY_TO_CLASS( worldspawn, CWorld ) #define SF_WORLD_FORCETEAM 0x0004 // Force teams extern DLL_GLOBAL BOOL g_fGameOver; +extern DLL_GLOBAL int g_VoteStatus; +extern DLL_GLOBAL BOOL g_runes_exist; +extern DLL_GLOBAL BOOL g_runes_learn; + float g_flWeaponCheat; void CWorld::Spawn( void ) { g_fGameOver = FALSE; Precache(); + + // BMOD Begin - Init World + // no runes yet + g_runes_exist = false; + g_runes_learn = false; + //strcpy(g_NextMap, ""); + g_VoteStatus = 0; + //g_bReplaceWeapons = TRUE; + //BMOD End - Init World } void CWorld::Precache( void )