mirror of
https://github.com/ValveSoftware/source-sdk-2013.git
synced 2026-01-25 00:32:37 +01:00
Added .vmt configurable horizontal texture scrolling to BuildingRescueLevel material proxy
This commit is contained in:
@@ -76,6 +76,9 @@
|
||||
#include "netadr.h"
|
||||
#include "input.h"
|
||||
|
||||
// for rescue ranger
|
||||
#include "materialsystem/imaterialproxy.h"
|
||||
|
||||
#include "gcsdk/gcclientsdk.h"
|
||||
#include "econ_gcmessages.h"
|
||||
#include "rtime.h"
|
||||
@@ -2289,12 +2292,31 @@ public:
|
||||
EXPOSE_INTERFACE( CProxyBenefactorLevel, IMaterialProxy, "BenefactorLevel" IMATERIAL_PROXY_INTERFACE_VERSION );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Used for scaling the oscilloscope on the Building Rescue Gun
|
||||
// Flattens the Wave when the player has no energy
|
||||
// Purpose: Used for scaling the oscilloscope on the Rescue Ranger
|
||||
// Flattens the Wave when the player has insufficent energy to rescue buildings
|
||||
// Wave has horizontal scrolling whose speed and direction can be controlled from material proxy
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class CProxyBuildingRescueLevel : public CResultProxy
|
||||
{
|
||||
public:
|
||||
// Add this member (default to something safe)
|
||||
float m_flScrollSpeed = -0.1f;
|
||||
|
||||
virtual bool Init( IMaterial *pMaterial, KeyValues *pKeyValues )
|
||||
{
|
||||
// Call base init first if needed
|
||||
if ( !CResultProxy::Init( pMaterial, pKeyValues ) )
|
||||
return false;
|
||||
|
||||
// pKeyValues points to the { "screenScrollRate" "#" ... } subkey
|
||||
if ( pKeyValues )
|
||||
{
|
||||
m_flScrollSpeed = pKeyValues->GetFloat( "screenScrollRate", -0.1f ); // fallback if missing
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
void OnBind( void *pC_BaseEntity )
|
||||
{
|
||||
Assert( m_pResult );
|
||||
@@ -2338,6 +2360,17 @@ public:
|
||||
MatrixBuildTranslation( temp, center.x, center.y, 0.0f );
|
||||
MatrixMultiply( temp, mat, mat );
|
||||
|
||||
|
||||
float flScrollSpeed = m_flScrollSpeed;
|
||||
|
||||
float scrollOffset = fmodf( gpGlobals->curtime * flScrollSpeed, 1.0f );
|
||||
if ( scrollOffset < 0.0f )
|
||||
scrollOffset += 1.0f; // [0,1) range for seamless loop
|
||||
|
||||
// Apply horizontal scroll AFTER the existing scale/center operations
|
||||
MatrixBuildTranslation( temp, scrollOffset, 0.0f, 0.0f );
|
||||
MatrixMultiply( temp, mat, mat );
|
||||
|
||||
m_pResult->SetMatrixValue( mat );
|
||||
|
||||
if ( ToolsEnabled() )
|
||||
@@ -2347,7 +2380,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
EXPOSE_INTERFACE( CProxyBuildingRescueLevel, IMaterialProxy, "BuildingRescueLevel" IMATERIAL_PROXY_INTERFACE_VERSION );
|
||||
EXPOSE_INTERFACE(CProxyBuildingRescueLevel, IMaterialProxy, "BuildingRescueLevel" IMATERIAL_PROXY_INTERFACE_VERSION);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user