Merge remote-tracking branch 'origin/newui' into newui

This commit is contained in:
TotallyNotElite 2018-09-11 20:06:04 +02:00
commit e88e756610

View File

@ -79,7 +79,7 @@ void EffectChams::EndRenderChams()
CMatRenderContextPtr ptr(GET_RENDER_CONTEXT); CMatRenderContextPtr ptr(GET_RENDER_CONTEXT);
g_IVModelRender->ForcedMaterialOverride(nullptr); g_IVModelRender->ForcedMaterialOverride(nullptr);
} }
bool data[32] = {}; rgba_t data[32] = {};
void EffectChams::SetEntityColor(CachedEntity *ent, rgba_t color) void EffectChams::SetEntityColor(CachedEntity *ent, rgba_t color)
{ {
data[ent->m_IDX] = color; data[ent->m_IDX] = color;
@ -93,7 +93,7 @@ rgba_t EffectChams::ChamsColor(IClientEntity *entity)
CachedEntity *ent = ENTITY(entity->entindex()); CachedEntity *ent = ENTITY(entity->entindex());
if (disco_chams) if (disco_chams)
{ {
static rgba_t disco = { 0, 0, 0, 0 }; static rgba_t disco{ 0, 0, 0, 0 };
if (t.test_and_set(200)) if (t.test_and_set(200))
{ {
int color = rand() % 20; int color = rand() % 20;
@ -150,8 +150,8 @@ rgba_t EffectChams::ChamsColor(IClientEntity *entity)
} }
if (data[entity->entindex()]) if (data[entity->entindex()])
{ {
data[entity->entindex()] = false; data[entity->entindex()] = {};
return colors::pink; return data[entity->entindex()];
} }
if (CE_BAD(ent)) if (CE_BAD(ent))
return colors::white; return colors::white;
@ -184,6 +184,8 @@ rgba_t EffectChams::ChamsColor(IClientEntity *entity)
return colors::Health(ent->m_iHealth(), ent->m_iMaxHealth()); return colors::Health(ent->m_iHealth(), ent->m_iMaxHealth());
} }
break; break;
default:
break;
} }
return colors::EntityF(ent); return colors::EntityF(ent);
} }
@ -217,7 +219,7 @@ bool EffectChams::ShouldRenderChams(IClientEntity *entity)
return false; return false;
if (!teammates && !ent->m_bEnemy() && playerlist::IsDefault(ent)) if (!teammates && !ent->m_bEnemy() && playerlist::IsDefault(ent))
return false; return false;
if (CE_BYTE(ent, netvar.iLifeState) != LIFE_ALIVE) if (CE_BYTE(ent, netvar.iLifeState))
return false; return false;
return true; return true;
break; break;
@ -241,8 +243,12 @@ bool EffectChams::ShouldRenderChams(IClientEntity *entity)
case ITEM_AMMO_MEDIUM: case ITEM_AMMO_MEDIUM:
case ITEM_AMMO_SMALL: case ITEM_AMMO_SMALL:
return *ammobox; return *ammobox;
default:
break;
} }
break; break;
default:
break;
} }
return false; return false;
} }
@ -253,7 +259,7 @@ void EffectChams::RenderChamsRecursive(IClientEntity *entity)
return; return;
entity->DrawModel(1); entity->DrawModel(1);
if (!recursive) if (!*recursive)
return; return;
IClientEntity *attach; IClientEntity *attach;
@ -305,7 +311,6 @@ void EffectChams::RenderChams(IClientEntity *entity)
g_IVRenderView->SetColorModulation(color_2); g_IVRenderView->SetColorModulation(color_2);
g_IVModelRender->ForcedMaterialOverride(flat ? mat_unlit_z g_IVModelRender->ForcedMaterialOverride(flat ? mat_unlit_z
: mat_lit_z); : mat_lit_z);
RenderChamsRecursive(entity); RenderChamsRecursive(entity);
} }