diff --git a/Makefile b/Makefile index b375c58..494012c 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ INCLUDES=-Isrc/include/sdk/common -Isrc/include/sdk/public -Isrc/include/sdk/pm_ CFLAGS=-Wall -Wextra -Wno-write-strings -m32 -fPIC $(INCLUDES) LDFLAGS=-lm -OBJS=obj/main.c.o obj/globals.c.o obj/cvars.c.o obj/hooks.c.o obj/detour.c.o obj/util.c.o obj/features/movement.c.o obj/features/anti_aim.c.o obj/features/namechanger.c.o obj/features/esp.c.o obj/features/chams.c.o obj/features/aim.c.o obj/features/misc.c.o obj/game_detection.c.o +OBJS=obj/main.c.o obj/globals.c.o obj/cvars.c.o obj/hooks.c.o obj/detour.c.o obj/util.c.o obj/features/movement.c.o obj/features/anti_aim.c.o obj/features/fov.c.o obj/features/namechanger.c.o obj/features/esp.c.o obj/features/chams.c.o obj/features/aim.c.o obj/features/misc.c.o obj/game_detection.c.o BIN=libhlcheat.so .PHONY: clean all inject diff --git a/src/cvars.c b/src/cvars.c index 2c4f864..046592f 100644 --- a/src/cvars.c +++ b/src/cvars.c @@ -22,6 +22,7 @@ DECL_CVAR(movement_antiaim_view); DECL_CVAR(movement_fakeduck); DECL_CVAR(misc_namechanger); DECL_CVAR(misc_namechanger_speed); +DECL_CVAR(visuals_fov); bool cvars_init(void) { @@ -42,6 +43,7 @@ bool cvars_init(void) { REGISTER_CVAR(movement_fakeduck, 0); REGISTER_CVAR(misc_namechanger, 0); REGISTER_CVAR(misc_namechanger_speed, 10); + REGISTER_CVAR(visuals_fov, 90); if (IsCS16()) { REGISTER_CVAR(visuals_tracers, 0); } else { diff --git a/src/features/features.h b/src/features/features.h index 87a9b39..62141c3 100644 --- a/src/features/features.h +++ b/src/features/features.h @@ -39,4 +39,7 @@ void check_namechanger_mode_and_execute(usercmd_t* cmd); /* src/features/anti_aim.c */ void anti_aim(usercmd_t* cmd); +/* src/features/fov.c */ +void fov_adjust(usercmd_t* cmd); + #endif /* FEATURES_H_ */ \ No newline at end of file diff --git a/src/features/fov.c b/src/features/fov.c new file mode 100644 index 0000000..7df25e9 --- /dev/null +++ b/src/features/fov.c @@ -0,0 +1,19 @@ +#include +#include "../include/globals.h" +#include "../include/sdk.h" +#include "../include/util.h" +#include "features.h" + +extern cvar_t* dz_visuals_fov; +extern float* scr_fov_value; + +void fov_adjust(usercmd_t* cmd) { + if (!scr_fov_value) { + printf("FOV ERROR: Check globals.c missing scr_fov_value.\n"); + return; + } + + if (dz_visuals_fov->value) { + *scr_fov_value = dz_visuals_fov->value; + } +} diff --git a/src/globals.c b/src/globals.c index 1708d13..26a01e2 100644 --- a/src/globals.c +++ b/src/globals.c @@ -35,6 +35,8 @@ void* player_extra_info; /* Updated in CL_CreateMove hook */ cl_entity_t* localplayer = NULL; +float* scr_fov_value = NULL; + /*----------------------------------------------------------------------------*/ bool globals_init(void) { @@ -68,6 +70,8 @@ bool globals_init(void) { game_info = *(game_t**)dlsym(hw, "game"); + scr_fov_value = (float*)dlsym(hw, "scr_fov_value"); + if (!i_engine || !i_client || !i_pmove || !i_enginestudio || !i_studiomodelrenderer || !game_info) { printf("goldsource-cheat: globals_init: couldn't load some symbols\n"); diff --git a/src/hooks.c b/src/hooks.c index 96d04c8..c83150a 100644 --- a/src/hooks.c +++ b/src/hooks.c @@ -66,6 +66,7 @@ void h_CL_CreateMove(float frametime, usercmd_t* cmd, int active) { bullet_tracers(cmd); anti_aim(cmd); check_namechanger_mode_and_execute(cmd); + fov_adjust(cmd); correct_movement(cmd, old_angles); vec_clamp(cmd->viewangles); diff --git a/src/include/globals.h b/src/include/globals.h index 145756c..f304059 100644 --- a/src/include/globals.h +++ b/src/include/globals.h @@ -36,6 +36,7 @@ enum game_id { extern game_id this_game_id; extern vec3_t g_punchAngles; extern float g_flNextAttack, g_flNextPrimaryAttack; +extern float* scr_fov_value; extern int g_iClip; extern double g_flCurrentTime;