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

[TF2] Play unused Shortstop shove anim


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Pelipoika
Veteran Member
Join Date: May 2012
Location: Inside
Old 01-17-2017 , 16:02   [TF2] Play unused Shortstop shove anim
Reply With Quote #1

PHP Code:
#include <sdktools>
#include <sdkhooks>
#include <dhooks>

#pragma newdecls required

//DHook
Handle g_hGetSecondaryAttackActivity

//SDKCall
Handle g_hSDKPlayGesture;

public 
Plugin myinfo 
{
    
name "[TF2] ",
    
author "Pelipoika",
    
description "",
    
version "1.0",
    
url "http://www.sourcemod.net/plugins.php?author=Pelipoika&search=1"
};

//tf_weapon_handgun_scout_primary 
//ACT_MP_PUSH_STAND_SECONDARY  1817
//ACT_MP_PUSH_CROUCH_SECONDARY 1818
//ACT_MP_PUSH_SWIM_SECONDARY   1819
//CTFPlayer::PlayGesture "mp_playgesture: unknown sequence or act"

public void OnPluginStart()
{
    
//CTFPistol_ScoutPrimary::SecondaryAttack
    
g_hGetSecondaryAttackActivity DHookCreate(279HookType_EntityReturnType_IntThisPointer_CBaseEntityCTFPistol_ScoutPrimary__SecondaryAttack);
    
DHookAddParam(g_hGetSecondaryAttackActivityHookParamType_CBaseEntity);
    
    
StartPrepSDKCall(SDKCall_Player);
    
PrepSDKCall_SetSignature(SDKLibrary_Server"\x55\x8B\xEC\x83\xEC\x30\x53\x56\x8B\x75\x08\x57\x56\x8B\xF9\xE8\x2A\x2A\x2A\x2A\x8B\xD8\x83\xFB\xFF\x74\x2A\x8B\x35\x2A\x2A\x2A\x2A\x8B\xCE\x8B\x16\xFF\x52\x64\x8B\x8F\xF0\x1F\x00\x00\x53\x6A\x14"49);
    
PrepSDKCall_AddParameter(SDKType_StringSDKPass_Pointer);
    if ((
g_hSDKPlayGesture EndPrepSDKCall()) == INVALID_HANDLESetFailState("Failed to create SDKCall for CTFPlayer::PlayGesture offset!");
}

public 
void OnEntityCreated(int ent, const char[] classname)
{
    if(
StrEqual(classname"tf_weapon_handgun_scout_primary"))
    {
        
SDKHook(entSDKHook_SpawnOnCTFPistol_ScoutPrimarySpawn);
    }
}

public 
void OnCTFPistol_ScoutPrimarySpawn(int wep)
{
    
DHookEntity(g_hGetSecondaryAttackActivitytruewep);
}

public 
MRESReturn CTFPistol_ScoutPrimary__SecondaryAttack(int pThisHandle hReturnHandle hParams)
{
    
int client GetEntPropEnt(pThisProp_Data"m_hOwnerEntity");
    if(
client 0)
    {
        if(
GetEntProp(clientProp_Send"m_nWaterLevel") >= 2)
        {
            
SDKCall(g_hSDKPlayGestureclient"ACT_MP_PUSH_SWIM_SECONDARY");
        }
        else if(
GetEntProp(clientProp_Send"m_bDucked")) 
        {
            
SDKCall(g_hSDKPlayGestureclient"ACT_MP_PUSH_CROUCH_SECONDARY");
        }
        else         
        {
            
SDKCall(g_hSDKPlayGestureclient"ACT_MP_PUSH_STAND_SECONDARY");
        }
    }
    
    return 
MRES_Ignored;

DHooks and stuff, if you're gonna release this or something put the gamedata in a config
__________________

Last edited by Pelipoika; 01-17-2017 at 16:03.
Pelipoika is offline
404UserNotFound
BANNED
Join Date: Dec 2011
Old 01-17-2017 , 19:07   Re: [TF2] Play unused Shortstop shove anim
Reply With Quote #2

This started out as an idea for a plugin I had after reading that the shortstop's thirdperson (or "world") shove anims are present but unused entirely ingame.

After some dicking around with things myself for an hour and a half, Peli made a working plugin within like 5 minutes.

Yer a wizard, Peli.

And big thanks to /r/tf2 user Very_geeky_and_sad for a comment he posted regarding the unused shove animations. That's why this whole idea came to be.

Last edited by 404UserNotFound; 01-17-2017 at 20:41.
404UserNotFound is offline
xXDeathreusXx
Veteran Member
Join Date: Mar 2013
Location: pPlayer->GetOrigin();
Old 01-19-2017 , 19:49   Re: [TF2] Play unused Shortstop shove anim
Reply With Quote #3

How did you find the ACT_ definitions? Are they stored in the model, or?
__________________
Plugins|Profile
Requests closed

I'm a smartass by nature, get used to it

Last edited by xXDeathreusXx; 01-19-2017 at 19:50.
xXDeathreusXx is offline
404UserNotFound
BANNED
Join Date: Dec 2011
Old 01-19-2017 , 21:18   Re: [TF2] Play unused Shortstop shove anim
Reply With Quote #4

Quote:
Originally Posted by xXDeathreusXx View Post
How did you find the ACT_ definitions? Are they stored in the model, or?
I grabbed em from Hammer for Peli. Create prop_dynamic, set model, choose player model in the Hammer model browser. Select activities tab. Done. I'm sure there are easier ways to get the ACT_ definitions, but the Hammer method also has the 3D model preview so you can actually view the animation associated with each ACT_.

Last edited by 404UserNotFound; 01-19-2017 at 21:19.
404UserNotFound is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 01-19-2017 , 23:51   Re: [TF2] Play unused Shortstop shove anim
Reply With Quote #5

Quote:
Originally Posted by abrandnewday View Post
I'm sure there are easier ways to get the ACT_ definitions, but the Hammer method also has the 3D model preview so you can actually view the animation associated with each ACT_.
Just took a look through HLMV myself. Turns out you can also use that, which is pretty handy since it already comes bundled with TF2.

Load in the model, tick View → Show Activities, and browse the animations with the dropdown in the Sequence tab.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop is offline
404UserNotFound
BANNED
Join Date: Dec 2011
Old 01-20-2017 , 12:57   Re: [TF2] Play unused Shortstop shove anim
Reply With Quote #6

Shit, and here I thought it only showed the sequence names and not the "ACT" names. Good to know! Thanks nosoop, you've saved the day again


EDIT: I released an actual factual plugin for this that you can use for Windows/Linux servers!

Last edited by 404UserNotFound; 01-20-2017 at 19:53.
404UserNotFound is offline
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 01-29-2017 , 04:35   Re: [TF2] Play unused Shortstop shove anim
Reply With Quote #7

Can any other animations be played through this method?
__________________
Chdata is offline
Pelipoika
Veteran Member
Join Date: May 2012
Location: Inside
Old 01-29-2017 , 08:12   Re: [TF2] Play unused Shortstop shove anim
Reply With Quote #8

Quote:
Originally Posted by Chdata View Post
Can any other animations be played through this method?
Spoiler
__________________

Last edited by Pelipoika; 01-29-2017 at 08:13. Reason: SPOLER
Pelipoika is offline
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 01-29-2017 , 14:04   Re: [TF2] Play unused Shortstop shove anim
Reply With Quote #9

So combined with that stuff from Stop That Tank we have some neat stuff to play with

PHP Code:
/*
    Animation Sequences
    Thanks to Stop That Tank!
*/

static Handle:g_hSDKSendWeaponAnim;
static 
Handle:g_hSDKPlaySpecificSequence;

stock OnPluginStart_RegisterAnimData()
{
    new 
Handle:hGameData LoadGameConfigFile("anim.data");
    if (
hGameData == INVALID_HANDLE)
    {
        
SetFailState("Unable to load required gamedata (anim.data.txt)");
    }

    
// This call is used to play the knife blocked animation.
    
StartPrepSDKCall(SDKCall_Entity);
    
PrepSDKCall_SetFromConf(hGameDataSDKConf_Signature"CTFWeaponBase::SendWeaponAnim");
    
PrepSDKCall_AddParameter(SDKType_PlainOldDataSDKPass_Plain);
    
g_hSDKSendWeaponAnim EndPrepSDKCall();

    if (
g_hSDKSendWeaponAnim == INVALID_HANDLE)
    {
        
StartPrepSDKCall(SDKCall_Entity);
        
PrepSDKCall_SetFromConf(hGameDataSDKConf_Virtual"CTFWeaponBase::SendWeaponAnim");
        
PrepSDKCall_AddParameter(SDKType_PlainOldDataSDKPass_Plain);
        
g_hSDKSendWeaponAnim EndPrepSDKCall();
        if (
g_hSDKSendWeaponAnim == INVALID_HANDLE)
        {
            
LogMessage("Failed to create call: CTFWeaponBase::SendWeaponAnim!");
        }
    }

    
// This call is used to set the deploy animation on the robots with the bomb
    
StartPrepSDKCall(SDKCall_Player);
    
PrepSDKCall_SetFromConf(hGameDataSDKConf_Signature"CTFPlayer::PlaySpecificSequence");
    
PrepSDKCall_AddParameter(SDKType_StringSDKPass_Pointer);
    
g_hSDKPlaySpecificSequence EndPrepSDKCall();
    if (
g_hSDKPlaySpecificSequence == INVALID_HANDLE)
    {
        
LogMessage("Failed to create call: CTFPlayer::PlaySpecificSequence!");
    }
}

stock SDK_SendWeaponAnim(weaponanim)
{
    if (
g_hSDKSendWeaponAnim != INVALID_HANDLE)
    {
        
SDKCall(g_hSDKSendWeaponAnimweaponanim);
    }
}

stock SDK_PlaySpecificSequence(clientString:strSequence[])
{
    if (
g_hSDKPlaySpecificSequence != INVALID_HANDLE)
    {
        
SDKCall(g_hSDKPlaySpecificSequenceclientstrSequence);
    }

anim.data.txt
Code:
"Games"
{
    "tf"
    {
        "Signatures"
        {
            "CTFPlayer::PlaySpecificSequence"
            {
                "library"   "server"
                "linux"     "@_ZN9CTFPlayer20PlaySpecificSequenceEPKc"
                "windows"   "\x55\x8B\xEC\x83\xEC\x30\x53\x56\x8B\x75\x08\x57\x56\x8B\xF9\xE8\x2A\x2A\x2A\x2A\x8B\xD8\x83\xFB\xFF\x74\x2A\x8B\x35\x2A\x2A\x2A\x2A\x8B\xCE\x8B\x16\xFF\x52\x2A\x8B\x8F\x2A\x2A\x2A\x2A\x53\x6A\x13\x8B\x01\xFF\x50"
            }
            "CTFWeaponBase::SendWeaponAnim"
            {
                "library"   "server"
                "linux"     "@_ZN13CTFWeaponBase14SendWeaponAnimEi"
            }
        }
        "Offsets"
        {
            "CTFWeaponBase::SendWeaponAnim"
            {
                "library"   "server"
                "linux"     "247"
                "windows"   "241"
            }
        }
    }
}
Stun animation on knives when backstabbing Razorback.
PHP Code:
SDK_SendWeaponAnim(iWeapon0x61B); 
They also have one for CTFPlayer::Taunt or w/e, dunno if it's any much different from things like what tauntem does though.
__________________

Last edited by Chdata; 01-29-2017 at 14:05.
Chdata is offline
404UserNotFound
BANNED
Join Date: Dec 2011
Old 01-29-2017 , 18:22   Re: [TF2] Play unused Shortstop shove anim
Reply With Quote #10

It's a shame that there's not yet any viable way of setting up an automatic gamedata generator or some sort of autoupdating "master gamedata" file that other developers could hook into when things requiring offsets/signatures come into play. Or even any way to actively make the plugin search for the offsets/signatures itself and have the plugin update them when they update in the gamedata file.
404UserNotFound 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 17:34.


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