Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tell the client what objects are breakable so that Gauss Gun shots won't be visibly reflected #222

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cl_dll/ev_hldm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ char* EV_HLDM_DamageDecal(physent_t* pe)
static char decalname[32];
int idx;

if (pe->classnumber == 1)
if (FBitSet(pe->classnumber, kBrushGlass))
{
idx = gEngfuncs.pfnRandomLong(0, 2);
sprintf(decalname, "{break%i", idx + 1);
Expand Down Expand Up @@ -934,7 +934,8 @@ void EV_FireGauss(event_args_t* args)

n = -DotProduct(tr.plane.normal, forward);

if (n < 0.5) // 60 degrees
// Move the breakable test down here so that decal effects are applied to breakable objects.
if (!FBitSet(pEntity->classnumber, kBrushBreakable) && n < 0.5) // 60 degrees
{
// ALERT( at_console, "reflect %f\n", n );
// reflect
Expand Down
6 changes: 6 additions & 0 deletions common/const.h
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,12 @@ enum
kRenderFxLightMultiplier, //CTM !!!CZERO added to tell the studiorender that the value in iuser2 is a lightmultiplier
};

enum
{
kBrushGlass = 1,
kBrushBreakable = 2,
};

#define _DEF_BYTE_

typedef struct
Expand Down
7 changes: 6 additions & 1 deletion dlls/func_break.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,16 @@ void CBreakable::Spawn()
m_angle = pev->angles.y;
pev->angles.y = 0;

if (IsBreakable())
{
pev->playerclass |= kBrushBreakable;
}

// HACK: matGlass can receive decals, we need the client to know about this
// so use class to store the material flag
if (m_Material == matGlass)
{
pev->playerclass = 1;
pev->playerclass |= kBrushGlass;
}

SET_MODEL(ENT(pev), STRING(pev->model)); //set size and link into world.
Expand Down
2 changes: 1 addition & 1 deletion network/delta.lst
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ entity_state_t gamedll Entity_Encode

// Playerclass signifies it's a decalable glass item when referring to an object

DEFINE_DELTA( playerclass, DT_INTEGER, 1, 1.0 )
DEFINE_DELTA( playerclass, DT_INTEGER, 2, 1.0 )
}

entity_state_player_t gamedll Player_Encode
Expand Down