Skip to content

Commit

Permalink
shield bubble visuals WIP; not yet ready, even for beta
Browse files Browse the repository at this point in the history
  • Loading branch information
BenLubar committed Aug 26, 2024
1 parent 07a1a61 commit 0b3a6dc
Show file tree
Hide file tree
Showing 31 changed files with 7,513 additions and 16 deletions.
16 changes: 16 additions & 0 deletions contentsrc/modelsrc/items/rifle_shield.qc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

$modelname "items/shield_bubble/rifle_shield.mdl"

$scale 0.5
$body default "rifle_shield.smd"
$surfaceprop "no_decal"
$contents "solid"
$cdmaterials "models/items/shield_bubble"

$sequence "BindPose" "rifle_shield.smd"

$collisionmodel "rifle_shield_physics.smd"
{
$concave
$maxconvexpieces 13
}
6,090 changes: 6,090 additions & 0 deletions contentsrc/modelsrc/items/rifle_shield.smd

Large diffs are not rendered by default.

586 changes: 586 additions & 0 deletions contentsrc/modelsrc/items/rifle_shield_physics.smd

Large diffs are not rendered by default.

Binary file added contentsrc/modelsrc/items/shield_bubble_arena.dmx
Binary file not shown.
8 changes: 8 additions & 0 deletions contentsrc/modelsrc/items/shield_bubble_arena.qc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$modelname "items/shield_bubble/shield_bubble_arena.mdl"
$cdmaterials "models/items/shield_bubble"
$body default "shield_bubble_arena.dmx"
$sequence BindPose "shield_bubble_arena.dmx"
$illumposition 0 0 64
$mostlyopaque
$staticprop
$surfaceprop "metal"
Binary file not shown.
8 changes: 8 additions & 0 deletions contentsrc/modelsrc/items/shield_bubble_arena_low.qc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$modelname "items/shield_bubble/shield_bubble_arena_low.mdl"
$cdmaterials "models/items/shield_bubble"
$body default "shield_bubble_arena_low.dmx"
$sequence BindPose "shield_bubble_arena_low.dmx"
$illumposition 0 0 64
$opaque
$staticprop
$surfaceprop "metal"
19 changes: 10 additions & 9 deletions src/game/client/swarm/c_asw_aoegrenade_projectile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

ConVar rd_simple_beacons("rd_simple_beacons", "0", FCVAR_NONE, "If 1 heal beacon and damage amplifier will be rendered simple to improve performance");

// saved in video.txt, not config.cfg
ConVar rd_simple_beacons( "rd_simple_beacons", "0", FCVAR_NONE, "If 1 heal beacon and damage amplifier will be rendered simple to improve performance" );

