-#if defined(CSQC)
- #include "../dpdefs/csprogsdefs.qh"
- #include "defs.qh"
- #include "../common/constants.qh"
- #include "../common/stats.qh"
- #include "../warpzonelib/mathlib.qh"
- #include "../warpzonelib/common.qh"
- #include "../warpzonelib/client.qh"
- #include "../common/teams.qh"
- #include "../common/util.qh"
- #include "../common/nades.qh"
- #include "../common/weapons/weapons.qh"
- #include "../common/mapinfo.qh"
- #include "autocvars.qh"
- #include "hud.qh"
- #include "scoreboard.qh"
- #include "noise.qh"
- #include "main.qh"
- #include "../csqcmodellib/cl_player.qh"
-#elif defined(MENUQC)
-#elif defined(SVQC)
-#endif
+#include "_all.qh"
+
+#include "announcer.qh"
+#include "hook.qh"
+#include "hud.qh"
+#include "hud_config.qh"
+#include "mapvoting.qh"
+#include "noise.qh"
+#include "scoreboard.qh"
+#include "shownames.qh"
+#include "vehicles/all.qh"
+#include "waypointsprites.qh"
+
+#include "../common/constants.qh"
+#include "../common/mapinfo.qh"
+#include "../common/nades.qh"
+#include "../common/stats.qh"
+#include "../common/triggers/target/music.qh"
+#include "../common/teams.qh"
+#include "../common/util.qh"
+
+#include "../common/weapons/all.qh"
+
+#include "../csqcmodellib/cl_player.qh"
+
+#include "../warpzonelib/client.qh"
+#include "../warpzonelib/common.qh"
+#include "../warpzonelib/mathlib.qh"
entity porto;
vector polyline[16];
portal_number = 0;
nextdir = dir;
- for(0;;)
+ for (;;)
{
dir = nextdir;
traceline(p, p + 65536 * dir, true, porto);
continue;
++portal_number;
ang = vectoangles2(trace_plane_normal, dir);
- ang_x = -ang.x;
+ ang.x = -ang.x;
makevectors(ang);
if(!CheckWireframeBox(porto, p - 48 * v_right - 48 * v_up + 16 * v_forward, 96 * v_right, 96 * v_up, 96 * v_forward))
return;
zoomsensitivity = autocvar_cl_zoomsensitivity;
zoomfactor = autocvar_cl_zoomfactor;
- if(zoomfactor < 1 || zoomfactor > 16)
+ if(zoomfactor < 1 || zoomfactor > 30)
zoomfactor = 2.5;
zoomspeed = autocvar_cl_zoomspeed;
if(zoomspeed >= 0)
}
else if(autocvar_cl_spawnzoom && zoomin_effect)
{
- float spawnzoomfactor = bound(1, autocvar_cl_spawnzoom_factor, 16);
+ float spawnzoomfactor = bound(1, autocvar_cl_spawnzoom_factor, 30);
current_viewzoom += (autocvar_cl_spawnzoom_speed * (spawnzoomfactor - current_viewzoom) * drawframetime);
current_viewzoom = bound(1 / spawnzoomfactor, current_viewzoom, 1);
return '1 0 0' * fovx + '0 1 0' * fovy;
}
+vector GetViewLocationFOV(float fov)
+{
+ float frustumy = tan(fov * M_PI / 360.0) * 0.75;
+ float frustumx = frustumy * vid_width / vid_height / vid_pixelheight;
+ float fovx = atan2(frustumx, 1) / M_PI * 360.0;
+ float fovy = atan2(frustumy, 1) / M_PI * 360.0;
+ return '1 0 0' * fovx + '0 1 0' * fovy;
+}
+
vector GetOrthoviewFOV(vector ov_worldmin, vector ov_worldmax, vector ov_mid, vector ov_org)
{
float fovx, fovy;
{
float t, n;
wcross_origin = project_3d_to_2d(trace_endpos);
- wcross_origin_z = 0;
+ wcross_origin.z = 0;
if(trace_ent)
n = trace_ent.entnum;
else
trueaimpoint = traceorigin + view_forward * g_trueaim_minrange;
if(vecs.x > 0)
- vecs_y = -vecs.y;
+ vecs.y = -vecs.y;
else
vecs = '0 0 0';
float eventchase_current_distance;
float eventchase_running;
-float WantEventchase()
+bool WantEventchase()
{
if(autocvar_cl_orthoview)
return false;
if(intermission)
return true;
+ if(self.viewloc)
+ return true;
if(spectatee_status >= 0)
{
if(autocvar_cl_eventchase_nexball && gametype == MAPINFO_TYPE_NEXBALL && !(WepSet_GetFromStat() & WepSet_FromWeapon(WEP_PORTO)))
if(getstati(STAT_FROZEN))
drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, ((getstatf(STAT_REVIVE_PROGRESS)) ? ('0.25 0.90 1' + ('1 0 0' * getstatf(STAT_REVIVE_PROGRESS)) + ('0 1 1' * getstatf(STAT_REVIVE_PROGRESS) * -1)) : '0.25 0.90 1'), autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
else if (getstatf(STAT_HEALING_ORB)>time)
- drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, Nade_Color(NADE_TYPE_HEAL), autocvar_hud_colorflash_alpha*getstatf(STAT_HEALING_ORB_ALPHA), DRAWFLAG_ADDITIVE);
+ drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, NADE_TYPE_HEAL.m_color, autocvar_hud_colorflash_alpha*getstatf(STAT_HEALING_ORB_ALPHA), DRAWFLAG_ADDITIVE);
if(!intermission)
if(getstatf(STAT_NADE_TIMER) && autocvar_cl_nade_timer) // give nade top priority, as it's a matter of life and death
{
CSQC_common_hud();
// crosshair goes VERY LAST
- if(!scoreboard_active && !camera_active && intermission != 2 && spectatee_status != -1 && hud == HUD_NORMAL)
+ if(!scoreboard_active && !camera_active && intermission != 2 && spectatee_status != -1 && hud == HUD_NORMAL && !csqcplayer.viewloc)
{
if (!autocvar_crosshair_enabled) // main toggle for crosshair rendering
return;
// wcross_origin = '0.5 0 0' * vid_conwidth + '0 0.5 0' * vid_conheight;
wcross_origin = project_3d_to_2d(view_origin + MAX_SHOT_DISTANCE * view_forward);
- wcross_origin_z = 0;
+ wcross_origin.z = 0;
if(autocvar_crosshair_hittest)
{
vector wcross_oldorigin;
//y = green
//z = blue
- wcross_color_z = 0;
+ wcross_color.z = 0;
if(x > 200)
{
- wcross_color_x = 0;
- wcross_color_y = 1;
+ wcross_color.x = 0;
+ wcross_color.y = 1;
}
else if(x > 150)
{
- wcross_color_x = 0.4 - (x-150)*0.02 * 0.4;
- wcross_color_y = 0.9 + (x-150)*0.02 * 0.1;
+ wcross_color.x = 0.4 - (x-150)*0.02 * 0.4;
+ wcross_color.y = 0.9 + (x-150)*0.02 * 0.1;
}
else if(x > 100)
{
- wcross_color_x = 1 - (x-100)*0.02 * 0.6;
- wcross_color_y = 1 - (x-100)*0.02 * 0.1;
- wcross_color_z = 1 - (x-100)*0.02;
+ wcross_color.x = 1 - (x-100)*0.02 * 0.6;
+ wcross_color.y = 1 - (x-100)*0.02 * 0.1;
+ wcross_color.z = 1 - (x-100)*0.02;
}
else if(x > 50)
{
- wcross_color_x = 1;
- wcross_color_y = 1;
- wcross_color_z = 0.2 + (x-50)*0.02 * 0.8;
+ wcross_color.x = 1;
+ wcross_color.y = 1;
+ wcross_color.z = 0.2 + (x-50)*0.02 * 0.8;
}
else if(x > 20)
{
- wcross_color_x = 1;
- wcross_color_y = (x-20)*90/27/100;
- wcross_color_z = (x-20)*90/27/100 * 0.2;
+ wcross_color.x = 1;
+ wcross_color.y = (x-20)*90/27/100;
+ wcross_color.z = (x-20)*90/27/100 * 0.2;
}
else
{
- wcross_color_x = 1;
- wcross_color_y = 0;
+ wcross_color.x = 1;
+ wcross_color.y = 0;
}
break;
}
wcross_alpha_goal_prev = wcross_alpha;
wcross_color_goal_prev = wcross_color;
- if(shottype == SHOTTYPE_HITTEAM || (shottype == SHOTTYPE_HITOBSTRUCTION && autocvar_crosshair_hittest_blur && !autocvar_chase_active))
+ if(spectatee_status == -1 && shottype == SHOTTYPE_HITTEAM || (shottype == SHOTTYPE_HITOBSTRUCTION && autocvar_crosshair_hittest_blur && !autocvar_chase_active))
{
wcross_blur = 1;
wcross_alpha *= 0.75;
}
}
-const float BUTTON_3 = 4;
-const float BUTTON_4 = 8;
+const int BUTTON_3 = 4;
+const int BUTTON_4 = 8;
float cl_notice_run();
float prev_myteam;
void CSQC_UpdateView(float w, float h)
CSQCPlayer_SetCamera();
- myteam = GetPlayerColor(player_localentnum - 1);
+ if(player_localentnum <= maxclients) // is it a client?
+ current_player = player_localentnum - 1;
+ else // then player_localentnum is the vehicle I'm driving
+ current_player = player_localnum;
+ myteam = GetPlayerColor(current_player);
if(myteam != prev_myteam)
{
WarpZone_TraceBox(current_view_origin, autocvar_cl_eventchase_mins, autocvar_cl_eventchase_maxs, eventchase_target_origin, MOVE_WORLDONLY, self);
// If the boxtrace fails, revert back to line tracing.
+ if(!self.viewloc)
if(trace_startsolid)
{
eventchase_target_origin = (current_view_origin - (v_forward * eventchase_current_distance));
}
else { setproperty(VF_ORIGIN, trace_endpos); }
- setproperty(VF_ANGLES, WarpZone_TransformVAngles(WarpZone_trace_transform, view_angles));
+ if(!self.viewloc)
+ setproperty(VF_ANGLES, WarpZone_TransformVAngles(WarpZone_trace_transform, view_angles));
}
else if(autocvar_chase_active < 0) // time to disable chase_active if it was set by this code
{
vid_pixelheight = autocvar_vid_pixelheight;
if(autocvar_cl_orthoview) { setproperty(VF_FOV, GetOrthoviewFOV(ov_worldmin, ov_worldmax, ov_mid, ov_org)); }
+ else if(csqcplayer.viewloc) { setproperty(VF_FOV, GetViewLocationFOV(110)); } // enforce 110 fov, so things dont look odd
else { setproperty(VF_FOV, GetCurrentFov(fov)); }
// Camera for demo playback
}
}
else
+ {
#ifdef CAMERATEST
- if(autocvar_camera_enable)
+ if(autocvar_camera_enable)
#else
- if(autocvar_camera_enable && isdemo())
+ if(autocvar_camera_enable && isdemo())
#endif
- {
- // Enable required Darkplaces cvars
- chase_active_backup = autocvar_chase_active;
- cvar_set("chase_active", "2");
- cvar_set("cl_demo_mousegrab", "1");
- camera_active = true;
- camera_mode = false;
+ {
+ // Enable required Darkplaces cvars
+ chase_active_backup = autocvar_chase_active;
+ cvar_set("chase_active", "2");
+ cvar_set("cl_demo_mousegrab", "1");
+ camera_active = true;
+ camera_mode = false;
+ }
}
// Draw the Crosshair
{
if(autocvar_cl_reticle_stretch)
{
- reticle_size_x = vid_conwidth;
- reticle_size_y = vid_conheight;
- reticle_pos_x = 0;
- reticle_pos_y = 0;
+ reticle_size.x = vid_conwidth;
+ reticle_size.y = vid_conheight;
+ reticle_pos.x = 0;
+ reticle_pos.y = 0;
}
else
{
- reticle_size_x = max(vid_conwidth, vid_conheight);
- reticle_size_y = max(vid_conwidth, vid_conheight);
- reticle_pos_x = (vid_conwidth - reticle_size.x) / 2;
- reticle_pos_y = (vid_conheight - reticle_size.y) / 2;
+ reticle_size.x = max(vid_conwidth, vid_conheight);
+ reticle_size.y = max(vid_conwidth, vid_conheight);
+ reticle_pos.x = (vid_conwidth - reticle_size.x) / 2;
+ reticle_pos.y = (vid_conheight - reticle_size.y) / 2;
}
if(zoomscript_caught)
f = 1;
- else
+ else
f = current_zoomfraction;
if(f)
{
if(autocvar_hud_contents_blur && contentavgalpha)
{
- content_blurpostprocess_x = 1;
- content_blurpostprocess_y = contentavgalpha * autocvar_hud_contents_blur;
- content_blurpostprocess_z = contentavgalpha * autocvar_hud_contents_blur_alpha;
+ content_blurpostprocess.x = 1;
+ content_blurpostprocess.y = contentavgalpha * autocvar_hud_contents_blur;
+ content_blurpostprocess.z = contentavgalpha * autocvar_hud_contents_blur_alpha;
}
else
{
- content_blurpostprocess_x = 0;
- content_blurpostprocess_y = 0;
- content_blurpostprocess_z = 0;
+ content_blurpostprocess.x = 0;
+ content_blurpostprocess.y = 0;
+ content_blurpostprocess.z = 0;
}
}
}
if(autocvar_hud_damage && !getstati(STAT_FROZEN))
{
- splash_size_x = max(vid_conwidth, vid_conheight);
- splash_size_y = max(vid_conwidth, vid_conheight);
- splash_pos_x = (vid_conwidth - splash_size.x) / 2;
- splash_pos_y = (vid_conheight - splash_size.y) / 2;
+ splash_size.x = max(vid_conwidth, vid_conheight);
+ splash_size.y = max(vid_conwidth, vid_conheight);
+ splash_pos.x = (vid_conwidth - splash_size.x) / 2;
+ splash_pos.y = (vid_conheight - splash_size.y) / 2;
float myhealth_flash_temp;
myhealth = getstati(STAT_HEALTH);
{
if(autocvar_hud_damage_blur && myhealth_flash_temp)
{
- damage_blurpostprocess_x = 1;
- damage_blurpostprocess_y = bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage_blur;
- damage_blurpostprocess_z = bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage_blur_alpha;
+ damage_blurpostprocess.x = 1;
+ damage_blurpostprocess.y = bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage_blur;
+ damage_blurpostprocess.z = bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage_blur_alpha;
}
else
{
- damage_blurpostprocess_x = 0;
- damage_blurpostprocess_y = 0;
- damage_blurpostprocess_z = 0;
+ damage_blurpostprocess.x = 0;
+ damage_blurpostprocess.y = 0;
+ damage_blurpostprocess.z = 0;
}
}
}
HUD_Main(); // always run these functions for alpha checks
HUD_DrawScoreboard();
- if (scoreboard_active) // scoreboard/accuracy
+ // scoreboard/accuracy, map/gametype voting screen
+ if (scoreboard_active || intermission == 2)
HUD_Reset();
- else if (intermission == 2) // map voting screen
- {
- MapVote_Draw();
- HUD_Reset();
- }
}
dir = normalize(view_origin - current_position);
n = mouse_angles.z;
mouse_angles = vectoangles(dir);
- mouse_angles_x = mouse_angles.x * -1;
- mouse_angles_z = n;
+ mouse_angles.x = mouse_angles.x * -1;
+ mouse_angles.z = n;
}
else
{
}
}
- while (mouse_angles.x < -180) mouse_angles_x = mouse_angles.x + 360;
- while (mouse_angles.x > 180) mouse_angles_x = mouse_angles.x - 360;
- while (mouse_angles.y < -180) mouse_angles_y = mouse_angles.y + 360;
- while (mouse_angles.y > 180) mouse_angles_y = mouse_angles.y - 360;
+ while (mouse_angles.x < -180) mouse_angles.x = mouse_angles.x + 360;
+ while (mouse_angles.x > 180) mouse_angles.x = mouse_angles.x - 360;
+ while (mouse_angles.y < -180) mouse_angles.y = mouse_angles.y + 360;
+ while (mouse_angles.y > 180) mouse_angles.y = mouse_angles.y - 360;
// Fix difference when angles don't have the same sign
delta = '0 0 0';
attenuation = 1 / max(1, attenuation);
current_angles += (mouse_angles - current_angles + delta) * attenuation;
- while (current_angles.x < -180) current_angles_x = current_angles.x + 360;
- while (current_angles.x > 180) current_angles_x = current_angles.x - 360;
- while (current_angles.y < -180) current_angles_y = current_angles.y + 360;
- while (current_angles.y > 180) current_angles_y = current_angles.y - 360;
+ while (current_angles.x < -180) current_angles.x = current_angles.x + 360;
+ while (current_angles.x > 180) current_angles.x = current_angles.x - 360;
+ while (current_angles.y < -180) current_angles.y = current_angles.y + 360;
+ while (current_angles.y > 180) current_angles.y = current_angles.y - 360;
// Camera position
tmp = '0 0 0';
if( camera_direction.x )
{
- tmp_x = camera_direction.x * cos(current_angles.y * DEG2RAD);
- tmp_y = camera_direction.x * sin(current_angles.y * DEG2RAD);
+ tmp.x = camera_direction.x * cos(current_angles.y * DEG2RAD);
+ tmp.y = camera_direction.x * sin(current_angles.y * DEG2RAD);
if( autocvar_camera_forward_follows && !autocvar_camera_look_player )
- tmp_z = camera_direction.x * -sin(current_angles.x * DEG2RAD);
+ tmp.z = camera_direction.x * -sin(current_angles.x * DEG2RAD);
++dimensions;
}