Raised This Month: $319 Target: $400
 79%   Almost there!

[TF2/ANY?] CBaseAnimatingOverlay.inc


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Pelipoika
Veteran Member
Join Date: May 2012
Location: Inside
Old 07-27-2017 , 11:53   [TF2/ANY?] CBaseAnimatingOverlay.inc
Reply With Quote #1

An unsafe way to access CBaseAnimatingOverlay and it's layers info.

PHP Code:
#if defined _CBaseAnimatingOverlay_included
 #endinput
#endif
#define _CBaseAnimatingOverlay_included

#include <sourcemod>
#include <sdktools>

#define ANIM_LAYER_ACTIVE        0x0001
#define ANIM_LAYER_AUTOKILL        0x0002
#define ANIM_LAYER_KILLME        0x0004
#define ANIM_LAYER_DONTRESTORE    0x0008
#define ANIM_LAYER_CHECKACCESS    0x0010
#define ANIM_LAYER_DYING        0x0020

#define MAX_OVERLAYS 15

enum //CAnimationLayer
{
    
m_fFlags 0,               //0x0000 
    
m_bSequenceFinished 4,    //0x0004 
    
m_bLooping 6,             //0x0006 
    
m_nSequence 8,            //0x0008 
    
m_flCycle 12,             //0x000C 
    
m_flPrevCycle 16,         //0x0010 
    
m_flWeight 20,            //0x0014 
    
m_flPlaybackRate 24,      //0x0018 
    
m_flBlendIn 28,           //0x001C 
    
m_flBlendOut 32,          //0x0020 
    
m_flKillRate 36,          //0x0024 
    
m_flKillDelay 40,         //0x0028 
    
m_flLayerAnimtime 44,     //0x002C 
    
m_flLayerFadeOuttime 48,  //0x0030 
    
m_nActivity 52,           //0x0034 
    
m_nPriority 56,           //0x0038 
    
m_nOrder 60,              //0x003C 
    
m_flLastEventCheck 64,    //0x0040 
    
m_flLastEventAccess 68,   //0x0044 
    
m_pOwnerEntity 72,        //0x0048 
    
    
CAnimationLayer_Size 76   //0x004C
}; //Size=0x004C

//int CBaseAnimatingOverlay_Size = CAnimationLayer_Size * MAX_OVERLAYS

methodmap CAnimationLayer 
{
    
property Address Address 
    
{
        public 
get() 
        {
            return 
view_as<Address>(this);
        }
    }

    public 
any Get(int offset)
    {
        return 
LoadFromAddress(this.Address view_as<Address>(offset), NumberType_Int32);
    }
    
    public 
void Set(int offsetany value)
    {
        
StoreToAddress(this.Address view_as<Address>(offset), valueNumberType_Int32);
    }
    
    public 
bool IsActive()   { return ((this.Get(m_fFlags) & ANIM_LAYER_ACTIVE)   != 0); }
    public 
bool IsAutokill() { return ((this.Get(m_fFlags) & ANIM_LAYER_AUTOKILL) != 0); }
    public 
bool IsKillMe()   { return ((this.Get(m_fFlags) & ANIM_LAYER_KILLME)   != 0); }
    public 
bool IsDying()    { return ((this.Get(m_fFlags) & ANIM_LAYER_DYING)    != 0); }
    public 
bool IsAutoramp() { return ((this.Get(m_flBlendIn) != 0.0) || (this.Get(m_flBlendOut) != 0.0)); }
    public 
void KillMe()     { int fFlags this.Get(m_fFlags); this.Set(m_fFlags, (fFlags |= ANIM_LAYER_KILLME)); }
    public 
void Dying()      { int fFlags this.Get(m_fFlags); this.Set(m_fFlags, (fFlags |= ANIM_LAYER_DYING));  }
    public 
void Dead()       { int fFlags this.Get(m_fFlags); this.Set(m_fFlags, (fFlags &= ~ANIM_LAYER_DYING)); }
}

methodmap CBaseAnimatingOverlay CAnimationLayer
{
    public 
CBaseAnimatingOverlay(int entity
    {
        
int iOffset = (view_as<int>(GetEntityAddress(entity)) + FindDataMapInfo(entity"m_AnimOverlay")) + view_as<int>(0x10);
        
Address Overlay view_as<Address>(LoadFromAddress(view_as<Address>(iOffset), NumberType_Int32));
    
        return 
view_as<CBaseAnimatingOverlay>(Overlay);
    }
    
    public 
CAnimationLayer GetLayer(int iLayer)
    {
        return 
view_as<CAnimationLayer>(this.Address view_as<Address>(iLayer CAnimationLayer_Size));
    }
}

stock int FindGestureLayer(int entityint activity)
{
    
CBaseAnimatingOverlay overlay CBaseAnimatingOverlay(entity);
    
    for (
int i 015i++)
    {
        
CAnimationLayer layer overlay.GetLayer(i);
        
        if(!(
layer.IsActive()))
            continue;                
        
        if(
layer.IsKillMe())
            continue;
        
        if(
layer.Get(m_nActivity) == activity || layer.Get(m_nSequence) == activity)
            return 
i;
    }
    
    return -
1;
}

//-----------------------------------------------------------------------------
// Purpose: 
// Input  : activity - 
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
stock bool IsPlayingGesture(int entityint activity)
{
    return 
FindGestureLayerentityactivity ) != -true false;

Propably not a good idea to try use this on players

EDIT: i guess it does work on players afterall

PHP Code:
CBaseAnimatingOverlay overlay CBaseAnimatingOverlay(client);
CAnimationLayer layer overlay.GetLayer(0);
PrintToServer("overlay %x layer %x %i %i"overlaylayerlayer.Get(m_nSequence), layer.Get(m_nActivity)); 
Code:
overlay af54280 layer af54280 0 -1
overlay af54280 layer af54280 147 1113
overlay af54280 layer af54280 147 1113
overlay af54280 layer af54280 147 1113
overlay af54280 layer af54280 145 1112
overlay af54280 layer af54280 145 1112
overlay af54280 layer af54280 145 1112
overlay af54280 layer af54280 0 -1
Attached Files
File Type: inc CBaseAnimatingOverlay.inc (6.7 KB, 382 views)
__________________

Last edited by Pelipoika; 07-28-2017 at 07:58.
Pelipoika is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Brexit
Old 07-27-2017 , 19:01   Re: [TF2/ANY?] CBaseAnimatingOverlay.inc
Reply With Quote #2

Wha O.O
I was looking in to this.
Maybe ill give it a play see what i can do with it sometime.
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux is offline
IQuitTF2AndYouShouldToo
( ͡ ͜ʖ ͡)
Join Date: Dec 2011
Old 07-28-2017 , 05:29   Re: [TF2/ANY?] CBaseAnimatingOverlay.inc
Reply With Quote #3

Quote:
Originally Posted by Pelipoika View Post
An unsafe way to access CBaseAnimatingOverlay and it's layers info.

Propably not a good idea to try use this on players
Why is it unsafe on players?
IQuitTF2AndYouShouldToo is offline
gubka
Veteran Member
Join Date: Jan 2012
Location: UK
Old 03-15-2019 , 07:52   Re: [TF2/ANY?] CBaseAnimatingOverlay.inc
Reply With Quote #4

Fix of wrong access to overlays (CS:GO)
also change StudioAdvanced to CBaseAnimatingOverlay class, fixed with removing, and many other
https://forums.alliedmods.net/showth...06#post2643406
__________________
gubka is offline
Send a message via ICQ to gubka Send a message via Skype™ to gubka
Reply


Thread Tools
Display Modes

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 07:13.


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