X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fwarpzonelib%2Fclient.qc;h=725f84ffbd24a8f09150431c7aa44e1c2f2860d2;hb=d341292a70c9866b19c3c63ea14470415bec0d6f;hp=d084e08084ce854d08b723911a97b63185610937;hpb=f536d182b06173bac130d0e77dfcf25833641504;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/warpzonelib/client.qc b/qcsrc/warpzonelib/client.qc index d084e0808..725f84ffb 100644 --- a/qcsrc/warpzonelib/client.qc +++ b/qcsrc/warpzonelib/client.qc @@ -1,5 +1,20 @@ +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; if not(self.enemy) { @@ -8,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(); @@ -33,25 +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; 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(); @@ -67,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); @@ -77,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;