Skip to content

Commit

Permalink
added effect Changing Pitch and fixed ep2 missing particles
Browse files Browse the repository at this point in the history
  • Loading branch information
Pinsplash committed Apr 30, 2024
1 parent c99d63a commit 4930344
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 5 deletions.
6 changes: 6 additions & 0 deletions sourcemods/ep1chaos/cfg/autoexec.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ chaos_time_no_brake 1
//Bumpy Road
chaos_time_bumpy 1
//Changing Pitch
chaos_time_change_pitch 1
//Color Incorrection
chaos_time_random_cc 1
Expand Down Expand Up @@ -226,6 +229,9 @@ chaos_prob_no_brake 600
//Bumpy Road
chaos_prob_bumpy 600
//Changing Pitch
chaos_prob_change_pitch 100
//Color Incorrection
chaos_prob_random_cc 100
Expand Down
6 changes: 6 additions & 0 deletions sourcemods/ep2chaos/cfg/autoexec.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ chaos_time_no_brake 1
//Bumpy Road
chaos_time_bumpy 1
//Changing Pitch
chaos_time_change_pitch 1
//Color Incorrection
chaos_time_random_cc 1
Expand Down Expand Up @@ -226,6 +229,9 @@ chaos_prob_no_brake 600
//Bumpy Road
chaos_prob_bumpy 600
//Changing Pitch
chaos_prob_change_pitch 100
//Color Incorrection
chaos_prob_random_cc 100
Expand Down
49 changes: 49 additions & 0 deletions sourcemods/ep2chaos/particles/particles_manifest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
particles_manifest
{
"file" "particles/error.pcf"
"file" "particles/explosion.pcf"
"file" "particles/blood_impact.pcf"
"file" "particles/vehicle.pcf"
"file" "particles/dust_bombdrop.pcf"
"file" "particles/building_explosion.pcf"
"file" "particles/antlion_gib_01.pcf"
"file" "particles/antlion_gib_02.pcf"
"file" "particles/stalactite.pcf"
"file" "particles/striderbuster.pcf"
"file" "particles/door_explosion.pcf"
"file" "particles/choreo_launch.pcf"
"file" "particles/water_leaks.pcf"
"file" "particles/antlion_worker.pcf"
"file" "particles/skybox_smoke.pcf"
"file" "particles/waterfall.pcf"
"file" "particles/aurora.pcf"
"file" "particles/rain.pcf"
"file" "particles/warpshield.pcf"
"file" "particles/aurora_sphere2.pcf"
"file" "particles/advisor.pcf"
"file" "particles/fire_01.pcf"
"file" "particles/hunter_shield_impact.pcf"
"file" "particles/water_impact.pcf"
"file" "particles/hunter_intro.pcf"
"file" "particles/dust_rumble.pcf"
"file" "particles/Advisor_FX.pcf"
"file" "particles/hunter_projectile.pcf"
"file" "particles/choreo_dog_v_strider.pcf"
"file" "particles/steampuff.pcf"
"file" "particles/magnusson_burner.pcf"
"file" "particles/combineball.pcf"
"file" "particles/waterdrips.pcf"
"file" "particles/hunter_flechette.pcf"
"file" "particles/choreo_gman.pcf"
"file" "particles/weapon_fx.pcf"
"file" "particles/choreo_extract.pcf"
"file" "particles/Vortigaunt_FX.pcf"
"file" "particles/devtest.pcf"
"file" "particles/electrical_fx.pcf"
"file" "particles/burning_fx.pcf"
"file" "particles/antlion_blood.pcf"
"file" "particles/grub_blood.pcf"
"file" "particles/grenade_fx.pcf"
"file" "particles/rocket_fx.pcf"
"file" "particles/impact_fx.pcf"
}
6 changes: 6 additions & 0 deletions sourcemods/hl2chaos/cfg/autoexec.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ chaos_time_no_brake 1
//Bumpy Road
chaos_time_bumpy 1
//Changing Pitch
chaos_time_change_pitch 1
//Color Incorrection
chaos_time_random_cc 1
Expand Down Expand Up @@ -226,6 +229,9 @@ chaos_prob_no_brake 600
//Bumpy Road
chaos_prob_bumpy 600
//Changing Pitch
chaos_prob_change_pitch 100
//Color Incorrection
chaos_prob_random_cc 100
Expand Down
7 changes: 7 additions & 0 deletions sp/src/game/server/hl2/chaos.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ enum Effect_T
EFFECT_NORMAL_VISION,
EFFECT_GIVE_ALL_RPG,
EFFECT_GRASS_HEAL,
EFFECT_CHANGE_PITCH,
//EFFECT_EVIL_ELI,
//EFFECT_EVIL_BREEN,

