+void WarpZone_Fade_PreDraw()
+{
+ if(self.warpzone_fadestart)
+ self.alpha = (self.warpzone_fadeend - vlen(view_origin - self.origin)) / (self.warpzone_fadeend - self.warpzone_fadestart);
+ else
+ self.alpha = 1;
+ 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)
{
}
self.classname = "trigger_warpzone";
- self.warpzone_isboxy = ReadByte();
+ f = ReadByte();
+ self.warpzone_isboxy = (f & 1);
self.origin_x = ReadCoord();
self.origin_y = ReadCoord();
self.origin_z = ReadCoord();
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";
+
+ f = ReadByte();
self.origin_x = ReadCoord();
self.origin_y = ReadCoord();
self.origin_z = ReadCoord();
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);
//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;
float WarpZone_Send(entity to, float sendflags)
{
+ float f;
WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE);
// we must send this flag for clientside to match properly too
- WriteByte(MSG_ENTITY, self.warpzone_isboxy);
+ f = 0;
+ if(self.warpzone_isboxy)
+ f |= 1;
+ if(self.warpzone_fadestart)
+ f |= 2;
+ WriteByte(MSG_ENTITY, f);
// we need THESE to render the warpzone (and cull properly)...
WriteCoord(MSG_ENTITY, self.origin_x);
WriteCoord(MSG_ENTITY, self.warpzone_targetangles_y);
WriteCoord(MSG_ENTITY, self.warpzone_targetangles_z);
+ if(f & 2)
+ {
+ WriteShort(MSG_ENTITY, self.warpzone_fadestart);
+ WriteShort(MSG_ENTITY, self.warpzone_fadeend);
+ }
+
return TRUE;
}
float WarpZone_Camera_Send(entity to, float sendflags)
{
+ float f;
WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE_CAMERA);
+ if(self.warpzone_fadestart)
+ f |= 2;
+ WriteByte(MSG_ENTITY, f);
+
// we need THESE to render the warpzone (and cull properly)...
WriteCoord(MSG_ENTITY, self.origin_x);
WriteCoord(MSG_ENTITY, self.origin_y);
WriteCoord(MSG_ENTITY, self.enemy.angles_y);
WriteCoord(MSG_ENTITY, self.enemy.angles_z);
+ if(f & 2)
+ {
+ WriteShort(MSG_ENTITY, self.warpzone_fadestart);
+ WriteShort(MSG_ENTITY, self.warpzone_fadeend);
+ }
+
return TRUE;
}