//Precahce the effects
PRECACHE_REGISTER_BEGIN( GLOBAL, ASWPrecacheEffectAOEGrenades )
Expand Down Expand Up @@ -282,8 +284,8 @@ void C_ASW_AOEGrenade_Projectile::UpdateParticleAttachments( CNewParticleEffect

void C_ASW_AOEGrenade_Projectile::UpdatePingEffects( void )
{
if (rd_simple_beacons.GetBool())
return;
if ( rd_simple_beacons.GetBool() )
return;

if ( m_bSettled && m_pPulseEffect.GetObject() == NULL )
{
Expand All @@ -299,20 +301,19 @@ void C_ASW_AOEGrenade_Projectile::UpdatePingEffects( void )
C_BaseAnimating *pEnt = new C_BaseAnimating;
if (!pEnt)
{
Msg("Error, couldn't create new C_BaseAnimating\n");
Warning( "Error, couldn't create new C_BaseAnimating\n" );
return;
}
if (!pEnt->InitializeAsClientEntity( "models/items/shield_bubble/shield_bubble.mdl", false ))
//if (!pEnt->InitializeAsClientEntity( "models/props_combine/coreball.mdl", false ))
if ( !pEnt->InitializeAsClientEntity( "models/items/shield_bubble/shield_bubble.mdl", false ) )
{
Msg("Error, couldn't InitializeAsClientEntity\n");
Warning( "Error, couldn't InitializeAsClientEntity\n" );
pEnt->Release();
return;
}

pEnt->SetParent( this );
pEnt->SetLocalOrigin( Vector( 0, 0, 0 ) );
pEnt->SetLocalAngles( QAngle( 0, 0, 0 ) );
pEnt->SetLocalAngles( QAngle( 0, 0, 0 ) );
pEnt->SetSolid( SOLID_NONE );
pEnt->SetSkin( GetSphereSkin() );
pEnt->RemoveEFlags( EFL_USE_PARTITION_WHEN_NOT_SOLID );
Expand Down Expand Up @@ -411,7 +412,7 @@ void C_ASW_AOEGrenade_Projectile::ClientThink( void )
}

// sphere bubble models
if ( ShouldSpawnSphere() && m_hSphereModel.Get() )
if ( m_hSphereModel.Get() )
{
C_BaseAnimating *pSphere = static_cast< C_BaseAnimating * >( m_hSphereModel.Get() );
if ( pSphere )
Expand Down
59 changes: 59 additions & 0 deletions src/game/client/swarm/c_asw_shieldgrenade_projectile.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#include "cbase.h"
#include "c_asw_shieldgrenade_projectile.h"

// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"


#define BUBBLE_MODEL "models/items/shield_bubble/shield_bubble_arena.mdl"
#define BUBBLE_MODEL_LOW "models/items/shield_bubble/shield_bubble_arena_low.mdl"

extern ConVar rd_simple_beacons;

IMPLEMENT_CLIENTCLASS_DT( C_ASW_ShieldGrenade_Projectile, DT_ASW_ShieldGrenade_Projectile, CASW_ShieldGrenade_Projectile )
END_RECV_TABLE()

static bool UseLowBubbleModel()
{
return rd_simple_beacons.GetBool() || ( g_pMaterialSystemHardwareConfig->GetDXSupportLevel() < 92 );
}

void C_ASW_ShieldGrenade_Projectile::Precache()
{
BaseClass::Precache();

PrecacheModel( BUBBLE_MODEL );
PrecacheModel( BUBBLE_MODEL_LOW );
}

void C_ASW_ShieldGrenade_Projectile::UpdatePingEffects()
{
BaseClass::UpdatePingEffects();

// Spawn a sphere that is different from the default aoegrenade sphere.
if ( m_bSettled && m_hSphereModel.Get() == NULL )
{
C_BaseAnimating *pEnt = new C_BaseAnimating;
if ( !pEnt )
{
Warning( "Error, couldn't create new C_BaseAnimating\n" );
return;
}
if ( !pEnt->InitializeAsClientEntity( UseLowBubbleModel() ? BUBBLE_MODEL_LOW : BUBBLE_MODEL, false ) )
{
Warning( "Error, couldn't InitializeAsClientEntity\n" );
pEnt->Release();
return;
}

pEnt->SetParent( this );
pEnt->SetLocalOrigin( Vector( 0, 0, 0 ) );
pEnt->SetLocalAngles( QAngle( 0, 0, 0 ) );
pEnt->SetSolid( SOLID_NONE );
pEnt->SetSkin( GetSphereSkin() );
pEnt->RemoveEFlags( EFL_USE_PARTITION_WHEN_NOT_SOLID );

m_hSphereModel = pEnt;
m_flTimeCreated = gpGlobals->curtime;
}
}
15 changes: 15 additions & 0 deletions src/game/client/swarm/c_asw_shieldgrenade_projectile.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once

#include "c_asw_aoegrenade_projectile.h"

class C_ASW_ShieldGrenade_Projectile : public C_ASW_AOEGrenade_Projectile
{
public:
DECLARE_CLASS( C_ASW_ShieldGrenade_Projectile, C_ASW_AOEGrenade_Projectile );
DECLARE_CLIENTCLASS();

void Precache() override;

void UpdatePingEffects() override;
bool ShouldSpawnSphere() override { return false; } // we spawn our own
};
2 changes: 2 additions & 0 deletions src/game/client/swarm_sdk_client.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ if exist ..\..\devtools\bin\postbuild.cmd ..\..\devtools\bin\postbuild.cmd clien
<ClInclude Include="..\shared\swarm\rd_map_texture_shared.h" />
<ClInclude Include="..\shared\swarm\rd_vgui_vscript_shared.h" />
<ClInclude Include="swarm\c_asw_colonist.h" />
<ClInclude Include="swarm\c_asw_shieldgrenade_projectile.h" />
<ClInclude Include="swarm\c_rd_infection_deathmatch_stats.h" />
<ClInclude Include="swarm\gameui\swarm\vgenericchoicelist.h" />
<ClInclude Include="swarm\gameui\swarm\vpromooptin.h" />
Expand Down Expand Up @@ -1345,6 +1346,7 @@ if exist ..\..\devtools\bin\postbuild.cmd ..\..\devtools\bin\postbuild.cmd clien
<ClCompile Include="swarm\c_asw_sentry_top_icer.cpp" />
<ClCompile Include="swarm\c_asw_shaman.cpp" />
<ClCompile Include="swarm\c_asw_shieldbug.cpp" />
<ClCompile Include="swarm\c_asw_shieldgrenade_projectile.cpp" />
<ClCompile Include="swarm\c_asw_simple_alien.cpp" />
<ClCompile Include="swarm\c_asw_simple_drone.cpp" />
<ClCompile Include="swarm\c_asw_snow_emitter.cpp" />
Expand Down
29 changes: 29 additions & 0 deletions src/game/server/swarm/asw_shieldgrenade_projectile.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include "cbase.h"
#include "asw_shieldgrenade_projectile.h"

// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"


#define SHIELD_GRENADE_MODEL "models/items/shield_generator/shield_generator.mdl"

LINK_ENTITY_TO_CLASS( asw_shieldgrenade_projectile, CASW_ShieldGrenade_Projectile );

IMPLEMENT_SERVERCLASS_ST( CASW_ShieldGrenade_Projectile, DT_ASW_ShieldGrenade_Projectile )
END_SEND_TABLE()

BEGIN_DATADESC( CASW_ShieldGrenade_Projectile )
END_DATADESC()

CASW_ShieldGrenade_Projectile::CASW_ShieldGrenade_Projectile()
{
SetModelName( MAKE_STRING( SHIELD_GRENADE_MODEL ) );
}

void CASW_ShieldGrenade_Projectile::Precache()
{
BaseClass::Precache();

PrecacheModel( "models/items/shield_bubble/shield_bubble_arena.mdl" );
PrecacheModel( "models/items/shield_bubble/shield_bubble_arena_low.mdl" );
}
15 changes: 15 additions & 0 deletions src/game/server/swarm/asw_shieldgrenade_projectile.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once

#include "asw_buffgrenade_projectile.h"

class CASW_ShieldGrenade_Projectile : public CASW_AOEGrenade_Projectile
{
public:
DECLARE_CLASS( CASW_ShieldGrenade_Projectile, CASW_AOEGrenade_Projectile );
DECLARE_SERVERCLASS();
DECLARE_DATADESC();

CASW_ShieldGrenade_Projectile();

void Precache() override;
};
2 changes: 2 additions & 0 deletions src/game/server/swarm_sdk_server.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1333,6 +1333,7 @@ if exist ..\..\devtools\bin\postbuild.cmd ..\..\devtools\bin\postbuild.cmd serve
<ClCompile Include="swarm\asw_sentry_top_railgun.cpp" />
<ClCompile Include="swarm\asw_shaman.cpp" />
<ClCompile Include="swarm\asw_shieldbug.cpp" />
<ClCompile Include="swarm\asw_shieldgrenade_projectile.cpp" />
<ClCompile Include="swarm\asw_simple_alien.cpp" />
<ClCompile Include="swarm\asw_simple_alien_shared_data.cpp" />
<ClCompile Include="swarm\asw_simple_drone.cpp" />
Expand Down Expand Up @@ -2267,6 +2268,7 @@ if exist ..\..\devtools\bin\postbuild.cmd ..\..\devtools\bin\postbuild.cmd serve
<ClInclude Include="swarm\asw_sentry_top_railgun.h" />
<ClInclude Include="swarm\asw_shaman.h" />
<ClInclude Include="swarm\asw_shieldbug.h" />
<ClInclude Include="swarm\asw_shieldgrenade_projectile.h" />
<ClInclude Include="swarm\asw_simple_alien.h" />
<ClInclude Include="swarm\asw_simple_alien_shared_data.h" />
<ClInclude Include="swarm\asw_simple_drone.h" />
Expand Down
31 changes: 31 additions & 0 deletions src/game/shared/swarm/asw_weapon_shield_bubble_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,37 @@ BEGIN_DATADESC( CASW_Weapon_Shield_Bubble )
END_DATADESC()
#endif

void CASW_Weapon_Shield_Bubble::Precache()
{
BaseClass::Precache();

#ifndef CLIENT_DLL
UTIL_PrecacheOther( "asw_shieldgrenade_projectile" );
#endif
}

bool CASW_Weapon_Shield_Bubble::OffhandActivate()
{
#ifdef GAME_DLL
CBaseEntity *pProp = CreateEntityByName( "prop_dynamic" );
pProp->SetModelName( AllocPooledString( "models/items/shield_generator/shield_generator.mdl" ) );
pProp->Precache();
pProp->SetAbsOrigin( GetMoveParent()->GetAbsOrigin() );
pProp->Spawn();
pProp->SetMoveType( MOVETYPE_NONE );
pProp->AddEffects( EF_NOSHADOW );
CBaseEntity *pProp2 = CreateEntityByName( "prop_dynamic" );
pProp2->SetModelName( AllocPooledString( "models/items/shield_bubble/shield_bubble_arena.mdl" ) );
pProp2->Precache();
pProp2->SetAbsOrigin( GetMoveParent()->GetAbsOrigin() );
pProp2->Spawn();
pProp2->SetMoveType( MOVETYPE_NONE );
pProp2->AddEffects( EF_NOSHADOW );
UTIL_Remove( this );
#endif
return true;
}

// TODO: m_iShieldBubblePushedEnemy
// TODO: m_iShieldBubbleDamageAbsorbed
#endif
2 changes: 2 additions & 0 deletions src/game/shared/swarm/asw_weapon_shield_bubble_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class CASW_Weapon_Shield_Bubble : public CASW_Weapon
DECLARE_DATADESC();
#endif

void Precache() override;
bool OffhandActivate() override;
bool IsOffensiveWeapon() override { return false; }

Class_T Classify() override { return ( Class_T )CLASS_ASW_SHIELD_BUBBLE; }
Expand Down
2 changes: 1 addition & 1 deletion src/materialsystem/stdshaders/common_ps_fxc.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ float4 DecompressNormal( sampler NormalSampler, float2 tc, int nDecompressionMod
HALF3 NormalizeWithCubemap( sampler normalizeSampler, HALF3 input )
{
// return texCUBE( normalizeSampler, input ) * 2.0f - 1.0f;
return texCUBE( normalizeSampler, input );
return texCUBE( normalizeSampler, input ).xyz;
}

/*
Expand Down
12 changes: 6 additions & 6 deletions src/materialsystem/stdshaders/common_vertexlitgeneric_dx9.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ float3 DiffuseTerm(const bool bHalfLambert, const float3 worldNormal, const floa
float3 fOut = float3( fResult, fResult, fResult );
if ( bDoLightingWarp )
{
fOut = 2.0f * tex1D( lightWarpSampler, fResult );
fOut = 2.0f * tex1D( lightWarpSampler, fResult ).rgb;
}

return fOut;
Expand Down Expand Up @@ -131,7 +131,7 @@ float3 PixelShaderGetLightVector( const float3 worldPos, PixelShaderLightInfo cL
}
else
{
return normalize( cLightInfo[nLightIndex].pos - worldPos );
return normalize( cLightInfo[nLightIndex].pos.xyz - worldPos );
}
}

Expand Down Expand Up @@ -164,7 +164,7 @@ void SpecularAndRimTerms( const float3 vWorldNormal, const float3 vLightDir, con

// Optionally warp as function of scalar specular and fresnel
if ( bDoSpecularWarp )
specularLighting *= tex2D( specularWarpSampler, float2(specularLighting.x, fFresnel) ); // Sample at { (L.R)^k, fresnel }
specularLighting *= tex2D( specularWarpSampler, float2(specularLighting.x, fFresnel) ).rgb; // Sample at { (L.R)^k, fresnel }

specularLighting *= saturate(dot( vWorldNormal, vLightDir )); // Mask with N.L
specularLighting *= color; // Modulate with light color
Expand Down Expand Up @@ -257,17 +257,17 @@ float3 PixelShaderDoLightingLinear( const float3 worldPos, const float3 worldNor
if ( nNumLights > 0 )
{
linearColor += PixelShaderDoGeneralDiffuseLight( lightAtten.x, worldPos, worldNormal, NormalizeSampler,
cLightInfo[0].pos, cLightInfo[0].color, bHalfLambert,
cLightInfo[0].pos.xyz, cLightInfo[0].color.rgb, bHalfLambert,
bDoLightingWarp, lightWarpSampler );
if ( nNumLights > 1 )
{
linearColor += PixelShaderDoGeneralDiffuseLight( lightAtten.y, worldPos, worldNormal, NormalizeSampler,
cLightInfo[1].pos, cLightInfo[1].color, bHalfLambert,
cLightInfo[1].pos.xyz, cLightInfo[1].color.rgb, bHalfLambert,
bDoLightingWarp, lightWarpSampler );
if ( nNumLights > 2 )
{
linearColor += PixelShaderDoGeneralDiffuseLight( lightAtten.z, worldPos, worldNormal, NormalizeSampler,
cLightInfo[2].pos, cLightInfo[2].color, bHalfLambert,
cLightInfo[2].pos.xyz, cLightInfo[2].color.rgb, bHalfLambert,
bDoLightingWarp, lightWarpSampler );
if ( nNumLights > 3 )
{
Expand Down
Loading

0 comments on commit 0b3a6dc

Please sign in to comment.