Merge pull request #61 from ineedbots/develop

Added G_Antilag dvar, default true
This commit is contained in:
Dss0 2020-12-23 23:10:36 +01:00 committed by GitHub
commit addcaddb8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 67 additions and 1 deletions

View File

@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog v0.3.0](http://keepachangelog.com/en/0.3.0/) and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.6.1] - 2020-12-22
## [0.6.1] - 2020-12-23
### Added
@ -30,6 +30,7 @@ The format is based on [Keep a Changelog v0.3.0](http://keepachangelog.com/en/0.
- Add r_specularCustomMaps Dvar (#36)
- Unlock safeArea_horizontal and safeArea_vertical Dvars (#42)
- Unlock cg_fovscale Dvar (#47)
- Added g_antilag Dvar (#61)
### Changed

View File

@ -183,6 +183,63 @@ namespace Components
}
}
Game::dvar_t* QuickPatch::g_antilag;
__declspec(naked) void QuickPatch::ClientEventsFireWeaponStub()
{
__asm
{
// check g_antilag dvar value
mov eax, g_antilag;
cmp byte ptr[eax + 16], 1;
// do antilag if 1
je fireWeapon
// do not do antilag if 0
mov eax, 0x1A83554 // level.time
mov ecx, [eax]
fireWeapon:
push edx
push ecx
push edi
mov eax, 0x4A4D50 // FireWeapon
call eax
add esp, 0Ch
pop edi
pop ecx
retn
}
}
__declspec(naked) void QuickPatch::ClientEventsFireWeaponMeleeStub()
{
__asm
{
// check g_antilag dvar value
mov eax, g_antilag;
cmp byte ptr[eax + 16], 1;
// do antilag if 1
je fireWeaponMelee
// do not do antilag if 0
mov eax, 0x1A83554 // level.time
mov edx, [eax]
fireWeaponMelee:
push edx
push edi
mov eax, 0x4F2470 // FireWeaponMelee
call eax
add esp, 8
pop edi
pop ecx
retn
}
}
Game::dvar_t* QuickPatch::sv_enableBounces;
__declspec(naked) void QuickPatch::BounceStub()
{
@ -397,6 +454,10 @@ namespace Components
g_playerEjection = Game::Dvar_RegisterBool("g_playerEjection", true, Game::DVAR_FLAG_REPLICATED, "Flag whether player ejection is on or off");
Utils::Hook(0x5D814A, QuickPatch::PlayerEjectionStub, HOOK_JUMP).install()->quick();
g_antilag = Game::Dvar_RegisterBool("g_antilag", true, Game::DVAR_FLAG_REPLICATED, "Perform antilag");
Utils::Hook(0x5D6D56, QuickPatch::ClientEventsFireWeaponStub, HOOK_JUMP).install()->quick();
Utils::Hook(0x5D6D6A, QuickPatch::ClientEventsFireWeaponMeleeStub, HOOK_JUMP).install()->quick();
// Disallow invalid player names
Utils::Hook(0x401983, QuickPatch::InvalidNameStub, HOOK_JUMP).install()->quick();

View File

@ -39,6 +39,10 @@ namespace Components
static void SetAspectRatioStub();
static void SetAspectRatio();
static Game::dvar_t* g_antilag;
static void ClientEventsFireWeaponStub();
static void ClientEventsFireWeaponMeleeStub();
static Game::dvar_t* g_playerCollision;
static void PlayerCollisionStub();
static Game::dvar_t* g_playerEjection;