Add hand chams

This commit is contained in:
8dcc 2023-07-26 16:34:14 +02:00
parent b5981b1da3
commit 7ad62b0fc4
3 changed files with 28 additions and 6 deletions

View File

@ -6,18 +6,35 @@
#include <GL/gl.h>
enum chams_settings {
DISABLED = 0,
PLAYER_CHAMS = 1,
HAND_CHAMS = 2,
/* ALL is 3, but we can OR player and hands */
};
visible_flags visible_mode;
bool chams(void* this_ptr) {
if (!CVAR_ON(chams))
const int setting = cv_chams->value;
if (setting == DISABLED)
return false;
cl_entity_t* ent = i_enginestudio->GetCurrentEntity();
if (ent->index == localplayer->index) {
/* TODO: Hand chams (set var, check in gl hook, return true) */
return false;
} else if (!valid_player(ent) || !is_alive(ent)) {
if (ent->index == localplayer->index && setting & HAND_CHAMS) {
/* If we are rendering hands and setting is on, render them */
glDisable(GL_TEXTURE_2D);
visible_mode = HANDS; /* Set for this call */
i_studiomodelrenderer->StudioRenderFinal(this_ptr);
visible_mode = NONE; /* Reset for future calls */
glEnable(GL_TEXTURE_2D);
return true;
} else if (!(setting & PLAYER_CHAMS) || !valid_player(ent) ||
!is_alive(ent)) {
/* If we don't want player chams, or this is not a player, stop */
return false;
}

View File

@ -8,7 +8,7 @@ enum visible_flags {
NONE = 0,
VISIBLE = 1,
NOT_VISIBLE = 2,
/* TODO: HANDS */
HANDS = 3,
};
/*----------------------------------------------------------------------------*/

View File

@ -99,6 +99,11 @@ void h_glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a) {
g = 0.07f;
b = 0.27f;
break;
case HANDS:
r = 0.94f;
g = 0.66f;
b = 0.94f;
break;
default:
case NONE:
break;