Add friendly and enemy chams
Add 2 new chams settings (friendly only and all players) Add 2 new colors to visible_flags enum (friend_visible and friend_not_visible) Add friendly colors to glColor4f hook
This commit is contained in:
parent
9743b58ae4
commit
3a107737b9
|
@ -8,15 +8,17 @@
|
||||||
|
|
||||||
enum chams_settings {
|
enum chams_settings {
|
||||||
DISABLED = 0,
|
DISABLED = 0,
|
||||||
PLAYER_CHAMS = 1,
|
ENEMY_CHAMS = 1,
|
||||||
HAND_CHAMS = 2,
|
FRIEND_CHAMS = 2,
|
||||||
/* ALL is 3, but we can OR player and hands */
|
/* 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;
|
visible_flags visible_mode;
|
||||||
|
|
||||||
bool chams(void* this_ptr) {
|
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)
|
if (setting == DISABLED)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -32,21 +34,29 @@ bool chams(void* this_ptr) {
|
||||||
visible_mode = NONE; /* Reset for future calls */
|
visible_mode = NONE; /* Reset for future calls */
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
return true;
|
return true;
|
||||||
} else if (!(setting & PLAYER_CHAMS) || !valid_player(ent) ||
|
} else if (!valid_player(ent) || !is_alive(ent)) {
|
||||||
!is_alive(ent)) {
|
|
||||||
/* If we don't want player chams, or this is not a player, stop */
|
/* If we don't want player chams, or this is not a player, stop */
|
||||||
return false;
|
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 */
|
/* If we got here it means we are rendering a valid player */
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
glDisable(GL_DEPTH_TEST); /* Ignore depth (walls between target) */
|
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);
|
i_studiomodelrenderer->StudioRenderFinal(this_ptr);
|
||||||
|
|
||||||
glEnable(GL_DEPTH_TEST); /* Don't ignore depth, different color chams */
|
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);
|
i_studiomodelrenderer->StudioRenderFinal(this_ptr);
|
||||||
|
|
||||||
/* Reset for future calls to glColor4f (from here or somewhere else) */
|
/* Reset for future calls to glColor4f (from here or somewhere else) */
|
||||||
|
|
|
@ -6,9 +6,11 @@
|
||||||
|
|
||||||
enum visible_flags {
|
enum visible_flags {
|
||||||
NONE = 0,
|
NONE = 0,
|
||||||
VISIBLE = 1,
|
ENEMY_VISIBLE = 1,
|
||||||
NOT_VISIBLE = 2,
|
ENEMY_NOT_VISIBLE = 2,
|
||||||
HANDS = 3,
|
FRIEND_VISIBLE = 3,
|
||||||
|
FRIEND_NOT_VISIBLE = 4,
|
||||||
|
HANDS = 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
14
src/hooks.c
14
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 the type of entity we are trying to render from there, and
|
||||||
* depending on its visibility, we change this visible_mode variable. */
|
* depending on its visibility, we change this visible_mode variable. */
|
||||||
switch (visible_mode) {
|
switch (visible_mode) {
|
||||||
case VISIBLE:
|
case ENEMY_VISIBLE:
|
||||||
r = 0.40f;
|
r = 0.40f;
|
||||||
g = 0.73f;
|
g = 0.73f;
|
||||||
b = 0.41f;
|
b = 0.41f;
|
||||||
break;
|
break;
|
||||||
case NOT_VISIBLE:
|
case ENEMY_NOT_VISIBLE:
|
||||||
r = 0.90f;
|
r = 0.90f;
|
||||||
g = 0.07f;
|
g = 0.07f;
|
||||||
b = 0.27f;
|
b = 0.27f;
|
||||||
break;
|
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:
|
case HANDS:
|
||||||
/* Multiply by original func parameters for non-flat chams.
|
/* Multiply by original func parameters for non-flat chams.
|
||||||
* Credits: @oxiKKK */
|
* Credits: @oxiKKK */
|
||||||
|
|
Loading…
Reference in New Issue