Compare commits

..

No commits in common. "72dc42006fd1997534ef54bb66527957bd1e70ff" and "44e5dc34c0cfe2105627f2604f227bb68ce3375c" have entirely different histories.

4 changed files with 20 additions and 18 deletions

View File

@ -28,6 +28,7 @@ bool isSpacebarPressed() {
return pressed; return pressed;
} }
void anti_aim(usercmd_t* cmd) { void anti_aim(usercmd_t* cmd) {
if (cmd->buttons & IN_ATTACK || cmd->buttons & IN_USE) { if (cmd->buttons & IN_ATTACK || cmd->buttons & IN_USE) {
if (cmd->buttons & IN_ATTACK) { if (cmd->buttons & IN_ATTACK) {

View File

@ -4,7 +4,6 @@
#include "../include/globals.h" #include "../include/globals.h"
#include "../include/cvars.h" #include "../include/cvars.h"
#include "../include/util.h" #include "../include/util.h"
#include "../include/game_detection.h"
/* For dz_esp */ /* For dz_esp */
enum esp_values { enum esp_values {
@ -103,32 +102,38 @@ void esp(void) {
if (setting == ESP_OFF) if (setting == ESP_OFF)
return; return;
/* Iterate all clients */
for (int i = 1; i <= i_engine->GetMaxClients(); i++) { for (int i = 1; i <= i_engine->GetMaxClients(); i++) {
cl_entity_t* ent = get_player(i); cl_entity_t* ent = get_player(i);
if (!valid_player(ent) || !is_alive(ent) || vec_is_zero(ent->origin)) if (!valid_player(ent) || !is_alive(ent) || vec_is_zero(ent->origin))
continue; continue;
// Check if the player is friendly and if visuals_friendly is 0
if (is_friend(ent) && dz_visuals_friendly->value == 0) if (is_friend(ent) && dz_visuals_friendly->value == 0)
continue; continue;
int bh = 70; const int bh = (ent->curstate.usehull == 1) ? 44 : 70;
if (IsDayOfDefeat()) { /* const int bw = 25; */
bh = 76;
} else if (ent->curstate.usehull == 1) {
bh = 44;
}
/* If ESP_BOX is enabled, draw it. If it returns false, continue */
if (setting & ESP_BOX && !gl_draw2dbox(ent->origin, bh)) if (setting & ESP_BOX && !gl_draw2dbox(ent->origin, bh))
continue; continue;
/* Rest of the loop is for name esp, if var is not enabled, continue */
if (!(setting & ESP_NAME)) if (!(setting & ESP_NAME))
continue; continue;
vec3_t name_pos = vec3(ent->origin.x, ent->origin.y, ent->origin.z + bh + 5); /* Draw name on top of the player. */
vec2_t s_name_pos; vec3_t top = vec3(ent->origin.x, ent->origin.y, ent->origin.z + bh);
if (world_to_screen(name_pos, s_name_pos)) { vec2_t s_top;
engine_draw_text(s_name_pos[0] - 5, s_name_pos[1] - 2, get_name(ent->index), (rgb_t){ 255, 255, 255 });
} if (!world_to_screen(top, s_top))
continue;
/* TODO: Instead of -5px, center the player name to the player origin.
* I don't know how to get the text size before rendering. */
engine_draw_text(s_top[0] - 5, s_top[1] - 2, get_name(ent->index),
(rgb_t){ 255, 255, 255 });
} }
} }

View File

@ -94,6 +94,7 @@ int h_HUD_Redraw(float time, int intermission) {
} else { } else {
color = (rgb_t){ 0, 255, 255 }; // default color color = (rgb_t){ 0, 255, 255 }; // default color
} }
/* Watermark */ /* Watermark */
engine_draw_text(5, 5, "https://git.deadzone.lol/Wizzard/goldsource-cheat", color); engine_draw_text(5, 5, "https://git.deadzone.lol/Wizzard/goldsource-cheat", color);
} }

View File

@ -163,15 +163,10 @@ bool world_to_screen(vec3_t vec, vec2_t screen) {
scr_inf.iSize = sizeof(SCREENINFO); scr_inf.iSize = sizeof(SCREENINFO);
i_engine->pfnGetScreenInfo(&scr_inf); i_engine->pfnGetScreenInfo(&scr_inf);
/* If within bounds, transform to screen scale */
if (screen[0] < 1 && screen[1] < 1 && screen[0] > -1 && screen[1] > -1) { if (screen[0] < 1 && screen[1] < 1 && screen[0] > -1 && screen[1] > -1) {
if (IsDayOfDefeat()) {
printf("Before transformation: %f, %f, Depth: %f\n", screen[0], screen[1], screen[2]);
screen[0] = ((screen[0] + 1) * 0.5) * scr_inf.iWidth;
screen[1] = ((1 - screen[1]) * 0.5) * scr_inf.iHeight;
} else {
screen[0] = screen[0] * (scr_inf.iWidth / 2) + (scr_inf.iWidth / 2); screen[0] = screen[0] * (scr_inf.iWidth / 2) + (scr_inf.iWidth / 2);
screen[1] = -screen[1] * (scr_inf.iHeight / 2) + (scr_inf.iHeight / 2); screen[1] = -screen[1] * (scr_inf.iHeight / 2) + (scr_inf.iHeight / 2);
}
return true; return true;
} }