}
}
+// FEATURE: EF_NODRAW workalike
+.float invisible_effects;
+void CSQCModel_Invisible_PreUpdate(void)
+{
+ self.effects = self.invisible_effects;
+}
+void CSQCModel_Invisible_PostUpdate(void)
+{
+ self.invisible_effects = self.effects;
+ self.effects &~= CSQCMODEL_EF_INVISIBLE;
+}
+void CSQCModel_Invisible_Apply(void)
+{
+ if(self.invisible_effects & CSQCMODEL_EF_INVISIBLE)
+ self.drawmask = 0;
+}
+
// general functions
void CSQCModel_Hook_PreDraw(float isplayer, float islocalplayer)
{
void CSQCModel_Hook_PreUpdate(float isplayer, float islocalplayer)
{
+ CSQCModel_Invisible_PreUpdate();
if(isplayer)
{
// revert to values from server
- CSQCPlayer_ForceModel_PreUpdate();
CSQCPlayer_FallbackFrame_PreUpdate();
+ CSQCPlayer_ForceModel_PreUpdate();
}
}
CSQCPlayer_ForceModel_PostUpdate();
CSQCPlayer_FallbackFrame_PostUpdate();
}
+ CSQCModel_Invisible_PostUpdate();
}
CSQCModel_CheckUpdate()
# endif
#endif
+
+#define CSQCMODEL_EF_INVISIBLE EF_SELECTABLE
}
}
- if(self.modelindex == 0 && self.deadflag == DEAD_NO)
- {
- if(self.model != "")
- bprint("\{1}^1Player ", self.netname, "^1 has a zero modelindex, trying to fix...\n");
- self.model = ""; // force the != checks to return true
- }
-
if(defaultmodel != "")
{
if (defaultmodel != self.model)
return;
}
- if (!self.owner.modelindex)
+ if (self.owner.effects & CSQCMODEL_EF_INVISIBLE)
{
self.owner.killindicator = world;
remove(self);
if(!self.killindicator)
{
- if(self.modelindex && self.deadflag == DEAD_NO)
+ if(self.deadflag == DEAD_NO)
{
killtime = max(killtime, self.clientkill_nexttime - time);
self.clientkill_nexttime = time + killtime + autocvar_g_balance_kill_antispam;
void ChatBubbleThink()
{
self.nextthink = time;
- if (!self.owner.modelindex || self.owner.chatbubbleentity != self)
+ if ((self.owner.effects & CSQCMODEL_EF_INVISIBLE) || self.owner.chatbubbleentity != self)
{
if(self.owner) // but why can that ever be world?
self.owner.chatbubbleentity = world;
void UpdateChatBubble()
{
- if (!self.modelindex)
+ if (self.effects & CSQCMODEL_EF_INVISIBLE)
return;
// spawn a chatbubble entity if needed
if (!self.chatbubbleentity)
.float oldcolormap;
void respawn(void)
{
- if(self.modelindex != 0 && autocvar_g_respawn_ghosts)
+ if(!(self.effects & CSQCMODEL_EF_INVISIBLE) && autocvar_g_respawn_ghosts)
{
self.solid = SOLID_NOT;
self.takedamage = DAMAGE_NO;
self.effects &~= (EF_DIMLIGHT | EF_RED | EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT | EF_FLAME | EF_NODEPTHTEST);
- if(!self.modelindex || self.deadflag) // don't apply the flags if the player is gibbed
+ if((self.effects & CSQCMODEL_EF_INVISIBLE) || self.deadflag) // don't apply the flags if the player is gibbed
return;
Fire_ApplyDamage(self);
self.dmg_take = self.dmg_take + take;//max(take - 10, 0);
self.dmg_inflictor = inflictor;
- if (self.health <= -autocvar_sv_gibhealth && self.modelindex != 0)
+ if (self.health <= -autocvar_sv_gibhealth && !(self.effects & CSQCMODEL_EF_INVISIBLE))
{
// don't use any animations as a gib
self.frame = 0;
self.view_ofs = '0 0 4';
Violence_GibSplash(self, 1, 1, attacker);
- self.modelindex = 0; // restore later
+ self.effects |= CSQCMODEL_EF_INVISIBLE;
self.solid = SOLID_NOT; // restore later
}
}