X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fwarpzonelib%2Fclient.qc;h=f02fa4a30266d097b9c595d413829300999eeb4d;hb=4fc59bbd7e2d4f25ba21952ed50ae754295a7faa;hp=3c3eaf5a3dacda1350719773fe293690f8f8e1c5;hpb=a93f3917dce3a007d9b15822c1c462d15290e2c3;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/warpzonelib/client.qc b/qcsrc/warpzonelib/client.qc index 3c3eaf5a3..f02fa4a30 100644 --- a/qcsrc/warpzonelib/client.qc +++ b/qcsrc/warpzonelib/client.qc @@ -1,14 +1,38 @@ +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(); self.enemy.classname = "warpzone_from"; } self.classname = "trigger_warpzone"; - 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(); @@ -30,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(); @@ -63,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); @@ -73,6 +132,13 @@ 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; } float warpzone_fixingview; @@ -104,7 +170,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; @@ -144,7 +209,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;