diff --git a/src/features/features.h b/src/features/features.h index 041d694..28b37ba 100644 --- a/src/features/features.h +++ b/src/features/features.h @@ -24,4 +24,7 @@ void correct_movement(usercmd_t* cmd, vec3_t old_angles); extern visible_flags visible_mode; bool chams(void* this_ptr); +/* src/features/misc.c */ +void custom_crosshair(void); + #endif /* FEATURES_H_ */ diff --git a/src/features/misc.c b/src/features/misc.c new file mode 100644 index 0000000..d861753 --- /dev/null +++ b/src/features/misc.c @@ -0,0 +1,31 @@ + +#include "features.h" +#include "../include/sdk.h" +#include "../include/globals.h" +#include "../include/cvars.h" +#include "../include/util.h" + +void custom_crosshair(void) { + if (!CVAR_ON(crosshair)) + return; + + /* Get window size, and then the center. */ + int mx = game_info->m_width / 2; + int my = game_info->m_height / 2; + + /* The real length is sqrt(2 * (len^2)) */ + const int len = cv_crosshair->value; + const int gap = 1; + const float w = 1; + const rgb_t col = { 255, 255, 255 }; + + /* + * 1\ /2 + * X + * 3/ \4 + */ + gl_drawline(mx - gap, my - gap, mx - gap - len, my - gap - len, w, col); + gl_drawline(mx + gap, my - gap, mx + gap + len, my - gap - len, w, col); + gl_drawline(mx - gap, my + gap, mx - gap - len, my + gap + len, w, col); + gl_drawline(mx + gap, my + gap, mx + gap + len, my + gap + len, w, col); +}