just updating plugins to 64bit support

This commit is contained in:
jenz
2026-11-22 22:12:20 +01:00
parent 7a4f26c2bd
commit 2dca39be8a
32 changed files with 2990 additions and 516 deletions
+32 -47
View File
@@ -1,39 +1,22 @@
#pragma semicolon 1
#pragma newdecls required
#define PLUGIN_AUTHOR "Cloud Strife"
#define PLUGIN_VERSION "1.0"
#include <sourcemod>
#include <sdktools>
#include <dhooks>
#pragma newdecls required
public Plugin myinfo =
public Plugin myinfo =
{
name = "FixFuncRotating",
author = PLUGIN_AUTHOR,
author = "Cloud Strife",
description = "Fixes func_rotating`s StartForward and StopAtStartPos inputs",
version = PLUGIN_VERSION,
version = "1.0.6",
url = ""
};
Handle g_CFuncRotating_StartForward = null;
Handle g_CFuncRotating_UpdateSpeed = null;
/*
float FloatMod(float num, float denom)
{
return num - denom * RoundToFloor(num / denom);
}
float operator%(float oper1, float oper2)
{
return FloatMod(oper1, oper2);
}
*/
DynamicDetour g_CFuncRotating_StartForward = null;
DynamicDetour g_CFuncRotating_UpdateSpeed = null;
// Set m_bStopAtStartPos to false
public MRESReturn CFuncRotating_InputStartForward(int entity)
@@ -42,72 +25,74 @@ public MRESReturn CFuncRotating_InputStartForward(int entity)
return MRES_Ignored;
}
public MRESReturn CFuncRotating_UpdateSpeed(int entity, Handle hParams)
public MRESReturn CFuncRotating_UpdateSpeed(int entity, DHookParam hParams)
{
if(GetEntProp(entity, Prop_Data, "m_bStopAtStartPos", 1))
{
float flNewSpeed = view_as<float>(DHookGetParam(hParams, 1));
float flNewSpeed = hParams.Get(1);
if(flNewSpeed <= 25)
{
float vecMoveAng[3], angStart[3], angRotation[3], avelpertick[3];
GetEntPropVector(entity, Prop_Data, "m_vecMoveAng", vecMoveAng);
GetEntPropVector(entity, Prop_Data, "m_angStart", angStart);
GetEntPropVector(entity, Prop_Data, "m_angRotation", angRotation);
GetEntPropVector(entity, Prop_Data, "m_vecAngVelocity", avelpertick);
ScaleVector(avelpertick, GetTickInterval());
int checkAxis = 2;
if (vecMoveAng[0] != 0) checkAxis = 0;
else if ( vecMoveAng[1] != 0 ) checkAxis = 1;
float angDelta = ( angRotation[ checkAxis ] - angStart[ checkAxis ] )%360.0;
if ( angDelta > 180.0 ) angDelta -= 360.0;
if(FloatAbs(angDelta) < FloatAbs(avelpertick[ checkAxis ]))
{
SetEntPropVector(entity, Prop_Data, "m_angRotation", angStart);
return MRES_Ignored;
}
}
{
SetEntPropVector(entity, Prop_Data, "m_angRotation", angStart);
return MRES_Ignored;
}
}
}
return MRES_Ignored;
}
public void OnPluginStart()
{
Handle hGameConf = LoadGameConfigFile("FixFuncRotating.games");
if(hGameConf == INVALID_HANDLE)
GameData hGameConf = new GameData("FixFuncRotating.games");
if(hGameConf == null)
{
LogError("Couldn't load FixFuncRotating.games game config!");
return;
}
Address pStartForward = GameConfGetAddress(hGameConf, "CFuncRotating::InputStartForward");
Address pStartForward = hGameConf.GetAddress("CFuncRotating::InputStartForward");
if(pStartForward)
{
g_CFuncRotating_StartForward = DHookCreateDetour(pStartForward, CallConv_THISCALL, ReturnType_Void, ThisPointer_CBaseEntity);
if(!DHookEnableDetour(g_CFuncRotating_StartForward, false, CFuncRotating_InputStartForward))
g_CFuncRotating_StartForward = new DynamicDetour(pStartForward, CallConv_THISCALL, ReturnType_Void, ThisPointer_CBaseEntity);
if(!g_CFuncRotating_StartForward.Enable(Hook_Pre, CFuncRotating_InputStartForward))
{
LogError("Could not enable detour for CFuncRotating::InputStartForward");
}
}
else LogError("Could not find CFuncRotating::InputStartForward address");
Address pUpdateSpeed = GameConfGetAddress(hGameConf, "CFuncRotating::UpdateSpeed");
Address pUpdateSpeed = hGameConf.GetAddress("CFuncRotating::UpdateSpeed");
if(!pUpdateSpeed)
{
LogError("Could not find CFuncRotating::UpdateSpeed address");
delete hGameConf;
return;
}
g_CFuncRotating_UpdateSpeed = DHookCreateDetour(pUpdateSpeed, CallConv_THISCALL, ReturnType_Void, ThisPointer_CBaseEntity);
DHookAddParam(g_CFuncRotating_UpdateSpeed, HookParamType_Float);
if(!DHookEnableDetour(g_CFuncRotating_UpdateSpeed, false, CFuncRotating_UpdateSpeed))
g_CFuncRotating_UpdateSpeed = new DynamicDetour(pUpdateSpeed, CallConv_THISCALL, ReturnType_Void, ThisPointer_CBaseEntity);
g_CFuncRotating_UpdateSpeed.AddParam(HookParamType_Float);
if(!g_CFuncRotating_UpdateSpeed.Enable(Hook_Pre, CFuncRotating_UpdateSpeed))
{
LogError("Could not enable detour for CFuncRotating::UpdateSpeed");
}
delete hGameConf;
}