Expand Down Expand Up @@ -580,4 +581,10 @@ class CEGiveAllRPG : public CChaosEffect
public:
void StartEffect() override;
};
class CEChangePitch : public CChaosEffect
{
public:
void MaintainEffect() override;
void StopEffect() override;
};
#endif
22 changes: 21 additions & 1 deletion sp/src/game/server/hl2/hl2_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5343,6 +5343,7 @@ ConVar chaos_time_yawroll("chaos_time_yawroll", "1");
ConVar chaos_time_zombiespam("chaos_time_zombiespam", "1");
ConVar chaos_time_normalvision("chaos_time_normalvision", "1");
ConVar chaos_time_grass_heal("chaos_time_grass_heal", "1");
ConVar chaos_time_change_pitch("chaos_time_change_pitch", "1");

ConVar chaos_prob_zerog("chaos_prob_zerog", "100");
ConVar chaos_prob_superg("chaos_prob_superg", "100");
Expand Down Expand Up @@ -5428,6 +5429,7 @@ ConVar chaos_prob_yawroll("chaos_prob_yawroll", "100");
ConVar chaos_prob_normalvision("chaos_prob_normalvision", "100");
ConVar chaos_prob_giveallrpg("chaos_prob_giveallrpg", "100");
ConVar chaos_prob_grass_heal("chaos_prob_grass_heal", "100");
ConVar chaos_prob_change_pitch("chaos_prob_change_pitch", "100");
//ConVar chaos_prob_evil_eli("chaos_prob_evil_eli", "100");
//ConVar chaos_prob_evil_breen("chaos_prob_evil_breen", "100");
#define ERROR_WEIGHT 1
Expand Down Expand Up @@ -5518,6 +5520,7 @@ void CHL2_Player::PopulateEffects()
CreateEffect<>(EFFECT_NORMAL_VISION, MAKE_STRING("Normal Vision"), EC_NONE, chaos_time_normalvision.GetFloat(), chaos_prob_normalvision.GetInt());
CreateEffect<CEGiveAllRPG>(EFFECT_GIVE_ALL_RPG, MAKE_STRING("Give Everyone RPGs"), EC_NONE, -1, chaos_prob_giveallrpg.GetInt());
CreateEffect<CEFloorEffect>(EFFECT_GRASS_HEAL, MAKE_STRING("Touch the Grass"), EC_NONE, chaos_time_grass_heal.GetFloat(), chaos_prob_grass_heal.GetInt());
CreateEffect<CEChangePitch>(EFFECT_CHANGE_PITCH, MAKE_STRING("Changing Pitch"), EC_NONE, chaos_time_change_pitch.GetFloat(), chaos_prob_change_pitch.GetInt());
//CreateEffect<CEEvilNPC>(EFFECT_EVIL_ELI, MAKE_STRING("Evil Eli"), EC_HAS_WEAPON, -1, chaos_prob_evil_eli.GetInt());
//CreateEffect<CEEvilNPC>(EFFECT_EVIL_BREEN, MAKE_STRING("Hands-on Dr. Breen"), EC_HAS_WEAPON, -1, chaos_prob_evil_breen.GetInt());
}
Expand Down Expand Up @@ -6239,10 +6242,14 @@ void CChaosEffect::RestoreEffect()
StartEffect();
}

