-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
287 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* 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 <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
#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<int>(data) || (entity < 1 || entity > MaxClients)); | ||
} |
Oops, something went wrong.