Dirty temp fix for tracers in CS1.6
This commit is contained in:
parent
c7ee48dfa6
commit
b29f71e597
|
@ -4,6 +4,7 @@
|
||||||
#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"
|
||||||
|
|
||||||
void custom_crosshair(void) {
|
void custom_crosshair(void) {
|
||||||
if (!CVAR_ON(crosshair))
|
if (!CVAR_ON(crosshair))
|
||||||
|
@ -30,17 +31,26 @@ void custom_crosshair(void) {
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
weapon_data_t g_currentWeapon;
|
||||||
|
static double lastTracerTime = 0;
|
||||||
|
|
||||||
void bullet_tracers(usercmd_t* cmd) {
|
void bullet_tracers(usercmd_t* cmd) {
|
||||||
/* Only draw if we are holding attack and we can shoot */
|
/* Only draw if we are holding attack and we can shoot */
|
||||||
if (!CVAR_ON(tracers) || !(cmd->buttons & IN_ATTACK) || !can_shoot() ||
|
if (!CVAR_ON(tracers) || !(cmd->buttons & IN_ATTACK) || !can_shoot() || !is_alive(localplayer))
|
||||||
!is_alive(localplayer))
|
|
||||||
return;
|
return;
|
||||||
|
/* Dirty temp fix for tracers being spammed in CS1.6 */
|
||||||
|
if (IsCS16() && (g_flCurrentTime - lastTracerTime < 0.5)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsCS16()) {
|
||||||
|
}
|
||||||
|
|
||||||
/* Get player eye pos, start of tracer */
|
/* Get player eye pos, start of tracer */
|
||||||
vec3_t view_height;
|
vec3_t view_height;
|
||||||
i_engine->pEventAPI->EV_LocalPlayerViewheight(view_height);
|
i_engine->pEventAPI->EV_LocalPlayerViewheight(view_height);
|
||||||
vec3_t local_eyes = vec_add(localplayer->origin, view_height);
|
vec3_t local_eyes = vec_add(localplayer->origin, view_height);
|
||||||
|
|
||||||
/* Get forward vector from viewangles */
|
/* Get forward vector from viewangles */
|
||||||
vec3_t fwd;
|
vec3_t fwd;
|
||||||
i_engine->pfnAngleVectors(cmd->viewangles, fwd, NULL, NULL);
|
i_engine->pfnAngleVectors(cmd->viewangles, fwd, NULL, NULL);
|
||||||
|
@ -55,4 +65,6 @@ void bullet_tracers(usercmd_t* cmd) {
|
||||||
const float w = 0.8;
|
const float w = 0.8;
|
||||||
const float time = 2;
|
const float time = 2;
|
||||||
draw_tracer(local_eyes, end, (rgb_t){ 66, 165, 245 }, 1, w, time);
|
draw_tracer(local_eyes, end, (rgb_t){ 66, 165, 245 }, 1, w, time);
|
||||||
|
lastTracerTime = g_flCurrentTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,9 @@ vec3_t g_punchAngles = { 0, 0, 0 };
|
||||||
float g_flNextAttack = 0.f, g_flNextPrimaryAttack = 0.f;
|
float g_flNextAttack = 0.f, g_flNextPrimaryAttack = 0.f;
|
||||||
int g_iClip = 0;
|
int g_iClip = 0;
|
||||||
|
|
||||||
|
double g_flCurrentTime = 0.0;
|
||||||
|
|
||||||
|
|
||||||
void* hw;
|
void* hw;
|
||||||
void** h_client;
|
void** h_client;
|
||||||
DECL_INTF(cl_enginefunc_t, engine);
|
DECL_INTF(cl_enginefunc_t, engine);
|
||||||
|
|
|
@ -108,6 +108,8 @@ void h_HUD_PostRunCmd(struct local_state_s* from, struct local_state_s* to,
|
||||||
unsigned int random_seed) {
|
unsigned int random_seed) {
|
||||||
ORIGINAL(HUD_PostRunCmd, from, to, cmd, runfuncs, time, random_seed);
|
ORIGINAL(HUD_PostRunCmd, from, to, cmd, runfuncs, time, random_seed);
|
||||||
|
|
||||||
|
g_flCurrentTime = time;
|
||||||
|
|
||||||
/* Store attack information to check if we can shoot */
|
/* Store attack information to check if we can shoot */
|
||||||
if (runfuncs) {
|
if (runfuncs) {
|
||||||
g_flNextAttack = to->client.m_flNextAttack;
|
g_flNextAttack = to->client.m_flNextAttack;
|
||||||
|
|
|
@ -37,6 +37,7 @@ extern game_id this_game_id;
|
||||||
extern vec3_t g_punchAngles;
|
extern vec3_t g_punchAngles;
|
||||||
extern float g_flNextAttack, g_flNextPrimaryAttack;
|
extern float g_flNextAttack, g_flNextPrimaryAttack;
|
||||||
extern int g_iClip;
|
extern int g_iClip;
|
||||||
|
extern double g_flCurrentTime;
|
||||||
|
|
||||||
extern void* hw;
|
extern void* hw;
|
||||||
extern void** h_client; /* hClientDLL hander */
|
extern void** h_client; /* hClientDLL hander */
|
||||||
|
|
|
@ -38,7 +38,7 @@ void load(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get game version after injecting */
|
/* Get game version after injecting */
|
||||||
this_game_id = get_cur_game();
|
//this_game_id = get_cur_game();
|
||||||
|
|
||||||
i_engine->pfnClientCmd("echo \"goldsource-cheat loaded successfully!\"");
|
i_engine->pfnClientCmd("echo \"goldsource-cheat loaded successfully!\"");
|
||||||
i_engine->pfnClientCmd("echo \"Deadzone rulez!\"");
|
i_engine->pfnClientCmd("echo \"Deadzone rulez!\"");
|
||||||
|
@ -64,10 +64,7 @@ void load(void) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
loaded = true;
|
loaded = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue