diff --git a/src/features/chams.c b/src/features/chams.c index 793e618..d6fca54 100644 --- a/src/features/chams.c +++ b/src/features/chams.c @@ -8,15 +8,17 @@ enum chams_settings { DISABLED = 0, - PLAYER_CHAMS = 1, - HAND_CHAMS = 2, - /* ALL is 3, but we can OR player and hands */ + ENEMY_CHAMS = 1, + FRIEND_CHAMS = 2, + /* ALL_PLAYER is 3, but we can OR player and hands */ + HAND_CHAMS = 4, + /* ALL is 5, but we will convert it to 7 so every setting can be OR'd */ }; visible_flags visible_mode; bool chams(void* this_ptr) { - const int setting = cv_chams->value; + const int setting = cv_chams->value == 5.0f ? 7 : cv_chams->value; if (setting == DISABLED) return false; @@ -32,21 +34,29 @@ bool chams(void* 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)) { + } else if (!valid_player(ent) || !is_alive(ent)) { /* If we don't want player chams, or this is not a player, stop */ return false; } + const bool friendly = is_friend(ent); + + if (friendly && !(setting & FRIEND_CHAMS)) + /* Friendly ent but we dont want to render friends */ + return false; + else if (!friendly && !(setting & ENEMY_CHAMS)) + /* Not friendly ent and we dont want to render enemies */ + return false; + /* If we got here it means we are rendering a valid player */ glDisable(GL_TEXTURE_2D); glDisable(GL_DEPTH_TEST); /* Ignore depth (walls between target) */ - visible_mode = NOT_VISIBLE; + visible_mode = friendly ? FRIEND_NOT_VISIBLE : ENEMY_NOT_VISIBLE; i_studiomodelrenderer->StudioRenderFinal(this_ptr); glEnable(GL_DEPTH_TEST); /* Don't ignore depth, different color chams */ - visible_mode = VISIBLE; + visible_mode = friendly ? FRIEND_VISIBLE : ENEMY_VISIBLE; i_studiomodelrenderer->StudioRenderFinal(this_ptr); /* Reset for future calls to glColor4f (from here or somewhere else) */ diff --git a/src/features/features.h b/src/features/features.h index 28b37ba..cdd525c 100644 --- a/src/features/features.h +++ b/src/features/features.h @@ -5,10 +5,12 @@ #include "../include/sdk.h" enum visible_flags { - NONE = 0, - VISIBLE = 1, - NOT_VISIBLE = 2, - HANDS = 3, + NONE = 0, + ENEMY_VISIBLE = 1, + ENEMY_NOT_VISIBLE = 2, + FRIEND_VISIBLE = 3, + FRIEND_NOT_VISIBLE = 4, + HANDS = 5, }; /*----------------------------------------------------------------------------*/ diff --git a/src/hooks.c b/src/hooks.c index 63dcd2d..64b9d56 100644 --- a/src/hooks.c +++ b/src/hooks.c @@ -90,16 +90,26 @@ void h_glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a) { * Depending on the type of entity we are trying to render from there, and * depending on its visibility, we change this visible_mode variable. */ switch (visible_mode) { - case VISIBLE: + case ENEMY_VISIBLE: r = 0.40f; g = 0.73f; b = 0.41f; break; - case NOT_VISIBLE: + case ENEMY_NOT_VISIBLE: r = 0.90f; g = 0.07f; b = 0.27f; break; + case FRIEND_VISIBLE: + r = 0.16f; + g = 0.71f; + b = 0.96f; + break; + case FRIEND_NOT_VISIBLE: + r = 0.00f; + g = 0.53f; + b = 0.81f; + break; case HANDS: /* Multiply by original func parameters for non-flat chams. * Credits: @oxiKKK */