Bounce from all angles & more

This commit is contained in:
FutureRave 2022-03-23 13:48:13 +00:00
parent 1d7cf00cdb
commit 0fd6597b71
No known key found for this signature in database
GPG Key ID: E883E2BC9657D955
30 changed files with 137 additions and 85 deletions

View File

@ -1,6 +1,7 @@
#include <std_include.hpp>
#include <utils/nt.hpp>
#include "launcher.hpp"
#include "utils/nt.hpp"
launcher::launcher()
{

View File

@ -1,10 +1,11 @@
#include <std_include.hpp>
#include <utils/nt.hpp>
#include <utils/io.hpp>
#include <utils/cryptography.hpp>
#include <utils/string.hpp>
#include <utils/compression.hpp>
#include "binary_loader.hpp"
#include "utils/nt.hpp"
#include "utils/io.hpp"
#include "utils/cryptography.hpp"
#include "utils/string.hpp"
#include "utils/compression.hpp"
#define DEDI_HASH "F271C305117B79242E254E9F64BD5AA2993CAC8E57975243EBD44CD576418D20"

View File

@ -1,7 +1,8 @@
#include <std_include.hpp>
#include <utils/string.hpp>
#include "loader.hpp"
#include "binary_loader.hpp"
#include "utils/string.hpp"
loader::loader(const launcher::mode mode) : mode_(mode)
{

View File

@ -1,6 +1,6 @@
#pragma once
#include "utils/nt.hpp"
#include "launcher/launcher.hpp"
#include <utils/nt.hpp>
#include <launcher/launcher.hpp>
class loader final
{

View File

@ -1,4 +1,4 @@
#include <std_include.hpp>
#include "std_include.hpp"
#include "launcher/launcher.hpp"
#include "loader/loader.hpp"
#include "loader/module_loader.hpp"

View File

@ -1,6 +1,7 @@
#include <std_include.hpp>
#include "loader/module_loader.hpp"
#include "utils/hook.hpp"
#include <loader/module_loader.hpp>
#include <utils/hook.hpp>
#include "game/game.hpp"
class ceg final : public module

View File

@ -1,9 +1,9 @@
#include <std_include.hpp>
#include "loader/module_loader.hpp"
#include "command.hpp"
#include "game/game.hpp"
#include <loader/module_loader.hpp>
#include <utils/string.hpp>
#include "utils/string.hpp"
#include "game/game.hpp"
#include "command.hpp"
class client_command final : public module
{

View File

@ -1,8 +1,12 @@
#include <std_include.hpp>
#include "command.hpp"
#include <loader/module_loader.hpp>
#include <utils/string.hpp>
#include <utils/hook.hpp>
#include "utils/string.hpp"
#include "utils/hook.hpp"
#include "game/structs.hpp"
#include "game/game.hpp"
#include "command.hpp"
utils::memory::allocator command::allocator_;
std::unordered_map<std::string, std::function<void(const command::params&)>> command::handlers;

View File

@ -1,10 +1,5 @@
#pragma once
#include "loader/module_loader.hpp"
#include "game/structs.hpp"
#include "game/game.hpp"
#include "utils/memory.hpp"
#include <utils/memory.hpp>
class command final : public module
{

View File

@ -1,5 +1,6 @@
#include <std_include.hpp>
#include "loader/module_loader.hpp"
#include <loader/module_loader.hpp>
#include "game/game.hpp"
#include "scheduler.hpp"

View File

@ -1,8 +1,10 @@
#include <std_include.hpp>
#include <loader/module_loader.hpp>
#include <discord_rpc.h>
#include "loader/module_loader.hpp"
#include "scheduler.hpp"
#include "game/game.hpp"
#include "scheduler.hpp"
class discord final : public module
{

View File

@ -1,9 +1,7 @@
#include <std_include.hpp>
#include "dw.hpp"
#include "utils/hook.hpp"
#include "game/game.hpp"
#include "utils/nt.hpp"
#include "utils/cryptography.hpp"
#include <utils/hook.hpp>
#include <utils/nt.hpp>
#include <utils/cryptography.hpp>
#include "game/demonware/services/bdLSGHello.hpp" // 7
#include "game/demonware/services/bdStorage.hpp" // 10
@ -13,6 +11,9 @@
#include "game/demonware/services/bdDediRSAAuth.hpp" // 26
#include "game/demonware/services/bdSteamAuth.hpp" // 28
#include "game/game.hpp"
#include "dw.hpp"
namespace demonware
{
namespace io

View File

@ -1,5 +1,6 @@
#pragma once
#include "loader/module_loader.hpp"
#include <loader/module_loader.hpp>
#include "game/demonware/stun_server.hpp"
#include "game/demonware/service_server.hpp"

View File

@ -1,7 +1,8 @@
#include <std_include.hpp>
#include "loader/module_loader.hpp"
#include <loader/module_loader.hpp>
#include <utils/hook.hpp>
#include "game/game.hpp"
#include "utils/hook.hpp"
static __declspec(naked) void db_load_stub_client(game::native::XZoneInfo*, unsigned int, int)
{

View File

@ -1,6 +1,7 @@
#include <std_include.hpp>
#include "loader/module_loader.hpp"
#include "utils/hook.hpp"
#include <loader/module_loader.hpp>
#include <utils/hook.hpp>
#include "game/game.hpp"
class fov final : public module

View File

@ -1,7 +1,7 @@
#include <std_include.hpp>
#include "loader/module_loader.hpp"
#include "utils/nt.hpp"
#include "utils/string.hpp"
#include <loader/module_loader.hpp>
#include <utils/nt.hpp>
#include <utils/string.hpp>
class game_launcher final : public module
{

View File

@ -1,6 +1,7 @@
#include <std_include.hpp>
#include "loader/module_loader.hpp"
#include "utils/hook.hpp"
#include <loader/module_loader.hpp>
#include <utils/hook.hpp>
#include "game/game.hpp"
class patches final : public module

View File

@ -1,8 +1,8 @@
#include <std_include.hpp>
#include <loader/module_loader.hpp>
#include <utils/hook.hpp>
#include "game/game.hpp"
#include "utils/hook.hpp"
#include "player_movement.hpp"
const game::native::dvar_t* player_movement::player_sustainAmmo;
@ -13,6 +13,7 @@ const game::native::dvar_t* player_movement::jump_height;
const game::native::dvar_t* player_movement::jump_stepSize;
const game::native::dvar_t* player_movement::jump_spreadAdd;
const game::native::dvar_t* player_movement::pm_bounces;
const game::native::dvar_t* player_movement::pm_bouncesAllAngles;
const game::native::dvar_t* player_movement::pm_playerEjection;
const game::native::dvar_t* player_movement::pm_playerCollision;
const game::native::dvar_t* player_movement::pm_rocketJump;
@ -309,6 +310,33 @@ __declspec(naked) void player_movement::jump_start_stub()
}
}
void player_movement::pm_project_velocity_stub(const float* vel_in, const float* normal, float* vel_out)
{
const auto length_squared_2d = vel_in[0] * vel_in[0] + vel_in[1] * vel_in[1];
if (std::fabsf(normal[2]) < 0.001f || length_squared_2d == 0.0f)
{
vel_out[0] = vel_in[0];
vel_out[1] = vel_in[1];
vel_out[2] = vel_in[2];
return;
}
auto new_z = vel_in[0] * normal[0] + vel_in[1] * normal[1];
new_z = -new_z / normal[2];
const auto length_scale = std::sqrtf((vel_in[2] * vel_in[2] + length_squared_2d) /
(new_z * new_z + length_squared_2d));
if (player_movement::pm_bouncesAllAngles->current.enabled
|| (length_scale < 1.f || new_z < 0.f || vel_in[2] > 0.f))
{
vel_out[0] = vel_in[0] * length_scale;
vel_out[1] = vel_in[1] * length_scale;
vel_out[2] = new_z * length_scale;
}
}
const game::native::dvar_t* player_movement::dvar_register_player_sustain_ammo(const char* dvar_name,
bool value, unsigned __int16 /*flags*/, const char* description)
{
@ -414,6 +442,8 @@ void player_movement::patch_mp()
// Modify the hardcoded value of the spread with the value of jump_spreadAdd
utils::hook(0x4166F0, &player_movement::jump_start_stub, HOOK_JUMP).install()->quick();
utils::hook::nop(0x4166F5, 1); // Nop skipped opcode
utils::hook(0x424E0A, &player_movement::pm_project_velocity_stub, HOOK_CALL).install()->quick(); // PM_StepSlideMove
}
void player_movement::patch_sp()
@ -454,6 +484,8 @@ void player_movement::patch_sp()
// Modify the hardcoded value of the spread with the value of jump_spreadAdd
utils::hook(0x63E90A, &player_movement::jump_start_stub, HOOK_JUMP).install()->quick();
utils::hook::nop(0x63E90F, 1); // Nop skipped opcode
utils::hook(0x43D9D1, &player_movement::pm_project_velocity_stub, HOOK_CALL).install()->quick(); // PM_StepSlideMove
}
void player_movement::post_load()
@ -473,6 +505,8 @@ void player_movement::post_load()
player_movement::pm_bounces = game::native::Dvar_RegisterBool("pm_bounces", false,
game::native::dvar_flags::DVAR_CODINFO, "CoD4 Bounces");
player_movement::pm_bouncesAllAngles = game::native::Dvar_RegisterBool("pm_bouncesAllAngles", false,
game::native::dvar_flags::DVAR_CODINFO, "Force bounces from all angles");
player_movement::pm_playerCollision = game::native::Dvar_RegisterBool("pm_playerCollision",
true, game::native::DVAR_CODINFO, "Push intersecting players away from each other");
player_movement::pm_elevators = game::native::Dvar_RegisterBool("pm_elevators",

View File

@ -1,5 +1,4 @@
#pragma once
#include "loader/module_loader.hpp"
class player_movement final : public module
{
@ -15,6 +14,7 @@ private:
static const game::native::dvar_t* jump_stepSize;
static const game::native::dvar_t* jump_spreadAdd;
static const game::native::dvar_t* pm_bounces;
static const game::native::dvar_t* pm_bouncesAllAngles;
static const game::native::dvar_t* pm_playerEjection;
static const game::native::dvar_t* pm_playerCollision;
static const game::native::dvar_t* pm_rocketJump;
@ -75,6 +75,8 @@ private:
static void jump_start_stub();
static void pm_project_velocity_stub(const float* vel_in, const float* normal, float* vel_out);
static void patch_mp();
static void patch_sp();
};

View File

@ -1,8 +1,10 @@
#include <std_include.hpp>
#include "scheduler.hpp"
#include "utils/string.hpp"
#include <loader/module_loader.hpp>
#include <utils/string.hpp>
#include <utils/hook.hpp>
#include "game/game.hpp"
#include "utils/hook.hpp"
#include "scheduler.hpp"
std::mutex scheduler::mutex_;
std::queue<std::pair<std::string, int>> scheduler::errors_;

View File

@ -1,5 +1,4 @@
#pragma once
#include "loader/module_loader.hpp"
#include "utils/concurrent_list.hpp"
class scheduler final : public module

View File

@ -1,7 +1,8 @@
#include <std_include.hpp>
#include "loader/module_loader.hpp"
#include "utils/hook.hpp"
#include "utils/io.hpp"
#include <loader/module_loader.hpp>
#include <utils/hook.hpp>
#include <utils/io.hpp>
#include "game/scripting/context.hpp"
#include "scheduler.hpp"

View File

@ -1,7 +1,8 @@
#include <std_include.hpp>
#include "loader/module_loader.hpp"
#include <loader/module_loader.hpp>
#include <utils/hook.hpp>
#include "game/game.hpp"
#include "utils/hook.hpp"
class security final : public module
{

View File

@ -1,10 +1,12 @@
#include <std_include.hpp>
#include "loader/module_loader.hpp"
#include "game/game.hpp"
#include "utils/nt.hpp"
#include <loader/module_loader.hpp>
#include <utils/nt.hpp>
#include <utils/string.hpp>
#include "steam/steam.hpp"
#include "steam/interface.hpp"
#include "utils/string.hpp"
#include "game/game.hpp"
#include "scheduler.hpp"
class steam_proxy final : public module

View File

@ -1,10 +1,11 @@
#include <std_include.hpp>
#include <loader/module_loader.hpp>
#include <utils/hook.hpp>
#include "game/game.hpp"
#include "test_clients.hpp"
#include "command.hpp"
#include "utils/hook.hpp"
bool test_clients::can_add()
{
auto i = 0;

View File

@ -1,6 +1,4 @@
#pragma once
#include "loader/module_loader.hpp"
#include "game/game.hpp"
class test_clients final : public module
{

View File

@ -1,4 +1,4 @@
#include <std_include.hpp>
#include "std_include.hpp"
#pragma comment(linker, "/merge:.data=.cld")
#pragma comment(linker, "/merge:.rdata=.clr")
@ -11,24 +11,25 @@
#pragma bss_seg(".payload")
char payload_data[BINARY_PAYLOAD_SIZE];
extern "C" {
int s_read_arc4random(void*, size_t)
extern "C"
{
int s_read_arc4random(void*, size_t)
{
return -1;
}
}
int s_read_getrandom(void*, size_t)
{
int s_read_getrandom(void*, size_t)
{
return -1;
}
}
int s_read_urandom(void*, size_t)
{
int s_read_urandom(void*, size_t)
{
return -1;
}
}
int s_read_ltm_rng(void*, size_t)
{
int s_read_ltm_rng(void*, size_t)
{
return -1;
}
}
}

View File

@ -53,7 +53,7 @@ namespace utils::io
if (size > -1)
{
data->resize(static_cast<uint32_t>(size));
stream.read(const_cast<char*>(data->data()), size);
stream.read(data->data(), size);
stream.close();
return true;
}

View File

@ -42,13 +42,13 @@ namespace utils
static void* allocate(size_t length);
template <typename T>
static inline T* allocate()
static T* allocate()
{
return allocate_array<T>(1);
}
template <typename T>
static inline T* allocate_array(const size_t count = 1)
static T* allocate_array(const size_t count = 1)
{
return static_cast<T*>(allocate(count * sizeof(T)));
}

View File

@ -228,7 +228,7 @@ namespace utils::nt
void relaunch_self()
{
const utils::nt::library self;
const library self;
STARTUPINFOA startup_info;
PROCESS_INFORMATION process_info;