From b31de2b7aee9bb53d07671a8187daf18449a045c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Troch?= Date: Mon, 12 Aug 2024 19:42:56 +0200 Subject: [PATCH 1/4] Reset frame to 0 when grenade bounces Fixes #238, thanks @FreeSlave --- CHANGELOG.md | 1 + FULL_UPDATED_CHANGELOG.md | 1 + dlls/ggrenade.cpp | 3 +++ 3 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07c02fa8f..8040a16c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ### Bug Fixes * Fixed potential buffer overflows in text localization (Thanks OMAM) +* Reset frame to 0 when grenade bounces [#238](https://github.com/twhl-community/halflife-updated/issues/238) (thanks FreeSlave) ## Changes in V1.0.0 diff --git a/FULL_UPDATED_CHANGELOG.md b/FULL_UPDATED_CHANGELOG.md index 391e7515d..c9995625a 100644 --- a/FULL_UPDATED_CHANGELOG.md +++ b/FULL_UPDATED_CHANGELOG.md @@ -116,6 +116,7 @@ Fixes for bugs introduced in beta builds are not included in this list. * Fixed Hand grenade not playing deploy animation after finishing a throw (halflife issue [#2495](https://github.com/ValveSoftware/halflife/issues/2495)) * Fixed Hand grenades staying primed when switching away or dropping the weapon (halflife issue [#3251](https://github.com/ValveSoftware/halflife/issues/3251)) * Fixed hand grenade animations not playing correctly [#209](https://github.com/twhl-community/halflife-updated/pull/209) (Thanks Toodles2You) +* Reset frame to 0 when grenade bounces [#238](https://github.com/twhl-community/halflife-updated/issues/238) (thanks FreeSlave) ### Satchel charge diff --git a/dlls/ggrenade.cpp b/dlls/ggrenade.cpp index 9e9891c22..b9958f630 100644 --- a/dlls/ggrenade.cpp +++ b/dlls/ggrenade.cpp @@ -283,7 +283,10 @@ void CGrenade::BounceTouch(CBaseEntity* pOther) if (pev->framerate > 1.0) pev->framerate = 1; else if (pev->framerate < 0.5) + { pev->framerate = 0; + pev->frame = 0; + } } From 7aae740983238044ce9104e3a50f130bc753462b Mon Sep 17 00:00:00 2001 From: Justin <95296300+Toodles2You@users.noreply.github.com> Date: Mon, 21 Aug 2023 18:20:58 -0700 Subject: [PATCH 2/4] Fix weapon events not treating pushable objects as BSP models --- CHANGELOG.md | 1 + FULL_UPDATED_CHANGELOG.md | 1 + cl_dll/ev_hldm.cpp | 29 ++++++++++++++++------------- cl_dll/hud.cpp | 2 ++ 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8040a16c2..a35d1b7f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Fixed potential buffer overflows in text localization (Thanks OMAM) * Reset frame to 0 when grenade bounces [#238](https://github.com/twhl-community/halflife-updated/issues/238) (thanks FreeSlave) +* Fix weapon events not treating pushable objects as BSP models [#220](https://github.com/twhl-community/halflife-updated/pull/220) (Thanks Toodles2You) ## Changes in V1.0.0 diff --git a/FULL_UPDATED_CHANGELOG.md b/FULL_UPDATED_CHANGELOG.md index c9995625a..2b12c34d5 100644 --- a/FULL_UPDATED_CHANGELOG.md +++ b/FULL_UPDATED_CHANGELOG.md @@ -43,6 +43,7 @@ Fixes for bugs introduced in beta builds are not included in this list. * Fixed player weapons still receiving input when starting to use a func_tank (halflife issue [#3345](https://github.com/ValveSoftware/halflife/issues/3345)) (Thanks Oxofemple.) * Fixed limit in world weapons (e.g. Hand Grenade) respawning at wrong time if server is near edict limit * Disabled fall think function for weapons when the player picks it up to prevent possible double-pickup which removes the weapon and crashes the game +* Fix weapon events not treating pushable objects as BSP models [#220](https://github.com/twhl-community/halflife-updated/pull/220) (Thanks Toodles2You) ### Crowbar diff --git a/cl_dll/ev_hldm.cpp b/cl_dll/ev_hldm.cpp index 38efd2f05..768fc04e0 100644 --- a/cl_dll/ev_hldm.cpp +++ b/cl_dll/ev_hldm.cpp @@ -52,6 +52,12 @@ void V_PunchAxis(int axis, float punch); void VectorAngles(const float* forward, float* angles); extern cvar_t* cl_lw; +extern cvar_t* r_decals; + +static inline bool EV_HLDM_IsBSPModel(physent_t* pe) +{ + return pe != nullptr && (pe->solid == SOLID_BSP || pe->movetype == MOVETYPE_PUSHSTEP); +} // play a strike sound based on the texture that was hit by the attack traceline. VecSrc/VecEnd are the // original traceline endpoints used by the attacker, iBulletType is the type of bullet that hit the texture. @@ -209,6 +215,9 @@ char* EV_HLDM_DamageDecal(physent_t* pe) static char decalname[32]; int idx; + if (pe->rendermode == kRenderTransAlpha) + return nullptr; + if (pe->classnumber == 1) { idx = gEngfuncs.pfnRandomLong(0, 2); @@ -229,7 +238,6 @@ char* EV_HLDM_DamageDecal(physent_t* pe) void EV_HLDM_GunshotDecalTrace(pmtrace_t* pTrace, char* decalName) { int iRand; - physent_t* pe; gEngfuncs.pEfxAPI->R_BulletImpactParticles(pTrace->endpos); @@ -256,17 +264,12 @@ void EV_HLDM_GunshotDecalTrace(pmtrace_t* pTrace, char* decalName) } } - pe = gEngfuncs.pEventAPI->EV_GetPhysent(pTrace->ent); - // Only decal brush models such as the world etc. - if (decalName && '\0' != decalName[0] && pe && (pe->solid == SOLID_BSP || pe->movetype == MOVETYPE_PUSHSTEP)) + if (decalName && '\0' != decalName[0] && r_decals->value > 0) { - if (CVAR_GET_FLOAT("r_decals")) - { - gEngfuncs.pEfxAPI->R_DecalShoot( - gEngfuncs.pEfxAPI->Draw_DecalIndex(gEngfuncs.pEfxAPI->Draw_DecalIndexFromName(decalName)), - gEngfuncs.pEventAPI->EV_IndexFromTrace(pTrace), 0, pTrace->endpos, 0); - } + gEngfuncs.pEfxAPI->R_DecalShoot( + gEngfuncs.pEfxAPI->Draw_DecalIndex(gEngfuncs.pEfxAPI->Draw_DecalIndexFromName(decalName)), + gEngfuncs.pEventAPI->EV_IndexFromTrace(pTrace), 0, pTrace->endpos, 0); } } @@ -276,7 +279,7 @@ void EV_HLDM_DecalGunshot(pmtrace_t* pTrace, int iBulletType) pe = gEngfuncs.pEventAPI->EV_GetPhysent(pTrace->ent); - if (pe && pe->solid == SOLID_BSP) + if (EV_HLDM_IsBSPModel(pe)) { switch (iBulletType) { @@ -926,7 +929,7 @@ void EV_FireGauss(event_args_t* args) if (pEntity == NULL) break; - if (pEntity->solid == SOLID_BSP) + if (EV_HLDM_IsBSPModel(pEntity)) { float n; @@ -1177,7 +1180,7 @@ void EV_FireCrossbow2(event_args_t* args) physent_t* pe = gEngfuncs.pEventAPI->EV_GetPhysent(tr.ent); //Not the world, let's assume we hit something organic ( dog, cat, uncle joe, etc ). - if (pe->solid != SOLID_BSP) + if (!EV_HLDM_IsBSPModel(pe)) { switch (gEngfuncs.pfnRandomLong(0, 1)) { diff --git a/cl_dll/hud.cpp b/cl_dll/hud.cpp index 415cd6648..6aca7a65b 100644 --- a/cl_dll/hud.cpp +++ b/cl_dll/hud.cpp @@ -85,6 +85,7 @@ cvar_t* cl_lw = NULL; cvar_t* cl_rollangle = nullptr; cvar_t* cl_rollspeed = nullptr; cvar_t* cl_bobtilt = nullptr; +cvar_t* r_decals = nullptr; void ShutdownInput(); @@ -334,6 +335,7 @@ void CHud::Init() cl_rollangle = CVAR_CREATE("cl_rollangle", "2.0", FCVAR_ARCHIVE); cl_rollspeed = CVAR_CREATE("cl_rollspeed", "200", FCVAR_ARCHIVE); cl_bobtilt = CVAR_CREATE("cl_bobtilt", "0", FCVAR_ARCHIVE); + r_decals = gEngfuncs.pfnGetCvarPointer("r_decals"); m_pSpriteList = NULL; From 484911d90b72f300a3bd6adf1635b1428c1142aa Mon Sep 17 00:00:00 2001 From: Justin <95296300+Toodles2You@users.noreply.github.com> Date: Mon, 21 Aug 2023 18:20:53 -0700 Subject: [PATCH 3/4] Fix crowbar applying breakable glass decals to unbreakable pushable objects --- CHANGELOG.md | 1 + FULL_UPDATED_CHANGELOG.md | 1 + dlls/func_break.cpp | 10 ++++++++++ 3 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a35d1b7f7..5fe1decca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * Fixed potential buffer overflows in text localization (Thanks OMAM) * Reset frame to 0 when grenade bounces [#238](https://github.com/twhl-community/halflife-updated/issues/238) (thanks FreeSlave) * Fix weapon events not treating pushable objects as BSP models [#220](https://github.com/twhl-community/halflife-updated/pull/220) (Thanks Toodles2You) +* Fixed crowbar applying breakable glass decals to unbreakable pushable objects [#219](https://github.com/twhl-community/halflife-updated/pull/219) (Thanks Toodles2You) ## Changes in V1.0.0 diff --git a/FULL_UPDATED_CHANGELOG.md b/FULL_UPDATED_CHANGELOG.md index 2b12c34d5..a2a856546 100644 --- a/FULL_UPDATED_CHANGELOG.md +++ b/FULL_UPDATED_CHANGELOG.md @@ -52,6 +52,7 @@ Fixes for bugs introduced in beta builds are not included in this list. * Fixed crowbar not showing in weapon list if there are empty weapon slots with a lower id (halflife [#3181](https://github.com/ValveSoftware/halflife/issues/3181)) * Fixed the Crowbar damage always being calculated halved (halflife issue [#1600](https://github.com/ValveSoftware/halflife/pull/1600) (Thanks YaLTeR) * Fixed Crowbar playing back swing events twice sometimes (halflife issue [#3230](https://github.com/ValveSoftware/halflife/issues/3230)) +* Fixed crowbar applying breakable glass decals to unbreakable pushable objects [#219](https://github.com/twhl-community/halflife-updated/pull/219) (Thanks Toodles2You) ### Glock diff --git a/dlls/func_break.cpp b/dlls/func_break.cpp index 598961dcc..f25413225 100644 --- a/dlls/func_break.cpp +++ b/dlls/func_break.cpp @@ -824,6 +824,8 @@ class CPushable : public CBreakable // breakables use an overridden takedamage bool TakeDamage(entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType) override; + int DamageDecal(int bitsDamageType) override; + static TYPEDESCRIPTION m_SaveData[]; static const char* m_soundNames[3]; @@ -1029,3 +1031,11 @@ bool CPushable::TakeDamage(entvars_t* pevInflictor, entvars_t* pevAttacker, floa return true; } + +int CPushable::DamageDecal(int bitsDamageType) +{ + if (FBitSet(pev->spawnflags, SF_PUSH_BREAKABLE)) + return CBreakable::DamageDecal(bitsDamageType); + + return CBaseEntity::DamageDecal(bitsDamageType); +} From 78575b95ee612df15d8c7ce62468528ad571fb5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Troch?= Date: Mon, 12 Aug 2024 20:32:56 +0200 Subject: [PATCH 4/4] Fix typo in changelogs --- CHANGELOG.md | 2 +- FULL_UPDATED_CHANGELOG.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fe1decca..4f3ab61e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ * Fixed potential buffer overflows in text localization (Thanks OMAM) * Reset frame to 0 when grenade bounces [#238](https://github.com/twhl-community/halflife-updated/issues/238) (thanks FreeSlave) -* Fix weapon events not treating pushable objects as BSP models [#220](https://github.com/twhl-community/halflife-updated/pull/220) (Thanks Toodles2You) +* Fixed weapon events not treating pushable objects as BSP models [#220](https://github.com/twhl-community/halflife-updated/pull/220) (Thanks Toodles2You) * Fixed crowbar applying breakable glass decals to unbreakable pushable objects [#219](https://github.com/twhl-community/halflife-updated/pull/219) (Thanks Toodles2You) ## Changes in V1.0.0 diff --git a/FULL_UPDATED_CHANGELOG.md b/FULL_UPDATED_CHANGELOG.md index a2a856546..bcc7bf899 100644 --- a/FULL_UPDATED_CHANGELOG.md +++ b/FULL_UPDATED_CHANGELOG.md @@ -43,7 +43,7 @@ Fixes for bugs introduced in beta builds are not included in this list. * Fixed player weapons still receiving input when starting to use a func_tank (halflife issue [#3345](https://github.com/ValveSoftware/halflife/issues/3345)) (Thanks Oxofemple.) * Fixed limit in world weapons (e.g. Hand Grenade) respawning at wrong time if server is near edict limit * Disabled fall think function for weapons when the player picks it up to prevent possible double-pickup which removes the weapon and crashes the game -* Fix weapon events not treating pushable objects as BSP models [#220](https://github.com/twhl-community/halflife-updated/pull/220) (Thanks Toodles2You) +* Fixed weapon events not treating pushable objects as BSP models [#220](https://github.com/twhl-community/halflife-updated/pull/220) (Thanks Toodles2You) ### Crowbar