diff --git a/cl_dll/ev_hldm.cpp b/cl_dll/ev_hldm.cpp index 697483bd..6e7f9b19 100644 --- a/cl_dll/ev_hldm.cpp +++ b/cl_dll/ev_hldm.cpp @@ -78,6 +78,8 @@ void EV_FireCmlwbr(struct event_args_s *args); void EV_SpinXS(struct event_args_s *args); void EV_FireXS(struct event_args_s *args); void EV_Reload(struct event_args_s *args); +void EV_FirePar21(struct event_args_s *args); +void EV_M203(struct event_args_s *args); } #define VECTOR_CONE_1DEGREES Vector( 0.00873, 0.00873, 0.00873 ) @@ -371,6 +373,7 @@ void EV_HLDM_DecalGunshot( pmtrace_t *pTrace, int iBulletType ) case BULLET_PLAYER_BUCKSHOT: case BULLET_PLAYER_357: //case BULLET_PLAYER_NAIL: + case BULLET_PLAYER_PAR21: default: // smoke and decal EV_HLDM_GunshotDecalTrace( pTrace, EV_HLDM_DamageDecal( pe ) ); @@ -411,6 +414,7 @@ int EV_HLDM_CheckTracer( int idx, float *vecSrc, float *end, float *forward, flo { case BULLET_PLAYER_MP5: case BULLET_PLAYER_NAIL: + case BULLET_PLAYER_PAR21: case BULLET_MONSTER_MP5: case BULLET_MONSTER_9MM: case BULLET_MONSTER_12MM: @@ -510,6 +514,13 @@ void EV_HLDM_FireBullets( int idx, float *forward, float *right, float *up, int // EV_HLDM_DecalGunshot( &tr, iBulletType ); } break; + case BULLET_PLAYER_PAR21: + if( !tracer ) + { + EV_HLDM_PlayTextureSound( idx, &tr, vecSrc, vecEnd, iBulletType ); + EV_HLDM_DecalGunshot( &tr, iBulletType ); + } + break; } } @@ -1825,7 +1836,7 @@ enum bradnailer_e BRADNAILER_ADD_SILENCER, BRADNAILER_UPRIGHT_TO_TILT, BRADNAILER_TILT_TO_UPRIGHT, - BRADNAILER_FASTSHOOT, + BRADNAILER_FASTSHOOT }; void EV_FireBradnailer( event_args_t *args ) @@ -1891,7 +1902,7 @@ enum nailgun_e NAILGUN_FIRE3, NAILGUN_DEPLOY_EMPTY, NAILGUN_LONGIDLE_EMPTY, - NAILGUN_IDLE1_EMPTY, + NAILGUN_IDLE1_EMPTY }; void EV_FireNailgun( event_args_t *args ) @@ -1950,7 +1961,7 @@ enum cmlwbr_e CMLWBR_DRAW1, // drawn CMLWBR_DRAW2, // undrawn CMLWBR_HOLSTER1, // drawn - CMLWBR_HOLSTER2, // undrawn + CMLWBR_HOLSTER2 // undrawn }; //TODO: Fully predict the fliying bolt. @@ -1990,7 +2001,7 @@ enum xensquasher_e XS_FIRE2, XS_HOLSTER, XS_DRAW, - XS_RELOAD, + XS_RELOAD }; void EV_SpinXS( event_args_t *args ) @@ -2105,3 +2116,103 @@ void EV_Reload( event_args_t *args ) //====================== // RELOAD END //====================== + +//====================== +// PAR21 START +//====================== + +enum par21_e +{ + PAR21_LONGIDLE = 0, + PAR21_IDLE1, + PAR21_LAUNCH, + PAR21_RELOAD, + PAR21_DEPLOY, + PAR21_FIRE1, + PAR21_FIRE2, + PAR21_FIRE3 +}; + +void EV_FirePar21( struct event_args_s *args ) +{ + int idx; + vec3_t origin; + vec3_t angles; + vec3_t velocity; + + vec3_t ShellVelocity; + vec3_t ShellOrigin; + int shell; + vec3_t vecSrc, vecAiming; + vec3_t up, right, forward; + float flSpread = 0.01; + + idx = args->entindex; + VectorCopy( args->origin, origin ); + VectorCopy( args->angles, angles ); + VectorCopy( args->velocity, velocity ); + + AngleVectors( angles, forward, right, up ); + + shell = gEngfuncs.pEventAPI->EV_FindModelIndex( "models/shell.mdl" );// brass shell + + if( EV_IsLocal( idx ) ) + { + // Add muzzle flash to current weapon model + EV_MuzzleFlash(); + gEngfuncs.pEventAPI->EV_WeaponAnimation( PAR21_FIRE1 + gEngfuncs.pfnRandomLong( 0, 2 ), 2 ); + + V_PunchAxis( 0, gEngfuncs.pfnRandomFloat( -2, 2 ) ); + } + + EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20, -12, 4 ); + + EV_EjectBrass( ShellOrigin, ShellVelocity, angles[YAW], shell, TE_BOUNCE_SHELL ); + + switch( gEngfuncs.pfnRandomLong( 0, 2 ) ) + { + case 0: + gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/par21_1.wav", 1, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 0xf ) ); + break; + case 1: + gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/par21_2.wav", 1, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 0xf ) ); + break; + case 2: + gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/par21_3.wav", 1, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 0xf ) ); + break; + } + + EV_GetGunPosition( args, vecSrc, origin ); + VectorCopy( forward, vecAiming ); + + EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_PAR21, 2, &tracerCount[idx - 1], args->fparam1, args->fparam2 ); +} + +void EV_M203( struct event_args_s *args ) +{ + int idx; + vec3_t origin; + + idx = args->entindex; + VectorCopy( args->origin, origin ); + + if( EV_IsLocal( idx ) ) + { + gEngfuncs.pEventAPI->EV_WeaponAnimation( PAR21_LAUNCH, 2 ); + V_PunchAxis( 0, -10 ); + } + + switch( gEngfuncs.pfnRandomLong( 0, 1 ) ) + { + case 0: + gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/glauncher.wav", 1, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 0xf ) ); + break; + case 1: + gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/glauncher2.wav", 1, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 0xf ) ); + break; + } +} + +//====================== +// PAR21 END +//====================== diff --git a/cl_dll/ev_hldm.h b/cl_dll/ev_hldm.h index 592ffd62..b565cdd0 100644 --- a/cl_dll/ev_hldm.h +++ b/cl_dll/ev_hldm.h @@ -19,6 +19,7 @@ typedef enum BULLET_PLAYER_CROWBAR, // crowbar swipe BULLET_PLAYER_NAIL, // nails BULLET_PLAYER_XS, // xen squasher + BULLET_PLAYER_PAR21, // par21 BULLET_MONSTER_9MM, BULLET_MONSTER_MP5, BULLET_MONSTER_12MM diff --git a/cl_dll/health.cpp b/cl_dll/health.cpp index 55ac564c..4aa07a67 100644 --- a/cl_dll/health.cpp +++ b/cl_dll/health.cpp @@ -61,7 +61,7 @@ int CHudHealth::Init( void ) { HOOK_MESSAGE( Health ); HOOK_MESSAGE( Damage ); - m_iHealth = 50; + m_iHealth = 100; m_fFade = 0; m_iFlags = 0; m_bitsDamage = 0; diff --git a/cl_dll/hl/hl_events.cpp b/cl_dll/hl/hl_events.cpp index 9412453e..569da4d1 100644 --- a/cl_dll/hl/hl_events.cpp +++ b/cl_dll/hl/hl_events.cpp @@ -48,6 +48,8 @@ void EV_FireCmlwbr( struct event_args_s *args ); void EV_SpinXS( struct event_args_s *args ); void EV_FireXS( struct event_args_s *args ); void EV_Reload( struct event_args_s *args ); +void EV_FirePar21( struct event_args_s *args ); +void EV_M203( struct event_args_s *args ); } /* @@ -92,4 +94,6 @@ void Game_HookEvents( void ) gEngfuncs.pfnHookEvent( "events/xsspin.sc", EV_SpinXS ); gEngfuncs.pfnHookEvent( "events/xs.sc", EV_FireXS ); gEngfuncs.pfnHookEvent( "events/reload.sc", EV_Reload ); + gEngfuncs.pfnHookEvent( "events/par21.sc", EV_FirePar21 ); + gEngfuncs.pfnHookEvent( "events/m203.sc", EV_M203 ); } diff --git a/cl_dll/hl/hl_weapons.cpp b/cl_dll/hl/hl_weapons.cpp index 4aeed83c..6422908c 100644 --- a/cl_dll/hl/hl_weapons.cpp +++ b/cl_dll/hl/hl_weapons.cpp @@ -57,9 +57,7 @@ CHeaterPipe g_HeaterPipe; CCmlwbr g_Cmlwbr; CShotgun g_Shotgun; CPipeBomb g_PipeBomb; -CBradnailer g_Bradnailer; -CNailgun g_Nailgun; -CXenSquasher g_Xs; +CPar21 g_Par21; /* ====================== AlertMessage @@ -619,9 +617,7 @@ void HUD_InitClientWeapons( void ) HUD_PrepEntity( &g_Shotgun, &player ); HUD_PrepEntity( &g_Cmlwbr, &player ); HUD_PrepEntity( &g_PipeBomb, &player ); - HUD_PrepEntity( &g_Bradnailer, &player ); - HUD_PrepEntity( &g_Nailgun, &player ); - HUD_PrepEntity( &g_Xs, &player ); + HUD_PrepEntity( &g_Par21, &player ); } /* @@ -697,14 +693,8 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm case WEAPON_PIPEBOMB: pWeapon = &g_PipeBomb; break; - case WEAPON_BRADNAILER: - pWeapon = &g_Bradnailer; - break; - case WEAPON_NAILGUN: - pWeapon = &g_Nailgun; - break; - case WEAPON_XS: - pWeapon = &g_Xs; + case WEAPON_PAR21: + pWeapon = &g_Par21; break; } @@ -818,6 +808,11 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm { player.ammo_xencandy = (int)from->client.vuser2[1]; } + else if( player.m_pActiveItem->m_iId == WEAPON_PAR21 ) + { + player.ammo_par21 = (int)from->client.vuser2[1]; + player.ammo_m203grens = (int)from->client.vuser2[2]; + } // Don't go firing anything if we have died. // Or if we don't have a weapon model deployed @@ -889,6 +884,11 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm { from->client.vuser2[1] = player.ammo_xencandy; } + else if( player.m_pActiveItem->m_iId == WEAPON_PAR21 ) + { + from->client.vuser2[1] = player.ammo_par21; + from->client.vuser2[2] = player.ammo_m203grens; + } // Make sure that weapon animation matches what the game .dll is telling us // over the wire ( fixes some animation glitches ) diff --git a/cl_dll/view.cpp b/cl_dll/view.cpp index cb770f9f..f5c9475d 100644 --- a/cl_dll/view.cpp +++ b/cl_dll/view.cpp @@ -1313,6 +1313,7 @@ int V_FindViewModelByWeaponModel( int weaponindex ) { "models/p_cmlwbr.mdl", "models/v_cmlwbr.mdl" }, { "models/p_heaterpipe.mdl", "models/v_heaterpipe.mdl" }, { "models/p_nailgun.mdl", "models/v_nailgun.mdl" }, + { "models/p_par21.mdl", "models/v_par21.mdl" }, { "models/p_pipebomb.mdl", "models/v_pipebomb.mdl" }, { "models/p_pipebomb_watch.mdl","models/v_pipebomb_watch.mdl" }, { "models/p_shotgun.mdl", "models/v_shotgun.mdl" }, diff --git a/dlls/barnacle.cpp b/dlls/barnacle.cpp index 2a264bf7..05d3c638 100644 --- a/dlls/barnacle.cpp +++ b/dlls/barnacle.cpp @@ -22,7 +22,6 @@ #include "monsters.h" #include "schedule.h" -#define SF_BARNACLE_SPAWN_XENCANDY 1 #define BARNACLE_BODY_HEIGHT 44 // how 'tall' the barnacle's model is. #define BARNACLE_PULL_SPEED 8 #define BARNACLE_KILL_VICTIM_DELAY 5 // how many seconds after pulling prey in to gib them. @@ -55,7 +54,6 @@ public: BOOL m_fTongueExtended; BOOL m_fLiftingPrey; float m_flTongueAdj; - BOOL m_fXenCandySpawned; // FIXME: need a custom barnacle model with non-generic hitgroup // otherwise we can apply to damage to tongue instead of body @@ -104,23 +102,6 @@ void CBarnacle::HandleAnimEvent( MonsterEvent_t *pEvent ) { case BARNACLE_AE_PUKEGIB: CGib::SpawnRandomGibs( pev, 1, 1 ); - if( ( pev->spawnflags & SF_BARNACLE_SPAWN_XENCANDY ) && !m_fXenCandySpawned ) - { - Vector vecSrc = pev->origin + Vector( 0, 0, -16 ); - - Vector vecAngles = pev->angles; - vecAngles.x = vecAngles.z = 0; - vecAngles.y = RANDOM_LONG(0, 36) * 10; - - CBaseEntity*pItem = DropItem( "ammo_xencandy", vecSrc, vecAngles ); - - if( pItem ) - { - pItem->pev->owner = edict(); - - m_fXenCandySpawned = TRUE; - } - } break; default: CBaseMonster::HandleAnimEvent( pEvent ); @@ -435,8 +416,6 @@ void CBarnacle::Precache() PRECACHE_SOUND( "barnacle/bcl_chew3.wav" ); PRECACHE_SOUND( "barnacle/bcl_die1.wav" ); PRECACHE_SOUND( "barnacle/bcl_die3.wav" ); - - UTIL_PrecacheOther( "ammo_xencandy" ); } //========================================================= diff --git a/dlls/cbase.h b/dlls/cbase.h index 9034b84a..c84dea91 100644 --- a/dlls/cbase.h +++ b/dlls/cbase.h @@ -342,6 +342,8 @@ public: int ammo_argrens; int ammo_nails; int ammo_xencandy; + int ammo_par21; + int ammo_m203grens; //Special stuff for grenades and satchels. float m_flStartThrow; diff --git a/dlls/client.cpp b/dlls/client.cpp index 230f395b..56bd8ff3 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -1628,6 +1628,11 @@ void UpdateClientData( const struct edict_s *ent, int sendweapons, struct client { cd->vuser2.y = pl->ammo_xencandy; } + else if( pl->m_pActiveItem->m_iId == WEAPON_PAR21 ) + { + cd->vuser2.y = pl->ammo_par21; + cd->vuser2.z = pl->ammo_m203grens; + } } } } diff --git a/dlls/combat.cpp b/dlls/combat.cpp index 8ec628b0..f0f39d04 100644 --- a/dlls/combat.cpp +++ b/dlls/combat.cpp @@ -1548,6 +1548,9 @@ Vector CBaseEntity::FireBulletsPlayer( ULONG cShots, Vector vecSrc, Vector vecDi case BULLET_PLAYER_NAIL: pEntity->TraceAttack( pevAttacker, 0, vecDir, &tr, DMG_BULLET ); break; + case BULLET_PLAYER_PAR21: + pEntity->TraceAttack( pevAttacker, gSkillData.plrDmgPar21, vecDir, &tr, DMG_BULLET ); + break; } } // make bullet trails diff --git a/dlls/func_break.cpp b/dlls/func_break.cpp index 7b0715cc..105add3c 100644 --- a/dlls/func_break.cpp +++ b/dlls/func_break.cpp @@ -39,22 +39,22 @@ const char *CBreakable::pSpawnObjects[] = NULL, // 0 "item_healthkit", // 1 "item_healthkit", // 2 - "weapon_bradnailer", // 3 - "ammo_nailclip", // 4 - "weapon_nailgun", // 5 - "ammo_nailround", // 6 + "weapon_9mmhandgun", // 3 + "ammo_9mmclip", // 4 + "weapon_9mmAR", // 5 + "ammo_9mmAR", // 6 "weapon_cmlwbr", // 7 - "ammo_bolts", // 8 + "weapon_shotgun", // 8 "weapon_shotgun", // 9 - "ammo_buckshot", // 10 + "weapon_crossbow", // 10 "ammo_crossbow", // 11 "weapon_357", // 12 "ammo_357", // 13 "weapon_rpg", // 14 "weapon_pipebomb", // 15 "ammo_gaussclip", // 16 - "weapon_handgrenade", // 17 - "weapon_tripmine", // 18 + "ammo_par21_clip", // 17 + "ammo_m203grenade", // 18 "weapon_satchel", // 19 "weapon_snark", // 20 "weapon_hornetgun", // 21 diff --git a/dlls/game.cpp b/dlls/game.cpp index cf79125a..b31f4657 100644 --- a/dlls/game.cpp +++ b/dlls/game.cpp @@ -461,6 +461,11 @@ cvar_t sk_plr_nail1 = { "sk_plr_nail1", "0" }; cvar_t sk_plr_nail2 = { "sk_plr_nail2", "0" }; cvar_t sk_plr_nail3 = { "sk_plr_nail3", "0" }; +// Par21 Round +cvar_t sk_plr_par21_bullet1 = { "sk_plr_par21_bullet1", "0" }; +cvar_t sk_plr_par21_bullet2 = { "sk_plr_par21_bullet2", "0" }; +cvar_t sk_plr_par21_bullet3 = { "sk_plr_par21_bullet3", "0" }; + // END Cvars for Skill Level settings // Register your console variables here @@ -891,6 +896,11 @@ void GameDLLInit( void ) CVAR_REGISTER( &sk_plr_nail2 ); CVAR_REGISTER( &sk_plr_nail3 ); + // Par21 Round + CVAR_REGISTER( &sk_plr_par21_bullet1 ); + CVAR_REGISTER( &sk_plr_par21_bullet2 ); + CVAR_REGISTER( &sk_plr_par21_bullet3 ); + // END REGISTER CVARS FOR SKILL LEVEL STUFF SERVER_COMMAND( "exec skill.cfg\n" ); diff --git a/dlls/gamerules.cpp b/dlls/gamerules.cpp index 72a70fe3..ea0e3161 100644 --- a/dlls/gamerules.cpp +++ b/dlls/gamerules.cpp @@ -310,6 +310,9 @@ void CGameRules::RefreshSkillData ( void ) // Nails gSkillData.plrDmgNail = GetSkillCvar( "sk_plr_nail" ); + + // Par21 + gSkillData.plrDmgPar21 = GetSkillCvar( "sk_plr_par21_bullet" ); } //========================================================= diff --git a/dlls/hgrunt.cpp b/dlls/hgrunt.cpp index d17e3ee8..70fdc0bd 100644 --- a/dlls/hgrunt.cpp +++ b/dlls/hgrunt.cpp @@ -275,6 +275,39 @@ int CHGrunt::IRelationship( CBaseEntity *pTarget ) //========================================================= void CHGrunt::GibMonster( void ) { + Vector vecGunPos; + Vector vecGunAngles; + + if( GetBodygroup(2) != 2 ) + { + // throw a gun if the grunt has one + GetAttachment( 0, vecGunPos, vecGunAngles ); + + CBaseEntity *pGun; + + // Only drop items such as par21 and m203 grenades + if( FBitSet( pev->weapons, HGRUNT_9MMAR ) ) + { + pGun = DropItem( "weapon_par21", vecGunPos, vecGunAngles ); + } + + if( pGun ) + { + pGun->pev->velocity = Vector( RANDOM_FLOAT( -100, 100 ), RANDOM_FLOAT( -100, 100 ), RANDOM_FLOAT( 200, 300 ) ); + pGun->pev->avelocity = Vector( 0, RANDOM_FLOAT( 200, 400 ), 0 ); + } + + if( FBitSet( pev->weapons, HGRUNT_GRENADELAUNCHER ) ) + { + pGun = DropItem( "ammo_m203grenade", vecGunPos, vecGunAngles ); + if( pGun ) + { + pGun->pev->velocity = Vector( RANDOM_FLOAT( -100, 100 ), RANDOM_FLOAT( -100, 100 ), RANDOM_FLOAT( 200, 300 ) ); + pGun->pev->avelocity = Vector( 0, RANDOM_FLOAT( 200, 400 ), 0 ); + } + } + } + CBaseMonster::GibMonster(); } @@ -812,6 +845,25 @@ void CHGrunt::HandleAnimEvent( MonsterEvent_t *pEvent ) switch( pEvent->event ) { case HGRUNT_AE_DROP_GUN: + Vector vecGunPos; + Vector vecGunAngles; + + GetAttachment( 0, vecGunPos, vecGunAngles ); + + // switch to body group with no gun. + SetBodygroup( GUN_GROUP, GUN_NONE ); + + // now spawn a gun. + + // Only drop items such as par21 and m203 grenades + if( FBitSet( pev->weapons, HGRUNT_9MMAR ) ) + { + DropItem( "weapon_par21", vecGunPos, vecGunAngles ); + } + if( FBitSet( pev->weapons, HGRUNT_GRENADELAUNCHER ) ) + { + DropItem( "ammo_m203grenade", BodyTarget( pev->origin ), vecGunAngles ); + } break; case HGRUNT_AE_RELOAD: EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "hgrunt/gr_reload1.wav", 1, ATTN_NORM ); diff --git a/dlls/player.cpp b/dlls/player.cpp index 6ba3eb0c..e3311a90 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -1118,6 +1118,8 @@ void CBasePlayer::TabulateAmmo() ammo_hornets = AmmoInventory( GetAmmoIndex( "Hornets" ) ); ammo_nails = AmmoInventory( GetAmmoIndex( "nails" ) ); ammo_xencandy = AmmoInventory( GetAmmoIndex( "xencandy" ) ); + ammo_par21 = AmmoInventory( GetAmmoIndex( "par21" ) ); + ammo_m203grens = AmmoInventory( GetAmmoIndex( "M203grenades" ) ); } /* @@ -1871,51 +1873,47 @@ void CBasePlayer::PreThink( void ) { if( !m_bSong01_Played ) { - if( FStrEq( STRING( gpGlobals->mapname ), "po_haz01" ) ) + if( FStrEq( STRING( gpGlobals->mapname ), "pv_intro" ) ) { - CLIENT_COMMAND( edict(), "play sound/mp3/hazard.mp3\n" ); + CLIENT_COMMAND( edict(), "play sound/mp3/int.mp3\n" ); m_bSong01_Played = TRUE; } } if( !m_bSong02_Played ) { - if( FStrEq( STRING( gpGlobals->mapname ), "po_aud01" ) ) + if( FStrEq( STRING( gpGlobals->mapname ), "pv_orl01" ) ) { - CLIENT_COMMAND( edict(), "play sound/mp3/audion.mp3\n" ); + CLIENT_COMMAND( edict(), "play sound/mp3/orl.mp3\n" ); m_bSong02_Played = TRUE; } } if( !m_bSong03_Played ) { - if( FStrEq( STRING( gpGlobals->mapname ), "po_sew01" ) ) + if( FStrEq( STRING( gpGlobals->mapname ), "pv_ntc01" ) ) { - CLIENT_COMMAND( edict(), "play sound/mp3/sewer.mp3\n" ); + CLIENT_COMMAND( edict(), "play sound/mp3/ntc.mp3\n" ); m_bSong03_Played = TRUE; } } if( !m_bSong04_Played ) { - if( FStrEq( STRING( gpGlobals->mapname ), "po_lib01" ) ) + if( FStrEq( STRING( gpGlobals->mapname ), "pv_ntc05" ) ) { - CLIENT_COMMAND( edict(), "play sound/mp3/library.mp3\n" ); + CLIENT_COMMAND( edict(), "play sound/mp3/asl.mp3\n" ); m_bSong04_Played = TRUE; } } if( !m_bSong05_Played ) { - if( FStrEq( STRING( gpGlobals->mapname ), "po_eas01" ) ) + if( FStrEq( STRING( gpGlobals->mapname ), "pv_outro" ) ) { - CLIENT_COMMAND( edict(), "play sound/mp3/eastend.mp3\n" ); + CLIENT_COMMAND( edict(), "play sound/mp3/out.mp3\n" ); m_bSong05_Played = TRUE; } } if( !m_bSong06_Played ) { - if( FStrEq( STRING( gpGlobals->mapname ), "credits" ) ) - { - CLIENT_COMMAND( edict(), "play sound/mp3/credits.mp3\n" ); - m_bSong06_Played = TRUE; - } + m_bSong06_Played = TRUE; } } } @@ -2024,6 +2022,7 @@ void CBasePlayer::CheckTimeBasedDamage() bDuration = NERVEGAS_DURATION; break; case itbd_Poison: + TakeDamage( pev, pev, POISON_DAMAGE, DMG_GENERIC ); bDuration = POISON_DURATION; break; case itbd_Radiation: @@ -2686,12 +2685,12 @@ ReturnSpot: void CBasePlayer::Spawn( void ) { pev->classname = MAKE_STRING( "player" ); - pev->health = 50; + pev->health = 100; pev->armorvalue = 0; pev->takedamage = DAMAGE_AIM; pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_WALK; - pev->max_health = 100; + pev->max_health = pev->health; pev->flags &= FL_PROXY; // keep proxy flag sey by engine pev->flags |= FL_CLIENT; pev->air_finished = gpGlobals->time + 12; @@ -3357,12 +3356,10 @@ void CBasePlayer::CheatImpulseCommands( int iImpulse ) GiveNamedItem( "weapon_cmlwbr" ); GiveNamedItem( "ammo_bolts" ); GiveNamedItem( "weapon_pipebomb" ); - GiveNamedItem( "weapon_bradnailer" ); - GiveNamedItem( "ammo_nailclip" ); - GiveNamedItem( "ammo_nailround" ); - GiveNamedItem( "weapon_nailgun" ); - GiveNamedItem( "weapon_xs" ); - GiveNamedItem( "ammo_xencandy" ); + GiveNamedItem( "weapon_par21" ); + GiveNamedItem( "ammo_par21_clip" ); + GiveNamedItem( "ammo_par21_grenade" ); + GiveNamedItem( "ammo_m203grenade" ); gEvilImpulse101 = FALSE; break; @@ -3775,19 +3772,7 @@ void CBasePlayer::UpdateClientData( void ) // if( !( pev->weapons & ( 1 << WEAPON_SUIT ) ) ) { - if( FStrEq( STRING( gpGlobals->mapname ), "po_haz01" ) ) - { - pev->weapons |= ( 1 << WEAPON_SUIT ); - - // Force HUD update. - m_fHudVisible = TRUE; - - // - // Make HUD completely transparent. - // - HidePlayerHUD( TRUE ); - } - else if( FStrEq( STRING( gpGlobals->mapname ), "po_aud01" ) ) + if( FStrEq( STRING( gpGlobals->mapname ), "pv_orl01" ) ) { pev->weapons |= ( 1 << WEAPON_SUIT ); @@ -3796,15 +3781,6 @@ void CBasePlayer::UpdateClientData( void ) // ShowPlayerHUD(); } - else if( FStrEq( STRING( gpGlobals->mapname ), "credits" ) ) - { - pev->weapons = 0; - - // - // Make HUD completely transparent and slowly increase it's alpha. - // - HidePlayerHUD( TRUE ); - } } // Update HUD visibility. @@ -4674,12 +4650,7 @@ void CStripWeapons::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE } if( pPlayer ) - { - if( !FStrEq( STRING( gpGlobals->mapname ), "po_xen01" ) ) - pPlayer->RemoveAllItems( TRUE ); - else - pPlayer->RemoveAllItems( FALSE ); - } + pPlayer->RemoveAllItems( TRUE ); } class CRevertSaved : public CPointEntity diff --git a/dlls/skill.h b/dlls/skill.h index 7b0a11a0..733a5269 100644 --- a/dlls/skill.h +++ b/dlls/skill.h @@ -140,6 +140,8 @@ struct skilldata_t float plrArm; float plrDmgNail; + + float plrDmgPar21; }; extern DLL_GLOBAL skilldata_t gSkillData; diff --git a/dlls/triggers.cpp b/dlls/triggers.cpp index 0ae741b7..431ccfb2 100644 --- a/dlls/triggers.cpp +++ b/dlls/triggers.cpp @@ -2233,13 +2233,9 @@ void CTriggerCamera::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP { ( (CBasePlayer *)pActivator )->EnableControl( FALSE ); - if( !( FStrEq( STRING( gpGlobals->mapname ), "po_haz01" ) && FStrEq( STRING( pev->targetname ), "cam" ) ) && - !( FStrEq( STRING( gpGlobals->mapname ), "po_aud01" ) && FStrEq( STRING( pev->targetname ), "cam" ) ) ) + if( ( (CBasePlayer *)pActivator )->pev->weapons & ( 1 << WEAPON_SUIT ) ) { - if( ( (CBasePlayer *)pActivator )->pev->weapons & ( 1 << WEAPON_SUIT ) ) - { - ( (CBasePlayer *)pActivator )->HidePlayerHUD(); - } + ( (CBasePlayer *)pActivator )->HidePlayerHUD(); } } @@ -2299,13 +2295,9 @@ void CTriggerCamera::FollowTarget() SET_VIEW( m_hPlayer->edict(), m_hPlayer->edict() ); ( (CBasePlayer *)( (CBaseEntity *)m_hPlayer ) )->EnableControl( TRUE ); - if( !( FStrEq( STRING( gpGlobals->mapname ), "po_aud01" ) && FStrEq( STRING( pev->targetname ), "cam" ) ) && - !( FStrEq( STRING( gpGlobals->mapname ), "credits" ) && FStrEq( STRING( pev->targetname ), "credits_cam" ) ) ) + if( ( (CBasePlayer *)( (CBaseEntity *)m_hPlayer ) )->pev->weapons & ( 1 << WEAPON_SUIT ) ) { - if( ( (CBasePlayer *)( (CBaseEntity *)m_hPlayer ) )->pev->weapons & ( 1 << WEAPON_SUIT ) ) - { - ( (CBasePlayer *)( (CBaseEntity *)m_hPlayer ) )->ShowPlayerHUD(); - } + ( (CBasePlayer *)( (CBaseEntity *)m_hPlayer ) )->ShowPlayerHUD(); } } SUB_UseTargets( this, USE_TOGGLE, 0 ); diff --git a/dlls/vendetta/par21.cpp b/dlls/vendetta/par21.cpp new file mode 100644 index 00000000..9cefa5f3 --- /dev/null +++ b/dlls/vendetta/par21.cpp @@ -0,0 +1,324 @@ +/*** +* +* Copyright (c) 1996-2001, Valve LLC. All rights reserved. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* All Rights Reserved. +* +* Use, distribution, and modification of this source code and/or resulting +* object code is restricted to non-commercial enhancements to products from +* Valve LLC. All other use, distribution, or modification is prohibited +* without written permission from Valve LLC. +* +****/ + +#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 par21_e +{ + PAR21_LONGIDLE = 0, + PAR21_IDLE1, + PAR21_LAUNCH, + PAR21_RELOAD, + PAR21_DEPLOY, + PAR21_FIRE1, + PAR21_FIRE2, + PAR21_FIRE3, +}; + + +LINK_ENTITY_TO_CLASS(weapon_par21, CPar21); + + +//========================================================= +//========================================================= +int CPar21::SecondaryAmmoIndex(void) +{ + return m_iSecondaryAmmoType; +} + +void CPar21::Spawn() +{ + Precache(); + SET_MODEL(ENT(pev), "models/w_par21.mdl"); + m_iId = WEAPON_PAR21; + + m_iDefaultAmmo = PAR21_DEFAULT_GIVE; + + FallInit();// get ready to fall down. +} + + +void CPar21::Precache(void) +{ + PRECACHE_MODEL("models/v_par21.mdl"); + PRECACHE_MODEL("models/w_par21.mdl"); + PRECACHE_MODEL("models/p_par21.mdl"); + + m_iShell = PRECACHE_MODEL("models/shell.mdl");// brass shellTE_MODEL + + PRECACHE_MODEL("models/grenade.mdl"); // grenade + + PRECACHE_MODEL("models/w_par21_clip.mdl"); + PRECACHE_SOUND("items/9mmclip1.wav"); + + PRECACHE_SOUND("items/clipinsert1.wav"); + PRECACHE_SOUND("items/cliprelease1.wav"); + + PRECACHE_SOUND("weapons/par21_1.wav"); + PRECACHE_SOUND("weapons/par21_2.wav"); + PRECACHE_SOUND("weapons/par21_3.wav"); + + PRECACHE_SOUND("weapons/glauncher.wav"); + PRECACHE_SOUND("weapons/glauncher2.wav"); + + PRECACHE_SOUND("weapons/357_cock1.wav"); + + m_usReload = PRECACHE_EVENT(1, "events/reload.sc"); + m_usPar21 = PRECACHE_EVENT(1, "events/par21.sc"); + m_usM203 = PRECACHE_EVENT(1, "events/m203.sc"); +} + +int CPar21::GetItemInfo(ItemInfo *p) +{ + p->pszName = STRING(pev->classname); + p->pszAmmo1 = "par21"; + p->iMaxAmmo1 = PAR21_MAX_CARRY; + p->pszAmmo2 = "M203grenades"; + p->iMaxAmmo2 = M203_GRENADE_MAX_CARRY; + p->iMaxClip = PAR21_MAX_CLIP; + p->iSlot = 1; + p->iPosition = 0; + p->iFlags = 0; + p->iId = m_iId = WEAPON_PAR21; + p->iWeight = PAR21_WEIGHT; + + return 1; +} + +int CPar21::AddToPlayer(CBasePlayer *pPlayer) +{ + if (CBasePlayerWeapon::AddToPlayer(pPlayer)) + { + MESSAGE_BEGIN(MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev); + WRITE_BYTE(m_iId); + MESSAGE_END(); + return TRUE; + } + return FALSE; +} + +BOOL CPar21::Deploy() +{ + m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0f; + return DefaultDeploy("models/v_par21.mdl", "models/p_par21.mdl", PAR21_DEPLOY, "par21"); +} + + +void CPar21::PrimaryAttack() +{ + // don't fire underwater + if (m_pPlayer->pev->waterlevel == 3) + { + PlayEmptySound(); + m_flNextPrimaryAttack = 0.15; + return; + } + + if (m_iClip <= 0) + { + PlayEmptySound(); + m_flNextPrimaryAttack = 0.15; + return; + } + + m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME; + m_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH; + + m_iClip--; + + + m_pPlayer->pev->effects = (int)(m_pPlayer->pev->effects) | EF_MUZZLEFLASH; + + // player "shoot" animation + m_pPlayer->SetAnimation(PLAYER_ATTACK1); + + Vector vecSrc = m_pPlayer->GetGunPosition(); + Vector vecAiming = m_pPlayer->GetAutoaimVector(AUTOAIM_5DEGREES); + Vector vecDir; + + // single player spread + vecDir = m_pPlayer->FireBulletsPlayer(1, vecSrc, vecAiming, VECTOR_CONE_3DEGREES, 8192, BULLET_PLAYER_PAR21, 2, 0, m_pPlayer->pev, m_pPlayer->random_seed); + + int flags; +#if defined( CLIENT_WEAPONS ) + flags = FEV_NOTHOST; +#else + flags = 0; +#endif + + PLAYBACK_EVENT_FULL(flags, m_pPlayer->edict(), m_usPar21, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0); + + m_flNextPrimaryAttack = GetNextAttackDelay(0.1); + + if (m_flNextPrimaryAttack < UTIL_WeaponTimeBase()) + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.1; + + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat(m_pPlayer->random_seed, 10, 15); +} + + + +void CPar21::SecondaryAttack(void) +{ + // don't fire underwater + if (m_pPlayer->pev->waterlevel == 3) + { + PlayEmptySound(); + m_flNextPrimaryAttack = 0.15; + return; + } + + if (m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType] == 0) + { + PlayEmptySound(); + return; + } + + m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME; + m_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH; + + m_pPlayer->m_iExtraSoundTypes = bits_SOUND_DANGER; + m_pPlayer->m_flStopExtraSoundTime = UTIL_WeaponTimeBase() + 0.2; + + m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType]--; + + // player "shoot" animation + m_pPlayer->SetAnimation(PLAYER_ATTACK1); + + UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle); + + // we don't add in player velocity anymore. + CGrenade::ShootContact(m_pPlayer->pev, + m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_forward * 16, + gpGlobals->v_forward * 800); + + int flags; +#if defined( CLIENT_WEAPONS ) + flags = FEV_NOTHOST; +#else + flags = 0; +#endif + + PLAYBACK_EVENT(0, m_pPlayer->edict(), m_usM203); + + m_flNextPrimaryAttack = GetNextAttackDelay(1); + m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1; + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5;// idle pretty soon after shooting. +} + +void CPar21::Reload(void) +{ + if (m_pPlayer->ammo_par21 <= 0) + return; + + int iAnim = PAR21_RELOAD; + int iResult = DefaultReload(PAR21_MAX_CLIP, iAnim, 1.5); + + if ( iResult ) + { + PLAYBACK_EVENT_FULL(0, m_pPlayer->edict(), m_usReload, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, iAnim, 0, 0, 0); + } +} + + +void CPar21::WeaponIdle(void) +{ + ResetEmptySound(); + + m_pPlayer->GetAutoaimVector(AUTOAIM_5DEGREES); + + if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase()) + return; + + int iAnim; + switch (RANDOM_LONG(0, 1)) + { + case 0: + iAnim = PAR21_LONGIDLE; + break; + + default: + case 1: + iAnim = PAR21_IDLE1; + break; + } + + SendWeaponAnim(iAnim); + + m_flTimeWeaponIdle = UTIL_SharedRandomFloat(m_pPlayer->random_seed, 10, 15); // how long till we do this again. +} + + + +class CPar21AmmoClip : public CBasePlayerAmmo +{ + void Spawn(void) + { + Precache(); + SET_MODEL(ENT(pev), "models/w_par21_clip.mdl"); + CBasePlayerAmmo::Spawn(); + } + void Precache(void) + { + PRECACHE_MODEL("models/w_par21_clip.mdl"); + PRECACHE_SOUND("items/9mmclip1.wav"); + } + BOOL AddAmmo(CBaseEntity *pOther) + { + int bResult = (pOther->GiveAmmo(AMMO_PAR21CLIP_GIVE, "par21", PAR21_MAX_CARRY) != -1); + if (bResult) + { + EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_NORM); + } + return bResult; + } +}; +LINK_ENTITY_TO_CLASS(ammo_par21_clip, CPar21AmmoClip); + + +class CM203GrenadeAmmo : public CBasePlayerAmmo +{ + void Spawn(void) + { + Precache(); + SET_MODEL(ENT(pev), "models/w_par21_grenades.mdl"); + CBasePlayerAmmo::Spawn(); + } + void Precache(void) + { + PRECACHE_MODEL("models/w_par21_grenades.mdl"); + PRECACHE_SOUND("items/9mmclip1.wav"); + } + BOOL AddAmmo(CBaseEntity *pOther) + { + int bResult = (pOther->GiveAmmo(AMMO_M203BOX_GIVE, "M203grenades", M203_GRENADE_MAX_CARRY) != -1); + + if (bResult) + { + EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_NORM); + } + return bResult; + } +}; +LINK_ENTITY_TO_CLASS(ammo_par21_grenade, CM203GrenadeAmmo); +LINK_ENTITY_TO_CLASS(ammo_m203grenade, CM203GrenadeAmmo); \ No newline at end of file diff --git a/dlls/weapons.cpp b/dlls/weapons.cpp index ca91b778..877598e9 100644 --- a/dlls/weapons.cpp +++ b/dlls/weapons.cpp @@ -171,6 +171,7 @@ void DecalGunshot( TraceResult *pTrace, int iBulletType ) case BULLET_PLAYER_BUCKSHOT: case BULLET_PLAYER_357: case BULLET_PLAYER_NAIL: + case BULLET_PLAYER_PAR21: default: // smoke and decal UTIL_GunshotDecalTrace( pTrace, DamageDecal( pEntity, DMG_BULLET ) ); @@ -316,17 +317,11 @@ void W_Precache( void ) // pipebomb UTIL_PrecacheOtherWeapon( "weapon_pipebomb" ); - // bradnailer - UTIL_PrecacheOtherWeapon( "weapon_bradnailer" ); - UTIL_PrecacheOther( "ammo_nailclip" ); - UTIL_PrecacheOther( "ammo_nailround" ); - - // nailgun - UTIL_PrecacheOtherWeapon( "weapon_nailgun" ); - - // xen squasher - UTIL_PrecacheOtherWeapon( "weapon_xs" ); - UTIL_PrecacheOther( "ammo_xencandy" ); + // par21 + UTIL_PrecacheOtherWeapon( "weapon_par21" ); + UTIL_PrecacheOther( "ammo_par21_clip" ); + UTIL_PrecacheOther( "ammo_par21_grenade" ); + UTIL_PrecacheOther( "ammo_m203grenade" ); #if !defined( OEM_BUILD ) && !defined( HLDEMO_BUILD ) if( g_pGameRules->IsDeathmatch() ) diff --git a/dlls/weapons.h b/dlls/weapons.h index 674b6df2..92f776b5 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -146,6 +146,7 @@ typedef enum BULLET_PLAYER_CROWBAR, // crowbar swipe BULLET_PLAYER_NAIL, // nails BULLET_PLAYER_XS, // xen squasher + BULLET_PLAYER_PAR21, BULLET_MONSTER_9MM, BULLET_MONSTER_MP5, @@ -1172,4 +1173,37 @@ public: private: unsigned short m_usReload; }; + +class CPar21 : public CBasePlayerWeapon +{ +public: + void Spawn( void ); + void Precache( void ); + int iItemSlot( void ) { return 2; } + int GetItemInfo( ItemInfo *p); + int AddToPlayer( CBasePlayer *pPlayer ); + + void PrimaryAttack( void ); + void SecondaryAttack( void ); + int SecondaryAmmoIndex( void ); + BOOL Deploy( void ); + void Reload( void ); + void WeaponIdle( void ); + int m_iShell; + + virtual BOOL UseDecrement( void ) + { +#if defined( CLIENT_WEAPONS ) + return TRUE; +#else + return FALSE; +#endif + } + +private: + unsigned short m_usReload; + unsigned short m_usPar21; + unsigned short m_usM203; +}; + #endif // WEAPONS_H