.float death_time;
.int modelflags;
-.bool isplayermodel;
-
// FEATURE: LOD
.int lodmodelindex0;
.int lodmodelindex1;
// recursive predraw call to fix issues with forcemodels and LOD if bone indexes mismatch
if(this.tag_entity.classname == "csqcmodel")
{
- CSQCModel_Hook_PreDraw(this.tag_entity, (this.tag_entity.entnum >= 1 && this.tag_entity.entnum <= maxclients));
+ CSQCModel_Hook_PreDraw(this.tag_entity, (this.tag_entity.isplayermodel & ISPLAYER_ENT));
}
if(this.tag_entity.modelindex != this.tag_entity_lastmodelindex)
if(this.isplayermodel && this.drawmask) // this checks if it's a player MODEL!
{
- CSQCPlayer_ModelAppearance_Apply(this, this.entnum == player_localnum + 1);
+ CSQCPlayer_ModelAppearance_Apply(this, (this.isplayermodel & ISPLAYER_LOCAL));
CSQCPlayer_LOD_Apply(this);
if(!isplayer)
void CSQCModel_Hook_PostUpdate(entity this, bool isnew, bool isplayer, bool islocalplayer)
{
// is it a player model? (shared state)
- this.isplayermodel = (substring(this.model, 0, 14) == "models/player/" || substring(this.model, 0, 17) == "models/ok_player/" || (substring(this.model, 0, 16) == "models/monsters/" && (this.entnum >= 1 && this.entnum <= maxclients)));
+ bool is_playermodel = (substring(this.model, 0, 14) == "models/player/" || substring(this.model, 0, 17) == "models/ok_player/" ||
+ (substring(this.model, 0, 16) == "models/monsters/" && (this.isplayermodel & BIT(1))));
+ this.isplayermodel = BITSET(this.isplayermodel, ISPLAYER_MODEL, is_playermodel);
// save values set by server
if(this.isplayermodel)
.int csqcmodel_modelflags;
.int csqcmodel_traileffect;
+.int isplayermodel;
+
void CSQCModel_Effects_Apply(entity this);
void CSQCModel_Hook_PreDraw(entity this, bool isplayer);
.float cnt;
.int state;
-.bool isplayermodel;
void DamageEffect_Think(entity this)
{
return;
}
this.state = this.owner.csqcmodel_isdead;
- if(this.owner.isplayermodel && (this.owner.entnum == player_localentnum) && !autocvar_chase_active)
+ if(this.owner.isplayermodel && (this.owner.isplayermodel & ISPLAYER_LOCAL) && !autocvar_chase_active)
return; // if we aren't using a third person camera, hide our own effects
// now generate the particles
.entity hook;
// TODO
- #define IS_CLIENT(s) ((s).isplayermodel || (s) == csqcplayer)
- #define IS_PLAYER(s) ((s).isplayermodel)
+ #define IS_CLIENT(s) (((s).isplayermodel & ISPLAYER_ENT) || (s) == csqcplayer)
+ #define IS_PLAYER(s) ((s).isplayermodel & ISPLAYER_ENT)
#define IS_NOT_A_CLIENT(s) (!(s).isplayermodel && (s) != csqcplayer)
#define isPushable(s) ((s).isplayermodel || (s).pushable || ((s).flags & FL_PROJECTILE))
NET_HANDLE(ENT_CLIENT_MODEL, bool isnew)
{
int sf = ReadInt24_t();
+ int psf = ReadByte();
// some nice flags for CSQCMODEL_IF and the hooks
- bool isplayer = ReadByte() || (this.entnum >= 1 && this.entnum <= maxclients);
+ bool isplayer = (psf & ISPLAYER_ENT) || (this.entnum >= 1 && this.entnum <= maxclients);
if (isnew && isplayer)
{
CSQCModel_players[this.entnum - 1] = this;
bool islocalplayer = (this.entnum == player_localnum + 1);
noref bool isnolocalplayer = (isplayer && !islocalplayer);
+ this.isplayermodel = BITSET(this.isplayermodel, ISPLAYER_ENT, isplayer);
+ this.isplayermodel = BITSET(this.isplayermodel, ISPLAYER_LOCAL, islocalplayer);
+
this.classname = "csqcmodel";
this.iflags |= IFLAG_ORIGIN; // interpolate origin too
this.iflags |= IFLAG_ANGLES; // interpolate angles too
.float frame2time;
.float lerpfrac;
+const int ISPLAYER_MODEL = BIT(0); // using a player model
+const int ISPLAYER_ENT = BIT(1); // is an actual player
+const int ISPLAYER_LOCAL = BIT(2); // is the local player
+
const int CSQCMODEL_PROPERTY_FRAME = BIT(23);
const int CSQCMODEL_PROPERTY_TELEPORTED = BIT(22); // the "teleport bit" cancelling interpolation
const int CSQCMODEL_PROPERTY_MODELINDEX = BIT(21);
noref bool islocalplayer = (this == to);
noref bool isnolocalplayer = (isplayer && (this != to));
+ int psf = 0;
+ psf = BITSET(psf, ISPLAYER_ENT, isplayer);
+ psf = BITSET(psf, ISPLAYER_LOCAL, islocalplayer);
+
WriteHeader(MSG_ENTITY, ENT_CLIENT_MODEL);
WriteInt24_t(MSG_ENTITY, sf);
- WriteByte(MSG_ENTITY, isplayer);
+ WriteByte(MSG_ENTITY, psf);
#define CSQCMODEL_IF(cond) if(cond) {
#define CSQCMODEL_ENDIF }