1 void WarpZone_Read(float isnew)
6 self.enemy.classname = "warpzone_from";
8 self.classname = "trigger_warpzone";
9 self.origin_x = ReadCoord();
10 self.origin_y = ReadCoord();
11 self.origin_z = ReadCoord();
12 self.modelindex = ReadShort();
13 self.mins_x = ReadCoord();
14 self.mins_y = ReadCoord();
15 self.mins_z = ReadCoord();
16 self.maxs_x = ReadCoord();
17 self.maxs_y = ReadCoord();
18 self.maxs_z = ReadCoord();
19 self.scale = ReadByte() / 16;
20 self.enemy.oldorigin_x = ReadCoord();
21 self.enemy.oldorigin_y = ReadCoord();
22 self.enemy.oldorigin_z = ReadCoord();
23 self.enemy.avelocity_x = ReadCoord();
24 self.enemy.avelocity_y = ReadCoord();
25 self.enemy.avelocity_z = ReadCoord();
26 self.oldorigin_x = ReadCoord();
27 self.oldorigin_y = ReadCoord();
28 self.oldorigin_z = ReadCoord();
29 self.avelocity_x = ReadCoord();
30 self.avelocity_y = ReadCoord();
31 self.avelocity_z = ReadCoord();
34 WarpZone_SetUp(self, self.enemy.oldorigin, self.enemy.avelocity, self.oldorigin, self.avelocity);
36 // engine currently wants this
37 self.drawmask = MASK_NORMAL;
40 //setmodel(self, self.model);
41 setorigin(self, self.origin);
42 setsize(self, self.mins, self.maxs);
45 void WarpZone_Camera_Read(float isnew)
47 self.classname = "func_warpzone_camera";
48 self.origin_x = ReadCoord();
49 self.origin_y = ReadCoord();
50 self.origin_z = ReadCoord();
51 self.modelindex = ReadShort();
52 self.mins_x = ReadCoord();
53 self.mins_y = ReadCoord();
54 self.mins_z = ReadCoord();
55 self.maxs_x = ReadCoord();
56 self.maxs_y = ReadCoord();
57 self.maxs_z = ReadCoord();
58 self.scale = ReadByte() / 16;
59 self.oldorigin_x = ReadCoord();
60 self.oldorigin_y = ReadCoord();
61 self.oldorigin_z = ReadCoord();
62 self.avelocity_x = ReadCoord();
63 self.avelocity_y = ReadCoord();
64 self.avelocity_z = ReadCoord();
67 WarpZone_Camera_SetUp(self, self.oldorigin, self.avelocity);
69 // engine currently wants this
70 self.drawmask = MASK_NORMAL;
73 //setmodel(self, self.model);
74 setorigin(self, self.origin);
75 setsize(self, self.mins, self.maxs);
78 float warpzone_fixingview;
79 float warpzone_fixingview_drawexteriormodel;
80 //float warpzone_fixingview_sidespeed;
81 //float warpzone_fixingview_forwardspeed;
82 void WarpZone_Inside()
84 if(warpzone_fixingview)
86 warpzone_fixingview = 1;
87 warpzone_fixingview_drawexteriormodel = cvar("r_drawexteriormodel");
88 //warpzone_fixingview_sidespeed = cvar("cl_sidespeed");
89 //warpzone_fixingview_forwardspeed = cvar("cl_forwardspeed");
90 cvar_set("r_drawexteriormodel", "0");
91 //cvar_set("cl_sidespeed", ftos(warpzone_fixingview_sidespeed / 100)); // just keep a bit of it in case player gets stuck
92 //cvar_set("cl_forwardspeed", ftos(warpzone_fixingview_forwardspeed / 100)); // just keep a bit of it in case player gets stuck
95 void WarpZone_Outside()
97 if(!warpzone_fixingview)
99 warpzone_fixingview = 0;
100 cvar_set("r_drawexteriormodel", ftos(warpzone_fixingview_drawexteriormodel));
101 //cvar_set("cl_sidespeed", ftos(warpzone_fixingview_sidespeed));
102 //cvar_set("cl_forwardspeed", ftos(warpzone_fixingview_forwardspeed));
105 float warpzone_saved;
106 vector warpzone_saved_origin;
107 vector warpzone_saved_angles;
108 vector warpzone_saved_cl_viewangles;
110 var float autocvar_cl_rollkillspeed = 10;
112 void WarpZone_FixView()
117 warpzone_saved_origin = warpzone_fixview_origin;
118 warpzone_saved_angles = warpzone_fixview_angles;
119 warpzone_saved_cl_viewangles = warpzone_fixview_cl_viewangles;
122 if(warpzone_fixview_angles_z != 0 || warpzone_fixview_cl_viewangles_z != 0)
124 if(autocvar_cl_rollkillspeed)
125 f = max(0, (1 - frametime * autocvar_cl_rollkillspeed));
128 warpzone_fixview_angles_z *= f;
129 warpzone_fixview_cl_viewangles_z *= f;
130 warpzone_saved_angles_z *= f; // PERMANENTLY apply that change!
131 warpzone_saved_cl_viewangles_z *= f; // PERMANENTLY apply that change!
133 R_SetView(VF_CL_VIEWANGLES_Z, warpzone_fixview_angles_z);
137 e = WarpZone_Find(warpzone_fixview_origin, warpzone_fixview_origin);
141 warpzone_fixview_origin = WarpZone_TransformOrigin(e, warpzone_fixview_origin);
142 warpzone_fixview_angles = WarpZone_TransformVAngles(e, warpzone_fixview_angles);
143 warpzone_fixview_cl_viewangles = WarpZone_TransformVAngles(e, warpzone_fixview_cl_viewangles);
149 // if we are near any warpzone planes - MOVE AWAY (work around nearclip)
151 e = WarpZone_Find(warpzone_fixview_origin - '1 1 1' * nearclip, warpzone_fixview_origin + '1 1 1' * nearclip);
154 pd = WarpZone_PlaneDist(e, warpzone_fixview_origin);
155 if(pd >= 0 && pd < nearclip)
158 warpzone_fixview_origin = warpzone_fixview_origin + e.warpzone_forward * (nearclip - pd);
162 if(warpzone_saved == 1)
164 R_SetView(VF_ORIGIN, warpzone_fixview_origin);
165 R_SetView(VF_ANGLES, warpzone_fixview_cl_viewangles);
168 void WarpZone_UnFixView()
172 warpzone_fixview_origin = warpzone_saved_origin;
173 warpzone_fixview_angles = warpzone_saved_angles;
174 warpzone_fixview_cl_viewangles = warpzone_saved_cl_viewangles;
175 R_SetView(VF_ORIGIN, warpzone_fixview_origin);
176 R_SetView(VF_ANGLES, warpzone_fixview_angles);
177 R_SetView(VF_CL_VIEWANGLES, warpzone_fixview_cl_viewangles);
185 void WarpZone_Shutdown()