This repository has been archived by the owner on Jan 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
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
76 changed files
with
9,752 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,22 @@ | ||
# Left4TAS | ||
TAS Plugin for Left 4 Dead 2 | ||
|
||
The current version is considered the basis for further promotion of the toolkit | ||
|
||
At the moment there is the most basic things for creating a TAS on the Source Engine: frame-by-frame input, autostrafer, callbacks (execution of .cfg files and VScripts), various console commands/variables, and HUD | ||
|
||
Some features were based on [SourcePauseTool](https://github.com/YaLTeR/SourcePauseTool "SourcePauseTool") | ||
|
||
# Wiki | ||
Here I will link to the wiki page when I write it =) | ||
|
||
# Project | ||
The project is written in Visual Studio 2019 | ||
|
||
You must have an unofficial [L4D2 SDK](https://github.com/alliedmodders/hl2sdk/tree/l4d2 "L4D2 SDK") from AlliedModders and the disassembler library [libdasm](https://github.com/jtpereyda/libdasm "libdasm") in the project | ||
|
||
# Post-TLS versions | ||
I am not going to support the versions that came out during the TLS update and after | ||
|
||
# Issues | ||
If you are playing on version 2.1.5.5 and below, and encountered bugs or if the plugin was unable to initialize all of its functions, please report it. Write the version of the game and a message in console that the plugin wrote during the failed initialization of all functions. If the problem is different, then I will try to solve it if possible |
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,12 @@ | ||
// Executable TAS script for l4d2_bhop_emf (wrapper) | ||
|
||
// tas_strafe_buttons 4017 | ||
|
||
tas_remove_triggers | ||
tas_create_trigger tas_trigger_touch1 -2314.920 1784.495 129.964 -2050.225 1510.190 -26.083 | ||
|
||
timer_reset | ||
tas_strafe_ignore_ground 1 | ||
tas_tp -64 37 0.03125 0 90 | ||
|
||
wait_frames 30 "exec tas_l4d2_bhop_emf_script" |
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,19 @@ | ||
// Executable TAS script for l4d2_bhop_emf | ||
|
||
tas_setyaw 122 | ||
tas_strafe_yaw 180 | ||
|
||
+forward | ||
|
||
wait_frames 50 "+jump; -forward; tas_strafe 1" | ||
wait_frames 80 "tas_strafe_yaw 175" | ||
wait_frames 105 "tas_strafe_yaw 180" | ||
wait_frames 140 "+duck" | ||
wait_frames 220 "-duck" | ||
wait_frames 230 "+duck" | ||
wait_frames 277 "tas_strafe_yaw 177" | ||
wait_frames 310 "tas_strafe_yaw -170" | ||
wait_frames 325 "tas_strafe_yaw 180" | ||
wait_frames 350 "tas_strafe_yaw -130" | ||
wait_frames 385 "+duck; tas_strafe_yaw -100" | ||
wait_frames 403 "+duck; tas_strafe_yaw -125" |
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,7 @@ | ||
// Left4TAS was loaded | ||
|
||
vhud_enable 1 | ||
sv_cheats 1 | ||
|
||
// bind g "exec tas_l4d2_bhop_emf" | ||
// bind h "exec tas_stop" |
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,5 @@ | ||
// Trigger was touched | ||
|
||
tas_create_trigger tas_trigger_touch2 235.557 23.364 -11.078 140.713 92.926 113.904 | ||
|
||
timer_start |
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,8 @@ | ||
// Trigger was touched | ||
|
||
timer_stop | ||
timer_print_ticks | ||
timer_print_time | ||
|
||
tas_strafe 0 | ||
-jump;-duck |
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,3 @@ | ||
// Intro was finished | ||
|
||
echo Executed tas_intro_finish.cfg |
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,3 @@ | ||
// Map was loaded | ||
|
||
echo Executed tas_map_load.cfg |
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,3 @@ | ||
// Left4TAS was loaded | ||
|
||
echo Executed tas_plugin_load.cfg |
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,3 @@ | ||
// Round was finished (transition began or finale escaped finished) | ||
|
||
echo Executed tas_round_end.cfg |
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,3 @@ | ||
// Round was (re)started | ||
|
||
echo Executed tas_round_start.cfg |
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,36 @@ | ||
// Squirrel | ||
// Left4TAS | ||
|
||
L4TAS_TIMER_ROUND_RESTART <- 0; | ||
L4TAS_TIMER_MAP_LOADED <- 1; | ||
L4TAS_TIMER_INTRO_FINISHED <- 2; | ||
L4TAS_TIMER_CUSTOM <- 3; | ||
|
||
// OnTimerStart callback | ||
function OnTimerStart( type ) | ||
{ | ||
if ( type == L4TAS_TIMER_ROUND_RESTART ) | ||
{ | ||
printl( "<0> Call from L4TAS => Round started" ); | ||
} | ||
else if ( type == L4TAS_TIMER_MAP_LOADED ) | ||
{ | ||
printl( "<1> Call from L4TAS => Map loaded" ); | ||
} | ||
else if ( type == L4TAS_TIMER_INTRO_FINISHED ) | ||
{ | ||
printl( "<2> Call from L4TAS => Intro finished" ); | ||
} | ||
else if ( type == L4TAS_TIMER_CUSTOM ) | ||
{ | ||
printl( "<3> Call from L4TAS => Timer started" ); | ||
} | ||
} | ||
|
||
// OnTimerEnd callback | ||
function OnTimerEnd() | ||
{ | ||
printl( "<-1> Call from L4TAS => Segment finished" ); | ||
} | ||
|
||
printl( "Executed Left4TAS script" ); |
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,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.28803.202 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "left4tas", "left4tas\left4tas.vcxproj", "{37E35D83-8D67-4EBF-A330-3AAC38DD5769}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|x86 = Debug|x86 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{37E35D83-8D67-4EBF-A330-3AAC38DD5769}.Debug|x86.ActiveCfg = Debug|Win32 | ||
{37E35D83-8D67-4EBF-A330-3AAC38DD5769}.Debug|x86.Build.0 = Debug|Win32 | ||
{37E35D83-8D67-4EBF-A330-3AAC38DD5769}.Release|x86.ActiveCfg = Release|Win32 | ||
{37E35D83-8D67-4EBF-A330-3AAC38DD5769}.Release|x86.Build.0 = Release|Win32 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {A61867FD-E5F2-4F6E-B573-1FA23D8BFA2B} | ||
EndGlobalSection | ||
EndGlobal |
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,92 @@ | ||
// C++ | ||
// Console Variables | ||
|
||
#include "cvars.h" | ||
#include "tools/timer.h" | ||
#include "tools/autojump.h" | ||
#include "modules/client.h" | ||
|
||
#define CVAR_INIT ConVar *cvar = dynamic_cast<ConVar *>(var); float flValue = cvar->GetFloat() | ||
#define CVAR_IGNORE_NOT_CHANGED if (flValue == flOldValue) return | ||
|
||
extern IServer *g_pServer; | ||
extern IVEngineServer *g_pEngineServer; | ||
|
||
// Callbacks | ||
void OnConVarChange(IConVar *var, const char *pOldValue, float flOldValue) | ||
{ | ||
CVAR_INIT; | ||
CVAR_IGNORE_NOT_CHANGED; | ||
|
||
const char *pszName = var->GetName(); | ||
|
||
if (!strcmp(pszName, "tas_autojump")) | ||
{ | ||
if (cvar->GetBool()) | ||
g_AutoJump.Enable(); | ||
else | ||
g_AutoJump.Disable(); | ||
} | ||
else if (!strcmp(pszName, "tas_timescale")) | ||
{ | ||
if (flValue > 0.0f) | ||
{ | ||
extern ConVar *host_timescale; | ||
host_timescale->SetValue(flValue); | ||
} | ||
} | ||
} | ||
|
||
void OnCategoryChange(IConVar *var, const char *pOldValue, float flOldValue) | ||
{ | ||
CVAR_INIT; | ||
|
||
const char *pszName = var->GetName(); | ||
|
||
if (!strcmp(pszName, "category_no_director")) | ||
{ | ||
g_pEngineServer->ServerCommand(cvar->GetBool() ? "director_stop;nb_delete_all infected\n" : "director_start\n"); | ||
} | ||
//else if (!strcmp(pszName, "category_no_survivor_bots")) | ||
else | ||
{ | ||
g_pEngineServer->ServerCommand(cvar->GetBool() ? "nb_delete_all survivor\n" : "sb_add;sb_add;sb_add\n"); | ||
} | ||
|
||
g_pEngineServer->ServerExecute(); | ||
} | ||
|
||
void OnSetAngle(IConVar *var, const char *pOldValue, float flOldValue) | ||
{ | ||
CVAR_INIT; | ||
|
||
const char *pszName = var->GetName(); | ||
|
||
if (!strcmp(pszName, "tas_setpitch")) | ||
g_InputState.bSetPitch = true; | ||
else | ||
g_InputState.bSetYaw = true; | ||
} | ||
|
||
void OnTimeScaleChange(IConVar *var, const char *pOldValue, float flOldValue) | ||
{ | ||
CVAR_INIT; | ||
|
||
if (flValue != 1.0f) | ||
g_Timer.OnPreciseTimeCorrupted(); | ||
} | ||
|
||
// ConVars | ||
ConVar tas_autojump("tas_autojump", "1", FCVAR_RELEASE, "Player automatically re-jumps while holding jump button", true, 0.0f, true, 1.0f, OnConVarChange); | ||
ConVar tas_timescale("tas_timescale", "1.0", FCVAR_CHEAT | FCVAR_RELEASE | FCVAR_REPLICATED, "Set server's timescale", OnConVarChange); | ||
|
||
ConVar wait_frames_pause("wait_frames_pause", "0", FCVAR_RELEASE, "Pause execution of wait_frames commands"); | ||
|
||
ConVar category_no_director("category_no_director", "0", FCVAR_CHEAT | FCVAR_RELEASE, "No Director category", true, 0.0f, true, 1.0f, OnCategoryChange); | ||
ConVar category_no_survivor_bots("category_no_survivor_bots", "0", FCVAR_CHEAT | FCVAR_RELEASE, "No Survivor Bots category", true, 0.0f, true, 1.0f, OnCategoryChange); | ||
|
||
ConVar tas_setpitch("tas_setpitch", "0", FCVAR_RELEASE, "Set the Pitch angle.", OnSetAngle); | ||
|
||
ConVar tas_setyaw("tas_setyaw", "0", FCVAR_RELEASE, "Set the Yaw angle.", OnSetAngle); | ||
|
||
ConVar tas_setanglespeed("tas_setanglespeed", "360", FCVAR_RELEASE, "Speed of setting angles when using tas_setpitch/tas_setyaw."); |
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,88 @@ | ||
// C++ | ||
// Console Variables | ||
|
||
#pragma once | ||
|
||
#pragma warning(disable : 4005) | ||
|
||
#include "sdk.h" | ||
|
||
extern ConVar wait_frames_pause; | ||
|
||
extern ConVar category_no_director; | ||
extern ConVar category_no_survivor_bots; | ||
|
||
extern ConVar tas_autojump; | ||
extern ConVar tas_timescale; | ||
|
||
// Strafing stuff | ||
extern ConVar tas_strafe; | ||
|
||
extern ConVar tas_strafe_autojump; | ||
extern ConVar tas_strafe_yaw; | ||
extern ConVar tas_strafe_buttons; | ||
|
||
extern ConVar tas_strafe_vectorial; | ||
extern ConVar tas_strafe_vectorial_increment; | ||
extern ConVar tas_strafe_vectorial_offset; | ||
extern ConVar tas_strafe_vectorial_snap; | ||
|
||
extern ConVar tas_strafe_ignore_ground; | ||
extern ConVar tas_strafe_tickrate; | ||
|
||
extern ConVar tas_force_wishspeed_cap; | ||
|
||
// Angles stuff | ||
extern ConVar tas_setpitch; | ||
extern ConVar tas_setyaw; | ||
extern ConVar tas_setanglespeed; | ||
|
||
// HUD | ||
extern ConVar vhud_enable; | ||
extern ConVar vhud_line_break_height; | ||
extern ConVar vhud_line_break_height2; | ||
|
||
extern ConVar vhud_game_version; | ||
extern ConVar vhud_game_version_x; | ||
extern ConVar vhud_game_version_y; | ||
|
||
extern ConVar vhud_plugin_version; | ||
extern ConVar vhud_plugin_version_x; | ||
extern ConVar vhud_plugin_version_y; | ||
|
||
extern ConVar vhud_angles; | ||
extern ConVar vhud_angles_x; | ||
extern ConVar vhud_angles_y; | ||
|
||
extern ConVar vhud_velocity; | ||
extern ConVar vhud_velocity_x; | ||
extern ConVar vhud_velocity_y; | ||
|
||
extern ConVar vhud_origin; | ||
extern ConVar vhud_origin_x; | ||
extern ConVar vhud_origin_y; | ||
|
||
extern ConVar vhud_bhop_info; | ||
extern ConVar vhud_bhop_info_x; | ||
extern ConVar vhud_bhop_info_y; | ||
|
||
extern ConVar vhud_speed; | ||
extern ConVar vhud_speed_x; | ||
extern ConVar vhud_speed_y; | ||
|
||
extern ConVar vhud_timer_format; | ||
extern ConVar vhud_timer; | ||
extern ConVar vhud_timer_x; | ||
extern ConVar vhud_timer_y; | ||
|
||
// Timer | ||
extern ConVar timer_auto; | ||
|
||
// Pause | ||
extern ConVar prevent_pause; | ||
extern ConVar prevent_unpause; | ||
|
||
// Files execution | ||
extern ConVar tas_autoexec_configs; | ||
extern ConVar tas_autorun_vscripts; | ||
extern ConVar tas_timer_callbacks; |
Oops, something went wrong.