Skip to content

Commit

Permalink
Add 'Scale unit type' parameter for env_smoker
Browse files Browse the repository at this point in the history
  • Loading branch information
FreeSlave committed Apr 15, 2024
1 parent 4e74768 commit c6479cb
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
5 changes: 4 additions & 1 deletion cl_dll/cl_msg_fx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,10 @@ int __MsgFunc_Smoke( const char* pszName, int iSize, void *pbuf )
pos[1] = READ_COORD();
pos[2] = READ_COORD();
modelIndex = READ_SHORT();
scale = (float)(READ_BYTE() * 0.1f);

const float scaleVal = READ_COORD();
scale = (flags & SMOKER_FLAG_SCALE_VALUE_IS_NORMAL) ? scaleVal : (float)(scaleVal * 0.1f);

frameRate = READ_BYTE();
speed = READ_SHORT();
zOffset = READ_SHORT();
Expand Down
15 changes: 14 additions & 1 deletion dlls/gargantua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1559,6 +1559,12 @@ void CGargantua::PlayUnUseSentence()
#define SF_SMOKER_FADE 16
#define SF_SMOKER_MAXHEALTH_SET (1 << 24)

enum
{
SMOKER_SPRITE_SCALE_DECILE = 0,
SMOKER_SPRITE_SCALE_NORMAL = 1
};

class CSmoker : public CBaseEntity
{
public:
Expand Down Expand Up @@ -1627,6 +1633,11 @@ void CSmoker::KeyValue(KeyValueData *pkvd)
pev->armorvalue = atof(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "scale_unit_type"))
{
pev->impulse = atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else
CBaseEntity::KeyValue( pkvd );
}
Expand Down Expand Up @@ -1691,14 +1702,16 @@ void CSmoker::Think( void )
flags |= SMOKER_FLAG_DIRECTED;
if (FBitSet(pev->spawnflags, SF_SMOKER_FADE))
flags |= SMOKER_FLAG_FADE_SPRITE;
if (pev->impulse == SMOKER_SPRITE_SCALE_NORMAL)
flags |= SMOKER_FLAG_SCALE_VALUE_IS_NORMAL;

MESSAGE_BEGIN( MSG_PVS, gmsgSmoke, pev->origin );
WRITE_BYTE( flags );
WRITE_COORD( pev->origin.x + RANDOM_FLOAT( -pev->dmg, pev->dmg ) );
WRITE_COORD( pev->origin.y + RANDOM_FLOAT( -pev->dmg, pev->dmg ) );
WRITE_COORD( pev->origin.z);
WRITE_SHORT( smokeIndex ? smokeIndex : g_sModelIndexSmoke );
WRITE_BYTE( RANDOM_LONG(pev->scale, pev->scale * 1.1f ) );
WRITE_COORD( RANDOM_FLOAT(pev->scale, pev->scale * 1.1f ) );
WRITE_BYTE( RANDOM_LONG( minFramerate, maxFramerate ) ); // framerate
WRITE_SHORT( pev->speed );
WRITE_SHORT( pev->frags );
Expand Down
7 changes: 6 additions & 1 deletion fgd/halflife.fgd
Original file line number Diff line number Diff line change
Expand Up @@ -1834,7 +1834,7 @@
@PointClass base(Targetname, RenderFields) size(-16 -16 -16, 16 16 16) = env_smoker : "Smoker"
[
health(integer) : "Times to smoke" : 1
scale(string) : "Smoke Scale (decile)" : 10
scale(string) : "Smoke Scale" : 1
dmg(string) : "Dispersion of smoke particles" : "0"
dmg_take(string) : "Min delay between smokes" : "0.4"
dmg_save(string) : "Max delay between smokes" : "0.6"
Expand All @@ -1844,6 +1844,11 @@
model(sprite) : "Sprite"
frags(integer) : "Z offset"
target(target_destination) : "Target to smoke at"
scale_unit_type(choices) :"Scale unit type" : 1 =
[
0: "Decile (tenth)"
1: "Normal"
]
spawnflags(Flags) =
[
1 : "Start On" : 0
Expand Down
1 change: 1 addition & 0 deletions game_shared/fx_flags.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@

#define SMOKER_FLAG_DIRECTED (1 << 0)
#define SMOKER_FLAG_FADE_SPRITE (1 << 1)
#define SMOKER_FLAG_SCALE_VALUE_IS_NORMAL (1 << 2)

#endif

0 comments on commit c6479cb

Please sign in to comment.