From b81918bdbe9ce0d2b1a8e3106f66f2319f0132fe Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sat, 12 Nov 2011 17:52:46 +0100 Subject: [PATCH] more stuff --- qcsrc/client/View.qc | 6 +----- qcsrc/common/csqcmodel.qc | 29 ++++++++++++++++++++++++++++- qcsrc/common/csqcmodel.qh | 1 + 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index a8acc0869..37f320b43 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -398,11 +398,7 @@ void CSQC_UpdateView(float w, float h) WaypointSprite_Load(); - if((e = findfloat(world, entnum, player_localentnum))) - { - R_SetView3fv(VF_ORIGIN, e.origin + e.view_ofs); - R_SetView3fv(VF_ANGLES, e.angles); - } + CSQCModel_SetCamera(); if(spectatee_status) myteam = GetPlayerColor(spectatee_status - 1); diff --git a/qcsrc/common/csqcmodel.qc b/qcsrc/common/csqcmodel.qc index cf5bce68c..688ba7daf 100644 --- a/qcsrc/common/csqcmodel.qc +++ b/qcsrc/common/csqcmodel.qc @@ -78,12 +78,32 @@ void CSQCModel_LinkEntity() #ifdef CSQC +void CSQCModel_Draw() +{ + InterpolateOrigin_Do(); +} + +entity csqcmodel_me; +void CSQCModel_SetCamera() +{ + if(csqcmodel_me) + { + entity oldself; + oldself = self; + self = csqcmodel_me; + InterpolateOrigin_Do(); + self = oldself; + R_SetView3fv(VF_ORIGIN, csqcmodel_me.origin + csqcmodel_me.view_ofs); + //R_SetView3fv(VF_ANGLES, e.angles); + } +} + void CSQCModel_Read() { float sf; sf = ReadShort(); - print("Read an update of flags: ", ftos(sf), "\n"); + InterpolateOrigin_Undo(); #define PROPERTY(flag,r,w,f) \ if(sf & flag) \ @@ -96,11 +116,18 @@ void CSQCModel_Read() #undef PROPERTY // if it is the local player, prediction + // interpolation + InterpolateOrigin_Note(); // CSQC_UpdateView has to set camera to this if this is the local player // draw it + self.renderflags = RF_EXTERNALMODEL; + if(self.entnum == player_localentnum) + csqcmodel_me = self; + self.drawmask = MASK_NORMAL; + self.predraw = CSQCModel_Draw; } #endif diff --git a/qcsrc/common/csqcmodel.qh b/qcsrc/common/csqcmodel.qh index e8387a268..f1b4c1c68 100644 --- a/qcsrc/common/csqcmodel.qh +++ b/qcsrc/common/csqcmodel.qh @@ -6,5 +6,6 @@ void CSQCModel_LinkEntity(); #endif #ifdef CSQC +void CSQCModel_SetCamera(); void CSQCModel_Read(); #endif -- 2.39.2