From c6479cb6ffe38b5c14dd42e704c0f3ecec1a1a3a Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Mon, 15 Apr 2024 15:20:20 +0300 Subject: [PATCH] Add 'Scale unit type' parameter for env_smoker --- cl_dll/cl_msg_fx.cpp | 5 ++++- dlls/gargantua.cpp | 15 ++++++++++++++- fgd/halflife.fgd | 7 ++++++- game_shared/fx_flags.h | 1 + 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/cl_dll/cl_msg_fx.cpp b/cl_dll/cl_msg_fx.cpp index 838cdeee7c..7b5ba61602 100644 --- a/cl_dll/cl_msg_fx.cpp +++ b/cl_dll/cl_msg_fx.cpp @@ -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(); diff --git a/dlls/gargantua.cpp b/dlls/gargantua.cpp index a05138ce0f..d61878a13e 100644 --- a/dlls/gargantua.cpp +++ b/dlls/gargantua.cpp @@ -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: @@ -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 ); } @@ -1691,6 +1702,8 @@ 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 ); @@ -1698,7 +1711,7 @@ void CSmoker::Think( void ) 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 ); diff --git a/fgd/halflife.fgd b/fgd/halflife.fgd index 4127666ee1..c18da9384a 100644 --- a/fgd/halflife.fgd +++ b/fgd/halflife.fgd @@ -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" @@ -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 diff --git a/game_shared/fx_flags.h b/game_shared/fx_flags.h index 2f05a5c781..700d27b7dd 100644 --- a/game_shared/fx_flags.h +++ b/game_shared/fx_flags.h @@ -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