Senior Member
|
07-18-2018
, 10:56
Help converting to new-style declarations
|
#1
|
I am converting one of my plugins to the new-style declarations, everything went smoothly, then all hell broke loose with enum and some of the include functions. I'm sure this is an easy task, just not as familiar with some of the new format since I've been using the old style for so long. Thanks for any help getting this working.
PHP Code:
#include <sourcemod>
#pragma newdecls required; #pragma semicolon 1;
enum FX { FxNone = 0, FxPulseFast, FxPulseSlowWide, FxPulseFastWide, FxFadeSlow, FxFadeFast, FxSolidSlow, FxSolidFast, FxStrobeSlow, FxStrobeFast, FxStrobeFaster, FxFlickerSlow, FxFlickerFast, FxNoDissipation, FxDistort, // Distort/scale/translate flicker FxHologram, // kRenderFxDistort + distance fade FxExplode, // Scale up really big! FxGlowShell, // Glowing Shell FxClampMinScale, // Keep this sprite from getting very small (SPRITES only!) FxEnvRain, // for environmental rendermode, make rain FxEnvSnow, // " " " , make snow FxSpotlight, FxRagdoll, FxPulseFastWider };
enum Render { Normal = 0, // src TransColor, // c*a+dest*(1-a) TransTexture, // src*a+dest*(1-a) Glow, // src*a+dest -- No Z buffer checks -- Fixed size in screen space TransAlpha, // src*srca+dest*(1-srca) TransAdd, // src*a+dest Environmental, // not drawn, used for environmental effects TransAddFrameBlend, // use a fractional frame value to blend between animation frames TransAlphaAdd, // src + dest*(1-a) WorldGlow, // Same as kRenderGlow but not fixed size in screen space None, // Don't render. };
stock void NotWorking() {
/* WARNINGS 'FX:' is an old-style tag operation; use view_as<FX>(expression) instead 'Render:' is an old-style tag operation; use view_as<Render>(expression) instead */
SetRendering(client, FX:FxDistort, 255, 255, 255, Render:RENDER_TRANSADD, 255); }
stock void SetRendering(index, FX:fx=FxNone, r=255, g=255, b=255, Render:render=Normal, amount=255) {
/*: WARNING: 'FX:' is an old-style tag operation; use view_as<FX>(expression) instead WARNING: 'Render:' is an old-style tag operation; use view_as<Render>(expression) instead ERROR: new-style declarations are required */
SetEntProp(index, Prop_Send, "m_nRenderFX", _:fx, 1); // WARNING: '_:' is an old-style tag operation; use view_as<int>(expression) instead SetEntProp(index, Prop_Send, "m_nRenderMode", _:render, 1); // WARNING '_:' is an old-style tag operation; use view_as<int>(expression) instead SetEntData(index, RenderOffs, r, 1, true); SetEntData(index, RenderOffs + 1, g, 1, true); SetEntData(index, RenderOffs + 2, b, 1, true); SetEntData(index, RenderOffs + 3, amount, 1, true); }
__________________
{__ PIRATES COVE __} ● HIGH-KILL Community | Stats ●
Half-Life 2: Deathmatch
66.151.244.149:27016 => CONNECT
Last edited by scorpius2k1; 07-18-2018 at 11:19.
|
|