//Do not restore:
//Do not include:
//Simple convar changes or any other thing that isn't affected by world state.
//Transient things, unless they have an override RestoreEffect. If spawned entities wish to persist through saves they have their own thing.
//Effects that can survive on MaintainEffect or FastThink.

//do include:
//changes variables of existing entities
//makes entities that should persist (but dont use the 'chaos spawned' variable)
bool CChaosEffect::DoRestorationAbort()
{
switch (m_nID)
Expand Down Expand Up @@ -6278,6 +6285,9 @@ bool CChaosEffect::DoRestorationAbort()
//alters triggers
case EFFECT_SOLID_TRIGGERS:

//alters scene ents
case EFFECT_CHANGE_PITCH:

//gone forever if not restarted
case EFFECT_EARTHQUAKE:

Expand Down Expand Up @@ -9342,4 +9352,14 @@ void CEGiveAllRPG::StartEffect()
pNPC->GiveWeapon(MAKE_STRING("weapon_rpg"));
pEnt = gEntList.FindEntityByClassname(pEnt, "npc*");
}
}
void CEChangePitch::MaintainEffect()
{
//the convar allows us to hit instanced scenes at their moment of creation.
float flPitch = RandomFloat(0.25, 2.5);
engine->ClientCommand(engine->PEntityOfEntIndex(1), "scene_pitch_default %f; ent_fire logic_choreographed_scene pitchshift %f\n", flPitch, flPitch);
}
void CEChangePitch::StopEffect()
{
engine->ClientCommand(engine->PEntityOfEntIndex(1), "scene_pitch_default 1; ent_fire logic_choreographed_scene pitchshift 1\n");
}
12 changes: 8 additions & 4 deletions sp/src/game/server/sceneentity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CBaseFlex;

static ConVar scene_forcecombined( "scene_forcecombined", "0", 0, "When playing back, force use of combined .wav files even in english." );
static ConVar scene_maxcaptionradius( "scene_maxcaptionradius", "1200", 0, "Only show closed captions if recipient is within this many units of speaking actor (0==disabled)." );

ConVar scene_pitch_default("scene_pitch_default", "1");
// Assume sound system is 100 msec lagged (only used if we can't find snd_mixahead cvar!)
#define SOUND_SYSTEM_LATENCY_DEFAULT ( 0.1f )

Expand Down Expand Up @@ -748,7 +748,7 @@ CSceneEntity::CSceneEntity( void )
m_bIsPlayingBack = false;
m_bPaused = false;
m_bMultiplayer = false;
m_fPitch = 1.0f;
m_fPitch = scene_pitch_default.GetFloat();
m_iszSceneFile = NULL_STRING;
m_iszResumeSceneFile = NULL_STRING;
m_hWaitingForThisResumeScene = NULL;
Expand Down Expand Up @@ -1069,7 +1069,7 @@ void CSceneEntity::OnRestore()

// Fix saved games that have their pitch set to zero
if ( m_fPitch < SCENE_MIN_PITCH || m_fPitch > SCENE_MAX_PITCH )
m_fPitch = 1.0f;
m_fPitch = scene_pitch_default.GetFloat();

if ( !m_bIsPlayingBack )
return;
Expand Down Expand Up @@ -2738,7 +2738,10 @@ void CSceneEntity::PitchShiftPlayback( float fPitch )

if ( !m_pScene )
return;

//this code was leading to voice lines playing twice, once old pitch, once new pitch, and potentially from the wrong actor.
//removing this means the currently spoken line, if any, will not instantly change pitch, which is definitely less confusing.
//the underlying bug appears to be in engine code.
/*
for ( int iActor = 0 ; iActor < m_pScene->GetNumActors(); ++iActor )
{
CBaseFlex *pTestActor = FindNamedActor( iActor );
Expand All @@ -2758,6 +2761,7 @@ void CSceneEntity::PitchShiftPlayback( float fPitch )
pTestActor->EmitSound( filter, pTestActor->entindex(), params );
}
}
*/
}

//-----------------------------------------------------------------------------
Expand Down

0 comments on commit 4930344

Please sign in to comment.