X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Flib%2Fwarpzone%2Fclient.qc;h=7f8b0cdc837258a7bb5547d984afbcd960430baa;hp=89f6b84afcef4d306989867fe4c2bb6160247922;hb=991de5e6922cd3c283de56c3249624f0f1bfe767;hpb=7bcb3a89b3271e018da4d92437dc5ba125ea8698 diff --git a/qcsrc/lib/warpzone/client.qc b/qcsrc/lib/warpzone/client.qc index 89f6b84af..7f8b0cdc8 100644 --- a/qcsrc/lib/warpzone/client.qc +++ b/qcsrc/lib/warpzone/client.qc @@ -25,143 +25,123 @@ void WarpZone_Fade_PreDraw(entity this) this.drawmask = MASK_NORMAL; } -void WarpZone_Touch (); +void WarpZone_Touch(entity this, entity toucher); NET_HANDLE(ENT_CLIENT_WARPZONE, bool isnew) { + if(!warpzone_warpzones_exist) + cvar_settemp("r_water", "1"); // HACK for DarkPlaces: always enable reflections when a map has warpzones warpzone_warpzones_exist = 1; - if (!self.enemy) + if (!this.enemy) { - self.enemy = new(warpzone_from); + this.enemy = new(warpzone_from); } - self.classname = "trigger_warpzone"; + this.classname = "trigger_warpzone"; + + if(isnew) + IL_PUSH(g_warpzones, this); int f = ReadByte(); - self.warpzone_isboxy = (f & 1); + this.warpzone_isboxy = (f & 1); if(f & 4) { - self.origin_x = ReadCoord(); - self.origin_y = ReadCoord(); - self.origin_z = ReadCoord(); + this.origin = ReadVector(); } else - self.origin = '0 0 0'; - self.modelindex = ReadShort(); - self.mins_x = ReadCoord(); - self.mins_y = ReadCoord(); - self.mins_z = ReadCoord(); - self.maxs_x = ReadCoord(); - self.maxs_y = ReadCoord(); - self.maxs_z = ReadCoord(); - self.scale = ReadByte() / 16; - self.enemy.oldorigin_x = ReadCoord(); - self.enemy.oldorigin_y = ReadCoord(); - self.enemy.oldorigin_z = ReadCoord(); - self.enemy.avelocity_x = ReadCoord(); - self.enemy.avelocity_y = ReadCoord(); - self.enemy.avelocity_z = ReadCoord(); - self.oldorigin_x = ReadCoord(); - self.oldorigin_y = ReadCoord(); - self.oldorigin_z = ReadCoord(); - self.avelocity_x = ReadCoord(); - self.avelocity_y = ReadCoord(); - self.avelocity_z = ReadCoord(); + this.origin = '0 0 0'; + this.modelindex = ReadShort(); + this.mins = ReadVector(); + this.maxs = ReadVector(); + this.scale = ReadByte() / 16; + this.enemy.oldorigin = ReadVector(); + this.enemy.avelocity = ReadVector(); + this.oldorigin = ReadVector(); + this.avelocity = ReadVector(); if(f & 2) { - self.warpzone_fadestart = ReadShort(); - self.warpzone_fadeend = max(self.warpzone_fadestart + 1, ReadShort()); + this.warpzone_fadestart = ReadShort(); + this.warpzone_fadeend = max(this.warpzone_fadestart + 1, ReadShort()); } else { - self.warpzone_fadestart = 0; - self.warpzone_fadeend = 0; + this.warpzone_fadestart = 0; + this.warpzone_fadeend = 0; } // common stuff - WarpZone_SetUp(self, self.enemy.oldorigin, self.enemy.avelocity, self.oldorigin, self.avelocity); + WarpZone_SetUp(this, this.enemy.oldorigin, this.enemy.avelocity, this.oldorigin, this.avelocity); // link me - //setmodel(self, self.model); - setorigin(self, self.origin); - setsize(self, self.mins, self.maxs); + //setmodel(this, this.model); + setorigin(this, this.origin); + setsize(this, this.mins, this.maxs); // how to draw // engine currently wants this - setpredraw(self, WarpZone_Fade_PreDraw); + setpredraw(this, WarpZone_Fade_PreDraw); - //self.move_touch = WarpZone_Touch; + //settouch(this, WarpZone_Touch); return true; } NET_HANDLE(ENT_CLIENT_WARPZONE_CAMERA, bool isnew) { + if(!warpzone_cameras_exist) + cvar_settemp("r_water", "1"); // HACK for DarkPlaces: always enable reflections when a map has cameras warpzone_cameras_exist = 1; - self.classname = "func_warpzone_camera"; + this.classname = "func_warpzone_camera"; int f = ReadByte(); if(f & 4) { - self.origin_x = ReadCoord(); - self.origin_y = ReadCoord(); - self.origin_z = ReadCoord(); + this.origin = ReadVector(); } else - self.origin = '0 0 0'; - self.modelindex = ReadShort(); - self.mins_x = ReadCoord(); - self.mins_y = ReadCoord(); - self.mins_z = ReadCoord(); - self.maxs_x = ReadCoord(); - self.maxs_y = ReadCoord(); - self.maxs_z = ReadCoord(); - self.scale = ReadByte() / 16; - self.oldorigin_x = ReadCoord(); - self.oldorigin_y = ReadCoord(); - self.oldorigin_z = ReadCoord(); - self.avelocity_x = ReadCoord(); - self.avelocity_y = ReadCoord(); - self.avelocity_z = ReadCoord(); + this.origin = '0 0 0'; + this.modelindex = ReadShort(); + this.mins = ReadVector(); + this.maxs = ReadVector(); + this.scale = ReadByte() / 16; + this.oldorigin = ReadVector(); + this.avelocity = ReadVector(); if(f & 2) { - self.warpzone_fadestart = ReadShort(); - self.warpzone_fadeend = max(self.warpzone_fadestart + 1, ReadShort()); + this.warpzone_fadestart = ReadShort(); + this.warpzone_fadeend = max(this.warpzone_fadestart + 1, ReadShort()); } else { - self.warpzone_fadestart = 0; - self.warpzone_fadeend = 0; + this.warpzone_fadestart = 0; + this.warpzone_fadeend = 0; } // common stuff - WarpZone_Camera_SetUp(self, self.oldorigin, self.avelocity); + WarpZone_Camera_SetUp(this, this.oldorigin, this.avelocity); // engine currently wants this - self.drawmask = MASK_NORMAL; + this.drawmask = MASK_NORMAL; // link me - //setmodel(self, self.model); - setorigin(self, self.origin); - setsize(self, self.mins, self.maxs); + //setmodel(this, this.model); + setorigin(this, this.origin); + setsize(this, this.mins, this.maxs); // how to draw // engine currently wants this - setpredraw(self, WarpZone_Fade_PreDraw); + setpredraw(this, WarpZone_Fade_PreDraw); return true; } void CL_RotateMoves(vector ang) = #638; NET_HANDLE(ENT_CLIENT_WARPZONE_TELEPORTED, bool isnew) { - self.classname = "warpzone_teleported"; - vector v; - v.x = ReadCoord(); - v.y = ReadCoord(); - v.z = ReadCoord(); + this.classname = "warpzone_teleported"; + vector v = ReadVector(); return = true; if (!isnew) return; - self.warpzone_transform = v; - setproperty(VF_CL_VIEWANGLES, WarpZone_TransformVAngles(self, getpropertyvec(VF_CL_VIEWANGLES))); + this.warpzone_transform = v; + setproperty(VF_CL_VIEWANGLES, WarpZone_TransformVAngles(this, getpropertyvec(VF_CL_VIEWANGLES))); if(checkextension("DP_CSQC_ROTATEMOVES")) CL_RotateMoves(v); //CL_RotateMoves('0 90 0'); @@ -226,8 +206,7 @@ vector WarpZone_FixNearClip(vector o, vector c0, vector c1, vector c2, vector c3 void WarpZone_FixPMove() { - entity e; - e = WarpZone_Find(pmove_org, pmove_org); + entity e = WarpZone_Find(pmove_org, pmove_org); if(e) { pmove_org = WarpZone_TransformOrigin(e, pmove_org); @@ -242,7 +221,6 @@ void WarpZone_FixView() { entity e; vector org, ang, nearclip, corner0, corner1, corner2, corner3, o; - float f; warpzone_save_view_origin = org = getpropertyvec(VF_ORIGIN); warpzone_save_view_angles = ang = getpropertyvec(VF_ANGLES); @@ -259,10 +237,29 @@ void WarpZone_FixView() #ifndef KEEP_ROLL float rick; - if(autocvar_cl_rollkillspeed) - f = max(0, (1 - frametime * autocvar_cl_rollkillspeed)); - else + float f; + static float rollkill; + if (STAT(HEALTH) > 0 || STAT(HEALTH) == -666 || STAT(HEALTH) == -2342) + { f = 0; + // reset roll when passing through a warpzone that change player's roll angle + if(autocvar_cl_rollkillspeed) + f = max(0, (1 - frametime * autocvar_cl_rollkillspeed)); + if(rollkill) + rollkill = 0; + } + else + { + f = 1; + // roll the view when killed (v_deathtilt) + if(autocvar_cl_rollkillspeed) + { + rollkill += frametime * autocvar_cl_rollkillspeed; + f = min(1, rollkill); + } + else if(rollkill) + rollkill = 0; + } rick = getproperty(VF_CL_VIEWANGLES_Z); rick *= f;