X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Flib%2Fcsqcmodel%2Fcl_model.qc;h=b443ed3288fc31c4f4a0dc37df9708233ecb7f20;hb=aecd4e7b9523204a1dec88eaee0fd618976baf85;hp=53b58e6297be9dc07e6d6cfd72c8e2cbd5799d45;hpb=7bcb3a89b3271e018da4d92437dc5ba125ea8698;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/lib/csqcmodel/cl_model.qc b/qcsrc/lib/csqcmodel/cl_model.qc index 53b58e629..b443ed328 100644 --- a/qcsrc/lib/csqcmodel/cl_model.qc +++ b/qcsrc/lib/csqcmodel/cl_model.qc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Rudolf PolzerCSQCModel_InterpolateAnimation_2To4_PreNote + * Copyright (c) 2011 Rudolf Polzer * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -24,10 +24,7 @@ #include "cl_player.qh" #include "common.qh" #include "interpolate.qh" -#include -#include #include -#include float autocvar_cl_lerpanim_maxdelta_framegroups = 0.1; float autocvar_cl_nolerp = 0; @@ -182,7 +179,7 @@ void CSQCModel_InterpolateAnimation_Do(entity this) void CSQCModel_Draw(entity this) { // some nice flags for CSQCMODEL_IF and the hooks - bool isplayer = (this.entnum >= 1 && this.entnum <= maxclients); + bool isplayer = (this.isplayermodel & ISPLAYER_CLIENT); noref bool islocalplayer = (this.entnum == player_localnum + 1); noref bool isnolocalplayer = (isplayer && (this.entnum != player_localnum + 1)); @@ -192,7 +189,15 @@ void CSQCModel_Draw(entity this) CSQCModel_InterpolateAnimation_Do(this); - { CSQCMODEL_HOOK_PREDRAW } + CSQCModel_Hook_PreDraw(this, isplayer); + + if(isplayer) + { + if(this.entnum == player_localentnum) + this.renderflags |= RF_EXTERNALMODEL; + else + this.renderflags &= ~RF_EXTERNALMODEL; + } // inherit draw flags easily entity root = this; @@ -218,23 +223,27 @@ void CSQCModel_remove(entity this) 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 = (this.entnum >= 1 && this.entnum <= maxclients); + bool isplayer = (psf & ISPLAYER_CLIENT) || (this.entnum >= 1 && this.entnum <= maxclients); if (isnew && isplayer) { CSQCModel_players[this.entnum - 1] = this; this.entremove = CSQCModel_remove; } bool islocalplayer = (this.entnum == player_localnum + 1); - noref bool isnolocalplayer = (isplayer && (this.entnum != player_localnum + 1)); + noref bool isnolocalplayer = (isplayer && !islocalplayer); + + this.isplayermodel = BITSET(this.isplayermodel, ISPLAYER_CLIENT, isplayer); + this.isplayermodel = BITSET(this.isplayermodel, ISPLAYER_LOCAL, islocalplayer); + this.isplayermodel = BITSET(this.isplayermodel, ISPLAYER_PLAYER, (psf & ISPLAYER_PLAYER)); - this.classname = "csqcmodel"; this.iflags |= IFLAG_ORIGIN; // interpolate origin too this.iflags |= IFLAG_ANGLES; // interpolate angles too this.iflags |= IFLAG_VELOCITY | IFLAG_AUTOVELOCITY; // let's calculate velocity automatically - { CSQCMODEL_HOOK_PREUPDATE } + CSQCModel_Hook_PreUpdate(this, isnew, isplayer, islocalplayer); CSQCPlayer_PreUpdate(this); InterpolateOrigin_Undo(this); @@ -267,11 +276,17 @@ NET_HANDLE(ENT_CLIENT_MODEL, bool isnew) this.csqcmodel_teleported = 1; } + if(sf & BIT(3)) + this.alpha = this.m_alpha; + + if(sf & BIT(11)) + viewloc_SetTags(this); + CSQCModel_InterpolateAnimation_Note(this, sf); InterpolateOrigin_Note(this); CSQCPlayer_PostUpdate(this); - { CSQCMODEL_HOOK_POSTUPDATE } + CSQCModel_Hook_PostUpdate(this, isnew, isplayer, islocalplayer); #ifdef CSQCMODEL_SUPPORT_GETTAGINFO_BEFORE_DRAW InterpolateOrigin_Do(this); @@ -300,6 +315,6 @@ entity CSQCModel_server2csqc(int i) { if (i < maxclients) return CSQCModel_players[i]; ++i; - LOG_DEBUGF("player out of bounds: %d\n", i); + LOG_DEBUGF("player out of bounds: %d", i); return findfloat(NULL, entnum, i); }