/* * shavit's Timer - tas.inc file * by: xutaxkamay, shavit * * This file is part of shavit's Timer. * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License, version 3.0, as published by the * Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program. If not, see . * */ #if defined _shavit_tas_included #endinput #endif #define _shavit_tas_included #define TAS_STYLE_SETTING "tas" enum { Type_Normal, // only w/s disables autostrafe Type_SurfOverride, // w/s always disables, a/d only over surf ramps Type_Override, // all keys disable Type_Size // size }; // taken from shavit's oryx stock bool IsSurfing(int client) { float fPosition[3]; GetClientAbsOrigin(client, fPosition); float fEnd[3]; fEnd = fPosition; fEnd[2] -= 64.0; float fMins[3]; GetEntPropVector(client, Prop_Send, "m_vecMins", fMins); float fMaxs[3]; GetEntPropVector(client, Prop_Send, "m_vecMaxs", fMaxs); Handle hTR = TR_TraceHullFilterEx(fPosition, fEnd, fMins, fMaxs, MASK_PLAYERSOLID, TRFilter_NoPlayers, client); if(TR_DidHit(hTR)) { float fNormal[3]; TR_GetPlaneNormal(hTR, fNormal); delete hTR; // If the plane normal's Z axis is 0.7 or below (alternatively, -0.7 when upside-down) then it's a surf ramp. // https://github.com/alliedmodders/hl2sdk/blob/92dcf04225a278b75170cc84917f04e98f5d08ec/game/server/physics_main.cpp#L1059 // https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/game/server/physics_main.cpp#L1065 return (-0.7 <= fNormal[2] <= 0.7); } delete hTR; return false; } public bool TRFilter_NoPlayers(int entity, int mask, any data) { return (entity != view_as(data) || (entity < 1 || entity > MaxClients)); }