Skip to content

Commit

Permalink
Merge branch 'Toodles2You-func-pushable-client'
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelTroch committed Aug 12, 2024
2 parents b31de2b + 7aae740 commit abbf918
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions FULL_UPDATED_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
29 changes: 16 additions & 13 deletions cl_dll/ev_hldm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand All @@ -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);

Expand All @@ -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);
}
}

Expand All @@ -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)
{
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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))
{
Expand Down
2 changes: 2 additions & 0 deletions cl_dll/hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit abbf918

Please sign in to comment.