Rainbow watermark + cvar dz_watermark_rainbow

This commit is contained in:
Wizzard 2023-09-19 16:41:13 -04:00
parent deccfca8e3
commit a688d94e9d
3 changed files with 23 additions and 1 deletions

View File

@ -13,6 +13,7 @@ DECL_CVAR(crosshair);
DECL_CVAR(tracers);
DECL_CVAR(clmove);
DECL_CVAR(watermark);
DECL_CVAR(watermark_rainbow);
bool cvars_init(void) {
REGISTER_CVAR(bhop, 1);
@ -25,6 +26,7 @@ bool cvars_init(void) {
REGISTER_CVAR(tracers, 1);
REGISTER_CVAR(clmove, 0);
REGISTER_CVAR(watermark, 1);
REGISTER_CVAR(watermark_rainbow, 1);
return true;
}

View File

@ -71,12 +71,31 @@ void h_CL_CreateMove(float frametime, usercmd_t* cmd, int active) {
/*----------------------------------------------------------------------------*/
rgb_t rainbow_color(float time) {
const float frequency = 0.1f;
unsigned char r = (sin(frequency * time + 0) * 127.5f + 127.5f);
unsigned char g = (sin(frequency * time + 2.0f) * 127.5f + 127.5f);
unsigned char b = (sin(frequency * time + 4.0f) * 127.5f + 127.5f);
return (rgb_t){ r, g, b };
}
int h_HUD_Redraw(float time, int intermission) {
int ret = ORIGINAL(HUD_Redraw, time, intermission);
if (dz_watermark->value) {
/* Determine the color for the watermark */
rgb_t color;
if (dz_watermark_rainbow->value) {
color = rainbow_color(time);
} else {
color = (rgb_t){ 0, 255, 255 }; // default color
}
/* Watermark */
engine_draw_text(5, 5, "https://git.deadzone.lol/Wizzard/goldsource-cheat", (rgb_t){ 0, 255, 255 });
engine_draw_text(5, 5, "https://git.deadzone.lol/Wizzard/goldsource-cheat", color);
}
esp();

View File

@ -40,6 +40,7 @@ DECL_CVAR_EXTERN(crosshair);
DECL_CVAR_EXTERN(tracers);
DECL_CVAR_EXTERN(clmove);
DECL_CVAR_EXTERN(watermark);
DECL_CVAR_EXTERN(watermark_rainbow);
/*----------------------------------------------------------------------------*/