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> #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; visible_flags visible_mode;
bool chams(void* this_ptr) { bool chams(void* this_ptr) {
if (!CVAR_ON(chams)) const int setting = cv_chams->value;
if (setting == DISABLED)
return false; return false;
cl_entity_t* ent = i_enginestudio->GetCurrentEntity(); cl_entity_t* ent = i_enginestudio->GetCurrentEntity();
if (ent->index == localplayer->index) { if (ent->index == localplayer->index && setting & HAND_CHAMS) {
/* TODO: Hand chams (set var, check in gl hook, return true) */ /* If we are rendering hands and setting is on, render them */
return false; glDisable(GL_TEXTURE_2D);
} else if (!valid_player(ent) || !is_alive(ent)) { 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; return false;
} }

View File

@ -8,7 +8,7 @@ enum visible_flags {
NONE = 0, NONE = 0,
VISIBLE = 1, VISIBLE = 1,
NOT_VISIBLE = 2, 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; g = 0.07f;
b = 0.27f; b = 0.27f;
break; break;
case HANDS:
r = 0.94f;
g = 0.66f;
b = 0.94f;
break;
default: default:
case NONE: case NONE:
break; break;