Raised This Month: $51 Target: $400
 12% 

Help converting to new-style declarations


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
scorpius2k1
Senior Member
Join Date: Feb 2016
Old 07-18-2018 , 10:56   Help converting to new-style declarations
Reply With Quote #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(clientFX:FxDistort255255255Render:RENDER_TRANSADD255);
}

stock void SetRendering(indexFX:fx=FxNoner=255g=255b=255Render:render=Normalamount=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(indexProp_Send"m_nRenderFX"_:fx1); // WARNING: '_:' is an old-style tag operation; use view_as<int>(expression) instead
    
SetEntProp(indexProp_Send"m_nRenderMode"_:render1); // WARNING '_:' is an old-style tag operation; use view_as<int>(expression) instead
    
SetEntData(indexRenderOffsr1true);
    
SetEntData(indexRenderOffs 1g1true);
    
SetEntData(indexRenderOffs 2b1true);
    
SetEntData(indexRenderOffs 3amount1true);    

__________________
{__ 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.
scorpius2k1 is offline
Facksy
Senior Member
Join Date: Apr 2017
Location: +2+2
Old 07-18-2018 , 11:17   Re: Help converting to new-style declarations
Reply With Quote #2

You can use this to convert old syntax to new one:
https://forums.alliedmods.net/showthread.php?t=290805
__________________
My Steam I take private requests if related with TF2
My Plugins
Facksy is offline
scorpius2k1
Senior Member
Join Date: Feb 2016
Old 07-18-2018 , 11:31   Re: Help converting to new-style declarations
Reply With Quote #3

Quote:
Originally Posted by Facksy View Post
You can use this to convert old syntax to new one:
https://forums.alliedmods.net/showthread.php?t=290805
I wasn't able to get it to work unfortunately, I'm on Linux so I think the way the paths are handled in it are incompatible. Thanks for the link though Facksy, I appreciate it.

I just don't understand how to call the enumerations properly with the new-style syntax if someone could show examples on how to fix the warnings, I can figure out the error part.

Thanks again.
__________________
{__ PIRATES COVE __} ● HIGH-KILL Community | Stats ●
Half-Life 2: Deathmatch
66.151.244.149:27016 => CONNECT
scorpius2k1 is offline
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 07-18-2018 , 11:56   Re: Help converting to new-style declarations
Reply With Quote #4

this should work
PHP Code:
void SetRendering(int indexFX fx=FxNoneint r=255int g=255int b=255Render render=Normalint amount=255
https://forums.alliedmods.net/showthread.php?t=244092
__________________
coding & free software

Last edited by shanapu; 07-18-2018 at 11:57.
shanapu is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:10.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode