New cvar: fastsprites. Wind simulation for wallpuff, some optimizations
This commit is contained in:
parent
34e0c7bdf2
commit
e0c6dfd73d
@ -338,6 +338,84 @@ void EV_HLDM_GunshotDecalTrace( pmtrace_t *pTrace, char *decalName, char chTextu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EV_WallPuff_Wind( struct tempent_s *te, float frametime, float currenttime )
|
||||||
|
{
|
||||||
|
static bool xWindDirection = true;
|
||||||
|
static bool yWindDirection = true;
|
||||||
|
static float xWindMagnitude;
|
||||||
|
static float yWindMagnitude;
|
||||||
|
|
||||||
|
if ( te->entity.curstate.frame > 7.0 )
|
||||||
|
{
|
||||||
|
te->entity.baseline.origin.x = 0.97 * te->entity.baseline.origin.x;
|
||||||
|
te->entity.baseline.origin.y = 0.97 * te->entity.baseline.origin.y;
|
||||||
|
te->entity.baseline.origin.z = 0.97 * te->entity.baseline.origin.z + 0.7;
|
||||||
|
if ( te->entity.baseline.origin.z > 70.0 )
|
||||||
|
te->entity.baseline.origin.z = 70.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( te->entity.curstate.frame > 6.0 )
|
||||||
|
{
|
||||||
|
xWindMagnitude += 0.075;
|
||||||
|
if ( xWindMagnitude > 5.0 )
|
||||||
|
xWindMagnitude = 5.0;
|
||||||
|
|
||||||
|
yWindMagnitude += 0.075;
|
||||||
|
if ( yWindMagnitude > 5.0 )
|
||||||
|
yWindMagnitude = 5.0;
|
||||||
|
|
||||||
|
if( xWindDirection )
|
||||||
|
te->entity.baseline.origin.x += xWindMagnitude;
|
||||||
|
else
|
||||||
|
te->entity.baseline.origin.x -= xWindMagnitude;
|
||||||
|
|
||||||
|
if( yWindDirection )
|
||||||
|
te->entity.baseline.origin.y += yWindMagnitude;
|
||||||
|
else
|
||||||
|
te->entity.baseline.origin.y -= yWindMagnitude;
|
||||||
|
|
||||||
|
if ( !gEngfuncs.pfnRandomLong(0, 10) && yWindMagnitude > 3.0 )
|
||||||
|
{
|
||||||
|
yWindMagnitude = 0;
|
||||||
|
yWindDirection = !yWindDirection;
|
||||||
|
}
|
||||||
|
if ( !gEngfuncs.pfnRandomLong(0, 10) && xWindMagnitude > 3.0 )
|
||||||
|
{
|
||||||
|
xWindMagnitude = 0;
|
||||||
|
xWindDirection = !xWindDirection;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void EV_HugWalls(TEMPENTITY *te, pmtrace_s *ptr)
|
||||||
|
{
|
||||||
|
Vector norm = te->entity.baseline.origin.Normalize();
|
||||||
|
float len = te->entity.baseline.origin.Length();
|
||||||
|
|
||||||
|
Vector v =
|
||||||
|
{
|
||||||
|
ptr->plane.normal.y * norm.x - norm.y * ptr->plane.normal.x,
|
||||||
|
ptr->plane.normal.x * norm.z - norm.x * ptr->plane.normal.z,
|
||||||
|
ptr->plane.normal.z * norm.y - norm.z * ptr->plane.normal.y
|
||||||
|
};
|
||||||
|
Vector v2 =
|
||||||
|
{
|
||||||
|
ptr->plane.normal.y * v.z - v.y * ptr->plane.normal.x,
|
||||||
|
ptr->plane.normal.x * v.x - v.z * ptr->plane.normal.z,
|
||||||
|
ptr->plane.normal.z * v.y - v.x * ptr->plane.normal.y
|
||||||
|
};
|
||||||
|
|
||||||
|
if( len <= 2000.0f )
|
||||||
|
len *= 1.5;
|
||||||
|
else len = 3000.0f;
|
||||||
|
|
||||||
|
te->entity.baseline.origin.x = v2.z * len * 1.5;
|
||||||
|
te->entity.baseline.origin.y = v2.y * len * 1.5;
|
||||||
|
te->entity.baseline.origin.z = v2.x * len * 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void EV_HLDM_DecalGunshot(pmtrace_t *pTrace, int iBulletType, float scale, int r, int g, int b, bool bCreateWallPuff, bool bCreateSparks, char cTextureType)
|
void EV_HLDM_DecalGunshot(pmtrace_t *pTrace, int iBulletType, float scale, int r, int g, int b, bool bCreateWallPuff, bool bCreateSparks, char cTextureType)
|
||||||
{
|
{
|
||||||
physent_t *pe;
|
physent_t *pe;
|
||||||
@ -359,18 +437,32 @@ void EV_HLDM_DecalGunshot(pmtrace_t *pTrace, int iBulletType, float scale, int r
|
|||||||
|
|
||||||
if( bCreateWallPuff )
|
if( bCreateWallPuff )
|
||||||
{
|
{
|
||||||
TEMPENTITY *te = gEngfuncs.pEfxAPI->R_DefaultSprite( pTrace->endpos,
|
TEMPENTITY *te = NULL;
|
||||||
gEngfuncs.pEventAPI->EV_FindModelIndex("sprites/wall_puff1.spr"), 30.0f );
|
if( gHUD.fastsprites && !gHUD.fastsprites->value )
|
||||||
|
{
|
||||||
|
char path[] = "sprites/wall_puff1.spr";
|
||||||
|
|
||||||
|
path[17] += gEngfuncs.pfnRandomLong(0, 3);
|
||||||
|
te = gEngfuncs.pEfxAPI->R_DefaultSprite( pTrace->endpos,
|
||||||
|
gEngfuncs.pEventAPI->EV_FindModelIndex(path), 30.0f );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
te = gEngfuncs.pEfxAPI->R_DefaultSprite( pTrace->endpos,
|
||||||
|
gEngfuncs.pEventAPI->EV_FindModelIndex("sprites/fast_wallpuff1.spr"), 30.0f );
|
||||||
|
}
|
||||||
if( te )
|
if( te )
|
||||||
{
|
{
|
||||||
te->flags = FTENT_SPRANIMATE | FTENT_FADEOUT;
|
te->callback = EV_WallPuff_Wind;
|
||||||
|
te->hitcallback = EV_HugWalls;
|
||||||
|
te->flags |= FTENT_COLLIDEALL | FTENT_CLIENTCUSTOM;
|
||||||
te->entity.curstate.rendermode = kRenderTransAdd;
|
te->entity.curstate.rendermode = kRenderTransAdd;
|
||||||
te->entity.curstate.rendercolor.r = r;
|
te->entity.curstate.rendercolor.r = r;
|
||||||
te->entity.curstate.rendercolor.g = g;
|
te->entity.curstate.rendercolor.g = g;
|
||||||
te->entity.curstate.rendercolor.b = b;
|
te->entity.curstate.rendercolor.b = b;
|
||||||
te->entity.curstate.renderamt = 255;
|
te->entity.curstate.renderamt = gEngfuncs.pfnRandomLong( 100, 180 );
|
||||||
te->entity.curstate.scale = 0.33;
|
te->entity.curstate.scale = 0.5;
|
||||||
te->entity.baseline.origin = 20 * pTrace->plane.normal;
|
te->entity.baseline.origin = (25 + gEngfuncs.pfnRandomLong( 0, 4 ) ) * pTrace->plane.normal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ void EV_CreateSmoke(event_args_s *args)
|
|||||||
|
|
||||||
if( !args->bparam2 ) //first explosion
|
if( !args->bparam2 ) //first explosion
|
||||||
{
|
{
|
||||||
const model_t *pGasModel = gEngfuncs.GetSpritePointer(SPR_Load("sprites/gas_puff_01.spr"));
|
const model_t *pGasModel = gEngfuncs.GetSpritePointer(gHUD.m_hGasPuff);
|
||||||
|
|
||||||
for( int i = 0; i < SMOKE_CLOUDS; i++ )
|
for( int i = 0; i < SMOKE_CLOUDS; i++ )
|
||||||
{
|
{
|
||||||
|
@ -123,6 +123,7 @@ void CHud :: Init( void )
|
|||||||
default_fov = CVAR_CREATE( "default_fov", "90", 0 );
|
default_fov = CVAR_CREATE( "default_fov", "90", 0 );
|
||||||
m_pCvarStealMouse = CVAR_CREATE( "hud_capturemouse", "1", FCVAR_ARCHIVE );
|
m_pCvarStealMouse = CVAR_CREATE( "hud_capturemouse", "1", FCVAR_ARCHIVE );
|
||||||
m_pCvarDraw = CVAR_CREATE( "hud_draw", "1", FCVAR_ARCHIVE );
|
m_pCvarDraw = CVAR_CREATE( "hud_draw", "1", FCVAR_ARCHIVE );
|
||||||
|
fastsprites = CVAR_CREATE( "fastsprites", "0", FCVAR_ARCHIVE );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -345,6 +346,8 @@ void CHud :: VidInit( void )
|
|||||||
|
|
||||||
m_iFontHeight = m_rgrcRects[m_HUD_number_0].bottom - m_rgrcRects[m_HUD_number_0].top;
|
m_iFontHeight = m_rgrcRects[m_HUD_number_0].bottom - m_rgrcRects[m_HUD_number_0].top;
|
||||||
|
|
||||||
|
m_hGasPuff = SPR_Load("sprites/gas_puff_01.spr");
|
||||||
|
|
||||||
m_Ammo.VidInit();
|
m_Ammo.VidInit();
|
||||||
m_Health.VidInit();
|
m_Health.VidInit();
|
||||||
m_Spectator.VidInit();
|
m_Spectator.VidInit();
|
||||||
|
@ -883,11 +883,13 @@ public:
|
|||||||
int m_iFOV;
|
int m_iFOV;
|
||||||
int m_Teamplay;
|
int m_Teamplay;
|
||||||
int m_iRes;
|
int m_iRes;
|
||||||
int RealSize;
|
|
||||||
float m_flScale;
|
float m_flScale;
|
||||||
cvar_t *m_pCvarStealMouse;
|
cvar_t *m_pCvarStealMouse;
|
||||||
cvar_t *m_pCvarDraw;
|
cvar_t *m_pCvarDraw;
|
||||||
cvar_t *cl_shadows;
|
cvar_t *cl_shadows;
|
||||||
|
cvar_t *fastsprites;
|
||||||
|
|
||||||
|
HSPRITE m_hGasPuff;
|
||||||
|
|
||||||
int m_iFontHeight;
|
int m_iFontHeight;
|
||||||
CHudAmmo m_Ammo;
|
CHudAmmo m_Ammo;
|
||||||
|
@ -116,7 +116,7 @@ static void UI_GameOptions_UpdateConfig( void )
|
|||||||
CVAR_SET_FLOAT( "mp_decals", uiGameOptions.mp_decals.curValue );
|
CVAR_SET_FLOAT( "mp_decals", uiGameOptions.mp_decals.curValue );
|
||||||
//CVAR_SET_FLOAT( "") maxshells
|
//CVAR_SET_FLOAT( "") maxshells
|
||||||
//CVAR_SET_FLOAT( "") max_smoke_puffs;
|
//CVAR_SET_FLOAT( "") max_smoke_puffs;
|
||||||
CVAR_SET_FLOAT( "cl_fastsmoke", uiGameOptions.fast_smoke_gas.enabled );
|
CVAR_SET_FLOAT( "fastsprites", uiGameOptions.fast_smoke_gas.enabled );
|
||||||
CVAR_SET_FLOAT( "_vgui_menus", !uiGameOptions.oldstylemenu.enabled );
|
CVAR_SET_FLOAT( "_vgui_menus", !uiGameOptions.oldstylemenu.enabled );
|
||||||
CVAR_SET_FLOAT( "_extended_menus", uiGameOptions.extendedmenus.enabled );
|
CVAR_SET_FLOAT( "_extended_menus", uiGameOptions.extendedmenus.enabled );
|
||||||
CVAR_SET_FLOAT( "_cl_autowepswitch", uiGameOptions.cl_autowepswitch.enabled );
|
CVAR_SET_FLOAT( "_cl_autowepswitch", uiGameOptions.cl_autowepswitch.enabled );
|
||||||
@ -140,7 +140,7 @@ static void UI_GameOptions_DiscardChanges( void )
|
|||||||
CVAR_SET_FLOAT( "mp_decals", uiGameInitial.mp_decals );
|
CVAR_SET_FLOAT( "mp_decals", uiGameInitial.mp_decals );
|
||||||
//CVAR_SET_FLOAT( "") maxshells
|
//CVAR_SET_FLOAT( "") maxshells
|
||||||
//CVAR_SET_FLOAT( "") max_smoke_puffs;
|
//CVAR_SET_FLOAT( "") max_smoke_puffs;
|
||||||
CVAR_SET_FLOAT( "cl_fastsmoke", uiGameInitial.fast_smoke_gas );
|
CVAR_SET_FLOAT( "fastsprites", uiGameInitial.fast_smoke_gas );
|
||||||
CVAR_SET_FLOAT( "_vgui_menus", !uiGameInitial.oldstylemenu );
|
CVAR_SET_FLOAT( "_vgui_menus", !uiGameInitial.oldstylemenu );
|
||||||
CVAR_SET_FLOAT( "_extended_menus", uiGameInitial.extendedmenus );
|
CVAR_SET_FLOAT( "_extended_menus", uiGameInitial.extendedmenus );
|
||||||
CVAR_SET_FLOAT( "_cl_autowepswitch", uiGameInitial.cl_autowepswitch );
|
CVAR_SET_FLOAT( "_cl_autowepswitch", uiGameInitial.cl_autowepswitch );
|
||||||
@ -180,7 +180,7 @@ static void UI_GameOptions_GetConfig( void )
|
|||||||
uiGameInitial.hand = uiGameOptions.hand.enabled = !CVAR_GET_FLOAT( "hand" );
|
uiGameInitial.hand = uiGameOptions.hand.enabled = !CVAR_GET_FLOAT( "hand" );
|
||||||
uiGameInitial.oldstylemenu = uiGameOptions.oldstylemenu.enabled = !CVAR_GET_FLOAT( "_vgui_menus" );
|
uiGameInitial.oldstylemenu = uiGameOptions.oldstylemenu.enabled = !CVAR_GET_FLOAT( "_vgui_menus" );
|
||||||
|
|
||||||
if( CVAR_GET_FLOAT( "cl_fastsmoke" ))
|
if( CVAR_GET_FLOAT( "fastsprites" ))
|
||||||
uiGameInitial.fast_smoke_gas = uiGameOptions.fast_smoke_gas.enabled = true;
|
uiGameInitial.fast_smoke_gas = uiGameOptions.fast_smoke_gas.enabled = true;
|
||||||
if( CVAR_GET_FLOAT( "_extended_menus" ))
|
if( CVAR_GET_FLOAT( "_extended_menus" ))
|
||||||
uiGameInitial.extendedmenus = uiGameOptions.extendedmenus.enabled = true;
|
uiGameInitial.extendedmenus = uiGameOptions.extendedmenus.enabled = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user