Skip to content

Commit

Permalink
Plugin rewrite and gamedata update (#17)
Browse files Browse the repository at this point in the history
* Update gamedata for 2024-04-18 TF2 update

* Throw error if patch couldn't be created at all

* Bump version

* Basically rewrite the entire thing

* Update README

* Fake news

* Fix cookies

* Fix unhooking

* SetFailState everything
  • Loading branch information
Mikusch authored Apr 19, 2024
1 parent b8ab4d7 commit 3c373ba
Show file tree
Hide file tree
Showing 3 changed files with 204 additions and 157 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# [TF2] Simple Bunnyhop

This is a simple SourceMod plugin for Team Fortress 2 that allows players to bunnyhop.
This is a simple and lightweight SourceMod plugin for Team Fortress 2 that allows players to bunnyhop.

Unlike most bunnyhop plugins, this one does not manually add velocity, but rather patches out unnecessary checks in the game's movement code.
Unlike most bunnyhop plugins, this one does not manually add velocity, but rather patches out unnecessary checks in the
game's movement code.
It is similar to the bunnyhop found in newer Source engine games, such as Counter-Strike: Global Offensive.

## Features
Expand All @@ -12,8 +13,7 @@ It is similar to the bunnyhop found in newer Source engine games, such as Counte
* Allows jumping while ducked
* Unlimited speed while bunnyhopping
* Prevents `CTFGameMovement::PreventBunnyJumping` from clamping your speed
* Support for TF2-specific actions in midair (e.g. Scout's double jump, B.A.S.E. Jumper parachutes, grappling hooks, etc.)
* Fully compatible with my [all-class air dash](https://github.com/Mikusch/allclass-air-dash) plugin
* Support for TF2-specific actions in midair (e.g. double jumps, parachutes, grappling hooks, etc.)

## Dependencies

Expand All @@ -23,12 +23,12 @@ It is similar to the bunnyhop found in newer Source engine games, such as Counte

## Configuration

The plugin creates the following console variables, configurable in `cfg/sourcemod/plugin.tf-bhop.cfg`:
The plugin creates the following console variables:

* `sv_enablebunnyhopping ( def. "1" )` - Allow player speed to exceed maximum running speed
* `sv_autobunnyhopping ( def. "1" )` - Players automatically re-jump while holding jump button
* `sv_duckbunnyhopping ( def. "1" )` - Allow jumping while ducked
* `sv_autobunnyhopping_falldamage ( def. "0" )` - Players can take fall damage while auto-bunnyhopping
* `sm_bhop_enabled ( def. "1" )` - When set, allows player speed to exceed maximum running speed.
* `sm_bhop_autojump ( def. "1" )` - When set, players automatically re-jump while holding the jump button.
* `sm_bhop_autojump_falldamage ( def. "0" )` - When set, players will take fall damage while auto-bunnyhopping.
* `sm_bhop_duckjump ( def. "1" )` - When set, allows jumping while ducked.

### Recommended Server Configuration

Expand Down
48 changes: 32 additions & 16 deletions addons/sourcemod/gamedata/tf-bhop.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,37 @@
{
"tf"
{
"Keys"
{
"Platform"
{
"linux" "linux"
"linux64" "linux"
"windows" "windows"
"windows64" "windows"
}
}
"Signatures"
{
// "set_scout_doublejump_disabled"
"CTFPlayer::CanAirDash"
{
"library" "server"
"linux" "@_ZNK9CTFPlayer10CanAirDashEv"
"windows" "\x55\x8B\xEC\x83\xEC\x08\x57\x8B\xF9\xF7\x87\xB4\x1B\x00\x00\x00\x00\x04\x00"
"windows" "\x55\x8B\xEC\x83\xEC\x08\x53\x57\x8B\xF9\x8B\x87\xB4\x1B\x00\x00"
}
// "BumperCar.Jump"
"CTFGameMovement::CheckJumpButton"
{
"library" "server"
"linux" "@_ZN15CTFGameMovement15CheckJumpButtonEv"
"windows" "\x55\x8B\xEC\x83\xEC\x0C\x57\x8B\xF9\x8B\x47\x04\x80\xB8\x84\x0B\x00\x00\x00"
"windows" "\x55\x8B\xEC\x83\xEC\x0C\x53\x56\x57\x8B\xF9\x8B\x4F\x04"
}
"CTFGameMovement::PreventBunnyJumping"
{
"library" "server"
"linux" "@_ZN15CTFGameMovement19PreventBunnyJumpingEv"
"windows" "\x56\x8B\xF1\x6A\x52\x8B\x8E\xB8\x16\x00\x00\x81\xC1\xE0\x1A\x00\x00\xE8\x2A\x2A\x2A\x2A\x84\xC0\x75\x2A"
// Windows inlines this function
}
}
"MemPatches"
Expand All @@ -47,31 +59,35 @@
"signature" "CTFGameMovement::CheckJumpButton"
"linux"
{
"offset" "DFh"
"verify" "\x74"
"patch" "\xEB"
"offset" "D3h"
"verify" "\x74" // jz
"patch" "\xEB" // jmp
}
"windows"
{
"offset" "1FFh"
"verify" "\x74"
"patch" "\xEB"
"offset" "38Eh"
"verify" "\x74" // jz
"patch" "\xEB" // jmp
}
}
"CTFGameMovement::PreventBunnyJumping::AllowBunnyJumping"
"CTFGameMovement::PreventBunnyJumping::AllowBunnyJumping_Linux"
{
"signature" "CTFGameMovement::PreventBunnyJumping"
"linux"
{
"offset" "27h"
"verify" "\x75"
"patch" "\xEB"
"offset" "22h"
"verify" "\x75" // jnz
"patch" "\xEB" // jmp
}
}
"CTFGameMovement::PreventBunnyJumping::AllowBunnyJumping_Windows"
{
"signature" "CTFGameMovement::CheckJumpButton"
"windows"
{
"offset" "18h"
"verify" "\x75"
"patch" "\xEB"
"offset" "42Bh"
"verify" "\x75" // jnz
"patch" "\xEB" // jmp
}
}
}
Expand Down
Loading

0 comments on commit 3c373ba

Please sign in to comment.