X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fwarpzonelib%2Fclient.qc;h=4b36b4651dc75efa463357b8f7d2405caaffcd05;hb=7204ed4f20ffc2ac138f4adf278de52128529fe6;hp=1dbe824d6629929a90d053e2d9e8b71abea64160;hpb=06f163284faddd0c1e8d66e198eba4771e3ea2f8;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/warpzonelib/client.qc b/qcsrc/warpzonelib/client.qc index 1dbe824d6..4b36b4651 100644 --- a/qcsrc/warpzonelib/client.qc +++ b/qcsrc/warpzonelib/client.qc @@ -1,5 +1,21 @@ +void WarpZone_Fade_PreDraw() +{ + if(self.warpzone_fadestart) + self.alpha = bound(0, (self.warpzone_fadeend - vlen(view_origin - self.origin - 0.5 * (self.mins + self.maxs))) / (self.warpzone_fadeend - self.warpzone_fadestart), 1); + else + self.alpha = 1; + //print(sprintf("%v <-> %v\n", view_origin, self.origin + 0.5 * (self.mins + self.maxs))); + if(self.alpha <= 0) + self.drawmask = 0; + else + self.drawmask = MASK_NORMAL; +} + void WarpZone_Read(float isnew) { + float f; + + warpzone_warpzones_exist = 1; if not(self.enemy) { self.enemy = spawn(); @@ -7,10 +23,16 @@ void WarpZone_Read(float isnew) } self.classname = "trigger_warpzone"; - self.warpzone_isboxy = ReadByte(); - self.origin_x = ReadCoord(); - self.origin_y = ReadCoord(); - self.origin_z = ReadCoord(); + f = ReadByte(); + self.warpzone_isboxy = (f & 1); + if(f & 4) + { + self.origin_x = ReadCoord(); + self.origin_y = ReadCoord(); + self.origin_z = ReadCoord(); + } + else + self.origin = '0 0 0'; self.modelindex = ReadShort(); self.mins_x = ReadCoord(); self.mins_y = ReadCoord(); @@ -32,24 +54,48 @@ void WarpZone_Read(float isnew) self.avelocity_y = ReadCoord(); self.avelocity_z = ReadCoord(); + if(f & 2) + { + self.warpzone_fadestart = ReadShort(); + self.warpzone_fadeend = max(self.warpzone_fadestart + 1, ReadShort()); + } + else + { + self.warpzone_fadestart = 0; + self.warpzone_fadeend = 0; + } + // common stuff WarpZone_SetUp(self, self.enemy.oldorigin, self.enemy.avelocity, self.oldorigin, self.avelocity); - // engine currently wants this - self.drawmask = MASK_NORMAL; - // link me //setmodel(self, self.model); setorigin(self, self.origin); setsize(self, self.mins, self.maxs); + + // how to draw + // engine currently wants this + if(self.warpzone_fadestart) + self.predraw = WarpZone_Fade_PreDraw; + else + self.drawmask = MASK_NORMAL; } void WarpZone_Camera_Read(float isnew) { + float f; + warpzone_cameras_exist = 1; self.classname = "func_warpzone_camera"; - self.origin_x = ReadCoord(); - self.origin_y = ReadCoord(); - self.origin_z = ReadCoord(); + + f = ReadByte(); + if(f & 4) + { + self.origin_x = ReadCoord(); + self.origin_y = ReadCoord(); + self.origin_z = ReadCoord(); + } + else + self.origin = '0 0 0'; self.modelindex = ReadShort(); self.mins_x = ReadCoord(); self.mins_y = ReadCoord(); @@ -65,6 +111,17 @@ void WarpZone_Camera_Read(float isnew) self.avelocity_y = ReadCoord(); self.avelocity_z = ReadCoord(); + if(f & 2) + { + self.warpzone_fadestart = ReadShort(); + self.warpzone_fadeend = max(self.warpzone_fadestart + 1, ReadShort()); + } + else + { + self.warpzone_fadestart = 0; + self.warpzone_fadeend = 0; + } + // common stuff WarpZone_Camera_SetUp(self, self.oldorigin, self.avelocity); @@ -75,6 +132,30 @@ void WarpZone_Camera_Read(float isnew) //setmodel(self, self.model); setorigin(self, self.origin); setsize(self, self.mins, self.maxs); + + // how to draw + // engine currently wants this + if(self.warpzone_fadestart) + self.predraw = WarpZone_Fade_PreDraw; + else + self.drawmask = MASK_NORMAL; +} + +void CL_RotateMoves(vector ang) = #638; +void WarpZone_Teleported_Read(float isnew) +{ + vector v; + self.classname = "warpzone_teleported"; + v_x = ReadCoord(); + v_y = ReadCoord(); + v_z = ReadCoord(); + if(!isnew) + return; + self.warpzone_transform = v; + R_SetView3fv(VF_CL_VIEWANGLES, WarpZone_TransformVAngles(self, R_SetView3fv(VF_CL_VIEWANGLES))); + if(checkextension("DP_CSQC_ROTATEMOVES")) + CL_RotateMoves(v); + //CL_RotateMoves('0 90 0'); } float warpzone_fixingview; @@ -106,7 +187,6 @@ void WarpZone_Outside() vector WarpZone_FixNearClip(vector o, vector c0, vector c1, vector c2, vector c3) { - float nearclipdistance; vector mi, ma; entity e; float pd; @@ -146,7 +226,7 @@ var float autocvar_cl_rollkillspeed = 10; #endif void WarpZone_FixView() { - float pd, f; + float f; vector o; entity e; vector corner0, corner1, corner2, corner3, nearclip;