X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcsqcmodel%2Fcl_player.qc;h=bcb0c08311c9e98f77121e46ef973e459996d517;hb=21836a0c615c95db00ec3993f13f91330d5d9d39;hp=f2e24d674e9f3e6425d38812492db8d866e7fc91;hpb=3b318c458364dbf74c3c814d2dbef8655b0d4810;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/csqcmodel/cl_player.qc b/qcsrc/csqcmodel/cl_player.qc index f2e24d674..bcb0c0831 100644 --- a/qcsrc/csqcmodel/cl_player.qc +++ b/qcsrc/csqcmodel/cl_player.qc @@ -21,15 +21,14 @@ */ var float autocvar_cl_predictionerrorcompensation = 0; -var float autocvar_chase_active; -var float autocvar_chase_back; // engine stuff .float pmove_flags; float pmove_onground; // weird engine flag we shouldn't really use but have to for now #define PMF_DUCKED 4 -#define PMF_TELEPORTED 16 -#define PMF_ONGROUND 32 +#define PMF_ONGROUND 8 +#define REFDEFFLAG_TELEPORTED 1 +#define REFDEFFLAG_JUMPING 2 entity csqcplayer; vector csqcplayer_origin, csqcplayer_velocity; @@ -126,18 +125,21 @@ float CSQCPlayer_IsLocalPlayer() return (self == csqcplayer); } -void(entity e) V_CalcRefdef = #640; // DP_CSQC_V_CALCREFDEF +void(entity e, float fl) V_CalcRefdef = #640; // DP_CSQC_V_CALCREFDEF void CSQCPlayer_SetCamera() { if(csqcplayer) { - vector org, ang; entity oldself; oldself = self; self = csqcplayer; +#ifdef COMPAT_XON050_ENGINE + if(servercommandframe == 0 || !(checkextension("DP_CSQC_V_CALCREFDEF") || checkextension("DP_CSQC_V_CALCREFDEF_WIP1"))) +#else if(servercommandframe == 0) +#endif { InterpolateOrigin_Do(); self.view_ofs = '0 0 1' * getstati(STAT_VIEWHEIGHT); @@ -156,7 +158,8 @@ void CSQCPlayer_SetCamera() CSQCPlayer_SetMinsMaxs(); - self.view_ofs_z = getstati(STAT_VIEWHEIGHT); + // override it back just in case + self.view_ofs = '0 0 1' * getstati(STAT_VIEWHEIGHT); } else { @@ -193,31 +196,54 @@ void CSQCPlayer_SetCamera() // relink setorigin(self, self.origin); - if(checkextension("DP_CSQC_V_CALCREFDEF")) - { - // set teleport bit - if(self.csqcmodel_teleported) - { - self.pmove_flags |= PMF_TELEPORTED; - self.csqcmodel_teleported = 0; - } - else - self.pmove_flags &~= PMF_TELEPORTED; + self.angles_y = input_angles_y; + + self = oldself; + } + + entity view; +#ifdef COMPAT_XON050_ENGINE + view = CSQCModel_server2csqc((spectatee_status > 0) ? spectatee_status : player_localentnum); +#else + view = CSQCModel_server2csqc(player_localentnum); +#endif + +#ifdef COMPAT_XON050_ENGINE + if(view && !(checkextension("DP_CSQC_V_CALCREFDEF") || checkextension("DP_CSQC_V_CALCREFDEF_WIP1"))) + { + // legacy code, not totally correct, but good enough for not having V_CalcRefdef + setproperty(VF_ORIGIN, view.origin + '0 0 1' * getstati(STAT_VIEWHEIGHT)); + setproperty(VF_ANGLES, view.angles); + } + else +#endif + if(view) + { + var float refdefflags = 0; - V_CalcRefdef(self); + if(view.csqcmodel_teleported) + { + refdefflags |= REFDEFFLAG_TELEPORTED; + view.csqcmodel_teleported = 0; } - else - R_SetView3fv(VF_ORIGIN, self.origin + self.view_ofs); - { CSQCPLAYER_HOOK_POSTCAMERASETUP } + if(input_buttons & 4) + refdefflags |= REFDEFFLAG_JUMPING; - self = oldself; + V_CalcRefdef(view, refdefflags); } + else + { + // no setup, keep engine provided values + // to support a legacy entity being the view + } + + { CSQCPLAYER_HOOK_POSTCAMERASETUP } } void CSQCPlayer_Remove() { - if(self.entnum != player_localentnum) + if(self.entnum != player_localnum + 1) return; csqcplayer = world; cvar_clientsettemp("cl_movement_replay", "1"); @@ -225,7 +251,7 @@ void CSQCPlayer_Remove() float CSQCPlayer_PreUpdate() { - if(self.entnum != player_localentnum) + if(self.entnum != player_localnum + 1) return 0; cvar_clientsettemp("cl_movement_replay", "0"); if(csqcplayer_status != CSQCPLAYERSTATUS_FROMSERVER) @@ -235,13 +261,6 @@ float CSQCPlayer_PreUpdate() float CSQCPlayer_PostUpdate() { - /* - if(self.entnum == player_localentnum) - self.renderflags |= RF_EXTERNALMODEL; - else - self.renderflags &~= RF_EXTERNALMODEL; - */ - if(self.entnum != player_localentnum) return 0; csqcplayer_status = CSQCPLAYERSTATUS_FROMSERVER; @@ -249,8 +268,3 @@ float CSQCPlayer_PostUpdate() self.entremove = CSQCPlayer_Remove; return 1; } - -entity CSQCPlayer_GetPlayer(float pl) -{ - return findfloat(world, entnum, pl); // FIXME optimize this using an array -}