diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 02999812a65..258258e35e7 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -186,7 +186,7 @@ jobs: run: | cp -r valve/game/jbmod game/jbmod_base cp -r game/jbmod/* game/jbmod_base/ - vpk-ctrl -b game/jbmod_base game/jbmod_base/*.cfg game/jbmod_base/*.txt !game/jbmod_base/gameinfo.txt !game/jbmod_base/steam.inf game/jbmod_base/cfg !game/jbmod_base/cfg/*_example.txt !game/jbmod_base/cfg/settings.scr game/jbmod_base/maps !game/jbmod_base/maps/*.bsp game/jbmod_base/materials game/jbmod_base/media game/jbmod_base/models game/jbmod_base/resource !game/jbmod_base/resource/*.ico !game/jbmod_base/resource/*.ttf game/jbmod_base/scripts game/jbmod_base/servers game/jbmod_base/sound > pak01.vdf + vpk-ctrl -b game/jbmod_base game/jbmod_base/*.cfg game/jbmod_base/*.txt !game/jbmod_base/gameinfo.txt !game/jbmod_base/steam.inf game/jbmod_base/cfg !game/jbmod_base/cfg/autoexec.cfg !game/jbmod_base/cfg/*_example.txt !game/jbmod_base/cfg/settings.scr game/jbmod_base/maps !game/jbmod_base/maps/*.bsp game/jbmod_base/materials game/jbmod_base/media game/jbmod_base/models game/jbmod_base/resource !game/jbmod_base/resource/*.ico !game/jbmod_base/resource/*.ttf game/jbmod_base/scripts game/jbmod_base/servers game/jbmod_base/sound > pak01.vdf vpk -M -P -K privatekey.vdf -k publickey.vdf k game/jbmod_base/jbmod_pak pak01.vdf cp pak01.vdf pak01.vdf.bak vpk-cleaner -c pak01.vdf game/jbmod_base game/jbmod_clean diff --git a/game/jbmod/cfg/autoexec.cfg b/game/jbmod/cfg/autoexec.cfg index 2db53feee8d..02190b8dd13 100644 --- a/game/jbmod/cfg/autoexec.cfg +++ b/game/jbmod/cfg/autoexec.cfg @@ -3,4 +3,4 @@ sv_allowdownload "0" cl_allowupload "0" cl_allowdownload "0" cl_downloadfilter "mapsonly" -cl_playerspraydisable "1" \ No newline at end of file +cl_spraydisable "1" diff --git a/game/jbmod/resource/clientscheme.res b/game/jbmod/resource/clientscheme.res index 7e7213af955..ca644826fd1 100644 --- a/game/jbmod/resource/clientscheme.res +++ b/game/jbmod/resource/clientscheme.res @@ -1273,7 +1273,7 @@ Scheme "7" "resource/linux_fonts/DejaVuSans-BoldOblique.ttf" "8" "resource/linux_fonts/DejaVuSans-Oblique.ttf" "9" "resource/linux_fonts/LiberationSans-Regular.ttf" - "10" "resource/linux_fonts/LiberationSans-Bold.ttf" + "10" "resource/linux_fonts/LiberationSans-Bold.ttf" "11" "resource/linux_fonts/LiberationMono-Regular.ttf" "12" "resource/GorDIN-Regular.ttf" diff --git a/game/jbmod/resource/halflife2.ttf b/game/jbmod/resource/halflife2.ttf index d4555ad85f0..059ed7c206c 100644 Binary files a/game/jbmod/resource/halflife2.ttf and b/game/jbmod/resource/halflife2.ttf differ diff --git a/game/jbmod/scripts/vscripts/gamemodes/sandbox.nut b/game/jbmod/scripts/vscripts/gamemodes/sandbox.nut index ea7144a866e..e570c15bb3e 100644 --- a/game/jbmod/scripts/vscripts/gamemodes/sandbox.nut +++ b/game/jbmod/scripts/vscripts/gamemodes/sandbox.nut @@ -12,9 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -printl( "Initializing Sandbox Game Mode..." ); +printl( "Initializing Sandbox..." ); SetGameDescription( "JBMod Sandbox" ); Convars.SetValue( "sv_infinite_aux_power", 1 ); +Convars.SetValue( "mp_falldamage", 1 ); function OnPlayerSpawn( player ) { diff --git a/game/jbmod/scripts/weapon_alyxgun.txt b/game/jbmod/scripts/weapon_alyxgun.txt new file mode 100644 index 00000000000..d29c322dafd --- /dev/null +++ b/game/jbmod/scripts/weapon_alyxgun.txt @@ -0,0 +1,63 @@ +// Alyx Gun + +WeaponData +{ + // Weapon data is loaded by both the Game and Client DLLs. + "printname" "#HL2_AlyxGun" + "viewmodel" "models/weapons/W_Alyx_Gun.mdl" + "playermodel" "models/weapons/W_Alyx_Gun.mdl" //FIXME: + "anim_prefix" "alyxgun" + "bucket" "1" + "bucket_position" "4" + + "clip_size" "30" + "clip2_size" "-1" + + "default_clip" "30" + "default_clip2" "-1" + + "primary_ammo" "AlyxGun" + + "weight" "2" + "item_flags" "0" + + // Sounds for the weapon. There is a max of 16 sounds per category (i.e. max 16 "single_shot" sounds) + SoundData + { + + "reload" "Weapon_Alyx_Gun.Reload" + "reload_npc" "Weapon_Alyx_Gun.NPC_Reload" + "empty" "Weapon_Alyx_Gun.Empty" + "single_shot" "Weapon_Alyx_Gun.Single" + "single_shot_npc" "Weapon_Alyx_Gun.NPC_Single" + "special1" "Weapon_Alyx_Gun.Special1" + "special2" "Weapon_Alyx_Gun.Special2" + "burst" "Weapon_Alyx_Gun.Burst" + } + + // Weapon Sprite data is loaded by the Client DLL. + TextureData + { + "ammo" + { + "font" "WeaponIconsSmall" + "character" "p" + } + "crosshair" + { + "file" "sprites/crosshairs" + "x" "0" + "y" "48" + "width" "24" + "height" "24" + } + "autoaim" + { + "file" "sprites/crosshairs" + "x" "0" + "y" "48" + "width" "24" + "height" "24" + } + } +} \ No newline at end of file diff --git a/game/jbmod/scripts/weapon_citizenpackage.txt b/game/jbmod/scripts/weapon_citizenpackage.txt new file mode 100644 index 00000000000..0a3d1afe587 --- /dev/null +++ b/game/jbmod/scripts/weapon_citizenpackage.txt @@ -0,0 +1,67 @@ +// Citizen package. Not really a weapon, just needs to be a visible model for citizens to open. + +WeaponData +{ + // Weapon data is loaded by both the Game and Client DLLs. + "printname" "#HL2_CitizenPackage" + "viewmodel" "models/weapons/w_package.mdl" + "playermodel" "models/weapons/w_package.mdl" + "anim_prefix" "smg2" + "bucket" "5" + "bucket_position" "18" + + "clip_size" "-1" + "clip2_size" "-1" + + "default_clip" "-1" + "default_clip2" "-1" + + "primary_ammo" "None" + "secondary_ammo" "None" + + "weight" "0" + "item_flags" "0" + + // Sounds for the weapon. There is a max of 16 sounds per category (i.e. max 16 "single_shot" sounds) + SoundData + { + } + + // Weapon Sprite data is loaded by the Client DLL. + TextureData + { + "weapon" + { + "font" "WeaponIcons" + "character" "b" + } + "weapon_s" + { + "font" "WeaponIconsSelected" + "character" "b" + } + "weapon_small" + { + "font" "WeaponIconsSmall" + "character" "b" + } + "ammo" + { + "font" "WeaponIconsSmall" + "character" "s" + } + "crosshair" + { + "font" "Crosshairs" + "character" "Q" + } + "autoaim" + { + "file" "sprites/crosshairs" + "x" "0" + "y" "48" + "width" "24" + "height" "24" + } + } +} \ No newline at end of file diff --git a/game/jbmod/scripts/weapon_citizensuitcase.txt b/game/jbmod/scripts/weapon_citizensuitcase.txt new file mode 100644 index 00000000000..0d089b72c95 --- /dev/null +++ b/game/jbmod/scripts/weapon_citizensuitcase.txt @@ -0,0 +1,67 @@ +// Citizen package. Not really a weapon, just needs to be a visible model for citizens to open. + +WeaponData +{ + // Weapon data is loaded by both the Game and Client DLLs. + "printname" "#HL2_CitizenSuitcase" + "viewmodel" "models/weapons/w_suitcase_passenger.mdl" + "playermodel" "models/weapons/w_suitcase_passenger.mdl" + "anim_prefix" "smg2" + "bucket" "5" + "bucket_position" "17" + + "clip_size" "-1" + "clip2_size" "-1" + + "default_clip" "-1" + "default_clip2" "-1" + + "primary_ammo" "None" + "secondary_ammo" "None" + + "weight" "0" + "item_flags" "0" + + // Sounds for the weapon. There is a max of 16 sounds per category (i.e. max 16 "single_shot" sounds) + SoundData + { + } + + // Weapon Sprite data is loaded by the Client DLL. + TextureData + { + "weapon" + { + "font" "WeaponIcons" + "character" "b" + } + "weapon_s" + { + "font" "WeaponIconsSelected" + "character" "b" + } + "weapon_small" + { + "font" "WeaponIconsSmall" + "character" "b" + } + "ammo" + { + "font" "WeaponIconsSmall" + "character" "s" + } + "crosshair" + { + "font" "Crosshairs" + "character" "Q" + } + "autoaim" + { + "file" "sprites/crosshairs" + "x" "0" + "y" "48" + "width" "24" + "height" "24" + } + } +} \ No newline at end of file diff --git a/game/jbmod/scripts/weapon_oldmanharpoon.txt b/game/jbmod/scripts/weapon_oldmanharpoon.txt new file mode 100644 index 00000000000..9343eed23fe --- /dev/null +++ b/game/jbmod/scripts/weapon_oldmanharpoon.txt @@ -0,0 +1,72 @@ +WeaponData +{ + // Weapon data is loaded by both the Game and Client DLLs. + "printname" "#HL2_SMG1" + "viewmodel" "models/lostcoast/fisherman/harpoon.mdl" + "playermodel" "models/lostcoast/fisherman/harpoon.mdl" + "anim_prefix" "smg2" + "bucket" "2" + "bucket_position" "0" + + "clip_size" "-1" + "clip2_size" "-1" + + "default_clip" "-1" + "default_clip2" "-1" + + "primary_ammo" "None" + "secondary_ammo" "None" + + "weight" "0" + "item_flags" "0" + + // Sounds for the weapon. There is a max of 16 sounds per category (i.e. max 16 "single_shot" sounds) + SoundData + { + } + + // Weapon Sprite data is loaded by the Client DLL. + TextureData + { + "weapon" + { + "file" "sprites/w_icons1" + "x" "128" + "y" "128" + "width" "128" + "height" "64" + } + "weapon_s" + { + "file" "sprites/w_icons1b" + "x" "128" + "y" "128" + "width" "128" + "height" "64" + } + "ammo" + { + "file" "sprites/a_icons1" + "x" "55" + "y" "60" + "width" "73" + "height" "15" + } + "crosshair" + { + "file" "sprites/crosshairs" + "x" "0" + "y" "48" + "width" "24" + "height" "24" + } + "autoaim" + { + "file" "sprites/crosshairs" + "x" "0" + "y" "48" + "width" "24" + "height" "24" + } + } +} \ No newline at end of file diff --git a/src/game/client/c_baseentity.cpp b/src/game/client/c_baseentity.cpp index adbd3914412..6b65e3d908d 100644 --- a/src/game/client/c_baseentity.cpp +++ b/src/game/client/c_baseentity.cpp @@ -1962,6 +1962,9 @@ int C_BaseEntity::DrawBrushModel( bool bDrawingTranslucency, int nFlags, bool bT // Identity brushes are drawn in view->DrawWorld as an optimization Assert ( modelinfo->GetModelType( model ) == mod_brush ); + if ( !render ) + return 0; + ERenderDepthMode DepthMode = DEPTH_MODE_NORMAL; if ( ( nFlags & STUDIO_SSAODEPTHTEXTURE ) != 0 ) { diff --git a/src/game/client/c_baseplayer.cpp b/src/game/client/c_baseplayer.cpp index 76d669377d6..bf7f0b2f407 100644 --- a/src/game/client/c_baseplayer.cpp +++ b/src/game/client/c_baseplayer.cpp @@ -2892,6 +2892,16 @@ bool C_BasePlayer::GetSteamID( CSteamID *pID ) return false; } +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +const Vector& C_BasePlayer::GetRenderOrigin(void) +{ + if ( IsInAVehicle() ) + InvalidateBoneCache(); + return BaseClass::GetRenderOrigin(); +} + #if defined USES_ECON_ITEMS //----------------------------------------------------------------------------- // Purpose: Update the visibility of our worn items. diff --git a/src/game/client/c_baseplayer.h b/src/game/client/c_baseplayer.h index 11a7fabca88..164cfdeb87e 100644 --- a/src/game/client/c_baseplayer.h +++ b/src/game/client/c_baseplayer.h @@ -83,6 +83,8 @@ class C_BasePlayer : public C_BaseCombatCharacter, public CGameEventListener virtual void SharedSpawn(); // Shared between client and server. virtual bool GetSteamID( CSteamID *pID ); + virtual const Vector& GetRenderOrigin(); + // IClientEntity overrides. virtual void OnPreDataChanged( DataUpdateType_t updateType ); virtual void OnDataChanged( DataUpdateType_t updateType ); diff --git a/src/game/client/c_prop_vehicle.cpp b/src/game/client/c_prop_vehicle.cpp index d093656ffff..c208f100129 100644 --- a/src/game/client/c_prop_vehicle.cpp +++ b/src/game/client/c_prop_vehicle.cpp @@ -203,6 +203,7 @@ void C_PropVehicleDriveable::DampenEyePosition( Vector &vecVehicleEyePos, QAngle //----------------------------------------------------------------------------- void C_PropVehicleDriveable::GetVehicleViewPosition( int nRole, Vector *pAbsOrigin, QAngle *pAbsAngles, float *pFOV /*=NULL*/ ) { + if ( !m_hPlayer->IsLocalPlayer() ) return; SharedVehicleViewSmoothing( m_hPlayer, pAbsOrigin, pAbsAngles, m_bEnterAnimOn, m_bExitAnimOn, diff --git a/src/game/client/c_vehicle_choreo_generic.cpp b/src/game/client/c_vehicle_choreo_generic.cpp index 52eba09e125..88f2e0f5a69 100644 --- a/src/game/client/c_vehicle_choreo_generic.cpp +++ b/src/game/client/c_vehicle_choreo_generic.cpp @@ -206,6 +206,7 @@ int C_PropVehicleChoreoGeneric::GetPassengerRole( C_BaseCombatCharacter *pPassen //----------------------------------------------------------------------------- void C_PropVehicleChoreoGeneric::GetVehicleViewPosition( int nRole, Vector *pAbsOrigin, QAngle *pAbsAngles, float *pFOV /*=NULL*/ ) { + if ( !m_hPlayer->IsLocalPlayer() ) return; SharedVehicleViewSmoothing( m_hPlayer, pAbsOrigin, pAbsAngles, m_bEnterAnimOn, m_bExitAnimOn, diff --git a/src/game/client/c_vehicle_jeep.cpp b/src/game/client/c_vehicle_jeep.cpp index a59e291eebb..735294aeace 100644 --- a/src/game/client/c_vehicle_jeep.cpp +++ b/src/game/client/c_vehicle_jeep.cpp @@ -144,9 +144,11 @@ void C_PropJeep::DampenEyePosition( Vector &vecVehicleEyePos, QAngle &vecVehicle return; } +#ifndef JBMOD // Keep static the sideways motion. // Dampen forward/backward motion. DampenForwardMotion( vecVehicleEyePos, vecVehicleEyeAngles, flFrameTime ); +#endif // Blend up/down motion. DampenUpMotion( vecVehicleEyePos, vecVehicleEyeAngles, flFrameTime ); diff --git a/src/game/client/client_jbmod.vpc b/src/game/client/client_jbmod.vpc index c9d0a663297..7bf9c66456e 100644 --- a/src/game/client/client_jbmod.vpc +++ b/src/game/client/client_jbmod.vpc @@ -13,11 +13,19 @@ $Configuration { $Compiler { - $AdditionalIncludeDirectories "$BASE;jbmod\ui,.\jbmod,$SRCDIR\game\shared\jbmod,.\hl2,.\hl2\elements,$SRCDIR\game\shared\hl2" - $PreprocessorDefinitions "$BASE;JBMOD;HL2MP;HL2_CLIENT_DLL;NEXT_BOT" + $AdditionalIncludeDirectories "$BASE;jbmod\ui,.\jbmod,$SRCDIR\game\shared\jbmod,.\hl2,.\hl2\elements,$SRCDIR\game\shared\hl2,$SRCDIR\game\shared\episodic" + $PreprocessorDefinitions "$BASE;JBMOD;HL2MP;HL2_CLIENT_DLL;HL2_EPISODIC;NEXT_BOT" } } +$CustomBuildStep "nut" +{ + $CommandLine "python $SRCDIR\devtools\bin\texttoarray.py $(InputPath) g_Script_$(InputName)> $(InputName)_nut.h" [$WINDOWS] + $CommandLine "python $SRCDIR\devtools\bin\texttoarray.py $(InputPath) g_Script_$(InputName)> $(InputName)_nut.h" [$POSIX] + $Description "$(InputFileName) produces $(InputName)_nut.h" + $Outputs "$(InputName)_nut.h" +} + $Project "Client (JBMod)" { $Folder "Source Files" @@ -71,6 +79,7 @@ $Project "Client (JBMod)" $File "hl2\c_plasma_beam_node.cpp" $File "hl2\c_prop_combine_ball.cpp" $File "hl2\c_prop_combine_ball.h" + $File "episodic\c_prop_scalable.cpp" $File "hl2\c_rotorwash.cpp" $File "hl2\c_script_intro.cpp" $File "$SRCDIR\game\shared\script_intro_shared.cpp" @@ -82,12 +91,19 @@ $Project "Client (JBMod)" $File "hl2\c_vehicle_cannon.cpp" $File "hl2\c_vehicle_crane.cpp" $File "hl2\c_vehicle_crane.h" + $File "episodic\c_vehicle_jeep_episodic.cpp" $File "hl2\c_vehicle_prisoner_pod.cpp" $File "hl2\c_weapon__stubs_hl2.cpp" $File "hl2\c_weapon_crossbow.cpp" + $File "episodic\c_weapon_hopwire.cpp" $File "$SRCDIR\game\shared\hl2\citadel_effects_shared.h" $File "$SRCDIR\game\shared\hl2\env_headcrabcanister_shared.cpp" $File "$SRCDIR\game\shared\hl2\env_headcrabcanister_shared.h" + $File "$SRCDIR\game\shared\episodic\npc_advisor_shared.h" + $File "episodic\c_npc_advisor.cpp" + $File "episodic\episodic_screenspaceeffects.cpp" + $File "episodic\episodic_screenspaceeffects.h" + $File "episodic\flesh_internal_material_proxy.cpp" $File "hl2\fx_antlion.cpp" $File "hl2\fx_bugbait.cpp" $File "hl2\fx_hl2_impacts.cpp" @@ -107,16 +123,21 @@ $Project "Client (JBMod)" $File "hl2\hud_credits.cpp" $File "hl2\hud_damageindicator.cpp" $File "hl2\hud_flashlight.cpp" + $File "hl2\hud_locator.cpp" $File "hl2\hud_health.cpp" $File "hl2\hud_poisondamageindicator.cpp" $File "hl2\hud_quickinfo.cpp" + $File "hl2\hud_radar.cpp" + $File "hl2\hud_radar.h" $File "hud_squadstatus.cpp" $File "hl2\hud_suitpower.cpp" $File "hl2\hud_suitpower.h" $File "hl2\hud_weaponselection.cpp" $File "hl2\hud_zoom.cpp" $File "hl2\shieldproxy.cpp" + $File "$SRCDIR\game\shared\hl2\survival_gamerules.cpp" $File "hl2\vgui_rootpanel_hl2.cpp" + $File "episodic\c_npc_puppet.cpp" } $Folder "JBMod" @@ -126,12 +147,18 @@ $Project "Client (JBMod)" $File "jbmod\c_te_jbmod_shotgun_shot.cpp" $File "jbmod\clientmode_jbmodnormal.cpp" $File "jbmod\clientmode_jbmodnormal.h" + $File "$SRCDIR\game\shared\jbmod\jbmod_achievements.cpp" + $File "$SRCDIR\game\shared\jbmod\jbmod_achievements.h" $File "$SRCDIR\game\shared\jbmod\jbmod_gamerules.cpp" $File "$SRCDIR\game\shared\jbmod\jbmod_gamerules.h" $File "$SRCDIR\game\shared\jbmod\jbmod_player_shared.cpp" $File "$SRCDIR\game\shared\jbmod\jbmod_player_shared.h" $File "$SRCDIR\game\shared\jbmod\jbmod_weapon_parse.cpp" $File "$SRCDIR\game\shared\jbmod\jbmod_weapon_parse.h" + $File "vscript_client.cpp" + $File "$SRCDIR\game\shared\vscript_shared.cpp" + $File "vscript_client.nut" + $File "jbmod\vscript_init.cpp" $Folder "Weapons" { diff --git a/src/game/client/hl2/c_vehicle_airboat.cpp b/src/game/client/hl2/c_vehicle_airboat.cpp index 167203706c5..cc1e69ac0a5 100644 --- a/src/game/client/hl2/c_vehicle_airboat.cpp +++ b/src/game/client/hl2/c_vehicle_airboat.cpp @@ -358,8 +358,10 @@ void C_PropAirboat::DampenEyePosition( Vector &vecVehicleEyePos, QAngle &vecVehi // Keep static the sideways motion. +#ifndef JBMOD // Dampen forward/backward motion. DampenForwardMotion( vecVehicleEyePos, vecVehicleEyeAngles, flFrameTime ); +#endif // Blend up/down motion. DampenUpMotion( vecVehicleEyePos, vecVehicleEyeAngles, flFrameTime ); diff --git a/src/game/client/hl2/c_vehicle_cannon.cpp b/src/game/client/hl2/c_vehicle_cannon.cpp index 74e49ce684e..9ab4d45d346 100644 --- a/src/game/client/hl2/c_vehicle_cannon.cpp +++ b/src/game/client/hl2/c_vehicle_cannon.cpp @@ -146,6 +146,7 @@ int C_PropCannon::GetPassengerRole( C_BaseCombatCharacter *pPassenger ) //----------------------------------------------------------------------------- void C_PropCannon::GetVehicleViewPosition( int nRole, Vector *pAbsOrigin, QAngle *pAbsAngles, float *pFOV /*=NULL*/ ) { + if ( !m_hPlayer->IsLocalPlayer() ) return; SharedVehicleViewSmoothing( m_hPlayer, pAbsOrigin, pAbsAngles, m_bEnterAnimOn, m_bExitAnimOn, diff --git a/src/game/client/hl2/c_vehicle_crane.cpp b/src/game/client/hl2/c_vehicle_crane.cpp index 933bef81678..96b9fa61135 100644 --- a/src/game/client/hl2/c_vehicle_crane.cpp +++ b/src/game/client/hl2/c_vehicle_crane.cpp @@ -110,6 +110,7 @@ int C_PropCrane::GetPassengerRole( C_BaseCombatCharacter *pPassenger ) //----------------------------------------------------------------------------- void C_PropCrane::GetVehicleViewPosition( int nRole, Vector *pAbsOrigin, QAngle *pAbsAngles, float *pFOV /*=NULL*/ ) { + if ( !m_hPlayer->IsLocalPlayer() ) return; SharedVehicleViewSmoothing( m_hPlayer, pAbsOrigin, pAbsAngles, m_bEnterAnimOn, m_bExitAnimOn, diff --git a/src/game/client/hl2/c_vehicle_prisoner_pod.cpp b/src/game/client/hl2/c_vehicle_prisoner_pod.cpp index 1b78bddab8d..13c61290359 100644 --- a/src/game/client/hl2/c_vehicle_prisoner_pod.cpp +++ b/src/game/client/hl2/c_vehicle_prisoner_pod.cpp @@ -184,6 +184,7 @@ int C_PropVehiclePrisonerPod::GetPassengerRole( C_BaseCombatCharacter *pPassenge //----------------------------------------------------------------------------- void C_PropVehiclePrisonerPod::GetVehicleViewPosition( int nRole, Vector *pAbsOrigin, QAngle *pAbsAngles, float *pFOV /*=NULL*/ ) { + if ( !m_hPlayer->IsLocalPlayer() ) return; SharedVehicleViewSmoothing( m_hPlayer, pAbsOrigin, pAbsAngles, m_bEnterAnimOn, m_bExitAnimOn, diff --git a/src/game/client/hl2/c_weapon__stubs_hl2.cpp b/src/game/client/hl2/c_weapon__stubs_hl2.cpp index 68693bfc165..ab3b1839242 100644 --- a/src/game/client/hl2/c_weapon__stubs_hl2.cpp +++ b/src/game/client/hl2/c_weapon__stubs_hl2.cpp @@ -23,6 +23,9 @@ STUB_WEAPON_CLASS( weapon_cubemap, WeaponCubemap, C_BaseCombatWeapon ); STUB_WEAPON_CLASS( weapon_alyxgun, WeaponAlyxGun, C_HLSelectFireMachineGun ); STUB_WEAPON_CLASS( weapon_citizenpackage, WeaponCitizenPackage, C_BaseHLCombatWeapon ); STUB_WEAPON_CLASS( weapon_citizensuitcase, WeaponCitizenSuitcase, C_WeaponCitizenPackage ); +#ifdef JBMOD +STUB_WEAPON_CLASS( weapon_oldmanharpoon, WeaponOldManHarpoon, C_WeaponCitizenPackage ); +#endif #ifndef HL2MP STUB_WEAPON_CLASS( weapon_ar2, WeaponAR2, C_HLMachineGun ); diff --git a/src/game/client/hud_voicestatus.cpp b/src/game/client/hud_voicestatus.cpp index 1e396ffef93..2450c022507 100644 --- a/src/game/client/hud_voicestatus.cpp +++ b/src/game/client/hud_voicestatus.cpp @@ -59,7 +59,7 @@ void CHudVoiceSelfStatus::ApplySchemeSettings(vgui::IScheme *pScheme) { BaseClass::ApplySchemeSettings( pScheme ); -#ifdef HL2MP +#if defined( HL2MP ) || defined( JBMOD ) SetBgColor( Color( 0, 0, 0, 0 ) ); #endif } @@ -101,6 +101,8 @@ class CHudVoiceStatus : public CHudElement, public vgui::Panel virtual void Paint(); virtual void VidInit(); virtual void Init(); + virtual void LevelInit(); + virtual void LevelShutdown(); virtual void OnThink(); virtual void ApplySchemeSettings(vgui::IScheme *pScheme); @@ -188,7 +190,7 @@ void CHudVoiceStatus::ApplySchemeSettings(vgui::IScheme *pScheme) { BaseClass::ApplySchemeSettings( pScheme ); -#ifdef HL2MP +#if defined( HL2MP ) || defined( JBMOD ) SetBgColor( Color( 0, 0, 0, 0 ) ); #endif } @@ -198,6 +200,15 @@ void CHudVoiceStatus::Init( void ) ClearActiveList(); } +void CHudVoiceStatus::LevelInit(void) +{ + ClearActiveList(); +} +void CHudVoiceStatus::LevelShutdown(void) +{ + ClearActiveList(); +} + void CHudVoiceStatus::VidInit( void ) { m_pVoiceIcon = gHUD.GetIcon( "voice_player" ); diff --git a/src/game/client/jbmod/c_jbmod_player.cpp b/src/game/client/jbmod/c_jbmod_player.cpp index 256c142ef07..e411a14afd5 100644 --- a/src/game/client/jbmod/c_jbmod_player.cpp +++ b/src/game/client/jbmod/c_jbmod_player.cpp @@ -217,6 +217,8 @@ void C_JBMod_Player::Initialize( void ) CStudioHdr *C_JBMod_Player::OnNewModel( void ) { CStudioHdr *hdr = BaseClass::OnNewModel(); + if ( !hdr ) + return NULL; Initialize( ); @@ -799,16 +801,7 @@ void C_JBMod_Player::HandleSpeedChanges( CMoveData *mv ) { if ( bWantSprint ) { - if ( m_HL2Local.m_flSuitPower < 10.0f ) - { - if ( bJustPressedSpeed ) - { - CPASAttenuationFilter filter( this ); - filter.UsePredictionRules(); - EmitSound( filter, entindex(), "HL2Player.SprintNoPower" ); - } - } - else + if ( m_HL2Local.m_flSuitPower >= 10.0f ) { bSprinting = true; } @@ -844,12 +837,6 @@ void C_JBMod_Player::HandleSpeedChanges( CMoveData *mv ) if ( bSprinting ) { - if ( bJustPressedSpeed ) - { - CPASAttenuationFilter filter( this ); - filter.UsePredictionRules(); - EmitSound( filter, entindex(), "HL2Player.SprintStart" ); - } mv->m_flClientMaxSpeed = HL2_SPRINT_SPEED; } else if ( bWantWalking ) @@ -906,6 +893,7 @@ void C_JBMod_Player::ItemPreFrame( void ) { //FIXME: Held weapons like the grenade get sad when this happens m_nButtons &= ~(IN_ATTACK|IN_ATTACK2); + m_afButtonPressed &= ~(IN_ATTACK|IN_ATTACK2); } BaseClass::ItemPreFrame(); diff --git a/src/game/client/jbmod/clientmode_jbmodnormal.cpp b/src/game/client/jbmod/clientmode_jbmodnormal.cpp index 89c95982676..8de6d231945 100644 --- a/src/game/client/jbmod/clientmode_jbmodnormal.cpp +++ b/src/game/client/jbmod/clientmode_jbmodnormal.cpp @@ -18,9 +18,13 @@ #include "jbmodclientscoreboard.h" #include "jbmodtextwindow.h" #include "ienginevgui.h" +#include "jbmod_achievements.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" + +ConVar fov_desired("fov_desired", "75", FCVAR_ARCHIVE | FCVAR_USERINFO, "Sets the base field-of-view.", true, 75.0, true, 90.0); + //----------------------------------------------------------------------------- // Globals //----------------------------------------------------------------------------- @@ -122,6 +126,46 @@ void ClientModeJBModNormal::Init() { Warning( "Couldn't load combine panel scheme!\n" ); } + + CheckStartupAchievements(); + + const char *cvarsToUncheat[] = { + "cl_drawhud", + "hidehud", + NULL // End of list + }; + UnCheatConVars( cvarsToUncheat ); +} + +//----------------------------------------------------------------------------- +// Purpose: Helper to remove FCVAR_CHEAT from ConVars at runtime +// We do this instead of changing the shared code to make any future merges +// easier, and because some cvars can be defined in the engine code instead. +//----------------------------------------------------------------------------- +struct ConCommandBase_Hack +{ + void* m_pVTable; + ConCommandBase* m_pNext; + bool m_bRegistered; + const char* m_pszName; + const char* m_pszHelpString; + int m_nFlags; +}; + +void ClientModeJBModNormal::UnCheatConVars( const char **ppCVarNames ) +{ + if ( !ppCVarNames ) + return; + + for ( int i = 0; ppCVarNames[i]; i++ ) + { + ConVar *pVar = cvar->FindVar( ppCVarNames[i] ); + if ( pVar ) + { + ConCommandBase_Hack *pHack = reinterpret_cast( pVar ); + pHack->m_nFlags &= ~FCVAR_CHEAT; + } + } } diff --git a/src/game/client/jbmod/clientmode_jbmodnormal.h b/src/game/client/jbmod/clientmode_jbmodnormal.h index 457ac83792b..d7c7871fae7 100644 --- a/src/game/client/jbmod/clientmode_jbmodnormal.h +++ b/src/game/client/jbmod/clientmode_jbmodnormal.h @@ -32,6 +32,8 @@ class ClientModeJBModNormal : public ClientModeShared virtual void Init(); virtual int GetDeathMessageStartHeight( void ); + + void UnCheatConVars( const char **ppCVarNames ); }; extern IClientMode *GetClientModeNormal(); diff --git a/src/game/client/jbmod/vscript_init.cpp b/src/game/client/jbmod/vscript_init.cpp new file mode 100644 index 00000000000..cee729c8038 --- /dev/null +++ b/src/game/client/jbmod/vscript_init.cpp @@ -0,0 +1,59 @@ +// Copyright 2026 The JBMod Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "cbase.h" +//#include "vscript_vgui.h" +#include "vscript_shared.h" +#include "igamesystem.h" +#include "icommandline.h" +#include "client_factorylist.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +IScriptManager *scriptmanager = NULL; + +class CScriptGameSystem : public CAutoGameSystem +{ +public: + CScriptGameSystem() : CAutoGameSystem( "CScriptGameSystem" ) {} + + virtual bool Init() + { + factorylist_t factories; + FactoryList_Retrieve( factories ); + + if ( factories.appSystemFactory && !CommandLine()->CheckParm( "-noscripting" ) ) + { + scriptmanager = (IScriptManager *)factories.appSystemFactory( VSCRIPT_INTERFACE_VERSION, NULL ); + } + + return true; + } + + virtual void LevelInitPostEntity() + { + if ( g_pScriptVM ) + { + //g_pScriptVM->RegisterInstance( &g_ScriptVGUI, "vgui" ); + } + } + + virtual void LevelShutdownPreEntity() + { + //g_ScriptVGUI.DestroyAllPanels(); + } +}; + +static CScriptGameSystem g_ScriptGameSystem; diff --git a/src/game/client/movehelper_client.cpp b/src/game/client/movehelper_client.cpp index cb4b3e169ce..59c15e88616 100644 --- a/src/game/client/movehelper_client.cpp +++ b/src/game/client/movehelper_client.cpp @@ -201,11 +201,13 @@ void CMoveHelperClient::ProcessImpacts( void ) m_pHost->SetAbsVelocity( vOldAbsVel ); //m_pHost->SetLocalVelocity( vOldLocalVel ); +#ifdef DEBUG if ( vOldLocalVel != vOldAbsVel ) { Msg( "vNewLocalVel: %f %f %f\n", m_pHost->GetLocalVelocity().x, m_pHost->GetLocalVelocity().y, m_pHost->GetLocalVelocity().z ); Msg( "vNewAbsVel: %f %f %f\n\n", m_pHost->GetAbsVelocity().x, m_pHost->GetAbsVelocity().y, m_pHost->GetAbsVelocity().z ); } +#endif // So no stuff is ever left over, sigh... ResetTouchList(); diff --git a/src/game/client/physpropclientside.cpp b/src/game/client/physpropclientside.cpp index 2f5c5f3b257..eab5d82d02a 100644 --- a/src/game/client/physpropclientside.cpp +++ b/src/game/client/physpropclientside.cpp @@ -612,6 +612,7 @@ const char *C_PhysPropClientside::ParseEntity( const char *pEntData ) Error( "classname missing from entity!\n" ); } +#ifndef JBMOD if ( !Q_strcmp( className, "prop_physics_multiplayer" ) ) { // always force clientside entitis placed in maps @@ -627,6 +628,7 @@ const char *C_PhysPropClientside::ParseEntity( const char *pEntData ) return entData.CurrentBufferPosition(); } } +#endif if ( !Q_strcmp( className, "func_proprrespawnzone" ) ) { diff --git a/src/game/client/vscript_client.cpp b/src/game/client/vscript_client.cpp index 57e00dc5414..444e2d9c80d 100644 --- a/src/game/client/vscript_client.cpp +++ b/src/game/client/vscript_client.cpp @@ -14,7 +14,9 @@ #include "isaverestore.h" #include "gamerules.h" #include "vscript_client_nut.h" +#ifndef JBMOD #include "gameui/gameui_interface.h" +#endif #ifdef PANORAMA_ENABLE #include "panorama/panorama.h" @@ -263,7 +265,7 @@ bool IsEntityCreationAllowedInScripts( void ) // // Slart: These were Portal 2 only, now they're not // - +#ifdef PORTAL2 bool __MsgFunc_SetMixLayerTriggerFactor(const CCSUsrMsg_SetMixLayerTriggerFactor &msg) { int iLayerID = engine->GetMixLayerIndex(msg.layer().c_str()); @@ -299,6 +301,7 @@ class CSetMixLayerTriggerHelper : public CAutoGameSystem }; static CSetMixLayerTriggerHelper g_SetMixLayerTriggerHelper; +#endif #ifdef PANORAMA_ENABLE diff --git a/src/game/client/vscript_client.nut b/src/game/client/vscript_client.nut new file mode 100644 index 00000000000..2efd34177b9 --- /dev/null +++ b/src/game/client/vscript_client.nut @@ -0,0 +1,19 @@ +//========== Copyright © 2008, Valve Corporation, All rights reserved. ======== +// +// Purpose: +// +//============================================================================= + +function UniqueString( string = "" ) +{ + return DoUniqueString( string.tostring() ); +} + +function IncludeScript( name, scope = null ) +{ + if ( scope == null ) + { + scope = this; + } + return ::DoIncludeScript( name, scope ); +} diff --git a/src/game/server/EnvMessage.cpp b/src/game/server/EnvMessage.cpp index a22dfc114b0..557c34c7936 100644 --- a/src/game/server/EnvMessage.cpp +++ b/src/game/server/EnvMessage.cpp @@ -219,10 +219,15 @@ void CCredits::RollOutroCredits() { sv_unlockedchapters.SetValue( "15" ); +#ifdef JBMOD + CRecipientFilter user; + user.AddAllPlayers(); + user.MakeReliable(); +#else CBasePlayer *pPlayer = UTIL_GetLocalPlayer(); - CSingleUserRecipientFilter user( pPlayer ); user.MakeReliable(); +#endif UserMessageBegin( user, "CreditsMsg" ); WRITE_BYTE( 3 ); @@ -241,10 +246,15 @@ void CCredits::InputRollOutroCredits( inputdata_t &inputdata ) void CCredits::InputShowLogo( inputdata_t &inputdata ) { +#ifdef JBMOD + CRecipientFilter user; + user.AddAllPlayers(); + user.MakeReliable(); +#else CBasePlayer *pPlayer = UTIL_GetLocalPlayer(); - CSingleUserRecipientFilter user( pPlayer ); user.MakeReliable(); +#endif if ( m_flLogoLength ) { @@ -267,10 +277,15 @@ void CCredits::InputSetLogoLength( inputdata_t &inputdata ) void CCredits::InputRollCredits( inputdata_t &inputdata ) { +#ifdef JBMOD + CRecipientFilter user; + user.AddAllPlayers(); + user.MakeReliable(); +#else CBasePlayer *pPlayer = UTIL_GetLocalPlayer(); - CSingleUserRecipientFilter user( pPlayer ); user.MakeReliable(); +#endif UserMessageBegin( user, "CreditsMsg" ); WRITE_BYTE( 2 ); diff --git a/src/game/server/ai_activity.cpp b/src/game/server/ai_activity.cpp index 3e620df68f0..0adf14baae1 100644 --- a/src/game/server/ai_activity.cpp +++ b/src/game/server/ai_activity.cpp @@ -1380,6 +1380,8 @@ void CAI_BaseNPC::InitDefaultActivitySR(void) ADD_ACTIVITY_TO_SR( ACT_HL2MP_GESTURE_RELOAD_SLAM ); ADD_ACTIVITY_TO_SR( ACT_HL2MP_JUMP_SLAM ); + ADD_ACTIVITY_TO_SR( ACT_HL2MP_SIT_IN_VEHICLE ); + // Portal! ADD_ACTIVITY_TO_SR( ACT_VM_FIZZLE ); diff --git a/src/game/server/ai_basenpc.cpp b/src/game/server/ai_basenpc.cpp index ec4b17d1af0..e4d6bf8f860 100644 --- a/src/game/server/ai_basenpc.cpp +++ b/src/game/server/ai_basenpc.cpp @@ -662,6 +662,9 @@ ConVar ai_block_damage( "ai_block_damage","0" ); bool CAI_BaseNPC::PassesDamageFilter( const CTakeDamageInfo &info ) { +#ifdef JBMOD // We always want NPCs to die + return true; +#endif if ( ai_block_damage.GetBool() ) return false; // FIXME: hook a friendly damage filter to the npc instead? @@ -3222,7 +3225,10 @@ void CAI_BaseNPC::UpdateEfficiency( bool bInPVS ) } } - iSound = pCurrentSound->NextSound(); + if ( pCurrentSound ) + iSound = pCurrentSound->NextSound(); + else + break; } } @@ -3409,7 +3415,10 @@ void CAI_BaseNPC::UpdateSleepState( bool bInPVS ) break; } - iSound = pCurrentSound->NextSound(); + if ( pCurrentSound ) + iSound = pCurrentSound->NextSound(); + else + break; } } } @@ -6560,6 +6569,12 @@ float CAI_BaseNPC::ThrowLimit( const Vector &vecStart, //----------------------------------------------------------------------------- void CAI_BaseNPC::SetupVPhysicsHull() { + if ( GetModelPtr() == NULL ) + { + UTIL_Remove(this); + return; + } + if ( GetMoveType() == MOVETYPE_VPHYSICS || GetMoveType() == MOVETYPE_NONE ) return; @@ -6573,6 +6588,12 @@ void CAI_BaseNPC::SetupVPhysicsHull() IPhysicsObject *pPhysObj = VPhysicsGetObject(); if ( pPhysObj ) { + if ( !GetModelPtr() ) + { + DevMsg( "Warning: NPC has no model, removing it!\n" ); + this->Remove(); + return; + } float mass = Studio_GetMass(GetModelPtr()); if ( mass > 0 ) { diff --git a/src/game/server/ai_scriptconditions.h b/src/game/server/ai_scriptconditions.h index c1860c83e36..a7882671a37 100644 --- a/src/game/server/ai_scriptconditions.h +++ b/src/game/server/ai_scriptconditions.h @@ -38,6 +38,9 @@ class CAI_ProxTester { if ( m_distSq != 0 ) { + if ( pEntity1 == NULL || pEntity2 == NULL ) + return false; + float distSq = ( pEntity1->GetAbsOrigin() - pEntity2->GetAbsOrigin() ).LengthSqr(); bool fInside = ( distSq < m_distSq ); diff --git a/src/game/server/baseanimating.cpp b/src/game/server/baseanimating.cpp index fb59bca9ec4..c3dbb5673e8 100644 --- a/src/game/server/baseanimating.cpp +++ b/src/game/server/baseanimating.cpp @@ -2670,6 +2670,10 @@ void CBaseAnimating::SetModel( const char *szModelName ) { Msg( "Setting CBaseAnimating to non-studio model %s (type:%i)\n", szModelName, modelinfo->GetModelType( model ) ); } + if ( modelIndex == -1 ) + { + PrecacheModel( szModelName ); + } } if ( m_boneCacheHandle ) diff --git a/src/game/server/baseanimating.h b/src/game/server/baseanimating.h index 973162687e9..11c12346de8 100644 --- a/src/game/server/baseanimating.h +++ b/src/game/server/baseanimating.h @@ -73,6 +73,8 @@ class CBaseAnimating : public CBaseEntity // This defaults to off. void UseClientSideAnimation(); + void SetClientSideAnimation( bool val ) { m_bClientSideAnimation = val; }; + // Tells whether or not we're using client-side animation. Used for controlling // the transmission of animtime. bool IsUsingClientSideAnimation() { return m_bClientSideAnimation; } @@ -460,6 +462,9 @@ friend class CBlendingCycler; //----------------------------------------------------------------------------- inline CStudioHdr *CBaseAnimating::GetModelPtr( void ) { + if ( !this ) + return NULL; + if ( IsDynamicModelLoading() ) return NULL; diff --git a/src/game/server/baseentity.cpp b/src/game/server/baseentity.cpp index 306ce3709a2..357122bf03b 100644 --- a/src/game/server/baseentity.cpp +++ b/src/game/server/baseentity.cpp @@ -2509,7 +2509,8 @@ void CBaseEntity::UpdateOnRemove( void ) DevMsg( 2, "Warning: Deleting orphaned children of %s\n", GetClassname() ); for ( int i = childrenList.Count()-1; i >= 0; --i ) { - UTIL_Remove( childrenList[i] ); + if ( !childrenList[i]->IsPlayer() ) + UTIL_Remove( childrenList[i] ); } } @@ -5736,8 +5737,11 @@ void CC_Ent_Remove( const CCommand& args ) } // Found one? - if ( pEntity ) + if ( pEntity && pEntity != NULL ) { + if ( pEntity->IsPlayer() ) + return; + Msg( "Removed %s(%s)\n", STRING(pEntity->m_iClassname), pEntity->GetDebugName() ); UTIL_Remove( pEntity ); } @@ -5763,6 +5767,9 @@ void CC_Ent_RemoveAll( const CCommand& args ) (ent->m_iClassname != NULL_STRING && FStrEq(args[1], STRING(ent->m_iClassname))) || (ent->GetClassname()!=NULL && FStrEq(args[1], ent->GetClassname()))) { + if ( ent->IsPlayer() ) + continue; + UTIL_Remove( ent ); iCount++; } diff --git a/src/game/server/buttons.cpp b/src/game/server/buttons.cpp index e044dd84ee6..7ef5fb5a224 100644 --- a/src/game/server/buttons.cpp +++ b/src/game/server/buttons.cpp @@ -898,6 +898,11 @@ void CRotButton::Spawn( void ) SetUse(&CRotButton::ButtonUse); + if (HasSpawnFlags(SF_BUTTON_LOCKED)) + { + m_bLocked = true; + } + // // If touching activates the button, set its touch function. // diff --git a/src/game/server/client.cpp b/src/game/server/client.cpp index ae1840256fc..4594a87ccc6 100644 --- a/src/game/server/client.cpp +++ b/src/game/server/client.cpp @@ -949,6 +949,11 @@ void CC_Player_SetModel( const CCommand &args ) if ( gpGlobals->deathmatch ) return; +#ifdef JBMOD + Msg("Use cl_playermodel instead\n"); + return; +#endif + CBasePlayer *pPlayer = ToBasePlayer( UTIL_GetCommandClient() ); if ( pPlayer && args.ArgC() == 2) { diff --git a/src/game/server/colorcorrectionvolume.cpp b/src/game/server/colorcorrectionvolume.cpp index a56cd533e38..19f45063dd6 100644 --- a/src/game/server/colorcorrectionvolume.cpp +++ b/src/game/server/colorcorrectionvolume.cpp @@ -162,7 +162,7 @@ void CColorCorrectionVolume::Spawn( void ) bool CColorCorrectionVolume::PassesTriggerFilters( CBaseEntity *pEntity ) { - if( pEntity == UTIL_GetLocalPlayer() ) + if( pEntity->IsPlayer() ) return true; return false; diff --git a/src/game/server/env_zoom.cpp b/src/game/server/env_zoom.cpp index 2a9f8478f40..e756d1c55b3 100644 --- a/src/game/server/env_zoom.cpp +++ b/src/game/server/env_zoom.cpp @@ -74,7 +74,11 @@ float GetZoomOwnerDesiredFOV( CBaseEntity *pZoomOwner ) //----------------------------------------------------------------------------- void CEnvZoom::InputZoom( inputdata_t &inputdata ) { - CBasePlayer *pPlayer = UTIL_GetLocalPlayer(); + CBasePlayer *pPlayer; + if ( inputdata.pActivator && inputdata.pActivator->IsPlayer() ) + pPlayer = ToBasePlayer( inputdata.pActivator ); + else + pPlayer = UTIL_GetLocalPlayer(); if ( pPlayer ) { @@ -94,6 +98,9 @@ void CEnvZoom::InputZoom( inputdata_t &inputdata ) pPlayer->ClearZoomOwner(); } + if ( m_nFOV == pPlayer->GetDefaultFOV() ) + m_nFOV = 0; + //Stuff the values pPlayer->SetFOV( this, m_nFOV, m_flSpeed ); } @@ -105,7 +112,11 @@ void CEnvZoom::InputZoom( inputdata_t &inputdata ) //----------------------------------------------------------------------------- void CEnvZoom::InputUnZoom( inputdata_t &inputdata ) { - CBasePlayer *pPlayer = UTIL_GetLocalPlayer(); + CBasePlayer *pPlayer; + if ( inputdata.pActivator && inputdata.pActivator->IsPlayer() ) + pPlayer = ToBasePlayer( inputdata.pActivator ); + else + pPlayer = UTIL_GetLocalPlayer(); if ( pPlayer ) { diff --git a/src/game/server/filters.cpp b/src/game/server/filters.cpp index 6179254dd3a..cacb8803f37 100644 --- a/src/game/server/filters.cpp +++ b/src/game/server/filters.cpp @@ -372,7 +372,7 @@ class FilterDamageType : public CBaseFilter bool PassesDamageFilterImpl(const CTakeDamageInfo &info) { - return info.GetDamageType() == m_iDamageType; + return ( ( info.GetDamageType() & m_iDamageType ) == m_iDamageType ); } int m_iDamageType; diff --git a/src/game/server/fourwheelvehiclephysics.cpp b/src/game/server/fourwheelvehiclephysics.cpp index 3a70d02d793..6bf2d3a65fa 100644 --- a/src/game/server/fourwheelvehiclephysics.cpp +++ b/src/game/server/fourwheelvehiclephysics.cpp @@ -400,6 +400,8 @@ bool CFourWheelVehiclePhysics::Initialize( const char *pVehicleScript, unsigned m_flMaxSpeed = vehicle.engine.maxSpeed; IPhysicsObject *pBody = m_pOuter->VPhysicsInitNormal( SOLID_VPHYSICS, 0, false, &solid ); + if ( !pBody ) + return false; PhysSetGameFlags( pBody, FVPHYSICS_NO_SELF_COLLISIONS | FVPHYSICS_MULTIOBJECT_ENTITY ); m_pVehicle = physenv->CreateVehicleController( pBody, vehicle, nVehicleType, physgametrace ); m_wheelCount = m_pVehicle->GetWheelCount(); diff --git a/src/game/server/hl2/func_tank.cpp b/src/game/server/hl2/func_tank.cpp index a990d1291e6..ee99d11e50c 100644 --- a/src/game/server/hl2/func_tank.cpp +++ b/src/game/server/hl2/func_tank.cpp @@ -753,6 +753,12 @@ void CFuncTank::Spawn( void ) AddSolidFlags( FSOLID_NOT_SOLID ); } + CDynamicProp *pProp = dynamic_cast( GetParent() ); + if ( pProp ) + { + pProp->SetClientSideAnimation( false ); + } + m_hControlVolume = NULL; if ( GetParent() && GetParent()->GetBaseAnimating() ) @@ -1038,6 +1044,9 @@ bool CFuncTank::StartControl( CBaseCombatCharacter *pController ) m_hController->GetActiveWeapon()->Holster(); } + if ( pController->IsPlayer() ) + pController->SetNextAttack( gpGlobals->curtime + 1.0f ); + // Set the controller's position to be the use position. m_vecControllerUsePos = m_hController->GetLocalOrigin(); @@ -2159,6 +2168,8 @@ void CFuncTank::DoMuzzleFlash( void ) CEffectData data; data.m_nAttachmentIndex = m_nBarrelAttachment; data.m_nEntIndex = pAnim->entindex(); + + pAnim->GetAttachment( m_nBarrelAttachment, data.m_vOrigin ); // FIXME: Create a custom entry here! DispatchEffect( "ChopperMuzzleFlash", data ); @@ -2171,6 +2182,8 @@ void CFuncTank::DoMuzzleFlash( void ) data.m_flScale = 1.0f; data.m_fFlags = MUZZLEFLASH_COMBINE; + pAnim->GetAttachment( m_nBarrelAttachment, data.m_vOrigin ); + DispatchEffect( "MuzzleFlash", data ); } } @@ -2437,6 +2450,8 @@ LINK_ENTITY_TO_CLASS( func_tank, CFuncTankGun ); //----------------------------------------------------------------------------- void CFuncTankGun::Fire( int bulletCount, const Vector &barrelEnd, const Vector &forward, CBaseEntity *pAttacker, bool bIgnoreSpread ) { + IPredictionSystem::SuppressHostEvents( NULL ); + int i; FireBulletsInfo_t info; @@ -2963,6 +2978,7 @@ void CFuncTankAirboatGun::DoMuzzleFlash( void ) data.m_nEntIndex = m_hAirboatGunModel->entindex(); data.m_nAttachmentIndex = m_nGunBarrelAttachment; data.m_flScale = 1.0f; + m_hAirboatGunModel->GetAttachment( m_nGunBarrelAttachment, data.m_vOrigin ); DispatchEffect( "AirboatMuzzleFlash", data ); } } @@ -3554,13 +3570,19 @@ void CMortarShell::FlyThink() // Beam updates START - m_pBeamEffect[0]->SetBrightness( 255 * curve1 ); - m_pBeamEffect[0]->SetWidth( 64.0f * curve1 ); - m_pBeamEffect[0]->SetEndWidth( 64.0f * curve1 ); + if ( m_pBeamEffect[0] ) + { + m_pBeamEffect[0]->SetBrightness( 255 * curve1 ); + m_pBeamEffect[0]->SetWidth( 64.0f * curve1 ); + m_pBeamEffect[0]->SetEndWidth( 64.0f * curve1 ); + } - m_pBeamEffect[1]->SetBrightness( 255 * curve1 ); - m_pBeamEffect[1]->SetWidth( 8.0f * curve1 ); - m_pBeamEffect[1]->SetEndWidth( 8.0f * curve1 ); + if ( m_pBeamEffect[1] ) + { + m_pBeamEffect[1]->SetBrightness( 255 * curve1 ); + m_pBeamEffect[1]->SetWidth( 8.0f * curve1 ); + m_pBeamEffect[1]->SetEndWidth( 8.0f * curve1 ); + } float curve2 = Bias( lifePerc, 0.1f ); @@ -3710,13 +3732,19 @@ void CMortarShell::FadeThink( void ) // Beam updates START - m_pBeamEffect[0]->SetBrightness( 255 * curve1 ); - m_pBeamEffect[0]->SetWidth( 64.0f * curve1 ); - m_pBeamEffect[0]->SetEndWidth( 64.0f * curve1 ); + if ( m_pBeamEffect[0] ) + { + m_pBeamEffect[0]->SetBrightness( 255 * curve1 ); + m_pBeamEffect[0]->SetWidth( 64.0f * curve1 ); + m_pBeamEffect[0]->SetEndWidth( 64.0f * curve1 ); + } - m_pBeamEffect[1]->SetBrightness( 255 * curve1 ); - m_pBeamEffect[1]->SetWidth( 8.0f * curve1 ); - m_pBeamEffect[1]->SetEndWidth( 8.0f * curve1 ); + if ( m_pBeamEffect[1] ) + { + m_pBeamEffect[1]->SetBrightness( 255 * curve1 ); + m_pBeamEffect[1]->SetWidth( 8.0f * curve1 ); + m_pBeamEffect[1]->SetEndWidth( 8.0f * curve1 ); + } float curve2 = Bias( lifePerc, 0.25f ); @@ -4216,6 +4244,11 @@ void CFuncTankCombineCannon::FuncTankPostThink() Vector vecTargetPosition = GetTargetPosition(); CBasePlayer *pPlayer = AI_GetSinglePlayer(); + if ( pPlayer == NULL ) + { + CreateBeam(); + return; + } Vector vecToPlayer = pPlayer->WorldSpaceCenter() - GetAbsOrigin(); vecToPlayer.NormalizeInPlace(); diff --git a/src/game/server/hl2/item_itemcrate.cpp b/src/game/server/hl2/item_itemcrate.cpp index 20ee2ff78d1..e46b75fad4a 100644 --- a/src/game/server/hl2/item_itemcrate.cpp +++ b/src/game/server/hl2/item_itemcrate.cpp @@ -8,6 +8,9 @@ #include "props.h" #include "items.h" #include "item_dynamic_resupply.h" +#ifdef JBMOD +#include "weapon_jbmodbasehlmpcombatweapon.h" +#endif // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" @@ -233,6 +236,20 @@ void CItem_ItemCrate::OnBreak( const Vector &vecVelocity, const AngularImpulse & pItem->ActivateWhenAtRest(); } +#ifdef JBMOD + if ( pItem ) + { + pItem->SetOriginalSpawnAngles( vecAngles ); + pItem->SetOriginalSpawnOrigin( vecOrigin ); + } + CWeaponJBModBase *pWeapon = dynamic_cast( pSpawn ); + if ( pWeapon ) + { + pWeapon->SetOriginalSpawnAngles( vecAngles ); + pWeapon->SetOriginalSpawnOrigin( vecOrigin ); + } +#endif + pSpawn->Spawn(); // Avoid missing items drops by a dynamic resupply because they don't think immediately diff --git a/src/game/server/hl2/item_suit.cpp b/src/game/server/hl2/item_suit.cpp index 5441234f656..e2cf32d530f 100644 --- a/src/game/server/hl2/item_suit.cpp +++ b/src/game/server/hl2/item_suit.cpp @@ -41,8 +41,10 @@ class CItemSuit : public CItem } bool MyTouch( CBasePlayer *pPlayer ) { +#ifndef JBMOD // Pick up suit even if we have one if ( pPlayer->IsSuitEquipped() ) return FALSE; +#endif if ( m_spawnflags & SF_SUIT_SHORTLOGON ) UTIL_EmitSoundSuit(pPlayer->edict(), "!HEV_A0"); // short version of suit logon, diff --git a/src/game/server/hl2/npc_attackchopper.cpp b/src/game/server/hl2/npc_attackchopper.cpp index f5a0477f321..02051bbc6b2 100644 --- a/src/game/server/hl2/npc_attackchopper.cpp +++ b/src/game/server/hl2/npc_attackchopper.cpp @@ -4737,7 +4737,8 @@ void CNPC_AttackHelicopter::SetTransmit( CCheckTransmitInfo *pInfo, bool bAlways // Make our smoke trails always come with us for ( int i = 0; i < m_nSmokeTrailCount; i++ ) { - m_hSmokeTrail[i]->SetTransmit( pInfo, bAlways ); + if ( m_hSmokeTrail[i] ) + m_hSmokeTrail[i]->SetTransmit( pInfo, bAlways ); } } diff --git a/src/game/server/hl2/npc_manhack.cpp b/src/game/server/hl2/npc_manhack.cpp index feef84f8b79..85922131207 100644 --- a/src/game/server/hl2/npc_manhack.cpp +++ b/src/game/server/hl2/npc_manhack.cpp @@ -3007,6 +3007,8 @@ void CNPC_Manhack::OnPhysGunPickup( CBasePlayer *pPhysGunUser, PhysGunPickup_t r } else { + m_pPrevOwner.Set( GetOwnerEntity() ); + // Suppress collisions between the manhack and the player; we're currently bumping // almost certainly because it's not purely a physics object. SetOwnerEntity( pPhysGunUser ); @@ -3023,7 +3025,8 @@ void CNPC_Manhack::OnPhysGunPickup( CBasePlayer *pPhysGunUser, PhysGunPickup_t r void CNPC_Manhack::OnPhysGunDrop( CBasePlayer *pPhysGunUser, PhysGunDrop_t Reason ) { // Stop suppressing collisions between the manhack and the player - SetOwnerEntity( NULL ); + SetOwnerEntity( m_pPrevOwner.Get() ); + m_pPrevOwner.Set( NULL ); m_bHeld = false; diff --git a/src/game/server/hl2/npc_manhack.h b/src/game/server/hl2/npc_manhack.h index 17a3cedb181..cdc7bd5f83a 100644 --- a/src/game/server/hl2/npc_manhack.h +++ b/src/game/server/hl2/npc_manhack.h @@ -254,6 +254,7 @@ DECLARE_SERVERCLASS(); CSprite *m_pLightGlow; CHandle m_hSmokeTrail; + CHandle m_pPrevOwner; int m_iPanel1; int m_iPanel2; diff --git a/src/game/server/hl2/npc_playercompanion.cpp b/src/game/server/hl2/npc_playercompanion.cpp index a03a752f182..980274aff41 100644 --- a/src/game/server/hl2/npc_playercompanion.cpp +++ b/src/game/server/hl2/npc_playercompanion.cpp @@ -3538,7 +3538,7 @@ void CNPC_PlayerCompanion::InputClearAllOuputs( inputdata_t &inputdata ) typedescription_t *dataDesc = &dmap->dataDesc[i]; if ( ( dataDesc->fieldType == FIELD_CUSTOM ) && ( dataDesc->flags & FTYPEDESC_OUTPUT ) ) { - CBaseEntityOutput *pOutput = (CBaseEntityOutput *)((int)this + (int)dataDesc->fieldOffset[0]); + CBaseEntityOutput *pOutput = (CBaseEntityOutput *)((char *)this + dataDesc->fieldOffset[0]); pOutput->DeleteAllElements(); /* int nConnections = pOutput->NumberOfElements(); diff --git a/src/game/server/hl2/vehicle_airboat.cpp b/src/game/server/hl2/vehicle_airboat.cpp index f29931c0524..11d82da5df3 100644 --- a/src/game/server/hl2/vehicle_airboat.cpp +++ b/src/game/server/hl2/vehicle_airboat.cpp @@ -1572,6 +1572,8 @@ void CPropAirboat::FireGun( ) Vector vecGunPosition; Vector vecForward; GetAttachment( m_nGunBarrelAttachment, vecGunPosition, &vecForward ); + + CDisablePredictionFiltering disabler; // NOTE: For the airboat, unable to fire really means the aim is clamped Vector vecAimPoint; diff --git a/src/game/server/hl2/vehicle_crane.cpp b/src/game/server/hl2/vehicle_crane.cpp index c8e30b4ffba..7a9475bbc44 100644 --- a/src/game/server/hl2/vehicle_crane.cpp +++ b/src/game/server/hl2/vehicle_crane.cpp @@ -233,6 +233,8 @@ bool CPropCrane::CreateVPhysics( void ) //----------------------------------------------------------------------------- void CPropCrane::UpdateOnRemove( void ) { + if ( m_hPlayer != NULL ) + m_hPlayer->LeaveVehicle(); m_BoneFollowerManager.DestroyBoneFollowers(); BaseClass::UpdateOnRemove(); } @@ -404,7 +406,7 @@ bool CPropCrane::CanExitVehicle( CBaseEntity *pEntity ) void CPropCrane::DrawDebugGeometryOverlays(void) { // Draw if BBOX is on - if ( m_debugOverlays & OVERLAY_BBOX_BIT ) + if ( m_hCraneMagnet && m_debugOverlays & OVERLAY_BBOX_BIT ) { Vector vecPoint = m_hCraneMagnet->GetAbsOrigin(); int iIndex = m_hCraneMagnet->LookupAttachment("magnetcable_a"); @@ -596,7 +598,7 @@ void CPropCrane::DriveCrane( int iDriverButtons, int iButtonsPressed, float flNP //Msg("Turn: %f\nExtensionRate: %f\n", m_flTurn, m_flExtensionRate ); //If we're holding down an attack button, update our state - if ( iButtonsPressed & (IN_ATTACK | IN_ATTACK2) ) + if ( m_hCraneMagnet && iButtonsPressed & (IN_ATTACK | IN_ATTACK2) ) { // If we have something on the magnet, turn the magnet off if ( m_hCraneMagnet->GetTotalMassAttachedObjects() ) @@ -674,7 +676,7 @@ void CPropCrane::RunCraneMovement( float flTime ) if ( m_bDropping ) { // Drop until the magnet hits something - if ( m_hCraneMagnet->HasHitSomething() ) + if ( m_hCraneMagnet && m_hCraneMagnet->HasHitSomething() ) { // We hit the ground, stop dropping m_hCraneTip->m_pSpring->SetSpringConstant( CRANE_SPRING_CONSTANT_INITIAL_RAISING ); @@ -726,7 +728,7 @@ void CPropCrane::RunCraneMovement( float flTime ) */ // Play creak sounds on the magnet if there's heavy weight on it - if ( (m_flNextCreakSound < gpGlobals->curtime) && (m_hCraneMagnet->GetTotalMassAttachedObjects() > 100) ) + if ( m_hCraneMagnet && (m_flNextCreakSound < gpGlobals->curtime) && (m_hCraneMagnet->GetTotalMassAttachedObjects() > 100) ) { // Randomly play creaks from the magnet, and increase the chance based on the turning speed float flSpeedPercentage = clamp( fabs(m_flTurn) / m_flMaxTurnSpeed, 0, 1 ); diff --git a/src/game/server/hl2/vehicle_jeep.cpp b/src/game/server/hl2/vehicle_jeep.cpp index 80eb13683af..3ee75cedf98 100644 --- a/src/game/server/hl2/vehicle_jeep.cpp +++ b/src/game/server/hl2/vehicle_jeep.cpp @@ -898,6 +898,8 @@ void CPropJeep::FireCannon( void ) if ( m_bUnableToFire ) return; + CDisablePredictionFiltering disabler; + m_flCannonTime = gpGlobals->curtime + 0.2f; m_bCannonCharging = false; @@ -936,6 +938,8 @@ void CPropJeep::FireCannon( void ) //----------------------------------------------------------------------------- void CPropJeep::FireChargedCannon( void ) { + CDisablePredictionFiltering disabler; + bool penetrated = false; m_bCannonCharging = false; diff --git a/src/game/server/hl2/vehicle_prisoner_pod.cpp b/src/game/server/hl2/vehicle_prisoner_pod.cpp index 1288e082c59..7f9a4f16e52 100644 --- a/src/game/server/hl2/vehicle_prisoner_pod.cpp +++ b/src/game/server/hl2/vehicle_prisoner_pod.cpp @@ -110,6 +110,7 @@ class CPropVehiclePrisonerPod : public CPhysicsProp, public IDrivableVehicle bool ShouldForceExit() { return m_bForcedExit; } void ClearForcedExit() { m_bForcedExit = false; } + virtual void UpdateOnRemove(void); // CBaseAnimating void HandleAnimEvent( animevent_t *pEvent ); @@ -654,6 +655,17 @@ void CPropVehiclePrisonerPod::InputExitVehicle( inputdata_t &inputdata ) m_bForcedExit = true; } +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CPropVehiclePrisonerPod::UpdateOnRemove(void) +{ + if ( m_hPlayer != NULL ) + m_hPlayer->LeaveVehicle(); + + BaseClass::UpdateOnRemove(); +} + //======================================================================================================================================== // CRANE VEHICLE SERVER VEHICLE diff --git a/src/game/server/physics_impact_damage.cpp b/src/game/server/physics_impact_damage.cpp index 164568e2368..12bb5d65085 100644 --- a/src/game/server/physics_impact_damage.cpp +++ b/src/game/server/physics_impact_damage.cpp @@ -335,15 +335,28 @@ float CalculatePhysicsImpactDamage( int index, gamevcollisionevent_t *pEvent, co if ( pEvent->pObjects[otherIndex]->GetGameFlags() & FVPHYSICS_PLAYER_HELD ) { + // if the player is holding the object, use it's real mass (player holding reduced the mass) + CBasePlayer* pPlayer = NULL; if ( gpGlobals->maxClients == 1 ) { - // if the player is holding the object, use it's real mass (player holding reduced the mass) CBasePlayer *pPlayer = UTIL_GetLocalPlayer(); - if ( pPlayer ) + } + else { + for ( int i = 1; i <= gpGlobals->maxClients; i++ ) { - otherMass = pPlayer->GetHeldObjectMass( pEvent->pObjects[otherIndex] ); + CBasePlayer *tempPlayer = UTIL_PlayerByIndex( i ); + if ( tempPlayer && pEvent->pEntities[index] == tempPlayer->GetHeldObject() ) + { + pPlayer = tempPlayer; + break; + } } } + + if ( pPlayer ) + { + otherMass = pPlayer->GetHeldObjectMass( pEvent->pObjects[otherIndex] ); + } } // NOTE: sum the mass of each object in this system for the purpose of damage @@ -438,19 +451,31 @@ float CalculatePhysicsImpactDamage( int index, gamevcollisionevent_t *pEvent, co } else if ( pEvent->pObjects[index]->GetGameFlags() & FVPHYSICS_PLAYER_HELD ) { + // if the player is holding the object, use it's real mass (player holding reduced the mass) + CBasePlayer *pPlayer = NULL; if ( gpGlobals->maxClients == 1 ) { - // if the player is holding the object, use it's real mass (player holding reduced the mass) CBasePlayer *pPlayer = UTIL_GetLocalPlayer(); - if ( pPlayer ) + } else { + for (int i = 1; i <= gpGlobals->maxClients; i++) { - float mass = pPlayer->GetHeldObjectMass( pEvent->pObjects[index] ); - if ( mass > 0 ) + CBasePlayer *tempPlayer = UTIL_PlayerByIndex( i ); + if ( tempPlayer && pEvent->pEntities[index] == tempPlayer->GetHeldObject() ) { - invMass = 1.0f / mass; + pPlayer = tempPlayer; + break; } } } + + if ( pPlayer ) + { + float mass = pPlayer->GetHeldObjectMass( pEvent->pObjects[index] ); + if ( mass > 0 ) + { + invMass = 1.0f / mass; + } + } } eliminatedEnergy *= invMass * energyScale; diff --git a/src/game/server/physics_prop_ragdoll.cpp b/src/game/server/physics_prop_ragdoll.cpp index 72635ea897d..6f36fb4436c 100644 --- a/src/game/server/physics_prop_ragdoll.cpp +++ b/src/game/server/physics_prop_ragdoll.cpp @@ -942,25 +942,28 @@ void CRagdollProp::Teleport( const Vector *newPosition, const QAngle *newAngles, // we need to call the base class and it will teleport our vphysics object, // so set object 0 up and compute the origin/angles for its new position (base implementation has side effects) - VPhysicsSwapObject( m_ragdoll.list[0].pObject ); - matrix3x4_t obj0source, obj0Target; - m_ragdoll.list[0].pObject->GetPositionMatrix( &obj0source ); - ConcatTransforms( xform, obj0source, obj0Target ); - Vector obj0Pos; - QAngle obj0Angles; - MatrixAngles( obj0Target, obj0Angles, obj0Pos ); - BaseClass::Teleport( &obj0Pos, &obj0Angles, newVelocity ); + if ( m_ragdoll.list[0].pObject ) + { + VPhysicsSwapObject( m_ragdoll.list[0].pObject ); + matrix3x4_t obj0source, obj0Target; + m_ragdoll.list[0].pObject->GetPositionMatrix( &obj0source ); + ConcatTransforms( xform, obj0source, obj0Target ); + Vector obj0Pos; + QAngle obj0Angles; + MatrixAngles( obj0Target, obj0Angles, obj0Pos ); + BaseClass::Teleport( &obj0Pos, &obj0Angles, newVelocity ); - for ( int i = 1; i < m_ragdoll.listCount; i++ ) - { - matrix3x4_t matrix, newMatrix; - m_ragdoll.list[i].pObject->GetPositionMatrix( &matrix ); - ConcatTransforms( xform, matrix, newMatrix ); - m_ragdoll.list[i].pObject->SetPositionMatrix( newMatrix, true ); - UpdateNetworkDataFromVPhysics( m_ragdoll.list[i].pObject, i ); + for ( int i = 1; i < m_ragdoll.listCount; i++ ) + { + matrix3x4_t matrix, newMatrix; + m_ragdoll.list[i].pObject->GetPositionMatrix( &matrix ); + ConcatTransforms( xform, matrix, newMatrix ); + m_ragdoll.list[i].pObject->SetPositionMatrix( newMatrix, true ); + UpdateNetworkDataFromVPhysics( m_ragdoll.list[i].pObject, i ); + } + // fixup/relink object 0 + UpdateNetworkDataFromVPhysics( m_ragdoll.list[0].pObject, 0 ); } - // fixup/relink object 0 - UpdateNetworkDataFromVPhysics( m_ragdoll.list[0].pObject, 0 ); } void CRagdollProp::VPhysicsUpdate( IPhysicsObject *pPhysics ) diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp index b8a0519d245..881d2a472ae 100644 --- a/src/game/server/player.cpp +++ b/src/game/server/player.cpp @@ -199,7 +199,7 @@ ConVar player_debug_print_damage( "player_debug_print_damage", "0", FCVAR_CHEAT void CC_GiveCurrentAmmo( void ) { - CBasePlayer *pPlayer = UTIL_PlayerByIndex(1); + CBasePlayer *pPlayer = UTIL_GetCommandClient(); if( pPlayer ) { @@ -747,22 +747,31 @@ int CBasePlayer::ShouldTransmit( const CCheckTransmitInfo *pInfo ) } -bool CBasePlayer::WantsLagCompensationOnEntity( const CBasePlayer *pPlayer, const CUserCmd *pCmd, const CBitVec *pEntityTransmitBits ) const +bool CBasePlayer::WantsLagCompensationOnEntity( const CBaseEntity *pEntity, const CUserCmd *pCmd, const CBitVec *pEntityTransmitBits ) const { - // Team members shouldn't be adjusted unless friendly fire is on. - if ( !friendlyfire.GetInt() && pPlayer->GetTeamNumber() == GetTeamNumber() ) - return false; + if ( gpGlobals->teamplay ) + { + // Team members shouldn't be adjusted unless friendly fire is on. + if ( !friendlyfire.GetInt() && pEntity->GetTeamNumber() == GetTeamNumber() ) + return false; + } // If this entity hasn't been transmitted to us and acked, then don't bother lag compensating it. - if ( pEntityTransmitBits && !pEntityTransmitBits->Get( pPlayer->entindex() ) ) + if ( pEntityTransmitBits && !pEntityTransmitBits->Get( pEntity->entindex() ) ) return false; const Vector &vMyOrigin = GetAbsOrigin(); - const Vector &vHisOrigin = pPlayer->GetAbsOrigin(); + const Vector &vHisOrigin = pEntity->GetAbsOrigin(); // get max distance player could have moved within max lag compensation time, // multiply by 1.5 to to avoid "dead zones" (sqrt(2) would be the exact value) - float maxDistance = 1.5 * pPlayer->MaxSpeed() * sv_maxunlag.GetFloat(); + float maxspeed; + CBasePlayer *pPlayer = ToBasePlayer((CBaseEntity*)pEntity); + if ( pPlayer ) + maxspeed = pPlayer->MaxSpeed(); + else + maxspeed = 600; + float maxDistance = 1.5 * maxspeed * sv_maxunlag.GetFloat(); // If the player is within this distance, lag compensate them in case they're running past us. if ( vHisOrigin.DistTo( vMyOrigin ) < maxDistance ) @@ -2639,6 +2648,12 @@ void CBasePlayer::JumptoPosition(const Vector &origin, const QAngle &angles) bool CBasePlayer::SetObserverTarget(CBaseEntity *target) { + if ( target == NULL ) + { + m_hObserverTarget.Set( NULL ); + return true; + } + if ( !IsValidObserverTarget( target ) ) return false; @@ -2679,42 +2694,42 @@ bool CBasePlayer::IsValidObserverTarget(CBaseEntity * target) // MOD AUTHORS: Add checks on target here or in derived method - if ( !target->IsPlayer() ) // only track players - return false; - - CBasePlayer * player = ToBasePlayer( target ); + if ( target->IsPlayer() ) + { + CBasePlayer * player = ToBasePlayer( target ); - /* Don't spec observers or players who haven't picked a class yet - if ( player->IsObserver() ) - return false; */ + /* Don't spec observers or players who haven't picked a class yet + if ( player->IsObserver() ) + return false; */ - if( player == this ) - return false; // We can't observe ourselves. + if( player == this ) + return false; // We can't observe ourselves. - if ( player->IsEffectActive( EF_NODRAW ) ) // don't watch invisible players - return false; + if ( player->IsEffectActive( EF_NODRAW ) ) // don't watch invisible players + return false; - if ( player->m_lifeState == LIFE_RESPAWNABLE ) // target is dead, waiting for respawn - return false; + if ( player->m_lifeState == LIFE_RESPAWNABLE ) // target is dead, waiting for respawn + return false; - if ( player->m_lifeState == LIFE_DEAD || player->m_lifeState == LIFE_DYING ) - { - if ( (player->m_flDeathTime + DEATH_ANIMATION_TIME ) < gpGlobals->curtime ) + if ( player->m_lifeState == LIFE_DEAD || player->m_lifeState == LIFE_DYING ) { - return false; // allow watching until 3 seconds after death to see death animation + if ( (player->m_flDeathTime + DEATH_ANIMATION_TIME ) < gpGlobals->curtime ) + { + return false; // allow watching until 3 seconds after death to see death animation + } } - } - // check forcecamera settings for active players - if ( GetTeamNumber() != TEAM_SPECTATOR ) - { - switch ( mp_forcecamera.GetInt() ) + // check forcecamera settings for active players + if ( GetTeamNumber() != TEAM_SPECTATOR ) { - case OBS_ALLOW_ALL : break; - case OBS_ALLOW_TEAM : if ( GetTeamNumber() != target->GetTeamNumber() ) - return false; - break; - case OBS_ALLOW_NONE : return false; + switch ( mp_forcecamera.GetInt() ) + { + case OBS_ALLOW_ALL : break; + case OBS_ALLOW_TEAM : if ( GetTeamNumber() != target->GetTeamNumber() ) + return false; + break; + case OBS_ALLOW_NONE : return false; + } } } @@ -2841,6 +2856,8 @@ bool CBasePlayer::CanPickupObject( CBaseEntity *pObject, float massLimit, float } if ( pList[i]->GetGameFlags() & FVPHYSICS_NO_PLAYER_PICKUP ) return false; + if ( pList[i]->GetGameFlags() & FVPHYSICS_PLAYER_HELD ) + return false; if ( pList[i]->IsHinged() ) return false; } @@ -2890,6 +2907,11 @@ float CBasePlayer::GetHeldObjectMass( IPhysicsObject *pHeldObject ) return 0; } +CBaseEntity *CBasePlayer::GetHeldObject(void) +{ + return NULL; +} + //----------------------------------------------------------------------------- // Purpose: Server side of jumping rules. Most jumping logic is already @@ -5579,10 +5601,12 @@ bool CBasePlayer::GetInVehicle( IServerVehicle *pVehicle, int nRole ) m_Local.m_iHideHUD |= HIDEHUD_INVEHICLE; } +#ifndef JBMOD if ( !pVehicle->IsPassengerVisible( nRole ) ) { AddEffects( EF_NODRAW ); } +#endif // Put us in the vehicle pVehicle->SetPassenger( nRole, this ); @@ -5987,6 +6011,9 @@ CBaseEntity *FindPickerEntity( CBasePlayer *pPlayer ) { MDLCACHE_CRITICAL_SECTION(); + if ( pPlayer == NULL ) + return NULL; + // First try to trace a hull to an entity CBaseEntity *pEntity = FindEntityForward( pPlayer, true ); @@ -6486,6 +6513,8 @@ void CBasePlayer::CheatImpulseCommands( int iImpulse ) pEntity = FindEntityForward( this, true ); if ( pEntity ) { + if ( pEntity->IsPlayer() ) + break; UTIL_Remove( pEntity ); // if ( pEntity->m_takedamage ) // pEntity->SetThink(SUB_Remove); diff --git a/src/game/server/player.h b/src/game/server/player.h index 902e0e627ca..755bd2846f4 100644 --- a/src/game/server/player.h +++ b/src/game/server/player.h @@ -285,7 +285,7 @@ class CBasePlayer : public CBaseCombatCharacter // Returns true if this player wants pPlayer to be moved back in time when this player runs usercmds. // Saves a lot of overhead on the server if we can cull out entities that don't need to lag compensate // (like team members, entities out of our PVS, etc). - virtual bool WantsLagCompensationOnEntity( const CBasePlayer *pPlayer, const CUserCmd *pCmd, const CBitVec *pEntityTransmitBits ) const; + virtual bool WantsLagCompensationOnEntity( const CBaseEntity *pEntity, const CUserCmd *pCmd, const CBitVec *pEntityTransmitBits ) const; virtual void Spawn( void ); virtual void Activate( void ); @@ -568,6 +568,7 @@ class CBasePlayer : public CBaseCombatCharacter virtual void PickupObject( CBaseEntity *pObject, bool bLimitMassAndSize = true ) {} virtual void ForceDropOfCarriedPhysObjects( CBaseEntity *pOnlyIfHoldindThis = NULL ) {} virtual float GetHeldObjectMass( IPhysicsObject *pHeldObject ); + virtual CBaseEntity *GetHeldObject(void); void CheckSuitUpdate(); void SetSuitUpdate(const char *name, int fgroup, int iNoRepeat); diff --git a/src/game/server/props.cpp b/src/game/server/props.cpp index dec14e42d4c..253fc9f8bd2 100644 --- a/src/game/server/props.cpp +++ b/src/game/server/props.cpp @@ -5685,7 +5685,11 @@ class CPhysicsPropMultiplayer : public CPhysicsProp, public IMultiplayerPhysics CNetworkVector( m_collisionMaxs ); }; +#ifdef JBMOD +LINK_ENTITY_TO_CLASS( prop_physics_multiplayer, CPhysicsProp ); +#else LINK_ENTITY_TO_CLASS( prop_physics_multiplayer, CPhysicsPropMultiplayer ); +#endif BEGIN_DATADESC( CPhysicsPropMultiplayer ) DEFINE_KEYFIELD( m_iPhysicsMode, FIELD_INTEGER, "physicsmode" ), diff --git a/src/game/server/server_jbmod.vpc b/src/game/server/server_jbmod.vpc index 39aeeb4090f..96c1dea4d46 100644 --- a/src/game/server/server_jbmod.vpc +++ b/src/game/server/server_jbmod.vpc @@ -14,8 +14,8 @@ $Configuration { $Compiler { - $AdditionalIncludeDirectories "$BASE;$SRCDIR\game\shared\hl2,.\hl2,.\jbmod,$SRCDIR\game\shared\jbmod" - $PreprocessorDefinitions "$BASE;JBMOD;HL2MP;HL2_DLL;NEXT_BOT" + $AdditionalIncludeDirectories "$BASE;$SRCDIR\game\shared\hl2,.\hl2,.\jbmod,.\episodic,$SRCDIR\game\shared\jbmod,$SRCDIR\game\shared\episodic" + $PreprocessorDefinitions "$BASE;JBMOD;HL2MP;HL2_DLL;HL2_EPISODIC;NEXT_BOT" } } @@ -23,6 +23,8 @@ $Project "Server (JBMod)" { $Folder "Source Files" { + $File "ai_eventresponse.cpp" + $File "ai_eventresponse.h" $File "ai_relationship.cpp" $File "basegrenade_concussion.cpp" $File "basegrenade_contact.cpp" @@ -33,6 +35,7 @@ $Project "Server (JBMod)" $File "grenadethrown.h" $File "h_cycler.cpp" $File "h_cycler.h" + $File "logic_achievement.cpp" $File "monstermaker.cpp" $File "monstermaker.h" $File "physics_bone_follower.h" @@ -59,6 +62,8 @@ $Project "Server (JBMod)" $File "trigger_area_capture.h" $File "$SRCDIR\game\shared\teamplay_round_timer.cpp" $File "$SRCDIR\game\shared\teamplay_round_timer.h" + $File "vehicle_choreo_generic.cpp" + $File "$SRCDIR\game\shared\vehicle_choreo_generic_shared.h" $Folder "NextBot" { @@ -132,10 +137,20 @@ $Project "Server (JBMod)" $File "hl2\ai_allymanager.cpp" $File "hl2\ai_behavior_actbusy.cpp" $File "hl2\ai_behavior_actbusy.h" + $File "episodic\ai_behavior_alyx_injured.cpp" + $File "episodic\ai_behavior_alyx_injured.h" $File "hl2\ai_behavior_functank.cpp" $File "hl2\ai_behavior_functank.h" $File "hl2\ai_behavior_holster.cpp" $File "hl2\ai_behavior_holster.h" + $File "hl2\ai_behavior_operator.cpp" + $File "hl2\ai_behavior_operator.h" + $File "ai_behavior_passenger.cpp" + $File "ai_behavior_passenger.h" + $File "episodic\ai_behavior_passenger_companion.cpp" + $File "episodic\ai_behavior_passenger_companion.h" + $File "episodic\ai_behavior_passenger_zombie.cpp" + $File "episodic\ai_behavior_passenger_zombie.h" $File "hl2\ai_behavior_police.cpp" $File "hl2\ai_behavior_police.h" $File "hl2\ai_goal_police.cpp" @@ -180,10 +195,14 @@ $Project "Server (JBMod)" $File "hl2\grenade_bugbait.h" $File "hl2\grenade_frag.cpp" $File "hl2\grenade_frag.h" + $File "hl2\grenade_spit.cpp" + $File "hl2\grenade_spit.h" $File "hl2\hl2_ai_network.cpp" $File "hl2\hl2_eventlog.cpp" $File "$SRCDIR\game\shared\hl2\hl2_gamerules.cpp" $File "$SRCDIR\game\shared\hl2\hl2_gamerules.h" + $File "hl2\hl2_gamestats.cpp" + $File "hl2\hl2_gamestats.h" $File "hl2\hl2_player.cpp" $File "hl2\hl2_player.h" $File "$SRCDIR\game\shared\hl2\hl2_player_shared.h" @@ -196,6 +215,8 @@ $Project "Server (JBMod)" $File "$SRCDIR\game\shared\hl2\hl_gamemovement.h" $File "$SRCDIR\game\shared\hl2\hl_movedata.h" $File "hl2\hl_playermove.cpp" + $File "hl2\info_darknessmode_lightsource.cpp" + $File "hl2\info_darknessmode_lightsource.h" $File "hl2\info_teleporter_countdown.cpp" $File "hl2\item_ammo.cpp" $File "hl2\item_battery.cpp" @@ -206,11 +227,14 @@ $Project "Server (JBMod)" $File "hl2\item_suit.cpp" $File "hl2\look_door.cpp" $File "hl2\monster_dummy.cpp" - $File "hl2\npc_alyx.cpp" - $File "hl2\npc_alyx.h" + $File "$SRCDIR\game\shared\episodic\npc_advisor_shared.h" + $File "episodic\npc_advisor.cpp" + $File "hl2\npc_alyx_episodic.cpp" + $File "hl2\npc_alyx_episodic.h" $File "hl2\npc_antlion.cpp" $File "hl2\npc_antlion.h" $File "hl2\npc_antlionguard.cpp" + $File "hl2\npc_antliongrub.cpp" $File "hl2\npc_apcdriver.cpp" $File "hl2\npc_attackchopper.cpp" $File "hl2\npc_attackchopper.h" @@ -226,6 +250,7 @@ $Project "Server (JBMod)" $File "hl2\npc_bullseye.h" $File "hl2\npc_citizen17.cpp" $File "hl2\npc_citizen17.h" + $File "episodic\npc_combine_cannon.cpp" $File "hl2\npc_combine.cpp" $File "hl2\npc_combine.h" $File "hl2\npc_combinecamera.cpp" @@ -239,13 +264,17 @@ $Project "Server (JBMod)" $File "hl2\npc_dog.cpp" $File "hl2\npc_eli.cpp" $File "hl2\npc_enemyfinder.cpp" + $File "hl2\npc_fastzombie.cpp" $File "hl2\npc_fisherman.cpp" $File "hl2\npc_gman.cpp" $File "hl2\npc_headcrab.cpp" $File "hl2\npc_headcrab.h" + $File "episodic\npc_hunter.cpp" + $File "episodic\npc_hunter.h" $File "hl2\npc_ichthyosaur.cpp" $File "hl2\npc_kleiner.cpp" $File "hl2\npc_launcher.cpp" + $File "episodic\npc_magnusson.cpp" $File "hl2\npc_manhack.cpp" $File "hl2\npc_manhack.h" $File "hl2\npc_metropolice.cpp" @@ -270,9 +299,11 @@ $Project "Server (JBMod)" $File "hl2\npc_vortigaunt_episodic.cpp" $File "hl2\npc_vortigaunt_episodic.h" $File "hl2\npc_zombie.cpp" + $File "hl2\npc_zombine.cpp" $File "hl2\point_apc_controller.cpp" $File "hl2\prop_combine_ball.cpp" $File "hl2\prop_combine_ball.h" + $File "episodic\prop_scalable.cpp" $File "hl2\prop_thumper.cpp" $File "hl2\proto_sniper.cpp" $File "hl2\rotorwash.cpp" @@ -282,15 +313,30 @@ $Project "Server (JBMod)" $File "$SRCDIR\game\shared\script_intro_shared.cpp" $File "hl2\vehicle_airboat.cpp" $File "hl2\vehicle_apc.h" + $File "hl2\vehicle_cannon.cpp" $File "hl2\vehicle_crane.cpp" $File "hl2\vehicle_crane.h" + $File "hl2\vehicle_jeep.cpp" + $File "episodic\vehicle_jeep_episodic.cpp" + $File "episodic\vehicle_jeep_episodic.h" $File "hl2\vehicle_prisoner_pod.cpp" $File "hl2\vehicle_viewcontroller.cpp" + $File "hl2\weapon_alyxgun.cpp" $File "hl2\weapon_alyxgun.h" $File "hl2\weapon_annabelle.cpp" $File "hl2\weapon_bugbait.cpp" + $File "hl2\weapon_citizenpackage.cpp" + $File "hl2\weapon_citizenpackage.h" $File "hl2\weapon_crowbar.h" $File "weapon_cubemap.cpp" + $File "episodic\weapon_striderbuster.cpp" + $File "episodic\weapon_striderbuster.h" + $File "hl2\weapon_flaregun.cpp" + $File "hl2\weapon_flaregun.h" + $File "episodic\weapon_oldmanharpoon.cpp" + $File "hl2\func_bulletshield.cpp" + $File "hl2\func_bulletshield.h" + $File "episodic\npc_puppet.cpp" $Folder "unused" { @@ -303,8 +349,6 @@ $Project "Server (JBMod)" $File "hl2\npc_missiledefense.cpp" $File "hl2\vehicle_apc.cpp" $File "hl2\weapon_cguard.cpp" - $File "hl2\weapon_flaregun.cpp" - $File "hl2\weapon_flaregun.h" } } diff --git a/src/game/server/soundscape_system.cpp b/src/game/server/soundscape_system.cpp index 15793bfa8d2..376ba72405d 100644 --- a/src/game/server/soundscape_system.cpp +++ b/src/game/server/soundscape_system.cpp @@ -63,7 +63,7 @@ void CSoundscapeSystem::AddSoundscapeFile( const char *filename ) MEM_ALLOC_CREDIT(); // Open the soundscape data file, and abort if we can't KeyValues *pKeyValuesData = new KeyValues( filename ); - if ( filesystem->LoadKeyValues( *pKeyValuesData, IFileSystem::TYPE_SOUNDSCAPE, filename, "GAME" ) ) + if ( pKeyValuesData->LoadFromFile( filesystem, filename, "GAME" ) ) { // parse out all of the top level sections and save their names KeyValues *pKeys = pKeyValuesData; @@ -140,7 +140,7 @@ bool CSoundscapeSystem::Init() } KeyValues *manifest = new KeyValues( SOUNDSCAPE_MANIFEST_FILE ); - if ( filesystem->LoadKeyValues( *manifest, IFileSystem::TYPE_SOUNDSCAPE, SOUNDSCAPE_MANIFEST_FILE, "GAME" ) ) + if ( manifest->LoadFromFile( filesystem, SOUNDSCAPE_MANIFEST_FILE, "GAME" ) ) { for ( KeyValues *sub = manifest->GetFirstSubKey(); sub != NULL; sub = sub->GetNextKey() ) { diff --git a/src/game/server/vehicle_base.cpp b/src/game/server/vehicle_base.cpp index f916ba69153..7e2c27fc23a 100644 --- a/src/game/server/vehicle_base.cpp +++ b/src/game/server/vehicle_base.cpp @@ -1089,6 +1089,14 @@ void CPropVehicleDriveable::Event_KilledOther( CBaseEntity *pVictim, const CTake BaseClass::Event_KilledOther( pVictim, info ); } +void CPropVehicleDriveable::UpdateOnRemove(void) +{ + if ( m_hPlayer != NULL ) + m_hPlayer->LeaveVehicle(); + + BaseClass::UpdateOnRemove(); +} + //======================================================================================================================================== // FOUR WHEEL PHYSICS VEHICLE SERVER VEHICLE //======================================================================================================================================== diff --git a/src/game/server/vehicle_base.h b/src/game/server/vehicle_base.h index ab63005a7a0..2376990a299 100644 --- a/src/game/server/vehicle_base.h +++ b/src/game/server/vehicle_base.h @@ -208,6 +208,8 @@ class CPropVehicleDriveable : public CPropVehicle, public IDrivableVehicle, publ void StopEngine( void ); bool IsEngineOn( void ); + virtual void UpdateOnRemove( void ); + // IDrivableVehicle public: virtual CBaseEntity *GetDriver( void ); diff --git a/src/game/shared/activitylist.cpp b/src/game/shared/activitylist.cpp index edfcb66bb01..6c3bd5a4acb 100644 --- a/src/game/shared/activitylist.cpp +++ b/src/game/shared/activitylist.cpp @@ -1497,6 +1497,8 @@ void ActivityList_RegisterSharedActivities( void ) REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_GESTURE_RELOAD_SLAM ); REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_JUMP_SLAM ); + REGISTER_SHARED_ACTIVITY ( ACT_HL2MP_SIT_IN_VEHICLE ); + // Portal REGISTER_SHARED_ACTIVITY ( ACT_VM_FIZZLE ); diff --git a/src/game/shared/ai_activity.h b/src/game/shared/ai_activity.h index 3702cb839e9..dff140af5e6 100644 --- a/src/game/shared/ai_activity.h +++ b/src/game/shared/ai_activity.h @@ -1325,6 +1325,8 @@ typedef enum ACT_HL2MP_GESTURE_RELOAD_SLAM, ACT_HL2MP_JUMP_SLAM, + ACT_HL2MP_SIT_IN_VEHICLE, + // Portal! ACT_VM_FIZZLE, diff --git a/src/game/shared/basecombatweapon_shared.cpp b/src/game/shared/basecombatweapon_shared.cpp index b843026a627..b9c95a0ee94 100644 --- a/src/game/shared/basecombatweapon_shared.cpp +++ b/src/game/shared/basecombatweapon_shared.cpp @@ -1030,7 +1030,8 @@ void CBaseCombatWeapon::SetActivity( Activity act, float duration ) { //Adrian: Oh man... #if !defined( CLIENT_DLL ) && (defined( HL2MP ) || defined( PORTAL )) - SetModel( GetWorldModel() ); + if ( GetOwner()->IsPlayer() ) + SetModel( GetWorldModel() ); #endif int sequence = SelectWeightedSequence( act ); @@ -1041,7 +1042,8 @@ void CBaseCombatWeapon::SetActivity( Activity act, float duration ) //Adrian: Oh man again... #if !defined( CLIENT_DLL ) && (defined( HL2MP ) || defined( PORTAL )) - SetModel( GetViewModel() ); + if ( GetOwner()->IsPlayer() ) + SetModel( GetViewModel() ); #endif if ( sequence != ACTIVITY_NOT_AVAILABLE ) diff --git a/src/game/shared/baseentity_shared.cpp b/src/game/shared/baseentity_shared.cpp index 0194f19303f..1b3018bfcda 100644 --- a/src/game/shared/baseentity_shared.cpp +++ b/src/game/shared/baseentity_shared.cpp @@ -2514,6 +2514,10 @@ void CBaseEntity::CollisionRulesChanged() } IPhysicsObject *pList[VPHYSICS_MAX_OBJECT_LIST_COUNT]; int count = VPhysicsGetObjectList( pList, ARRAYSIZE(pList) ); + if ( count == NULL || pList == NULL ) + { + return; + } for ( int i = 0; i < count; i++ ) { if ( pList[i] != NULL ) //this really shouldn't happen, but it does >_< diff --git a/src/game/shared/baseplayer_shared.cpp b/src/game/shared/baseplayer_shared.cpp index abbd3196495..0e0aac558b7 100644 --- a/src/game/shared/baseplayer_shared.cpp +++ b/src/game/shared/baseplayer_shared.cpp @@ -679,6 +679,11 @@ void CBasePlayer::PlayStepSound( Vector &vecOrigin, surfacedata_t *psurface, flo if ( !psurface ) return; +#ifdef JBMOD + if ( GetFlags() & FL_DUCKING ) + return; +#endif + int nSide = m_Local.m_nStepside; unsigned short stepSoundName = nSide ? psurface->sounds.stepleft : psurface->sounds.stepright; if ( !stepSoundName ) @@ -1278,6 +1283,11 @@ void CBasePlayer::PlayerUse ( void ) if ( ! ((m_nButtons | m_afButtonPressed | m_afButtonReleased) & IN_USE) ) return; +#ifdef JBMOD + if ( m_nButtons & IN_ATTACK ) + return; +#endif + if ( IsObserver() ) { // do special use operation in oberserver mode diff --git a/src/game/shared/gamemovement.cpp b/src/game/shared/gamemovement.cpp index 4b79f72c531..a41c7481d1c 100644 --- a/src/game/shared/gamemovement.cpp +++ b/src/game/shared/gamemovement.cpp @@ -2185,10 +2185,21 @@ void CGameMovement::FullObserverMove( void ) float factor = sv_specspeed.GetFloat(); +#ifdef JBMOD + if ( mv->m_nButtons & IN_DUCK ) + { + factor /= sv_noclipsprint.GetFloat(); + } + if ( mv->m_nButtons & IN_SPEED ) + { + factor *= sv_noclipsprint.GetFloat(); + } +#else if ( mv->m_nButtons & IN_SPEED ) { factor /= 2.0f; } +#endif float fmove = mv->m_flForwardMove * factor; float smove = mv->m_flSideMove * factor; @@ -2261,10 +2272,22 @@ void CGameMovement::FullNoClipMove( float factor, float maxacceleration ) AngleVectors (mv->m_vecViewAngles, &forward, &right, &up); // Determine movement angles +#ifdef JBMOD + if ( mv->m_nButtons & IN_DUCK ) + { + factor /= sv_noclipsprint.GetFloat(); + } + if ( mv->m_nButtons & IN_SPEED ) + { + factor *= sv_noclipsprint.GetFloat(); + } + maxspeed = sv_maxspeed.GetFloat() * factor; +#else if ( mv->m_nButtons & IN_SPEED ) { factor /= 2.0f; } +#endif // Copy movement amounts float fmove = mv->m_flForwardMove * factor; diff --git a/src/game/shared/hl2/hl2_gamerules.cpp b/src/game/shared/hl2/hl2_gamerules.cpp index bdd5abec195..d87f0acbda5 100644 --- a/src/game/shared/hl2/hl2_gamerules.cpp +++ b/src/game/shared/hl2/hl2_gamerules.cpp @@ -1372,7 +1372,7 @@ ConVar alyx_darkness_force( "alyx_darkness_force", "0", FCVAR_CHEAT | FCVAR_REP flDamage = BaseClass::GetAmmoDamage( pAttacker, pVictim, nAmmoType ); } - if( pAttacker->IsPlayer() && pVictim->IsNPC() ) + if( pAttacker && pAttacker->IsPlayer() && pVictim->IsNPC() ) { if( pVictim->MyCombatCharacterPointer() ) { diff --git a/src/game/shared/hl2/survival_gamerules.cpp b/src/game/shared/hl2/survival_gamerules.cpp index a216fabf227..2bc23cef563 100644 --- a/src/game/shared/hl2/survival_gamerules.cpp +++ b/src/game/shared/hl2/survival_gamerules.cpp @@ -207,7 +207,7 @@ void CHalfLife2Survival::ParseSurvivalSettings( KeyValues *pSubKey ) } else if ( !stricmp( pTestKey->GetName(), "spawnhealth" ) ) { - m_SurvivalSettings.m_iSpawnHealth = pTestKey->GetInt( NULL, 100 ); + m_SurvivalSettings.m_iSpawnHealth = pTestKey->GetInt( nullptr, 100 ); } else if ( !stricmp( pTestKey->GetName(), "allowedpickups" ) ) { diff --git a/src/game/shared/jbmod/jbmod_achievements.cpp b/src/game/shared/jbmod/jbmod_achievements.cpp new file mode 100644 index 00000000000..62cd9a66820 --- /dev/null +++ b/src/game/shared/jbmod/jbmod_achievements.cpp @@ -0,0 +1,94 @@ +// Copyright 2025 The JBMod Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "cbase.h" +#include "jbmod_achievements.h" + +#ifdef CLIENT_DLL +#include "achievementmgr.h" +#include "baseachievement.h" +#include "steam/steam_api.h" +#include "vcr_shared.h" + +CAchievementMgr g_AchievementMgrJB; + +class CBaseJBModAchievement : public CBaseAchievement +{ + DECLARE_CLASS( CBaseJBModAchievement, CBaseAchievement ); +public: +}; + +//----------------------------------------------------------------------------- +// JBMOD_PLAYED: Awarded for simply playing the game. +//----------------------------------------------------------------------------- +DECLARE_MAP_EVENT_ACHIEVEMENT( ACHIEVEMENT_JBMOD_PLAYED, "JBMOD_PLAYED", 10 ); + +//----------------------------------------------------------------------------- +// JBMOD_PLAYED_ATLAUNCH: Awarded for playing on launch day (on any year). +//----------------------------------------------------------------------------- +DECLARE_MAP_EVENT_ACHIEVEMENT_HIDDEN( ACHIEVEMENT_JBMOD_PLAYED_ATLAUNCH, "JBMOD_PLAYED_ATLAUNCH", 10 ); + +//----------------------------------------------------------------------------- +// JBMOD_PLAYED_90DAYS: Awarded for playing 90 days after install. +//----------------------------------------------------------------------------- +DECLARE_MAP_EVENT_ACHIEVEMENT_HIDDEN( ACHIEVEMENT_JBMOD_PLAYED_90DAYS, "JBMOD_PLAYED_90DAYS", 10 ); + +//----------------------------------------------------------------------------- +// Startup check logic +//----------------------------------------------------------------------------- +void CheckStartupAchievements() +{ +#ifndef NO_STEAM + if ( !g_AchievementMgrJB.HasAchieved( "JBMOD_PLAYED" ) ) + { + g_AchievementMgrJB.AwardAchievement( ACHIEVEMENT_JBMOD_PLAYED ); + } + + if ( steamapicontext && steamapicontext->SteamApps() && steamapicontext->SteamUtils() ) + { + uint32 installed = steamapicontext->SteamApps()->GetEarliestPurchaseUnixTime( steamapicontext->SteamUtils()->GetAppID() ); + if ( installed > 0 ) + { + if ( !g_AchievementMgrJB.HasAchieved( "JBMOD_PLAYED_ATLAUNCH" ) ) + { + if ( installed <= 1666568334 ) // installed before October 23, 2022 + { + g_AchievementMgrJB.AwardAchievement( ACHIEVEMENT_JBMOD_PLAYED_ATLAUNCH ); + } + else + { + tm today; + VCRHook_LocalTime( &today ); + if ( today.tm_mon == 9 && today.tm_mday == 22 ) // October 22 (month is 0-indexed) + { + g_AchievementMgrJB.AwardAchievement( ACHIEVEMENT_JBMOD_PLAYED_ATLAUNCH ); + } + } + } + + if ( !g_AchievementMgrJB.HasAchieved( "JBMOD_PLAYED_90DAYS" ) ) + { + long today; + VCRHook_Time( &today); + if ( (int)today - (int)installed >= 7776000 ) // 90 * 24 * 60 * 60 = 7776000 + { + g_AchievementMgrJB.AwardAchievement( ACHIEVEMENT_JBMOD_PLAYED_90DAYS ); + } + } + } + } +#endif // NO_STEAM +} + +#endif // CLIENT_DLL diff --git a/src/game/shared/jbmod/jbmod_achievements.h b/src/game/shared/jbmod/jbmod_achievements.h new file mode 100644 index 00000000000..2d40534dc2d --- /dev/null +++ b/src/game/shared/jbmod/jbmod_achievements.h @@ -0,0 +1,34 @@ +// Copyright 2025 The JBMod Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef JBMOD_ACHIEVEMENTS_H +#define JBMOD_ACHIEVEMENTS_H +#ifdef _WIN32 +#pragma once +#endif + +#include "achievementmgr.h" + +enum +{ + ACHIEVEMENT_JBMOD_PLAYED = 1001, + ACHIEVEMENT_JBMOD_PLAYED_ATLAUNCH, + ACHIEVEMENT_JBMOD_PLAYED_90DAYS, +}; + +extern CAchievementMgr g_AchievementMgrJB; + +void CheckStartupAchievements(); + +#endif // JBMOD_ACHIEVEMENTS_H diff --git a/src/game/shared/jbmod/jbmod_gamerules.cpp b/src/game/shared/jbmod/jbmod_gamerules.cpp index 81a188476c1..4927509761f 100644 --- a/src/game/shared/jbmod/jbmod_gamerules.cpp +++ b/src/game/shared/jbmod/jbmod_gamerules.cpp @@ -649,6 +649,9 @@ void CJBModRules::ClientDisconnected( edict_t *pClient ) { pPlayer->GetTeam()->RemovePlayer( pPlayer ); } + + if ( pPlayer->IsInAVehicle() ) + pPlayer->LeaveVehicle(); } BaseClass::ClientDisconnected( pClient ); @@ -814,6 +817,14 @@ void CJBModRules::ClientSettingsChanged( CBasePlayer *pPlayer ) UTIL_LogPrintf( "\"%s\" cl_cmdrate = \"%s\"\n", pHL2Player->GetPlayerName(), engine->GetClientConVarValue( pHL2Player->entindex(), "cl_cmdrate" )); } + const char *pszFov = engine->GetClientConVarValue( pHL2Player->entindex(), "fov_desired" ); + if ( pszFov ) + { + int iFov = atoi( pszFov ); + iFov = clamp( iFov, 75, 90 ); + pHL2Player->SetDefaultFOV( iFov ); + } + BaseClass::ClientSettingsChanged( pPlayer ); #endif diff --git a/src/game/shared/jbmod/weapon_jbmodbase.cpp b/src/game/shared/jbmod/weapon_jbmodbase.cpp index dc14cc73980..9ed384f28dc 100644 --- a/src/game/shared/jbmod/weapon_jbmodbase.cpp +++ b/src/game/shared/jbmod/weapon_jbmodbase.cpp @@ -119,7 +119,7 @@ void CWeaponJBModBase::WeaponSound( WeaponSound_t sound_type, float soundtime /* if ( !te->CanPredict() ) return; - CBaseEntity::EmitSound( filter, GetPlayerOwner()->entindex(), shootsound, &GetPlayerOwner()->GetAbsOrigin() ); + CBaseEntity::EmitSound( filter, GetJBModPlayerOwner()->entindex(), shootsound, &GetJBModPlayerOwner()->GetAbsOrigin() ); #else BaseClass::WeaponSound( sound_type, soundtime ); #endif diff --git a/src/game/shared/jbmod/weapon_jbmodbase.h b/src/game/shared/jbmod/weapon_jbmodbase.h index bfa88c2aa7a..7cd234e5137 100644 --- a/src/game/shared/jbmod/weapon_jbmodbase.h +++ b/src/game/shared/jbmod/weapon_jbmodbase.h @@ -13,6 +13,9 @@ #include "jbmod_player_shared.h" #include "basecombatweapon_shared.h" #include "jbmod_weapon_parse.h" +#ifndef CLIENT_DLL +#include "ai_basenpc.h" +#endif #if defined( CLIENT_DLL ) #define CWeaponJBModBase C_WeaponJBModBase @@ -80,6 +83,8 @@ class CWeaponJBModBase : public CBaseCombatWeapon Vector GetOriginalSpawnOrigin( void ) { return m_vOriginalSpawnOrigin; } QAngle GetOriginalSpawnAngles( void ) { return m_vOriginalSpawnAngles; } + void SetOriginalSpawnOrigin( const Vector& origin ) { m_vOriginalSpawnOrigin = origin; } + void SetOriginalSpawnAngles( const QAngle& angles ) { m_vOriginalSpawnAngles = angles; } private: diff --git a/src/game/shared/jbmod/weapon_jbmodbasebasebludgeon.cpp b/src/game/shared/jbmod/weapon_jbmodbasebasebludgeon.cpp index a7edc6f35fa..20ae588ce4c 100644 --- a/src/game/shared/jbmod/weapon_jbmodbasebasebludgeon.cpp +++ b/src/game/shared/jbmod/weapon_jbmodbasebasebludgeon.cpp @@ -69,6 +69,13 @@ void CBaseJBModBludgeonWeapon::Precache( void ) BaseClass::Precache(); } +#ifndef CLIENT_DLL +int CBaseJBModBludgeonWeapon::CapabilitiesGet() +{ + return bits_CAP_WEAPON_MELEE_ATTACK1; +} +#endif + //------------------------------------------------------------------------------ // Purpose : Update weapon //------------------------------------------------------------------------------ diff --git a/src/game/shared/jbmod/weapon_jbmodbasebasebludgeon.h b/src/game/shared/jbmod/weapon_jbmodbasebasebludgeon.h index ac2cd817ef3..4c60edd6adc 100644 --- a/src/game/shared/jbmod/weapon_jbmodbasebasebludgeon.h +++ b/src/game/shared/jbmod/weapon_jbmodbasebasebludgeon.h @@ -36,6 +36,9 @@ class CBaseJBModBludgeonWeapon : public CBaseJBModCombatWeapon virtual void Spawn( void ); virtual void Precache( void ); +#ifndef CLIENT_DLL + virtual int CapabilitiesGet(void); +#endif //Attack functions virtual void PrimaryAttack( void ); diff --git a/src/game/shared/jbmod/weapon_physcannon.cpp b/src/game/shared/jbmod/weapon_physcannon.cpp index c3058e6271e..455080c0b05 100644 --- a/src/game/shared/jbmod/weapon_physcannon.cpp +++ b/src/game/shared/jbmod/weapon_physcannon.cpp @@ -810,6 +810,9 @@ void CPlayerPickupController::Use( CBaseEntity *pActivator, CBaseEntity *pCaller // +ATTACK will throw phys objects if ( m_pPlayer->m_nButtons & IN_ATTACK ) { + if ( !pPhys ) + return; + Shutdown( true ); Vector vecLaunch; m_pPlayer->EyeVectors( &vecLaunch ); @@ -2452,6 +2455,8 @@ bool CWeaponPhysCannon::CanPickupObject( CBaseEntity *pTarget ) //----------------------------------------------------------------------------- void CWeaponPhysCannon::OpenElements( void ) { + CDisablePredictionFiltering disabler; + if ( m_bOpen ) return; @@ -2480,6 +2485,8 @@ void CWeaponPhysCannon::OpenElements( void ) //----------------------------------------------------------------------------- void CWeaponPhysCannon::CloseElements( void ) { + CDisablePredictionFiltering disabler; + if ( m_bOpen == false ) return; @@ -2531,6 +2538,8 @@ float CWeaponPhysCannon::GetLoadPercentage( void ) //----------------------------------------------------------------------------- CSoundPatch *CWeaponPhysCannon::GetMotorSound( void ) { + CDisablePredictionFiltering disabler; + #ifdef CLIENT_DLL if ( m_sndMotor == NULL ) { diff --git a/src/game/shared/jbmod/weapon_rpg.cpp b/src/game/shared/jbmod/weapon_rpg.cpp index cbaad2da009..a232179cc7d 100644 --- a/src/game/shared/jbmod/weapon_rpg.cpp +++ b/src/game/shared/jbmod/weapon_rpg.cpp @@ -671,6 +671,33 @@ CMissile *CMissile::Create( const Vector &vecOrigin, const QAngle &vecAngles, ed return pMissile; } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +CUtlVector CMissile::gm_CustomDetonators; + +void CMissile::AddCustomDetonator( CBaseEntity* pEntity, float radius, float height ) +{ + int i = gm_CustomDetonators.AddToTail(); + gm_CustomDetonators[i].hEntity = pEntity; + gm_CustomDetonators[i].radiusSq = Square( radius ); + gm_CustomDetonators[i].halfHeight = height * 0.5f; +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void CMissile::RemoveCustomDetonator( CBaseEntity* pEntity ) +{ + for ( int i = 0; i < gm_CustomDetonators.Count(); i++ ) + { + if ( gm_CustomDetonators[i].hEntity == pEntity ) + { + gm_CustomDetonators.FastRemove( i ); + break; + } + } +} + //----------------------------------------------------------------------------- diff --git a/src/game/shared/jbmod/weapon_rpg.h b/src/game/shared/jbmod/weapon_rpg.h index bdd75d29ccb..a6983c6ffa2 100644 --- a/src/game/shared/jbmod/weapon_rpg.h +++ b/src/game/shared/jbmod/weapon_rpg.h @@ -70,6 +70,9 @@ class CMissile : public CBaseCombatCharacter static CMissile *Create( const Vector &vecOrigin, const QAngle &vecAngles, edict_t *pentOwner ); + static void AddCustomDetonator( CBaseEntity* pEntity, float radius, float height = -1 ); + static void RemoveCustomDetonator( CBaseEntity* pEntity ); + protected: virtual void DoExplosion(); virtual void ComputeActualDotPosition( CLaserDot *pLaserDot, Vector *pActualDotPosition, float *pHomingSpeed ); @@ -86,6 +89,15 @@ class CMissile : public CBaseCombatCharacter float m_flMarkDeadTime; float m_flDamage; + struct CustomDetonator_t + { + EHANDLE hEntity; + float radiusSq; + float halfHeight; + }; + + static CUtlVector gm_CustomDetonators; + private: float m_flGracePeriodEndsAt; diff --git a/src/game/shared/movevars_shared.cpp b/src/game/shared/movevars_shared.cpp index df89471f60e..6955f0273bf 100644 --- a/src/game/shared/movevars_shared.cpp +++ b/src/game/shared/movevars_shared.cpp @@ -43,6 +43,7 @@ ConVar sv_stopspeed ( "sv_stopspeed","100", FCVAR_NOTIFY | FCVAR_REPLICATED, "Mi #endif // DOD_DLL || CSTRIKE_DLL ConVar sv_noclipaccelerate( "sv_noclipaccelerate", "5", FCVAR_NOTIFY | FCVAR_ARCHIVE | FCVAR_REPLICATED); +ConVar sv_noclipsprint ( "sv_noclipsprint", "2", FCVAR_ARCHIVE | FCVAR_NOTIFY | FCVAR_REPLICATED); ConVar sv_noclipspeed ( "sv_noclipspeed", "5", FCVAR_ARCHIVE | FCVAR_NOTIFY | FCVAR_REPLICATED); ConVar sv_specaccelerate( "sv_specaccelerate", "5", FCVAR_NOTIFY | FCVAR_ARCHIVE | FCVAR_REPLICATED); ConVar sv_specspeed ( "sv_specspeed", "3", FCVAR_ARCHIVE | FCVAR_NOTIFY | FCVAR_REPLICATED); diff --git a/src/game/shared/movevars_shared.h b/src/game/shared/movevars_shared.h index 58412eb59b3..02c8ea49ccc 100644 --- a/src/game/shared/movevars_shared.h +++ b/src/game/shared/movevars_shared.h @@ -17,6 +17,7 @@ float GetCurrentGravity( void ); extern ConVar sv_gravity; extern ConVar sv_stopspeed; extern ConVar sv_noclipaccelerate; +extern ConVar sv_noclipsprint; extern ConVar sv_noclipspeed; extern ConVar sv_maxspeed; extern ConVar sv_accelerate; diff --git a/src/game/shared/physics_saverestore.cpp b/src/game/shared/physics_saverestore.cpp index 434be1f4207..84ec085220c 100644 --- a/src/game/shared/physics_saverestore.cpp +++ b/src/game/shared/physics_saverestore.cpp @@ -444,7 +444,7 @@ class CPhysSaveRestoreBlockHandler : public CDefSaveRestoreBlockHandler, // Don't doing the box thing for things like wheels on cars IPhysicsObject *pPhysObj = (IPhysicsObject *)(*ppPhysObj); - if ( pPhysObj ) + if ( pPhysObj && physcollision ) { item.header.modelName = GetModelName( pPhysObj ); item.header.iCollide = physcollision->CollideIndex( pPhysObj->GetCollide() ); diff --git a/src/game/shared/physics_shared.cpp b/src/game/shared/physics_shared.cpp index c6539bae773..0faacd7c1a3 100644 --- a/src/game/shared/physics_shared.cpp +++ b/src/game/shared/physics_shared.cpp @@ -1003,7 +1003,7 @@ void PhysFrictionSound( CBaseEntity *pEntity, IPhysicsObject *pObject, float ene if ( psurf->sounds.scrapeSmooth && phit->audio.roughnessFactor < psurf->audio.roughThreshold ) { soundName = psurf->sounds.scrapeSmooth; - soundHandle = &psurf->soundhandles.scrapeRough; + soundHandle = &psurf->soundhandles.scrapeSmooth; } const char *pSoundName = physprops->GetString( soundName ); diff --git a/src/game/shared/physics_shared.h b/src/game/shared/physics_shared.h index 0f1178ae430..871104a5fbd 100644 --- a/src/game/shared/physics_shared.h +++ b/src/game/shared/physics_shared.h @@ -100,6 +100,8 @@ void PhysFrictionEffect( Vector &vecPos, Vector vecVel, float energy, int surfac // ORs gameFlags with the physics object's current game flags inline unsigned short PhysSetGameFlags( IPhysicsObject *pPhys, unsigned short gameFlags ) { + if ( !pPhys ) return 0; + unsigned short flags = pPhys->GetGameFlags(); flags |= gameFlags; pPhys->SetGameFlags( flags ); @@ -109,6 +111,8 @@ inline unsigned short PhysSetGameFlags( IPhysicsObject *pPhys, unsigned short ga // mask off gameFlags inline unsigned short PhysClearGameFlags( IPhysicsObject *pPhys, unsigned short gameFlags ) { + if ( !pPhys ) return 0; + unsigned short flags = pPhys->GetGameFlags(); flags &= ~gameFlags; pPhys->SetGameFlags( flags ); diff --git a/src/game/shared/util_shared.cpp b/src/game/shared/util_shared.cpp index c3cca293f82..fbc02078bbe 100644 --- a/src/game/shared/util_shared.cpp +++ b/src/game/shared/util_shared.cpp @@ -778,6 +778,8 @@ void UTIL_Tracer( const Vector &vecStart, const Vector &vecEnd, int iEntIndex, void UTIL_BloodDrips( const Vector &origin, const Vector &direction, int color, int amount ) { + IPredictionSystem::SuppressHostEvents( NULL ); + if ( !UTIL_ShouldShowBlood( color ) ) return; diff --git a/src/game/shared/vscript_shared.cpp b/src/game/shared/vscript_shared.cpp index 64088e10919..d1e13884638 100644 --- a/src/game/shared/vscript_shared.cpp +++ b/src/game/shared/vscript_shared.cpp @@ -1,4 +1,4 @@ -//========== Copyright © 2008, Valve Corporation, All rights reserved. ======== +//========== Copyright � 2008, Valve Corporation, All rights reserved. ======== // // Purpose: // @@ -185,8 +185,10 @@ CON_COMMAND( script, "Run the text as a script" ) #endif { #ifdef CLIENT_DLL +#ifndef JBMOD if ( !engine->IsClientLocalToActiveServer() ) return; +#endif #else if ( !UTIL_IsCommandIssuedByServerAdmin() ) return; @@ -253,8 +255,10 @@ CON_COMMAND( script_execute, "Run a vscript file" ) #endif { #ifdef CLIENT_DLL +#ifndef JBMOD if ( !engine->IsClientLocalToActiveServer() ) return; +#endif #else if ( !UTIL_IsCommandIssuedByServerAdmin() ) return; @@ -282,8 +286,10 @@ CON_COMMAND( script_debug, "Connect the vscript VM to the script debugger" ) #endif { #ifdef CLIENT_DLL +#ifndef JBMOD if ( !engine->IsClientLocalToActiveServer() ) return; +#endif #else if ( !UTIL_IsCommandIssuedByServerAdmin() ) return; @@ -304,8 +310,10 @@ CON_COMMAND( script_help, "Output help for script functions, optionally with a s #endif { #ifdef CLIENT_DLL +#ifndef JBMOD if ( !engine->IsClientLocalToActiveServer() ) return; +#endif #else if ( !UTIL_IsCommandIssuedByServerAdmin() ) return; @@ -332,8 +340,10 @@ CON_COMMAND( script_dump_all, "Dump the state of the VM to the console" ) #endif { #ifdef CLIENT_DLL +#ifndef JBMOD if ( !engine->IsClientLocalToActiveServer() ) return; +#endif #else if ( !UTIL_IsCommandIssuedByServerAdmin() ) return; diff --git a/src/public/bone_setup.cpp b/src/public/bone_setup.cpp index dac6699f71a..3953310b315 100644 --- a/src/public/bone_setup.cpp +++ b/src/public/bone_setup.cpp @@ -5926,6 +5926,8 @@ const char *Studio_GetDefaultSurfaceProps( CStudioHdr *pstudiohdr ) float Studio_GetMass( CStudioHdr *pstudiohdr ) { + if ( pstudiohdr == NULL ) + return 0.f; return pstudiohdr->mass(); } diff --git a/src/tier1/NetAdr.cpp b/src/tier1/NetAdr.cpp index 00514d6e679..e7214e598de 100644 --- a/src/tier1/NetAdr.cpp +++ b/src/tier1/NetAdr.cpp @@ -97,7 +97,7 @@ bool netadr_t::IsReservedAdr () const if ( (ip[0] == 10) || // 10.x.x.x is reserved (ip[0] == 127) || // 127.x.x.x (ip[0] == 172 && ip[1] >= 16 && ip[1] <= 31) || // 172.16.x.x - 172.31.x.x - (ip[0] == 192 && ip[1] >= 168) ) // 192.168.x.x + (ip[0] == 192 && ip[1] == 168) ) // 192.168.x.x return true; } return false; diff --git a/src/tier1/convar.cpp b/src/tier1/convar.cpp index 9aa66bbfe2c..b55f6d59cb1 100644 --- a/src/tier1/convar.cpp +++ b/src/tier1/convar.cpp @@ -360,7 +360,7 @@ CCommand::CCommand( int nArgC, const char **ppArgV ) { *pSBuf++ = '\"'; } - memcpy( pSBuf, ppArgV[i], nLen ); + memcpy( pSBuf, ppArgV[i], nLen + 1 ); pSBuf += nLen; if ( bContainsSpace ) { diff --git a/src/utils/common/threads.cpp b/src/utils/common/threads.cpp index 74e457a9ce9..88a1318bcf1 100644 --- a/src/utils/common/threads.cpp +++ b/src/utils/common/threads.cpp @@ -19,7 +19,7 @@ #include "threads.h" #include "pacifier.h" -#define MAX_THREADS 16 +#define MAX_THREADS 32 class CRunThreadsData diff --git a/src/utils/common/threads.h b/src/utils/common/threads.h index 0908b67ad00..906d0b7ba8c 100644 --- a/src/utils/common/threads.h +++ b/src/utils/common/threads.h @@ -18,7 +18,7 @@ // Arrays that are indexed by thread should always be MAX_TOOL_THREADS+1 // large so THREADINDEX_MAIN can be used from the main thread. -#define MAX_TOOL_THREADS 16 +#define MAX_TOOL_THREADS 32 #define THREADINDEX_MAIN (MAX_TOOL_THREADS) diff --git a/src/utils/common/utilmatlib.cpp b/src/utils/common/utilmatlib.cpp index f2dc49fa838..f4e3920be37 100644 --- a/src/utils/common/utilmatlib.cpp +++ b/src/utils/common/utilmatlib.cpp @@ -52,6 +52,8 @@ void LoadMaterialSystemInterface( CreateInterfaceFn fileSystemFactory ) { Error( "Could not start the empty shader (shaderapiempty.dll)!" ); } + + g_pMaterialSystem->ModInit(); } void InitMaterialSystem( const char *materialBaseDirPath, CreateInterfaceFn fileSystemFactory ) diff --git a/src/utils/vbsp/detail.cpp b/src/utils/vbsp/detail.cpp index 840068def67..913c99c0758 100644 --- a/src/utils/vbsp/detail.cpp +++ b/src/utils/vbsp/detail.cpp @@ -440,6 +440,7 @@ face_t *MakeBrushFace( side_t *originalSide, winding_t *winding ) f->split[0] = f->split[1] = NULL; f->w = CopyWinding( winding ); f->originalface = originalSide; + f->smoothingGroups = originalSide->smoothingGroups; // // save material info //