Added dz_visuals_fov

This commit is contained in:
Wizzard 2023-09-21 15:00:14 -04:00
parent 21d9cac264
commit 543c00e294
7 changed files with 31 additions and 1 deletions

View File

@ -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

View File

@ -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 {

View File

@ -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_ */

19
src/features/fov.c Normal file
View File

@ -0,0 +1,19 @@
#include <stdio.h>
#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;
}
}

View File

@ -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");

View File

@ -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);

View File

@ -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;