From 6c4f62990980e74d4a0963b7179c7c964f535398 Mon Sep 17 00:00:00 2001 From: TimePath Date: Sun, 25 Jan 2015 22:27:23 +1100 Subject: [PATCH] Replace `vector_[xyz]` with `vector.[xyz]` where possible --- qcsrc/client/View.qc | 138 +-- qcsrc/client/casings.qc | 2 +- qcsrc/client/command/cl_cmd.qc | 28 +- qcsrc/client/csqcmodel_hooks.qc | 6 +- qcsrc/client/effects.qc | 2 +- qcsrc/client/hook.qc | 4 +- qcsrc/client/hud.qc | 835 +++++++++--------- qcsrc/client/hud_config.qc | 336 +++---- qcsrc/client/mapvoting.qc | 86 +- qcsrc/client/miscfunctions.qc | 136 +-- qcsrc/client/movetypes.qc | 42 +- qcsrc/client/particles.qc | 8 +- qcsrc/client/player_skeleton.qc | 2 +- qcsrc/client/scoreboard.qc | 182 ++-- qcsrc/client/shownames.qc | 28 +- qcsrc/client/teamradar.qc | 38 +- qcsrc/client/tturrets.qc | 36 +- qcsrc/client/vehicles/vehicles.qc | 126 +-- qcsrc/client/waypointsprites.qc | 92 +- qcsrc/client/weapons/projectile.qc | 4 +- qcsrc/common/animdecide.qc | 92 +- qcsrc/common/constants.qh | 16 +- qcsrc/common/mapinfo.qc | 12 +- qcsrc/common/monsters/monster/shambler.qc | 2 +- qcsrc/common/monsters/sv_monsters.qc | 20 +- qcsrc/common/nades.qc | 8 +- qcsrc/common/util.qc | 214 ++--- qcsrc/common/weapons/calculations.qc | 8 +- qcsrc/common/weapons/w_arc.qc | 26 +- qcsrc/common/weapons/w_crylink.qc | 12 +- qcsrc/common/weapons/w_devastator.qc | 6 +- qcsrc/common/weapons/w_fireball.qc | 10 +- qcsrc/common/weapons/w_hagar.qc | 6 +- qcsrc/common/weapons/w_shockwave.qc | 30 +- qcsrc/common/weapons/w_tuba.qc | 22 +- qcsrc/common/weapons/w_vortex.qc | 12 +- qcsrc/common/weapons/weapons.qc | 2 +- qcsrc/csqcmodellib/cl_player.qc | 2 +- qcsrc/csqcmodellib/interpolate.qc | 2 +- qcsrc/dpdefs/csprogsdefs.qc | 2 +- qcsrc/dpdefs/dpextensions.qc | 2 +- qcsrc/menu/draw.qc | 94 +- qcsrc/menu/draw.qh | 3 - qcsrc/menu/item/borderimage.qc | 10 +- qcsrc/menu/item/button.qc | 12 +- qcsrc/menu/item/container.qc | 20 +- qcsrc/menu/item/dialog.qc | 12 +- qcsrc/menu/item/image.qc | 70 +- qcsrc/menu/item/inputbox.qc | 26 +- qcsrc/menu/item/inputcontainer.qc | 8 +- qcsrc/menu/item/label.qc | 20 +- qcsrc/menu/item/listbox.qc | 40 +- qcsrc/menu/item/modalcontroller.qc | 4 +- qcsrc/menu/item/nexposee.qc | 24 +- qcsrc/menu/item/slider.qc | 30 +- qcsrc/menu/menu.qc | 60 +- qcsrc/menu/xonotic/campaign.qc | 24 +- qcsrc/menu/xonotic/charmap.qc | 48 +- qcsrc/menu/xonotic/colorpicker.qc | 38 +- qcsrc/menu/xonotic/colorpicker_string.qc | 14 +- qcsrc/menu/xonotic/credits.qc | 6 +- qcsrc/menu/xonotic/crosshairbutton.qc | 6 +- qcsrc/menu/xonotic/cvarlist.qc | 12 +- qcsrc/menu/xonotic/demolist.qc | 10 +- qcsrc/menu/xonotic/gametypelist.qc | 16 +- qcsrc/menu/xonotic/keybinder.qc | 14 +- qcsrc/menu/xonotic/languagelist.qc | 16 +- qcsrc/menu/xonotic/listbox.qc | 2 +- qcsrc/menu/xonotic/maplist.qc | 28 +- qcsrc/menu/xonotic/playerlist.qc | 14 +- qcsrc/menu/xonotic/playermodel.qc | 8 +- qcsrc/menu/xonotic/playlist.qc | 12 +- qcsrc/menu/xonotic/screenshotimage.qc | 4 +- qcsrc/menu/xonotic/screenshotlist.qc | 12 +- qcsrc/menu/xonotic/serverlist.qc | 50 +- qcsrc/menu/xonotic/skinlist.qc | 14 +- qcsrc/menu/xonotic/slider_resolution.qc | 34 +- qcsrc/menu/xonotic/soundlist.qc | 10 +- qcsrc/menu/xonotic/statslist.qc | 16 +- qcsrc/menu/xonotic/util.qc | 18 +- qcsrc/menu/xonotic/weaponslist.qc | 10 +- qcsrc/server/bot/aim.qc | 38 +- qcsrc/server/bot/havocbot/havocbot.qc | 86 +- qcsrc/server/bot/navigation.qc | 36 +- qcsrc/server/bot/scripting.qc | 12 +- qcsrc/server/bot/waypoints.qc | 12 +- qcsrc/server/cheats.qc | 42 +- qcsrc/server/cl_client.qc | 28 +- qcsrc/server/cl_physics.qc | 130 +-- qcsrc/server/cl_player.qc | 18 +- qcsrc/server/command/radarmap.qc | 84 +- qcsrc/server/command/sv_cmd.qc | 114 +-- qcsrc/server/csqceffects.qc | 12 +- qcsrc/server/ent_cs.qc | 10 +- qcsrc/server/func_breakable.qc | 24 +- qcsrc/server/g_casings.qc | 16 +- qcsrc/server/g_damage.qc | 26 +- qcsrc/server/g_hook.qc | 18 +- qcsrc/server/g_models.qc | 38 +- qcsrc/server/g_subs.qc | 46 +- qcsrc/server/g_tetris.qc | 128 +-- qcsrc/server/g_triggers.qc | 66 +- qcsrc/server/g_violence.qc | 8 +- qcsrc/server/g_world.qc | 6 +- qcsrc/server/miscfunctions.qc | 98 +- qcsrc/server/movelib.qc | 22 +- qcsrc/server/mutators/gamemode_ctf.qc | 8 +- qcsrc/server/mutators/gamemode_cts.qc | 18 +- qcsrc/server/mutators/gamemode_keyhunt.qc | 10 +- qcsrc/server/mutators/gamemode_nexball.qc | 34 +- qcsrc/server/mutators/gamemode_onslaught.qc | 60 +- qcsrc/server/mutators/gamemode_race.qc | 18 +- qcsrc/server/mutators/mutator_buffs.qc | 8 +- qcsrc/server/mutators/mutator_dodging.qc | 35 +- qcsrc/server/mutators/mutator_multijump.qc | 14 +- qcsrc/server/mutators/mutator_nades.qc | 12 +- .../mutators/mutator_spawn_near_teammate.qc | 6 +- qcsrc/server/mutators/mutator_touchexplode.qc | 2 +- qcsrc/server/mutators/sandbox.qc | 2 +- qcsrc/server/pathlib.qc | 66 +- qcsrc/server/pathlib/costs.qc | 24 +- qcsrc/server/pathlib/expandnode.qc | 6 +- qcsrc/server/pathlib/main.qc | 8 +- qcsrc/server/pathlib/movenode.qc | 28 +- qcsrc/server/pathlib/utility.qc | 10 +- qcsrc/server/portals.qc | 28 +- qcsrc/server/race.qc | 6 +- qcsrc/server/scores.qc | 6 +- qcsrc/server/spawnpoints.qc | 24 +- qcsrc/server/steerlib.qc | 10 +- qcsrc/server/sv_main.qc | 26 +- qcsrc/server/t_items.qc | 30 +- qcsrc/server/t_jumppads.qc | 18 +- qcsrc/server/t_plats.qc | 80 +- qcsrc/server/t_teleporters.qc | 16 +- qcsrc/server/target_music.qc | 24 +- qcsrc/server/target_spawn.qc | 6 +- .../server/tturrets/system/system_aimprocs.qc | 6 +- qcsrc/server/tturrets/system/system_damage.qc | 4 +- qcsrc/server/tturrets/system/system_main.qc | 78 +- qcsrc/server/tturrets/system/system_misc.qc | 16 +- qcsrc/server/tturrets/units/unit_ewheel.qc | 12 +- qcsrc/server/tturrets/units/unit_hk.qc | 4 +- qcsrc/server/tturrets/units/unit_walker.qc | 12 +- qcsrc/server/vehicles/bumblebee.qc | 76 +- qcsrc/server/vehicles/racer.qc | 36 +- qcsrc/server/vehicles/raptor.qc | 68 +- qcsrc/server/vehicles/spiderbot.qc | 60 +- qcsrc/server/vehicles/vehicles.qc | 30 +- qcsrc/server/waypointsprites.qc | 12 +- qcsrc/server/weapons/csqcprojectile.qc | 12 +- qcsrc/server/weapons/hitplot.qc | 18 +- qcsrc/server/weapons/selection.qc | 2 +- qcsrc/server/weapons/tracing.qc | 14 +- qcsrc/server/weapons/weaponstats.qc | 2 +- qcsrc/server/weapons/weaponsystem.qc | 8 +- qcsrc/warpzonelib/anglestransform.qc | 76 +- qcsrc/warpzonelib/client.qc | 14 +- qcsrc/warpzonelib/common.qc | 10 +- qcsrc/warpzonelib/mathlib.qc | 12 +- qcsrc/warpzonelib/server.qc | 96 +- 161 files changed, 2969 insertions(+), 2976 deletions(-) diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index 59382a80e..b87cef402 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -47,7 +47,7 @@ void Porto_Draw() 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; @@ -202,8 +202,8 @@ vector GetCurrentFov(float fov) vector GetOrthoviewFOV(vector ov_worldmin, vector ov_worldmax, vector ov_mid, vector ov_org) { float fovx, fovy; - float width = (ov_worldmax_x - ov_worldmin_x); - float height = (ov_worldmax_y - ov_worldmin_y); + float width = (ov_worldmax.x - ov_worldmin.x); + float height = (ov_worldmax.y - ov_worldmin.y); float distance_to_middle_of_world = vlen(ov_mid - ov_org); fovx = atan2(width/2, distance_to_middle_of_world) / M_PI * 360.0; fovy = atan2(height/2, distance_to_middle_of_world) / M_PI * 360.0; @@ -328,16 +328,16 @@ float TrueAimCheck() if(vlen(trueaimpoint - traceorigin) < g_trueaim_minrange) trueaimpoint = traceorigin + view_forward * g_trueaim_minrange; - if(vecs_x > 0) - vecs_y = -vecs_y; + if(vecs.x > 0) + vecs_y = -vecs.y; else vecs = '0 0 0'; - dv = view_right * vecs_y + view_up * vecs_z; + dv = view_right * vecs.y + view_up * vecs.z; w_shotorg = traceorigin + dv; // now move the vecs forward as much as requested if possible - tracebox(w_shotorg, mi, ma, w_shotorg + view_forward * (vecs_x + nudge), MOVE_NORMAL, ta); // FIXME this MOVE_NORMAL part will misbehave a little in csqc + tracebox(w_shotorg, mi, ma, w_shotorg + view_forward * (vecs.x + nudge), MOVE_NORMAL, ta); // FIXME this MOVE_NORMAL part will misbehave a little in csqc w_shotorg = trace_endpos - view_forward * nudge; tracebox(w_shotorg, mi, ma, trueaimpoint, MOVE_NORMAL, ta); @@ -552,8 +552,8 @@ void UpdateCrosshair() if(shottype == SHOTTYPE_HITWORLD) { v = wcross_origin - wcross_oldorigin; - v_x /= vid_conwidth; - v_y /= vid_conheight; + v.x /= vid_conwidth; + v.y /= vid_conheight; if(vlen(v) > 0.01) shottype = SHOTTYPE_HITOBSTRUCTION; } @@ -708,9 +708,9 @@ void UpdateCrosshair() hitindication_crosshair_size = 0; wcross_scale += sin(hitindication_crosshair_size) * autocvar_crosshair_hitindication; - wcross_color_x += sin(hitindication_crosshair_size) * hitindication_color_x; - wcross_color_y += sin(hitindication_crosshair_size) * hitindication_color_y; - wcross_color_z += sin(hitindication_crosshair_size) * hitindication_color_z; + wcross_color.x += sin(hitindication_crosshair_size) * hitindication_color.x; + wcross_color.y += sin(hitindication_crosshair_size) * hitindication_color.y; + wcross_color.z += sin(hitindication_crosshair_size) * hitindication_color.z; } if(shottype == SHOTTYPE_HITENEMY) @@ -883,10 +883,10 @@ void UpdateCrosshair() } if (autocvar_crosshair_ring_inner && ring_inner_value) // lets draw a ring inside a ring so you can ring while you ring - DrawCircleClippedPic(wcross_origin, wcross_size_x * ring_scale, ring_inner_image, ring_inner_value, ring_inner_rgb, wcross_alpha * ring_inner_alpha, DRAWFLAG_ADDITIVE); + DrawCircleClippedPic(wcross_origin, wcross_size.x * ring_scale, ring_inner_image, ring_inner_value, ring_inner_rgb, wcross_alpha * ring_inner_alpha, DRAWFLAG_ADDITIVE); if (ring_value) - DrawCircleClippedPic(wcross_origin, wcross_size_x * ring_scale, ring_image, ring_value, ring_rgb, wcross_alpha * ring_alpha, DRAWFLAG_ADDITIVE); + DrawCircleClippedPic(wcross_origin, wcross_size.x * ring_scale, ring_image, ring_value, ring_rgb, wcross_alpha * ring_alpha, DRAWFLAG_ADDITIVE); } #define CROSSHAIR_DO_BLUR(M,sz,wcross_name,wcross_alpha) \ @@ -906,7 +906,7 @@ void UpdateCrosshair() while(0) #define CROSSHAIR_DRAW_SINGLE(i,j,sz,wcross_name,wcross_alpha) \ - drawpic(wcross_origin - ('0.5 0 0' * (sz * wcross_size_x + i * wcross_blur) + '0 0.5 0' * (sz * wcross_size_y + j * wcross_blur)), wcross_name, sz * wcross_size, wcross_color, wcross_alpha, DRAWFLAG_NORMAL) + drawpic(wcross_origin - ('0.5 0 0' * (sz * wcross_size.x + i * wcross_blur) + '0 0.5 0' * (sz * wcross_size.y + j * wcross_blur)), wcross_name, sz * wcross_size, wcross_color, wcross_alpha, DRAWFLAG_NORMAL) #define CROSSHAIR_DRAW(sz,wcross_name,wcross_alpha) \ CROSSHAIR_DO_BLUR(CROSSHAIR_DRAW_SINGLE,sz,wcross_name,wcross_alpha) @@ -1008,8 +1008,8 @@ void CSQC_UpdateView(float w, float h) vf_size = getpropertyvec(VF_SIZE); vf_min = getpropertyvec(VF_MIN); - vid_width = vf_size_x; - vid_height = vf_size_y; + vid_width = vf_size.x; + vid_height = vf_size.y; vector reticle_pos = '0 0 0', reticle_size = '0 0 0'; vector splash_pos = '0 0 0', splash_size = '0 0 0'; @@ -1061,9 +1061,9 @@ void CSQC_UpdateView(float w, float h) // detect maximum viewoffset and use it if(autocvar_cl_eventchase_viewoffset) { - WarpZone_TraceLine(current_view_origin, current_view_origin + autocvar_cl_eventchase_viewoffset + ('0 0 1' * autocvar_cl_eventchase_maxs_z), MOVE_WORLDONLY, self); + WarpZone_TraceLine(current_view_origin, current_view_origin + autocvar_cl_eventchase_viewoffset + ('0 0 1' * autocvar_cl_eventchase_maxs.z), MOVE_WORLDONLY, self); if(trace_fraction == 1) { current_view_origin += autocvar_cl_eventchase_viewoffset; } - else { current_view_origin_z += max(0, (trace_endpos_z - current_view_origin_z) - autocvar_cl_eventchase_maxs_z); } + else { current_view_origin.z += max(0, (trace_endpos.z - current_view_origin.z) - autocvar_cl_eventchase_maxs.z); } } // We must enable chase_active to get a third person view (weapon viewmodel hidden and own player model showing). @@ -1087,7 +1087,7 @@ void CSQC_UpdateView(float w, float h) { eventchase_target_origin = (current_view_origin - (v_forward * eventchase_current_distance)); WarpZone_TraceLine(current_view_origin, eventchase_target_origin, MOVE_WORLDONLY, self); - setproperty(VF_ORIGIN, (trace_endpos - (v_forward * autocvar_cl_eventchase_mins_z))); + setproperty(VF_ORIGIN, (trace_endpos - (v_forward * autocvar_cl_eventchase_mins.z))); } else { setproperty(VF_ORIGIN, trace_endpos); } @@ -1132,30 +1132,30 @@ void CSQC_UpdateView(float w, float h) ov_worldmin = mi_picmin; ov_worldmax = mi_picmax; - float ov_width = (ov_worldmax_x - ov_worldmin_x); - float ov_height = (ov_worldmax_y - ov_worldmin_y); + float ov_width = (ov_worldmax.x - ov_worldmin.x); + float ov_height = (ov_worldmax.y - ov_worldmin.y); float ov_distance = (max(vid_width, vid_height) * max(ov_width, ov_height)); ov_mid = ((ov_worldmax + ov_worldmin) * 0.5); - ov_org = vec3(ov_mid_x, ov_mid_y, (ov_mid_z + ov_distance)); + ov_org = vec3(ov_mid.x, ov_mid.y, (ov_mid.z + ov_distance)); float ov_nearest = vlen(ov_org - vec3( - bound(ov_worldmin_x, ov_org_x, ov_worldmax_x), - bound(ov_worldmin_y, ov_org_y, ov_worldmax_y), - bound(ov_worldmin_z, ov_org_z, ov_worldmax_z) + bound(ov_worldmin.x, ov_org.x, ov_worldmax.x), + bound(ov_worldmin.y, ov_org.y, ov_worldmax.y), + bound(ov_worldmin.z, ov_org.z, ov_worldmax.z) )); float ov_furthest = 0; float dist = 0; - if((dist = vlen(vec3(ov_worldmin_x, ov_worldmin_y, ov_worldmin_z) - ov_org)) > ov_furthest) { ov_furthest = dist; } - if((dist = vlen(vec3(ov_worldmax_x, ov_worldmin_y, ov_worldmin_z) - ov_org)) > ov_furthest) { ov_furthest = dist; } - if((dist = vlen(vec3(ov_worldmin_x, ov_worldmax_y, ov_worldmin_z) - ov_org)) > ov_furthest) { ov_furthest = dist; } - if((dist = vlen(vec3(ov_worldmin_x, ov_worldmin_y, ov_worldmax_z) - ov_org)) > ov_furthest) { ov_furthest = dist; } - if((dist = vlen(vec3(ov_worldmax_x, ov_worldmax_y, ov_worldmin_z) - ov_org)) > ov_furthest) { ov_furthest = dist; } - if((dist = vlen(vec3(ov_worldmin_x, ov_worldmax_y, ov_worldmax_z) - ov_org)) > ov_furthest) { ov_furthest = dist; } - if((dist = vlen(vec3(ov_worldmax_x, ov_worldmin_y, ov_worldmax_z) - ov_org)) > ov_furthest) { ov_furthest = dist; } - if((dist = vlen(vec3(ov_worldmax_x, ov_worldmax_y, ov_worldmax_z) - ov_org)) > ov_furthest) { ov_furthest = dist; } + if((dist = vlen(vec3(ov_worldmin.x, ov_worldmin.y, ov_worldmin.z) - ov_org)) > ov_furthest) { ov_furthest = dist; } + if((dist = vlen(vec3(ov_worldmax.x, ov_worldmin.y, ov_worldmin.z) - ov_org)) > ov_furthest) { ov_furthest = dist; } + if((dist = vlen(vec3(ov_worldmin.x, ov_worldmax.y, ov_worldmin.z) - ov_org)) > ov_furthest) { ov_furthest = dist; } + if((dist = vlen(vec3(ov_worldmin.x, ov_worldmin.y, ov_worldmax.z) - ov_org)) > ov_furthest) { ov_furthest = dist; } + if((dist = vlen(vec3(ov_worldmax.x, ov_worldmax.y, ov_worldmin.z) - ov_org)) > ov_furthest) { ov_furthest = dist; } + if((dist = vlen(vec3(ov_worldmin.x, ov_worldmax.y, ov_worldmax.z) - ov_org)) > ov_furthest) { ov_furthest = dist; } + if((dist = vlen(vec3(ov_worldmax.x, ov_worldmin.y, ov_worldmax.z) - ov_org)) > ov_furthest) { ov_furthest = dist; } + if((dist = vlen(vec3(ov_worldmax.x, ov_worldmax.y, ov_worldmax.z) - ov_org)) > ov_furthest) { ov_furthest = dist; } cvar_settemp("r_nearclip", ftos(ov_nearest)); cvar_settemp("r_farclip_base", ftos(ov_furthest)); @@ -1454,8 +1454,8 @@ void CSQC_UpdateView(float w, float h) { 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_pos_x = (vid_conwidth - reticle_size.x) / 2; + reticle_pos_y = (vid_conheight - reticle_size.y) / 2; } if(zoomscript_caught) @@ -1548,8 +1548,8 @@ void CSQC_UpdateView(float w, float h) { 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_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); @@ -1639,10 +1639,10 @@ void CSQC_UpdateView(float w, float h) if(cvar("r_glsl_postprocess_uservec2_enable") != e2) { cvar_set("r_glsl_postprocess_uservec2_enable", ftos(e2)); } // blur postprocess handling done first (used by hud_damage and hud_contents) - if((damage_blurpostprocess_x || content_blurpostprocess_x)) + if((damage_blurpostprocess.x || content_blurpostprocess.x)) { - float blurradius = bound(0, damage_blurpostprocess_y + content_blurpostprocess_y, autocvar_hud_postprocessing_maxblurradius); - float bluralpha = bound(0, damage_blurpostprocess_z + content_blurpostprocess_z, autocvar_hud_postprocessing_maxbluralpha); + float blurradius = bound(0, damage_blurpostprocess.y + content_blurpostprocess.y, autocvar_hud_postprocessing_maxblurradius); + float bluralpha = bound(0, damage_blurpostprocess.z + content_blurpostprocess.z, autocvar_hud_postprocessing_maxbluralpha); if(blurradius != old_blurradius || bluralpha != old_bluralpha) // reduce cvar_set spam as much as possible { cvar_set("r_glsl_postprocess_uservec1", strcat(ftos(blurradius), " ", ftos(bluralpha), " 0 0")); @@ -1794,9 +1794,9 @@ void CSQC_Demo_Camera() camera_offset = '0 0 0'; current_angles = '0 0 0'; camera_direction = '0 0 0'; - camera_offset_z += 30; - camera_offset_x += 30 * -cos(current_angles_y * DEG2RAD); - camera_offset_y += 30 * -sin(current_angles_y * DEG2RAD); + camera_offset.z += 30; + camera_offset.x += 30 * -cos(current_angles.y * DEG2RAD); + camera_offset.y += 30 * -sin(current_angles.y * DEG2RAD); current_origin = view_origin; current_camera_offset = camera_offset; cvar_set("camera_reset", "0"); @@ -1805,7 +1805,7 @@ void CSQC_Demo_Camera() // Camera angles if( camera_roll ) - mouse_angles_z += camera_roll * autocvar_camera_speed_roll; + mouse_angles.z += camera_roll * autocvar_camera_speed_roll; if(autocvar_camera_look_player) { @@ -1813,9 +1813,9 @@ void CSQC_Demo_Camera() float n; dir = normalize(view_origin - current_position); - n = mouse_angles_z; + n = mouse_angles.z; mouse_angles = vectoangles(dir); - mouse_angles_x = mouse_angles_x * -1; + mouse_angles_x = mouse_angles.x * -1; mouse_angles_z = n; } else @@ -1823,21 +1823,21 @@ void CSQC_Demo_Camera() tmp = getmousepos() * 0.1; if(vlen(tmp)>autocvar_camera_mouse_threshold) { - mouse_angles_x += tmp_y * cos(mouse_angles_z * DEG2RAD) + (tmp_x * sin(mouse_angles_z * DEG2RAD)); - mouse_angles_y -= tmp_x * cos(mouse_angles_z * DEG2RAD) + (tmp_y * -sin(mouse_angles_z * DEG2RAD)); + mouse_angles.x += tmp.y * cos(mouse_angles.z * DEG2RAD) + (tmp.x * sin(mouse_angles.z * DEG2RAD)); + mouse_angles.y -= tmp.x * cos(mouse_angles.z * DEG2RAD) + (tmp.y * -sin(mouse_angles.z * DEG2RAD)); } } - 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'; - if(mouse_angles_y < -60 && current_angles_y > 60) + if(mouse_angles.y < -60 && current_angles.y > 60) delta = '0 360 0'; - if(mouse_angles_y > 60 && current_angles_y < -60) + if(mouse_angles.y > 60 && current_angles.y < -60) delta = '0 -360 0'; if(autocvar_camera_look_player) @@ -1848,35 +1848,35 @@ void CSQC_Demo_Camera() 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'; dimensions = 0; - if( camera_direction_x ) + 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; } - if( camera_direction_y ) + if( camera_direction.y ) { - tmp_x += camera_direction_y * -sin(current_angles_y * DEG2RAD); - tmp_y += camera_direction_y * cos(current_angles_y * DEG2RAD) * cos(current_angles_z * DEG2RAD); - tmp_z += camera_direction_y * sin(current_angles_z * DEG2RAD); + tmp.x += camera_direction.y * -sin(current_angles.y * DEG2RAD); + tmp.y += camera_direction.y * cos(current_angles.y * DEG2RAD) * cos(current_angles.z * DEG2RAD); + tmp.z += camera_direction.y * sin(current_angles.z * DEG2RAD); ++dimensions; } - if( camera_direction_z ) + if( camera_direction.z ) { - tmp_z += camera_direction_z * cos(current_angles_z * DEG2RAD); + tmp.z += camera_direction.z * cos(current_angles.z * DEG2RAD); ++dimensions; } diff --git a/qcsrc/client/casings.qc b/qcsrc/client/casings.qc index 02e06001e..d97e99557 100644 --- a/qcsrc/client/casings.qc +++ b/qcsrc/client/casings.qc @@ -66,7 +66,7 @@ void Casing_Touch() void Casing_Damage(float thisdmg, int hittype, vector org, vector thisforce) { - if(thisforce_z < 0) + if(thisforce.z < 0) thisforce_z = 0; self.move_velocity = self.move_velocity + thisforce + '0 0 100'; self.move_flags &= ~FL_ONGROUND; diff --git a/qcsrc/client/command/cl_cmd.qc b/qcsrc/client/command/cl_cmd.qc index 4fad33629..dbece27b3 100644 --- a/qcsrc/client/command/cl_cmd.qc +++ b/qcsrc/client/command/cl_cmd.qc @@ -121,8 +121,8 @@ void LocalCommand_create_scrshot_ent(int request) { fputs(fh, "{\n"); fputs(fh, strcat("\"classname\" \"info_autoscreenshot\"\n")); - fputs(fh, strcat("\"origin\" \"", strcat(ftos(view_origin_x), " ", ftos(view_origin_y), " ", ftos(view_origin_z)), "\"\n")); - fputs(fh, strcat("\"angles\" \"", strcat(ftos(view_angles_x), " ", ftos(view_angles_y), " ", ftos(view_angles_z)), "\"\n")); + fputs(fh, strcat("\"origin\" \"", strcat(ftos(view_origin.x), " ", ftos(view_origin.y), " ", ftos(view_origin.z)), "\"\n")); + fputs(fh, strcat("\"angles\" \"", strcat(ftos(view_angles.x), " ", ftos(view_angles.y), " ", ftos(view_angles.z)), "\"\n")); fputs(fh, "}\n"); print("Completed screenshot entity dump in ^2data/data/", MapInfo_Map_bspname, "_scrshot_ent.txt^7.\n"); @@ -524,18 +524,18 @@ void GameCommand(string command) /* nothing */ #define CONSOLE_COMMANDS_MOVEMENT \ - CONSOLE_COMMAND("+forward", { ++camera_direction_x; }) \ - CONSOLE_COMMAND("-forward", { --camera_direction_x; }) \ - CONSOLE_COMMAND("+back", { --camera_direction_x; }) \ - CONSOLE_COMMAND("-back", { ++camera_direction_x; }) \ - CONSOLE_COMMAND("+moveup", { ++camera_direction_z; }) \ - CONSOLE_COMMAND("-moveup", { --camera_direction_z; }) \ - CONSOLE_COMMAND("+movedown", { --camera_direction_z; }) \ - CONSOLE_COMMAND("-movedown", { ++camera_direction_z; }) \ - CONSOLE_COMMAND("+moveright", { --camera_direction_y; }) \ - CONSOLE_COMMAND("-moveright", { ++camera_direction_y; }) \ - CONSOLE_COMMAND("+moveleft", { ++camera_direction_y; }) \ - CONSOLE_COMMAND("-moveleft", { --camera_direction_y; }) \ + CONSOLE_COMMAND("+forward", { ++camera_direction.x; }) \ + CONSOLE_COMMAND("-forward", { --camera_direction.x; }) \ + CONSOLE_COMMAND("+back", { --camera_direction.x; }) \ + CONSOLE_COMMAND("-back", { ++camera_direction.x; }) \ + CONSOLE_COMMAND("+moveup", { ++camera_direction.z; }) \ + CONSOLE_COMMAND("-moveup", { --camera_direction.z; }) \ + CONSOLE_COMMAND("+movedown", { --camera_direction.z; }) \ + CONSOLE_COMMAND("-movedown", { ++camera_direction.z; }) \ + CONSOLE_COMMAND("+moveright", { --camera_direction.y; }) \ + CONSOLE_COMMAND("-moveright", { ++camera_direction.y; }) \ + CONSOLE_COMMAND("+moveleft", { ++camera_direction.y; }) \ + CONSOLE_COMMAND("-moveleft", { --camera_direction.y; }) \ CONSOLE_COMMAND("+roll_right", { ++camera_roll; }) \ CONSOLE_COMMAND("-roll_right", { --camera_roll; }) \ CONSOLE_COMMAND("+roll_left", { --camera_roll; }) \ diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index 81eefe60f..715a05c52 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -280,9 +280,9 @@ void CSQCPlayer_ModelAppearance_Apply(bool islocalplayer) self.colormap = 0; self.glowmod = self.old_glowmod * bound(0, 1 - (time - self.death_time) / autocvar_cl_deathglow, 1); - self.glowmod_x = max(self.glowmod_x, 0.0001); - self.glowmod_y = max(self.glowmod_y, 0.0001); - self.glowmod_z = max(self.glowmod_z, 0.0001); + self.glowmod_x = max(self.glowmod.x, 0.0001); + self.glowmod_y = max(self.glowmod.y, 0.0001); + self.glowmod_z = max(self.glowmod.z, 0.0001); } else if(self.old_glowmod != '0 0 0') { self.old_glowmod = '0 0 0'; } } diff --git a/qcsrc/client/effects.qc b/qcsrc/client/effects.qc index a515fdb61..56c83e063 100644 --- a/qcsrc/client/effects.qc +++ b/qcsrc/client/effects.qc @@ -75,7 +75,7 @@ void Net_ReadLightningarc() vector from, to; from_x = ReadCoord(); from_y = ReadCoord(); from_z = ReadCoord(); - to_x = ReadCoord(); to_y = ReadCoord(); to_z = ReadCoord(); + to_x = ReadCoord(); to_y = ReadCoord(); to_z = ReadCoord(); if(autocvar_cl_effects_lightningarc_simple) { diff --git a/qcsrc/client/hook.qc b/qcsrc/client/hook.qc index ec8029f00..a537cbae6 100644 --- a/qcsrc/client/hook.qc +++ b/qcsrc/client/hook.qc @@ -86,7 +86,7 @@ void Draw_GrapplingHook() { default: case ENT_CLIENT_HOOK: - a = view_origin + view_forward * vs_x + view_right * -vs_y + view_up * vs_z; + a = view_origin + view_forward * vs.x + view_right * -vs.y + view_up * vs.z; b = self.origin; break; case ENT_CLIENT_ARC_BEAM: @@ -96,7 +96,7 @@ void Draw_GrapplingHook() b = view_origin + view_forward * vlen(self.velocity - self.origin); // honor original length of beam! WarpZone_TraceLine(view_origin, b, MOVE_NORMAL, world); b = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos); - a = view_origin + view_forward * vs_x + view_right * -vs_y + view_up * vs_z; + a = view_origin + view_forward * vs.x + view_right * -vs.y + view_up * vs.z; break; } } diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 067770c51..e189ff97d 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -14,7 +14,7 @@ Misc HUD functions // 1/4 height: bottom part void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector theColor, float theAlpha, vector theBorderSize) { - if (theBorderSize_x < 0 && theBorderSize_y < 0) // draw whole image as it is + if (theBorderSize.x < 0 && theBorderSize.y < 0) // draw whole image as it is { drawpic(theOrigin, pic, theSize, theColor, theAlpha, 0); return; @@ -30,16 +30,16 @@ void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector the vector width, height; vector bW, bH; //pic = draw_UseSkinFor(pic); - width = eX * theSize_x; - height = eY * theSize_y; - if(theSize_x <= theBorderSize_x * 2) + width = eX * theSize.x; + height = eY * theSize.y; + if(theSize.x <= theBorderSize.x * 2) { // not wide enough... draw just left and right then - bW = eX * (0.25 * theSize_x / (theBorderSize_x * 2)); - if(theSize_y <= theBorderSize_y * 2) + bW = eX * (0.25 * theSize.x / (theBorderSize.x * 2)); + if(theSize.y <= theBorderSize.y * 2) { // not high enough... draw just corners - bH = eY * (0.25 * theSize_y / (theBorderSize_y * 2)); + bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2)); drawsubpic(theOrigin, width * 0.5 + height * 0.5, pic, '0 0 0', bW + bH, theColor, theAlpha, 0); drawsubpic(theOrigin + width * 0.5, width * 0.5 + height * 0.5, pic, eX - bW, bW + bH, theColor, theAlpha, 0); drawsubpic(theOrigin + height * 0.5, width * 0.5 + height * 0.5, pic, eY - bH, bW + bH, theColor, theAlpha, 0); @@ -47,7 +47,7 @@ void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector the } else { - dY = theBorderSize_x * eY; + dY = theBorderSize.x * eY; drawsubpic(theOrigin, width * 0.5 + dY, pic, '0 0 0', '0 0.25 0' + bW, theColor, theAlpha, 0); drawsubpic(theOrigin + width * 0.5, width * 0.5 + dY, pic, '0 0 0' + eX - bW, '0 0.25 0' + bW, theColor, theAlpha, 0); drawsubpic(theOrigin + dY, width * 0.5 + height - 2 * dY, pic, '0 0.25 0', '0 0.5 0' + bW, theColor, theAlpha, 0); @@ -58,11 +58,11 @@ void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector the } else { - if(theSize_y <= theBorderSize_y * 2) + if(theSize.y <= theBorderSize.y * 2) { // not high enough... draw just top and bottom then - bH = eY * (0.25 * theSize_y / (theBorderSize_y * 2)); - dX = theBorderSize_x * eX; + bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2)); + dX = theBorderSize.x * eX; drawsubpic(theOrigin, dX + height * 0.5, pic, '0 0 0', '0.25 0 0' + bH, theColor, theAlpha, 0); drawsubpic(theOrigin + dX, width - 2 * dX + height * 0.5, pic, '0.25 0 0', '0.5 0 0' + bH, theColor, theAlpha, 0); drawsubpic(theOrigin + width - dX, dX + height * 0.5, pic, '0.75 0 0', '0.25 0 0' + bH, theColor, theAlpha, 0); @@ -72,8 +72,8 @@ void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector the } else { - dX = theBorderSize_x * eX; - dY = theBorderSize_x * eY; + dX = theBorderSize.x * eX; + dY = theBorderSize.x * eY; drawsubpic(theOrigin, dX + dY, pic, '0 0 0', '0.25 0.25 0', theColor, theAlpha, 0); drawsubpic(theOrigin + dX, width - 2 * dX + dY, pic, '0.25 0 0', '0.5 0.25 0', theColor, theAlpha, 0); drawsubpic(theOrigin + width - dX, dX + dY, pic, '0.75 0 0', '0.25 0.25 0', theColor, theAlpha, 0); @@ -125,9 +125,9 @@ vector HUD_Get_Num_Color (float x, float maxvalue) blinkingamt = (1 - x/maxvalue/0.25); if(blinkingamt > 0) { - color_x = color_x - color_x * blinkingamt * sin(2*M_PI*time); - color_y = color_y - color_y * blinkingamt * sin(2*M_PI*time); - color_z = color_z - color_z * blinkingamt * sin(2*M_PI*time); + color_x = color.x - color.x * blinkingamt * sin(2*M_PI*time); + color_y = color.y - color.y * blinkingamt * sin(2*M_PI*time); + color_z = color.z - color.z * blinkingamt * sin(2*M_PI*time); } return color; } @@ -144,13 +144,13 @@ float stringwidth_nocolors(string s, vector theSize) void drawstringright(vector position, string text, vector theScale, vector rgb, float theAlpha, float flag) { - position_x -= 2 / 3 * strlen(text) * theScale_x; + position.x -= 2 / 3 * strlen(text) * theScale.x; drawstring(position, text, theScale, rgb, theAlpha, flag); } void drawstringcenter(vector position, string text, vector theScale, vector rgb, float theAlpha, float flag) { - position_x = 0.5 * (vid_conwidth - 0.6025 * strlen(text) * theScale_x); + position_x = 0.5 * (vid_conwidth - 0.6025 * strlen(text) * theScale.x); drawstring(position, text, theScale, rgb, theAlpha, flag); } @@ -291,37 +291,37 @@ void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, flo } if (baralign == 1) // bottom align - theOrigin_y += (1 - length_ratio) * theSize_y; + theOrigin.y += (1 - length_ratio) * theSize.y; else if (baralign == 2) // center align - theOrigin_y += 0.5 * (1 - length_ratio) * theSize_y; + theOrigin.y += 0.5 * (1 - length_ratio) * theSize.y; else if (baralign == 3) // center align, positive values down, negative up { - theSize_y *= 0.5; + theSize.y *= 0.5; if (length_ratio > 0) - theOrigin_y += theSize_y; + theOrigin.y += theSize.y; else { - theOrigin_y += (1 + length_ratio) * theSize_y; + theOrigin.y += (1 + length_ratio) * theSize.y; length_ratio = -length_ratio; } } - theSize_y *= length_ratio; + theSize.y *= length_ratio; vector bH; - width = eX * theSize_x; - height = eY * theSize_y; - if(theSize_y <= theSize_x * 2) + width = eX * theSize.x; + height = eY * theSize.y; + if(theSize.y <= theSize.x * 2) { // button not high enough // draw just upper and lower part then - square = eY * theSize_y * 0.5; - bH = eY * (0.25 * theSize_y / (theSize_x * 2)); + square = eY * theSize.y * 0.5; + bH = eY * (0.25 * theSize.y / (theSize.x * 2)); drawsubpic(theOrigin, square + width, pic, '0 0 0', eX + bH, theColor, theAlpha, drawflag); drawsubpic(theOrigin + square, square + width, pic, eY - bH, eX + bH, theColor, theAlpha, drawflag); } else { - square = eY * theSize_x; + square = eY * theSize.x; drawsubpic(theOrigin, width + square, pic, '0 0 0', '1 0.25 0', theColor, theAlpha, drawflag); drawsubpic(theOrigin + square, theSize - 2 * square, pic, '0 0.25 0', '1 0.5 0', theColor, theAlpha, drawflag); drawsubpic(theOrigin + height - square, width + square, pic, '0 0.75 0', '1 0.25 0', theColor, theAlpha, drawflag); @@ -333,37 +333,37 @@ void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, flo } if (baralign == 1) // right align - theOrigin_x += (1 - length_ratio) * theSize_x; + theOrigin.x += (1 - length_ratio) * theSize.x; else if (baralign == 2) // center align - theOrigin_x += 0.5 * (1 - length_ratio) * theSize_x; + theOrigin.x += 0.5 * (1 - length_ratio) * theSize.x; else if (baralign == 3) // center align, positive values on the right, negative on the left { - theSize_x *= 0.5; + theSize.x *= 0.5; if (length_ratio > 0) - theOrigin_x += theSize_x; + theOrigin.x += theSize.x; else { - theOrigin_x += (1 + length_ratio) * theSize_x; + theOrigin.x += (1 + length_ratio) * theSize.x; length_ratio = -length_ratio; } } - theSize_x *= length_ratio; + theSize.x *= length_ratio; vector bW; - width = eX * theSize_x; - height = eY * theSize_y; - if(theSize_x <= theSize_y * 2) + width = eX * theSize.x; + height = eY * theSize.y; + if(theSize.x <= theSize.y * 2) { // button not wide enough // draw just left and right part then - square = eX * theSize_x * 0.5; - bW = eX * (0.25 * theSize_x / (theSize_y * 2)); + square = eX * theSize.x * 0.5; + bW = eX * (0.25 * theSize.x / (theSize.y * 2)); drawsubpic(theOrigin, square + height, pic, '0 0 0', eY + bW, theColor, theAlpha, drawflag); drawsubpic(theOrigin + square, square + height, pic, eX - bW, eY + bW, theColor, theAlpha, drawflag); } else { - square = eX * theSize_y; + square = eX * theSize.y; drawsubpic(theOrigin, height + square, pic, '0 0 0', '0.25 1 0', theColor, theAlpha, drawflag); drawsubpic(theOrigin + square, theSize - 2 * square, pic, '0.25 0 0', '0.5 1 0', theColor, theAlpha, drawflag); drawsubpic(theOrigin + width - square, height + square, pic, '0.75 0 0', '0.25 1 0', theColor, theAlpha, drawflag); @@ -382,10 +382,10 @@ void HUD_Panel_DrawHighlight(vector pos, vector mySize, vector color, float theA pic = "gfx/hud/default/num_leading"; } - drawsubpic(pos, eX * min(mySize_x * 0.5, mySize_y) + eY * mySize_y, pic, '0 0 0', '0.25 1 0', color, theAlpha, drawflag); - if(mySize_x/mySize_y > 2) - drawsubpic(pos + eX * mySize_y, eX * (mySize_x - 2 * mySize_y) + eY * mySize_y, pic, '0.25 0 0', '0.5 1 0', color, theAlpha, drawflag); - drawsubpic(pos + eX * mySize_x - eX * min(mySize_x * 0.5, mySize_y), eX * min(mySize_x * 0.5, mySize_y) + eY * mySize_y, pic, '0.75 0 0', '0.25 1 0', color, theAlpha, drawflag); + drawsubpic(pos, eX * min(mySize.x * 0.5, mySize.y) + eY * mySize.y, pic, '0 0 0', '0.25 1 0', color, theAlpha, drawflag); + if(mySize.x/mySize.y > 2) + drawsubpic(pos + eX * mySize.y, eX * (mySize.x - 2 * mySize.y) + eY * mySize.y, pic, '0.25 0 0', '0.5 1 0', color, theAlpha, drawflag); + drawsubpic(pos + eX * mySize.x - eX * min(mySize.x * 0.5, mySize.y), eX * min(mySize.x * 0.5, mySize.y) + eY * mySize.y, pic, '0.75 0 0', '0.25 1 0', color, theAlpha, drawflag); } // Weapon icons (#0) @@ -413,7 +413,8 @@ void HUD_Weapons(void) // declarations WepSet weapons_stat = WepSet_GetFromStat(); float i, f, a; - float screen_ar, center_x = 0, center_y; + float screen_ar; + vector center = '0 0 0'; float weapon_count, weapon_id; float row, column, rows = 0, columns = 0; float aspect = autocvar_hud_panel_weapons_aspect; @@ -425,7 +426,7 @@ void HUD_Weapons(void) float timeout_effect_length = autocvar_hud_panel_weapons_timeout_speed_out; //? 0.75 : 0); float ammo_full; - float barsize_x = 0, barsize_y = 0, baroffset_x = 0, baroffset_y = 0; + vector barsize = '0 0 0', baroffset = '0 0 0'; vector ammo_color = '1 0 1'; float ammo_alpha = 1; @@ -521,16 +522,16 @@ void HUD_Weapons(void) vector max_panel_size = panel_size - '2 2 0' * panel_bg_padding; // calculate distribution and size of table cells - if(max_panel_size_x > max_panel_size_y) + if(max_panel_size.x > max_panel_size.y) { while(weapon_count > columns * rows) { ++rows; - columns = ceil(max_panel_size_x / (max_panel_size_y / rows * aspect)); + columns = ceil(max_panel_size.x / (max_panel_size.y / rows * aspect)); } - weapon_size_x = max_panel_size_x / columns; - weapon_size_y = max_panel_size_y / rows; + weapon_size_x = max_panel_size.x / columns; + weapon_size_y = max_panel_size.y / rows; columns = ceil(weapon_count / rows); } else @@ -538,19 +539,19 @@ void HUD_Weapons(void) while(weapon_count > columns * rows) { ++columns; - rows = ceil(max_panel_size_y / (max_panel_size_x / columns / aspect)); + rows = ceil(max_panel_size.y / (max_panel_size.x / columns / aspect)); } - weapon_size_x = max_panel_size_x / columns; - weapon_size_y = max_panel_size_y / rows; + weapon_size_x = max_panel_size.x / columns; + weapon_size_y = max_panel_size.y / rows; rows = ceil(weapon_count / columns); } // reduce size of the panel - panel_size_x = columns * weapon_size_x; - panel_size_y = rows * weapon_size_y; - panel_pos_x += (max_panel_size_x - panel_size_x) / 2; - panel_pos_y += (max_panel_size_y - panel_size_y) / 2; + panel_size_x = columns * weapon_size.x; + panel_size_y = rows * weapon_size.y; + panel_pos.x += (max_panel_size.x - panel_size.x) / 2; + panel_pos.y += (max_panel_size.y - panel_size.y) / 2; panel_size += '2 2 0' * panel_bg_padding; } @@ -580,22 +581,22 @@ void HUD_Weapons(void) if (autocvar_hud_panel_weapons_timeout_effect == 2 || autocvar_hud_panel_weapons_timeout_effect == 3) { f *= f; // for a cooler movement - center_x = panel_pos_x + panel_size_x/2; - center_y = panel_pos_y + panel_size_y/2; + center_x = panel_pos.x + panel_size.x/2; + center_y = panel_pos.y + panel_size.y/2; screen_ar = vid_conwidth/vid_conheight; - if (center_x/center_y < screen_ar) //bottom left + if (center.x/center.y < screen_ar) //bottom left { - if ((vid_conwidth - center_x)/center_y < screen_ar) //bottom - panel_pos_y += f * (vid_conheight - panel_pos_y); + if ((vid_conwidth - center.x)/center.y < screen_ar) //bottom + panel_pos.y += f * (vid_conheight - panel_pos.y); else //left - panel_pos_x -= f * (panel_pos_x + panel_size_x); + panel_pos.x -= f * (panel_pos.x + panel_size.x); } else //top right { - if ((vid_conwidth - center_x)/center_y < screen_ar) //right - panel_pos_x += f * (vid_conwidth - panel_pos_x); + if ((vid_conwidth - center.x)/center.y < screen_ar) //right + panel_pos.x += f * (vid_conwidth - panel_pos.x); else //top - panel_pos_y -= f * (panel_pos_y + panel_size_y); + panel_pos.y -= f * (panel_pos.y + panel_size.y); } if(f == 1) center_x = -1; // mark the panel as off screen @@ -623,22 +624,22 @@ void HUD_Weapons(void) { f *= f; // for a cooler movement f = 1 - f; - center_x = panel_pos_x + panel_size_x/2; - center_y = panel_pos_y + panel_size_y/2; + center_x = panel_pos.x + panel_size.x/2; + center_y = panel_pos.y + panel_size.y/2; screen_ar = vid_conwidth/vid_conheight; - if (center_x/center_y < screen_ar) //bottom left + if (center.x/center.y < screen_ar) //bottom left { - if ((vid_conwidth - center_x)/center_y < screen_ar) //bottom - panel_pos_y += f * (vid_conheight - panel_pos_y); + if ((vid_conwidth - center.x)/center.y < screen_ar) //bottom + panel_pos.y += f * (vid_conheight - panel_pos.y); else //left - panel_pos_x -= f * (panel_pos_x + panel_size_x); + panel_pos.x -= f * (panel_pos.x + panel_size.x); } else //top right { - if ((vid_conwidth - center_x)/center_y < screen_ar) //right - panel_pos_x += f * (vid_conwidth - panel_pos_x); + if ((vid_conwidth - center.x)/center.y < screen_ar) //right + panel_pos.x += f * (vid_conwidth - panel_pos.x); else //top - panel_pos_y -= f * (panel_pos_y + panel_size_y); + panel_pos.y -= f * (panel_pos.y + panel_size.y); } } } @@ -663,10 +664,10 @@ void HUD_Weapons(void) if(!rows) // if rows is > 0 onlyowned code has already updated these vars { - rows = panel_size_y/panel_size_x; + rows = panel_size.y/panel_size.x; rows = bound(1, floor((sqrt(4 * aspect * rows * weapon_count + rows * rows) + rows + 0.5) / 2), weapon_count); columns = ceil(weapon_count/rows); - weapon_size = eX * panel_size_x*(1/columns) + eY * panel_size_y*(1/rows); + weapon_size = eX * panel_size.x*(1/columns) + eY * panel_size.y*(1/rows); } // calculate position/size for visual bar displaying ammount of ammo status @@ -675,17 +676,17 @@ void HUD_Weapons(void) ammo_color = stov(autocvar_hud_panel_weapons_ammo_color); ammo_alpha = panel_fg_alpha * autocvar_hud_panel_weapons_ammo_alpha; - if(weapon_size_x/weapon_size_y > aspect) + if(weapon_size.x/weapon_size.y > aspect) { - barsize_x = aspect * weapon_size_y; - barsize_y = weapon_size_y; - baroffset_x = (weapon_size_x - barsize_x) / 2; + barsize_x = aspect * weapon_size.y; + barsize_y = weapon_size.y; + baroffset_x = (weapon_size.x - barsize.x) / 2; } else { - barsize_y = 1/aspect * weapon_size_x; - barsize_x = weapon_size_x; - baroffset_y = (weapon_size_y - barsize_y) / 2; + barsize_y = 1/aspect * weapon_size.x; + barsize_x = weapon_size.x; + baroffset_y = (weapon_size.y - barsize.y) / 2; } } if(autocvar_hud_panel_weapons_accuracy) @@ -693,7 +694,7 @@ void HUD_Weapons(void) // draw items row = column = 0; - vector label_size = '1 1 0' * min(weapon_size_x, weapon_size_y) * bound(0, autocvar_hud_panel_weapons_label_scale, 1); + vector label_size = '1 1 0' * min(weapon_size.x, weapon_size.y) * bound(0, autocvar_hud_panel_weapons_label_scale, 1); for(i = 0; i <= WEP_LAST-WEP_FIRST; ++i) { // retrieve information about the current weapon to be drawn @@ -710,8 +711,8 @@ void HUD_Weapons(void) // figure out the drawing position of weapon weapon_pos = (panel_pos - + eX * column * weapon_size_x - + eY * row * weapon_size_y); + + eX * column * weapon_size.x + + eY * row * weapon_size.y); // draw background behind currently selected weapon if(self.weapon == switchweapon) @@ -772,10 +773,10 @@ void HUD_Weapons(void) } drawsetcliparea( - weapon_pos_x + baroffset_x, - weapon_pos_y + baroffset_y, - barsize_x * bound(0, a/ammo_full, 1), - barsize_y + weapon_pos.x + baroffset.x, + weapon_pos.y + baroffset.y, + barsize.x * bound(0, a/ammo_full, 1), + barsize.y ); drawpic_aspect_skin( @@ -839,8 +840,8 @@ void DrawNadeScoreBar(vector myPos, vector mySize, vector color) { HUD_Panel_DrawProgressBar( - myPos + eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize_x, - mySize - eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize_x, + myPos + eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize.x, + mySize - eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize.x, autocvar_hud_panel_ammo_progressbar_name, getstatf(STAT_NADE_BONUS_SCORE), 0, 0, color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); @@ -860,11 +861,11 @@ void DrawAmmoNades(vector myPos, vector mySize, float draw_expanding, float expa if(autocvar_hud_panel_ammo_iconalign) { numpos = myPos; - picpos = myPos + eX * 2 * mySize_y; + picpos = myPos + eX * 2 * mySize.y; } else { - numpos = myPos + eX * mySize_y; + numpos = myPos + eX * mySize.y; picpos = myPos; } @@ -873,13 +874,13 @@ void DrawAmmoNades(vector myPos, vector mySize, float draw_expanding, float expa if(b > 0 || a > 0) { if(autocvar_hud_panel_ammo_text) - drawstring_aspect(numpos, ftos(a), eX * (2/3) * mySize_x + eY * mySize_y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL); + drawstring_aspect(numpos, ftos(a), eX * (2/3) * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL); if(draw_expanding) - drawpic_aspect_skin_expanding(picpos, "nade_nbg", '1 1 0' * mySize_y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, expand_time); + drawpic_aspect_skin_expanding(picpos, "nade_nbg", '1 1 0' * mySize.y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, expand_time); - drawpic_aspect_skin(picpos, "nade_bg" , '1 1 0' * mySize_y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL); - drawpic_aspect_skin(picpos, "nade_nbg" , '1 1 0' * mySize_y, nade_color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL); + drawpic_aspect_skin(picpos, "nade_bg" , '1 1 0' * mySize.y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL); + drawpic_aspect_skin(picpos, "nade_nbg" , '1 1 0' * mySize.y, nade_color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL); } } @@ -909,13 +910,13 @@ void DrawAmmoItem(vector myPos, vector mySize, .float ammoType, float isCurrent, vector iconPos, textPos; if(autocvar_hud_panel_ammo_iconalign) { - iconPos = myPos + eX * 2 * mySize_y; + iconPos = myPos + eX * 2 * mySize.y; textPos = myPos; } else { iconPos = myPos; - textPos = myPos + eX * mySize_y; + textPos = myPos + eX * mySize.y; } float isShadowed = (ammo <= 0 && !isCurrent && !isInfinite); @@ -947,12 +948,12 @@ void DrawAmmoItem(vector myPos, vector mySize, .float ammoType, float isCurrent, drawpic_aspect_skin(myPos, "ammo_current_bg", mySize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); if(ammo > 0 && autocvar_hud_panel_ammo_progressbar) - HUD_Panel_DrawProgressBar(myPos + eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize_x, mySize - eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize_x, autocvar_hud_panel_ammo_progressbar_name, ammo/autocvar_hud_panel_ammo_maxammo, 0, 0, textColor, autocvar_hud_progressbar_alpha * alpha, DRAWFLAG_NORMAL); + HUD_Panel_DrawProgressBar(myPos + eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize.x, mySize - eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize.x, autocvar_hud_panel_ammo_progressbar_name, ammo/autocvar_hud_panel_ammo_maxammo, 0, 0, textColor, autocvar_hud_progressbar_alpha * alpha, DRAWFLAG_NORMAL); if(autocvar_hud_panel_ammo_text) - drawstring_aspect(textPos, text, eX * (2/3) * mySize_x + eY * mySize_y, textColor, alpha, DRAWFLAG_NORMAL); + drawstring_aspect(textPos, text, eX * (2/3) * mySize.x + eY * mySize.y, textColor, alpha, DRAWFLAG_NORMAL); - drawpic_aspect_skin(iconPos, GetAmmoPicture(ammoType), '1 1 0' * mySize_y, iconColor, alpha, DRAWFLAG_NORMAL); + drawpic_aspect_skin(iconPos, GetAmmoPicture(ammoType), '1 1 0' * mySize.y, iconColor, alpha, DRAWFLAG_NORMAL); } float nade_prevstatus; @@ -1006,29 +1007,29 @@ void HUD_Ammo(void) else nade_prevstatus = nade_prevframe = nade_statuschange_time = 0; - rows = mySize_y/mySize_x; + rows = mySize.y/mySize.x; rows = bound(1, floor((sqrt(4 * (3/1) * rows * (total_ammo_count) + rows * rows) + rows + 0.5) / 2), (total_ammo_count)); // ^^^ ammo item aspect goes here columns = ceil((total_ammo_count)/rows); - ammo_size = eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows); + ammo_size = eX * mySize.x*(1/columns) + eY * mySize.y*(1/rows); vector offset = '0 0 0'; // fteqcc sucks float newSize; - if(ammo_size_x/ammo_size_y > 3) + if(ammo_size.x/ammo_size.y > 3) { - newSize = 3 * ammo_size_y; - offset_x = ammo_size_x - newSize; - pos_x += offset_x/2; + newSize = 3 * ammo_size.y; + offset_x = ammo_size.x - newSize; + pos.x += offset.x/2; ammo_size_x = newSize; } else { - newSize = 1/3 * ammo_size_x; - offset_y = ammo_size_y - newSize; - pos_y += offset_y/2; + newSize = 1/3 * ammo_size.x; + offset_y = ammo_size.y - newSize; + pos.y += offset.y/2; ammo_size_y = newSize; } @@ -1067,7 +1068,7 @@ void HUD_Ammo(void) { ammotype = GetAmmoFieldFromNum(i); DrawAmmoItem( - pos + eX * column * (ammo_size_x + offset_x) + eY * row * (ammo_size_y + offset_y), + pos + eX * column * (ammo_size.x + offset.x) + eY * row * (ammo_size.y + offset.y), ammo_size, ammotype, ((get_weaponinfo(switchweapon)).ammo_field == ammotype), @@ -1089,7 +1090,7 @@ void HUD_Ammo(void) float f = bound(0, nade_statuschange_elapsedtime*2, 1); - DrawAmmoNades(pos + eX * column * (ammo_size_x + offset_x) + eY * row * (ammo_size_y + offset_y), ammo_size, nade_prevstatus < nade_cnt && nade_cnt != 0 && f < 1, f); + DrawAmmoNades(pos + eX * column * (ammo_size.x + offset.x) + eY * row * (ammo_size.y + offset.y), ammo_size, nade_prevstatus < nade_cnt && nade_cnt != 0 && f < 1, f); } draw_endBoldFont(); @@ -1102,76 +1103,76 @@ void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, fl if (vertical) { - if(mySize_y/mySize_x > 2) + if(mySize.y/mySize.x > 2) { - newSize_y = 2 * mySize_x; - newSize_x = mySize_x; + newSize_y = 2 * mySize.x; + newSize_x = mySize.x; - newPos_y = myPos_y + (mySize_y - newSize_y) / 2; - newPos_x = myPos_x; + newPos_y = myPos.y + (mySize.y - newSize.y) / 2; + newPos_x = myPos.x; } else { - newSize_x = 1/2 * mySize_y; - newSize_y = mySize_y; + newSize_x = 1/2 * mySize.y; + newSize_y = mySize.y; - newPos_x = myPos_x + (mySize_x - newSize_x) / 2; - newPos_y = myPos_y; + newPos_x = myPos.x + (mySize.x - newSize.x) / 2; + newPos_y = myPos.y; } if(icon_right_align) { numpos = newPos; - picpos = newPos + eY * newSize_x; + picpos = newPos + eY * newSize.x; } else { picpos = newPos; - numpos = newPos + eY * newSize_x; + numpos = newPos + eY * newSize.x; } - newSize_y /= 2; + newSize.y /= 2; drawpic_aspect_skin(picpos, icon, newSize, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL); // make number smaller than icon, it looks better // reduce only y to draw numbers with different number of digits with the same y size - numpos_y += newSize_y * ((1 - 0.7) / 2); - newSize_y *= 0.7; + numpos.y += newSize.y * ((1 - 0.7) / 2); + newSize.y *= 0.7; drawstring_aspect(numpos, ftos(x), newSize, color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL); return; } - if(mySize_x/mySize_y > 3) + if(mySize.x/mySize.y > 3) { - newSize_x = 3 * mySize_y; - newSize_y = mySize_y; + newSize_x = 3 * mySize.y; + newSize_y = mySize.y; - newPos_x = myPos_x + (mySize_x - newSize_x) / 2; - newPos_y = myPos_y; + newPos_x = myPos.x + (mySize.x - newSize.x) / 2; + newPos_y = myPos.y; } else { - newSize_y = 1/3 * mySize_x; - newSize_x = mySize_x; + newSize_y = 1/3 * mySize.x; + newSize_x = mySize.x; - newPos_y = myPos_y + (mySize_y - newSize_y) / 2; - newPos_x = myPos_x; + newPos_y = myPos.y + (mySize.y - newSize.y) / 2; + newPos_x = myPos.x; } if(icon_right_align) // right align { numpos = newPos; - picpos = newPos + eX * 2 * newSize_y; + picpos = newPos + eX * 2 * newSize.y; } else // left align { - numpos = newPos + eX * newSize_y; + numpos = newPos + eX * newSize.y; picpos = newPos; } // NOTE: newSize_x is always equal to 3 * mySize_y so we can use // '2 1 0' * newSize_y instead of eX * (2/3) * newSize_x + eY * newSize_y - drawstring_aspect_expanding(numpos, ftos(x), '2 1 0' * newSize_y, color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, fadelerp); - drawpic_aspect_skin_expanding(picpos, icon, '1 1 0' * newSize_y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, fadelerp); + drawstring_aspect_expanding(numpos, ftos(x), '2 1 0' * newSize.y, color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, fadelerp); + drawpic_aspect_skin_expanding(picpos, icon, '1 1 0' * newSize.y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, fadelerp); } void DrawNumIcon(vector myPos, vector mySize, float x, string icon, float vertical, float icon_right_align, vector color, float theAlpha) @@ -1224,7 +1225,7 @@ void HUD_Powerups(void) mySize -= '2 2 0' * panel_bg_padding; } - float panel_ar = mySize_x/mySize_y; + float panel_ar = mySize.x/mySize.y; float is_vertical = (panel_ar < 1); vector shield_offset = '0 0 0', strength_offset = '0 0 0', superweapons_offset = '0 0 0'; @@ -1253,40 +1254,40 @@ void HUD_Powerups(void) { if (panel_ar >= 4 || (panel_ar >= 1/4 && panel_ar < 1)) { - mySize_x *= (1.0 / 3.0); - superweapons_offset_x = mySize_x; + mySize.x *= (1.0 / 3.0); + superweapons_offset_x = mySize.x; if (autocvar_hud_panel_powerups_flip) - shield_offset_x = 2*mySize_x; + shield_offset_x = 2*mySize.x; else - strength_offset_x = 2*mySize_x; + strength_offset_x = 2*mySize.x; } else { - mySize_y *= (1.0 / 3.0); - superweapons_offset_y = mySize_y; + mySize.y *= (1.0 / 3.0); + superweapons_offset_y = mySize.y; if (autocvar_hud_panel_powerups_flip) - shield_offset_y = 2*mySize_y; + shield_offset_y = 2*mySize.y; else - strength_offset_y = 2*mySize_y; + strength_offset_y = 2*mySize.y; } } else { if (panel_ar >= 4 || (panel_ar >= 1/4 && panel_ar < 1)) { - mySize_x *= 0.5; + mySize.x *= 0.5; if (autocvar_hud_panel_powerups_flip) - shield_offset_x = mySize_x; + shield_offset_x = mySize.x; else - strength_offset_x = mySize_x; + strength_offset_x = mySize.x; } else { - mySize_y *= 0.5; + mySize.y *= 0.5; if (autocvar_hud_panel_powerups_flip) - shield_offset_y = mySize_y; + shield_offset_y = mySize.y; else - strength_offset_y = mySize_y; + strength_offset_y = mySize.y; } } @@ -1463,18 +1464,18 @@ void HUD_HealthArmor(void) v = healtharmor_maxdamage(health, armor, armorblockpercent, DEATH_WEAPON); float x; - x = floor(v_x + 1); + x = floor(v.x + 1); float maxtotal = maxhealth + maxarmor; string biggercount; - if(v_z) // NOT fully armored + if(v.z) // NOT fully armored { biggercount = "health"; if(autocvar_hud_panel_healtharmor_progressbar) HUD_Panel_DrawProgressBar(pos, mySize, autocvar_hud_panel_healtharmor_progressbar_health, x/maxtotal, 0, (baralign == 1 || baralign == 2), autocvar_hud_progressbar_health_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); if(armor) if(autocvar_hud_panel_healtharmor_text) - drawpic_aspect_skin(pos + eX * mySize_x - eX * 0.5 * mySize_y, "armor", '0.5 0.5 0' * mySize_y, '1 1 1', panel_fg_alpha * armor / health, DRAWFLAG_NORMAL); + drawpic_aspect_skin(pos + eX * mySize.x - eX * 0.5 * mySize.y, "armor", '0.5 0.5 0' * mySize.y, '1 1 1', panel_fg_alpha * armor / health, DRAWFLAG_NORMAL); } else { @@ -1483,34 +1484,34 @@ void HUD_HealthArmor(void) HUD_Panel_DrawProgressBar(pos, mySize, autocvar_hud_panel_healtharmor_progressbar_armor, x/maxtotal, 0, (baralign == 1 || baralign == 2), autocvar_hud_progressbar_armor_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); if(health) if(autocvar_hud_panel_healtharmor_text) - drawpic_aspect_skin(pos + eX * mySize_x - eX * 0.5 * mySize_y, "health", '0.5 0.5 0' * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawpic_aspect_skin(pos + eX * mySize.x - eX * 0.5 * mySize.y, "health", '0.5 0.5 0' * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); } if(autocvar_hud_panel_healtharmor_text) DrawNumIcon(pos, mySize, x, biggercount, 0, iconalign, HUD_Get_Num_Color(x, maxtotal), 1); if(fuel) - HUD_Panel_DrawProgressBar(pos, eX * mySize_x + eY * 0.2 * mySize_y, "progressbar", fuel/100, 0, (baralign == 1 || baralign == 3), autocvar_hud_progressbar_fuel_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL); + HUD_Panel_DrawProgressBar(pos, eX * mySize.x + eY * 0.2 * mySize.y, "progressbar", fuel/100, 0, (baralign == 1 || baralign == 3), autocvar_hud_progressbar_fuel_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL); } else { - float panel_ar = mySize_x/mySize_y; + float panel_ar = mySize.x/mySize.y; float is_vertical = (panel_ar < 1); vector health_offset = '0 0 0', armor_offset = '0 0 0'; if (panel_ar >= 4 || (panel_ar >= 1/4 && panel_ar < 1)) { - mySize_x *= 0.5; + mySize.x *= 0.5; if (autocvar_hud_panel_healtharmor_flip) - health_offset_x = mySize_x; + health_offset_x = mySize.x; else - armor_offset_x = mySize_x; + armor_offset_x = mySize.x; } else { - mySize_y *= 0.5; + mySize.y *= 0.5; if (autocvar_hud_panel_healtharmor_flip) - health_offset_y = mySize_y; + health_offset_y = mySize.y; else - armor_offset_y = mySize_y; + armor_offset_y = mySize.y; } float health_baralign, armor_baralign, fuel_baralign; @@ -1636,13 +1637,13 @@ void HUD_HealthArmor(void) if(fuel) { if (is_vertical) - mySize_x *= 0.2 / 2; //if vertical always halve x to not cover too much numbers with 3 digits + mySize.x *= 0.2 / 2; //if vertical always halve x to not cover too much numbers with 3 digits else - mySize_y *= 0.2; + mySize.y *= 0.2; if (panel_ar >= 4) - mySize_x *= 2; //restore full panel size + mySize.x *= 2; //restore full panel size else if (panel_ar < 1/4) - mySize_y *= 2; //restore full panel size + mySize.y *= 2; //restore full panel size HUD_Panel_DrawProgressBar(pos, mySize, "progressbar", fuel/100, is_vertical, fuel_baralign, autocvar_hud_progressbar_fuel_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL); } } @@ -1718,18 +1719,18 @@ void HUD_Notify(void) float fade_time = max(0, autocvar_hud_panel_notify_fadetime); float icon_aspect = max(1, autocvar_hud_panel_notify_icon_aspect); - float entry_count = bound(1, floor(NOTIFY_MAX_ENTRIES * size_y / size_x), NOTIFY_MAX_ENTRIES); - float entry_height = size_y / entry_count; + float entry_count = bound(1, floor(NOTIFY_MAX_ENTRIES * size.y / size.x), NOTIFY_MAX_ENTRIES); + float entry_height = size.y / entry_count; - float panel_width_half = size_x * 0.5; + float panel_width_half = size.x * 0.5; float icon_width_half = entry_height * icon_aspect / 2; - float name_maxwidth = panel_width_half - icon_width_half - size_x * NOTIFY_ICON_MARGIN; + float name_maxwidth = panel_width_half - icon_width_half - size.x * NOTIFY_ICON_MARGIN; vector font_size = '0.5 0.5 0' * entry_height * autocvar_hud_panel_notify_fontsize; vector icon_size = (eX * icon_aspect + eY) * entry_height; vector icon_left = eX * (panel_width_half - icon_width_half); vector attacker_right = eX * name_maxwidth; - vector victim_left = eX * (size_x - name_maxwidth); + vector victim_left = eX * (size.x - name_maxwidth); vector attacker_pos, victim_pos, icon_pos; string attacker, victim, icon; @@ -1782,7 +1783,7 @@ void HUD_Notify(void) if (icon != "" && victim != "") { - vector name_top = eY * (i * entry_height + 0.5 * (entry_height - font_size_y)); + vector name_top = eY * (i * entry_height + 0.5 * (entry_height - font_size.y)); icon_pos = pos + icon_left + eY * i * entry_height; drawpic_aspect_skin(icon_pos, icon, icon_size, '1 1 1', panel_fg_alpha * alpha, DRAWFLAG_NORMAL); @@ -1901,10 +1902,10 @@ void HUD_Radar(void) if (hud_panel_radar_maximized && !autocvar__hud_configure) { panel_size = autocvar_hud_panel_radar_maximized_size; - panel_size_x = bound(0.2, panel_size_x, 1) * vid_conwidth; - panel_size_y = bound(0.2, panel_size_y, 1) * vid_conheight; - panel_pos_x = (vid_conwidth - panel_size_x) / 2; - panel_pos_y = (vid_conheight - panel_size_y) / 2; + panel_size_x = bound(0.2, panel_size.x, 1) * vid_conwidth; + panel_size_y = bound(0.2, panel_size.y, 1) * vid_conheight; + panel_pos_x = (vid_conwidth - panel_size.x) / 2; + panel_pos_y = (vid_conheight - panel_size.y) / 2; string panel_bg; panel_bg = strcat(hud_skin_path, "/border_default"); // always use the default border when maximized @@ -1936,7 +1937,7 @@ void HUD_Radar(void) switch(hud_panel_radar_maximized_rotation) { case 0: - teamradar_angle = view_angles_y - 90; + teamradar_angle = view_angles.y - 90; break; default: teamradar_angle = 90 * hud_panel_radar_maximized_rotation; @@ -1965,7 +1966,7 @@ void HUD_Radar(void) switch(hud_panel_radar_rotation) { case 0: - teamradar_angle = view_angles_y - 90; + teamradar_angle = view_angles.y - 90; break; default: teamradar_angle = 90 * hud_panel_radar_rotation; @@ -2012,16 +2013,16 @@ void HUD_Radar(void) vector c0, c1, c2, c3, span; c0 = rotate(mi_min, teamradar_angle * DEG2RAD); c1 = rotate(mi_max, teamradar_angle * DEG2RAD); - c2 = rotate('1 0 0' * mi_min_x + '0 1 0' * mi_max_y, teamradar_angle * DEG2RAD); - c3 = rotate('1 0 0' * mi_max_x + '0 1 0' * mi_min_y, teamradar_angle * DEG2RAD); + c2 = rotate('1 0 0' * mi_min.x + '0 1 0' * mi_max.y, teamradar_angle * DEG2RAD); + c3 = rotate('1 0 0' * mi_max.x + '0 1 0' * mi_min.y, teamradar_angle * DEG2RAD); span = '0 0 0'; span_x = max(c0_x, c1_x, c2_x, c3_x) - min(c0_x, c1_x, c2_x, c3_x); span_y = max(c0_y, c1_y, c2_y, c3_y) - min(c0_y, c1_y, c2_y, c3_y); // max-min distance must fit the radar in x=x, y=y bigsize = min( - teamradar_size2d_x * scale2d / (1.05 * span_x), - teamradar_size2d_y * scale2d / (1.05 * span_y) + teamradar_size2d.x * scale2d / (1.05 * span.x), + teamradar_size2d.y * scale2d / (1.05 * span.y) ); } @@ -2037,10 +2038,10 @@ void HUD_Radar(void) + (1 - f) * view_origin); drawsetcliparea( - pos_x, - pos_y, - mySize_x, - mySize_y + pos.x, + pos.y, + mySize.x, + mySize.y ); draw_teamradar_background(hud_panel_radar_foreground_alpha); @@ -2069,15 +2070,15 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me) entity tm = world, pl; float SCOREPANEL_MAX_ENTRIES = 6; float SCOREPANEL_ASPECTRATIO = 2; - float entries = bound(1, floor(SCOREPANEL_MAX_ENTRIES * mySize_y/mySize_x * SCOREPANEL_ASPECTRATIO), SCOREPANEL_MAX_ENTRIES); - vector fontsize = '1 1 0' * (mySize_y/entries); + float entries = bound(1, floor(SCOREPANEL_MAX_ENTRIES * mySize.y/mySize.x * SCOREPANEL_ASPECTRATIO), SCOREPANEL_MAX_ENTRIES); + vector fontsize = '1 1 0' * (mySize.y/entries); vector rgb, score_color; rgb = '1 1 1'; score_color = '1 1 1'; - float name_size = mySize_x*0.75; - float spacing_size = mySize_x*0.04; + float name_size = mySize.x*0.75; + float spacing_size = mySize.x*0.04; const float highlight_alpha = 0.2; float i = 0, me_printed = 0, first_pl = 0; string s; @@ -2087,15 +2088,15 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me) if (team_count) { // show team scores in the first line - float score_size = mySize_x / team_count; + float score_size = mySize.x / team_count; players_per_team = max(2, ceil((entries - 1) / team_count)); for(i=0; i 0) distribution_str = strcat("+", distribution_str); - HUD_Panel_DrawHighlight(pos, eX * 0.75 * mySize_x + eY * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + HUD_Panel_DrawHighlight(pos, eX * 0.75 * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); } - drawstring_aspect(pos, ftos(score), eX * 0.75 * mySize_x + eY * mySize_y, distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL); - drawstring_aspect(pos + eX * 0.75 * mySize_x, distribution_str, eX * 0.25 * mySize_x + eY * (1/3) * mySize_y, distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL); + drawstring_aspect(pos, ftos(score), eX * 0.75 * mySize.x + eY * mySize.y, distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL); + drawstring_aspect(pos + eX * 0.75 * mySize.x, distribution_str, eX * 0.25 * mySize.x + eY * (1/3) * mySize.y, distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL); draw_endBoldFont(); } else { // teamgames float row, column, rows = 0, columns = 0; @@ -2300,32 +2301,32 @@ void HUD_Score(void) } if(spectatee_status == -1) { - rows = mySize_y/mySize_x; + rows = mySize.y/mySize.x; rows = bound(1, floor((sqrt(4 * (3/1) * rows * team_count + rows * rows) + rows + 0.5) / 2), team_count); // ^^^ ammo item aspect goes here columns = ceil(team_count/rows); - score_size = eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows); + score_size = eX * mySize.x*(1/columns) + eY * mySize.y*(1/rows); float newSize; - if(score_size_x/score_size_y > 3) + if(score_size.x/score_size.y > 3) { - newSize = 3 * score_size_y; - offset_x = score_size_x - newSize; - pos_x += offset_x/2; + newSize = 3 * score_size.y; + offset_x = score_size.x - newSize; + pos.x += offset.x/2; score_size_x = newSize; } else { - newSize = 1/3 * score_size_x; - offset_y = score_size_y - newSize; - pos_y += offset_y/2; + newSize = 1/3 * score_size.x; + offset_y = score_size.y - newSize; + pos.y += offset.y/2; score_size_y = newSize; } } else - score_size = eX * mySize_x*(1/4) + eY * mySize_y*(1/3); + score_size = eX * mySize.x*(1/4) + eY * mySize.y*(1/3); float max_fragcount; max_fragcount = -99; @@ -2343,7 +2344,7 @@ void HUD_Score(void) if (spectatee_status == -1) { - score_pos = pos + eX * column * (score_size_x + offset_x) + eY * row * (score_size_y + offset_y); + score_pos = pos + eX * column * (score_size.x + offset.x) + eY * row * (score_size.y + offset.y); if (max_fragcount == score) HUD_Panel_DrawHighlight(score_pos, score_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); drawstring_aspect(score_pos, ftos(score), score_size, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL); @@ -2356,12 +2357,12 @@ void HUD_Score(void) } else if(tm.team == myteam) { if (max_fragcount == score) - HUD_Panel_DrawHighlight(pos, eX * 0.75 * mySize_x + eY * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); - drawstring_aspect(pos, ftos(score), eX * 0.75 * mySize_x + eY * mySize_y, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL); + HUD_Panel_DrawHighlight(pos, eX * 0.75 * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawstring_aspect(pos, ftos(score), eX * 0.75 * mySize.x + eY * mySize.y, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL); } else { if (max_fragcount == score) - HUD_Panel_DrawHighlight(pos + eX * 0.75 * mySize_x + eY * (1/3) * rows * mySize_y, score_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); - drawstring_aspect(pos + eX * 0.75 * mySize_x + eY * (1/3) * rows * mySize_y, ftos(score), score_size, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL); + HUD_Panel_DrawHighlight(pos + eX * 0.75 * mySize.x + eY * (1/3) * rows * mySize.y, score_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawstring_aspect(pos + eX * 0.75 * mySize.x + eY * (1/3) * rows * mySize.y, ftos(score), score_size, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL); ++rows; } } @@ -2397,19 +2398,19 @@ void HUD_RaceTimer (void) // always force 4:1 aspect vector newSize = '0 0 0'; - if(mySize_x/mySize_y > 4) + if(mySize.x/mySize.y > 4) { - newSize_x = 4 * mySize_y; - newSize_y = mySize_y; + newSize_x = 4 * mySize.y; + newSize_y = mySize.y; - pos_x = pos_x + (mySize_x - newSize_x) / 2; + pos_x = pos.x + (mySize.x - newSize.x) / 2; } else { - newSize_y = 1/4 * mySize_x; - newSize_x = mySize_x; + newSize_y = 1/4 * mySize.x; + newSize_x = mySize.x; - pos_y = pos_y + (mySize_y - newSize_y) / 2; + pos_y = pos.y + (mySize.y - newSize.y) / 2; } mySize = newSize; @@ -2419,11 +2420,11 @@ void HUD_RaceTimer (void) if(autocvar__hud_configure) { s = "0:13:37"; - drawstring(pos + eX * 0.5 * mySize_x - '0.5 0 0' * stringwidth(s, FALSE, '0.60 0.60 0' * mySize_y), s, '0.60 0.60 0' * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, FALSE, '0.60 0.60 0' * mySize.y), s, '0.60 0.60 0' * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); s = _("^1Intermediate 1 (+15.42)"); - drawcolorcodedstring(pos + eX * 0.5 * mySize_x - '0.5 0 0' * stringwidth(s, TRUE, '1 1 0' * 0.20 * mySize_y) + eY * 0.60 * mySize_y, s, '1 1 0' * 0.20 * mySize_y, panel_fg_alpha, DRAWFLAG_NORMAL); + drawcolorcodedstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, TRUE, '1 1 0' * 0.20 * mySize.y) + eY * 0.60 * mySize.y, s, '1 1 0' * 0.20 * mySize.y, panel_fg_alpha, DRAWFLAG_NORMAL); s = sprintf(_("^1PENALTY: %.1f (%s)"), 2, "missing a checkpoint"); - drawcolorcodedstring(pos + eX * 0.5 * mySize_x - '0.5 0 0' * stringwidth(s, TRUE, '1 1 0' * 0.20 * mySize_y) + eY * 0.80 * mySize_y, s, '1 1 0' * 0.20 * mySize_y, panel_fg_alpha, DRAWFLAG_NORMAL); + drawcolorcodedstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, TRUE, '1 1 0' * 0.20 * mySize.y) + eY * 0.80 * mySize.y, s, '1 1 0' * 0.20 * mySize.y, panel_fg_alpha, DRAWFLAG_NORMAL); } else if(race_checkpointtime) { @@ -2456,7 +2457,7 @@ void HUD_RaceTimer (void) if(s != "" && a > 0) { - drawcolorcodedstring(pos + eX * 0.5 * mySize_x - '0.5 0 0' * stringwidth(s, TRUE, '1 1 0' * 0.2 * mySize_y) + eY * 0.6 * mySize_y, s, '1 1 0' * 0.2 * mySize_y, panel_fg_alpha * a, DRAWFLAG_NORMAL); + drawcolorcodedstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, TRUE, '1 1 0' * 0.2 * mySize.y) + eY * 0.6 * mySize.y, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL); } if(race_penaltytime) @@ -2465,14 +2466,14 @@ void HUD_RaceTimer (void) if(a > 0) { s = sprintf(_("^1PENALTY: %.1f (%s)"), race_penaltytime * 0.1, race_penaltyreason); - drawcolorcodedstring(pos + eX * 0.5 * mySize_x - '0.5 0 0' * stringwidth(s, TRUE, '1 1 0' * 0.2 * mySize_y) + eY * 0.8 * mySize_y, s, '1 1 0' * 0.2 * mySize_y, panel_fg_alpha * a, DRAWFLAG_NORMAL); + drawcolorcodedstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, TRUE, '1 1 0' * 0.2 * mySize.y) + eY * 0.8 * mySize.y, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL); } } if(forcetime != "") { a = bound(0, (time - race_checkpointtime) / 0.5, 1); - drawstring_expanding(pos + eX * 0.5 * mySize_x - '0.5 0 0' * stringwidth(forcetime, FALSE, '1 1 0' * 0.6 * mySize_y), forcetime, '1 1 0' * 0.6 * mySize_y, '1 1 1', panel_fg_alpha, 0, a); + drawstring_expanding(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(forcetime, FALSE, '1 1 0' * 0.6 * mySize.y), forcetime, '1 1 0' * 0.6 * mySize.y, '1 1 1', panel_fg_alpha, 0, a); } else a = 1; @@ -2480,7 +2481,7 @@ void HUD_RaceTimer (void) if(race_laptime && race_checkpoint != 255) { s = TIME_ENCODED_TOSTRING(TIME_ENCODE(time + TIME_DECODE(race_penaltyaccumulator) - race_laptime)); - drawstring(pos + eX * 0.5 * mySize_x - '0.5 0 0' * stringwidth(s, FALSE, '0.6 0.6 0' * mySize_y), s, '0.6 0.6 0' * mySize_y, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL); + drawstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, FALSE, '0.6 0.6 0' * mySize.y), s, '0.6 0.6 0' * mySize.y, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL); } } else @@ -2489,13 +2490,13 @@ void HUD_RaceTimer (void) { a = bound(0, 2 - (time - race_mycheckpointtime), 1); s = MakeRaceString(race_mycheckpoint, TIME_DECODE(race_mycheckpointdelta), -(race_mycheckpointenemy == ""), race_mycheckpointlapsdelta, race_mycheckpointenemy); - drawcolorcodedstring(pos + eX * 0.5 * mySize_x - '0.5 0 0' * stringwidth(s, TRUE, '1 1 0' * 0.2 * mySize_y) + eY * 0.6 * mySize_y, s, '1 1 0' * 0.2 * mySize_y, panel_fg_alpha * a, DRAWFLAG_NORMAL); + drawcolorcodedstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, TRUE, '1 1 0' * 0.2 * mySize.y) + eY * 0.6 * mySize.y, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL); } if(race_othercheckpointtime && race_othercheckpointenemy != "") { a = bound(0, 2 - (time - race_othercheckpointtime), 1); s = MakeRaceString(race_othercheckpoint, -TIME_DECODE(race_othercheckpointdelta), -(race_othercheckpointenemy == ""), race_othercheckpointlapsdelta, race_othercheckpointenemy); - drawcolorcodedstring(pos + eX * 0.5 * mySize_x - '0.5 0 0' * stringwidth(s, TRUE, '1 1 0' * 0.2 * mySize_y) + eY * 0.6 * mySize_y, s, '1 1 0' * 0.2 * mySize_y, panel_fg_alpha * a, DRAWFLAG_NORMAL); + drawcolorcodedstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, TRUE, '1 1 0' * 0.2 * mySize.y) + eY * 0.6 * mySize.y, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL); } if(race_penaltytime && !race_penaltyaccumulator) @@ -2508,7 +2509,7 @@ void HUD_RaceTimer (void) s = sprintf(_("^1PENALTY: %.1f (%s)"), (t - time) * 0.1, race_penaltyreason); else s = sprintf(_("^2PENALTY: %.1f (%s)"), 0, race_penaltyreason); - drawcolorcodedstring(pos + eX * 0.5 * mySize_x - '0.5 0 0' * stringwidth(s, TRUE, '1 1 0' * 0.2 * mySize_y) + eY * 0.6 * mySize_y, s, '1 1 0' * 0.2 * mySize_y, panel_fg_alpha * a, DRAWFLAG_NORMAL); + drawcolorcodedstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, TRUE, '1 1 0' * 0.2 * mySize.y) + eY * 0.6 * mySize.y, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL); } } } @@ -2605,61 +2606,61 @@ void HUD_Vote(void) // always force 3:1 aspect vector newSize = '0 0 0'; - if(mySize_x/mySize_y > 3) + if(mySize.x/mySize.y > 3) { - newSize_x = 3 * mySize_y; - newSize_y = mySize_y; + newSize_x = 3 * mySize.y; + newSize_y = mySize.y; - pos_x = pos_x + (mySize_x - newSize_x) / 2; + pos_x = pos.x + (mySize.x - newSize.x) / 2; } else { - newSize_y = 1/3 * mySize_x; - newSize_x = mySize_x; + newSize_y = 1/3 * mySize.x; + newSize_x = mySize.x; - pos_y = pos_y + (mySize_y - newSize_y) / 2; + pos_y = pos.y + (mySize.y - newSize.y) / 2; } mySize = newSize; s = _("A vote has been called for:"); if(uid2name_dialog) s = _("Allow servers to store and display your name?"); - drawstring_aspect(pos, s, eX * mySize_x + eY * (2/8) * mySize_y, '1 1 1', a, DRAWFLAG_NORMAL); - s = textShortenToWidth(vote_called_vote, mySize_x, '1 1 0' * mySize_y * (1/8), stringwidth_colors); + drawstring_aspect(pos, s, eX * mySize.x + eY * (2/8) * mySize.y, '1 1 1', a, DRAWFLAG_NORMAL); + s = textShortenToWidth(vote_called_vote, mySize.x, '1 1 0' * mySize.y * (1/8), stringwidth_colors); if(autocvar__hud_configure) s = _("^1Configure the HUD"); - drawcolorcodedstring_aspect(pos + eY * (2/8) * mySize_y, s, eX * mySize_x + eY * (1.75/8) * mySize_y, a, DRAWFLAG_NORMAL); + drawcolorcodedstring_aspect(pos + eY * (2/8) * mySize.y, s, eX * mySize.x + eY * (1.75/8) * mySize.y, a, DRAWFLAG_NORMAL); // print the yes/no counts s = sprintf(_("Yes (%s): %d"), getcommandkey("vyes", "vyes"), vote_yescount); - drawstring_aspect(pos + eY * (4/8) * mySize_y, s, eX * 0.5 * mySize_x + eY * (1.5/8) * mySize_y, '0 1 0', a, DRAWFLAG_NORMAL); + drawstring_aspect(pos + eY * (4/8) * mySize.y, s, eX * 0.5 * mySize.x + eY * (1.5/8) * mySize.y, '0 1 0', a, DRAWFLAG_NORMAL); s = sprintf(_("No (%s): %d"), getcommandkey("vno", "vno"), vote_nocount); - drawstring_aspect(pos + eX * 0.5 * mySize_x + eY * (4/8) * mySize_y, s, eX * 0.5 * mySize_x + eY * (1.5/8) * mySize_y, '1 0 0', a, DRAWFLAG_NORMAL); + drawstring_aspect(pos + eX * 0.5 * mySize.x + eY * (4/8) * mySize.y, s, eX * 0.5 * mySize.x + eY * (1.5/8) * mySize.y, '1 0 0', a, DRAWFLAG_NORMAL); // draw the progress bar backgrounds - drawpic_skin(pos + eY * (5/8) * mySize_y, "voteprogress_back", eX * mySize_x + eY * (3/8) * mySize_y, '1 1 1', a, DRAWFLAG_NORMAL); + drawpic_skin(pos + eY * (5/8) * mySize.y, "voteprogress_back", eX * mySize.x + eY * (3/8) * mySize.y, '1 1 1', a, DRAWFLAG_NORMAL); // draw the highlights if(vote_highlighted == 1) { - drawsetcliparea(pos_x, pos_y, mySize_x * 0.5, mySize_y); - drawpic_skin(pos + eY * (5/8) * mySize_y, "voteprogress_voted", eX * mySize_x + eY * (3/8) * mySize_y, '1 1 1', a, DRAWFLAG_NORMAL); + drawsetcliparea(pos.x, pos.y, mySize.x * 0.5, mySize.y); + drawpic_skin(pos + eY * (5/8) * mySize.y, "voteprogress_voted", eX * mySize.x + eY * (3/8) * mySize.y, '1 1 1', a, DRAWFLAG_NORMAL); } else if(vote_highlighted == -1) { - drawsetcliparea(pos_x + 0.5 * mySize_x, pos_y, mySize_x * 0.5, mySize_y); - drawpic_skin(pos + eY * (5/8) * mySize_y, "voteprogress_voted", eX * mySize_x + eY * (3/8) * mySize_y, '1 1 1', a, DRAWFLAG_NORMAL); + drawsetcliparea(pos.x + 0.5 * mySize.x, pos.y, mySize.x * 0.5, mySize.y); + drawpic_skin(pos + eY * (5/8) * mySize.y, "voteprogress_voted", eX * mySize.x + eY * (3/8) * mySize.y, '1 1 1', a, DRAWFLAG_NORMAL); } // draw the progress bars if(vote_yescount && vote_needed) { - drawsetcliparea(pos_x, pos_y, mySize_x * 0.5 * (vote_yescount/vote_needed), mySize_y); - drawpic_skin(pos + eY * (5/8) * mySize_y, "voteprogress_prog", eX * mySize_x + eY * (3/8) * mySize_y, '1 1 1', a, DRAWFLAG_NORMAL); + drawsetcliparea(pos.x, pos.y, mySize.x * 0.5 * (vote_yescount/vote_needed), mySize.y); + drawpic_skin(pos + eY * (5/8) * mySize.y, "voteprogress_prog", eX * mySize.x + eY * (3/8) * mySize.y, '1 1 1', a, DRAWFLAG_NORMAL); } if(vote_nocount && vote_needed) { - drawsetcliparea(pos_x + mySize_x - mySize_x * 0.5 * (vote_nocount/vote_needed), pos_y, mySize_x * 0.5, mySize_y); - drawpic_skin(pos + eY * (5/8) * mySize_y, "voteprogress_prog", eX * mySize_x + eY * (3/8) * mySize_y, '1 1 1', a, DRAWFLAG_NORMAL); + drawsetcliparea(pos.x + mySize.x - mySize.x * 0.5 * (vote_nocount/vote_needed), pos.y, mySize.x * 0.5, mySize.y); + drawpic_skin(pos + eY * (5/8) * mySize.y, "voteprogress_prog", eX * mySize.x + eY * (3/8) * mySize.y, '1 1 1', a, DRAWFLAG_NORMAL); } drawresetcliparea(); @@ -2700,23 +2701,23 @@ void DrawCAItem(vector myPos, vector mySize, float aspect_ratio, int layout, flo break; } - if(mySize_x/mySize_y > aspect_ratio) + if(mySize.x/mySize.y > aspect_ratio) { - i = aspect_ratio * mySize_y; - myPos_x = myPos_x + (mySize_x - i) / 2; + i = aspect_ratio * mySize.y; + myPos_x = myPos.x + (mySize.x - i) / 2; mySize_x = i; } else { - i = 1/aspect_ratio * mySize_x; - myPos_y = myPos_y + (mySize_y - i) / 2; + i = 1/aspect_ratio * mySize.x; + myPos_y = myPos.y + (mySize.y - i) / 2; mySize_y = i; } if(layout) { - drawpic_aspect_skin(myPos, pic, eX * 0.7 * mySize_x + eY * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); - drawstring_aspect(myPos + eX * 0.7 * mySize_x, ftos(stat), eX * 0.3 * mySize_x + eY * mySize_y, color, panel_fg_alpha, DRAWFLAG_NORMAL); + drawpic_aspect_skin(myPos, pic, eX * 0.7 * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawstring_aspect(myPos + eX * 0.7 * mySize.x, ftos(stat), eX * 0.3 * mySize.x + eY * mySize.y, color, panel_fg_alpha, DRAWFLAG_NORMAL); } else drawstring_aspect(myPos, ftos(stat), mySize, color, panel_fg_alpha, DRAWFLAG_NORMAL); @@ -2733,7 +2734,7 @@ void HUD_Mod_CA(vector myPos, vector mySize) else //if(gametype == MAPINFO_TYPE_FREEZETAG) layout = autocvar_hud_panel_modicons_freezetag_layout; float rows, columns, aspect_ratio; - rows = mySize_y/mySize_x; + rows = mySize.y/mySize.x; aspect_ratio = (layout) ? 2 : 1; rows = bound(1, floor((sqrt((4 * aspect_ratio * team_count + rows) * rows) + rows + 0.5) / 2), team_count); columns = ceil(team_count/rows); @@ -2741,10 +2742,10 @@ void HUD_Mod_CA(vector myPos, vector mySize) int i; float row = 0, column = 0; vector pos, itemSize; - itemSize = eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows); + itemSize = eX * mySize.x*(1/columns) + eY * mySize.y*(1/rows); for(i=0; i mySize_y) { + if(mySize.x > mySize.y) { if (myteam == NUM_TEAM_1) { // always draw own flag on left redflag_pos = pos; - blueflag_pos = pos + eX * 0.5 * mySize_x; + blueflag_pos = pos + eX * 0.5 * mySize.x; } else { blueflag_pos = pos; - redflag_pos = pos + eX * 0.5 * mySize_x; + redflag_pos = pos + eX * 0.5 * mySize.x; } - flag_size = eX * 0.5 * mySize_x + eY * mySize_y; + flag_size = eX * 0.5 * mySize.x + eY * mySize.y; } else { if (myteam == NUM_TEAM_1) { // always draw own flag on left redflag_pos = pos; - blueflag_pos = pos + eY * 0.5 * mySize_y; + blueflag_pos = pos + eY * 0.5 * mySize.y; } else { blueflag_pos = pos; - redflag_pos = pos + eY * 0.5 * mySize_y; + redflag_pos = pos + eY * 0.5 * mySize.y; } - flag_size = eY * 0.5 * mySize_y + eX * mySize_x; + flag_size = eY * 0.5 * mySize.y + eX * mySize.x; } f = bound(0, redflag_statuschange_elapsedtime*2, 1); @@ -2951,30 +2952,30 @@ void HUD_Mod_KH(vector pos, vector mySize) vector slot_size; - if(all_keys == 4 && mySize_x * 0.5 < mySize_y && mySize_y * 0.5 < mySize_x) + if(all_keys == 4 && mySize.x * 0.5 < mySize.y && mySize.y * 0.5 < mySize.x) { // Quadratic arrangement - slot_size = eX * mySize_x * 0.5 + eY * mySize_y * 0.5; + slot_size = eX * mySize.x * 0.5 + eY * mySize.y * 0.5; KH_SLOTS[0] = pos; - KH_SLOTS[1] = pos + eX * slot_size_x; - KH_SLOTS[2] = pos + eY * slot_size_y; - KH_SLOTS[3] = pos + eX * slot_size_x + eY * slot_size_y; + KH_SLOTS[1] = pos + eX * slot_size.x; + KH_SLOTS[2] = pos + eY * slot_size.y; + KH_SLOTS[3] = pos + eX * slot_size.x + eY * slot_size.y; } else { - if(mySize_x > mySize_y) + if(mySize.x > mySize.y) { // Horizontal arrangement - slot_size = eX * mySize_x / all_keys + eY * mySize_y; + slot_size = eX * mySize.x / all_keys + eY * mySize.y; for(i = 0; i < all_keys; ++i) - KH_SLOTS[i] = pos + eX * slot_size_x * i; + KH_SLOTS[i] = pos + eX * slot_size.x * i; } else { // Vertical arrangement - slot_size = eX * mySize_x + eY * mySize_y / all_keys; + slot_size = eX * mySize.x + eY * mySize.y / all_keys; for(i = 0; i < all_keys; ++i) - KH_SLOTS[i] = pos + eY * slot_size_y * i; + KH_SLOTS[i] = pos + eY * slot_size.y * i; } } @@ -3064,12 +3065,12 @@ void HUD_Mod_Keepaway(vector pos, vector mySize) vector kaball_pos, kaball_size; - if(mySize_x > mySize_y) { - kaball_pos = pos + eX * 0.25 * mySize_x; - kaball_size = eX * 0.5 * mySize_x + eY * mySize_y; + if(mySize.x > mySize.y) { + kaball_pos = pos + eX * 0.25 * mySize.x; + kaball_size = eX * 0.5 * mySize.x + eY * mySize.y; } else { - kaball_pos = pos + eY * 0.25 * mySize_y; - kaball_size = eY * 0.5 * mySize_y + eX * mySize_x; + kaball_pos = pos + eY * 0.25 * mySize.y; + kaball_size = eY * 0.5 * mySize.y + eX * mySize.x; } float kaball_statuschange_elapsedtime = time - kaball_statuschange_time; @@ -3079,7 +3080,7 @@ void HUD_Mod_Keepaway(vector pos, vector mySize) drawpic_aspect_skin_expanding(kaball_pos, "keepawayball_carrying", kaball_size, '1 1 1', panel_fg_alpha * kaball_alpha, DRAWFLAG_NORMAL, f); if(kaball) - drawpic_aspect_skin(pos, "keepawayball_carrying", eX * mySize_x + eY * mySize_y, '1 1 1', panel_fg_alpha * kaball_alpha * f, DRAWFLAG_NORMAL); + drawpic_aspect_skin(pos, "keepawayball_carrying", eX * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha * kaball_alpha * f, DRAWFLAG_NORMAL); } @@ -3105,11 +3106,11 @@ void HUD_Mod_NexBall(vector pos, vector mySize) if (p > 1) p = 2 - p; - HUD_Panel_DrawProgressBar(pos, mySize, "progressbar", p, (mySize_x <= mySize_y), 0, autocvar_hud_progressbar_nexball_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); + HUD_Panel_DrawProgressBar(pos, mySize, "progressbar", p, (mySize.x <= mySize.y), 0, autocvar_hud_progressbar_nexball_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); } if (stat_items & IT_KEY1) - drawpic_aspect_skin(pos, "nexball_carrying", eX * mySize_x + eY * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawpic_aspect_skin(pos, "nexball_carrying", eX * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); } // Race/CTS HUD mod icons @@ -3158,16 +3159,16 @@ void HUD_Mod_Race(vector pos, vector mySize) vector textPos, medalPos; float squareSize; - if(mySize_x > mySize_y) { + if(mySize.x > mySize.y) { // text on left side - squareSize = min(mySize_y, mySize_x/2); - textPos = pos + eX * 0.5 * max(0, mySize_x/2 - squareSize) + eY * 0.5 * (mySize_y - squareSize); - medalPos = pos + eX * 0.5 * max(0, mySize_x/2 - squareSize) + eX * 0.5 * mySize_x + eY * 0.5 * (mySize_y - squareSize); + squareSize = min(mySize.y, mySize.x/2); + textPos = pos + eX * 0.5 * max(0, mySize.x/2 - squareSize) + eY * 0.5 * (mySize.y - squareSize); + medalPos = pos + eX * 0.5 * max(0, mySize.x/2 - squareSize) + eX * 0.5 * mySize.x + eY * 0.5 * (mySize.y - squareSize); } else { // text on top - squareSize = min(mySize_x, mySize_y/2); - textPos = pos + eY * 0.5 * max(0, mySize_y/2 - squareSize) + eX * 0.5 * (mySize_x - squareSize); - medalPos = pos + eY * 0.5 * max(0, mySize_y/2 - squareSize) + eY * 0.5 * mySize_y + eX * 0.5 * (mySize_x - squareSize); + squareSize = min(mySize.x, mySize.y/2); + textPos = pos + eY * 0.5 * max(0, mySize.y/2 - squareSize) + eX * 0.5 * (mySize.x - squareSize); + medalPos = pos + eY * 0.5 * max(0, mySize.y/2 - squareSize) + eY * 0.5 * mySize.y + eX * 0.5 * (mySize.x - squareSize); } f = time - crecordtime_change_time; @@ -3290,16 +3291,16 @@ void DrawDomItem(vector myPos, vector mySize, float aspect_ratio, int layout, fl } float pps_ratio = stat / getstatf(STAT_DOM_TOTAL_PPS); - if(mySize_x/mySize_y > aspect_ratio) + if(mySize.x/mySize.y > aspect_ratio) { - i = aspect_ratio * mySize_y; - myPos_x = myPos_x + (mySize_x - i) / 2; + i = aspect_ratio * mySize.y; + myPos_x = myPos.x + (mySize.x - i) / 2; mySize_x = i; } else { - i = 1/aspect_ratio * mySize_x; - myPos_y = myPos_y + (mySize_y - i) / 2; + i = 1/aspect_ratio * mySize.x; + myPos_y = myPos.y + (mySize.y - i) / 2; mySize_y = i; } @@ -3308,17 +3309,17 @@ void DrawDomItem(vector myPos, vector mySize, float aspect_ratio, int layout, fl //draw the text color *= 0.5 + pps_ratio * (1 - 0.5); // half saturated color at min, full saturated at max if (layout == 2) // average pps - drawstring_aspect(myPos + eX * mySize_y, ftos_decimals(stat, 2), eX * (2/3) * mySize_x + eY * mySize_y, color, panel_fg_alpha, DRAWFLAG_NORMAL); + drawstring_aspect(myPos + eX * mySize.y, ftos_decimals(stat, 2), eX * (2/3) * mySize.x + eY * mySize.y, color, panel_fg_alpha, DRAWFLAG_NORMAL); else // percentage of average pps - drawstring_aspect(myPos + eX * mySize_y, strcat( ftos(floor(pps_ratio*100 + 0.5)), "%" ), eX * (2/3) * mySize_x + eY * mySize_y, color, panel_fg_alpha, DRAWFLAG_NORMAL); + drawstring_aspect(myPos + eX * mySize.y, strcat( ftos(floor(pps_ratio*100 + 0.5)), "%" ), eX * (2/3) * mySize.x + eY * mySize.y, color, panel_fg_alpha, DRAWFLAG_NORMAL); } //draw the icon - drawpic_aspect_skin(myPos, pic, '1 1 0' * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawpic_aspect_skin(myPos, pic, '1 1 0' * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); if (stat > 0) { - drawsetcliparea(myPos_x, myPos_y + mySize_y * (1 - pps_ratio), mySize_y, mySize_y * pps_ratio); - drawpic_aspect_skin(myPos, strcat(pic, "-highlighted"), '1 1 0' * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawsetcliparea(myPos.x, myPos.y + mySize.y * (1 - pps_ratio), mySize.y, mySize.y * pps_ratio); + drawpic_aspect_skin(myPos, strcat(pic, "-highlighted"), '1 1 0' * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); drawresetcliparea(); } } @@ -3329,7 +3330,7 @@ void HUD_Mod_Dom(vector myPos, vector mySize) int layout = autocvar_hud_panel_modicons_dom_layout; float rows, columns, aspect_ratio; - rows = mySize_y/mySize_x; + rows = mySize.y/mySize.x; aspect_ratio = (layout) ? 3 : 1; rows = bound(1, floor((sqrt((4 * aspect_ratio * team_count + rows) * rows) + rows + 0.5) / 2), team_count); columns = ceil(team_count/rows); @@ -3337,10 +3338,10 @@ void HUD_Mod_Dom(vector myPos, vector mySize) int i; float row = 0, column = 0; vector pos, itemSize; - itemSize = eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows); + itemSize = eX * mySize.x*(1/columns) + eY * mySize.y*(1/rows); for(i=0; i aspect) + if(mySize.x/mySize.y > aspect) { - newSize_x = aspect * mySize_y; - newSize_y = mySize_y; + newSize_x = aspect * mySize.y; + newSize_y = mySize.y; - pos_x = pos_x + (mySize_x - newSize_x) / 2; + pos_x = pos.x + (mySize.x - newSize.x) / 2; } else { - newSize_y = 1/aspect * mySize_x; - newSize_x = mySize_x; + newSize_y = 1/aspect * mySize.x; + newSize_x = mySize.x; - pos_y = pos_y + (mySize_y - newSize_y) / 2; + pos_y = pos.y + (mySize.y - newSize.y) / 2; } mySize = newSize; } vector keysize; - keysize = eX * mySize_x * (1/3.0) + eY * mySize_y * (1/(3.0 - !autocvar_hud_panel_pressedkeys_attack)); + keysize = eX * mySize.x * (1/3.0) + eY * mySize.y * (1/(3.0 - !autocvar_hud_panel_pressedkeys_attack)); float pressedkeys; pressedkeys = getstatf(STAT_PRESSED_KEYS); if(autocvar_hud_panel_pressedkeys_attack) { - drawpic_aspect_skin(pos + eX * keysize_x * 0.5, ((pressedkeys & KEY_ATCK) ? "key_atck_inv.tga" : "key_atck.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); - drawpic_aspect_skin(pos + eX * keysize_x * 1.5, ((pressedkeys & KEY_ATCK2) ? "key_atck_inv.tga" : "key_atck.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); - pos_y += keysize_y; + drawpic_aspect_skin(pos + eX * keysize.x * 0.5, ((pressedkeys & KEY_ATCK) ? "key_atck_inv.tga" : "key_atck.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawpic_aspect_skin(pos + eX * keysize.x * 1.5, ((pressedkeys & KEY_ATCK2) ? "key_atck_inv.tga" : "key_atck.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + pos.y += keysize.y; } drawpic_aspect_skin(pos, ((pressedkeys & KEY_CROUCH) ? "key_crouch_inv.tga" : "key_crouch.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); - drawpic_aspect_skin(pos + eX * keysize_x, ((pressedkeys & KEY_FORWARD) ? "key_forward_inv.tga" : "key_forward.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); - drawpic_aspect_skin(pos + eX * keysize_x * 2, ((pressedkeys & KEY_JUMP) ? "key_jump_inv.tga" : "key_jump.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); - pos_y += keysize_y; + drawpic_aspect_skin(pos + eX * keysize.x, ((pressedkeys & KEY_FORWARD) ? "key_forward_inv.tga" : "key_forward.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawpic_aspect_skin(pos + eX * keysize.x * 2, ((pressedkeys & KEY_JUMP) ? "key_jump_inv.tga" : "key_jump.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + pos.y += keysize.y; drawpic_aspect_skin(pos, ((pressedkeys & KEY_LEFT) ? "key_left_inv.tga" : "key_left.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); - drawpic_aspect_skin(pos + eX * keysize_x, ((pressedkeys & KEY_BACKWARD) ? "key_backward_inv.tga" : "key_backward.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); - drawpic_aspect_skin(pos + eX * keysize_x * 2, ((pressedkeys & KEY_RIGHT) ? "key_right_inv.tga" : "key_right.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawpic_aspect_skin(pos + eX * keysize.x, ((pressedkeys & KEY_BACKWARD) ? "key_backward_inv.tga" : "key_backward.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawpic_aspect_skin(pos + eX * keysize.x * 2, ((pressedkeys & KEY_RIGHT) ? "key_right_inv.tga" : "key_right.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); } // Handle chat as a panel (#12) @@ -3535,11 +3536,11 @@ void HUD_Chat(void) if (!autocvar_con_chatrect) cvar_set("con_chatrect", "1"); - cvar_set("con_chatrect_x", ftos(pos_x/vid_conwidth)); - cvar_set("con_chatrect_y", ftos(pos_y/vid_conheight)); + cvar_set("con_chatrect_x", ftos(pos.x/vid_conwidth)); + cvar_set("con_chatrect_y", ftos(pos.y/vid_conheight)); - cvar_set("con_chatwidth", ftos(mySize_x/vid_conwidth)); - cvar_set("con_chat", ftos(floor(mySize_y/autocvar_con_chatsize - 0.5))); + cvar_set("con_chatwidth", ftos(mySize.x/vid_conwidth)); + cvar_set("con_chat", ftos(floor(mySize.y/autocvar_con_chatsize - 0.5))); if(autocvar__hud_configure) { @@ -3553,8 +3554,8 @@ void HUD_Chat(void) a = panel_fg_alpha; else a = panel_fg_alpha * floor(((i + 1) * 7 + autocvar_con_chattime)/45); - drawcolorcodedstring(pos, textShortenToWidth(_("^3Player^7: This is the chat area."), mySize_x, chatsize, stringwidth_colors), chatsize, a, DRAWFLAG_NORMAL); - pos_y += chatsize_y; + drawcolorcodedstring(pos, textShortenToWidth(_("^3Player^7: This is the chat area."), mySize.x, chatsize, stringwidth_colors), chatsize, a, DRAWFLAG_NORMAL); + pos.y += chatsize.y; } } } @@ -3625,9 +3626,9 @@ void HUD_EngineInfo(void) // #define drawInfoMessage(s)\ if(autocvar_hud_panel_infomessages_flip)\ - o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize);\ + o_x = pos.x + mySize.x - stringwidth(s, TRUE, fontsize);\ drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL);\ - o_y += fontsize_y; + o.y += fontsize.y; void HUD_InfoMessages(void) { if(!autocvar__hud_configure) @@ -3649,19 +3650,19 @@ void HUD_InfoMessages(void) // always force 5:1 aspect vector newSize = '0 0 0'; - if(mySize_x/mySize_y > 5) + if(mySize.x/mySize.y > 5) { - newSize_x = 5 * mySize_y; - newSize_y = mySize_y; + newSize_x = 5 * mySize.y; + newSize_y = mySize.y; - pos_x = pos_x + (mySize_x - newSize_x) / 2; + pos_x = pos.x + (mySize.x - newSize.x) / 2; } else { - newSize_y = 1/5 * mySize_x; - newSize_x = mySize_x; + newSize_y = 1/5 * mySize.x; + newSize_x = mySize.x; - pos_y = pos_y + (mySize_y - newSize_y) / 2; + pos_y = pos.y + (mySize.y - newSize.y) / 2; } mySize = newSize; @@ -3670,7 +3671,7 @@ void HUD_InfoMessages(void) o = pos; vector fontsize; - fontsize = '0.20 0.20 0' * mySize_y; + fontsize = '0.20 0.20 0' * mySize.y; float a; a = panel_fg_alpha; @@ -3724,7 +3725,7 @@ void HUD_InfoMessages(void) countdown = ceil(getstatf(STAT_GAMESTARTTIME) - time); s = sprintf(_("^1Game starts in ^3%d^1 seconds"), countdown); drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL); - o_y += fontsize_y; + o.y += fontsize.y; } } if(warmup_stage && !intermission) @@ -3875,7 +3876,7 @@ void HUD_Physics(void) else if(autocvar_hud_panel_physics_speed_vertical) speed = floor( vlen(vel) * conversion_factor + 0.5 ); else - speed = floor( vlen(vel - vel_z * '0 0 1') * conversion_factor + 0.5 ); + speed = floor( vlen(vel - vel.z * '0 0 1') * conversion_factor + 0.5 ); //compute acceleration float acceleration, f; @@ -3888,7 +3889,7 @@ void HUD_Physics(void) if(autocvar_hud_panel_physics_acceleration_vertical) acceleration = (vlen(vel) - vlen(acc_prevspeed)); else - acceleration = (vlen(vel - '0 0 1' * vel_z) - vlen(acc_prevspeed - '0 0 1' * acc_prevspeed_z)); + acceleration = (vlen(vel - '0 0 1' * vel.z) - vlen(acc_prevspeed - '0 0 1' * acc_prevspeed.z)); acceleration = acceleration * (1 / max(0.0001, f)) * (0.0254 / 9.80665); @@ -3900,23 +3901,23 @@ void HUD_Physics(void) } //compute layout - float panel_ar = panel_size_x/panel_size_y; + float panel_ar = panel_size.x/panel_size.y; vector speed_offset = '0 0 0', acceleration_offset = '0 0 0'; if (panel_ar >= 5 && !acceleration_progressbar_scale) { - panel_size_x *= 0.5; + panel_size.x *= 0.5; if (autocvar_hud_panel_physics_flip) - speed_offset_x = panel_size_x; + speed_offset_x = panel_size.x; else - acceleration_offset_x = panel_size_x; + acceleration_offset_x = panel_size.x; } else { - panel_size_y *= 0.5; + panel_size.y *= 0.5; if (autocvar_hud_panel_physics_flip) - speed_offset_y = panel_size_y; + speed_offset_y = panel_size.y; else - acceleration_offset_y = panel_size_y; + acceleration_offset_y = panel_size.y; } float speed_baralign, acceleration_baralign; if (autocvar_hud_panel_physics_baralign == 1) @@ -3943,26 +3944,26 @@ void HUD_Physics(void) vector tmp_offset = '0 0 0', tmp_size = '0 0 0'; if (autocvar_hud_panel_physics_text == 1 || autocvar_hud_panel_physics_text == 2) { - tmp_size_x = panel_size_x * 0.75; - tmp_size_y = panel_size_y * text_scale; + tmp_size_x = panel_size.x * 0.75; + tmp_size_y = panel_size.y * text_scale; if (speed_baralign) - tmp_offset_x = panel_size_x - tmp_size_x; + tmp_offset_x = panel_size.x - tmp_size.x; //else //tmp_offset_x = 0; - tmp_offset_y = (panel_size_y - tmp_size_y) / 2; + tmp_offset_y = (panel_size.y - tmp_size.y) / 2; drawstring_aspect(panel_pos + speed_offset + tmp_offset, ftos(speed), tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); //draw speed unit if (speed_baralign) tmp_offset_x = 0; else - tmp_offset_x = tmp_size_x; + tmp_offset_x = tmp_size.x; if (autocvar_hud_panel_physics_speed_unit_show) { //tmp_offset_y = 0; - tmp_size_x = panel_size_x * (1 - 0.75); - tmp_size_y = panel_size_y * 0.4 * text_scale; - tmp_offset_y = (panel_size_y * 0.4 - tmp_size_y) / 2; + tmp_size_x = panel_size.x * (1 - 0.75); + tmp_size_y = panel_size.y * 0.4 * text_scale; + tmp_offset_y = (panel_size.y * 0.4 - tmp_size.y) / 2; drawstring_aspect(panel_pos + speed_offset + tmp_offset, unit, tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); } } @@ -3998,30 +3999,30 @@ void HUD_Physics(void) if(speed < top_speed) if(autocvar_hud_panel_physics_progressbar == 1 || autocvar_hud_panel_physics_progressbar == 2) { - float peak_offset_x; + float peak_offsetX; vector peak_size = '0 0 0'; if (speed_baralign == 0) - peak_offset_x = min(top_speed, max_speed)/max_speed * panel_size_x; + peak_offsetX = min(top_speed, max_speed)/max_speed * panel_size.x; else if (speed_baralign == 1) - peak_offset_x = (1 - min(top_speed, max_speed)/max_speed) * panel_size_x; + peak_offsetX = (1 - min(top_speed, max_speed)/max_speed) * panel_size.x; else // if (speed_baralign == 2) - peak_offset_x = min(top_speed, max_speed)/max_speed * panel_size_x * 0.5; - peak_size_x = floor(panel_size_x * 0.01 + 1.5); - peak_size_y = panel_size_y; + peak_offsetX = min(top_speed, max_speed)/max_speed * panel_size.x * 0.5; + peak_size_x = floor(panel_size.x * 0.01 + 1.5); + peak_size_y = panel_size.y; if (speed_baralign == 2) // draw two peaks, on both sides { - drawfill(panel_pos + speed_offset + eX * (0.5 * panel_size_x + peak_offset_x - peak_size_x), peak_size, autocvar_hud_progressbar_speed_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); - drawfill(panel_pos + speed_offset + eX * (0.5 * panel_size_x - peak_offset_x + peak_size_x), peak_size, autocvar_hud_progressbar_speed_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); + drawfill(panel_pos + speed_offset + eX * (0.5 * panel_size.x + peak_offsetX - peak_size.x), peak_size, autocvar_hud_progressbar_speed_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); + drawfill(panel_pos + speed_offset + eX * (0.5 * panel_size.x - peak_offsetX + peak_size.x), peak_size, autocvar_hud_progressbar_speed_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); } else - drawfill(panel_pos + speed_offset + eX * (peak_offset_x - peak_size_x), peak_size, autocvar_hud_progressbar_speed_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); + drawfill(panel_pos + speed_offset + eX * (peak_offsetX - peak_size.x), peak_size, autocvar_hud_progressbar_speed_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); } //top speed - tmp_offset_y = panel_size_y * 0.4; - tmp_size_x = panel_size_x * (1 - 0.75); - tmp_size_y = (panel_size_y - tmp_offset_y) * text_scale; - tmp_offset_y += (panel_size_y - tmp_offset_y - tmp_size_y) / 2; + tmp_offset_y = panel_size.y * 0.4; + tmp_size_x = panel_size.x * (1 - 0.75); + tmp_size_y = (panel_size.y - tmp_offset.y) * text_scale; + tmp_offset.y += (panel_size.y - tmp_offset.y - tmp_size.y) / 2; drawstring_aspect(panel_pos + speed_offset + tmp_offset, ftos(top_speed), tmp_size, '1 0 0', f * panel_fg_alpha, DRAWFLAG_NORMAL); } else @@ -4044,12 +4045,12 @@ void HUD_Physics(void) if (acceleration_progressbar_scale) // allow progressbar to go out of panel bounds { - tmp_size = acceleration_progressbar_scale * panel_size_x * eX + panel_size_y * eY; + tmp_size = acceleration_progressbar_scale * panel_size.x * eX + panel_size.y * eY; if (acceleration_baralign == 1) - tmp_offset_x = panel_size_x - tmp_size_x; + tmp_offset_x = panel_size.x - tmp_size.x; else if (acceleration_baralign == 2 || acceleration_baralign == 3) - tmp_offset_x = (panel_size_x - tmp_size_x) / 2; + tmp_offset_x = (panel_size.x - tmp_size.x) / 2; else tmp_offset_x = 0; tmp_offset_y = 0; @@ -4062,10 +4063,10 @@ void HUD_Physics(void) HUD_Panel_DrawProgressBar(panel_pos + acceleration_offset + tmp_offset, tmp_size, "accelbar", f, 0, acceleration_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); } - tmp_size_x = panel_size_x; - tmp_size_y = panel_size_y * text_scale; + tmp_size_x = panel_size.x; + tmp_size_y = panel_size.y * text_scale; tmp_offset_x = 0; - tmp_offset_y = (panel_size_y - tmp_size_y) / 2; + tmp_offset_y = (panel_size.y - tmp_size.y) / 2; if (autocvar_hud_panel_physics_text == 1 || autocvar_hud_panel_physics_text == 3) drawstring_aspect(panel_pos + acceleration_offset + tmp_offset, strcat(ftos_decimals(acceleration, 2), "g"), tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); @@ -4225,12 +4226,12 @@ void HUD_CenterPrint (void) return; vector target_pos; - target_pos = eY * scoreboard_bottom + eX * 0.5 * (vid_conwidth - panel_size_x); + target_pos = eY * scoreboard_bottom + eX * 0.5 * (vid_conwidth - panel_size.x); - if(target_pos_y > panel_pos_y) + if(target_pos.y > panel_pos.y) { panel_pos = panel_pos + (target_pos - panel_pos) * sqrt(scoreboard_fade_alpha); - panel_size_y = min(panel_size_y, vid_conheight - scoreboard_bottom); + panel_size_y = min(panel_size.y, vid_conheight - scoreboard_bottom); } } @@ -4252,17 +4253,17 @@ void HUD_CenterPrint (void) // fontsize = '1 1 0' * height; height = vid_conheight/50 * autocvar_hud_panel_centerprint_fontscale; fontsize = '1 1 0' * height; - entries = bound(1, floor(panel_size_y/height), CENTERPRINT_MAX_ENTRIES); + entries = bound(1, floor(panel_size.y/height), CENTERPRINT_MAX_ENTRIES); float i, j, k, n, g; - float a, sz, align, current_msg_pos_y = 0, msg_size; + float a, sz, align, current_msg_posY = 0, msg_size; vector pos; string ts; float all_messages_expired = TRUE; pos = panel_pos; if (autocvar_hud_panel_centerprint_flip) - pos_y += panel_size_y; + pos.y += panel_size.y; align = bound(0, autocvar_hud_panel_centerprint_align, 1); for (g=0, i=0, j=cpm_index; i 0.5/255.0) // Otherwise guaranteed invisible - don't show. This is checked a second time after some multiplications with other factors were done so temporary changes of these cannot cause flicker. - drawcolorcodedstring(pos + eY * 0.5 * (1 - sz) * fontsize_y, ts, fontsize, a, DRAWFLAG_NORMAL); - pos_y += fontsize_y; + drawcolorcodedstring(pos + eY * 0.5 * (1 - sz) * fontsize.y, ts, fontsize, a, DRAWFLAG_NORMAL); + pos.y += fontsize.y; } else - pos_y += fontsize_y * CENTERPRINT_SPACING/2; + pos.y += fontsize.y * CENTERPRINT_SPACING/2; } } ++g; // move next position number up - msg_size = pos_y - msg_size; + msg_size = pos.y - msg_size; if (autocvar_hud_panel_centerprint_flip) { - pos_y = current_msg_pos_y - CENTERPRINT_SPACING * fontsize_y; + pos_y = current_msg_posY - CENTERPRINT_SPACING * fontsize.y; if (a < 1 && centerprint_msgID[j] == 0) // messages with id can be replaced just after they are faded out, so never move over them the next messages - pos_y += (msg_size + CENTERPRINT_SPACING * fontsize_y) * (1 - sqrt(sz)); + pos.y += (msg_size + CENTERPRINT_SPACING * fontsize.y) * (1 - sqrt(sz)); - if (pos_y < panel_pos_y) // check if the next message can be shown + if (pos.y < panel_pos.y) // check if the next message can be shown { drawfontscale = '1 1 0'; return; @@ -4372,11 +4373,11 @@ void HUD_CenterPrint (void) } else { - pos_y += CENTERPRINT_SPACING * fontsize_y; + pos.y += CENTERPRINT_SPACING * fontsize.y; if (a < 1 && centerprint_msgID[j] == 0) // messages with id can be replaced just after they are faded out, so never move over them the next messages - pos_y -= (msg_size + CENTERPRINT_SPACING * fontsize_y) * (1 - sqrt(sz)); + pos.y -= (msg_size + CENTERPRINT_SPACING * fontsize.y) * (1 - sqrt(sz)); - if(pos_y > panel_pos_y + panel_size_y - fontsize_y) // check if the next message can be shown + if(pos.y > panel_pos.y + panel_size.y - fontsize.y) // check if the next message can be shown { drawfontscale = '1 1 0'; return; diff --git a/qcsrc/client/hud_config.qc b/qcsrc/client/hud_config.qc index d36e7d869..43e8e578e 100644 --- a/qcsrc/client/hud_config.qc +++ b/qcsrc/client/hud_config.qc @@ -217,7 +217,7 @@ void HUD_Configure_Exit_Force() // check if move will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector vector HUD_Panel_CheckMove(vector myPos, vector mySize) { - float myCenter_x, myCenter_y, targCenter_x, targCenter_y; + vector myCenter, targCenter; vector myTarget = myPos; int i; for (i = 0; i < HUD_PANEL_NUM; ++i) { @@ -229,51 +229,51 @@ vector HUD_Panel_CheckMove(vector myPos, vector mySize) panel_pos -= '1 1 0' * panel_bg_border; panel_size += '2 2 0' * panel_bg_border; - if(myPos_y + mySize_y < panel_pos_y) + if(myPos.y + mySize.y < panel_pos.y) continue; - if(myPos_y > panel_pos_y + panel_size_y) + if(myPos.y > panel_pos.y + panel_size.y) continue; - if(myPos_x + mySize_x < panel_pos_x) + if(myPos.x + mySize.x < panel_pos.x) continue; - if(myPos_x > panel_pos_x + panel_size_x) + if(myPos.x > panel_pos.x + panel_size.x) continue; // OK, there IS a collision. - myCenter_x = myPos_x + 0.5 * mySize_x; - myCenter_y = myPos_y + 0.5 * mySize_y; + myCenter_x = myPos.x + 0.5 * mySize.x; + myCenter_y = myPos.y + 0.5 * mySize.y; - targCenter_x = panel_pos_x + 0.5 * panel_size_x; - targCenter_y = panel_pos_y + 0.5 * panel_size_y; + targCenter_x = panel_pos.x + 0.5 * panel_size.x; + targCenter_y = panel_pos.y + 0.5 * panel_size.y; - if(myCenter_x < targCenter_x && myCenter_y < targCenter_y) // top left (of the target panel) + if(myCenter.x < targCenter.x && myCenter.y < targCenter.y) // top left (of the target panel) { - if(myPos_x + mySize_x - panel_pos_x < myPos_y + mySize_y - panel_pos_y) // push it to the side - myTarget_x = panel_pos_x - mySize_x; + if(myPos.x + mySize.x - panel_pos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side + myTarget_x = panel_pos.x - mySize.x; else // push it upwards - myTarget_y = panel_pos_y - mySize_y; + myTarget_y = panel_pos.y - mySize.y; } - else if(myCenter_x > targCenter_x && myCenter_y < targCenter_y) // top right + else if(myCenter.x > targCenter.x && myCenter.y < targCenter.y) // top right { - if(panel_pos_x + panel_size_x - myPos_x < myPos_y + mySize_y - panel_pos_y) // push it to the side - myTarget_x = panel_pos_x + panel_size_x; + if(panel_pos.x + panel_size.x - myPos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side + myTarget_x = panel_pos.x + panel_size.x; else // push it upwards - myTarget_y = panel_pos_y - mySize_y; + myTarget_y = panel_pos.y - mySize.y; } - else if(myCenter_x < targCenter_x && myCenter_y > targCenter_y) // bottom left + else if(myCenter.x < targCenter.x && myCenter.y > targCenter.y) // bottom left { - if(myPos_x + mySize_x - panel_pos_x < panel_pos_y + panel_size_y - myPos_y) // push it to the side - myTarget_x = panel_pos_x - mySize_x; + if(myPos.x + mySize.x - panel_pos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side + myTarget_x = panel_pos.x - mySize.x; else // push it downwards - myTarget_y = panel_pos_y + panel_size_y; + myTarget_y = panel_pos.y + panel_size.y; } - else if(myCenter_x > targCenter_x && myCenter_y > targCenter_y) // bottom right + else if(myCenter.x > targCenter.x && myCenter.y > targCenter.y) // bottom right { - if(panel_pos_x + panel_size_x - myPos_x < panel_pos_y + panel_size_y - myPos_y) // push it to the side - myTarget_x = panel_pos_x + panel_size_x; + if(panel_pos.x + panel_size.x - myPos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side + myTarget_x = panel_pos.x + panel_size.x; else // push it downwards - myTarget_y = panel_pos_y + panel_size_y; + myTarget_y = panel_pos.y + panel_size.y; } //if(cvar("hud_configure_checkcollisions_debug")) //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL); @@ -294,18 +294,18 @@ void HUD_Panel_SetPos(vector pos) if(autocvar_hud_configure_grid) { - pos_x = floor((pos_x/vid_conwidth)/hud_configure_gridSize_x + 0.5) * hud_configure_realGridSize_x; - pos_y = floor((pos_y/vid_conheight)/hud_configure_gridSize_y + 0.5) * hud_configure_realGridSize_y; + pos_x = floor((pos.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x; + pos_y = floor((pos.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y; } if(hud_configure_checkcollisions) pos = HUD_Panel_CheckMove(pos, mySize); - pos_x = bound(0, pos_x, vid_conwidth - mySize_x); - pos_y = bound(0, pos_y, vid_conheight - mySize_y); + pos_x = bound(0, pos.x, vid_conwidth - mySize.x); + pos_y = bound(0, pos.y, vid_conheight - mySize.y); string s; - s = strcat(ftos(pos_x/vid_conwidth), " ", ftos(pos_y/vid_conheight)); + s = strcat(ftos(pos.x/vid_conwidth), " ", ftos(pos.y/vid_conheight)); cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s); } @@ -316,9 +316,9 @@ vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) { vector targEndPos; - float dist_x, dist_y; + vector dist; float ratio; - ratio = mySize_x/mySize_y; + ratio = mySize.x/mySize.y; for (i = 0; i < HUD_PANEL_NUM; ++i) { panel = hud_panel[i]; @@ -332,19 +332,19 @@ vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) { targEndPos = panel_pos + panel_size; // resizeorigin is WITHIN target panel, just abort any collision testing against that particular panel to produce expected behaviour! - if(resizeorigin_x > panel_pos_x && resizeorigin_x < targEndPos_x && resizeorigin_y > panel_pos_y && resizeorigin_y < targEndPos_y) + if(resizeorigin.x > panel_pos.x && resizeorigin.x < targEndPos.x && resizeorigin.y > panel_pos.y && resizeorigin.y < targEndPos.y) continue; if (resizeCorner == 1) { // check if this panel is on our way - if (resizeorigin_x <= panel_pos_x) + if (resizeorigin.x <= panel_pos.x) continue; - if (resizeorigin_y <= panel_pos_y) + if (resizeorigin.y <= panel_pos.y) continue; - if (targEndPos_x <= resizeorigin_x - mySize_x) + if (targEndPos.x <= resizeorigin.x - mySize.x) continue; - if (targEndPos_y <= resizeorigin_y - mySize_y) + if (targEndPos.y <= resizeorigin.y - mySize.y) continue; // there is a collision: @@ -353,66 +353,66 @@ vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) { // // dist is the distance between resizeorigin and the "analogous" point of the panel // in this case between resizeorigin (bottom-right point) and the bottom-right point of the panel - dist_x = resizeorigin_x - targEndPos_x; - dist_y = resizeorigin_y - targEndPos_y; - if (dist_y <= 0 || dist_x / dist_y > ratio) - mySize_x = min(mySize_x, dist_x); + dist_x = resizeorigin.x - targEndPos.x; + dist_y = resizeorigin.y - targEndPos.y; + if (dist.y <= 0 || dist.x / dist.y > ratio) + mySize_x = min(mySize.x, dist.x); else - mySize_y = min(mySize_y, dist_y); + mySize_y = min(mySize.y, dist.y); } else if (resizeCorner == 2) { - if (resizeorigin_x >= targEndPos_x) + if (resizeorigin.x >= targEndPos.x) continue; - if (resizeorigin_y <= panel_pos_y) + if (resizeorigin.y <= panel_pos.y) continue; - if (panel_pos_x >= resizeorigin_x + mySize_x) + if (panel_pos.x >= resizeorigin.x + mySize.x) continue; - if (targEndPos_y <= resizeorigin_y - mySize_y) + if (targEndPos.y <= resizeorigin.y - mySize.y) continue; - dist_x = panel_pos_x - resizeorigin_x; - dist_y = resizeorigin_y - targEndPos_y; - if (dist_y <= 0 || dist_x / dist_y > ratio) - mySize_x = min(mySize_x, dist_x); + dist_x = panel_pos.x - resizeorigin.x; + dist_y = resizeorigin.y - targEndPos.y; + if (dist.y <= 0 || dist.x / dist.y > ratio) + mySize_x = min(mySize.x, dist.x); else - mySize_y = min(mySize_y, dist_y); + mySize_y = min(mySize.y, dist.y); } else if (resizeCorner == 3) { - if (resizeorigin_x <= panel_pos_x) + if (resizeorigin.x <= panel_pos.x) continue; - if (resizeorigin_y >= targEndPos_y) + if (resizeorigin.y >= targEndPos.y) continue; - if (targEndPos_x <= resizeorigin_x - mySize_x) + if (targEndPos.x <= resizeorigin.x - mySize.x) continue; - if (panel_pos_y >= resizeorigin_y + mySize_y) + if (panel_pos.y >= resizeorigin.y + mySize.y) continue; - dist_x = resizeorigin_x - targEndPos_x; - dist_y = panel_pos_y - resizeorigin_y; - if (dist_y <= 0 || dist_x / dist_y > ratio) - mySize_x = min(mySize_x, dist_x); + dist_x = resizeorigin.x - targEndPos.x; + dist_y = panel_pos.y - resizeorigin.y; + if (dist.y <= 0 || dist.x / dist.y > ratio) + mySize_x = min(mySize.x, dist.x); else - mySize_y = min(mySize_y, dist_y); + mySize_y = min(mySize.y, dist.y); } else if (resizeCorner == 4) { - if (resizeorigin_x >= targEndPos_x) + if (resizeorigin.x >= targEndPos.x) continue; - if (resizeorigin_y >= targEndPos_y) + if (resizeorigin.y >= targEndPos.y) continue; - if (panel_pos_x >= resizeorigin_x + mySize_x) + if (panel_pos.x >= resizeorigin.x + mySize.x) continue; - if (panel_pos_y >= resizeorigin_y + mySize_y) + if (panel_pos.y >= resizeorigin.y + mySize.y) continue; - dist_x = panel_pos_x - resizeorigin_x; - dist_y = panel_pos_y - resizeorigin_y; - if (dist_y <= 0 || dist_x / dist_y > ratio) - mySize_x = min(mySize_x, dist_x); + dist_x = panel_pos.x - resizeorigin.x; + dist_y = panel_pos.y - resizeorigin.y; + if (dist.y <= 0 || dist.x / dist.y > ratio) + mySize_x = min(mySize.x, dist.x); else - mySize_y = min(mySize_y, dist_y); + mySize_y = min(mySize.y, dist.y); } //if(cvar("hud_configure_checkcollisions_debug")) //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL); @@ -430,13 +430,13 @@ void HUD_Panel_SetPosSize(vector mySize) vector myPos; // minimum panel size cap - mySize_x = max(0.025 * vid_conwidth, mySize_x); - mySize_y = max(0.025 * vid_conheight, mySize_y); + mySize_x = max(0.025 * vid_conwidth, mySize.x); + mySize_y = max(0.025 * vid_conheight, mySize.y); if(highlightedPanel == HUD_PANEL(CHAT)) // some panels have their own restrictions, like the chat panel (which actually only moves the engine chat print around). Looks bad if it's too small. { - mySize_x = max(17 * autocvar_con_chatsize, mySize_x); - mySize_y = max(2 * autocvar_con_chatsize + 2 * panel_bg_padding, mySize_y); + mySize_x = max(17 * autocvar_con_chatsize, mySize.x); + mySize_y = max(2 * autocvar_con_chatsize + 2 * panel_bg_padding, mySize.y); } // collision testing| @@ -444,30 +444,30 @@ void HUD_Panel_SetPosSize(vector mySize) // we need to know pos at this stage, but it might still change later if we hit a screen edge/other panel (?) if(resizeCorner == 1) { - myPos_x = resizeorigin_x - mySize_x; - myPos_y = resizeorigin_y - mySize_y; + myPos_x = resizeorigin.x - mySize.x; + myPos_y = resizeorigin.y - mySize.y; } else if(resizeCorner == 2) { - myPos_x = resizeorigin_x; - myPos_y = resizeorigin_y - mySize_y; + myPos_x = resizeorigin.x; + myPos_y = resizeorigin.y - mySize.y; } else if(resizeCorner == 3) { - myPos_x = resizeorigin_x - mySize_x; - myPos_y = resizeorigin_y; + myPos_x = resizeorigin.x - mySize.x; + myPos_y = resizeorigin.y; } else { // resizeCorner == 4 - myPos_x = resizeorigin_x; - myPos_y = resizeorigin_y; + myPos_x = resizeorigin.x; + myPos_y = resizeorigin.y; } // left/top screen edges - if(myPos_x < 0) - mySize_x = mySize_x + myPos_x; - if(myPos_y < 0) - mySize_y = mySize_y + myPos_y; + if(myPos.x < 0) + mySize_x = mySize.x + myPos.x; + if(myPos.y < 0) + mySize_y = mySize.y + myPos.y; // bottom/right screen edges - if(myPos_x + mySize_x > vid_conwidth) - mySize_x = vid_conwidth - myPos_x; - if(myPos_y + mySize_y > vid_conheight) - mySize_y = vid_conheight - myPos_y; + if(myPos.x + mySize.x > vid_conwidth) + mySize_x = vid_conwidth - myPos.x; + if(myPos.y + mySize.y > vid_conheight) + mySize_y = vid_conheight - myPos.y; //if(cvar("hud_configure_checkcollisions_debug")) //drawfill(myPos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL); @@ -475,40 +475,40 @@ void HUD_Panel_SetPosSize(vector mySize) // before checkresize, otherwise panel can be snapped partially inside another panel or panel aspect ratio can be broken if(autocvar_hud_configure_grid) { - mySize_x = floor((mySize_x/vid_conwidth)/hud_configure_gridSize_x + 0.5) * hud_configure_realGridSize_x; - mySize_y = floor((mySize_y/vid_conheight)/hud_configure_gridSize_y + 0.5) * hud_configure_realGridSize_y; + mySize_x = floor((mySize.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x; + mySize_y = floor((mySize.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y; } if(hud_configure_checkcollisions) mySize = HUD_Panel_CheckResize(mySize, resizeorigin); // minimum panel size cap, do this once more so we NEVER EVER EVER have a panel smaller than this, JUST IN CASE above code still makes the panel eg negative (impossible to resize back without changing cvars manually then) - mySize_x = max(0.025 * vid_conwidth, mySize_x); - mySize_y = max(0.025 * vid_conheight, mySize_y); + mySize_x = max(0.025 * vid_conwidth, mySize.x); + mySize_y = max(0.025 * vid_conheight, mySize.y); // do another pos check, as size might have changed by now if(resizeCorner == 1) { - myPos_x = resizeorigin_x - mySize_x; - myPos_y = resizeorigin_y - mySize_y; + myPos_x = resizeorigin.x - mySize.x; + myPos_y = resizeorigin.y - mySize.y; } else if(resizeCorner == 2) { - myPos_x = resizeorigin_x; - myPos_y = resizeorigin_y - mySize_y; + myPos_x = resizeorigin.x; + myPos_y = resizeorigin.y - mySize.y; } else if(resizeCorner == 3) { - myPos_x = resizeorigin_x - mySize_x; - myPos_y = resizeorigin_y; + myPos_x = resizeorigin.x - mySize.x; + myPos_y = resizeorigin.y; } else { // resizeCorner == 4 - myPos_x = resizeorigin_x; - myPos_y = resizeorigin_y; + myPos_x = resizeorigin.x; + myPos_y = resizeorigin.y; } //if(cvar("hud_configure_checkcollisions_debug")) //drawfill(myPos, mySize, '0 1 0', .3, DRAWFLAG_NORMAL); string s; - s = strcat(ftos(mySize_x/vid_conwidth), " ", ftos(mySize_y/vid_conheight)); + s = strcat(ftos(mySize.x/vid_conwidth), " ", ftos(mySize.y/vid_conheight)); cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s); - s = strcat(ftos(myPos_x/vid_conwidth), " ", ftos(myPos_y/vid_conheight)); + s = strcat(ftos(myPos.x/vid_conwidth), " ", ftos(myPos.y/vid_conheight)); cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s); } @@ -527,16 +527,16 @@ void HUD_Panel_Arrow_Action(float nPrimary) if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW) { if (hudShiftState & S_SHIFT) - step = hud_configure_realGridSize_y; + step = hud_configure_realGridSize.y; else - step = 2 * hud_configure_realGridSize_y; + step = 2 * hud_configure_realGridSize.y; } else { if (hudShiftState & S_SHIFT) - step = hud_configure_realGridSize_x; + step = hud_configure_realGridSize.x; else - step = 2 * hud_configure_realGridSize_x; + step = 2 * hud_configure_realGridSize.x; } } else @@ -582,15 +582,15 @@ void HUD_Panel_Arrow_Action(float nPrimary) panel_click_resizeorigin = panel_pos; if(resizeCorner == 1) { panel_click_resizeorigin += mySize; - mySize_y += step; + mySize.y += step; } else if(resizeCorner == 2) { - panel_click_resizeorigin_y += mySize_y; - mySize_x += step; + panel_click_resizeorigin.y += mySize.y; + mySize.x += step; } else if(resizeCorner == 3) { - panel_click_resizeorigin_x += mySize_x; - mySize_x += step; + panel_click_resizeorigin.x += mySize.x; + mySize.x += step; } else { // resizeCorner == 4 - mySize_y += step; + mySize.y += step; } HUD_Panel_SetPosSize(mySize); } @@ -600,13 +600,13 @@ void HUD_Panel_Arrow_Action(float nPrimary) vector pos; pos = panel_pos; if(nPrimary == K_UPARROW) - pos_y -= step; + pos.y -= step; else if(nPrimary == K_DOWNARROW) - pos_y += step; + pos.y += step; else if(nPrimary == K_LEFTARROW) - pos_x -= step; + pos.x -= step; else // if(nPrimary == K_RIGHTARROW) - pos_x += step; + pos.x += step; HUD_Panel_SetPos(pos); } @@ -769,14 +769,14 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary) } tab_backward = (hudShiftState & S_SHIFT); - float k, level = 0, start_pos_x; + float k, level = 0, start_posX; vector candidate_pos = '0 0 0'; const float LEVELS_NUM = 4; float level_height = vid_conheight / LEVELS_NUM; :find_tab_panel - level = floor(tab_panel_pos_y / level_height) * level_height; //starting level + level = floor(tab_panel_pos.y / level_height) * level_height; //starting level candidate_pos_x = (!tab_backward) ? vid_conwidth : 0; - start_pos_x = tab_panel_pos_x; + start_posX = tab_panel_pos.x; tab_panel = world; k=0; while(++k) @@ -787,9 +787,9 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary) if (panel == tab_panels[i] || panel == starting_panel) continue; HUD_Panel_UpdatePosSize() - if (panel_pos_y >= level && (panel_pos_y - level) < level_height) - if ( ( !tab_backward && panel_pos_x >= start_pos_x && (panel_pos_x < candidate_pos_x || (panel_pos_x == candidate_pos_x && panel_pos_y <= candidate_pos_y)) ) - || ( tab_backward && panel_pos_x <= start_pos_x && (panel_pos_x > candidate_pos_x || (panel_pos_x == candidate_pos_x && panel_pos_y >= candidate_pos_y)) ) ) + if (panel_pos.y >= level && (panel_pos.y - level) < level_height) + if ( ( !tab_backward && panel_pos.x >= start_posX && (panel_pos.x < candidate_pos.x || (panel_pos_x == candidate_pos.x && panel_pos.y <= candidate_pos.y)) ) + || ( tab_backward && panel_pos.x <= start_posX && (panel_pos.x > candidate_pos.x || (panel_pos_x == candidate_pos.x && panel_pos.y >= candidate_pos.y)) ) ) { tab_panel = panel; tab_panel_pos = candidate_pos = panel_pos; @@ -812,13 +812,13 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary) if (!tab_backward) { level = (level + level_height) % vid_conheight; - start_pos_x = 0; + start_posX = 0; candidate_pos_x = vid_conwidth; } else { level = (level - level_height) % vid_conheight; - start_pos_x = vid_conwidth; + start_posX = vid_conwidth; candidate_pos_x = 0; } } @@ -860,10 +860,10 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary) // reduce size if it'd go beyond screen boundaries vector tmp_size = panel_size_copied; - if (panel_pos_x + panel_size_copied_x > vid_conwidth) - tmp_size_x = vid_conwidth - panel_pos_x; - if (panel_pos_y + panel_size_copied_y > vid_conheight) - tmp_size_y = vid_conheight - panel_pos_y; + if (panel_pos.x + panel_size_copied.x > vid_conwidth) + tmp_size_x = vid_conwidth - panel_pos.x; + if (panel_pos.y + panel_size_copied.y > vid_conheight) + tmp_size_y = vid_conheight - panel_pos.y; if (panel_size == tmp_size) return true; @@ -873,7 +873,7 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary) panel_size_backup = panel_size; highlightedPanel_backup = highlightedPanel; - s = strcat(ftos(tmp_size_x/vid_conwidth), " ", ftos(tmp_size_y/vid_conheight)); + s = strcat(ftos(tmp_size.x/vid_conwidth), " ", ftos(tmp_size.y/vid_conheight)); cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s); } else if(nPrimary == 'z' && hudShiftState & S_CTRL) // undo last action @@ -883,9 +883,9 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary) //restore previous values if (highlightedPanel_backup) { - s = strcat(ftos(panel_pos_backup_x/vid_conwidth), " ", ftos(panel_pos_backup_y/vid_conheight)); + s = strcat(ftos(panel_pos_backup.x/vid_conwidth), " ", ftos(panel_pos_backup.y/vid_conheight)); cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_pos"), s); - s = strcat(ftos(panel_size_backup_x/vid_conwidth), " ", ftos(panel_size_backup_y/vid_conheight)); + s = strcat(ftos(panel_size_backup.x/vid_conwidth), " ", ftos(panel_size_backup.y/vid_conheight)); cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_size"), s); highlightedPanel_backup = world; } @@ -931,27 +931,27 @@ float HUD_Panel_Check_Mouse_Pos(float allow_move) border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize // move - if(allow_move && mousepos_x > panel_pos_x && mousepos_y > panel_pos_y && mousepos_x < panel_pos_x + panel_size_x && mousepos_y < panel_pos_y + panel_size_y) + if(allow_move && mousepos.x > panel_pos.x && mousepos.y > panel_pos.y && mousepos.x < panel_pos.x + panel_size.x && mousepos.y < panel_pos.y + panel_size.y) { return 1; } // resize from topleft border - else if(mousepos_x >= panel_pos_x - border && mousepos_y >= panel_pos_y - border && mousepos_x <= panel_pos_x + 0.5 * panel_size_x && mousepos_y <= panel_pos_y + 0.5 * panel_size_y) + else if(mousepos.x >= panel_pos.x - border && mousepos.y >= panel_pos.y - border && mousepos.x <= panel_pos.x + 0.5 * panel_size.x && mousepos.y <= panel_pos.y + 0.5 * panel_size.y) { return 2; } // resize from topright border - else if(mousepos_x >= panel_pos_x + 0.5 * panel_size_x && mousepos_y >= panel_pos_y - border && mousepos_x <= panel_pos_x + panel_size_x + border && mousepos_y <= panel_pos_y + 0.5 * panel_size_y) + else if(mousepos.x >= panel_pos.x + 0.5 * panel_size.x && mousepos.y >= panel_pos.y - border && mousepos.x <= panel_pos.x + panel_size.x + border && mousepos.y <= panel_pos.y + 0.5 * panel_size.y) { return 3; } // resize from bottomleft border - else if(mousepos_x >= panel_pos_x - border && mousepos_y >= panel_pos_y + 0.5 * panel_size_y && mousepos_x <= panel_pos_x + 0.5 * panel_size_x && mousepos_y <= panel_pos_y + panel_size_y + border) + else if(mousepos.x >= panel_pos.x - border && mousepos.y >= panel_pos.y + 0.5 * panel_size.y && mousepos.x <= panel_pos.x + 0.5 * panel_size.x && mousepos.y <= panel_pos.y + panel_size.y + border) { return 3; } // resize from bottomright border - else if(mousepos_x >= panel_pos_x + 0.5 * panel_size_x && mousepos_y >= panel_pos_y + 0.5 * panel_size_y && mousepos_x <= panel_pos_x + panel_size_x + border && mousepos_y <= panel_pos_y + panel_size_y + border) + else if(mousepos.x >= panel_pos.x + 0.5 * panel_size.x && mousepos.y >= panel_pos.y + 0.5 * panel_size.y && mousepos.x <= panel_pos.x + panel_size.x + border && mousepos.y <= panel_pos.y + panel_size.y + border) { return 2; } @@ -1012,7 +1012,7 @@ void HUD_Panel_Highlight(float allow_move) border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize // move - if(allow_move && mousepos_x > panel_pos_x && mousepos_y > panel_pos_y && mousepos_x < panel_pos_x + panel_size_x && mousepos_y < panel_pos_y + panel_size_y) + if(allow_move && mousepos.x > panel_pos.x && mousepos.y > panel_pos.y && mousepos.x < panel_pos.x + panel_size.x && mousepos.y < panel_pos.y + panel_size.y) { highlightedPanel = hud_panel[i]; HUD_Panel_FirstInDrawQ(i); @@ -1021,7 +1021,7 @@ void HUD_Panel_Highlight(float allow_move) return; } // resize from topleft border - else if(mousepos_x >= panel_pos_x - border && mousepos_y >= panel_pos_y - border && mousepos_x <= panel_pos_x + 0.5 * panel_size_x && mousepos_y <= panel_pos_y + 0.5 * panel_size_y) + else if(mousepos.x >= panel_pos.x - border && mousepos.y >= panel_pos.y - border && mousepos.x <= panel_pos.x + 0.5 * panel_size.x && mousepos.y <= panel_pos.y + 0.5 * panel_size.y) { highlightedPanel = hud_panel[i]; HUD_Panel_FirstInDrawQ(i); @@ -1032,31 +1032,31 @@ void HUD_Panel_Highlight(float allow_move) return; } // resize from topright border - else if(mousepos_x >= panel_pos_x + 0.5 * panel_size_x && mousepos_y >= panel_pos_y - border && mousepos_x <= panel_pos_x + panel_size_x + border && mousepos_y <= panel_pos_y + 0.5 * panel_size_y) + else if(mousepos.x >= panel_pos.x + 0.5 * panel_size.x && mousepos.y >= panel_pos.y - border && mousepos.x <= panel_pos.x + panel_size.x + border && mousepos.y <= panel_pos.y + 0.5 * panel_size.y) { highlightedPanel = hud_panel[i]; HUD_Panel_FirstInDrawQ(i); highlightedAction = 2; resizeCorner = 2; - panel_click_distance_x = panel_size_x - mousepos_x + panel_pos_x; - panel_click_distance_y = mousepos_y - panel_pos_y; - panel_click_resizeorigin = panel_pos + eY * panel_size_y; + panel_click_distance_x = panel_size.x - mousepos.x + panel_pos.x; + panel_click_distance_y = mousepos.y - panel_pos.y; + panel_click_resizeorigin = panel_pos + eY * panel_size.y; return; } // resize from bottomleft border - else if(mousepos_x >= panel_pos_x - border && mousepos_y >= panel_pos_y + 0.5 * panel_size_y && mousepos_x <= panel_pos_x + 0.5 * panel_size_x && mousepos_y <= panel_pos_y + panel_size_y + border) + else if(mousepos.x >= panel_pos.x - border && mousepos.y >= panel_pos.y + 0.5 * panel_size.y && mousepos.x <= panel_pos.x + 0.5 * panel_size.x && mousepos.y <= panel_pos.y + panel_size.y + border) { highlightedPanel = hud_panel[i]; HUD_Panel_FirstInDrawQ(i); highlightedAction = 2; resizeCorner = 3; - panel_click_distance_x = mousepos_x - panel_pos_x; - panel_click_distance_y = panel_size_y - mousepos_y + panel_pos_y; - panel_click_resizeorigin = panel_pos + eX * panel_size_x; + panel_click_distance_x = mousepos.x - panel_pos.x; + panel_click_distance_y = panel_size.y - mousepos.y + panel_pos.y; + panel_click_resizeorigin = panel_pos + eX * panel_size.x; return; } // resize from bottomright border - else if(mousepos_x >= panel_pos_x + 0.5 * panel_size_x && mousepos_y >= panel_pos_y + 0.5 * panel_size_y && mousepos_x <= panel_pos_x + panel_size_x + border && mousepos_y <= panel_pos_y + panel_size_y + border) + else if(mousepos.x >= panel_pos.x + 0.5 * panel_size.x && mousepos.y >= panel_pos.y + 0.5 * panel_size.y && mousepos.x <= panel_pos.x + panel_size.x + border && mousepos.y <= panel_pos.y + panel_size.y + border) { highlightedPanel = hud_panel[i]; HUD_Panel_FirstInDrawQ(i); @@ -1086,8 +1086,8 @@ void HUD_Panel_Mouse() { mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed; - mousepos_x = bound(0, mousepos_x, vid_conwidth); - mousepos_y = bound(0, mousepos_y, vid_conheight); + mousepos_x = bound(0, mousepos.x, vid_conwidth); + mousepos_y = bound(0, mousepos.y, vid_conheight); } if(mouseClicked) @@ -1153,17 +1153,17 @@ void HUD_Panel_Mouse() { vector mySize = '0 0 0'; if(resizeCorner == 1) { - mySize_x = panel_click_resizeorigin_x - (mousepos_x - panel_click_distance_x); - mySize_y = panel_click_resizeorigin_y - (mousepos_y - panel_click_distance_y); + mySize_x = panel_click_resizeorigin.x - (mousepos.x - panel_click_distance.x); + mySize_y = panel_click_resizeorigin.y - (mousepos.y - panel_click_distance.y); } else if(resizeCorner == 2) { - mySize_x = mousepos_x + panel_click_distance_x - panel_click_resizeorigin_x; - mySize_y = panel_click_distance_y + panel_click_resizeorigin_y - mousepos_y; + mySize_x = mousepos.x + panel_click_distance.x - panel_click_resizeorigin.x; + mySize_y = panel_click_distance.y + panel_click_resizeorigin.y - mousepos.y; } else if(resizeCorner == 3) { - mySize_x = panel_click_resizeorigin_x + panel_click_distance_x - mousepos_x; - mySize_y = mousepos_y + panel_click_distance_y - panel_click_resizeorigin_y; + mySize_x = panel_click_resizeorigin.x + panel_click_distance.x - mousepos.x; + mySize_y = mousepos.y + panel_click_distance.y - panel_click_resizeorigin.y; } else { // resizeCorner == 4 - mySize_x = mousepos_x - (panel_click_resizeorigin_x - panel_click_distance_x); - mySize_y = mousepos_y - (panel_click_resizeorigin_y - panel_click_distance_y); + mySize_x = mousepos.x - (panel_click_resizeorigin.x - panel_click_distance.x); + mySize_y = mousepos.y - (panel_click_resizeorigin.y - panel_click_distance.y); } HUD_Panel_SetPosSize(mySize); } @@ -1199,17 +1199,17 @@ void HUD_Configure_DrawGrid() { hud_configure_gridSize_x = bound(0.005, cvar("hud_configure_grid_xsize"), 0.2); hud_configure_gridSize_y = bound(0.005, cvar("hud_configure_grid_ysize"), 0.2); - hud_configure_realGridSize_x = hud_configure_gridSize_x * vid_conwidth; - hud_configure_realGridSize_y = hud_configure_gridSize_y * vid_conheight; + hud_configure_realGridSize_x = hud_configure_gridSize.x * vid_conwidth; + hud_configure_realGridSize_y = hud_configure_gridSize.y * vid_conheight; vector s; // x-axis s = eX + eY * vid_conheight; - for(i = 1; i < 1/hud_configure_gridSize_x; ++i) - drawfill(eX * i * hud_configure_realGridSize_x, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL); + for(i = 1; i < 1/hud_configure_gridSize.x; ++i) + drawfill(eX * i * hud_configure_realGridSize.x, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL); // y-axis s = eY + eX * vid_conwidth; - for(i = 1; i < 1/hud_configure_gridSize_y; ++i) - drawfill(eY * i * hud_configure_realGridSize_y, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL); + for(i = 1; i < 1/hud_configure_gridSize.y; ++i) + drawfill(eY * i * hud_configure_realGridSize.y, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL); } } @@ -1259,10 +1259,10 @@ const string hlBorder2 = "gfx/hud/default/border_highlighted2"; void HUD_Panel_HlBorder(float myBorder, vector color, float theAlpha) { drawfill(panel_pos - '1 1 0' * myBorder, panel_size + '2 2 0' * myBorder, '0 0.5 1', .5 * theAlpha, DRAWFLAG_NORMAL); - drawpic_tiled(panel_pos - '1 1 0' * myBorder, hlBorder, '8 1 0' * hlBorderSize, eX * (panel_size_x + 2 * myBorder) + eY * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL); - drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * (panel_size_y + 2 * myBorder - hlBorderSize), hlBorder, '8 1 0' * hlBorderSize, eX * (panel_size_x + 2 * myBorder) + eY * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL); - drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * hlBorderSize, hlBorder2, '1 8 0' * hlBorderSize, eY * (panel_size_y + 2 * myBorder - 2 * hlBorderSize) + eX * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL); - drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * hlBorderSize + eX * (panel_size_x + 2 * myBorder - hlBorderSize), hlBorder2, '1 8 0' * hlBorderSize, eY * (panel_size_y + 2 * myBorder - 2 * hlBorderSize) + eX * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL); + drawpic_tiled(panel_pos - '1 1 0' * myBorder, hlBorder, '8 1 0' * hlBorderSize, eX * (panel_size.x + 2 * myBorder) + eY * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL); + drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * (panel_size.y + 2 * myBorder - hlBorderSize), hlBorder, '8 1 0' * hlBorderSize, eX * (panel_size.x + 2 * myBorder) + eY * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL); + drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * hlBorderSize, hlBorder2, '1 8 0' * hlBorderSize, eY * (panel_size.y + 2 * myBorder - 2 * hlBorderSize) + eX * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL); + drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * hlBorderSize + eX * (panel_size.x + 2 * myBorder - hlBorderSize), hlBorder2, '1 8 0' * hlBorderSize, eY * (panel_size.y + 2 * myBorder - 2 * hlBorderSize) + eX * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL); } void HUD_Configure_PostDraw() diff --git a/qcsrc/client/mapvoting.qc b/qcsrc/client/mapvoting.qc index dc1b8253b..8e4ede204 100644 --- a/qcsrc/client/mapvoting.qc +++ b/qcsrc/client/mapvoting.qc @@ -67,8 +67,8 @@ vector MapVote_RGB(int id) void GameTypeVote_DrawGameTypeItem(vector pos, float maxh, float tsize, string gtype, string pic, float count, int id) { float alpha; - float desc_padding = gtv_text_size_x * 3; - float rect_margin = hud_fontsize_y / 2; + float desc_padding = gtv_text_size.x * 3; + float rect_margin = hud_fontsize.y / 2; vector rect_pos = pos - '0.5 0.5 0' * rect_margin; vector rect_size = '1 1 0'; rect_size_x = tsize + rect_margin; @@ -100,16 +100,16 @@ void GameTypeVote_DrawGameTypeItem(vector pos, float maxh, float tsize, string g count, tsize, gtv_text_size); title.origin = pos-offset; - pos_y += gtv_text_size_small_y; - pos_y += gtv_text_size_y/2; + pos.y += gtv_text_size_small.y; + pos.y += gtv_text_size.y/2; - maxh -= gtv_text_size_y; + maxh -= gtv_text_size.y; entity picent = spawn(); picent.origin = pos-offset; picent.maxs = '1 1 0 ' * min(maxh, desc_padding) * 0.8; - pos_x += desc_padding; + pos.x += desc_padding; tsize -= desc_padding; string thelabel = GameTypeVote_DescriptionByID(id), ts; @@ -118,10 +118,10 @@ void GameTypeVote_DrawGameTypeItem(vector pos, float maxh, float tsize, string g if( thelabel != "") { float i,n = tokenizebyseparator(thelabel, "\n"); - for(i = 0; i < n && maxh > (nlines+1)*gtv_text_size_small_y; ++i) + for(i = 0; i < n && maxh > (nlines+1)*gtv_text_size_small.y; ++i) { getWrappedLine_remaining = argv(i); - while(getWrappedLine_remaining && maxh > (nlines+1)*gtv_text_size_small_y) + while(getWrappedLine_remaining && maxh > (nlines+1)*gtv_text_size_small.y) { ts = getWrappedLine(tsize, gtv_text_size_small, stringwidth_colors); if (ts != "") @@ -131,16 +131,16 @@ void GameTypeVote_DrawGameTypeItem(vector pos, float maxh, float tsize, string g next.origin = pos-offset; last.chain = next; last = next; - pos_y += gtv_text_size_small_y; + pos.y += gtv_text_size_small.y; nlines++; } } } } - maxh -= max(nlines*gtv_text_size_small_y,picent.maxs_y); + maxh -= max(nlines*gtv_text_size_small.y,picent.maxs.y); if ( maxh > 0 ) - offset_y += maxh/2; + offset.y += maxh/2; drawstring(title.origin+offset, title.message, gtv_text_size, rgb, alpha, DRAWFLAG_NORMAL); if(pic != "") @@ -165,14 +165,14 @@ void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, strin string label; float text_size; - isize -= hud_fontsize_y; // respect the text when calculating the image size + isize -= hud_fontsize.y; // respect the text when calculating the image size rgb = MapVote_RGB(id); img_size_y = isize; img_size_x = isize / 0.75; // 4:3 x can be stretched easily, height is defined in isize - pos_y = pos_y + img_size_y; + pos_y = pos.y + img_size.y; label = MapVote_FormatMapItem(id, map, count, tsize, hud_fontsize); @@ -184,11 +184,11 @@ void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, strin else theAlpha = 1; - pos_x -= text_size*0.5; + pos.x -= text_size*0.5; drawstring(pos, label, hud_fontsize, rgb, theAlpha, DRAWFLAG_NORMAL); - pos_x = pos_x + text_size*0.5 - img_size_x*0.5; - pos_y = pos_y - img_size_y; + pos_x = pos.x + text_size*0.5 - img_size.x*0.5; + pos_y = pos.y - img_size.y; pos += autocvar_scoreboard_border_thickness * '1 1 0'; img_size -= (autocvar_scoreboard_border_thickness * 2) * '1 1 0'; @@ -221,13 +221,13 @@ void MapVote_DrawAbstain(vector pos, float isize, float tsize, float count, int rgb = MapVote_RGB(id); - pos_y = pos_y + hud_fontsize_y; + pos_y = pos.y + hud_fontsize.y; label = MapVote_FormatMapItem(id, _("Don't care"), count, tsize, hud_fontsize); text_size = stringwidth(label, false, hud_fontsize); - pos_x -= text_size*0.5; + pos.x -= text_size*0.5; drawstring(pos, label, hud_fontsize, rgb, 1, DRAWFLAG_NORMAL); } @@ -235,9 +235,9 @@ vector MapVote_GridVec(vector gridspec, int i, int m) { int r = i % m; return - '1 0 0' * (gridspec_x * r) + '1 0 0' * (gridspec.x * r) + - '0 1 0' * (gridspec_y * (i - r) / m); + '0 1 0' * (gridspec.y * (i - r) / m); } float MapVote_Selection(vector topleft, vector cellsize, float rows, float columns) @@ -250,10 +250,10 @@ float MapVote_Selection(vector topleft, vector cellsize, float rows, float colum for (r = 0; r < rows; ++r) for (c = 0; c < columns; ++c) { - if (mv_mousepos_x >= topleft_x + cellsize_x * c && - mv_mousepos_x <= topleft_x + cellsize_x * (c + 1) && - mv_mousepos_y >= topleft_y + cellsize_y * r && - mv_mousepos_y <= topleft_y + cellsize_y * (r + 1)) + if (mv_mousepos.x >= topleft.x + cellsize.x * c && + mv_mousepos.x <= topleft.x + cellsize.x * (c + 1) && + mv_mousepos.y >= topleft.y + cellsize.y * r && + mv_mousepos.y <= topleft.y + cellsize.y * (r + 1)) { mv_mouse_selection = r * columns + c; break; @@ -290,10 +290,10 @@ void MapVote_Draw() if (!autocvar_hud_cursormode) { vector mpos = mv_mousepos + getmousepos(); - mpos_x = bound(0, mpos_x, vid_conwidth); - mpos_y = bound(0, mpos_y, vid_conheight); + mpos_x = bound(0, mpos.x, vid_conwidth); + mpos_y = bound(0, mpos.y, vid_conheight); - if ( mpos_x != mv_mousepos_x || mpos_y != mv_mousepos_y ) + if ( mpos.x != mv_mousepos.x || mpos.y != mv_mousepos.y ) mv_selection_keyboard = 0; mv_mousepos = mpos; @@ -318,58 +318,58 @@ void MapVote_Draw() map = ((gametypevote) ? _("Decide the gametype") : _("Vote for a map")); pos_x = center - stringwidth(map, false, '12 0 0'); drawstring(pos, map, '24 24 0', '1 1 1', 1, DRAWFLAG_NORMAL); - pos_y += 26; + pos.y += 26; if( mapvote_chosenmap != "" ) { pos_x = center - stringwidth(mapvote_chosenmap, false, hud_fontsize*1.5/2); drawstring(pos, mapvote_chosenmap, hud_fontsize*1.5, '1 1 1', 1, DRAWFLAG_NORMAL); - pos_y += hud_fontsize_y*2; + pos.y += hud_fontsize.y*2; } i = ceil(max(0, mv_timeout - time)); map = sprintf(_("%d seconds left"), i); pos_x = center - stringwidth(map, false, '8 0 0'); drawstring(pos, map, '16 16 0', '0 1 0', 1, DRAWFLAG_NORMAL); - pos_y += 22; + pos.y += 22; pos_x = xmin; draw_endBoldFont(); // base for multi-column stuff... - ymin = pos_y; + ymin = pos.y; if(mv_abstain) mv_num_maps -= 1; rows = ceil(mv_num_maps / mv_columns); dist_x = (xmax - xmin) / mv_columns; - dist_y = (ymax - pos_y) / rows; + dist_y = (ymax - pos.y) / rows; if ( gametypevote ) { - tsize = dist_x - hud_fontsize_y; - isize = dist_y; - float maxheight = (ymax - pos_y) / 3; + tsize = dist.x - hud_fontsize.y; + isize = dist.y; + float maxheight = (ymax - pos.y) / 3; if ( isize > maxheight ) { - pos_x += (isize - maxheight)/2; + pos.x += (isize - maxheight)/2; isize = maxheight; } else - dist_y += hud_fontsize_y; - pos_x = ( vid_conwidth - dist_x * mv_columns ) / 2; + dist.y += hud_fontsize.y; + pos_x = ( vid_conwidth - dist.x * mv_columns ) / 2; } else { - tsize = dist_x - 10; - isize = min(dist_y - 10, 0.75 * tsize); + tsize = dist.x - 10; + isize = min(dist.y - 10, 0.75 * tsize); } mv_selection = MapVote_Selection(pos, dist, rows, mv_columns); if ( !gametypevote ) - pos_x += dist_x / 2; - pos_y += (dist_y - isize) / 2; + pos.x += dist.x / 2; + pos.y += (dist.y - isize) / 2; ymax -= isize; if (mv_top2_time) @@ -397,7 +397,7 @@ void MapVote_Draw() if(mv_abstain && i < mv_num_maps) { tmp = mv_votes[i]; - pos_y = ymax + isize - hud_fontsize_y; + pos_y = ymax + isize - hud_fontsize.y; pos_x = (xmax+xmin)*0.5; MapVote_DrawAbstain(pos, isize, xmax - xmin, tmp, i); } diff --git a/qcsrc/client/miscfunctions.qc b/qcsrc/client/miscfunctions.qc index ee0ba0ca0..41c64b806 100644 --- a/qcsrc/client/miscfunctions.qc +++ b/qcsrc/client/miscfunctions.qc @@ -132,7 +132,7 @@ vector HUD_GetFontsize(string cvarname) if(v_x == 0) v = '8 8 0'; if(v_y == 0) - v_y = v_x; + v_y = v.x; v_z = 0; return v; } @@ -154,8 +154,8 @@ vector rotate(vector v, float a) { vector w = '0 0 0'; // FTEQCC SUCKS AGAIN - w_x = v_x * cos(a) + v_y * sin(a); - w_y = -1 * v_x * sin(a) + v_y * cos(a); + w_x = v.x * cos(a) + v.y * sin(a); + w_y = -1 * v.x * sin(a) + v.y * cos(a); return w; } @@ -197,8 +197,8 @@ vector project_3d_to_2d(vector vec) vec = cs_project(vec); if(cs_project_is_b0rked > 0) { - vec_x *= vid_conwidth / vid_width; - vec_y *= vid_conheight / vid_height; + vec.x *= vid_conwidth / vid_width; + vec.y *= vid_conheight / vid_height; } return vec; } @@ -214,7 +214,7 @@ float expandingbox_sizefactor_from_fadelerp(float fadelerp) vector expandingbox_resize_centered_box_offset(float sz, vector boxsize, float boxxsizefactor) { - boxsize_x *= boxxsizefactor; // easier interface for text + boxsize.x *= boxxsizefactor; // easier interface for text return boxsize * (0.5 * (1 - sz)); } @@ -223,18 +223,18 @@ void drawborderlines(float thickness, vector pos, vector dim, vector color, floa vector line_dim = '0 0 0'; // left and right lines - pos_x -= thickness; + pos.x -= thickness; line_dim_x = thickness; - line_dim_y = dim_y; + line_dim_y = dim.y; drawfill(pos, line_dim, color, theAlpha, drawflag); - drawfill(pos + (dim_x + thickness) * '1 0 0', line_dim, color, theAlpha, drawflag); + drawfill(pos + (dim.x + thickness) * '1 0 0', line_dim, color, theAlpha, drawflag); // upper and lower lines - pos_y -= thickness; - line_dim_x = dim_x + thickness * 2; // make upper and lower lines longer + pos.y -= thickness; + line_dim_x = dim.x + thickness * 2; // make upper and lower lines longer line_dim_y = thickness; drawfill(pos, line_dim, color, theAlpha, drawflag); - drawfill(pos + (dim_y + thickness) * '0 1 0', line_dim, color, theAlpha, drawflag); + drawfill(pos + (dim.y + thickness) * '0 1 0', line_dim, color, theAlpha, drawflag); } void drawpic_tiled(vector pos, string pic, vector sz, vector area, vector color, float theAlpha, float drawflag) @@ -242,20 +242,20 @@ void drawpic_tiled(vector pos, string pic, vector sz, vector area, vector color, vector current_pos = '0 0 0', end_pos, new_size = '0 0 0', ratio = '0 0 0'; end_pos = pos + area; - current_pos_y = pos_y; - while (current_pos_y < end_pos_y) + current_pos_y = pos.y; + while (current_pos.y < end_pos.y) { - current_pos_x = pos_x; - while (current_pos_x < end_pos_x) + current_pos_x = pos.x; + while (current_pos.x < end_pos.x) { - new_size_x = min(sz_x, end_pos_x - current_pos_x); - new_size_y = min(sz_y, end_pos_y - current_pos_y); - ratio_x = new_size_x / sz_x; - ratio_y = new_size_y / sz_y; + new_size_x = min(sz.x, end_pos.x - current_pos.x); + new_size_y = min(sz.y, end_pos.y - current_pos.y); + ratio_x = new_size.x / sz.x; + ratio_y = new_size.y / sz.y; drawsubpic(current_pos, new_size, pic, '0 0 0', ratio, color, theAlpha, drawflag); - current_pos_x += sz_x; + current_pos.x += sz.x; } - current_pos_y += sz_y; + current_pos.y += sz.y; } } @@ -269,18 +269,18 @@ var string _drawpic_picpath; do {\ _drawpic_imgsize = draw_getimagesize(pic);\ if(_drawpic_imgsize != '0 0 0') {\ - _drawpic_imgaspect = _drawpic_imgsize_x/_drawpic_imgsize_y;\ + _drawpic_imgaspect = _drawpic_imgsize.x/_drawpic_imgsize.y;\ _drawpic_sz = mySize;\ - if(_drawpic_sz_x/_drawpic_sz_y > _drawpic_imgaspect) {\ - _drawpic_oldsz = _drawpic_sz_x;\ - _drawpic_sz_x = _drawpic_sz_y * _drawpic_imgaspect;\ - if(_drawpic_sz_x)\ - drawpic(pos + eX * (_drawpic_oldsz - _drawpic_sz_x) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\ + if(_drawpic_sz.x/_drawpic_sz.y > _drawpic_imgaspect) {\ + _drawpic_oldsz = _drawpic_sz.x;\ + _drawpic_sz_x = _drawpic_sz.y * _drawpic_imgaspect;\ + if(_drawpic_sz.x)\ + drawpic(pos + eX * (_drawpic_oldsz - _drawpic_sz.x) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\ } else {\ - _drawpic_oldsz = _drawpic_sz_y;\ - _drawpic_sz_y = _drawpic_sz_x / _drawpic_imgaspect;\ - if(_drawpic_sz_y)\ - drawpic(pos + eY * (_drawpic_oldsz - _drawpic_sz_y) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\ + _drawpic_oldsz = _drawpic_sz.y;\ + _drawpic_sz_y = _drawpic_sz.x / _drawpic_imgaspect;\ + if(_drawpic_sz.y)\ + drawpic(pos + eY * (_drawpic_oldsz - _drawpic_sz.y) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\ }\ }\ } while(0) @@ -322,27 +322,27 @@ void drawpic_aspect_skin_expanding_two(vector position, string pic, vector theSc } #define SET_POS_AND_SZ_Y_ASPECT(allow_colors)\ float textaspect, oldsz;\ - textaspect = stringwidth(text, allow_colors, '1 1 1' * sz_y) / sz_y;\ - if(sz_x/sz_y > textaspect) {\ - oldsz = sz_x;\ - sz_x = sz_y * textaspect;\ - pos_x += (oldsz - sz_x) * 0.5;\ + textaspect = stringwidth(text, allow_colors, '1 1 1' * sz.y) / sz.y;\ + if(sz.x/sz.y > textaspect) {\ + oldsz = sz.x;\ + sz_x = sz.y * textaspect;\ + pos.x += (oldsz - sz.x) * 0.5;\ } else {\ - oldsz = sz_y;\ - sz_y = sz_x / textaspect; \ - pos_y += (oldsz - sz_y) * 0.5;\ + oldsz = sz.y;\ + sz_y = sz.x / textaspect; \ + pos.y += (oldsz - sz.y) * 0.5;\ } // drawstring wrapper to draw a string as large as possible with preserved aspect ratio into a box void drawstring_aspect(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag) { SET_POS_AND_SZ_Y_ASPECT(FALSE) - drawstring(pos, text, '1 1 0' * sz_y, color, theAlpha, drawflag); + drawstring(pos, text, '1 1 0' * sz.y, color, theAlpha, drawflag); } // drawstring wrapper to draw a colorcodedstring as large as possible with preserved aspect ratio into a box void drawcolorcodedstring_aspect(vector pos, string text, vector sz, float theAlpha, float drawflag) { SET_POS_AND_SZ_Y_ASPECT(TRUE) - drawcolorcodedstring(pos, text, '1 1 0' * sz_y, theAlpha, drawflag); + drawcolorcodedstring(pos, text, '1 1 0' * sz.y, theAlpha, drawflag); } vector drawfontscale; @@ -353,7 +353,7 @@ void drawstring_expanding(vector position, string text, vector theScale, vector drawfontscale = sz * '1 1 0'; dummyfunction(0, 0, 0, 0, 0, 0, 0, 0); - drawstring(position + expandingbox_resize_centered_box_offset(sz, theScale, stringwidth(text, FALSE, theScale * (sz / drawfontscale_x)) / (theScale_x * sz)), text, theScale * (sz / drawfontscale_x), rgb, theAlpha * (1 - fadelerp), flag); + drawstring(position + expandingbox_resize_centered_box_offset(sz, theScale, stringwidth(text, FALSE, theScale * (sz / drawfontscale.x)) / (theScale.x * sz)), text, theScale * (sz / drawfontscale.x), rgb, theAlpha * (1 - fadelerp), flag); // width parameter: // (scale_x * sz / drawfontscale_x) * drawfontscale_x * SIZE1 / (scale_x * sz) // SIZE1 @@ -363,7 +363,7 @@ void drawstring_expanding(vector position, string text, vector theScale, vector // drawstring wrapper to draw a string as large as possible with preserved aspect ratio into a box void drawstring_aspect_expanding(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag, float fadelerp) { SET_POS_AND_SZ_Y_ASPECT(FALSE) - drawstring_expanding(pos, text, '1 1 0' * sz_y, color, theAlpha, drawflag, fadelerp); + drawstring_expanding(pos, text, '1 1 0' * sz.y, color, theAlpha, drawflag, fadelerp); } void drawcolorcodedstring_expanding(vector position, string text, vector theScale, float theAlpha, float flag, float fadelerp) @@ -373,13 +373,13 @@ void drawcolorcodedstring_expanding(vector position, string text, vector theScal drawfontscale = sz * '1 1 0'; dummyfunction(0, 0, 0, 0, 0, 0, 0, 0); - drawcolorcodedstring(position + expandingbox_resize_centered_box_offset(sz, theScale, stringwidth(text, TRUE, theScale * (sz / drawfontscale_x)) / (theScale_x * sz)), text, theScale * (sz / drawfontscale_x), theAlpha * (1 - fadelerp), flag); + drawcolorcodedstring(position + expandingbox_resize_centered_box_offset(sz, theScale, stringwidth(text, TRUE, theScale * (sz / drawfontscale.x)) / (theScale.x * sz)), text, theScale * (sz / drawfontscale.x), theAlpha * (1 - fadelerp), flag); drawfontscale = '1 1 0'; } void drawcolorcodedstring_aspect_expanding(vector pos, string text, vector sz, float theAlpha, float drawflag, float fadelerp) { SET_POS_AND_SZ_Y_ASPECT(TRUE) - drawcolorcodedstring_expanding(pos, text, '1 1 0' * sz_y, theAlpha, drawflag, fadelerp); + drawcolorcodedstring_expanding(pos, text, '1 1 0' * sz.y, theAlpha, drawflag, fadelerp); } // this draws the triangles of a model DIRECTLY. Don't expect high performance, really... @@ -397,9 +397,9 @@ float PolyDrawModelSurface(entity e, float i_s) { tri = getsurfacetriangle(e, i_s, i_t); R_BeginPolygon(tex, 0); - R_PolygonVertex(getsurfacepoint(e, i_s, tri_x), getsurfacepointattribute(e, i_s, tri_x, SPA_TEXCOORDS0), '1 1 1', 1); - R_PolygonVertex(getsurfacepoint(e, i_s, tri_y), getsurfacepointattribute(e, i_s, tri_y, SPA_TEXCOORDS0), '1 1 1', 1); - R_PolygonVertex(getsurfacepoint(e, i_s, tri_z), getsurfacepointattribute(e, i_s, tri_z, SPA_TEXCOORDS0), '1 1 1', 1); + R_PolygonVertex(getsurfacepoint(e, i_s, tri.x), getsurfacepointattribute(e, i_s, tri.x, SPA_TEXCOORDS0), '1 1 1', 1); + R_PolygonVertex(getsurfacepoint(e, i_s, tri.y), getsurfacepointattribute(e, i_s, tri.y, SPA_TEXCOORDS0), '1 1 1', 1); + R_PolygonVertex(getsurfacepoint(e, i_s, tri.z), getsurfacepointattribute(e, i_s, tri.z, SPA_TEXCOORDS0), '1 1 1', 1); R_EndPolygon(); } return 1; @@ -429,19 +429,19 @@ void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vect // draw full rectangle R_BeginPolygon(pic, drawflag); v = centre; t = '0.5 0.5 0'; - v_x += 0.5 * ringsize_x; t += '0.5 0.5 0'; + v.x += 0.5 * ringsize.x; t += '0.5 0.5 0'; R_PolygonVertex(v, t, rgb, a); v = centre; t = '0.5 0.5 0'; - v_y += 0.5 * ringsize_y; t += '0.5 -0.5 0'; + v.y += 0.5 * ringsize.y; t += '0.5 -0.5 0'; R_PolygonVertex(v, t, rgb, a); v = centre; t = '0.5 0.5 0'; - v_x -= 0.5 * ringsize_x; t -= '0.5 0.5 0'; + v.x -= 0.5 * ringsize.x; t -= '0.5 0.5 0'; R_PolygonVertex(v, t, rgb, a); v = centre; t = '0.5 0.5 0'; - v_y -= 0.5 * ringsize_y; t -= '0.5 -0.5 0'; + v.y -= 0.5 * ringsize.y; t -= '0.5 -0.5 0'; R_PolygonVertex(v, t, rgb, a); R_EndPolygon(); @@ -453,7 +453,7 @@ void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vect R_PolygonVertex(v, t, rgb, a); v = centre; t = '0.5 0.5 0'; - v_x += 0.5 * ringsize_x; t += '0.5 0.5 0'; + v.x += 0.5 * ringsize.x; t += '0.5 0.5 0'; R_PolygonVertex(v, t, rgb, a); } } @@ -462,15 +462,15 @@ void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vect // draw upper and first triangle R_BeginPolygon(pic, drawflag); v = centre; t = '0.5 0.5 0'; - v_x += 0.5 * ringsize_x; t += '0.5 0.5 0'; + v.x += 0.5 * ringsize.x; t += '0.5 0.5 0'; R_PolygonVertex(v, t, rgb, a); v = centre; t = '0.5 0.5 0'; - v_y += 0.5 * ringsize_y; t += '0.5 -0.5 0'; + v.y += 0.5 * ringsize.y; t += '0.5 -0.5 0'; R_PolygonVertex(v, t, rgb, a); v = centre; t = '0.5 0.5 0'; - v_x -= 0.5 * ringsize_x; t -= '0.5 0.5 0'; + v.x -= 0.5 * ringsize.x; t -= '0.5 0.5 0'; R_PolygonVertex(v, t, rgb, a); R_EndPolygon(); R_BeginPolygon(pic, drawflag); @@ -478,11 +478,11 @@ void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vect R_PolygonVertex(v, t, rgb, a); v = centre; t = '0.5 0.5 0'; - v_x -= 0.5 * ringsize_x; t -= '0.5 0.5 0'; + v.x -= 0.5 * ringsize.x; t -= '0.5 0.5 0'; R_PolygonVertex(v, t, rgb, a); v = centre; t = '0.5 0.5 0'; - v_y -= 0.5 * ringsize_y; t -= '0.5 -0.5 0'; + v.y -= 0.5 * ringsize.y; t -= '0.5 -0.5 0'; R_PolygonVertex(v, t, rgb, a); d = q - 0.75; @@ -494,15 +494,15 @@ void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vect // draw upper triangle R_BeginPolygon(pic, drawflag); v = centre; t = '0.5 0.5 0'; - v_x += 0.5 * ringsize_x; t += '0.5 0.5 0'; + v.x += 0.5 * ringsize.x; t += '0.5 0.5 0'; R_PolygonVertex(v, t, rgb, a); v = centre; t = '0.5 0.5 0'; - v_y += 0.5 * ringsize_y; t += '0.5 -0.5 0'; + v.y += 0.5 * ringsize.y; t += '0.5 -0.5 0'; R_PolygonVertex(v, t, rgb, a); v = centre; t = '0.5 0.5 0'; - v_x -= 0.5 * ringsize_x; t -= '0.5 0.5 0'; + v.x -= 0.5 * ringsize.x; t -= '0.5 0.5 0'; R_PolygonVertex(v, t, rgb, a); R_EndPolygon(); @@ -514,7 +514,7 @@ void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vect R_PolygonVertex(v, t, rgb, a); v = centre; t = '0.5 0.5 0'; - v_x -= 0.5 * ringsize_x; t -= '0.5 0.5 0'; + v.x -= 0.5 * ringsize.x; t -= '0.5 0.5 0'; R_PolygonVertex(v, t, rgb, a); } } @@ -526,11 +526,11 @@ void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vect R_PolygonVertex(v, t, rgb, a); v = centre; t = '0.5 0.5 0'; - v_x += 0.5 * ringsize_x; t += '0.5 0.5 0'; + v.x += 0.5 * ringsize.x; t += '0.5 0.5 0'; R_PolygonVertex(v, t, rgb, a); v = centre; t = '0.5 0.5 0'; - v_y += 0.5 * ringsize_y; t += '0.5 -0.5 0'; + v.y += 0.5 * ringsize.y; t += '0.5 -0.5 0'; R_PolygonVertex(v, t, rgb, a); d = q - 0.25; @@ -547,7 +547,7 @@ void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vect R_PolygonVertex(v, t, rgb, a); v = centre; t = '0.5 0.5 0'; - v_x += 0.5 * ringsize_x; t += '0.5 0.5 0'; + v.x += 0.5 * ringsize.x; t += '0.5 0.5 0'; R_PolygonVertex(v, t, rgb, a); } } @@ -555,8 +555,8 @@ void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vect if(d > 0) { v = centre; t = '0.5 0.5 0'; - v_x += x * 0.5 * ringsize_x; t += x * '0.5 0.5 0'; - v_y += y * 0.5 * ringsize_y; t += y * '0.5 -0.5 0'; + v.x += x * 0.5 * ringsize.x; t += x * '0.5 0.5 0'; + v.y += y * 0.5 * ringsize.y; t += y * '0.5 -0.5 0'; R_PolygonVertex(v, t, rgb, a); R_EndPolygon(); } diff --git a/qcsrc/client/movetypes.qc b/qcsrc/client/movetypes.qc index a5ffdabfb..e08c7244e 100644 --- a/qcsrc/client/movetypes.qc +++ b/qcsrc/client/movetypes.qc @@ -16,7 +16,7 @@ float _Movetype_CheckWater(entity ent) // SV_CheckWater vector point; point = ent.move_origin; - point_z += (ent.mins_z + 1); + point_z += (ent.mins.z + 1); nativecontents = pointcontents(point); @@ -36,11 +36,11 @@ float _Movetype_CheckWater(entity ent) // SV_CheckWater { ent.move_watertype = nativecontents; ent.move_waterlevel = 1; - point_y = (ent.origin_y + ((ent.mins_z + ent.maxs_y) * 0.5)); + point_y = (ent.origin.y + ((ent.mins.z + ent.maxs.y) * 0.5)); if(Mod_Q1BSP_SuperContentsFromNativeContents(pointcontents(point)) & DPCONTENTS_LIQUIDSMASK) { ent.move_waterlevel = 2; - point_y = ent.origin_y + ent.view_ofs_y; + point_y = ent.origin.y + ent.view_ofs.y; if(Mod_Q1BSP_SuperContentsFromNativeContents(pointcontents(point)) & DPCONTENTS_LIQUIDSMASK) ent.move_waterlevel = 3; } @@ -162,21 +162,21 @@ void _Movetype_LinkEdict(float touch_triggers) // SV_LinkEdict if(self.move_flags & FL_ITEM) { - mi_x -= 15; - mi_y -= 15; - mi_z -= 1; - ma_x += 15; - ma_y += 15; - ma_z += 1; + mi.x -= 15; + mi.y -= 15; + mi.z -= 1; + ma.x += 15; + ma.y += 15; + ma.z += 1; } else { - mi_x -= 1; - mi_y -= 1; - mi_z -= 1; - ma_x += 1; - ma_y += 1; - ma_z += 1; + mi.x -= 1; + mi.y -= 1; + mi.z -= 1; + ma.x += 1; + ma.y += 1; + ma.z += 1; } self.absmin = mi; @@ -235,9 +235,9 @@ vector _Movetype_ClipVelocity(vector vel, vector norm, float f) // SV_ClipVeloci { vel = vel - ((vel * norm) * norm) * f; - if(vel_x > -0.1 && vel_x < 0.1) vel_x = 0; - if(vel_y > -0.1 && vel_y < 0.1) vel_y = 0; - if(vel_z > -0.1 && vel_z < 0.1) vel_z = 0; + if(vel.x > -0.1 && vel.x < 0.1) vel_x = 0; + if(vel.y > -0.1 && vel.y < 0.1) vel_y = 0; + if(vel.z > -0.1 && vel.z < 0.1) vel_z = 0; return vel; } @@ -282,7 +282,7 @@ void _Movetype_Physics_Toss(float dt) // SV_Physics_Toss { if(self.move_flags & FL_ONGROUND) { - if(self.move_velocity_z >= 1/32) + if(self.move_velocity.z >= 1/32) self.move_flags &= ~FL_ONGROUND; else if(!self.move_groundentity) return; @@ -360,7 +360,7 @@ void _Movetype_Physics_Toss(float dt) // SV_Physics_Toss self.move_velocity = _Movetype_ClipVelocity(self.move_velocity, trace_plane_normal, 1 + bouncefac); d = trace_plane_normal * self.move_velocity; - if(trace_plane_normal_z > 0.7 && d < bouncestop && d > -bouncestop) + if(trace_plane_normal.z > 0.7 && d < bouncestop && d > -bouncestop) { self.move_flags |= FL_ONGROUND; self.move_groundentity = trace_ent; @@ -373,7 +373,7 @@ void _Movetype_Physics_Toss(float dt) // SV_Physics_Toss else { self.move_velocity = _Movetype_ClipVelocity(self.move_velocity, trace_plane_normal, 1.0); - if(trace_plane_normal_z > 0.7) + if(trace_plane_normal.z > 0.7) { self.move_flags |= FL_ONGROUND; self.move_groundentity = trace_ent; diff --git a/qcsrc/client/particles.qc b/qcsrc/client/particles.qc index 5fcc3c1f3..578e96181 100644 --- a/qcsrc/client/particles.qc +++ b/qcsrc/client/particles.qc @@ -40,9 +40,9 @@ void Draw_PointParticles() for(i = random(); i <= n && fail <= 64*n; ++i) { p = o + self.mins; - p_x += random() * sz_x; - p_y += random() * sz_y; - p_z += random() * sz_z; + p.x += random() * sz.x; + p.y += random() * sz.y; + p.z += random() * sz.z; if(WarpZoneLib_BoxTouchesBrush(p, p, self, world)) { if(self.movedir != '0 0 0') @@ -174,7 +174,7 @@ void Ent_PointParticles() if(!self.absolute) { v = self.maxs - self.mins; - self.impulse *= -v_x * v_y * v_z / 262144; // relative: particles per 64^3 cube + self.impulse *= -v.x * v.y * v.z / 262144; // relative: particles per 64^3 cube } } diff --git a/qcsrc/client/player_skeleton.qc b/qcsrc/client/player_skeleton.qc index bec9c9ebe..a0d75057a 100644 --- a/qcsrc/client/player_skeleton.qc +++ b/qcsrc/client/player_skeleton.qc @@ -172,7 +172,7 @@ void skeleton_from_frames(entity e, float is_dead) { if(e.(bone_aim[i])) { - vector aim = '1 0 0' * bound(-90, self.v_angle_x, 90) * e.(bone_aimweight[i]); + vector aim = '1 0 0' * bound(-90, self.v_angle.x, 90) * e.(bone_aimweight[i]); vector org = skel_get_boneabs(s, e.(bone_aim[i])); vector ang_cur = fixedvectoangles2(v_forward, v_up); vector ang = AnglesTransform_Multiply(aim, ang_cur); diff --git a/qcsrc/client/scoreboard.qc b/qcsrc/client/scoreboard.qc index e9b4ea03a..69bdd018c 100644 --- a/qcsrc/client/scoreboard.qc +++ b/qcsrc/client/scoreboard.qc @@ -622,7 +622,7 @@ string HUD_FixScoreboardColumnWidth(int i, string str) if(hud_field_icon0 != "") { sz = draw_getimagesize(hud_field_icon0); - f = sz_x / sz_y; + f = sz.x / sz.y; if(hud_fixscoreboardcolumnwidth_iconlen < f) hud_fixscoreboardcolumnwidth_iconlen = f; } @@ -630,7 +630,7 @@ string HUD_FixScoreboardColumnWidth(int i, string str) if(hud_field_icon1 != "") { sz = draw_getimagesize(hud_field_icon1); - f = sz_x / sz_y; + f = sz.x / sz.y; if(hud_fixscoreboardcolumnwidth_iconlen < f) hud_fixscoreboardcolumnwidth_iconlen = f; } @@ -638,12 +638,12 @@ string HUD_FixScoreboardColumnWidth(int i, string str) if(hud_field_icon2 != "") { sz = draw_getimagesize(hud_field_icon2); - f = sz_x / sz_y; + f = sz.x / sz.y; if(hud_fixscoreboardcolumnwidth_iconlen < f) hud_fixscoreboardcolumnwidth_iconlen = f; } - hud_fixscoreboardcolumnwidth_iconlen *= hud_fontsize_y / hud_fontsize_x; // fix icon aspect + hud_fixscoreboardcolumnwidth_iconlen *= hud_fontsize.y / hud_fontsize.x; // fix icon aspect if(hud_fixscoreboardcolumnwidth_iconlen != 0) hud_fixscoreboardcolumnwidth_marginlen = stringwidth(" ", FALSE, hud_fontsize); @@ -658,8 +658,8 @@ string HUD_FixScoreboardColumnWidth(int i, string str) for(j = 0; j < hud_num_fields; ++j) if(j != i) if (hud_field[i] != SP_SEPARATOR) - namesize -= hud_size[j] + hud_fontsize_x; - namesize += hud_fontsize_x; + namesize -= hud_size[j] + hud_fontsize.x; + namesize += hud_fontsize.x; hud_size[i] = namesize; if (hud_fixscoreboardcolumnwidth_iconlen != 0) @@ -699,7 +699,7 @@ void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_s else if((scoreboard_highlight) && (!(pl_number % 2))) drawfill(h_pos, h_size, rgb, scoreboard_highlight_alpha, DRAWFLAG_NORMAL); - tmp_x = item_size_x; + tmp_x = item_size.x; tmp_y = 0; tmp_z = 0; int i; @@ -710,44 +710,44 @@ void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_s break; if(is_spec && field != SP_NAME && field != SP_PING) { - pos_x += hud_size[i] + hud_fontsize_x; + pos.x += hud_size[i] + hud_fontsize.x; continue; } str = HUD_GetField(pl, field); str = HUD_FixScoreboardColumnWidth(i, str); - pos_x += hud_size[i] + hud_fontsize_x; + pos.x += hud_size[i] + hud_fontsize.x; if(field == SP_NAME) { - tmp_x = hud_size[i] - hud_fontsize_x*hud_fixscoreboardcolumnwidth_iconlen - hud_fixscoreboardcolumnwidth_marginlen + hud_fontsize_x; + tmp_x = hud_size[i] - hud_fontsize.x*hud_fixscoreboardcolumnwidth_iconlen - hud_fixscoreboardcolumnwidth_marginlen + hud_fontsize.x; if (is_self) drawcolorcodedstring(pos - tmp, str, hud_fontsize, scoreboard_alpha_name_self, DRAWFLAG_NORMAL); else drawcolorcodedstring(pos - tmp, str, hud_fontsize, scoreboard_alpha_name, DRAWFLAG_NORMAL); } else { - tmp_x = hud_fixscoreboardcolumnwidth_len + hud_fontsize_x; + tmp_x = hud_fixscoreboardcolumnwidth_len + hud_fontsize.x; if (is_self) drawstring(pos - tmp, str, hud_fontsize, hud_field_rgb, scoreboard_alpha_name_self, DRAWFLAG_NORMAL); else drawstring(pos - tmp, str, hud_fontsize, hud_field_rgb, scoreboard_alpha_name, DRAWFLAG_NORMAL); } - tmp_x = hud_size[i] + hud_fontsize_x; + tmp_x = hud_size[i] + hud_fontsize.x; if(hud_field_icon0 != "") if (is_self) - drawpic(pos - tmp, hud_field_icon0, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon0_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL); + drawpic(pos - tmp, hud_field_icon0, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon0_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL); else - drawpic(pos - tmp, hud_field_icon0, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon0_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL); + drawpic(pos - tmp, hud_field_icon0, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon0_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL); if(hud_field_icon1 != "") if (is_self) - drawpic(pos - tmp, hud_field_icon1, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon1_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL); + drawpic(pos - tmp, hud_field_icon1, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon1_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL); else - drawpic(pos - tmp, hud_field_icon1, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon1_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL); + drawpic(pos - tmp, hud_field_icon1, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon1_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL); if(hud_field_icon2 != "") if (is_self) - drawpic(pos - tmp, hud_field_icon2, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon2_rgb, hud_field_icon2_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL); + drawpic(pos - tmp, hud_field_icon2, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon2_rgb, hud_field_icon2_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL); else - drawpic(pos - tmp, hud_field_icon2, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon2_rgb, hud_field_icon2_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL); + drawpic(pos - tmp, hud_field_icon2, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon2_rgb, hud_field_icon2_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL); } if(hud_field[i] == SP_SEPARATOR) @@ -760,7 +760,7 @@ void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_s break; if(is_spec && field != SP_NAME && field != SP_PING) { - pos_x -= hud_size[i] + hud_fontsize_x; + pos.x -= hud_size[i] + hud_fontsize.x; continue; } @@ -784,20 +784,20 @@ void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_s tmp_x = hud_size[i]; if(hud_field_icon0 != "") if (is_self) - drawpic(pos - tmp, hud_field_icon0, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon0_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL); + drawpic(pos - tmp, hud_field_icon0, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon0_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL); else - drawpic(pos - tmp, hud_field_icon0, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon0_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL); + drawpic(pos - tmp, hud_field_icon0, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon0_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL); if(hud_field_icon1 != "") if (is_self) - drawpic(pos - tmp, hud_field_icon1, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon1_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL); + drawpic(pos - tmp, hud_field_icon1, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon1_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL); else - drawpic(pos - tmp, hud_field_icon1, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon1_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL); + drawpic(pos - tmp, hud_field_icon1, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon1_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL); if(hud_field_icon2 != "") if (is_self) - drawpic(pos - tmp, hud_field_icon2, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon2_rgb, hud_field_icon2_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL); + drawpic(pos - tmp, hud_field_icon2, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon2_rgb, hud_field_icon2_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL); else - drawpic(pos - tmp, hud_field_icon2, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon2_rgb, hud_field_icon2_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL); - pos_x -= hud_size[i] + hud_fontsize_x; + drawpic(pos - tmp, hud_field_icon2, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon2_rgb, hud_field_icon2_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL); + pos.x -= hud_size[i] + hud_fontsize.x; } } @@ -817,13 +817,13 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz vector tmp = '0 0 0', column_dim = '0 0 0'; entity pl; - body_table_height = 1.25 * hud_fontsize_y * max(1, tm.team_size); // no player? show 1 empty line + body_table_height = 1.25 * hud_fontsize.y * max(1, tm.team_size); // no player? show 1 empty line - pos_y += autocvar_scoreboard_border_thickness; + pos.y += autocvar_scoreboard_border_thickness; pos -= '1 1 0'; tmp_x = sbwidth + 2; - tmp_y = 1.25 * hud_fontsize_y; + tmp_y = 1.25 * hud_fontsize.y; // rounded header if (teamplay) @@ -832,16 +832,16 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz drawpic(pos, "gfx/scoreboard/scoreboard_tableheader", tmp, rgb + '0.5 0.5 0.5', scoreboard_alpha_bg, DRAWFLAG_NORMAL); // table border - tmp_y += autocvar_scoreboard_border_thickness; - tmp_y += body_table_height; + tmp.y += autocvar_scoreboard_border_thickness; + tmp.y += body_table_height; drawborderlines(autocvar_scoreboard_border_thickness, pos, tmp, '0 0 0', scoreboard_alpha_bg, DRAWFLAG_NORMAL); // more transparency for the scoreboard // separator header/table - pos_y += 1.25 * hud_fontsize_y; + pos.y += 1.25 * hud_fontsize.y; tmp_y = autocvar_scoreboard_border_thickness; drawfill(pos, tmp, '0 0 0', scoreboard_alpha_bg, DRAWFLAG_NORMAL); - pos_y += autocvar_scoreboard_border_thickness; + pos.y += autocvar_scoreboard_border_thickness; // table background tmp_y = body_table_height; @@ -854,16 +854,16 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz //drawfill(pos, tmp + '2 0 0', rgb, 0.1, DRAWFLAG_NORMAL); // go back to the top to make alternated columns highlighting and to print the strings - pos_y -= 1.25 * hud_fontsize_y; - pos_y -= autocvar_scoreboard_border_thickness; + pos.y -= 1.25 * hud_fontsize.y; + pos.y -= autocvar_scoreboard_border_thickness; pos += '1 1 0'; if (scoreboard_highlight) { - column_dim_y = 1.25 * hud_fontsize_y; // header - column_dim_y += autocvar_scoreboard_border_thickness; - column_dim_y += body_table_height; + column_dim_y = 1.25 * hud_fontsize.y; // header + column_dim.y += autocvar_scoreboard_border_thickness; + column_dim.y += body_table_height; } // print the strings of the columns headers and draw the columns @@ -872,14 +872,14 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz { if(hud_field[i] == SP_SEPARATOR) break; - column_dim_x = hud_size[i] + hud_fontsize_x; + column_dim_x = hud_size[i] + hud_fontsize.x; if (scoreboard_highlight) { if (i % 2) - drawfill(pos - '0 1 0' - hud_fontsize_x / 2 * '1 0 0', column_dim, '0 0 0', scoreboard_alpha_bg * 0.2, DRAWFLAG_NORMAL); + drawfill(pos - '0 1 0' - hud_fontsize.x / 2 * '1 0 0', column_dim, '0 0 0', scoreboard_alpha_bg * 0.2, DRAWFLAG_NORMAL); } drawstring(pos, hud_title[i], hud_fontsize, rgb * 1.5, scoreboard_alpha_fg, DRAWFLAG_NORMAL); - pos_x += column_dim_x; + pos.x += column_dim.x; } if(hud_field[i] == SP_SEPARATOR) { @@ -890,35 +890,35 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz if(hud_field[i] == SP_SEPARATOR) break; - pos_x -= hud_size[i]; + pos.x -= hud_size[i]; if (scoreboard_highlight) { if (!(i % 2)) { if (i == hud_num_fields-1) - column_dim_x = hud_size[i] + hud_fontsize_x / 2 + 1; + column_dim_x = hud_size[i] + hud_fontsize.x / 2 + 1; else - column_dim_x = hud_size[i] + hud_fontsize_x; - drawfill(pos - '0 1 0' - hud_fontsize_x / 2 * '1 0 0', column_dim, '0 0 0', scoreboard_alpha_bg * 0.2, DRAWFLAG_NORMAL); + column_dim_x = hud_size[i] + hud_fontsize.x; + drawfill(pos - '0 1 0' - hud_fontsize.x / 2 * '1 0 0', column_dim, '0 0 0', scoreboard_alpha_bg * 0.2, DRAWFLAG_NORMAL); } } tmp_x = stringwidth(hud_title[i], FALSE, hud_fontsize); - tmp_x = (hud_size[i] - tmp_x); + tmp_x = (hud_size[i] - tmp.x); drawstring(pos + tmp, hud_title[i], hud_fontsize, rgb * 1.5, scoreboard_alpha_fg, DRAWFLAG_NORMAL); - pos_x -= hud_fontsize_x; + pos.x -= hud_fontsize.x; } } draw_endBoldFont(); pos_x = xmin; - pos_y += 1.25 * hud_fontsize_y; // skip the header - pos_y += autocvar_scoreboard_border_thickness; + pos.y += 1.25 * hud_fontsize.y; // skip the header + pos.y += autocvar_scoreboard_border_thickness; // item size tmp_x = sbwidth; - tmp_y = hud_fontsize_y * 1.25; + tmp_y = hud_fontsize.y * 1.25; // fill the table and draw the rows i = 0; @@ -928,7 +928,7 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz if(pl.team != tm.team) continue; HUD_PrintScoreboardItem(pos, tmp, pl, (pl.sv_entnum == player_localnum), i); - pos_y += 1.25 * hud_fontsize_y; + pos.y += 1.25 * hud_fontsize.y; ++i; } else @@ -937,13 +937,13 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz if(pl.team == NUM_SPECTATOR) continue; HUD_PrintScoreboardItem(pos, tmp, pl, (pl.sv_entnum == player_localnum), i); - pos_y += 1.25 * hud_fontsize_y; + pos.y += 1.25 * hud_fontsize.y; ++i; } if (i == 0) - pos_y += 1.25 * hud_fontsize_y; // move to the end of the table - pos_y += 1.25 * hud_fontsize_y; // move empty row (out of the table) + pos.y += 1.25 * hud_fontsize.y; // move to the end of the table + pos.y += 1.25 * hud_fontsize.y; // move empty row (out of the table) return pos; } @@ -981,7 +981,7 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size) float g_instagib = 0; drawstring(pos, sprintf(_("Accuracy stats (average %d%%)"), average_accuracy), hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL); - pos_y += 1.25 * hud_fontsize_y + autocvar_scoreboard_border_thickness; + pos.y += 1.25 * hud_fontsize.y + autocvar_scoreboard_border_thickness; vector tmp = '0 0 0'; tmp_x = sbwidth; tmp_y = height * rows; @@ -1009,7 +1009,7 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size) float weapons_with_stats; weapons_with_stats = 0; if(rows == 2) - pos_x += weapon_width / 2; + pos.x += weapon_width / 2; if(switchweapon == WEP_VAPORIZER) g_instagib = 1; // TODO: real detection for instagib? @@ -1053,10 +1053,10 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size) drawstring(pos + '1 0 0' * padding + '0 1 0' * weapon_height, s, '1 1 0' * fontsize, rgb, scoreboard_alpha_fg, DRAWFLAG_NORMAL); } - pos_x += weapon_width * rows; + pos.x += weapon_width * rows; if(rows == 2 && i == 6) { - pos_x -= sbwidth; - pos_y += height; + pos.x -= sbwidth; + pos.y += height; } } @@ -1064,22 +1064,22 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size) average_accuracy = floor((average_accuracy * 100 / weapons_with_stats) + 0.5); if(rows == 2) - pos_x -= weapon_width / 2; - pos_x -= sbwidth; - pos_y += height; + pos.x -= weapon_width / 2; + pos.x -= sbwidth; + pos.y += height; - pos_y += 1.25 * hud_fontsize_y; + pos.y += 1.25 * hud_fontsize.y; return pos; } vector HUD_DrawKeyValue(vector pos, string key, string value) { - float px = pos_x; - pos_x += hud_fontsize_x * 0.25; + float px = pos.x; + pos.x += hud_fontsize.x * 0.25; drawstring(pos, key, hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL); - pos_x = xmax - stringwidth(value, FALSE, hud_fontsize) - hud_fontsize_x * 0.25; + pos_x = xmax - stringwidth(value, FALSE, hud_fontsize) - hud_fontsize.x * 0.25; drawstring(pos, value, hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL); pos_x = px; - pos_y+= hud_fontsize_y; + pos.y+= hud_fontsize.y; return pos; } @@ -1110,12 +1110,12 @@ vector HUD_DrawMapStats(vector pos, vector rgb, vector bg_size) { // draw table header drawstring(pos, _("Map stats:"), hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL); - pos_y += 1.25 * hud_fontsize_y + autocvar_scoreboard_border_thickness; + pos.y += 1.25 * hud_fontsize.y + autocvar_scoreboard_border_thickness; // draw table vector tmp = '0 0 0'; tmp_x = sbwidth; - tmp_y = hud_fontsize_y * rows; + tmp_y = hud_fontsize.y * rows; if (teamplay) drawpic_tiled(pos, "gfx/scoreboard/scoreboard_bg", bg_size, tmp, rgb * autocvar_scoreboard_color_bg_team, scoreboard_alpha_bg, DRAWFLAG_NORMAL); @@ -1138,7 +1138,7 @@ vector HUD_DrawMapStats(vector pos, vector rgb, vector bg_size) { } // update position - pos_y += 1.25 * hud_fontsize_y; + pos.y += 1.25 * hud_fontsize.y; return pos; } @@ -1161,12 +1161,12 @@ vector HUD_DrawScoreboardRankings(vector pos, entity pl, vector rgb, vector bg_ hl_rgb_y = autocvar_scoreboard_color_bg_g + 0.5; hl_rgb_z = autocvar_scoreboard_color_bg_b + 0.5; - pos_y += hud_fontsize_y; + pos.y += hud_fontsize.y; drawstring(pos, _("Rankings"), hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL); - pos_y += hud_fontsize_y + autocvar_scoreboard_border_thickness; + pos.y += hud_fontsize.y + autocvar_scoreboard_border_thickness; vector tmp = '0 0 0'; tmp_x = sbwidth; - tmp_y = 1.25 * hud_fontsize_y * RANKINGS_RECEIVED_CNT; + tmp_y = 1.25 * hud_fontsize.y * RANKINGS_RECEIVED_CNT; if (teamplay) drawpic_tiled(pos, "gfx/scoreboard/scoreboard_bg", bg_size, tmp, rgb * autocvar_scoreboard_color_bg_team, scoreboard_alpha_bg, DRAWFLAG_NORMAL); @@ -1185,15 +1185,15 @@ vector HUD_DrawScoreboardRankings(vector pos, entity pl, vector rgb, vector bg_ n = grecordholder[i]; p = count_ordinal(i+1); if(grecordholder[i] == GetPlayerName(player_localnum)) - drawfill(pos, '1 0 0' * sbwidth + '0 1.25 0' * hud_fontsize_y, hl_rgb, scoreboard_highlight_alpha_self, DRAWFLAG_NORMAL); + drawfill(pos, '1 0 0' * sbwidth + '0 1.25 0' * hud_fontsize.y, hl_rgb, scoreboard_highlight_alpha_self, DRAWFLAG_NORMAL); else if(!(i % 2) && scoreboard_highlight) - drawfill(pos, '1 0 0' * sbwidth + '0 1.25 0' * hud_fontsize_y, hl_rgb, scoreboard_highlight_alpha, DRAWFLAG_NORMAL); - drawstring(pos, p, '1 1 0' * hud_fontsize_y, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL); - drawstring(pos + '3 0 0' * hud_fontsize_y, TIME_ENCODED_TOSTRING(t), '1 1 0' * hud_fontsize_y, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL); - drawcolorcodedstring(pos + '8 0 0' * hud_fontsize_y, n, '1 1 0' * hud_fontsize_y, scoreboard_alpha_fg, DRAWFLAG_NORMAL); - pos_y += 1.25 * hud_fontsize_y; + drawfill(pos, '1 0 0' * sbwidth + '0 1.25 0' * hud_fontsize.y, hl_rgb, scoreboard_highlight_alpha, DRAWFLAG_NORMAL); + drawstring(pos, p, '1 1 0' * hud_fontsize.y, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL); + drawstring(pos + '3 0 0' * hud_fontsize.y, TIME_ENCODED_TOSTRING(t), '1 1 0' * hud_fontsize.y, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL); + drawcolorcodedstring(pos + '8 0 0' * hud_fontsize.y, n, '1 1 0' * hud_fontsize.y, scoreboard_alpha_fg, DRAWFLAG_NORMAL); + pos.y += 1.25 * hud_fontsize.y; } - pos_y += autocvar_scoreboard_border_thickness; + pos.y += autocvar_scoreboard_border_thickness; return pos; } @@ -1261,7 +1261,7 @@ void HUD_DrawScoreboard() drawstring(pos, _("Scoreboard"), sb_heading_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL); draw_endBoldFont(); - pos_y += sb_heading_fontsize_y + hud_fontsize_y * 0.25; + pos.y += sb_heading_fontsize.y + hud_fontsize.y * 0.25; // Draw the scoreboard vector bg_size = draw_getimagesize("gfx/scoreboard/scoreboard_bg") * autocvar_scoreboard_bg_scale; @@ -1269,7 +1269,7 @@ void HUD_DrawScoreboard() if(teamplay) { vector team_score_baseoffset; - team_score_baseoffset = eY * (2 * autocvar_scoreboard_border_thickness + hud_fontsize_y) - eX * (autocvar_scoreboard_border_thickness + hud_fontsize_x * 0.25); + team_score_baseoffset = eY * (2 * autocvar_scoreboard_border_thickness + hud_fontsize.y) - eX * (autocvar_scoreboard_border_thickness + hud_fontsize.x * 0.25); for(tm = teams.sort_next; tm; tm = tm.sort_next) { if(tm.team == NUM_SPECTATOR) @@ -1283,7 +1283,7 @@ void HUD_DrawScoreboard() if(ts_primary != ts_secondary) { str = ftos(tm.(teamscores[ts_secondary])); - drawstring(pos + team_score_baseoffset - eX * stringwidth(str, FALSE, hud_fontsize) + eY * hud_fontsize_y * 1.5, str, hud_fontsize, rgb, scoreboard_alpha_fg, DRAWFLAG_NORMAL); + drawstring(pos + team_score_baseoffset - eX * stringwidth(str, FALSE, hud_fontsize) + eY * hud_fontsize.y * 1.5, str, hud_fontsize, rgb, scoreboard_alpha_fg, DRAWFLAG_NORMAL); } draw_endBoldFont(); @@ -1311,11 +1311,11 @@ void HUD_DrawScoreboard() if(gametype == MAPINFO_TYPE_CTS || gametype == MAPINFO_TYPE_RACE) { if(race_speedaward) { drawcolorcodedstring(pos, sprintf(_("Speed award: %d ^7(%s^7)"), race_speedaward, race_speedaward_holder), hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL); - pos_y += 1.25 * hud_fontsize_y; + pos.y += 1.25 * hud_fontsize.y; } if(race_speedaward_alltimebest) { drawcolorcodedstring(pos, sprintf(_("All-time fastest: %d ^7(%s^7)"), race_speedaward_alltimebest, race_speedaward_alltimebest_holder), hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL); - pos_y += 1.25 * hud_fontsize_y; + pos.y += 1.25 * hud_fontsize.y; } pos = HUD_DrawScoreboardRankings(pos, playerslots[player_localnum], rgb, bg_size); } @@ -1338,13 +1338,13 @@ void HUD_DrawScoreboard() tmp = pos; vector item_size; item_size_x = sbwidth; - item_size_y = hud_fontsize_y * 1.25; + item_size_y = hud_fontsize.y * 1.25; item_size_z = 0; for(pl = players.sort_next; pl; pl = pl.sort_next) { if(pl.team != NUM_SPECTATOR) continue; - pos_y += 1.25 * hud_fontsize_y; + pos.y += 1.25 * hud_fontsize.y; HUD_PrintScoreboardItem(pos, item_size, pl, (pl.sv_entnum == player_localnum), specs); ++specs; } @@ -1354,7 +1354,7 @@ void HUD_DrawScoreboard() draw_beginBoldFont(); drawstring(tmp, _("Spectators"), hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL); draw_endBoldFont(); - pos_y += 1.25 * hud_fontsize_y; + pos.y += 1.25 * hud_fontsize.y; } // Print info string @@ -1412,7 +1412,7 @@ void HUD_DrawScoreboard() } } - pos_y += 1.2 * hud_fontsize_y; + pos.y += 1.2 * hud_fontsize.y; drawcolorcodedstring(pos + '0.5 0 0' * (sbwidth - stringwidth(str, TRUE, hud_fontsize)), str, hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL); // print information about respawn status @@ -1447,9 +1447,9 @@ void HUD_DrawScoreboard() else if(time >= respawn_time) str = sprintf(_("You are dead, press ^2%s^7 to respawn"), getcommandkey("jump", "+jump")); - pos_y += 1.2 * hud_fontsize_y; + pos.y += 1.2 * hud_fontsize.y; drawcolorcodedstring(pos + '0.5 0 0' * (sbwidth - stringwidth(str, TRUE, hud_fontsize)), str, hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL); } - scoreboard_bottom = pos_y + 2 * hud_fontsize_y; + scoreboard_bottom = pos.y + 2 * hud_fontsize.y; } diff --git a/qcsrc/client/shownames.qc b/qcsrc/client/shownames.qc index 8aeb12a04..779898608 100644 --- a/qcsrc/client/shownames.qc +++ b/qcsrc/client/shownames.qc @@ -51,10 +51,10 @@ void Draw_ShowNames(entity ent) if(e == ent) continue; eo = project_3d_to_2d(e.origin); - if (!(eo_z < 0 || eo_x < 0 || eo_y < 0 || eo_x > vid_conwidth || eo_y > vid_conheight)) + if (!(eo.z < 0 || eo.x < 0 || eo.y < 0 || eo.x > vid_conwidth || eo.y > vid_conheight)) { eo_z = 0; - if(vlen((eX * o_x + eY * o_y) - eo) < autocvar_hud_shownames_antioverlap_distance && vlen(ent.origin - view_origin) > vlen(e.origin - view_origin)) + if(vlen((eX * o.x + eY * o.y) - eo) < autocvar_hud_shownames_antioverlap_distance && vlen(ent.origin - view_origin) > vlen(e.origin - view_origin)) { overlap = TRUE; break; @@ -63,8 +63,8 @@ void Draw_ShowNames(entity ent) } } - onscreen = (o_z >= 0 && o_x >= 0 && o_y >= 0 && o_x <= vid_conwidth && o_y <= vid_conheight); - crosshairdistance = sqrt( pow(o_x - vid_conwidth/2, 2) + pow(o_y - vid_conheight/2, 2) ); + onscreen = (o.z >= 0 && o.x >= 0 && o.y >= 0 && o.x <= vid_conwidth && o.y <= vid_conheight); + crosshairdistance = sqrt( pow(o.x - vid_conwidth/2, 2) + pow(o.y - vid_conheight/2, 2) ); if(autocvar_hud_shownames_crosshairdistance) { @@ -123,26 +123,26 @@ void Draw_ShowNames(entity ent) resize = 0.5 + 0.5 * ((autocvar_hud_shownames_maxdistance - autocvar_hud_shownames_mindistance) - max(0, dist - autocvar_hud_shownames_mindistance)) / (autocvar_hud_shownames_maxdistance - autocvar_hud_shownames_mindistance); // draw the sprite image - if(o_z >= 0) + if(o.z >= 0) { o_z = 0; vector myPos, mySize; mySize = (eX * autocvar_hud_shownames_aspect + eY) * autocvar_hud_shownames_fontsize; - myPos = o - '0.5 0 0' * mySize_x - '0 1 0' * mySize_y; + myPos = o - '0.5 0 0' * mySize.x - '0 1 0' * mySize.y; // size scaling - mySize_x *= resize; - mySize_y *= resize; + mySize.x *= resize; + mySize.y *= resize; - myPos_x += 0.5 * (mySize_x / resize - mySize_x); - myPos_y += (mySize_y / resize - mySize_y); + myPos.x += 0.5 * (mySize.x / resize - mySize.x); + myPos.y += (mySize.y / resize - mySize.y); vector namepos; // this is where the origin of the string float namewidth; namepos = myPos; - namewidth = mySize_x; + namewidth = mySize.x; if(autocvar_hud_shownames_status && teamplay) { @@ -150,10 +150,10 @@ void Draw_ShowNames(entity ent) { if(ent.healthvalue > 0) { - HUD_Panel_DrawProgressBar(namepos + '0 1 0' * autocvar_hud_shownames_fontsize * resize, eX * 0.5 * mySize_x + eY * resize * autocvar_hud_shownames_statusbar_height, "nametag_statusbar", ent.healthvalue/autocvar_hud_panel_healtharmor_maxhealth, 0, 1, '1 0 0', a, DRAWFLAG_NORMAL); + HUD_Panel_DrawProgressBar(namepos + '0 1 0' * autocvar_hud_shownames_fontsize * resize, eX * 0.5 * mySize.x + eY * resize * autocvar_hud_shownames_statusbar_height, "nametag_statusbar", ent.healthvalue/autocvar_hud_panel_healtharmor_maxhealth, 0, 1, '1 0 0', a, DRAWFLAG_NORMAL); if(ent.armorvalue > 0) - HUD_Panel_DrawProgressBar(namepos + '0 1 0' * autocvar_hud_shownames_fontsize * resize + eX * 0.5 * mySize_x, eX * 0.5 * mySize_x + eY * resize * autocvar_hud_shownames_statusbar_height, "nametag_statusbar", ent.armorvalue/autocvar_hud_panel_healtharmor_maxarmor, 0, 0, '0 1 0', a, DRAWFLAG_NORMAL); + HUD_Panel_DrawProgressBar(namepos + '0 1 0' * autocvar_hud_shownames_fontsize * resize + eX * 0.5 * mySize.x, eX * 0.5 * mySize.x + eY * resize * autocvar_hud_shownames_statusbar_height, "nametag_statusbar", ent.armorvalue/autocvar_hud_panel_healtharmor_maxarmor, 0, 0, '0 1 0', a, DRAWFLAG_NORMAL); } } } @@ -170,7 +170,7 @@ void Draw_ShowNames(entity ent) width = stringwidth(s, TRUE, '1 1 0' * autocvar_hud_shownames_fontsize); if (width != namewidth) - namepos_x += (namewidth - width) / 2; + namepos.x += (namewidth - width) / 2; drawcolorcodedstring(namepos, s, '1 1 0' * autocvar_hud_shownames_fontsize, a, DRAWFLAG_NORMAL); drawfontscale = '1 1 0'; } diff --git a/qcsrc/client/teamradar.qc b/qcsrc/client/teamradar.qc index 5bb3f45a5..9cf5aa0ae 100644 --- a/qcsrc/client/teamradar.qc +++ b/qcsrc/client/teamradar.qc @@ -9,24 +9,24 @@ float v_flipped; float vlen2d(vector v) { - return sqrt(v_x * v_x + v_y * v_y); + return sqrt(v.x * v.x + v.y * v.y); } float vlen_maxnorm2d(vector v) { - return max(v_x, v_y, -v_x, -v_y); + return max(v.x, v.y, -v.x, -v.y); } float vlen_minnorm2d(vector v) { - return min(max(v_x, -v_x), max(v_y, -v_y)); + return min(max(v.x, -v.x), max(v.y, -v.y)); } vector teamradar_3dcoord_to_texcoord(vector in) { vector out; - out_x = (in_x - mi_picmin_x) / (mi_picmax_x - mi_picmin_x); - out_y = (in_y - mi_picmin_y) / (mi_picmax_y - mi_picmin_y); + out_x = (in.x - mi_picmin.x) / (mi_picmax.x - mi_picmin.x); + out_y = (in.y - mi_picmin.y) / (mi_picmax.y - mi_picmin.y); out_z = 0; return out; } @@ -37,18 +37,18 @@ vector teamradar_texcoord_to_2dcoord(vector in) in -= teamradar_origin3d_in_texcoord; out = rotate(in, teamradar_angle * DEG2RAD); - out_y = - out_y; // screen space is reversed + out_y = - out.y; // screen space is reversed out = out * teamradar_size; if(v_flipped) - out_x = -out_x; + out_x = -out.x; out += teamradar_origin2d; return out; } vector yinvert(vector v) { - v_y = 1 - v_y; + v_y = 1 - v.y; return v; } @@ -89,15 +89,15 @@ void draw_teamradar_player(vector coord3d, vector pangles, vector rgb) makevectors(pangles - '0 1 0' * teamradar_angle); if(v_flipped) { - v_forward_x = -v_forward_x; - v_right_x = -v_right_x; - v_up_x = -v_up_x; + v_forward_x = -v_forward.x; + v_right_x = -v_right.x; + v_up_x = -v_up.x; } v_forward_z = 0; v_forward = normalize(v_forward); - v_forward_y *= -1.0; - v_right_x = -v_forward_y; - v_right_y = v_forward_x; + v_forward.y *= -1.0; + v_right_x = -v_forward.y; + v_right_y = v_forward.x; if(rgb == '1 1 1') rgb2 = '0 0 0'; @@ -151,9 +151,9 @@ void draw_teamradar_link(vector start, vector end, int colors) start = teamradar_texcoord_to_2dcoord(teamradar_3dcoord_to_texcoord(start)); end = teamradar_texcoord_to_2dcoord(teamradar_3dcoord_to_texcoord(end)); norm = normalize(start - end); - norm_z = norm_x; - norm_x = -norm_y; - norm_y = norm_z; + norm_z = norm.x; + norm_x = -norm.y; + norm_y = norm.z; norm_z = 0; c0 = colormapPaletteColor(colors & 0x0F, FALSE); @@ -194,8 +194,8 @@ void teamradar_loadcvars() // match this to defaultXonotic.cfg! if(!hud_panel_radar_scale) hud_panel_radar_scale = 4096; if(!hud_panel_radar_foreground_alpha) hud_panel_radar_foreground_alpha = 0.8 * panel_fg_alpha; - if(!hud_panel_radar_size_x) hud_panel_radar_size_x = 128; - if(!hud_panel_radar_size_y) hud_panel_radar_size_y = hud_panel_radar_size_x; + if(!hud_panel_radar_size.x) hud_panel_radar_size_x = 128; + if(!hud_panel_radar_size.y) hud_panel_radar_size_y = hud_panel_radar_size.x; } // radar links diff --git a/qcsrc/client/tturrets.qc b/qcsrc/client/tturrets.qc index ba640068e..aaa43bd80 100644 --- a/qcsrc/client/tturrets.qc +++ b/qcsrc/client/tturrets.qc @@ -248,11 +248,11 @@ void turret_draw2d() { // TODO: Vehicle tactical hud o = project_3d_to_2d(self.origin + '0 0 32'); - if(o_z < 0 - || o_x < (vid_conwidth * waypointsprite_edgeoffset_left) - || o_y < (vid_conheight * waypointsprite_edgeoffset_top) - || o_x > (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) - || o_y > (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom))) + if(o.z < 0 + || o.x < (vid_conwidth * waypointsprite_edgeoffset_left) + || o.y < (vid_conheight * waypointsprite_edgeoffset_top) + || o.x > (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) + || o.y > (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom))) return; // Dont draw wp's for turrets out of view o_z = 0; if(hud != HUD_NORMAL) @@ -326,24 +326,24 @@ void turret_draw2d() rgb = fixrgbexcess(rgb); o = project_3d_to_2d(self.origin + '0 0 64'); - if(o_z < 0 - || o_x < (vid_conwidth * waypointsprite_edgeoffset_left) - || o_y < (vid_conheight * waypointsprite_edgeoffset_top) - || o_x > (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) - || o_y > (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom))) + if(o.z < 0 + || o.x < (vid_conwidth * waypointsprite_edgeoffset_left) + || o.y < (vid_conheight * waypointsprite_edgeoffset_top) + || o.x > (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) + || o.y > (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom))) return; // Dont draw wp's for turrets out of view o_z = 0; float edgedistance_min, crosshairdistance; - edgedistance_min = min((o_y - (vid_conheight * waypointsprite_edgeoffset_top)), - (o_x - (vid_conwidth * waypointsprite_edgeoffset_left)), - (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) - o_x, - (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)) - o_y); + edgedistance_min = min((o.y - (vid_conheight * waypointsprite_edgeoffset_top)), + (o.x - (vid_conwidth * waypointsprite_edgeoffset_left)), + (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) - o.x, + (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)) - o.y); float vidscale = max(vid_conwidth / vid_width, vid_conheight / vid_height); - crosshairdistance = sqrt( pow(o_x - vid_conwidth/2, 2) + pow(o_y - vid_conheight/2, 2) ); + crosshairdistance = sqrt( pow(o.x - vid_conwidth/2, 2) + pow(o.y - vid_conheight/2, 2) ); t = waypointsprite_scale * vidscale; a *= waypointsprite_alpha; @@ -395,7 +395,7 @@ void turret_walker_draw() movelib_groundalign4point(300, 100, 0.25, 45); setorigin(self, self.origin + self.velocity * dt); self.tur_head.angles += dt * self.tur_head.move_avelocity; - self.angles_y = self.move_angles_y; + self.angles_y = self.move_angles.y; if (self.health < 127) if(random() < 0.15) @@ -414,7 +414,7 @@ void turret_ewheel_draw() fixedmakevectors(self.angles); setorigin(self, self.origin + self.velocity * dt); self.tur_head.angles += dt * self.tur_head.move_avelocity; - self.angles_y = self.move_angles_y; + self.angles_y = self.move_angles.y; if (self.health < 127) if(random() < 0.05) @@ -584,7 +584,7 @@ void turret_die() { headgib.angles = headgib.move_angles = self.tur_head.angles; headgib.avelocity = headgib.move_avelocity = self.tur_head.move_avelocity + randomvec() * 45; - headgib.avelocity_y = headgib.move_avelocity_y = headgib.move_avelocity_y * 5; + headgib.avelocity_y = headgib.move_avelocity_y = headgib.move_avelocity.y * 5; headgib.gravity = 0.5; } } diff --git a/qcsrc/client/vehicles/vehicles.qc b/qcsrc/client/vehicles/vehicles.qc index 9119318e6..c8cb149b4 100644 --- a/qcsrc/client/vehicles/vehicles.qc +++ b/qcsrc/client/vehicles/vehicles.qc @@ -75,7 +75,7 @@ void AuxiliaryXhair_Draw2D() psize = self.axh_scale * draw_getimagesize(self.axh_image); loc = project_3d_to_2d(self.move_origin) - 0.5 * psize; - if (!(loc_z < 0 || loc_x < 0 || loc_y < 0 || loc_x > vid_conwidth || loc_y > vid_conheight)) + if (!(loc.z < 0 || loc.x < 0 || loc.y < 0 || loc.x > vid_conwidth || loc.y > vid_conheight)) { loc_z = 0; psize_z = 0; @@ -104,12 +104,12 @@ void Net_AuXair2(bool bIsNew) AuxiliaryXhair[axh_id] = axh; } - axh.move_origin_x = ReadCoord(); - axh.move_origin_y = ReadCoord(); - axh.move_origin_z = ReadCoord(); - axh.colormod_x = ReadByte() / 255; - axh.colormod_y = ReadByte() / 255; - axh.colormod_z = ReadByte() / 255; + axh.move_origin_x = ReadCoord(); + axh.move_origin_y = ReadCoord(); + axh.move_origin_z = ReadCoord(); + axh.colormod_x = ReadByte() / 255; + axh.colormod_y = ReadByte() / 255; + axh.colormod_z = ReadByte() / 255; axh.cnt = time; axh.draw2d = AuxiliaryXhair_Draw2D; } @@ -233,8 +233,8 @@ void CSQC_BUMBLE_HUD() HUD_GETSTATS picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale; - hudloc_y = vid_conheight - picsize_y; - hudloc_x = vid_conwidth * 0.5 - picsize_x * 0.5; + hudloc_y = vid_conheight - picsize.y; + hudloc_x = vid_conwidth * 0.5 - picsize.x * 0.5; drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL); @@ -258,7 +258,7 @@ void CSQC_BUMBLE_HUD() // Health bar picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale; picloc = '69 69 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - vh_health)), 0, vid_conwidth, vid_conheight); + drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight); drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL); drawresetcliparea(); // .. and icon @@ -287,7 +287,7 @@ void CSQC_BUMBLE_HUD() // Shield bar picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale; picloc = '69 140 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - shield)), 0, vid_conwidth, vid_conheight); + drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight); drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); drawresetcliparea(); // .. and icon @@ -318,16 +318,16 @@ void CSQC_BUMBLE_HUD() // Gunner1 bar picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale; picloc = '450 69 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x, picloc_y, picsize_x * ammo1, vid_conheight); + drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * ammo1, vid_conheight); drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); drawresetcliparea(); // Right gunner slot occupied? if(!AuxiliaryXhair[1].draw2d) { - shield = (picsize_x * 0.5) - (0.5 * stringwidth(_("No right gunner!"), FALSE, '1 0 0' * picsize_y + '0 1 0' * picsize_y)); + shield = (picsize.x * 0.5) - (0.5 * stringwidth(_("No right gunner!"), FALSE, '1 0 0' * picsize.y + '0 1 0' * picsize.y)); drawfill(hudloc + picloc - '0.2 0.2 0', picsize + '0.4 0.4 0', '0.25 0.25 0.25', 0.75, DRAWFLAG_NORMAL); - drawstring(hudloc + picloc + '1 0 0' * shield, _("No right gunner!"), '1 0 0' * picsize_y + '0 1 0' * picsize_y, '1 0 0' + '0 1 1' * sin(time * 10), 1, DRAWFLAG_NORMAL); + drawstring(hudloc + picloc + '1 0 0' * shield, _("No right gunner!"), '1 0 0' * picsize.y + '0 1 0' * picsize.y, '1 0 0' + '0 1 1' * sin(time * 10), 1, DRAWFLAG_NORMAL); } // .. and icon @@ -341,15 +341,15 @@ void CSQC_BUMBLE_HUD() // Gunner2 bar picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale; picloc = '450 140 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x, picloc_y, picsize_x * ammo2, vid_conheight); + drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * ammo2, vid_conheight); drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); drawresetcliparea(); // Left gunner slot occupied? if(!AuxiliaryXhair[2].draw2d) { - shield = (picsize_x * 0.5) - (0.5 * stringwidth(_("No left gunner!"), FALSE, '1 0 0' * picsize_y + '0 1 0' * picsize_y)); + shield = (picsize.x * 0.5) - (0.5 * stringwidth(_("No left gunner!"), FALSE, '1 0 0' * picsize.y + '0 1 0' * picsize.y)); drawfill(hudloc + picloc - '0.2 0.2 0', picsize + '0.4 0.4 0', '0.25 0.25 0.25', 0.75, DRAWFLAG_NORMAL); - drawstring(hudloc + picloc + '1 0 0' * shield, _("No left gunner!"), '1 0 0' * picsize_y + '0 1 0' * picsize_y, '1 0 0' + '0 1 1' * sin(time * 10), 1, DRAWFLAG_NORMAL); + drawstring(hudloc + picloc + '1 0 0' * shield, _("No left gunner!"), '1 0 0' * picsize.y + '0 1 0' * picsize.y, '1 0 0' + '0 1 1' * sin(time * 10), 1, DRAWFLAG_NORMAL); } // .. and icon @@ -365,9 +365,9 @@ void CSQC_BUMBLE_HUD() else { picsize = draw_getimagesize(waki_xhair); - picsize_x *= 0.5; - picsize_y *= 0.5; - drawpic('0.5 0 0' * (vid_conwidth - picsize_x) + '0 0.5 0' * (vid_conheight - picsize_y), waki_xhair, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); + picsize.x *= 0.5; + picsize.y *= 0.5; + drawpic('0.5 0 0' * (vid_conwidth - picsize.x) + '0 0.5 0' * (vid_conheight - picsize.y), waki_xhair, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); } } @@ -384,8 +384,8 @@ void CSQC_BUMBLE_GUN_HUD() HUD_GETSTATS picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale; - hudloc_y = vid_conheight - picsize_y; - hudloc_x = vid_conwidth * 0.5 - picsize_x * 0.5; + hudloc_y = vid_conheight - picsize.y; + hudloc_x = vid_conwidth * 0.5 - picsize.x * 0.5; drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL); @@ -408,7 +408,7 @@ void CSQC_BUMBLE_GUN_HUD() // Health bar picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale; picloc = '69 69 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - vh_health)), 0, vid_conwidth, vid_conheight); + drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight); drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL); drawresetcliparea(); // .. and icon @@ -437,7 +437,7 @@ void CSQC_BUMBLE_GUN_HUD() // Shield bar picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale; picloc = '69 140 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - shield)), 0, vid_conwidth, vid_conheight); + drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight); drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); drawresetcliparea(); // .. and icon @@ -465,7 +465,7 @@ void CSQC_BUMBLE_GUN_HUD() // Gun bar picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale; picloc = '450 69 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x, picloc_y, picsize_x * energy, vid_conheight); + drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * energy, vid_conheight); drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); drawresetcliparea(); @@ -506,8 +506,8 @@ void CSQC_SPIDER_HUD() HUD_GETSTATS picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale; - hudloc_y = vid_conheight - picsize_y; - hudloc_x = vid_conwidth * 0.5 - picsize_x * 0.5; + hudloc_y = vid_conheight - picsize.y; + hudloc_x = vid_conwidth * 0.5 - picsize.x * 0.5; drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL); @@ -529,7 +529,7 @@ void CSQC_SPIDER_HUD() // Health bar picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale; picloc = '69 69 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - vh_health)), 0, vid_conwidth, vid_conheight); + drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight); drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL); drawresetcliparea(); // .. and icon @@ -556,7 +556,7 @@ void CSQC_SPIDER_HUD() // Shield bar picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale; picloc = '69 140 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - shield)), 0, vid_conwidth, vid_conheight); + drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight); drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); drawresetcliparea(); // .. and icon @@ -584,7 +584,7 @@ void CSQC_SPIDER_HUD() // Minigun bar picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale; picloc = '450 69 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x, picloc_y, picsize_x * ammo1, vid_conheight); + drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * ammo1, vid_conheight); drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); drawresetcliparea(); // .. and icon @@ -597,21 +597,21 @@ void CSQC_SPIDER_HUD() // Rocket ammo bar picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale; - ammo1 = picsize_x / 8; + ammo1 = picsize.x / 8; picloc = '450 140 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x, hudloc_y + picloc_y, picsize_x * reload2, vid_conheight); + drawsetcliparea(hudloc.x + picloc.x, hudloc.y + picloc.y, picsize.x * reload2, vid_conheight); drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); drawresetcliparea(); // .. and icons pic2size = 0.35 * draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale; - picloc_x -= pic2size_x; - picloc_y += pic2size_y * 2.25; + picloc.x -= pic2size.x; + picloc.y += pic2size.y * 2.25; if(ammo2 == 9) { for(i = 1; i < 9; ++i) { - picloc_x += ammo1; + picloc.x += ammo1; drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, ((8 * reload2 <= i) ? '0 0 0' : '1 1 1'), 0.75, DRAWFLAG_NORMAL); } } @@ -619,7 +619,7 @@ void CSQC_SPIDER_HUD() { for(i = 1; i < 9; ++i) { - picloc_x += ammo1; + picloc.x += ammo1; drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, ((i >= ammo2) ? '1 1 1' : '0 0 0'), 0.75, DRAWFLAG_NORMAL); } } @@ -650,10 +650,10 @@ void CSQC_SPIDER_HUD() } picsize = draw_getimagesize(spider_xhair); - picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size; - picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size; + picsize.x *= autocvar_cl_vehicle_spiderbot_cross_size; + picsize.y *= autocvar_cl_vehicle_spiderbot_cross_size; - drawpic('0.5 0 0' * (vid_conwidth - picsize_x) + '0 0.5 0' * (vid_conheight - picsize_y), spider_xhair, picsize, '1 1 1', autocvar_cl_vehicle_spiderbot_cross_alpha, DRAWFLAG_ADDITIVE); + drawpic('0.5 0 0' * (vid_conwidth - picsize.x) + '0 0.5 0' * (vid_conheight - picsize.y), spider_xhair, picsize, '1 1 1', autocvar_cl_vehicle_spiderbot_cross_alpha, DRAWFLAG_ADDITIVE); } } @@ -668,8 +668,8 @@ void CSQC_RAPTOR_HUD() HUD_GETSTATS picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale; - hudloc_y = vid_conheight - picsize_y; - hudloc_x = vid_conwidth * 0.5 - picsize_x * 0.5; + hudloc_y = vid_conheight - picsize.y; + hudloc_x = vid_conwidth * 0.5 - picsize.x * 0.5; drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL); @@ -694,7 +694,7 @@ void CSQC_RAPTOR_HUD() // Health bar picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale; picloc = '69 69 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - vh_health)), 0, vid_conwidth, vid_conheight); + drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight); drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL); drawresetcliparea(); // .. and icon @@ -723,7 +723,7 @@ void CSQC_RAPTOR_HUD() // Shield bar picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale; picloc = '69 140 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - shield)), 0, vid_conwidth, vid_conheight); + drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight); drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); drawresetcliparea(); // .. and icon @@ -751,7 +751,7 @@ void CSQC_RAPTOR_HUD() // Gun bar picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale; picloc = '450 69 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x, picloc_y, picsize_x * energy, vid_conheight); + drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * energy, vid_conheight); drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); drawresetcliparea(); // .. and icon @@ -765,7 +765,7 @@ void CSQC_RAPTOR_HUD() // Bomb bar picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale; picloc = '450 140 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x, hudloc_y + picloc_y, picsize_x * reload1, vid_conheight); + drawsetcliparea(hudloc.x + picloc.x, hudloc.y + picloc.y, picsize.x * reload1, vid_conheight); drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); drawresetcliparea(); // .. and icon @@ -805,10 +805,10 @@ void CSQC_RAPTOR_HUD() setorigin(dropmark, trace_endpos); picsize = draw_getimagesize(raptor_drop) * 0.2; - if (!(where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)) + if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight)) { - where_x -= picsize_x * 0.5; - where_y -= picsize_y * 0.5; + where.x -= picsize.x * 0.5; + where.y -= picsize.y * 0.5; where_z = 0; drawpic(where, raptor_drop, picsize, '0 2 0', 1, DRAWFLAG_ADDITIVE); } @@ -822,10 +822,10 @@ void CSQC_RAPTOR_HUD() where = project_3d_to_2d(dropmark.origin); picsize = draw_getimagesize(raptor_drop) * 0.25; - if (!(where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)) + if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight)) { - where_x -= picsize_x * 0.5; - where_y -= picsize_y * 0.5; + where.x -= picsize.x * 0.5; + where.y -= picsize.y * 0.5; where_z = 0; drawpic(where, raptor_drop, picsize, '2 0 0', 1, DRAWFLAG_ADDITIVE); } @@ -838,10 +838,10 @@ void CSQC_RAPTOR_HUD() else { picsize = draw_getimagesize(raptor_xhair); - picsize_x *= 0.5; - picsize_y *= 0.5; + picsize.x *= 0.5; + picsize.y *= 0.5; - drawpic('0.5 0 0' * (vid_conwidth - picsize_x) + '0 0.5 0' * (vid_conheight - picsize_y), raptor_xhair, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); + drawpic('0.5 0 0' * (vid_conwidth - picsize.x) + '0 0.5 0' * (vid_conheight - picsize.y), raptor_xhair, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); } } @@ -862,8 +862,8 @@ void CSQC_WAKIZASHI_HUD() HUD_GETSTATS picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale; - hudloc_y = vid_conheight - picsize_y; - hudloc_x = vid_conwidth * 0.5 - picsize_x * 0.5; + hudloc_y = vid_conheight - picsize.y; + hudloc_x = vid_conwidth * 0.5 - picsize.x * 0.5; drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL); @@ -886,7 +886,7 @@ void CSQC_WAKIZASHI_HUD() // Health bar picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale; picloc = '69 69 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - vh_health)), 0, vid_conwidth, vid_conheight); + drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight); drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL); drawresetcliparea(); // .. and icon @@ -916,7 +916,7 @@ void CSQC_WAKIZASHI_HUD() // Shield bar picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale; picloc = '69 140 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - shield)), 0, vid_conwidth, vid_conheight); + drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight); drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); drawresetcliparea(); // .. and icon @@ -944,7 +944,7 @@ void CSQC_WAKIZASHI_HUD() // Gun bar picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale; picloc = '450 69 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x, picloc_y, picsize_x * energy, vid_conheight); + drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * energy, vid_conheight); drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); drawresetcliparea(); // .. and icon @@ -958,7 +958,7 @@ void CSQC_WAKIZASHI_HUD() // Bomb bar picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale; picloc = '450 140 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x, hudloc_y + picloc_y, picsize_x * reload1, vid_conheight); + drawsetcliparea(hudloc.x + picloc.x, hudloc.y + picloc.y, picsize.x * reload1, vid_conheight); drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); drawresetcliparea(); // .. and icon @@ -974,11 +974,11 @@ void CSQC_WAKIZASHI_HUD() else { picsize = draw_getimagesize(waki_xhair); - picsize_x *= 0.5; - picsize_y *= 0.5; + picsize.x *= 0.5; + picsize.y *= 0.5; - drawpic('0.5 0 0' * (vid_conwidth - picsize_x) + '0 0.5 0' * (vid_conheight - picsize_y), waki_xhair, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); + drawpic('0.5 0 0' * (vid_conwidth - picsize.x) + '0 0.5 0' * (vid_conheight - picsize.y), waki_xhair, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); } } diff --git a/qcsrc/client/waypointsprites.qc b/qcsrc/client/waypointsprites.qc index ae6fcffcc..9390396b8 100644 --- a/qcsrc/client/waypointsprites.qc +++ b/qcsrc/client/waypointsprites.qc @@ -55,9 +55,9 @@ void drawrotpic(vector org, float rot, string pic, vector sz, vector hotspot, ve // hotspot-relative coordinates of the corners v1 = hotspot; - v2 = hotspot + '1 0 0' * sz_x; - v3 = hotspot + '1 0 0' * sz_x + '0 1 0' * sz_y; - v4 = hotspot + '0 1 0' * sz_y; + v2 = hotspot + '1 0 0' * sz.x; + v3 = hotspot + '1 0 0' * sz.x + '0 1 0' * sz.y; + v4 = hotspot + '0 1 0' * sz.y; // rotate them, and make them absolute rot = -rot; // rotate by the opposite angle, as our coordinate system is reversed @@ -103,7 +103,7 @@ void drawhealthbar(vector org, float rot, float h, vector sz, vector hotspot, fl up = rotate(up, rot); owidth = width + 2 * border; - o = o - up * (margin + border + height) + ri * (sz_x - owidth) * 0.5; + o = o - up * (margin + border + height) + ri * (sz.x - owidth) * 0.5; drawquad(o - up * border, ri * owidth, up * border, "", rgb, a, f); drawquad(o + up * height, ri * owidth, up * border, "", rgb, a, f); @@ -154,7 +154,7 @@ vector drawspritetext(vector o, float ang, float minwidth, vector rgb, float a, w = sw; else w = minwidth; - h = fontsize_y; + h = fontsize.y; // how do corners work? aspect = vid_conwidth / vid_conheight; @@ -172,25 +172,25 @@ vector drawspritetext(vector o, float ang, float minwidth, vector rgb, float a, } // align - o_x -= w * algnx; - o_y -= h * algny; + o.x -= w * algnx; + o.y -= h * algny; // we want to be onscreen - if(o_x < 0) + if(o.x < 0) o_x = 0; - if(o_y < 0) + if(o.y < 0) o_y = 0; - if(o_x > vid_conwidth - w) + if(o.x > vid_conwidth - w) o_x = vid_conwidth - w; - if(o_y > vid_conheight - h) + if(o.y > vid_conheight - h) o_x = vid_conheight - h; - o_x += 0.5 * (w - sw); + o.x += 0.5 * (w - sw); drawstring(o, s, fontsize, rgb, a, DRAWFLAG_NORMAL); - o_x += 0.5 * sw; - o_y += 0.5 * h; + o.x += 0.5 * sw; + o.y += 0.5 * h; return o; } @@ -297,51 +297,51 @@ vector fixrgbexcess_move(vector rgb, vector src, vector dst) } vector fixrgbexcess(vector rgb) { - if(rgb_x > 1) + if(rgb.x > 1) { rgb = fixrgbexcess_move(rgb, '1 0 0', '0 1 1'); - if(rgb_y > 1) + if(rgb.y > 1) { rgb = fixrgbexcess_move(rgb, '0 1 0', '0 0 1'); - if(rgb_z > 1) + if(rgb.z > 1) rgb_z = 1; } - else if(rgb_z > 1) + else if(rgb.z > 1) { rgb = fixrgbexcess_move(rgb, '0 0 1', '0 1 0'); - if(rgb_y > 1) + if(rgb.y > 1) rgb_y = 1; } } - else if(rgb_y > 1) + else if(rgb.y > 1) { rgb = fixrgbexcess_move(rgb, '0 1 0', '1 0 1'); - if(rgb_x > 1) + if(rgb.x > 1) { rgb = fixrgbexcess_move(rgb, '1 0 0', '0 0 1'); - if(rgb_z > 1) + if(rgb.z > 1) rgb_z = 1; } - else if(rgb_z > 1) + else if(rgb.z > 1) { rgb = fixrgbexcess_move(rgb, '0 0 1', '1 0 0'); - if(rgb_x > 1) + if(rgb.x > 1) rgb_x = 1; } } - else if(rgb_z > 1) + else if(rgb.z > 1) { rgb = fixrgbexcess_move(rgb, '0 0 1', '1 1 0'); - if(rgb_x > 1) + if(rgb.x > 1) { rgb = fixrgbexcess_move(rgb, '1 0 0', '0 1 0'); - if(rgb_y > 1) + if(rgb.y > 1) rgb_y = 1; } - else if(rgb_y > 1) + else if(rgb.y > 1) { rgb = fixrgbexcess_move(rgb, '0 1 0', '1 0 0'); - if(rgb_x > 1) + if(rgb.x > 1) rgb_x = 1; } } @@ -450,27 +450,27 @@ void Draw_WaypointSprite() float ang; o = project_3d_to_2d(self.origin); - if(o_z < 0 - || o_x < (vid_conwidth * waypointsprite_edgeoffset_left) - || o_y < (vid_conheight * waypointsprite_edgeoffset_top) - || o_x > (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) - || o_y > (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom))) + if(o.z < 0 + || o.x < (vid_conwidth * waypointsprite_edgeoffset_left) + || o.y < (vid_conheight * waypointsprite_edgeoffset_top) + || o.x > (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) + || o.y > (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom))) { // scale it to be just in view vector d; float f1, f2; d = o - '0.5 0 0' * vid_conwidth - '0 0.5 0' * vid_conheight; - ang = atan2(-d_x, -d_y); - if(o_z < 0) + ang = atan2(-d.x, -d.y); + if(o.z < 0) ang += M_PI; - f1 = d_x / vid_conwidth; - f2 = d_y / vid_conheight; + f1 = d.x / vid_conwidth; + f2 = d.y / vid_conheight; if(max(f1, -f1) > max(f2, -f2)) { - if(d_z * f1 > 0) + if(d.z * f1 > 0) { // RIGHT edge d = d * ((0.5 - waypointsprite_edgeoffset_right) / f1); @@ -483,7 +483,7 @@ void Draw_WaypointSprite() } else { - if(d_z * f2 > 0) + if(d.z * f2 > 0) { // BOTTOM edge d = d * ((0.5 - waypointsprite_edgeoffset_bottom) / f2); @@ -504,21 +504,21 @@ void Draw_WaypointSprite() #else vector d; d = o - '0.5 0 0' * vid_conwidth - '0 0.5 0' * vid_conheight; - ang = atan2(-d_x, -d_y); + ang = atan2(-d.x, -d.y); #endif } o_z = 0; float edgedistance_min, crosshairdistance; - edgedistance_min = min((o_y - (vid_conheight * waypointsprite_edgeoffset_top)), - (o_x - (vid_conwidth * waypointsprite_edgeoffset_left)), - (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) - o_x, - (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)) - o_y); + edgedistance_min = min((o.y - (vid_conheight * waypointsprite_edgeoffset_top)), + (o.x - (vid_conwidth * waypointsprite_edgeoffset_left)), + (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) - o.x, + (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)) - o.y); float vidscale; vidscale = max(vid_conwidth / vid_width, vid_conheight / vid_height); - crosshairdistance = sqrt( pow(o_x - vid_conwidth/2, 2) + pow(o_y - vid_conheight/2, 2) ); + crosshairdistance = sqrt( pow(o.x - vid_conwidth/2, 2) + pow(o.y - vid_conheight/2, 2) ); t = waypointsprite_scale * vidscale; a *= waypointsprite_alpha; diff --git a/qcsrc/client/weapons/projectile.qc b/qcsrc/client/weapons/projectile.qc index fa0828442..a6302bb28 100644 --- a/qcsrc/client/weapons/projectile.qc +++ b/qcsrc/client/weapons/projectile.qc @@ -36,7 +36,7 @@ void Projectile_DrawTrail(vector to) // force the effect even for stationary firemine if(self.cnt == PROJECTILE_FIREMINE) if(from == to) - from_z += 1; + from.z += 1; if (self.traileffect) { @@ -116,7 +116,7 @@ void Projectile_Draw() vector ang; ang = self.angles; - ang_x = -ang_x; + ang_x = -ang.x; makevectors(ang); a = 1 - (time - self.fade_time) * self.fade_rate; diff --git a/qcsrc/common/animdecide.qc b/qcsrc/common/animdecide.qc index a2837343e..4a3873991 100644 --- a/qcsrc/common/animdecide.qc +++ b/qcsrc/common/animdecide.qc @@ -84,7 +84,7 @@ vector animdecide_getupperanim(entity e) { // death etc. if(e.anim_state & ANIMSTATE_FROZEN) - return vec3(e.anim_idle_x, e.anim_time, ANIMPRIO_DEAD); + return vec3(e.anim_idle.x, e.anim_time, ANIMPRIO_DEAD); if(e.anim_state & ANIMSTATE_DEAD1) return vec3(e.anim_die1_x, e.anim_time, ANIMPRIO_DEAD); if(e.anim_state & ANIMSTATE_DEAD2) @@ -112,25 +112,25 @@ vector animdecide_getupperanim(entity e) case ANIMACTION_TAUNT: outframe = e.anim_taunt; break; case ANIMACTION_MELEE: outframe = e.anim_melee; break; } - if(outframe_x >= 0) + if(outframe.x >= 0) { - if(time <= t + outframe_y / outframe_z) + if(time <= t + outframe.y / outframe.z) { // animation is running! - return vec3(outframe_x, t, ANIMPRIO_ACTIVE); + return vec3(outframe.x, t, ANIMPRIO_ACTIVE); } } // or, decide the anim by state t = max(e.anim_time, e.anim_implicit_time); // but all states are for lower body! - return vec3(e.anim_idle_x, t, ANIMPRIO_IDLE); + return vec3(e.anim_idle.x, t, ANIMPRIO_IDLE); } vector animdecide_getloweranim(entity e) { // death etc. if(e.anim_state & ANIMSTATE_FROZEN) - return vec3(e.anim_idle_x, e.anim_time, ANIMPRIO_DEAD); + return vec3(e.anim_idle.x, e.anim_time, ANIMPRIO_DEAD); if(e.anim_state & ANIMSTATE_DEAD1) return vec3(e.anim_die1_x, e.anim_time, ANIMPRIO_DEAD); if(e.anim_state & ANIMSTATE_DEAD2) @@ -153,12 +153,12 @@ vector animdecide_getloweranim(entity e) { case ANIMACTION_JUMP: if(e.anim_implicit_state & ANIMIMPLICITSTATE_INAIR) { if(e.anim_state & ANIMSTATE_DUCK) outframe = e.anim_duckjump; else outframe = e.anim_jump; } break; } - if(outframe_x >= 0) + if(outframe.x >= 0) { - if(time <= t + outframe_y / outframe_z) + if(time <= t + outframe.y / outframe.z) { // animation is running! - return vec3(outframe_x, t, ANIMPRIO_ACTIVE); + return vec3(outframe.x, t, ANIMPRIO_ACTIVE); } } // or, decide the anim by state @@ -166,58 +166,58 @@ vector animdecide_getloweranim(entity e) if(e.anim_state & ANIMSTATE_DUCK) { if(e.anim_implicit_state & ANIMIMPLICITSTATE_INAIR) - return vec3(e.anim_duckjump_x, 0, ANIMPRIO_CROUCH); // play the END of the jump anim + return vec3(e.anim_duckjump.x, 0, ANIMPRIO_CROUCH); // play the END of the jump anim else switch(e.anim_implicit_state & (ANIMIMPLICITSTATE_FORWARD | ANIMIMPLICITSTATE_BACKWARDS | ANIMIMPLICITSTATE_LEFT | ANIMIMPLICITSTATE_RIGHT)) { case ANIMIMPLICITSTATE_FORWARD: - return vec3(e.anim_duckwalk_x, t, ANIMPRIO_CROUCH); + return vec3(e.anim_duckwalk.x, t, ANIMPRIO_CROUCH); case ANIMIMPLICITSTATE_BACKWARDS: - return vec3(e.anim_duckwalkbackwards_x, t, ANIMPRIO_CROUCH); + return vec3(e.anim_duckwalkbackwards.x, t, ANIMPRIO_CROUCH); case ANIMIMPLICITSTATE_RIGHT: - return vec3(e.anim_duckwalkstraferight_x, t, ANIMPRIO_CROUCH); + return vec3(e.anim_duckwalkstraferight.x, t, ANIMPRIO_CROUCH); case ANIMIMPLICITSTATE_LEFT: - return vec3(e.anim_duckwalkstrafeleft_x, t, ANIMPRIO_CROUCH); + return vec3(e.anim_duckwalkstrafeleft.x, t, ANIMPRIO_CROUCH); case ANIMIMPLICITSTATE_FORWARD | ANIMIMPLICITSTATE_RIGHT: - return vec3(e.anim_duckwalkforwardright_x, t, ANIMPRIO_CROUCH); + return vec3(e.anim_duckwalkforwardright.x, t, ANIMPRIO_CROUCH); case ANIMIMPLICITSTATE_FORWARD | ANIMIMPLICITSTATE_LEFT: - return vec3(e.anim_duckwalkforwardleft_x, t, ANIMPRIO_CROUCH); + return vec3(e.anim_duckwalkforwardleft.x, t, ANIMPRIO_CROUCH); case ANIMIMPLICITSTATE_BACKWARDS | ANIMIMPLICITSTATE_RIGHT: - return vec3(e.anim_duckwalkbackright_x, t, ANIMPRIO_CROUCH); + return vec3(e.anim_duckwalkbackright.x, t, ANIMPRIO_CROUCH); case ANIMIMPLICITSTATE_BACKWARDS | ANIMIMPLICITSTATE_LEFT: - return vec3(e.anim_duckwalkbackleft_x, t, ANIMPRIO_CROUCH); + return vec3(e.anim_duckwalkbackleft.x, t, ANIMPRIO_CROUCH); default: - return vec3(e.anim_duckidle_x, t, ANIMPRIO_CROUCH); + return vec3(e.anim_duckidle.x, t, ANIMPRIO_CROUCH); } } else { if(e.anim_implicit_state & ANIMIMPLICITSTATE_INAIR) - return vec3(e.anim_jump_x, 0, ANIMPRIO_ACTIVE); // play the END of the jump anim + return vec3(e.anim_jump.x, 0, ANIMPRIO_ACTIVE); // play the END of the jump anim else switch(e.anim_implicit_state & (ANIMIMPLICITSTATE_FORWARD | ANIMIMPLICITSTATE_BACKWARDS | ANIMIMPLICITSTATE_LEFT | ANIMIMPLICITSTATE_RIGHT)) { case ANIMIMPLICITSTATE_FORWARD: - return vec3(e.anim_run_x, t, ANIMPRIO_ACTIVE); + return vec3(e.anim_run.x, t, ANIMPRIO_ACTIVE); case ANIMIMPLICITSTATE_BACKWARDS: - return vec3(e.anim_runbackwards_x, t, ANIMPRIO_ACTIVE); + return vec3(e.anim_runbackwards.x, t, ANIMPRIO_ACTIVE); case ANIMIMPLICITSTATE_RIGHT: - return vec3(e.anim_straferight_x, t, ANIMPRIO_ACTIVE); + return vec3(e.anim_straferight.x, t, ANIMPRIO_ACTIVE); case ANIMIMPLICITSTATE_LEFT: - return vec3(e.anim_strafeleft_x, t, ANIMPRIO_ACTIVE); + return vec3(e.anim_strafeleft.x, t, ANIMPRIO_ACTIVE); case ANIMIMPLICITSTATE_FORWARD | ANIMIMPLICITSTATE_RIGHT: - return vec3(e.anim_forwardright_x, t, ANIMPRIO_ACTIVE); + return vec3(e.anim_forwardright.x, t, ANIMPRIO_ACTIVE); case ANIMIMPLICITSTATE_FORWARD | ANIMIMPLICITSTATE_LEFT: - return vec3(e.anim_forwardleft_x, t, ANIMPRIO_ACTIVE); + return vec3(e.anim_forwardleft.x, t, ANIMPRIO_ACTIVE); case ANIMIMPLICITSTATE_BACKWARDS | ANIMIMPLICITSTATE_RIGHT: - return vec3(e.anim_backright_x, t, ANIMPRIO_ACTIVE); + return vec3(e.anim_backright.x, t, ANIMPRIO_ACTIVE); case ANIMIMPLICITSTATE_BACKWARDS | ANIMIMPLICITSTATE_LEFT: - return vec3(e.anim_backleft_x, t, ANIMPRIO_ACTIVE); + return vec3(e.anim_backleft.x, t, ANIMPRIO_ACTIVE); default: - return vec3(e.anim_idle_x, t, ANIMPRIO_IDLE); + return vec3(e.anim_idle.x, t, ANIMPRIO_IDLE); } } // can't get here #ifdef GMQCC - return vec3(e.anim_idle_x, t, ANIMPRIO_IDLE); + return vec3(e.anim_idle.x, t, ANIMPRIO_IDLE); #endif } @@ -243,13 +243,13 @@ void animdecide_setimplicitstate(entity e, float onground) if(vlen(v) > 10) { - if(v_x > fabs(v_y) * 0.5) + if(v.x > fabs(v.y) * 0.5) s |= ANIMIMPLICITSTATE_FORWARD; - if(v_x < -fabs(v_y) * 0.5) + if(v.x < -fabs(v.y) * 0.5) s |= ANIMIMPLICITSTATE_BACKWARDS; - if(v_y > fabs(v_x) * 0.5) + if(v.y > fabs(v.x) * 0.5) s |= ANIMIMPLICITSTATE_RIGHT; - if(v_y < -fabs(v_x) * 0.5) + if(v.y < -fabs(v.x) * 0.5) s |= ANIMIMPLICITSTATE_LEFT; } if(!onground) @@ -279,27 +279,27 @@ void animdecide_setframes(entity e, float support_blending, .float fld_frame, .f //print("UPPER: ", vtos(upper), ", LOWER: ", vtos(lower), "\n"); if(support_blending) { - if(upper_z && !lower_z) + if(upper.z && !lower.z) lower = upper; - else if(lower_z && !upper_z) + else if(lower.z && !upper.z) upper = lower; - if(e.frame1time != upper_y || e.frame2time != lower_y) + if(e.frame1time != upper.y || e.frame2time != lower.y) BITXOR_ASSIGN(e.effects, EF_RESTARTANIM_BIT); - e.fld_frame = upper_x; - e.fld_frame1time = upper_y; - e.fld_frame2 = lower_x; - e.fld_frame2time = lower_y; + e.fld_frame = upper.x; + e.fld_frame1time = upper.y; + e.fld_frame2 = lower.x; + e.fld_frame2time = lower.y; } else { - if(upper_z > lower_z) + if(upper.z > lower.z) lower = upper; - else if(lower_z > upper_z) + else if(lower.z > upper.z) upper = lower; - if(e.frame1time != upper_y) + if(e.frame1time != upper.y) BITXOR_ASSIGN(e.effects, EF_RESTARTANIM_BIT); - e.fld_frame = upper_x; - e.fld_frame1time = upper_y; + e.fld_frame = upper.x; + e.fld_frame1time = upper.y; } } diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index bcc624d05..a110a818c 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -291,14 +291,14 @@ vector autocvar_sv_player_headsize = '24 24 12'; #define PL_HEAD autocvar_sv_player_headsize // helpers -#define PL_VIEW_OFS_z autocvar_sv_player_viewoffset_z -#define PL_MIN_z autocvar_sv_player_mins_z -#define PL_MAX_z autocvar_sv_player_maxs_z -#define PL_CROUCH_VIEW_OFS_z autocvar_sv_player_crouch_viewoffset_z -#define PL_CROUCH_MIN_z autocvar_sv_player_mins_z -#define PL_HEAD_x autocvar_sv_player_headsize_x -#define PL_HEAD_y autocvar_sv_player_headsize_y -#define PL_HEAD_z autocvar_sv_player_headsize_z +#define PL_VIEW_OFS_z autocvar_sv_player_viewoffset.z +#define PL_MIN_z autocvar_sv_player_mins.z +#define PL_MAX_z autocvar_sv_player_maxs.z +#define PL_CROUCH_VIEW_OFS_z autocvar_sv_player_crouch_viewoffset.z +#define PL_CROUCH_MIN_z autocvar_sv_player_mins.z +#define PL_HEAD_x autocvar_sv_player_headsize.x +#define PL_HEAD_y autocvar_sv_player_headsize.y +#define PL_HEAD_z autocvar_sv_player_headsize.z // spawnpoint prios const int SPAWN_PRIO_NEAR_TEAMMATE_FOUND = 200; diff --git a/qcsrc/common/mapinfo.qc b/qcsrc/common/mapinfo.qc index 2654d8706..98a22e493 100644 --- a/qcsrc/common/mapinfo.qc +++ b/qcsrc/common/mapinfo.qc @@ -293,12 +293,12 @@ float _MapInfo_Generate(string pFilename) // 0: failure, 1: ok ent, 2: ok bsp if(k == "origin") { o = stov(strcat("'", v, "'")); - mapMins_x = min(mapMins_x, o_x); - mapMins_y = min(mapMins_y, o_y); - mapMins_z = min(mapMins_z, o_z); - mapMaxs_x = max(mapMaxs_x, o_x); - mapMaxs_y = max(mapMaxs_y, o_y); - mapMaxs_z = max(mapMaxs_z, o_z); + mapMins_x = min(mapMins.x, o.x); + mapMins_y = min(mapMins.y, o.y); + mapMins_z = min(mapMins.z, o.z); + mapMaxs_x = max(mapMaxs.x, o.x); + mapMaxs_y = max(mapMaxs.y, o.y); + mapMaxs_z = max(mapMaxs.z, o.z); } else if(k == "race_place") { diff --git a/qcsrc/common/monsters/monster/shambler.qc b/qcsrc/common/monsters/monster/shambler.qc index 7c46a1da1..17f75c280 100644 --- a/qcsrc/common/monsters/monster/shambler.qc +++ b/qcsrc/common/monsters/monster/shambler.qc @@ -39,7 +39,7 @@ const float shambler_anim_death = 8; void shambler_smash() { makevectors(self.angles); - pointparticles(particleeffectnum("explosion_medium"), (self.origin + (v_forward * 150)) - ('0 0 1' * self.maxs_z), '0 0 0', 1); + pointparticles(particleeffectnum("explosion_medium"), (self.origin + (v_forward * 150)) - ('0 0 1' * self.maxs.z), '0 0 0', 1); sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM); tracebox(self.origin + v_forward * 50, self.mins * 0.5, self.maxs * 0.5, self.origin + v_forward * 500, MOVE_NORMAL, self); diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index fd966f5d2..b8c47d00a 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -290,7 +290,7 @@ void monster_makevectors(entity e) v = e.origin + (e.mins + e.maxs) * 0.5; self.v_angle = vectoangles(v - (self.origin + self.view_ofs)); - self.v_angle_x = -self.v_angle_x; + self.v_angle_x = -self.v_angle.x; makevectors(self.v_angle); } @@ -553,7 +553,7 @@ vector monster_pickmovetarget(entity targ) { pos_z = random() * 200; if(random() >= 0.5) - pos_z *= -1; + pos.z *= -1; } } @@ -564,7 +564,7 @@ vector monster_pickmovetarget(entity targ) void monster_CalculateVelocity(entity mon, vector to, vector from, float turnrate, float movespeed) { - float current_distance = vlen((('1 0 0' * to_x) + ('0 1 0' * to_y)) - (('1 0 0' * from_x) + ('0 1 0' * from_y))); // for the sake of this check, exclude Z axis + float current_distance = vlen((('1 0 0' * to.x) + ('0 1 0' * to.y)) - (('1 0 0' * from.x) + ('0 1 0' * from.y))); // for the sake of this check, exclude Z axis float initial_height = 0; //min(50, (targ_distance * tanh(20))); float current_height = (initial_height * min(1, (current_distance / self.pass_distance))); //print("current_height = ", ftos(current_height), ", initial_height = ", ftos(initial_height), ".\n"); @@ -729,7 +729,7 @@ void monster_move(float runspeed, float walkspeed, float stopspeed, float manim_ WarpZone_RefSys_AddInverse(self.enemy, self); // wz1^-1 ... wzn^-1 receiver self.moveto = WarpZone_RefSys_TransformOrigin(self.enemy, self, (0.5 * (self.enemy.absmin + self.enemy.absmax))); - self.pass_distance = vlen((('1 0 0' * self.enemy.origin_x) + ('0 1 0' * self.enemy.origin_y)) - (('1 0 0' * self.origin_x) + ('0 1 0' * self.origin_y))); + self.pass_distance = vlen((('1 0 0' * self.enemy.origin.x) + ('0 1 0' * self.enemy.origin.y)) - (('1 0 0' * self.origin.x) + ('0 1 0' * self.origin.y))); MonsterSound(monstersound_sight, 0, FALSE, CH_VOICE); } } @@ -762,7 +762,7 @@ void monster_move(float runspeed, float walkspeed, float stopspeed, float manim_ if(!(((self.flags & FL_FLY) && (self.spawnflags & MONSTERFLAG_FLY_VERTICAL)) || (self.flags & FL_SWIM))) //v_forward = normalize(self.moveto - self.origin); //else - self.moveto_z = self.origin_z; + self.moveto_z = self.origin.z; if(vlen(self.origin - self.moveto) > 64) { @@ -804,7 +804,7 @@ void monster_move(float runspeed, float walkspeed, float stopspeed, float manim_ turny = 0; if(turny) { - turny = bound(turny * -1, shortangle_f(real_angle_y, self.angles_y), turny); + turny = bound(turny * -1, shortangle_f(real_angle.y, self.angles.y), turny); self.angles_y += turny; } @@ -975,8 +975,8 @@ void monsters_damage (entity inflictor, entity attacker, float damage, float dea float take, save; v = healtharmor_applydamage(self.armorvalue, self.m_armor_blockpercent, deathtype, damage); - take = v_x; - save = v_y; + take = v.x; + save = v.y; self.health -= take; @@ -1118,7 +1118,7 @@ float monster_spawn() MonsterSound(monstersound_spawn, 0, FALSE, CH_VOICE); - WaypointSprite_Spawn(M_NAME(self.monsterid), 0, 1024, self, '0 0 1' * (self.maxs_z + 15), world, self.team, self, sprite, TRUE, RADARICON_DANGER, ((self.team) ? Team_ColorRGB(self.team) : '1 0 0')); + WaypointSprite_Spawn(M_NAME(self.monsterid), 0, 1024, self, '0 0 1' * (self.maxs.z + 15), world, self.team, self, sprite, TRUE, RADARICON_DANGER, ((self.team) ? Team_ColorRGB(self.team) : '1 0 0')); if(!(self.spawnflags & MONSTERFLAG_INVINCIBLE)) { WaypointSprite_UpdateMaxHealth(self.sprite, self.max_health); @@ -1182,7 +1182,7 @@ float monster_initialize(float mon_id) self.netname = mon.netname; self.monster_name = M_NAME(mon_id); self.candrop = TRUE; - self.view_ofs = '0 0 1' * (self.maxs_z * 0.5); + self.view_ofs = '0 0 1' * (self.maxs.z * 0.5); self.oldtarget2 = self.target2; self.pass_distance = 0; self.deadflag = DEAD_NO; diff --git a/qcsrc/common/nades.qc b/qcsrc/common/nades.qc index 22280c36c..5d67ef34e 100644 --- a/qcsrc/common/nades.qc +++ b/qcsrc/common/nades.qc @@ -9,9 +9,9 @@ float healer_send(entity to, float sf) if(sf & 1) { - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); + WriteCoord(MSG_ENTITY, self.origin.x); + WriteCoord(MSG_ENTITY, self.origin.y); + WriteCoord(MSG_ENTITY, self.origin.z); WriteByte(MSG_ENTITY, self.healer_lifetime); //WriteByte(MSG_ENTITY, self.ltime - time + 1); @@ -44,7 +44,7 @@ void healer_setup() setorigin(self, self.origin); - float model_radius = self.maxs_x; + float model_radius = self.maxs.x; vector size = '1 1 1' * self.healer_radius / 2; setsize(self,-size,size); self.healer_radius = self.healer_radius/model_radius*0.6; diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index 9e022a8ad..beb27aa28 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -480,15 +480,15 @@ string ScoreString(int pFlags, float pValue) float dotproduct(vector a, vector b) { - return a_x * b_x + a_y * b_y + a_z * b_z; + return a.x * b.x + a.y * b.y + a.z * b.z; } vector cross(vector a, vector b) { return - '1 0 0' * (a_y * b_z - a_z * b_y) - + '0 1 0' * (a_z * b_x - a_x * b_z) - + '0 0 1' * (a_x * b_y - a_y * b_x); + '1 0 0' * (a.y * b.z - a.z * b.y) + + '0 1 0' * (a.z * b.x - a.x * b.z) + + '0 0 1' * (a.x * b.y - a.y * b.x); } // compressed vector format: @@ -574,23 +574,23 @@ float compressShortVector(vector vec) return 0; //print("compress: ", vtos(vec), "\n"); ang = vectoangles(vec); - ang_x = -ang_x; - if(ang_x < -90) - ang_x += 360; - if(ang_x < -90 && ang_x > +90) + ang_x = -ang.x; + if(ang.x < -90) + ang.x += 360; + if(ang.x < -90 && ang.x > +90) error("BOGUS vectoangles"); //print("angles: ", vtos(ang), "\n"); - p = floor(0.5 + (ang_x + 90) * 16 / 180) & 15; // -90..90 to 0..14 + p = floor(0.5 + (ang.x + 90) * 16 / 180) & 15; // -90..90 to 0..14 if(p == 0) { - if(vec_z < 0) + if(vec.z < 0) y = 31; else y = 30; } else - y = floor(0.5 + ang_y * 32 / 360) & 31; // 0..360 to 0..32 + y = floor(0.5 + ang.y * 32 / 360) & 31; // 0..360 to 0..32 len = invertLengthLog(vlen(vec)); //print("compressed: p ", ftos(p)); print("y ", ftos(y)); print("len ", ftos(len), "\n"); @@ -763,7 +763,7 @@ void get_mi_min_max(float mode) mi_min = mi; mi_max = ma; MapInfo_Get_ByName(mi_shortname, 0, 0); - if(MapInfo_Map_mins_x < MapInfo_Map_maxs_x) + if(MapInfo_Map_mins.x < MapInfo_Map_maxs.x) { mi_min = MapInfo_Map_mins; mi_max = MapInfo_Map_maxs; @@ -774,59 +774,59 @@ void get_mi_min_max(float mode) if(mode) { // be clever - tracebox('1 0 0' * mi_x, - '0 1 0' * mi_y + '0 0 1' * mi_z, - '0 1 0' * ma_y + '0 0 1' * ma_z, - '1 0 0' * ma_x, + tracebox('1 0 0' * mi.x, + '0 1 0' * mi.y + '0 0 1' * mi.z, + '0 1 0' * ma.y + '0 0 1' * ma.z, + '1 0 0' * ma.x, MOVE_WORLDONLY, world); if(!trace_startsolid) - mi_min_x = trace_endpos_x; + mi_min_x = trace_endpos.x; - tracebox('0 1 0' * mi_y, - '1 0 0' * mi_x + '0 0 1' * mi_z, - '1 0 0' * ma_x + '0 0 1' * ma_z, - '0 1 0' * ma_y, + tracebox('0 1 0' * mi.y, + '1 0 0' * mi.x + '0 0 1' * mi.z, + '1 0 0' * ma.x + '0 0 1' * ma.z, + '0 1 0' * ma.y, MOVE_WORLDONLY, world); if(!trace_startsolid) - mi_min_y = trace_endpos_y; + mi_min_y = trace_endpos.y; - tracebox('0 0 1' * mi_z, - '1 0 0' * mi_x + '0 1 0' * mi_y, - '1 0 0' * ma_x + '0 1 0' * ma_y, - '0 0 1' * ma_z, + tracebox('0 0 1' * mi.z, + '1 0 0' * mi.x + '0 1 0' * mi.y, + '1 0 0' * ma.x + '0 1 0' * ma.y, + '0 0 1' * ma.z, MOVE_WORLDONLY, world); if(!trace_startsolid) - mi_min_z = trace_endpos_z; + mi_min_z = trace_endpos.z; - tracebox('1 0 0' * ma_x, - '0 1 0' * mi_y + '0 0 1' * mi_z, - '0 1 0' * ma_y + '0 0 1' * ma_z, - '1 0 0' * mi_x, + tracebox('1 0 0' * ma.x, + '0 1 0' * mi.y + '0 0 1' * mi.z, + '0 1 0' * ma.y + '0 0 1' * ma.z, + '1 0 0' * mi.x, MOVE_WORLDONLY, world); if(!trace_startsolid) - mi_max_x = trace_endpos_x; + mi_max_x = trace_endpos.x; - tracebox('0 1 0' * ma_y, - '1 0 0' * mi_x + '0 0 1' * mi_z, - '1 0 0' * ma_x + '0 0 1' * ma_z, - '0 1 0' * mi_y, + tracebox('0 1 0' * ma.y, + '1 0 0' * mi.x + '0 0 1' * mi.z, + '1 0 0' * ma.x + '0 0 1' * ma.z, + '0 1 0' * mi.y, MOVE_WORLDONLY, world); if(!trace_startsolid) - mi_max_y = trace_endpos_y; + mi_max_y = trace_endpos.y; - tracebox('0 0 1' * ma_z, - '1 0 0' * mi_x + '0 1 0' * mi_y, - '1 0 0' * ma_x + '0 1 0' * ma_y, - '0 0 1' * mi_z, + tracebox('0 0 1' * ma.z, + '1 0 0' * mi.x + '0 1 0' * mi.y, + '1 0 0' * ma.x + '0 1 0' * ma.y, + '0 0 1' * mi.z, MOVE_WORLDONLY, world); if(!trace_startsolid) - mi_max_z = trace_endpos_z; + mi_max_z = trace_endpos.z; } } } @@ -843,15 +843,15 @@ void get_mi_min_max_texcoords(float mode) // extend mi_picmax to get a square aspect ratio // center the map in that area extend = mi_picmax - mi_picmin; - if(extend_y > extend_x) + if(extend.y > extend.x) { - mi_picmin_x -= (extend_y - extend_x) * 0.5; - mi_picmax_x += (extend_y - extend_x) * 0.5; + mi_picmin.x -= (extend.y - extend.x) * 0.5; + mi_picmax.x += (extend.y - extend.x) * 0.5; } else { - mi_picmin_y -= (extend_x - extend_y) * 0.5; - mi_picmax_y += (extend_x - extend_y) * 0.5; + mi_picmin.y -= (extend.x - extend.y) * 0.5; + mi_picmax.y += (extend.x - extend.y) * 0.5; } // add another some percent @@ -862,10 +862,10 @@ void get_mi_min_max_texcoords(float mode) // calculate the texcoords mi_pictexcoord0 = mi_pictexcoord1 = mi_pictexcoord2 = mi_pictexcoord3 = '0 0 0'; // first the two corners of the origin - mi_pictexcoord0_x = (mi_min_x - mi_picmin_x) / (mi_picmax_x - mi_picmin_x); - mi_pictexcoord0_y = (mi_min_y - mi_picmin_y) / (mi_picmax_y - mi_picmin_y); - mi_pictexcoord2_x = (mi_max_x - mi_picmin_x) / (mi_picmax_x - mi_picmin_x); - mi_pictexcoord2_y = (mi_max_y - mi_picmin_y) / (mi_picmax_y - mi_picmin_y); + mi_pictexcoord0_x = (mi_min.x - mi_picmin.x) / (mi_picmax.x - mi_picmin.x); + mi_pictexcoord0_y = (mi_min.y - mi_picmin.y) / (mi_picmax.y - mi_picmin.y); + mi_pictexcoord2_x = (mi_max.x - mi_picmin.x) / (mi_picmax.x - mi_picmin.x); + mi_pictexcoord2_y = (mi_max.y - mi_picmin.y) / (mi_picmax.y - mi_picmin.y); // then the other corners mi_pictexcoord1_x = mi_pictexcoord0_x; mi_pictexcoord1_y = mi_pictexcoord2_y; @@ -1033,17 +1033,17 @@ float rgb_mi_ma_to_hue(vector rgb, float mi, float ma) { if(mi == ma) return 0; - else if(ma == rgb_x) + else if(ma == rgb.x) { - if(rgb_y >= rgb_z) - return (rgb_y - rgb_z) / (ma - mi); + if(rgb.y >= rgb.z) + return (rgb.y - rgb.z) / (ma - mi); else - return (rgb_y - rgb_z) / (ma - mi) + 6; + return (rgb.y - rgb.z) / (ma - mi) + 6; } - else if(ma == rgb_y) - return (rgb_z - rgb_x) / (ma - mi) + 2; + else if(ma == rgb.y) + return (rgb.z - rgb.x) / (ma - mi) + 2; else // if(ma == rgb_z) - return (rgb_x - rgb_y) / (ma - mi) + 4; + return (rgb.x - rgb.y) / (ma - mi) + 4; } vector hue_mi_ma_to_rgb(float hue, float mi, float ma) @@ -1105,8 +1105,8 @@ vector rgb_to_hsv(vector rgb) float mi, ma; vector hsv; - mi = min(rgb_x, rgb_y, rgb_z); - ma = max(rgb_x, rgb_y, rgb_z); + mi = min(rgb.x, rgb.y, rgb.z); + ma = max(rgb.x, rgb.y, rgb.z); hsv_x = rgb_mi_ma_to_hue(rgb, mi, ma); hsv_z = ma; @@ -1121,7 +1121,7 @@ vector rgb_to_hsv(vector rgb) vector hsv_to_rgb(vector hsv) { - return hue_mi_ma_to_rgb(hsv_x, hsv_z * (1 - hsv_y), hsv_z); + return hue_mi_ma_to_rgb(hsv.x, hsv.z * (1 - hsv.y), hsv.z); } vector rgb_to_hsl(vector rgb) @@ -1129,18 +1129,18 @@ vector rgb_to_hsl(vector rgb) float mi, ma; vector hsl; - mi = min(rgb_x, rgb_y, rgb_z); - ma = max(rgb_x, rgb_y, rgb_z); + mi = min(rgb.x, rgb.y, rgb.z); + ma = max(rgb.x, rgb.y, rgb.z); hsl_x = rgb_mi_ma_to_hue(rgb, mi, ma); hsl_z = 0.5 * (mi + ma); if(mi == ma) hsl_y = 0; - else if(hsl_z <= 0.5) - hsl_y = (ma - mi) / (2*hsl_z); + else if(hsl.z <= 0.5) + hsl_y = (ma - mi) / (2*hsl.z); else // if(hsl_z > 0.5) - hsl_y = (ma - mi) / (2 - 2*hsl_z); + hsl_y = (ma - mi) / (2 - 2*hsl.z); return hsl; } @@ -1149,17 +1149,17 @@ vector hsl_to_rgb(vector hsl) { float mi, ma, maminusmi; - if(hsl_z <= 0.5) - maminusmi = hsl_y * 2 * hsl_z; + if(hsl.z <= 0.5) + maminusmi = hsl.y * 2 * hsl.z; else - maminusmi = hsl_y * (2 - 2 * hsl_z); + maminusmi = hsl.y * (2 - 2 * hsl.z); // hsl_z = 0.5 * mi + 0.5 * ma // maminusmi = - mi + ma - mi = hsl_z - 0.5 * maminusmi; - ma = hsl_z + 0.5 * maminusmi; + mi = hsl.z - 0.5 * maminusmi; + ma = hsl.z + 0.5 * maminusmi; - return hue_mi_ma_to_rgb(hsl_x, mi, ma); + return hue_mi_ma_to_rgb(hsl.x, mi, ma); } string rgb_to_hexcolor(vector rgb) @@ -1167,9 +1167,9 @@ string rgb_to_hexcolor(vector rgb) return strcat( "^x", - DEC_TO_HEXDIGIT(floor(rgb_x * 15 + 0.5)), - DEC_TO_HEXDIGIT(floor(rgb_y * 15 + 0.5)), - DEC_TO_HEXDIGIT(floor(rgb_z * 15 + 0.5)) + DEC_TO_HEXDIGIT(floor(rgb.x * 15 + 0.5)), + DEC_TO_HEXDIGIT(floor(rgb.y * 15 + 0.5)), + DEC_TO_HEXDIGIT(floor(rgb.z * 15 + 0.5)) ); } @@ -1177,7 +1177,7 @@ string rgb_to_hexcolor(vector rgb) float boxesoverlap(vector m1, vector m2, vector m3, vector m4) {return m2_x >= m3_x && m1_x <= m4_x && m2_y >= m3_y && m1_y <= m4_y && m2_z >= m3_z && m1_z <= m4_z;} // requires the same, but is a stronger condition -float boxinsidebox(vector smins, vector smaxs, vector bmins, vector bmaxs) {return smins_x >= bmins_x && smaxs_x <= bmaxs_x && smins_y >= bmins_y && smaxs_y <= bmaxs_y && smins_z >= bmins_z && smaxs_z <= bmaxs_z;} +float boxinsidebox(vector smins, vector smaxs, vector bmins, vector bmaxs) {return smins.x >= bmins.x && smaxs.x <= bmaxs.x && smins.y >= bmins.y && smaxs.y <= bmaxs.y && smins.z >= bmins.z && smaxs.z <= bmaxs.z;} #ifndef MENUQC #endif @@ -1633,7 +1633,7 @@ vector solve_shotdirection(vector myorg, vector myvel, vector eorg, vector evel, vector solution = solve_quadratic(evel * evel - spd * spd, 2 * (eorg * evel), eorg * eorg); // p = 2 * (eorg * evel) / (evel * evel - spd * spd) // q = (eorg * eorg) / (evel * evel - spd * spd) - if(!solution_z) // no real solution + if(!solution.z) // no real solution { // happens if D < 0 // (eorg * evel)^2 < (evel^2 - spd^2) * eorg^2 @@ -1644,17 +1644,17 @@ vector solve_shotdirection(vector myorg, vector myvel, vector eorg, vector evel, // spd < |evel| * sin angle(evel, eorg) return '0 0 0'; } - else if(solution_x > 0) + else if(solution.x > 0) { // both solutions > 0: take the smaller one // happens if p < 0 and q > 0 - ret = normalize(eorg + solution_x * evel); + ret = normalize(eorg + solution.x * evel); } - else if(solution_y > 0) + else if(solution.y > 0) { // one solution > 0: take the larger one // happens if q < 0 or q == 0 and p < 0 - ret = normalize(eorg + solution_y * evel); + ret = normalize(eorg + solution.y * evel); } else { @@ -1701,12 +1701,12 @@ vector get_shotvelocity(vector myvel, vector mydir, float spd, float newton_styl vector solution = solve_quadratic(1, -2 * (mydir * myvel), myvel * myvel - spd * spd); float outspeed; - if(solution_z) - outspeed = solution_y; // the larger one + if(solution.z) + outspeed = solution.y; // the larger one else { //outspeed = 0; // slowest possible shot - outspeed = solution_x; // the real part (that is, the average!) + outspeed = solution.x; // the real part (that is, the average!) //dprint("impossible shot, adjusting\n"); } @@ -1721,9 +1721,9 @@ vector get_shotvelocity(vector myvel, vector mydir, float spd, float newton_styl float compressShotOrigin(vector v) { float x, y, z; - x = rint(v_x * 2); - y = rint(v_y * 4) + 128; - z = rint(v_z * 4) + 128; + x = rint(v.x * 2); + y = rint(v.y * 4) + 128; + z = rint(v.z * 4) + 128; if(x > 255 || x < 0) { print("shot origin ", vtos(v), " x out of bounds\n"); @@ -1864,7 +1864,7 @@ vector healtharmor_applydamage(float a, float armorblock, float deathtype, float if (deathtype == DEATH_DROWN) // Why should armor help here... armorblock = 0; v_y = bound(0, damage * armorblock, a); // save - v_x = bound(0, damage - v_y, damage); // take + v_x = bound(0, damage - v.y, damage); // take v_z = 0; return v; } @@ -1916,14 +1916,14 @@ void WriteInt24_t(float dst, float val) } void WriteInt48_t(float dst, vector val) { - WriteInt24_t(dst, val_x); - WriteInt24_t(dst, val_y); + WriteInt24_t(dst, val.x); + WriteInt24_t(dst, val.y); } void WriteInt72_t(float dst, vector val) { - WriteInt24_t(dst, val_x); - WriteInt24_t(dst, val_y); - WriteInt24_t(dst, val_z); + WriteInt24_t(dst, val.x); + WriteInt24_t(dst, val.y); + WriteInt24_t(dst, val.z); } #endif #endif @@ -2151,9 +2151,9 @@ vector NearestPointOnBox(entity box, vector org) m1 = box.mins + box.origin; m2 = box.maxs + box.origin; - nearest_x = bound(m1_x, org_x, m2_x); - nearest_y = bound(m1_y, org_y, m2_y); - nearest_z = bound(m1_z, org_z, m2_z); + nearest_x = bound(m1_x, org.x, m2_x); + nearest_y = bound(m1_y, org.y, m2_y); + nearest_z = bound(m1_z, org.z, m2_z); return nearest; } @@ -2573,14 +2573,14 @@ vector get_corner_position(entity box, float corner) { switch(corner) { - case 1: return combine_to_vector(box.absmin_x, box.absmin_y, box.absmin_z); - case 2: return combine_to_vector(box.absmax_x, box.absmin_y, box.absmin_z); - case 3: return combine_to_vector(box.absmin_x, box.absmax_y, box.absmin_z); - case 4: return combine_to_vector(box.absmin_x, box.absmin_y, box.absmax_z); - case 5: return combine_to_vector(box.absmax_x, box.absmax_y, box.absmin_z); - case 6: return combine_to_vector(box.absmin_x, box.absmax_y, box.absmax_z); - case 7: return combine_to_vector(box.absmax_x, box.absmin_y, box.absmax_z); - case 8: return combine_to_vector(box.absmax_x, box.absmax_y, box.absmax_z); + case 1: return combine_to_vector(box.absmin.x, box.absmin.y, box.absmin.z); + case 2: return combine_to_vector(box.absmax.x, box.absmin.y, box.absmin.z); + case 3: return combine_to_vector(box.absmin.x, box.absmax.y, box.absmin.z); + case 4: return combine_to_vector(box.absmin.x, box.absmin.y, box.absmax.z); + case 5: return combine_to_vector(box.absmax.x, box.absmax.y, box.absmin.z); + case 6: return combine_to_vector(box.absmin.x, box.absmax.y, box.absmax.z); + case 7: return combine_to_vector(box.absmax.x, box.absmin.y, box.absmax.z); + case 8: return combine_to_vector(box.absmax.x, box.absmax.y, box.absmax.z); default: return '0 0 0'; } } @@ -2647,11 +2647,11 @@ vector animfixfps(entity e, vector a, vector b) if(a_y == 1) { float dur; - dur = frameduration(e.modelindex, a_x); - if(dur <= 0 && b_y) + dur = frameduration(e.modelindex, a.x); + if(dur <= 0 && b.y) { a = b; - dur = frameduration(e.modelindex, a_x); + dur = frameduration(e.modelindex, a.x); } if(dur > 0) a_z = 1.0 / dur; diff --git a/qcsrc/common/weapons/calculations.qc b/qcsrc/common/weapons/calculations.qc index 7bc64e0b5..d2ec53bfa 100644 --- a/qcsrc/common/weapons/calculations.qc +++ b/qcsrc/common/weapons/calculations.qc @@ -129,16 +129,16 @@ vector solve_cubic_abcd(float a, float b, float c, float d) v = solve_cubic_pq(p, q); v = (v - b * '1 1 1') * (1.0 / (3.0 * a)); if(a < 0) - v += '1 0 -1' * (v_z - v_x); // swap x, z + v += '1 0 -1' * (v.z - v.x); // swap x, z return v; } vector findperpendicular(vector v) { vector p; - p_x = v_z; - p_y = -v_x; - p_z = v_y; + p_x = v.z; + p_y = -v.x; + p_z = v.y; return normalize(cliptoplane(p, v)); } diff --git a/qcsrc/common/weapons/w_arc.qc b/qcsrc/common/weapons/w_arc.qc index 4c30d6e7f..f233cae3b 100644 --- a/qcsrc/common/weapons/w_arc.qc +++ b/qcsrc/common/weapons/w_arc.qc @@ -153,21 +153,21 @@ float W_Arc_Beam_Send(entity to, float sf) } if(sf & ARC_SF_START) // starting location { - WriteCoord(MSG_ENTITY, self.beam_start_x); - WriteCoord(MSG_ENTITY, self.beam_start_y); - WriteCoord(MSG_ENTITY, self.beam_start_z); + WriteCoord(MSG_ENTITY, self.beam_start.x); + WriteCoord(MSG_ENTITY, self.beam_start.y); + WriteCoord(MSG_ENTITY, self.beam_start.z); } if(sf & ARC_SF_WANTDIR) // want/aim direction { - WriteCoord(MSG_ENTITY, self.beam_wantdir_x); - WriteCoord(MSG_ENTITY, self.beam_wantdir_y); - WriteCoord(MSG_ENTITY, self.beam_wantdir_z); + WriteCoord(MSG_ENTITY, self.beam_wantdir.x); + WriteCoord(MSG_ENTITY, self.beam_wantdir.y); + WriteCoord(MSG_ENTITY, self.beam_wantdir.z); } if(sf & ARC_SF_BEAMDIR) // beam direction { - WriteCoord(MSG_ENTITY, self.beam_dir_x); - WriteCoord(MSG_ENTITY, self.beam_dir_y); - WriteCoord(MSG_ENTITY, self.beam_dir_z); + WriteCoord(MSG_ENTITY, self.beam_dir.x); + WriteCoord(MSG_ENTITY, self.beam_dir.y); + WriteCoord(MSG_ENTITY, self.beam_dir.z); } if(sf & ARC_SF_BEAMTYPE) // beam type { @@ -671,7 +671,7 @@ float W_Arc(float req) if(self.arc_BUTTON_ATCK_prev) { #if 0 - if(self.animstate_startframe == self.anim_shoot_x && self.animstate_numframes == self.anim_shoot_y) + if(self.animstate_startframe == self.anim_shoot.x && self.animstate_numframes == self.anim_shoot.y) weapon_thinkf(WFRAME_DONTCHANGE, autocvar_g_balance_arc_primary_animtime, w_ready); else #endif @@ -924,13 +924,13 @@ void Draw_ArcBeam(void) // move shot origin to the actual gun muzzle origin vector origin_offset = - right * -self.beam_shotorigin_y - + up * self.beam_shotorigin_z; + right * -self.beam_shotorigin.y + + up * self.beam_shotorigin.z; start_pos = start_pos + origin_offset; // Move it also forward, but only as far as possible without hitting anything. Don't poke into walls! - traceline(start_pos, start_pos + forward * self.beam_shotorigin_x, MOVE_NORMAL, self); + traceline(start_pos, start_pos + forward * self.beam_shotorigin.x, MOVE_NORMAL, self); start_pos = trace_endpos; // calculate the aim direction now diff --git a/qcsrc/common/weapons/w_crylink.qc b/qcsrc/common/weapons/w_crylink.qc index d17826a92..392c45223 100644 --- a/qcsrc/common/weapons/w_crylink.qc +++ b/qcsrc/common/weapons/w_crylink.qc @@ -404,11 +404,11 @@ void W_Crylink_Attack(void) else { makevectors('0 360 0' * (0.75 + (counter - 0.5) / (shots - 1))); - s_y = v_forward_x; - s_z = v_forward_y; + s_y = v_forward.x; + s_z = v_forward.y; } s = s * WEP_CVAR_PRI(crylink, spread) * g_weaponspreadfactor; - W_SetupProjVelocity_Explicit(proj, w_shotdir + right * s_y + up * s_z, v_up, WEP_CVAR_PRI(crylink, speed), 0, 0, 0, FALSE); + W_SetupProjVelocity_Explicit(proj, w_shotdir + right * s.y + up * s.z, v_up, WEP_CVAR_PRI(crylink, speed), 0, 0, 0, FALSE); proj.touch = W_Crylink_Touch; proj.think = W_Crylink_Fadethink; @@ -514,11 +514,11 @@ void W_Crylink_Attack2(void) else { makevectors('0 360 0' * (0.75 + (counter - 0.5) / (shots - 1))); - s_y = v_forward_x; - s_z = v_forward_y; + s_y = v_forward.x; + s_z = v_forward.y; } s = s * WEP_CVAR_SEC(crylink, spread) * g_weaponspreadfactor; - s = w_shotdir + right * s_y + up * s_z; + s = w_shotdir + right * s.y + up * s.z; } else { diff --git a/qcsrc/common/weapons/w_devastator.qc b/qcsrc/common/weapons/w_devastator.qc index cff16702d..617beed18 100644 --- a/qcsrc/common/weapons/w_devastator.qc +++ b/qcsrc/common/weapons/w_devastator.qc @@ -142,7 +142,7 @@ void W_Devastator_DoRemoteExplode(void) head.velocity_y *= 0.9; head.velocity_z = bound( WEP_CVAR(devastator, remote_jump_velocity_z_min), - head.velocity_z + WEP_CVAR(devastator, remote_jump_velocity_z_add), + head.velocity.z + WEP_CVAR(devastator, remote_jump_velocity_z_add), WEP_CVAR(devastator, remote_jump_velocity_z_max) ); @@ -226,7 +226,7 @@ vector W_Devastator_SteerTo(vector thisdir, vector goaldir, float maxturn_cos) // 0 = (m^2 - f^2) * x^2 + (2 * f * (m^2 - 1)) * x + (m^2 - 1) m2 = maxturn_cos * maxturn_cos; v = solve_quadratic(m2 - f * f, 2 * f * (m2 - 1), m2 - 1); - return normalize(thisdir + goaldir * v_y); // the larger solution! + return normalize(thisdir + goaldir * v.y); // the larger solution! } // assume thisdir == -goaldir: // f == -1 @@ -252,7 +252,7 @@ void W_Devastator_Think(void) } // accelerate - makevectors(self.angles_x * '-1 0 0' + self.angles_y * '0 1 0'); + makevectors(self.angles.x * '-1 0 0' + self.angles.y * '0 1 0'); velspeed = WEP_CVAR(devastator, speed) * g_weaponspeedfactor - (self.velocity * v_forward); if(velspeed > 0) self.velocity = self.velocity + v_forward * min(WEP_CVAR(devastator, speedaccel) * g_weaponspeedfactor * frametime, velspeed); diff --git a/qcsrc/common/weapons/w_fireball.qc b/qcsrc/common/weapons/w_fireball.qc index 80c453a4d..f4542040a 100644 --- a/qcsrc/common/weapons/w_fireball.qc +++ b/qcsrc/common/weapons/w_fireball.qc @@ -126,9 +126,9 @@ void W_Fireball_LaserPlay(float dt, float dist, float damage, float edgedamage, if(e != self.realowner) if(e.takedamage == DAMAGE_AIM) if(!IS_PLAYER(e) || !self.realowner || DIFF_TEAM(e, self)) { p = e.origin; - p_x += e.mins_x + random() * (e.maxs_x - e.mins_x); - p_y += e.mins_y + random() * (e.maxs_y - e.mins_y); - p_z += e.mins_z + random() * (e.maxs_z - e.mins_z); + p.x += e.mins.x + random() * (e.maxs.x - e.mins.x); + p.y += e.mins.y + random() * (e.maxs.y - e.mins.y); + p.z += e.mins.z + random() * (e.maxs.z - e.mins.z); d = vlen(WarpZone_UnTransformOrigin(e, self.origin) - p); if(d < dist) { @@ -219,7 +219,7 @@ void W_Fireball_Attack1(void) void W_Fireball_AttackEffect(float i, vector f_diff) { W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', FALSE, 0, "", 0, 0); - w_shotorg += f_diff_x * v_up + f_diff_y * v_right; + w_shotorg += f_diff.x * v_up + f_diff.y * v_right; pointparticles(particleeffectnum("fireball_preattack_muzzleflash"), w_shotorg, w_shotdir * 1000, 1); } @@ -316,7 +316,7 @@ void W_Fireball_Attack2(void) break; } W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', FALSE, 2, "weapons/fireball_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(fireball, damage)); - traceline(w_shotorg, w_shotorg + f_diff_x * v_up + f_diff_y * v_right, MOVE_NORMAL, self); + traceline(w_shotorg, w_shotorg + f_diff.x * v_up + f_diff.y * v_right, MOVE_NORMAL, self); w_shotorg = trace_endpos; pointparticles(particleeffectnum("fireball_muzzleflash"), w_shotorg, w_shotdir * 1000, 1); diff --git a/qcsrc/common/weapons/w_hagar.qc b/qcsrc/common/weapons/w_hagar.qc index fe3abf0a9..0435dbfd6 100644 --- a/qcsrc/common/weapons/w_hagar.qc +++ b/qcsrc/common/weapons/w_hagar.qc @@ -268,12 +268,12 @@ void W_Hagar_Attack2_Load_Release(void) else { makevectors('0 360 0' * (0.75 + (counter - 0.5) / (shots - 1))); - s_y = v_forward_x; - s_z = v_forward_y; + s_y = v_forward.x; + s_z = v_forward.y; } s = s * WEP_CVAR_SEC(hagar, load_spread) * g_weaponspreadfactor; - W_SetupProjVelocity_Explicit(missile, w_shotdir + right * s_y + up * s_z, v_up, WEP_CVAR_SEC(hagar, speed), 0, 0, spread_pershot, FALSE); + W_SetupProjVelocity_Explicit(missile, w_shotdir + right * s.y + up * s.z, v_up, WEP_CVAR_SEC(hagar, speed), 0, 0, spread_pershot, FALSE); missile.angles = vectoangles(missile.velocity); missile.flags = FL_PROJECTILE; diff --git a/qcsrc/common/weapons/w_shockwave.qc b/qcsrc/common/weapons/w_shockwave.qc index ea7f38572..a051ec735 100644 --- a/qcsrc/common/weapons/w_shockwave.qc +++ b/qcsrc/common/weapons/w_shockwave.qc @@ -336,12 +336,12 @@ void W_Shockwave_Send(void) { WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); WriteByte(MSG_BROADCAST, TE_CSQC_SHOCKWAVEPARTICLE); - WriteCoord(MSG_BROADCAST, w_shotorg_x); - WriteCoord(MSG_BROADCAST, w_shotorg_y); - WriteCoord(MSG_BROADCAST, w_shotorg_z); - WriteCoord(MSG_BROADCAST, w_shotdir_x); - WriteCoord(MSG_BROADCAST, w_shotdir_y); - WriteCoord(MSG_BROADCAST, w_shotdir_z); + WriteCoord(MSG_BROADCAST, w_shotorg.x); + WriteCoord(MSG_BROADCAST, w_shotorg.y); + WriteCoord(MSG_BROADCAST, w_shotorg.z); + WriteCoord(MSG_BROADCAST, w_shotdir.x); + WriteCoord(MSG_BROADCAST, w_shotdir.y); + WriteCoord(MSG_BROADCAST, w_shotdir.z); WriteShort(MSG_BROADCAST, WEP_CVAR(shockwave, blast_distance)); WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_max), 255)); WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_min), 255)); @@ -436,7 +436,7 @@ void W_Shockwave_Attack(void) ); // figure out the direction of force - vel = normalize(combine_to_vector(head.velocity_x, head.velocity_y, 0)); + vel = normalize(combine_to_vector(head.velocity.x, head.velocity.y, 0)); vel *= ( bound(0, (vlen(vel) / autocvar_sv_maxspeed), 1) @@ -447,7 +447,7 @@ void W_Shockwave_Attack(void) // now multiply the direction by force units final_force *= (WEP_CVAR(shockwave, blast_jump_force) * multiplier); - final_force_z *= WEP_CVAR(shockwave, blast_jump_force_zscale); + final_force.z *= WEP_CVAR(shockwave, blast_jump_force_zscale); // trigger damage with this calculated info Damage( @@ -518,7 +518,7 @@ void W_Shockwave_Attack(void) // now multiply the direction by force units final_force *= (WEP_CVAR(shockwave, blast_splash_force) * multiplier); - final_force_z *= WEP_CVAR(shockwave, blast_force_zscale); + final_force.z *= WEP_CVAR(shockwave, blast_force_zscale); // queue damage with this calculated info if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { queue = min(queue + 1, MAX_SHOCKWAVE_HITS); } @@ -609,7 +609,7 @@ void W_Shockwave_Attack(void) // now multiply the direction by force units final_force *= (WEP_CVAR(shockwave, blast_force) * multiplier); - final_force_z *= WEP_CVAR(shockwave, blast_force_zscale); + final_force.z *= WEP_CVAR(shockwave, blast_force_zscale); // queue damage with this calculated info if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { queue = min(queue + 1, MAX_SHOCKWAVE_HITS); } @@ -782,19 +782,19 @@ void Draw_Shockwave() { // perfect circle effect lines makevectors('0 360 0' * (0.75 + (counter - 0.5) / divisions)); - angle_y = v_forward_x; - angle_z = v_forward_y; + angle_y = v_forward.x; + angle_z = v_forward.y; // first do the spread_to_min effect deviation = angle * spread_to_min; - deviation = ((self.sw_shotdir + (right * deviation_y) + (up * deviation_z))); + deviation = ((self.sw_shotdir + (right * deviation.y) + (up * deviation.z))); new_min_dist = SW_DISTTOMIN; new_min_end = (self.sw_shotorg + (deviation * new_min_dist)); //te_lightning2(world, new_min_end, self.sw_shotorg); // then calculate spread_to_max effect deviation = angle * spread_to_max; - deviation = ((self.sw_shotdir + (right * deviation_y) + (up * deviation_z))); + deviation = ((self.sw_shotdir + (right * deviation.y) + (up * deviation.z))); new_max_dist = vlen(new_min_end - endpos); new_max_end = (new_min_end + (deviation * new_max_dist)); //te_lightning2(world, new_end, prev_min_end); @@ -855,7 +855,7 @@ void Net_ReadShockwaveParticle(void) shockwave.draw = Draw_Shockwave; shockwave.sw_shotorg_x = ReadCoord(); shockwave.sw_shotorg_y = ReadCoord(); shockwave.sw_shotorg_z = ReadCoord(); - shockwave.sw_shotdir_x = ReadCoord(); shockwave.sw_shotdir_y = ReadCoord(); shockwave.sw_shotdir_z = ReadCoord(); + shockwave.sw_shotdir_x = ReadCoord(); shockwave.sw_shotdir_y = ReadCoord(); shockwave.sw_shotdir_z = ReadCoord(); shockwave.sw_distance = ReadShort(); shockwave.sw_spread_max = ReadByte(); diff --git a/qcsrc/common/weapons/w_tuba.qc b/qcsrc/common/weapons/w_tuba.qc index 37f1e3868..92bdf4f8f 100644 --- a/qcsrc/common/weapons/w_tuba.qc +++ b/qcsrc/common/weapons/w_tuba.qc @@ -82,11 +82,11 @@ float W_Tuba_HasPlayed(entity pl, string melody, float instrument, float ignorep // _z is note pitch if(ignorepitch && i == 0) { - pitchshift = np - v_z; + pitchshift = np - v.z; } else { - if(v_z + pitchshift != np) + if(v.z + pitchshift != np) return FALSE; } } @@ -132,8 +132,8 @@ float W_Tuba_HasPlayed(entity pl, string melody, float instrument, float ignorep //printf("second note: %f to %f, should be %f\n", vj_x, vj_y, tj); //printf("m1 = %f\n", (vi_x - vj_y) / (ti - tj)); //printf("m2 = %f\n", (vi_y - vj_x) / (ti - tj)); - mmin = max(mmin, (vi_x - vj_y) / (ti - tj)); // lower bound - mmax = min(mmax, (vi_y - vj_x) / (ti - tj)); // upper bound + mmin = max(mmin, (vi.x - vj.y) / (ti - tj)); // lower bound + mmax = min(mmax, (vi.y - vj.x) / (ti - tj)); // upper bound } } @@ -185,10 +185,10 @@ void W_Tuba_NoteOff(void) float W_Tuba_GetNote(entity pl, float hittype) { float movestate = 5; - if (pl.movement_x < 0) movestate -= 3; - else if (pl.movement_x > 0) movestate += 3; - if (pl.movement_y < 0) movestate -= 1; - else if (pl.movement_y > 0) movestate += 1; + if (pl.movement.x < 0) movestate -= 3; + else if (pl.movement.x > 0) movestate += 3; + if (pl.movement.y < 0) movestate -= 1; + else if (pl.movement.y > 0) movestate += 1; float note = 0; switch(movestate) @@ -271,9 +271,9 @@ float W_Tuba_NoteSendEntity(entity to, float sf) } if(sf & 2) { - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); + WriteCoord(MSG_ENTITY, self.origin.x); + WriteCoord(MSG_ENTITY, self.origin.y); + WriteCoord(MSG_ENTITY, self.origin.z); } return TRUE; } diff --git a/qcsrc/common/weapons/w_vortex.qc b/qcsrc/common/weapons/w_vortex.qc index 6512d0430..c880e7dee 100644 --- a/qcsrc/common/weapons/w_vortex.qc +++ b/qcsrc/common/weapons/w_vortex.qc @@ -64,12 +64,12 @@ void SendCSQCVortexBeamParticle(float charge) { v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos); WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); WriteByte(MSG_BROADCAST, TE_CSQC_VORTEXBEAMPARTICLE); - WriteCoord(MSG_BROADCAST, w_shotorg_x); - WriteCoord(MSG_BROADCAST, w_shotorg_y); - WriteCoord(MSG_BROADCAST, w_shotorg_z); - WriteCoord(MSG_BROADCAST, v_x); - WriteCoord(MSG_BROADCAST, v_y); - WriteCoord(MSG_BROADCAST, v_z); + WriteCoord(MSG_BROADCAST, w_shotorg.x); + WriteCoord(MSG_BROADCAST, w_shotorg.y); + WriteCoord(MSG_BROADCAST, w_shotorg.z); + WriteCoord(MSG_BROADCAST, v.x); + WriteCoord(MSG_BROADCAST, v.y); + WriteCoord(MSG_BROADCAST, v.z); WriteByte(MSG_BROADCAST, bound(0, 255 * charge, 255)); } diff --git a/qcsrc/common/weapons/weapons.qc b/qcsrc/common/weapons/weapons.qc index e9a834f78..7b91f1d30 100644 --- a/qcsrc/common/weapons/weapons.qc +++ b/qcsrc/common/weapons/weapons.qc @@ -45,7 +45,7 @@ void WriteWepSet(float dst, WepSet w) #elif WEP_MAXCOUNT > 24 WriteInt48_t(dst, w); #else - WriteInt24_t(dst, w_x); + WriteInt24_t(dst, w.x); #endif } #endif diff --git a/qcsrc/csqcmodellib/cl_player.qc b/qcsrc/csqcmodellib/cl_player.qc index 4a40df30f..0bb5cec42 100644 --- a/qcsrc/csqcmodellib/cl_player.qc +++ b/qcsrc/csqcmodellib/cl_player.qc @@ -251,7 +251,7 @@ void CSQCPlayer_SetCamera() CSQCPlayer_SetMinsMaxs(); - self.angles_y = input_angles_y; + self.angles_y = input_angles.y; } // relink diff --git a/qcsrc/csqcmodellib/interpolate.qc b/qcsrc/csqcmodellib/interpolate.qc index 8d3b351c8..4632cec46 100644 --- a/qcsrc/csqcmodellib/interpolate.qc +++ b/qcsrc/csqcmodellib/interpolate.qc @@ -95,7 +95,7 @@ void InterpolateOrigin_Note() else if(self.iflags & IFLAG_V_ANGLE_X) { self.ivforward1_x = self.ivforward2_x; - self.ivforward2_x = self.v_angle_x; + self.ivforward2_x = self.v_angle.x; } if(self.iflags & IFLAG_VELOCITY) diff --git a/qcsrc/dpdefs/csprogsdefs.qc b/qcsrc/dpdefs/csprogsdefs.qc index b849379d1..43694accf 100644 --- a/qcsrc/dpdefs/csprogsdefs.qc +++ b/qcsrc/dpdefs/csprogsdefs.qc @@ -1362,7 +1362,7 @@ void(vector eyetarget, string bonename) example_skel_player_update_eyetarget = v_y = u * parentright; v_z = u * parentup; vector ang = vectoangles2(v, relup); - ang_x = 0 - ang_x; + ang_x = 0 - ang.x; makevectors(ang); // set the relative bone matrix skel_set_bone(self.skeletonindex, bonenum, relorg); diff --git a/qcsrc/dpdefs/dpextensions.qc b/qcsrc/dpdefs/dpextensions.qc index 624442539..a9b953883 100644 --- a/qcsrc/dpdefs/dpextensions.qc +++ b/qcsrc/dpdefs/dpextensions.qc @@ -2282,7 +2282,7 @@ void(vector eyetarget, string bonename) example_skel_player_update_eyetarget = v_y = u * parentright; v_z = u * parentup; vector ang = vectoangles2(v, relup); - ang_x = 0 - ang_x; + ang_x = 0 - ang.x; makevectors(ang); // set the relative bone matrix skel_set_bone(self.skeletonindex, bonenum, relorg); diff --git a/qcsrc/menu/draw.qc b/qcsrc/menu/draw.qc index 19d18223a..7596c0c3a 100644 --- a/qcsrc/menu/draw.qc +++ b/qcsrc/menu/draw.qc @@ -6,7 +6,7 @@ void draw_setMousePointer(string pic, vector theSize, vector theOffset) { draw_mousepointer = strzone(draw_UseSkinFor(pic)); draw_mousepointer_size = theSize; - draw_mousepointer_offset = eX * (theOffset_x * theSize_x) + eY * (theOffset_y * theSize_y); + draw_mousepointer_offset = eX * (theOffset.x * theSize.x) + eY * (theOffset.y * theSize.y); } void draw_drawMousePointer(vector where) @@ -36,30 +36,30 @@ void draw_endBoldFont() vector globalToBox(vector v, vector theOrigin, vector theScale) { v -= theOrigin; - v_x /= theScale_x; - v_y /= theScale_y; + v.x /= theScale.x; + v.y /= theScale.y; return v; } vector globalToBoxSize(vector v, vector theScale) { - v_x /= theScale_x; - v_y /= theScale_y; + v.x /= theScale.x; + v.y /= theScale.y; return v; } vector boxToGlobal(vector v, vector theOrigin, vector theScale) { - v_x *= theScale_x; - v_y *= theScale_y; + v.x *= theScale.x; + v.y *= theScale.y; v += theOrigin; return v; } vector boxToGlobalSize(vector v, vector theScale) { - v_x *= theScale_x; - v_y *= theScale_y; + v.x *= theScale.x; + v.y *= theScale.y; return v; } @@ -77,7 +77,7 @@ string draw_PreloadPictureWithFlags(string pic, float f) void draw_Picture(vector theOrigin, string pic, vector theSize, vector theColor, float theAlpha) { - if(theSize_x == 0 || theSize_y <= 0) // no default sizing please + if(theSize_x == 0 || theSize.y <= 0) // no default sizing please return; pic = draw_UseSkinFor(pic); drawpic(boxToGlobal(theOrigin, draw_shift, draw_scale), pic, boxToGlobalSize(theSize, draw_scale), theColor, theAlpha * draw_alpha, 0); @@ -109,20 +109,20 @@ void draw_ButtonPicture(vector theOrigin, string pic, vector theSize, vector the theOrigin = boxToGlobal(theOrigin, draw_shift, draw_scale); theSize = boxToGlobalSize(theSize, draw_scale); theAlpha *= draw_alpha; - width = eX * theSize_x; - height = eY * theSize_y; - if(theSize_x <= theSize_y * 2) + width = eX * theSize.x; + height = eY * theSize.y; + if(theSize.x <= theSize.y * 2) { // button not wide enough // draw just left and right part then - square = eX * theSize_x * 0.5; - bW = eX * (0.25 * theSize_x / (theSize_y * 2)); + square = eX * theSize.x * 0.5; + bW = eX * (0.25 * theSize.x / (theSize.y * 2)); drawsubpic(theOrigin, square + height, pic, '0 0 0', eY + bW, theColor, theAlpha, 0); drawsubpic(theOrigin + square, square + height, pic, eX - bW, eY + bW, theColor, theAlpha, 0); } else { - square = eX * theSize_y; + square = eX * theSize.y; drawsubpic(theOrigin, height + square, pic, '0 0 0', '0.25 1 0', theColor, theAlpha, 0); drawsubpic(theOrigin + square, theSize - 2 * square, pic, '0.25 0 0', '0.5 1 0', theColor, theAlpha, 0); drawsubpic(theOrigin + width - square, height + square, pic, '0.75 0 0', '0.25 1 0', theColor, theAlpha, 0); @@ -144,20 +144,20 @@ void draw_VertButtonPicture(vector theOrigin, string pic, vector theSize, vector theOrigin = boxToGlobal(theOrigin, draw_shift, draw_scale); theSize = boxToGlobalSize(theSize, draw_scale); theAlpha *= draw_alpha; - width = eX * theSize_x; - height = eY * theSize_y; - if(theSize_y <= theSize_x * 2) + width = eX * theSize.x; + height = eY * theSize.y; + if(theSize.y <= theSize.x * 2) { // button not high enough // draw just upper and lower part then - square = eY * theSize_y * 0.5; - bH = eY * (0.25 * theSize_y / (theSize_x * 2)); + square = eY * theSize.y * 0.5; + bH = eY * (0.25 * theSize.y / (theSize.x * 2)); drawsubpic(theOrigin, square + width, pic, '0 0 0', eX + bH, theColor, theAlpha, 0); drawsubpic(theOrigin + square, square + width, pic, eY - bH, eX + bH, theColor, theAlpha, 0); } else { - square = eY * theSize_x; + square = eY * theSize.x; drawsubpic(theOrigin, width + square, pic, '0 0 0', '1 0.25 0', theColor, theAlpha, 0); drawsubpic(theOrigin + square, theSize - 2 * square, pic, '0 0.25 0', '1 0.5 0', theColor, theAlpha, 0); drawsubpic(theOrigin + height - square, width + square, pic, '0 0.75 0', '1 0.25 0', theColor, theAlpha, 0); @@ -182,45 +182,45 @@ void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector the theSize = boxToGlobalSize(theSize, draw_scale); theBorderSize = boxToGlobalSize(theBorderSize, draw_scale); theAlpha *= draw_alpha; - width = eX * theSize_x; - height = eY * theSize_y; + width = eX * theSize.x; + height = eY * theSize.y; // zero size? bail out, we cannot handle this - if(theSize_x <= 0 || theSize_y <= 0) + if(theSize.x <= 0 || theSize.y <= 0) return; - if(theBorderSize_x <= 0) // no x border + if(theBorderSize.x <= 0) // no x border { - if(theBorderSize_y <= 0) + if(theBorderSize.y <= 0) { drawsubpic(theOrigin, width + height, pic, '0.25 0.25 0', '0.5 0.5 0', theColor, theAlpha, 0); } - else if(theSize_y <= theBorderSize_y * 2) + else if(theSize.y <= theBorderSize.y * 2) { // not high enough... draw just top and bottom then - bH = eY * (0.25 * theSize_y / (theBorderSize_y * 2)); + bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2)); drawsubpic(theOrigin, width + height * 0.5, pic, '0.25 0 0', '0.5 0 0' + bH, theColor, theAlpha, 0); drawsubpic(theOrigin + height * 0.5, width + height * 0.5, pic, '0.25 0 0' + eY - bH, '0.5 0 0' + bH, theColor, theAlpha, 0); } else { - dY = theBorderSize_y * eY; + dY = theBorderSize.y * eY; drawsubpic(theOrigin, width + dY, pic, '0.25 0 0', '0.5 0.25 0', theColor, theAlpha, 0); drawsubpic(theOrigin + dY, width + height - 2 * dY, pic, '0.25 0.25 0', '0.5 0.5 0', theColor, theAlpha, 0); drawsubpic(theOrigin + height - dY, width + dY, pic, '0.25 0.75 0', '0.5 0.25 0', theColor, theAlpha, 0); } } - else if(theSize_x <= theBorderSize_x * 2) + else if(theSize.x <= theBorderSize.x * 2) { // not wide enough... draw just left and right then - bW = eX * (0.25 * theSize_x / (theBorderSize_x * 2)); - if(theBorderSize_y <= 0) + bW = eX * (0.25 * theSize.x / (theBorderSize.x * 2)); + if(theBorderSize.y <= 0) { drawsubpic(theOrigin, width * 0.5 + height, pic, '0 0.25 0', '0 0.5 0' + bW, theColor, theAlpha, 0); drawsubpic(theOrigin + width * 0.5, width * 0.5 + height, pic, '0 0.25 0' + eX - bW, '0 0.5 0' + bW, theColor, theAlpha, 0); } - else if(theSize_y <= theBorderSize_y * 2) + else if(theSize.y <= theBorderSize.y * 2) { // not high enough... draw just corners - bH = eY * (0.25 * theSize_y / (theBorderSize_y * 2)); + bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2)); drawsubpic(theOrigin, width * 0.5 + height * 0.5, pic, '0 0 0', bW + bH, theColor, theAlpha, 0); drawsubpic(theOrigin + width * 0.5, width * 0.5 + height * 0.5, pic, eX - bW, bW + bH, theColor, theAlpha, 0); drawsubpic(theOrigin + height * 0.5, width * 0.5 + height * 0.5, pic, eY - bH, bW + bH, theColor, theAlpha, 0); @@ -228,7 +228,7 @@ void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector the } else { - dY = theBorderSize_y * eY; + dY = theBorderSize.y * eY; drawsubpic(theOrigin, width * 0.5 + dY, pic, '0 0 0', '0 0.25 0' + bW, theColor, theAlpha, 0); drawsubpic(theOrigin + width * 0.5, width * 0.5 + dY, pic, '0 0 0' + eX - bW, '0 0.25 0' + bW, theColor, theAlpha, 0); drawsubpic(theOrigin + dY, width * 0.5 + height - 2 * dY, pic, '0 0.25 0', '0 0.5 0' + bW, theColor, theAlpha, 0); @@ -239,18 +239,18 @@ void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector the } else { - if(theBorderSize_y <= 0) + if(theBorderSize.y <= 0) { - dX = theBorderSize_x * eX; + dX = theBorderSize.x * eX; drawsubpic(theOrigin, dX + height, pic, '0 0.25 0', '0.25 0.5 0', theColor, theAlpha, 0); drawsubpic(theOrigin + dX, width - 2 * dX + height, pic, '0.25 0.25 0', '0.5 0.5 0', theColor, theAlpha, 0); drawsubpic(theOrigin + width - dX, dX + height, pic, '0.75 0.25 0', '0.25 0.5 0', theColor, theAlpha, 0); } - else if(theSize_y <= theBorderSize_y * 2) + else if(theSize.y <= theBorderSize.y * 2) { // not high enough... draw just top and bottom then - bH = eY * (0.25 * theSize_y / (theBorderSize_y * 2)); - dX = theBorderSize_x * eX; + bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2)); + dX = theBorderSize.x * eX; drawsubpic(theOrigin, dX + height * 0.5, pic, '0 0 0', '0.25 0 0' + bH, theColor, theAlpha, 0); drawsubpic(theOrigin + dX, width - 2 * dX + height * 0.5, pic, '0.25 0 0', '0.5 0 0' + bH, theColor, theAlpha, 0); drawsubpic(theOrigin + width - dX, dX + height * 0.5, pic, '0.75 0 0', '0.25 0 0' + bH, theColor, theAlpha, 0); @@ -260,8 +260,8 @@ void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector the } else { - dX = theBorderSize_x * eX; - dY = theBorderSize_y * eY; + dX = theBorderSize.x * eX; + dY = theBorderSize.y * eY; drawsubpic(theOrigin, dX + dY, pic, '0 0 0', '0.25 0.25 0', theColor, theAlpha, 0); drawsubpic(theOrigin + dX, width - 2 * dX + dY, pic, '0.25 0 0', '0.5 0.25 0', theColor, theAlpha, 0); drawsubpic(theOrigin + width - dX, dX + dY, pic, '0.75 0 0', '0.25 0.25 0', theColor, theAlpha, 0); @@ -276,7 +276,7 @@ void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector the } void draw_Text(vector theOrigin, string theText, vector theSize, vector theColor, float theAlpha, float ICanHasKallerz) { - if(theSize_x <= 0 || theSize_y <= 0) { + if(theSize.x <= 0 || theSize.y <= 0) { dprint("Drawing zero size text?\n"); return; } @@ -305,7 +305,7 @@ float draw_TextWidth(string theText, float ICanHasKallerz, vector SizeThxBye) //float r; v_x = stringwidth(theText, ICanHasKallerz, globalToBoxSize(boxToGlobalSize(SizeThxBye, draw_scale), draw_fontscale)); v = globalToBoxSize(v, draw_scale); - return v_x; + return v.x; } float draw_CondensedFontFactor(string theText, float ICanHasKallerz, vector SizeThxBye, float maxWidth) @@ -323,7 +323,7 @@ void draw_SetClip() { if(draw_clipSet) error("Already clipping, no stack implemented here, sorry"); - drawsetcliparea(draw_shift_x, draw_shift_y, draw_scale_x, draw_scale_y); + drawsetcliparea(draw_shift.x, draw_shift.y, draw_scale.x, draw_scale.y); draw_clipSet = 1; } @@ -334,7 +334,7 @@ void draw_SetClipRect(vector theOrigin, vector theScale) error("Already clipping, no stack implemented here, sorry"); o = boxToGlobal(theOrigin, draw_shift, draw_scale); s = boxToGlobalSize(theScale, draw_scale); - drawsetcliparea(o_x, o_y, s_x, s_y); + drawsetcliparea(o.x, o.y, s.x, s.y); draw_clipSet = 1; } diff --git a/qcsrc/menu/draw.qh b/qcsrc/menu/draw.qh index 9632c8fea..96e0233df 100644 --- a/qcsrc/menu/draw.qh +++ b/qcsrc/menu/draw.qh @@ -1,9 +1,6 @@ // from the engine vector drawfontscale; #define draw_fontscale drawfontscale -#define draw_fontscale_x drawfontscale_x -#define draw_fontscale_y drawfontscale_y -#define draw_fontscale_z drawfontscale_z vector draw_shift; vector draw_scale; diff --git a/qcsrc/menu/item/borderimage.qc b/qcsrc/menu/item/borderimage.qc index 3a345a43d..e6affc1c0 100644 --- a/qcsrc/menu/item/borderimage.qc +++ b/qcsrc/menu/item/borderimage.qc @@ -30,7 +30,7 @@ void BorderImage_recalcPositionWithText(entity me, string t) scrs = eX * conwidth + eY * conheight; me.resizeNotify(me, me.saveRelOrigin, me.saveRelSize, boxToGlobal(me.parent.Nexposee_smallOrigin, '0 0 0', scrs), boxToGlobalSize(me.parent.Nexposee_smallSize, scrs)); SUPER(BorderImage).recalcPositionWithText(me, t); - me.realOrigin_y = me.realFontSize_y * me.zoomedOutTitleBarPosition; + me.realOrigin_y = me.realFontSize.y * me.zoomedOutTitleBarPosition; me.realOrigin_Nexposeed = me.realOrigin; me.realFontSize_Nexposeed = me.realFontSize; me.resizeNotify(me, me.saveRelOrigin, me.saveRelSize, boxToGlobal(me.parent.Nexposee_initialOrigin, '0 0 0', scrs), boxToGlobalSize(me.parent.Nexposee_initialSize, scrs)); @@ -48,13 +48,13 @@ void BorderImage_resizeNotify(entity me, vector relOrigin, vector relSize, vecto me.saveRelOrigin = relOrigin; me.saveRelSize = relSize; SUPER(BorderImage).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); - me.borderVec_x = me.borderHeight / absSize_x; - me.borderVec_y = me.borderHeight / absSize_y; - me.realOrigin_y = 0.5 * (me.borderVec_y - me.realFontSize_y); + me.borderVec_x = me.borderHeight / absSize.x; + me.borderVec_y = me.borderHeight / absSize.y; + me.realOrigin_y = 0.5 * (me.borderVec.y - me.realFontSize.y); if(me.closeButton) { // move the close button to the right place - me.closeButton.Container_origin = '1 0 0' * (1 - me.borderVec_x); + me.closeButton.Container_origin = '1 0 0' * (1 - me.borderVec.x); me.closeButton.Container_size = me.borderVec; me.closeButton.color = me.color; me.closeButton.colorC = me.color; diff --git a/qcsrc/menu/item/button.qc b/qcsrc/menu/item/button.qc index 8bbdfa704..f6ba208f5 100644 --- a/qcsrc/menu/item/button.qc +++ b/qcsrc/menu/item/button.qc @@ -41,7 +41,7 @@ void Button_resizeNotify(entity me, vector relOrigin, vector relSize, vector abs if(me.srcMulti) me.keepspaceLeft = 0; else - me.keepspaceLeft = min(0.8, absSize_y / absSize_x); + me.keepspaceLeft = min(0.8, absSize.y / absSize.x); SUPER(Button).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); } void Button_configureButton(entity me, string txt, float sz, string gfx) @@ -61,10 +61,10 @@ float Button_keyDown(entity me, float key, float ascii, float shift) float Button_mouseDrag(entity me, vector pos) { me.pressed = 1; - if(pos_x < 0) me.pressed = 0; - if(pos_y < 0) me.pressed = 0; - if(pos_x >= 1) me.pressed = 0; - if(pos_y >= 1) me.pressed = 0; + if(pos.x < 0) me.pressed = 0; + if(pos.y < 0) me.pressed = 0; + if(pos.x >= 1) me.pressed = 0; + if(pos.y >= 1) me.pressed = 0; return 1; } float Button_mousePress(entity me, vector pos) @@ -133,7 +133,7 @@ void Button_draw(entity me) } else { - bOrigin = eY * (0.5 * (1 - me.realFontSize_y)) + eX * (0.5 * (me.keepspaceLeft - me.realFontSize_x)); + bOrigin = eY * (0.5 * (1 - me.realFontSize.y)) + eX * (0.5 * (me.keepspaceLeft - me.realFontSize.x)); bSize = me.realFontSize; } if(me.disabled) diff --git a/qcsrc/menu/item/container.qc b/qcsrc/menu/item/container.qc index 8bc925f1c..2bf2ef1df 100644 --- a/qcsrc/menu/item/container.qc +++ b/qcsrc/menu/item/container.qc @@ -155,10 +155,10 @@ entity Container_itemFromPoint(entity me, vector pos) { o = e.Container_origin; s = e.Container_size; - if(pos_x < o_x) continue; - if(pos_y < o_y) continue; - if(pos_x >= o_x + s_x) continue; - if(pos_y >= o_y + s_y) continue; + if(pos.x < o.x) continue; + if(pos.y < o.y) continue; + if(pos.x >= o.x + s.x) continue; + if(pos.y >= o.y + s.y) continue; return e; } return NULL; @@ -288,18 +288,18 @@ void Container_addItem(entity me, entity other, vector theOrigin, vector theSize if(other.focusable) me.focusable += 1; - if(theSize_x > 1) + if(theSize.x > 1) { - theOrigin_x -= 0.5 * (theSize_x - 1); + theOrigin.x -= 0.5 * (theSize.x - 1); theSize_x = 1; } - if(theSize_y > 1) + if(theSize.y > 1) { - theOrigin_y -= 0.5 * (theSize_y - 1); + theOrigin.y -= 0.5 * (theSize.y - 1); theSize_y = 1; } - theOrigin_x = bound(0, theOrigin_x, 1 - theSize_x); - theOrigin_y = bound(0, theOrigin_y, 1 - theSize_y); + theOrigin_x = bound(0, theOrigin.x, 1 - theSize.x); + theOrigin_y = bound(0, theOrigin.y, 1 - theSize.y); other.parent = me; other.Container_origin = theOrigin; diff --git a/qcsrc/menu/item/dialog.qc b/qcsrc/menu/item/dialog.qc index 383578781..fed110f6f 100644 --- a/qcsrc/menu/item/dialog.qc +++ b/qcsrc/menu/item/dialog.qc @@ -81,12 +81,12 @@ void Dialog_fill(entity me) void Dialog_addItemSimple(entity me, float row, float col, float rowspan, float colspan, entity e, vector v) { vector o, s; - o = me.itemOrigin + eX * ( col * me.itemSpacing_x) + eY * ( row * me.itemSpacing_y); - s = me.itemSize + eX * ((colspan - 1) * me.itemSpacing_x) + eY * ((rowspan - 1) * me.itemSpacing_y); - o_x -= 0.5 * (me.itemSpacing_x - me.itemSize_x) * v_x; - s_x += (me.itemSpacing_x - me.itemSize_x) * v_x; - o_y -= 0.5 * (me.itemSpacing_y - me.itemSize_y) * v_y; - s_y += (me.itemSpacing_y - me.itemSize_y) * v_y; + o = me.itemOrigin + eX * ( col * me.itemSpacing.x) + eY * ( row * me.itemSpacing.y); + s = me.itemSize + eX * ((colspan - 1) * me.itemSpacing.x) + eY * ((rowspan - 1) * me.itemSpacing.y); + o.x -= 0.5 * (me.itemSpacing.x - me.itemSize.x) * v.x; + s.x += (me.itemSpacing.x - me.itemSize.x) * v.x; + o.y -= 0.5 * (me.itemSpacing.y - me.itemSize.y) * v.y; + s.y += (me.itemSpacing.y - me.itemSize.y) * v.y; me.addItem(me, e, o, s, 1); } diff --git a/qcsrc/menu/item/image.qc b/qcsrc/menu/item/image.qc index 8d1a6de86..1b5aa59a0 100644 --- a/qcsrc/menu/item/image.qc +++ b/qcsrc/menu/item/image.qc @@ -47,17 +47,17 @@ void Image_initZoom(entity me) void Image_draw(entity me) { - if(me.imgSize_x > 1 || me.imgSize_y > 1) + if(me.imgSize.x > 1 || me.imgSize.y > 1) draw_SetClip(); draw_Picture(me.imgOrigin, me.src, me.imgSize, me.color, 1); - if(me.imgSize_x > 1 || me.imgSize_y > 1) + if(me.imgSize.x > 1 || me.imgSize.y > 1) draw_ClearClip(); SUPER(Image).draw(me); } void Image_updateAspect(entity me) { float asp = 0; - if(me.size_x <= 0 || me.size_y <= 0) + if(me.size.x <= 0 || me.size.y <= 0) return; if(me.forcedAspect == 0) { @@ -71,42 +71,42 @@ void Image_updateAspect(entity me) { if (me.src != "") sz = draw_PictureSize(me.src); - if(sz_x <= 0 || sz_y <= 0) + if(sz.x <= 0 || sz.y <= 0) { // image is broken or doesn't exist, set the size for the placeholder image - sz_x = me.size_x; - sz_y = me.size_y; + sz_x = me.size.x; + sz_y = me.size.y; } - asp = sz_x / sz_y; + asp = sz.x / sz.y; } else asp = me.forcedAspect; if(me.forcedAspect <= -2) { - me.imgSize_x = sz_x / me.size_x; - me.imgSize_y = sz_y / me.size_y; - if(me.zoomBox < 0 && (me.imgSize_x > 1 || me.imgSize_y > 1)) + me.imgSize_x = sz.x / me.size.x; + me.imgSize_y = sz.y / me.size.y; + if(me.zoomBox < 0 && (me.imgSize.x > 1 || me.imgSize.y > 1)) { // image larger than the containing box, zoom it out to fit into the box - if(me.size_x > asp * me.size_y) - me.zoomBox = (me.size_y * asp / me.size_x) / me.imgSize_x; + if(me.size.x > asp * me.size.y) + me.zoomBox = (me.size.y * asp / me.size.x) / me.imgSize.x; else - me.zoomBox = (me.size_x / (asp * me.size_y)) / me.imgSize_y; + me.zoomBox = (me.size.x / (asp * me.size.y)) / me.imgSize.y; me.zoomFactor = me.zoomBox; } } else { - if(me.size_x > asp * me.size_y) + if(me.size.x > asp * me.size.y) { // x too large, so center x-wise - me.imgSize = eY + eX * (me.size_y * asp / me.size_x); + me.imgSize = eY + eX * (me.size.y * asp / me.size.x); } else { // y too large, so center y-wise - me.imgSize = eX + eY * (me.size_x / (asp * me.size_y)); + me.imgSize = eX + eY * (me.size.x / (asp * me.size.y)); } } } @@ -117,10 +117,10 @@ void Image_updateAspect(entity me) me.zoomMax = me.zoomBox; else { - if(me.size_x > asp * me.size_y) - me.zoomMax = (me.size_y * asp / me.size_x) / me.imgSize_x; + if(me.size.x > asp * me.size.y) + me.zoomMax = (me.size.y * asp / me.size.x) / me.imgSize.x; else - me.zoomMax = (me.size_x / (asp * me.size_y)) / me.imgSize_y; + me.zoomMax = (me.size.x / (asp * me.size.y)) / me.imgSize.y; } } @@ -129,31 +129,31 @@ void Image_updateAspect(entity me) if (me.zoomFactor) me.imgSize = me.imgSize * me.zoomFactor; - if(me.imgSize_x > 1 || me.imgSize_y > 1) + if(me.imgSize.x > 1 || me.imgSize.y > 1) { if(me.zoomSnapToTheBox) { - if(me.imgSize_x > 1) - me.zoomOffset_x = bound(0.5/me.imgSize_x, me.zoomOffset_x, 1 - 0.5/me.imgSize_x); + if(me.imgSize.x > 1) + me.zoomOffset_x = bound(0.5/me.imgSize.x, me.zoomOffset.x, 1 - 0.5/me.imgSize.x); else - me.zoomOffset_x = bound(1 - 0.5/me.imgSize_x, me.zoomOffset_x, 0.5/me.imgSize_x); + me.zoomOffset_x = bound(1 - 0.5/me.imgSize.x, me.zoomOffset.x, 0.5/me.imgSize.x); - if(me.imgSize_y > 1) - me.zoomOffset_y = bound(0.5/me.imgSize_y, me.zoomOffset_y, 1 - 0.5/me.imgSize_y); + if(me.imgSize.y > 1) + me.zoomOffset_y = bound(0.5/me.imgSize.y, me.zoomOffset.y, 1 - 0.5/me.imgSize.y); else - me.zoomOffset_y = bound(1 - 0.5/me.imgSize_y, me.zoomOffset_y, 0.5/me.imgSize_y); + me.zoomOffset_y = bound(1 - 0.5/me.imgSize.y, me.zoomOffset.y, 0.5/me.imgSize.y); } else { - me.zoomOffset_x = bound(0, me.zoomOffset_x, 1); - me.zoomOffset_y = bound(0, me.zoomOffset_y, 1); + me.zoomOffset_x = bound(0, me.zoomOffset.x, 1); + me.zoomOffset_y = bound(0, me.zoomOffset.y, 1); } } else me.zoomOffset = '0.5 0.5 0'; - me.imgOrigin_x = 0.5 - me.zoomOffset_x * me.imgSize_x; - me.imgOrigin_y = 0.5 - me.zoomOffset_y * me.imgSize_y; + me.imgOrigin_x = 0.5 - me.zoomOffset.x * me.imgSize.x; + me.imgOrigin_y = 0.5 - me.zoomOffset.y * me.imgSize.y; } float Image_drag_setStartPos(entity me, vector coords) { @@ -166,10 +166,10 @@ float Image_drag_setStartPos(entity me, vector coords) } float Image_drag(entity me, vector coords) { - if(me.imgSize_x > 1 || me.imgSize_y > 1) + if(me.imgSize.x > 1 || me.imgSize.y > 1) { - me.zoomOffset_x = me.start_zoomOffset_x + (me.start_coords_x - coords_x) / me.imgSize_x; - me.zoomOffset_y = me.start_zoomOffset_y + (me.start_coords_y - coords_y) / me.imgSize_y; + me.zoomOffset_x = me.start_zoomOffset.x + (me.start_coords.x - coords.x) / me.imgSize.x; + me.zoomOffset_y = me.start_zoomOffset.y + (me.start_coords.y - coords.y) / me.imgSize.y; me.updateAspect(me); } return 1; @@ -214,8 +214,8 @@ void Image_setZoom(entity me, float z, float atMousePosition) me.zoomTime = time; if (atMousePosition) { - me.zoomOffset_x = me.start_zoomOffset_x + (me.start_coords_x - 0.5) / me.imgSize_x; - me.zoomOffset_y = me.start_zoomOffset_y + (me.start_coords_y - 0.5) / me.imgSize_y; + me.zoomOffset_x = me.start_zoomOffset.x + (me.start_coords.x - 0.5) / me.imgSize.x; + me.zoomOffset_y = me.start_zoomOffset.y + (me.start_coords.y - 0.5) / me.imgSize.y; // updateAspect will reset zoomOffset to '0.5 0.5 0' if // with this zoomFactor the image will not be zoomed in // (updateAspect will check the new values of imgSize). diff --git a/qcsrc/menu/item/inputbox.qc b/qcsrc/menu/item/inputbox.qc index 7708a0d7f..e85cfa0e8 100644 --- a/qcsrc/menu/item/inputbox.qc +++ b/qcsrc/menu/item/inputbox.qc @@ -53,7 +53,7 @@ void InputBox_resizeNotify(entity me, vector relOrigin, vector relSize, vector a SUPER(InputBox).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); if (me.enableClearButton) { - me.cb_width = absSize_y / absSize_x; + me.cb_width = absSize.y / absSize.x; me.cb_offset = bound(-1, me.cb_offset, 0) * me.cb_width; // bound to range -1, 0 me.keepspaceRight = me.keepspaceRight - me.cb_offset + me.cb_width; } @@ -73,10 +73,10 @@ void InputBox_Clear_Click(entity btn, entity me) float over_ClearButton(entity me, vector pos) { - if (pos_x >= 1 + me.cb_offset - me.cb_width) - if (pos_x < 1 + me.cb_offset) - if (pos_y >= 0) - if (pos_y < 1) + if (pos.x >= 1 + me.cb_offset - me.cb_width) + if (pos.x < 1 + me.cb_offset) + if (pos.y >= 0) + if (pos.y < 1) return 1; return 0; } @@ -101,7 +101,7 @@ float InputBox_mouseDrag(entity me, vector pos) if(me.pressed) { me.dragScrollPos = pos; - p = me.scrollPos + pos_x - me.keepspaceLeft; + p = me.scrollPos + pos.x - me.keepspaceLeft; me.cursorPos = draw_TextLengthUpToWidth(me.text, p, 0, me.realFontSize); me.lastChangeTime = time; } @@ -276,7 +276,7 @@ void InputBox_draw(entity me) w = draw_TextWidth(strcat(ch, ch2), 0, me.realFontSize); if(ch2 == "^") { - draw_Fill(p, eX * w + eY * me.realFontSize_y, '1 1 1', 0.5); + draw_Fill(p, eX * w + eY * me.realFontSize.y, '1 1 1', 0.5); draw_Text(p + eX * 0.25 * w, "^", me.realFontSize, theColor, theAlpha, 0); } else if(ch2 == "0" || stof(ch2)) // digit? @@ -294,7 +294,7 @@ void InputBox_draw(entity me) case 8: theColor = '1 1 1'; theAlpha = 0.5; break; case 9: theColor = '0.5 0.5 0.5'; theAlpha = 1; break; } - draw_Fill(p, eX * w + eY * me.realFontSize_y, '1 1 1', 0.5); + draw_Fill(p, eX * w + eY * me.realFontSize.y, '1 1 1', 0.5); draw_Text(p, strcat(ch, ch2), me.realFontSize, theColor, theAlpha, 0); } else if(ch2 == "x") // ^x found @@ -318,7 +318,7 @@ void InputBox_draw(entity me) theColor = theTempColor; w = draw_TextWidth(substring(me.text, i, 5), 0, me.realFontSize); - draw_Fill(p, eX * w + eY * me.realFontSize_y, '1 1 1', 0.5); + draw_Fill(p, eX * w + eY * me.realFontSize.y, '1 1 1', 0.5); draw_Text(p, substring(me.text, i, 5), me.realFontSize, theColor, 1, 0); // theVariableAlpha instead of 1 using alpha tags ^ax i += 3; } @@ -326,7 +326,7 @@ void InputBox_draw(entity me) { // blue missing w = draw_TextWidth(substring(me.text, i, 4), 0, me.realFontSize); - draw_Fill(p, eX * w + eY * me.realFontSize_y, eZ, 0.5); + draw_Fill(p, eX * w + eY * me.realFontSize.y, eZ, 0.5); draw_Text(p, substring(me.text, i, 4), me.realFontSize, '1 1 1', theAlpha, 0); i += 2; } @@ -335,7 +335,7 @@ void InputBox_draw(entity me) { // green missing w = draw_TextWidth(substring(me.text, i, 3), 0, me.realFontSize); - draw_Fill(p, eX * w + eY * me.realFontSize_y, eY, 0.5); + draw_Fill(p, eX * w + eY * me.realFontSize.y, eY, 0.5); draw_Text(p, substring(me.text, i, 3), me.realFontSize, '1 1 1', theAlpha, 0); i += 1; } @@ -344,13 +344,13 @@ void InputBox_draw(entity me) { // red missing //w = draw_TextWidth(substring(me.text, i, 2), 0) * me.realFontSize_x; - draw_Fill(p, eX * w + eY * me.realFontSize_y, eX, 0.5); + draw_Fill(p, eX * w + eY * me.realFontSize.y, eX, 0.5); draw_Text(p, substring(me.text, i, 2), me.realFontSize, '1 1 1', theAlpha, 0); } } else { - draw_Fill(p, eX * w + eY * me.realFontSize_y, '1 1 1', 0.5); + draw_Fill(p, eX * w + eY * me.realFontSize.y, '1 1 1', 0.5); draw_Text(p, strcat(ch, ch2), me.realFontSize, theColor, theAlpha, 0); } p += w * eX; diff --git a/qcsrc/menu/item/inputcontainer.qc b/qcsrc/menu/item/inputcontainer.qc index 0f80c2b50..8c09d1991 100644 --- a/qcsrc/menu/item/inputcontainer.qc +++ b/qcsrc/menu/item/inputcontainer.qc @@ -128,7 +128,7 @@ float InputContainer_mouseDrag(entity me, vector pos) { if(SUPER(InputContainer).mouseDrag(me, pos)) return 1; - if(pos_x >= 0 && pos_y >= 0 && pos_x < 1 && pos_y < 1) + if(pos.x >= 0 && pos.y >= 0 && pos.x < 1 && pos.y < 1) return 1; return 0; } @@ -139,7 +139,7 @@ float InputContainer_mouseMove(entity me, vector pos) if(me._changeFocusXY(me, pos)) if(SUPER(InputContainer).mouseMove(me, pos)) return 1; - if(pos_x >= 0 && pos_y >= 0 && pos_x < 1 && pos_y < 1) + if(pos.x >= 0 && pos.y >= 0 && pos.x < 1 && pos.y < 1) return 1; return 0; } @@ -149,7 +149,7 @@ float InputContainer_mousePress(entity me, vector pos) if(me._changeFocusXY(me, pos)) if(SUPER(InputContainer).mousePress(me, pos)) return 1; - if(pos_x >= 0 && pos_y >= 0 && pos_x < 1 && pos_y < 1) + if(pos.x >= 0 && pos.y >= 0 && pos.x < 1 && pos.y < 1) return 1; return 0; } @@ -159,7 +159,7 @@ float InputContainer_mouseRelease(entity me, vector pos) if(me.focused) // am I still eligible for this? (UGLY HACK, but a mouse event could have changed focus away) if(me._changeFocusXY(me, pos)) return 1; - if(pos_x >= 0 && pos_y >= 0 && pos_x < 1 && pos_y < 1) + if(pos.x >= 0 && pos.y >= 0 && pos.x < 1 && pos.y < 1) return 1; return 0; } diff --git a/qcsrc/menu/item/label.qc b/qcsrc/menu/item/label.qc index 592c3a7ac..a1769fc03 100644 --- a/qcsrc/menu/item/label.qc +++ b/qcsrc/menu/item/label.qc @@ -90,10 +90,10 @@ void Label_recalcPositionWithText(entity me, string t) // set up variables to draw in condensed size, but use hinting for original size fs = me.realFontSize; - fs_x *= me.condenseFactor; + fs.x *= me.condenseFactor; dfs = draw_fontscale; - draw_fontscale_x *= me.condenseFactor; + draw_fontscale.x *= me.condenseFactor; if(me.allowCut) // FIXME allowCut incompatible with align != 0 lines = 1; @@ -115,7 +115,7 @@ void Label_recalcPositionWithText(entity me, string t) draw_fontscale = dfs; - me.realOrigin_y = 0.5 * (1 - lines * me.realFontSize_y); + me.realOrigin_y = 0.5 * (1 - lines * me.realFontSize.y); } if(me.isBold) @@ -128,12 +128,12 @@ void Label_resizeNotify(entity me, vector relOrigin, vector relSize, vector absO SUPER(Label).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); // absSize_y is height of label - me.realFontSize_y = me.fontSize / absSize_y; - me.realFontSize_x = me.fontSize / absSize_x; + me.realFontSize_y = me.fontSize / absSize.y; + me.realFontSize_x = me.fontSize / absSize.x; if(me.marginLeft) - me.keepspaceLeft = me.marginLeft * me.realFontSize_x; + me.keepspaceLeft = me.marginLeft * me.realFontSize.x; if(me.marginRight) - me.keepspaceRight = me.marginRight * me.realFontSize_x; + me.keepspaceRight = me.marginRight * me.realFontSize.x; me.recalcPos = 1; } @@ -178,10 +178,10 @@ void Label_draw(entity me) // set up variables to draw in condensed size, but use hinting for original size fs = me.realFontSize; - fs_x *= me.condenseFactor; + fs.x *= me.condenseFactor; dfs = draw_fontscale; - draw_fontscale_x *= me.condenseFactor; + draw_fontscale.x *= me.condenseFactor; if(me.allowCut) // FIXME allowCut incompatible with align != 0 draw_Text(me.realOrigin, draw_TextShortenToWidth(t, (1 - me.keepspaceLeft - me.keepspaceRight), me.allowColors, fs), fs, me.colorL, me.alpha, me.allowColors); @@ -196,7 +196,7 @@ void Label_draw(entity me) else t = getWrappedLine((1 - me.keepspaceLeft - me.keepspaceRight), fs, draw_TextWidth_WithoutColors); draw_Text(o, t, fs, me.colorL, me.alpha, me.allowColors); - o_y += me.realFontSize_y; + o.y += me.realFontSize.y; } } else diff --git a/qcsrc/menu/item/listbox.qc b/qcsrc/menu/item/listbox.qc index b92beb3d1..208367ae7 100644 --- a/qcsrc/menu/item/listbox.qc +++ b/qcsrc/menu/item/listbox.qc @@ -81,7 +81,7 @@ void ListBox_setSelected(entity me, float i) void ListBox_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize) { SUPER(ListBox).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); - me.controlWidth = me.scrollbarWidth / absSize_x; + me.controlWidth = me.scrollbarWidth / absSize.x; } void ListBox_configureListBox(entity me, float theScrollbarWidth, float theItemHeight) { @@ -184,15 +184,15 @@ float ListBox_mouseDrag(entity me, vector pos) if(me.pressed == 1) { hit = 1; - if(pos_x < 1 - me.controlWidth - me.tolerance_y * me.controlWidth) hit = 0; - if(pos_y < 0 - me.tolerance_x) hit = 0; - if(pos_x >= 1 + me.tolerance_y * me.controlWidth) hit = 0; - if(pos_y >= 1 + me.tolerance_x) hit = 0; + if(pos.x < 1 - me.controlWidth - me.tolerance.y * me.controlWidth) hit = 0; + if(pos.y < 0 - me.tolerance.x) hit = 0; + if(pos.x >= 1 + me.tolerance.y * me.controlWidth) hit = 0; + if(pos.y >= 1 + me.tolerance.x) hit = 0; if(hit) { // calculate new pos to v float d; - d = (pos_y - me.pressOffset) / (1 - (me.controlBottom - me.controlTop)) * (me.getTotalHeight(me) - 1); + d = (pos.y - me.pressOffset) / (1 - (me.controlBottom - me.controlTop)) * (me.getTotalHeight(me) - 1); me.scrollPos = me.previousValue + d; } else @@ -205,29 +205,29 @@ float ListBox_mouseDrag(entity me, vector pos) } else if(me.pressed == 2) { - me.setSelected(me, me.getItemAtPos(me, me.scrollPos + pos_y)); + me.setSelected(me, me.getItemAtPos(me, me.scrollPos + pos.y)); } return 1; } float ListBox_mousePress(entity me, vector pos) { - if(pos_x < 0) return 0; - if(pos_y < 0) return 0; - if(pos_x >= 1) return 0; - if(pos_y >= 1) return 0; + if(pos.x < 0) return 0; + if(pos.y < 0) return 0; + if(pos.x >= 1) return 0; + if(pos.y >= 1) return 0; me.dragScrollPos = pos; me.updateControlTopBottom(me); me.dragScrollTimer = time; - if(pos_x >= 1 - me.controlWidth) + if(pos.x >= 1 - me.controlWidth) { // if hit, set me.pressed, otherwise scroll by one page - if(pos_y < me.controlTop) + if(pos.y < me.controlTop) { // page up me.scrollPos = max(me.scrollPos - 1, 0); me.setSelected(me, min(me.selectedItem, ListBox_getLastFullyVisibleItemAtScrollPos(me, me.scrollPos))); } - else if(pos_y > me.controlBottom) + else if(pos.y > me.controlBottom) { // page down me.scrollPos = min(me.scrollPos + 1, me.getTotalHeight(me) - 1); @@ -236,7 +236,7 @@ float ListBox_mousePress(entity me, vector pos) else { me.pressed = 1; - me.pressOffset = pos_y; + me.pressOffset = pos.y; me.previousValue = me.scrollPos; } } @@ -245,7 +245,7 @@ float ListBox_mousePress(entity me, vector pos) // continue doing that while dragging (even when dragging outside). When releasing, forward the click to the then selected item. me.pressed = 2; // an item has been clicked. Select it, ... - me.setSelected(me, me.getItemAtPos(me, me.scrollPos + pos_y)); + me.setSelected(me, me.getItemAtPos(me, me.scrollPos + pos.y)); } return 1; } @@ -261,7 +261,7 @@ float ListBox_mouseRelease(entity me, vector pos) me.pressed = 3; // do that here, so setSelected can know the mouse has been released // item dragging mode // select current one one last time... - me.setSelected(me, me.getItemAtPos(me, me.scrollPos + pos_y)); + me.setSelected(me, me.getItemAtPos(me, me.scrollPos + pos.y)); // and give it a nice click event if(me.nItems > 0) { @@ -322,7 +322,7 @@ void ListBox_updateControlTopBottom(entity me) me.controlBottom = min((me.scrollPos + 1) / me.getTotalHeight(me), 1); float minfactor; - minfactor = 2 * me.controlWidth / me.size_y * me.size_x; + minfactor = 2 * me.controlWidth / me.size.y * me.size.x; f = me.controlBottom - me.controlTop; if(f < minfactor) // FIXME good default? { @@ -376,7 +376,7 @@ void ListBox_draw(entity me) absSize = boxToGlobalSize(relSize, me.size); draw_scale = boxToGlobalSize(relSize, oldscale); me.drawListBoxItem(me, i, absSize, (me.selectedItem == i)); - y += relSize_y; + y += relSize.y; } draw_ClearClip(); @@ -397,6 +397,6 @@ void ListBox_doubleClickListBoxItem(entity me, float i, vector where) void ListBox_drawListBoxItem(entity me, float i, vector absSize, float selected) { - draw_Text('0 0 0', sprintf(_("Item %d"), i), eX * (8 / absSize_x) + eY * (8 / absSize_y), (selected ? '0 1 0' : '1 1 1'), 1, 0); + draw_Text('0 0 0', sprintf(_("Item %d"), i), eX * (8 / absSize.x) + eY * (8 / absSize.y), (selected ? '0 1 0' : '1 1 1'), 1, 0); } #endif diff --git a/qcsrc/menu/item/modalcontroller.qc b/qcsrc/menu/item/modalcontroller.qc index 8a025cb33..38332fd74 100644 --- a/qcsrc/menu/item/modalcontroller.qc +++ b/qcsrc/menu/item/modalcontroller.qc @@ -221,8 +221,8 @@ void ModalController_draw(entity me) // o' = (to * (f - f_prev) + o * (1 - f)) / (1 - f_prev) fs = globalToBoxSize(e.Container_size, e.ModalController_initialSize); - e.Container_fontscale_x = fs_x * e.ModalController_initialFontScale_x; - e.Container_fontscale_y = fs_y * e.ModalController_initialFontScale_y; + e.Container_fontscale_x = fs.x * e.ModalController_initialFontScale.x; + e.Container_fontscale_y = fs.y * e.ModalController_initialFontScale.y; } if(animating || !me.focused) me.setFocus(me, NULL); diff --git a/qcsrc/menu/item/nexposee.qc b/qcsrc/menu/item/nexposee.qc index ca7ab8fc3..79a294a3c 100644 --- a/qcsrc/menu/item/nexposee.qc +++ b/qcsrc/menu/item/nexposee.qc @@ -72,14 +72,14 @@ void Nexposee_Calc_Scale(entity me, float scale) { e.Nexposee_smallOrigin = (e.Nexposee_initialOrigin - e.Nexposee_scaleCenter) * scale + e.Nexposee_scaleCenter; e.Nexposee_smallSize = e.Nexposee_initialSize * scale; - if(e.Nexposee_align_x > 0) - e.Nexposee_smallOrigin_x = 1 - e.Nexposee_align_x * scale; - if(e.Nexposee_align_x < 0) - e.Nexposee_smallOrigin_x = -e.Nexposee_smallSize_x + e.Nexposee_align_x * scale; - if(e.Nexposee_align_y > 0) - e.Nexposee_smallOrigin_y = 1 - e.Nexposee_align_y * scale; - if(e.Nexposee_align_y < 0) - e.Nexposee_smallOrigin_y = -e.Nexposee_smallSize_y + e.Nexposee_align_y * scale; + if(e.Nexposee_align.x > 0) + e.Nexposee_smallOrigin_x = 1 - e.Nexposee_align.x * scale; + if(e.Nexposee_align.x < 0) + e.Nexposee_smallOrigin_x = -e.Nexposee_smallSize.x + e.Nexposee_align.x * scale; + if(e.Nexposee_align.y > 0) + e.Nexposee_smallOrigin_y = 1 - e.Nexposee_align.y * scale; + if(e.Nexposee_align.y < 0) + e.Nexposee_smallOrigin_y = -e.Nexposee_smallSize.y + e.Nexposee_align.y * scale; } } @@ -111,8 +111,8 @@ void Nexposee_calc(entity me) // for which suffices // bmins < amaxs // amins < bmaxs - if((e2mins_x - emaxs_x) * (emins_x - e2maxs_x) > 0) // x overlap - if((e2mins_y - emaxs_y) * (emins_y - e2maxs_y) > 0) // y overlap + if((e2mins.x - emaxs.x) * (emins.x - e2maxs.x) > 0) // x overlap + if((e2mins.y - emaxs.y) * (emins.y - e2maxs.y) > 0) // y overlap { goto have_overlap; } @@ -204,8 +204,8 @@ void Nexposee_draw(entity me) me.setAlphaOf(me, e, e.Container_alpha * (1 - f) + a * f); fs = globalToBoxSize(e.Container_size, e.Nexposee_initialSize); - e.Container_fontscale_x = fs_x * e.Nexposee_initialFontScale_x; - e.Container_fontscale_y = fs_y * e.Nexposee_initialFontScale_y; + e.Container_fontscale_x = fs.x * e.Nexposee_initialFontScale.x; + e.Container_fontscale_y = fs.y * e.Nexposee_initialFontScale.y; } SUPER(Nexposee).draw(me); diff --git a/qcsrc/menu/item/slider.qc b/qcsrc/menu/item/slider.qc index c92db27e9..f97871b22 100644 --- a/qcsrc/menu/item/slider.qc +++ b/qcsrc/menu/item/slider.qc @@ -66,7 +66,7 @@ string Slider_toString(entity me) void Slider_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize) { SUPER(Slider).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); - me.controlWidth = absSize_y / absSize_x; + me.controlWidth = absSize.y / absSize.x; } string Slider_valueToText(entity me, float val) { @@ -163,13 +163,13 @@ float Slider_mouseDrag(entity me, vector pos) if(me.pressed) { hit = 1; - if(pos_x < 0 - me.tolerance_x) hit = 0; - if(pos_y < 0 - me.tolerance_y) hit = 0; - if(pos_x >= 1 - me.textSpace + me.tolerance_x) hit = 0; - if(pos_y >= 1 + me.tolerance_y) hit = 0; + if(pos.x < 0 - me.tolerance.x) hit = 0; + if(pos.y < 0 - me.tolerance.y) hit = 0; + if(pos.x >= 1 - me.textSpace + me.tolerance.x) hit = 0; + if(pos.y >= 1 + me.tolerance.y) hit = 0; if(hit) { - v = median(0, (pos_x - me.pressOffset - 0.5 * me.controlWidth) / (1 - me.textSpace - me.controlWidth), 1) * (me.valueMax - me.valueMin) + me.valueMin; + v = median(0, (pos.x - me.pressOffset - 0.5 * me.controlWidth) / (1 - me.textSpace - me.controlWidth), 1) * (me.valueMax - me.valueMin) + me.valueMin; if(me.valueStep) v = floor(0.5 + v / me.valueStep) * me.valueStep; me.setValue(me, v); @@ -187,24 +187,24 @@ float Slider_mousePress(entity me, vector pos) float controlCenter; if(me.disabled) return 0; - if(pos_x < 0) return 0; - if(pos_y < 0) return 0; - if(pos_x >= 1 - me.textSpace) return 0; - if(pos_y >= 1) return 0; + if(pos.x < 0) return 0; + if(pos.y < 0) return 0; + if(pos.x >= 1 - me.textSpace) return 0; + if(pos.y >= 1) return 0; controlCenter = (me.value - me.valueMin) / (me.valueMax - me.valueMin) * (1 - me.textSpace - me.controlWidth) + 0.5 * me.controlWidth; - if(fabs(pos_x - controlCenter) <= 0.5 * me.controlWidth) + if(fabs(pos.x - controlCenter) <= 0.5 * me.controlWidth) { me.pressed = 1; - me.pressOffset = pos_x - controlCenter; + me.pressOffset = pos.x - controlCenter; me.previousValue = me.value; //me.mouseDrag(me, pos); } else { float clickValue, pageValue, inRange; - clickValue = median(0, (pos_x - me.pressOffset - 0.5 * me.controlWidth) / (1 - me.textSpace - me.controlWidth), 1) * (me.valueMax - me.valueMin) + me.valueMin; + clickValue = median(0, (pos.x - me.pressOffset - 0.5 * me.controlWidth) / (1 - me.textSpace - me.controlWidth), 1) * (me.valueMax - me.valueMin) + me.valueMin; inRange = (almost_in_bounds(me.valueMin, me.value, me.valueMax)); - if(pos_x < controlCenter) + if(pos.x < controlCenter) { pageValue = me.value - me.valuePageStep; if(me.valueStep) @@ -230,7 +230,7 @@ float Slider_mousePress(entity me, vector pos) { controlCenter = (me.value - me.valueMin) / (me.valueMax - me.valueMin) * (1 - me.textSpace - me.controlWidth) + 0.5 * me.controlWidth; me.pressed = 1; - me.pressOffset = pos_x - controlCenter; + me.pressOffset = pos.x - controlCenter; me.previousValue = me.value; //me.mouseDrag(me, pos); } diff --git a/qcsrc/menu/menu.qc b/qcsrc/menu/menu.qc index 8a7d04193..446f1d0d2 100644 --- a/qcsrc/menu/menu.qc +++ b/qcsrc/menu/menu.qc @@ -264,7 +264,7 @@ void m_keydown(float key, float ascii) { // detect a click outside of the game window vector p = getmousepos(); - if(p_x < 0 || p_x > realconwidth || p_y < 0 || p_y > realconheight) + if(p.x < 0 || p.x > realconwidth || p.y < 0 || p.y > realconheight) { ++mouseButtonsPressed; return; @@ -314,9 +314,9 @@ void draw_Picture_Aligned(vector algn, float scalemode, string img, float a) float width_is_larger; sz = draw_PictureSize(img); - width_is_larger = (sz_x * draw_scale_y >= sz_y * draw_scale_x); - isz_w = '1 0 0' + '0 1 0' * ((sz_y / sz_x) * (draw_scale_x / draw_scale_y)); - isz_h = '0 1 0' + '1 0 0' * ((sz_x / sz_y) * (draw_scale_y / draw_scale_x)); + width_is_larger = (sz.x * draw_scale.y >= sz.y * draw_scale.x); + isz_w = '1 0 0' + '0 1 0' * ((sz.y / sz.x) * (draw_scale.x / draw_scale.y)); + isz_h = '0 1 0' + '1 0 0' * ((sz.x / sz.y) * (draw_scale.y / draw_scale.x)); switch(scalemode) { @@ -338,7 +338,7 @@ void draw_Picture_Aligned(vector algn, float scalemode, string img, float a) break; } - org = eX * (algn_x * (1 - isz_x)) + eY * (algn_y * (1 - isz_y)); + org = eX * (algn.x * (1 - isz.x)) + eY * (algn.y * (1 - isz.y)); draw_Picture(org, img, isz, '1 1 1', a); } @@ -404,20 +404,20 @@ string menuTooltipText; float menuTooltipState; // 0: static, 1: fading in, 2: fading out float m_testmousetooltipbox(vector pos) { - if(pos_x >= menuTooltipOrigin_x && pos_x < menuTooltipOrigin_x + menuTooltipSize_x) - if(pos_y >= menuTooltipOrigin_y && pos_y < menuTooltipOrigin_y + menuTooltipSize_y) + if(pos.x >= menuTooltipOrigin.x && pos.x < menuTooltipOrigin.x + menuTooltipSize.x) + if(pos.y >= menuTooltipOrigin.y && pos.y < menuTooltipOrigin.y + menuTooltipSize.y) return FALSE; return TRUE; } float m_testtooltipbox(vector tooltippos) { - if(tooltippos_x < 0) + if(tooltippos.x < 0) return FALSE; - if(tooltippos_y < 0) + if(tooltippos.y < 0) return FALSE; - if(tooltippos_x + menuTooltipSize_x > 1) + if(tooltippos.x + menuTooltipSize.x > 1) return FALSE; - if(tooltippos_y + menuTooltipSize_y > 1) + if(tooltippos.y + menuTooltipSize.y > 1) return FALSE; menuTooltipOrigin = tooltippos; return TRUE; @@ -431,8 +431,8 @@ float m_allocatetooltipbox(vector pos) avoidplus_y = (SKINAVOID_TOOLTIP_y + SKINSIZE_CURSOR_y - SKINOFFSET_CURSOR_y * SKINSIZE_CURSOR_y) / conheight; avoidplus_z = 0; - avoidminus_x = (SKINAVOID_TOOLTIP_x + SKINOFFSET_CURSOR_x * SKINSIZE_CURSOR_x) / conwidth + menuTooltipSize_x; - avoidminus_y = (SKINAVOID_TOOLTIP_y + SKINOFFSET_CURSOR_y * SKINSIZE_CURSOR_y) / conheight + menuTooltipSize_y; + avoidminus_x = (SKINAVOID_TOOLTIP_x + SKINOFFSET_CURSOR_x * SKINSIZE_CURSOR_x) / conwidth + menuTooltipSize.x; + avoidminus_y = (SKINAVOID_TOOLTIP_y + SKINOFFSET_CURSOR_y * SKINSIZE_CURSOR_y) / conheight + menuTooltipSize.y; avoidminus_z = 0; // bottom right @@ -441,27 +441,27 @@ float m_allocatetooltipbox(vector pos) return TRUE; // bottom center - v_x = pos_x - menuTooltipSize_x * 0.5; + v_x = pos.x - menuTooltipSize.x * 0.5; if(m_testtooltipbox(v)) return TRUE; // bottom left - v_x = pos_x - avoidminus_x; + v_x = pos.x - avoidminus.x; if(m_testtooltipbox(v)) return TRUE; // top left - v_y = pos_y - avoidminus_y; + v_y = pos.y - avoidminus.y; if(m_testtooltipbox(v)) return TRUE; // top center - v_x = pos_x - menuTooltipSize_x * 0.5; + v_x = pos.x - menuTooltipSize.x * 0.5; if(m_testtooltipbox(v)) return TRUE; // top right - v_x = pos_x + avoidplus_x; + v_x = pos.x + avoidplus.x; if(m_testtooltipbox(v)) return TRUE; @@ -591,7 +591,7 @@ void m_tooltip(vector pos) w = f; } menuTooltipSize_x = w + 2 * (SKINMARGIN_TOOLTIP_x / conwidth); - menuTooltipSize_y = i * fontsize_y + 2 * (SKINMARGIN_TOOLTIP_y / conheight); + menuTooltipSize_y = i * fontsize.y + 2 * (SKINMARGIN_TOOLTIP_y / conheight); menuTooltipSize_z = 0; } break; @@ -645,25 +645,25 @@ void m_tooltip(vector pos) menuTooltipItem = world; // reload tooltip next frame menu_tooltips_old = menu_tooltips; } - else if(menuTooltipOrigin_x < 0) // unallocated? + else if(menuTooltipOrigin.x < 0) // unallocated? m_allocatetooltipbox(pos); - if(menuTooltipOrigin_x >= 0) + if(menuTooltipOrigin.x >= 0) { // draw the tooltip! p = SKINBORDER_TOOLTIP; - p_x *= 1 / conwidth; - p_y *= 1 / conheight; + p.x *= 1 / conwidth; + p.y *= 1 / conheight; draw_BorderPicture(menuTooltipOrigin, SKINGFX_TOOLTIP, menuTooltipSize, '1 1 1', menuTooltipAlpha, p); p = menuTooltipOrigin; - p_x += SKINMARGIN_TOOLTIP_x / conwidth; - p_y += SKINMARGIN_TOOLTIP_y / conheight; + p.x += SKINMARGIN_TOOLTIP_x / conwidth; + p.y += SKINMARGIN_TOOLTIP_y / conheight; getWrappedLine_remaining = menuTooltipText; while(getWrappedLine_remaining) { s = getWrappedLine(SKINWIDTH_TOOLTIP, fontsize, draw_TextWidth_WithoutColors); draw_Text(p, s, fontsize, SKINCOLOR_TOOLTIP, SKINALPHA_TOOLTIP * menuTooltipAlpha, FALSE); - p_y += fontsize_y; + p.y += fontsize.y; } } } @@ -825,8 +825,8 @@ void m_draw(float width, float height) maxpos = globalToBox(eX * (realconwidth - 1) + eY * (realconheight - 1), draw_shift, draw_scale); dMouse = globalToBoxSize(dMouse, draw_scale); menuMousePos += dMouse * cvar("menu_mouse_speed"); - menuMousePos_x = bound(minpos_x, menuMousePos_x, maxpos_x); - menuMousePos_y = bound(minpos_y, menuMousePos_y, maxpos_y); + menuMousePos_x = bound(minpos.x, menuMousePos.x, maxpos.x); + menuMousePos_y = bound(minpos.y, menuMousePos.y, maxpos.y); if(mouseButtonsPressed) main.mouseDrag(main, menuMousePos); else @@ -953,8 +953,8 @@ void m_setpointerfocus(entity wnd) if(focus) { menuMousePos = focus.origin + 0.5 * focus.size; - menuMousePos_x *= 1 / conwidth; - menuMousePos_y *= 1 / conheight; + menuMousePos.x *= 1 / conwidth; + menuMousePos.y *= 1 / conheight; if(wnd.focused) // why does this never happen? m_focus_item_chain(wnd, focus); } diff --git a/qcsrc/menu/xonotic/campaign.qc b/qcsrc/menu/xonotic/campaign.qc index 126b728c8..de9715354 100644 --- a/qcsrc/menu/xonotic/campaign.qc +++ b/qcsrc/menu/xonotic/campaign.qc @@ -212,19 +212,19 @@ void XonoticCampaignList_resizeNotify(entity me, vector relOrigin, vector relSiz me.itemAbsSize = '0 0 0'; SUPER(XonoticCampaignList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); - me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize_y * me.itemHeight)); - me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize_x * (1 - me.controlWidth))); - me.realUpperMargin1 = 0.5 * me.realFontSize_y; - me.realUpperMargin2 = me.realUpperMargin1 + 2 * me.realFontSize_y; + me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize.y * me.itemHeight)); + me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize.x * (1 - me.controlWidth))); + me.realUpperMargin1 = 0.5 * me.realFontSize.y; + me.realUpperMargin2 = me.realUpperMargin1 + 2 * me.realFontSize.y; - me.checkMarkSize = (eX * (me.itemAbsSize_y / me.itemAbsSize_x) + eY) * 0.5; + me.checkMarkSize = (eX * (me.itemAbsSize.y / me.itemAbsSize.x) + eY) * 0.5; me.columnPreviewOrigin = 0; - me.columnPreviewSize = me.itemAbsSize_y / me.itemAbsSize_x * 4 / 3; - me.columnCheckMarkSize = me.checkMarkSize_x; - me.columnNameSize = 1 - me.columnPreviewSize - me.columnCheckMarkSize - 4 * me.realFontSize_x; - me.columnNameOrigin = me.columnPreviewOrigin + me.columnPreviewSize + me.realFontSize_x; - me.columnCheckMarkOrigin = me.columnNameOrigin + me.columnNameSize + me.realFontSize_x * 2; + me.columnPreviewSize = me.itemAbsSize.y / me.itemAbsSize.x * 4 / 3; + me.columnCheckMarkSize = me.checkMarkSize.x; + me.columnNameSize = 1 - me.columnPreviewSize - me.columnCheckMarkSize - 4 * me.realFontSize.x; + me.columnNameOrigin = me.columnPreviewOrigin + me.columnPreviewSize + me.realFontSize.x; + me.columnCheckMarkOrigin = me.columnNameOrigin + me.columnNameSize + me.realFontSize.x * 2; me.checkMarkOrigin = eY + eX * (me.columnCheckMarkOrigin + me.columnCheckMarkSize) - me.checkMarkSize; @@ -284,10 +284,10 @@ void XonoticCampaignList_drawListBoxItem(entity me, float i, vector absSize, flo if(argv(j) != "") { draw_Text(o, argv(j), me.realFontSize, theColor, theAlpha * SKINALPHA_CAMPAIGN_DESCRIPTION, 0); - o_y += me.realFontSize_y; + o.y += me.realFontSize.y; } else - o_y += me.realFontSize_y * me.emptyLineHeight; + o.y += me.realFontSize.y * me.emptyLineHeight; } } void CampaignList_LoadMap(entity btn, entity me) diff --git a/qcsrc/menu/xonotic/charmap.qc b/qcsrc/menu/xonotic/charmap.qc index 5439c391d..0ba72a5d8 100644 --- a/qcsrc/menu/xonotic/charmap.qc +++ b/qcsrc/menu/xonotic/charmap.qc @@ -46,7 +46,7 @@ string CHARMAP = string charmap_cellToChar(vector cell) { - string character = substring(CHARMAP, cell_y * CHARMAP_COLS + cell_x, 1); + string character = substring(CHARMAP, cell.y * CHARMAP_COLS + cell.x, 1); if (character != " ") return character; @@ -72,31 +72,31 @@ void XonoticCharmap_resizeNotify(entity me, vector relOrigin, vector relSize, ve { SUPER(XonoticCharmap).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); - float maxFontWidth = SKINFONTSIZE_NORMAL / absSize_x; - float maxFontHeight = SKINFONTSIZE_NORMAL / absSize_y; + float maxFontWidth = SKINFONTSIZE_NORMAL / absSize.x; + float maxFontHeight = SKINFONTSIZE_NORMAL / absSize.y; - if((me.realCellSize_x * absSize_x) > (me.realCellSize_y * absSize_y)) + if((me.realCellSize.x * absSize.x) > (me.realCellSize.y * absSize.y)) { - me.realFontSize_x = me.realCellSize_y * absSize_y / absSize_x; - me.realFontSize_y = me.realCellSize_y; + me.realFontSize_x = me.realCellSize.y * absSize.y / absSize.x; + me.realFontSize_y = me.realCellSize.y; } else { - me.realFontSize_x = me.realCellSize_x; - me.realFontSize_y = me.realCellSize_x * absSize_x / absSize_y; + me.realFontSize_x = me.realCellSize.x; + me.realFontSize_y = me.realCellSize.x * absSize.x / absSize.y; } - if(me.realFontSize_x > maxFontWidth || me.realFontSize_y > maxFontHeight) + if(me.realFontSize.x > maxFontWidth || me.realFontSize.y > maxFontHeight) me.realFontSize = eX * maxFontWidth + eY * maxFontHeight; } float XonoticCharmap_mouseMove(entity me, vector coords) { - me.focusedCell_x = floor(coords_x * CHARMAP_COLS); - me.focusedCell_y = floor(coords_y * CHARMAP_ROWS); + me.focusedCell_x = floor(coords.x * CHARMAP_COLS); + me.focusedCell_y = floor(coords.y * CHARMAP_ROWS); - if(me.focusedCell_x < 0 || me.focusedCell_y < 0 || - me.focusedCell_x >= CHARMAP_COLS || me.focusedCell_y >= CHARMAP_ROWS) + if(me.focusedCell.x < 0 || me.focusedCell.y < 0 || + me.focusedCell.x >= CHARMAP_COLS || me.focusedCell.y >= CHARMAP_ROWS) { me.focusedCell = '-1 -1 0'; return 0; @@ -114,7 +114,7 @@ float XonoticCharmap_mousePress(entity me, vector coords) { me.mouseMove(me, coords); - if(me.focusedCell_x >= 0) + if(me.focusedCell.x >= 0) { me.pressed = 1; me.previouslyFocusedCell = me.focusedCell; @@ -179,8 +179,8 @@ float XonoticCharmap_keyDown(entity me, float key, float ascii, float shift) void XonoticCharmap_moveFocus(entity me, vector initialCell, vector step) { - me.focusedCell_x = mod(me.focusedCell_x + step_x + CHARMAP_COLS, CHARMAP_COLS); - me.focusedCell_y = mod(me.focusedCell_y + step_y + CHARMAP_ROWS, CHARMAP_ROWS); + me.focusedCell_x = mod(me.focusedCell.x + step.x + CHARMAP_COLS, CHARMAP_COLS); + me.focusedCell_y = mod(me.focusedCell.y + step.y + CHARMAP_ROWS, CHARMAP_ROWS); if(me.focusedCell != initialCell) // Recursion break if(charmap_cellToChar(me.focusedCell) == "") @@ -207,13 +207,13 @@ void XonoticCharmap_draw(entity me) cellPos = '0 0 0'; charPos = '0 0 0'; - float CHAR_OFFSET_X = me.realCellSize_x / 2; - float CHAR_OFFSET_Y = (me.realCellSize_y - me.realFontSize_y) / 2; + float CHAR_OFFSET_X = me.realCellSize.x / 2; + float CHAR_OFFSET_Y = (me.realCellSize.y - me.realFontSize.y) / 2; - for(cell_y = 0; cell_y < CHARMAP_ROWS; ++cell_y) + for(cell_y = 0; cell.y < CHARMAP_ROWS; ++cell.y) { - charPos_y = cell_y / CHARMAP_ROWS + CHAR_OFFSET_Y; - for(cell_x = 0; cell_x < CHARMAP_COLS; ++cell_x) + charPos_y = cell.y / CHARMAP_ROWS + CHAR_OFFSET_Y; + for(cell_x = 0; cell.x < CHARMAP_COLS; ++cell.x) { character = charmap_cellToChar(cell); @@ -225,14 +225,14 @@ void XonoticCharmap_draw(entity me) { if(!me.pressed || me.focusedCell == me.previouslyFocusedCell) { - cellPos_x = mod(me.focusedCell_x, CHARMAP_COLS) / CHARMAP_COLS; - cellPos_y = mod(me.focusedCell_y, CHARMAP_ROWS) / CHARMAP_ROWS; + cellPos_x = mod(me.focusedCell.x, CHARMAP_COLS) / CHARMAP_COLS; + cellPos_y = mod(me.focusedCell.y, CHARMAP_ROWS) / CHARMAP_ROWS; draw_Fill(cellPos, me.realCellSize, SKINCOLOR_CHARMAP_FOCUS, SKINALPHA_CHARMAP_FOCUS); } } // Draw character - charPos_x = cell_x / CHARMAP_COLS + CHAR_OFFSET_X; + charPos_x = cell.x / CHARMAP_COLS + CHAR_OFFSET_X; draw_CenterText(charPos, character, me.realFontSize, SKINCOLOR_CHARMAP_CHAR, SKINALPHA_CHARMAP_CHAR, 0); } } diff --git a/qcsrc/menu/xonotic/colorpicker.qc b/qcsrc/menu/xonotic/colorpicker.qc index 6e55a585e..36d779744 100644 --- a/qcsrc/menu/xonotic/colorpicker.qc +++ b/qcsrc/menu/xonotic/colorpicker.qc @@ -39,34 +39,34 @@ float XonoticColorpicker_mousePress(entity me, vector coords) // must match hslimage.c vector hslimage_color(vector v, vector margin) { - v_x = (v_x - margin_x) / (1 - 2 * margin_x); - v_y = (v_y - margin_y) / (1 - 2 * margin_y); - if(v_x < 0) v_x = 0; - if(v_y < 0) v_y = 0; - if(v_x > 1) v_x = 1; - if(v_y > 1) v_y = 1; - if(v_y > 0.875) // grey bar - return hsl_to_rgb(eZ * v_x); + v_x = (v.x - margin.x) / (1 - 2 * margin.x); + v_y = (v.y - margin.y) / (1 - 2 * margin.y); + if(v.x < 0) v_x = 0; + if(v.y < 0) v_y = 0; + if(v.x > 1) v_x = 1; + if(v.y > 1) v_y = 1; + if(v.y > 0.875) // grey bar + return hsl_to_rgb(eZ * v.x); else - return hsl_to_rgb(v_x * 6 * eX + eY + v_y / 0.875 * eZ); + return hsl_to_rgb(v.x * 6 * eX + eY + v.y / 0.875 * eZ); } vector color_hslimage(vector v, vector margin) { vector pos = '0 0 0'; v = rgb_to_hsl(v); - if (v_y) + if (v.y) { - pos_x = v_x / 6; - pos_y = v_z * 0.875; + pos_x = v.x / 6; + pos_y = v.z * 0.875; } else // grey scale { - pos_x = v_z; + pos_x = v.z; pos_y = 0.875 + 0.07; } - pos_x = margin_x + pos_x * (1 - 2 * margin_x); - pos_y = margin_y + pos_y * (1 - 2 * margin_y); + pos_x = margin.x + pos.x * (1 - 2 * margin.x); + pos_y = margin.y + pos.y * (1 - 2 * margin.y); return pos; } @@ -128,10 +128,10 @@ float XonoticColorpicker_mouseDrag(entity me, vector coords) vector margin; margin = me.imagemargin; - if(coords_x >= margin_x) - if(coords_y >= margin_y) - if(coords_x <= 1 - margin_x) - if(coords_y <= 1 - margin_y) + if(coords.x >= margin.x) + if(coords.y >= margin.y) + if(coords.x <= 1 - margin.x) + if(coords.y <= 1 - margin.y) me.controlledTextbox.enterText(me.controlledTextbox, rgb_to_hexcolor(hslimage_color(coords, margin))); return 1; diff --git a/qcsrc/menu/xonotic/colorpicker_string.qc b/qcsrc/menu/xonotic/colorpicker_string.qc index 5d53135e9..f0e3e6da0 100644 --- a/qcsrc/menu/xonotic/colorpicker_string.qc +++ b/qcsrc/menu/xonotic/colorpicker_string.qc @@ -63,9 +63,9 @@ void XonoticColorPickerString_saveCvars(entity me) if(substring(me.cvarName, -1, 1) == "_") { vector v = hslimage_color(me.prevcoords, me.imagemargin); - cvar_set(strcat(me.cvarName, "red"), ftos(v_x)); - cvar_set(strcat(me.cvarName, "green"), ftos(v_y)); - cvar_set(strcat(me.cvarName, "blue"), ftos(v_z)); + cvar_set(strcat(me.cvarName, "red"), ftos(v.x)); + cvar_set(strcat(me.cvarName, "green"), ftos(v.y)); + cvar_set(strcat(me.cvarName, "blue"), ftos(v.z)); } else cvar_set(me.cvarName, sprintf("%v", hslimage_color(me.prevcoords, me.imagemargin))); @@ -83,10 +83,10 @@ float XonoticColorpickerString_mouseDrag(entity me, vector coords) return 0; vector margin; margin = me.imagemargin; - if(coords_x >= margin_x) - if(coords_y >= margin_y) - if(coords_x <= 1 - margin_x) - if(coords_y <= 1 - margin_y) + if(coords.x >= margin.x) + if(coords.y >= margin.y) + if(coords.x <= 1 - margin.x) + if(coords.y <= 1 - margin.y) { me.prevcoords = coords; me.saveCvars(me); diff --git a/qcsrc/menu/xonotic/credits.qc b/qcsrc/menu/xonotic/credits.qc index 0d998d7de..67848f914 100644 --- a/qcsrc/menu/xonotic/credits.qc +++ b/qcsrc/menu/xonotic/credits.qc @@ -53,9 +53,9 @@ void XonoticCreditsList_resizeNotify(entity me, vector relOrigin, vector relSize { SUPER(XonoticCreditsList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); - me.realFontSize_y = me.fontSize / (absSize_y * me.itemHeight); - me.realFontSize_x = me.fontSize / (absSize_x * (1 - me.controlWidth)); - me.realUpperMargin = 0.5 * (1 - me.realFontSize_y); + me.realFontSize_y = me.fontSize / (absSize.y * me.itemHeight); + me.realFontSize_x = me.fontSize / (absSize.x * (1 - me.controlWidth)); + me.realUpperMargin = 0.5 * (1 - me.realFontSize.y); } void XonoticCreditsList_drawListBoxItem(entity me, float i, vector absSize, float isSelected) { diff --git a/qcsrc/menu/xonotic/crosshairbutton.qc b/qcsrc/menu/xonotic/crosshairbutton.qc index 7fe3a600f..3b562cb77 100644 --- a/qcsrc/menu/xonotic/crosshairbutton.qc +++ b/qcsrc/menu/xonotic/crosshairbutton.qc @@ -111,9 +111,9 @@ void XonoticCrosshairButton_draw(entity me) } else // show the crosshair picker at full size { - sz = sz * (0.95 / sz_x); - if(sz_y > 0.95) - sz = sz * (0.95 / sz_y); + sz = sz * (0.95 / sz.x); + if(sz.y > 0.95) + sz = sz * (0.95 / sz.y); } draw_Picture('0.5 0.5 0' - 0.5 * sz, me.src3, sz, rgb, a); diff --git a/qcsrc/menu/xonotic/cvarlist.qc b/qcsrc/menu/xonotic/cvarlist.qc index 913a03eaf..421142aac 100644 --- a/qcsrc/menu/xonotic/cvarlist.qc +++ b/qcsrc/menu/xonotic/cvarlist.qc @@ -141,14 +141,14 @@ void XonoticCvarList_resizeNotify(entity me, vector relOrigin, vector relSize, v { SUPER(XonoticCvarList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); - me.realFontSize_y = me.fontSize / (absSize_y * me.itemHeight); - me.realFontSize_x = me.fontSize / (absSize_x * (1 - me.controlWidth)); - me.realUpperMargin = 0.5 * (1 - me.realFontSize_y); + me.realFontSize_y = me.fontSize / (absSize.y * me.itemHeight); + me.realFontSize_x = me.fontSize / (absSize.x * (1 - me.controlWidth)); + me.realUpperMargin = 0.5 * (1 - me.realFontSize.y); me.columnNameOrigin = 0; - me.columnValueSize = me.realFontSize_x * 20; - me.columnNameSize = 1 - me.columnValueSize - me.realFontSize_x; - me.columnValueOrigin = me.columnNameOrigin + me.columnNameSize + me.realFontSize_x; + me.columnValueSize = me.realFontSize.x * 20; + me.columnNameSize = 1 - me.columnValueSize - me.realFontSize.x; + me.columnValueOrigin = me.columnNameOrigin + me.columnNameSize + me.realFontSize.x; me.setSelected(me, me.selectedItem); } diff --git a/qcsrc/menu/xonotic/demolist.qc b/qcsrc/menu/xonotic/demolist.qc index 9f5909676..ff9f1241f 100644 --- a/qcsrc/menu/xonotic/demolist.qc +++ b/qcsrc/menu/xonotic/demolist.qc @@ -122,12 +122,12 @@ void XonoticDemoList_resizeNotify(entity me, vector relOrigin, vector relSize, v me.itemAbsSize = '0 0 0'; SUPER(XonoticDemoList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); - me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize_y * me.itemHeight)); - me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize_x * (1 - me.controlWidth))); - me.realUpperMargin = 0.5 * (1 - me.realFontSize_y); + me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize.y * me.itemHeight)); + me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize.x * (1 - me.controlWidth))); + me.realUpperMargin = 0.5 * (1 - me.realFontSize.y); - me.columnNameOrigin = me.realFontSize_x; - me.columnNameSize = 1 - 2 * me.realFontSize_x; + me.columnNameOrigin = me.realFontSize.x; + me.columnNameSize = 1 - 2 * me.realFontSize.x; } void XonoticDemoList_drawListBoxItem(entity me, float i, vector absSize, float isSelected) diff --git a/qcsrc/menu/xonotic/gametypelist.qc b/qcsrc/menu/xonotic/gametypelist.qc index e3df84467..6471a1a74 100644 --- a/qcsrc/menu/xonotic/gametypelist.qc +++ b/qcsrc/menu/xonotic/gametypelist.qc @@ -91,9 +91,9 @@ void XonoticGametypeList_drawListBoxItem(entity me, float i, vector absSize, flo vector save_fontscale = draw_fontscale; float f = draw_CondensedFontFactor(strcat(s1, " ", s2), FALSE, me.realFontSize, 1); - draw_fontscale_x *= f; + draw_fontscale.x *= f; vector fs = me.realFontSize; - fs_x *= f; + fs.x *= f; draw_Text(me.realUpperMargin * eY + me.columnNameOrigin * eX, s1, fs, '1 1 1', SKINALPHA_TEXT, 0); draw_Text(me.realUpperMargin * eY + (me.columnNameOrigin + 1.0 * (me.columnNameSize - draw_TextWidth(s2, 0, fs))) * eX, s2, fs, SKINCOLOR_TEXT, SKINALPHA_TEXT, 0); draw_fontscale = save_fontscale; @@ -103,13 +103,13 @@ void XonoticGametypeList_resizeNotify(entity me, vector relOrigin, vector relSiz me.itemAbsSize = '0 0 0'; SUPER(XonoticServerList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); - me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize_y * me.itemHeight)); - me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize_x * (1 - me.controlWidth))); - me.realUpperMargin = 0.5 * (1 - me.realFontSize_y); + me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize.y * me.itemHeight)); + me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize.x * (1 - me.controlWidth))); + me.realUpperMargin = 0.5 * (1 - me.realFontSize.y); me.columnIconOrigin = 0; - me.columnIconSize = me.itemAbsSize_y / me.itemAbsSize_x; - me.columnNameOrigin = me.columnIconOrigin + me.columnIconSize + (0.5 * me.realFontSize_x); - me.columnNameSize = 1 - me.columnIconSize - (1.5 * me.realFontSize_x); + me.columnIconSize = me.itemAbsSize.y / me.itemAbsSize.x; + me.columnNameOrigin = me.columnIconOrigin + me.columnIconSize + (0.5 * me.realFontSize.x); + me.columnNameSize = 1 - me.columnIconSize - (1.5 * me.realFontSize.x); } float XonoticGametypeList_keyDown(entity me, float scan, float ascii, float shift) diff --git a/qcsrc/menu/xonotic/keybinder.qc b/qcsrc/menu/xonotic/keybinder.qc index 6f3e56f72..caf61a9d9 100644 --- a/qcsrc/menu/xonotic/keybinder.qc +++ b/qcsrc/menu/xonotic/keybinder.qc @@ -106,14 +106,14 @@ void XonoticKeyBinder_resizeNotify(entity me, vector relOrigin, vector relSize, { SUPER(XonoticKeyBinder).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); - me.realFontSize_y = me.fontSize / (absSize_y * me.itemHeight); - me.realFontSize_x = me.fontSize / (absSize_x * (1 - me.controlWidth)); - me.realUpperMargin = 0.5 * (1 - me.realFontSize_y); + me.realFontSize_y = me.fontSize / (absSize.y * me.itemHeight); + me.realFontSize_x = me.fontSize / (absSize.x * (1 - me.controlWidth)); + me.realUpperMargin = 0.5 * (1 - me.realFontSize.y); me.columnFunctionOrigin = 0; - me.columnKeysSize = me.realFontSize_x * 12; - me.columnFunctionSize = 1 - me.columnKeysSize - 2 * me.realFontSize_x; - me.columnKeysOrigin = me.columnFunctionOrigin + me.columnFunctionSize + me.realFontSize_x; + me.columnKeysSize = me.realFontSize.x * 12; + me.columnFunctionSize = 1 - me.columnKeysSize - 2 * me.realFontSize.x; + me.columnKeysOrigin = me.columnFunctionOrigin + me.columnFunctionSize + me.realFontSize.x; if(me.userbindEditButton) me.userbindEditButton.disabled = (substring(Xonotic_KeyBinds_Descriptions[me.selectedItem], 0, 1) != "$"); @@ -326,7 +326,7 @@ void XonoticKeyBinder_drawListBoxItem(entity me, float i, vector absSize, float } theAlpha = SKINALPHA_KEYGRABBER_KEYS; theColor = SKINCOLOR_KEYGRABBER_KEYS; - extraMargin = me.realFontSize_x * 0.5; + extraMargin = me.realFontSize.x * 0.5; } if(substring(descr, 0, 1) == "$") diff --git a/qcsrc/menu/xonotic/languagelist.qc b/qcsrc/menu/xonotic/languagelist.qc index d34062d46..5345e6313 100644 --- a/qcsrc/menu/xonotic/languagelist.qc +++ b/qcsrc/menu/xonotic/languagelist.qc @@ -65,9 +65,9 @@ void XonoticLanguageList_drawListBoxItem(entity me, float i, vector absSize, flo vector save_fontscale = draw_fontscale; float f = draw_CondensedFontFactor(s, FALSE, me.realFontSize, 1); - draw_fontscale_x *= f; + draw_fontscale.x *= f; vector fs = me.realFontSize; - fs_x *= f; + fs.x *= f; draw_Text(me.realUpperMargin * eY + me.columnNameOrigin * eX, s, fs, SKINCOLOR_TEXT, SKINALPHA_TEXT, 0); draw_fontscale = save_fontscale; @@ -76,9 +76,9 @@ void XonoticLanguageList_drawListBoxItem(entity me, float i, vector absSize, flo { vector save_fontscale = draw_fontscale; float f = draw_CondensedFontFactor(p, FALSE, me.realFontSize, 1); - draw_fontscale_x *= f; + draw_fontscale.x *= f; vector fs = me.realFontSize; - fs_x *= f; + fs.x *= f; draw_Text(me.realUpperMargin * eY + (me.columnPercentageOrigin + (me.columnPercentageSize - draw_TextWidth(p, 0, fs))) * eX, p, fs, SKINCOLOR_TEXT, SKINALPHA_TEXT, 0); draw_fontscale = save_fontscale; } @@ -87,10 +87,10 @@ void XonoticLanguageList_drawListBoxItem(entity me, float i, vector absSize, flo void XonoticLanguageList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize) { SUPER(XonoticLanguageList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); - me.realFontSize_y = me.fontSize / (absSize_y * me.itemHeight); - me.realFontSize_x = me.fontSize / (absSize_x * (1 - me.controlWidth)); - me.realUpperMargin = 0.5 * (1 - me.realFontSize_y); - me.columnPercentageSize = me.realFontSize_x * 3; + me.realFontSize_y = me.fontSize / (absSize.y * me.itemHeight); + me.realFontSize_x = me.fontSize / (absSize.x * (1 - me.controlWidth)); + me.realUpperMargin = 0.5 * (1 - me.realFontSize.y); + me.columnPercentageSize = me.realFontSize.x * 3; me.columnPercentageOrigin = 1 - me.columnPercentageSize; me.columnNameOrigin = 0; me.columnNameSize = me.columnPercentageOrigin; diff --git a/qcsrc/menu/xonotic/listbox.qc b/qcsrc/menu/xonotic/listbox.qc index 23fa58d83..0ab574fa2 100644 --- a/qcsrc/menu/xonotic/listbox.qc +++ b/qcsrc/menu/xonotic/listbox.qc @@ -31,7 +31,7 @@ void XonoticListBox_configureXonoticListBox(entity me) } void XonoticListBox_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize) { - me.itemHeight = me.rowsPerItem * me.fontSize / absSize_y; + me.itemHeight = me.rowsPerItem * me.fontSize / absSize.y; SUPER(XonoticListBox).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); } #endif diff --git a/qcsrc/menu/xonotic/maplist.qc b/qcsrc/menu/xonotic/maplist.qc index e05c7644f..60720bd54 100644 --- a/qcsrc/menu/xonotic/maplist.qc +++ b/qcsrc/menu/xonotic/maplist.qc @@ -123,35 +123,35 @@ void XonoticMapList_resizeNotify(entity me, vector relOrigin, vector relSize, ve me.itemAbsSize = '0 0 0'; SUPER(XonoticMapList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); - me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize_y * me.itemHeight)); - me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize_x * (1 - me.controlWidth))); - me.realUpperMargin1 = 0.5 * (1 - 2.5 * me.realFontSize_y); - me.realUpperMargin2 = me.realUpperMargin1 + 1.5 * me.realFontSize_y; + me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize.y * me.itemHeight)); + me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize.x * (1 - me.controlWidth))); + me.realUpperMargin1 = 0.5 * (1 - 2.5 * me.realFontSize.y); + me.realUpperMargin2 = me.realUpperMargin1 + 1.5 * me.realFontSize.y; me.columnPreviewOrigin = 0; - me.columnPreviewSize = me.itemAbsSize_y / me.itemAbsSize_x * 4 / 3; - me.columnNameOrigin = me.columnPreviewOrigin + me.columnPreviewSize + me.realFontSize_x; - me.columnNameSize = 1 - me.columnPreviewSize - 2 * me.realFontSize_x; + me.columnPreviewSize = me.itemAbsSize.y / me.itemAbsSize.x * 4 / 3; + me.columnNameOrigin = me.columnPreviewOrigin + me.columnPreviewSize + me.realFontSize.x; + me.columnNameSize = 1 - me.columnPreviewSize - 2 * me.realFontSize.x; - me.checkMarkSize = (eX * (me.itemAbsSize_y / me.itemAbsSize_x) + eY) * 0.5; + me.checkMarkSize = (eX * (me.itemAbsSize.y / me.itemAbsSize.x) + eY) * 0.5; me.checkMarkOrigin = eY + eX * (me.columnPreviewOrigin + me.columnPreviewSize) - me.checkMarkSize; } void XonoticMapList_clickListBoxItem(entity me, float i, vector where) { - if(where_x <= me.columnPreviewOrigin + me.columnPreviewSize) - if(where_x >= 0) + if(where.x <= me.columnPreviewOrigin + me.columnPreviewSize) + if(where.x >= 0) me.g_maplistCacheToggle(me, i); } void XonoticMapList_doubleClickListBoxItem(entity me, float i, vector where) { - if(where_x >= me.columnNameOrigin) - if(where_x <= 1) + if(where.x >= me.columnNameOrigin) + if(where.x <= 1) { // pop up map info screen main.mapInfoDialog.loadMapInfo(main.mapInfoDialog, i, me); - DialogOpenButton_Click_withCoords(NULL, main.mapInfoDialog, me.origin + eX * (me.columnNameOrigin * me.size_x) + eY * ((me.itemHeight * i - me.scrollPos) * me.size_y), eY * me.itemAbsSize_y + eX * (me.itemAbsSize_x * me.columnNameSize)); + DialogOpenButton_Click_withCoords(NULL, main.mapInfoDialog, me.origin + eX * (me.columnNameOrigin * me.size.x) + eY * ((me.itemHeight * i - me.scrollPos) * me.size.y), eY * me.itemAbsSize.y + eX * (me.itemAbsSize.x * me.columnNameSize)); } } @@ -297,7 +297,7 @@ float XonoticMapList_keyDown(entity me, float scan, float ascii, float shift) { // pop up map info screen main.mapInfoDialog.loadMapInfo(main.mapInfoDialog, me.selectedItem, me); - DialogOpenButton_Click_withCoords(NULL, main.mapInfoDialog, me.origin + eX * (me.columnNameOrigin * me.size_x) + eY * ((me.itemHeight * me.selectedItem - me.scrollPos) * me.size_y), eY * me.itemAbsSize_y + eX * (me.itemAbsSize_x * me.columnNameSize)); + DialogOpenButton_Click_withCoords(NULL, main.mapInfoDialog, me.origin + eX * (me.columnNameOrigin * me.size.x) + eY * ((me.itemHeight * me.selectedItem - me.scrollPos) * me.size.y), eY * me.itemAbsSize.y + eX * (me.itemAbsSize.x * me.columnNameSize)); } else if(scan == K_MOUSE3 || scan == K_INS || scan == K_KP_INS) { diff --git a/qcsrc/menu/xonotic/playerlist.qc b/qcsrc/menu/xonotic/playerlist.qc index c60b34e38..1facda299 100644 --- a/qcsrc/menu/xonotic/playerlist.qc +++ b/qcsrc/menu/xonotic/playerlist.qc @@ -79,16 +79,16 @@ void XonoticPlayerList_resizeNotify(entity me, vector relOrigin, vector relSize, me.itemAbsSize = '0 0 0'; SUPER(XonoticPlayerList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); - me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize_y * me.itemHeight)); - me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize_x * (1 - me.controlWidth))); - me.realUpperMargin = 0.5 * (1 - me.realFontSize_y); + me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize.y * me.itemHeight)); + me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize.x * (1 - me.controlWidth))); + me.realUpperMargin = 0.5 * (1 - me.realFontSize.y); // this list does 1 char left and right margin - me.columnScoreSize = 5 * me.realFontSize_x; - me.columnNameSize = 1 - 3 * me.realFontSize_x - me.columnScoreSize; + me.columnScoreSize = 5 * me.realFontSize.x; + me.columnNameSize = 1 - 3 * me.realFontSize.x - me.columnScoreSize; - me.columnNameOrigin = me.realFontSize_x; - me.columnScoreOrigin = me.columnNameOrigin + me.columnNameSize + me.realFontSize_x; + me.columnNameOrigin = me.realFontSize.x; + me.columnScoreOrigin = me.columnNameOrigin + me.columnNameSize + me.realFontSize.x; } void XonoticPlayerList_drawListBoxItem(entity me, float i, vector absSize, float isSelected) diff --git a/qcsrc/menu/xonotic/playermodel.qc b/qcsrc/menu/xonotic/playermodel.qc index 0a0d6f940..72edf6a45 100644 --- a/qcsrc/menu/xonotic/playermodel.qc +++ b/qcsrc/menu/xonotic/playermodel.qc @@ -201,19 +201,19 @@ void XonoticPlayerModelSelector_draw(entity me) draw_endBoldFont(); - o = '0.5 1 0' - eY * me.realFontSize_y * ((n = tokenizebyseparator(me.currentModelDescription, "\n")) + 0.5); + o = '0.5 1 0' - eY * me.realFontSize.y * ((n = tokenizebyseparator(me.currentModelDescription, "\n")) + 0.5); for(i = 0; i < n; ++i) { draw_CenterText(o, argv(i), me.realFontSize, SKINCOLOR_TEXT, 1, FALSE); - o += eY * me.realFontSize_y; + o += eY * me.realFontSize.y; } } void XonoticPlayerModelSelector_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize) { SUPER(XonoticPlayerModelSelector).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); - me.realFontSize_y = me.fontSize / absSize_y; - me.realFontSize_x = me.fontSize / absSize_x; + me.realFontSize_y = me.fontSize / absSize.y; + me.realFontSize_x = me.fontSize / absSize.x; } void XonoticPlayerModelSelector_showNotify(entity me) diff --git a/qcsrc/menu/xonotic/playlist.qc b/qcsrc/menu/xonotic/playlist.qc index e918adacd..18b4fc3fa 100644 --- a/qcsrc/menu/xonotic/playlist.qc +++ b/qcsrc/menu/xonotic/playlist.qc @@ -58,15 +58,15 @@ void XonoticPlayList_resizeNotify(entity me, vector relOrigin, vector relSize, v me.itemAbsSize = '0 0 0'; SUPER(XonoticPlayList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); - me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize_y * me.itemHeight)); - me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize_x * (1 - me.controlWidth))); - me.realUpperMargin = 0.5 * (1 - me.realFontSize_y); + me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize.y * me.itemHeight)); + me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize.x * (1 - me.controlWidth))); + me.realUpperMargin = 0.5 * (1 - me.realFontSize.y); me.columnNumberOrigin = 0; - me.columnNumberSize = 3 * me.realFontSize_x; + me.columnNumberSize = 3 * me.realFontSize.x; - me.columnNameOrigin = me.columnNumberSize + me.realFontSize_x; - me.columnNameSize = 1 - me.columnNameOrigin - me.realFontSize_x; + me.columnNameOrigin = me.columnNumberSize + me.realFontSize.x; + me.columnNameSize = 1 - me.columnNameOrigin - me.realFontSize.x; } void XonoticPlayList_addToPlayList(entity me, string track) diff --git a/qcsrc/menu/xonotic/screenshotimage.qc b/qcsrc/menu/xonotic/screenshotimage.qc index 469f177fc..9b69e46c3 100644 --- a/qcsrc/menu/xonotic/screenshotimage.qc +++ b/qcsrc/menu/xonotic/screenshotimage.qc @@ -89,7 +89,7 @@ void XonoticScreenshotImage_draw(entity me) void XonoticScreenshotImage_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize) { SUPER(XonoticScreenshotImage).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); - me.realFontSize_y = me.fontSize / absSize_y; - me.realFontSize_x = me.fontSize / absSize_x; + me.realFontSize_y = me.fontSize / absSize.y; + me.realFontSize_x = me.fontSize / absSize.x; } #endif diff --git a/qcsrc/menu/xonotic/screenshotlist.qc b/qcsrc/menu/xonotic/screenshotlist.qc index c8f3becfa..5801d3be7 100644 --- a/qcsrc/menu/xonotic/screenshotlist.qc +++ b/qcsrc/menu/xonotic/screenshotlist.qc @@ -138,12 +138,12 @@ void XonoticScreenshotList_resizeNotify(entity me, vector relOrigin, vector relS me.itemAbsSize = '0 0 0'; SUPER(XonoticScreenshotList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); - me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize_y * me.itemHeight)); - me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize_x * (1 - me.controlWidth))); - me.realUpperMargin = 0.5 * (1 - me.realFontSize_y); + me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize.y * me.itemHeight)); + me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize.x * (1 - me.controlWidth))); + me.realUpperMargin = 0.5 * (1 - me.realFontSize.y); - me.columnNameOrigin = me.realFontSize_x; - me.columnNameSize = 1 - 2 * me.realFontSize_x; + me.columnNameOrigin = me.realFontSize.x; + me.columnNameSize = 1 - 2 * me.realFontSize.x; } void XonoticScreenshotList_setSelected(entity me, float i) @@ -260,7 +260,7 @@ void XonoticScreenshotList_startScreenshot(entity me) { me.screenshotViewerDialog.loadScreenshot(me.screenshotViewerDialog, strcat("/screenshots/", strdecolorize(me.screenshotName(me,me.selectedItem)))); // pop up screenshot - DialogOpenButton_Click_withCoords(NULL, me.screenshotViewerDialog, me.origin + eX * (me.columnNameOrigin * me.size_x) + eY * ((me.itemHeight * me.selectedItem - me.scrollPos) * me.size_y), eY * me.itemAbsSize_y + eX * (me.itemAbsSize_x * me.columnNameSize)); + DialogOpenButton_Click_withCoords(NULL, me.screenshotViewerDialog, me.origin + eX * (me.columnNameOrigin * me.size.x) + eY * ((me.itemHeight * me.selectedItem - me.scrollPos) * me.size.y), eY * me.itemAbsSize.y + eX * (me.itemAbsSize.x * me.columnNameSize)); } void XonoticScreenshotList_previewScreenshot(entity me) diff --git a/qcsrc/menu/xonotic/serverlist.qc b/qcsrc/menu/xonotic/serverlist.qc index 50ce594e8..3af6ff6d4 100644 --- a/qcsrc/menu/xonotic/serverlist.qc +++ b/qcsrc/menu/xonotic/serverlist.qc @@ -887,8 +887,8 @@ void XonoticServerList_positionSortButton(entity me, entity btn, float theOrigin originInDialogSpace = boxToGlobal(originInLBSpace, me.Container_origin, me.Container_size); sizeInDialogSpace = boxToGlobalSize(sizeInLBSpace, me.Container_size); - btn.Container_origin_x = originInDialogSpace_x + sizeInDialogSpace_x * theOrigin; - btn.Container_size_x = sizeInDialogSpace_x * theSize; + btn.Container_origin_x = originInDialogSpace.x + sizeInDialogSpace.x * theOrigin; + btn.Container_size_x = sizeInDialogSpace.x * theSize; btn.setText(btn, theTitle); btn.onClick = theFunc; btn.onClickEntity = me; @@ -898,22 +898,22 @@ void XonoticServerList_resizeNotify(entity me, vector relOrigin, vector relSize, { SUPER(XonoticServerList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); - me.realFontSize_y = me.fontSize / (absSize_y * me.itemHeight); - me.realFontSize_x = me.fontSize / (absSize_x * (1 - me.controlWidth)); - me.realUpperMargin = 0.5 * (1 - me.realFontSize_y); + me.realFontSize_y = me.fontSize / (absSize.y * me.itemHeight); + me.realFontSize_x = me.fontSize / (absSize.x * (1 - me.controlWidth)); + me.realUpperMargin = 0.5 * (1 - me.realFontSize.y); me.columnIconsOrigin = 0; - me.columnIconsSize = me.realFontSize_x * 4 * me.iconsSizeFactor; - me.columnPingSize = me.realFontSize_x * 3; - me.columnMapSize = me.realFontSize_x * 10; - me.columnTypeSize = me.realFontSize_x * 4; - me.columnPlayersSize = me.realFontSize_x * 5; - me.columnNameSize = 1 - me.columnPlayersSize - me.columnMapSize - me.columnPingSize - me.columnIconsSize - me.columnTypeSize - 5 * me.realFontSize_x; - me.columnPingOrigin = me.columnIconsOrigin + me.columnIconsSize + me.realFontSize_x; - me.columnNameOrigin = me.columnPingOrigin + me.columnPingSize + me.realFontSize_x; - me.columnMapOrigin = me.columnNameOrigin + me.columnNameSize + me.realFontSize_x; - me.columnTypeOrigin = me.columnMapOrigin + me.columnMapSize + me.realFontSize_x; - me.columnPlayersOrigin = me.columnTypeOrigin + me.columnTypeSize + me.realFontSize_x; + me.columnIconsSize = me.realFontSize.x * 4 * me.iconsSizeFactor; + me.columnPingSize = me.realFontSize.x * 3; + me.columnMapSize = me.realFontSize.x * 10; + me.columnTypeSize = me.realFontSize.x * 4; + me.columnPlayersSize = me.realFontSize.x * 5; + me.columnNameSize = 1 - me.columnPlayersSize - me.columnMapSize - me.columnPingSize - me.columnIconsSize - me.columnTypeSize - 5 * me.realFontSize.x; + me.columnPingOrigin = me.columnIconsOrigin + me.columnIconsSize + me.realFontSize.x; + me.columnNameOrigin = me.columnPingOrigin + me.columnPingSize + me.realFontSize.x; + me.columnMapOrigin = me.columnNameOrigin + me.columnNameSize + me.realFontSize.x; + me.columnTypeOrigin = me.columnMapOrigin + me.columnMapSize + me.realFontSize.x; + me.columnPlayersOrigin = me.columnTypeOrigin + me.columnTypeSize + me.realFontSize.x; me.positionSortButton(me, me.sortButton1, me.columnPingOrigin, me.columnPingSize, _("Ping"), ServerList_PingSort_Click); me.positionSortButton(me, me.sortButton2, me.columnNameOrigin, me.columnNameSize, _("Host name"), ServerList_NameSort_Click); @@ -1145,18 +1145,18 @@ void XonoticServerList_drawListBoxItem(entity me, float i, vector absSize, float // RENDER ICONS // -------------- vector iconSize = '0 0 0'; - iconSize_y = me.realFontSize_y * me.iconsSizeFactor; - iconSize_x = me.realFontSize_x * me.iconsSizeFactor; + iconSize_y = me.realFontSize.y * me.iconsSizeFactor; + iconSize_x = me.realFontSize.x * me.iconsSizeFactor; vector iconPos = '0 0 0'; - iconPos_x = (me.columnIconsSize - 3 * iconSize_x) * 0.5; - iconPos_y = (1 - iconSize_y) * 0.5; + iconPos_x = (me.columnIconsSize - 3 * iconSize.x) * 0.5; + iconPos_y = (1 - iconSize.y) * 0.5; string n; if (!(me.seenIPv4 && me.seenIPv6)) { - iconPos_x += iconSize_x * 0.5; + iconPos.x += iconSize.x * 0.5; } else if(me.seenIPv4 && me.seenIPv6) { @@ -1167,7 +1167,7 @@ void XonoticServerList_drawListBoxItem(entity me, float i, vector absSize, float draw_PreloadPictureWithFlags(n = strcat(SKINGFX_SERVERLIST_ICON, "_ipv4"), 0); // PRECACHE_PIC_MIPMAP if(n) draw_Picture(iconPos, n, iconSize, '1 1 1', 1); - iconPos_x += iconSize_x; + iconPos.x += iconSize.x; } if(q > 0) @@ -1175,7 +1175,7 @@ void XonoticServerList_drawListBoxItem(entity me, float i, vector absSize, float draw_PreloadPictureWithFlags(n = strcat(SKINGFX_SERVERLIST_ICON, "_aeslevel", ftos(q)), 0); // PRECACHE_PIC_MIPMAP draw_Picture(iconPos, n, iconSize, '1 1 1', 1); } - iconPos_x += iconSize_x; + iconPos.x += iconSize.x; if(modname == "Xonotic") { @@ -1195,14 +1195,14 @@ void XonoticServerList_drawListBoxItem(entity me, float i, vector absSize, float else draw_Picture(iconPos, n, iconSize, '1 1 1', SKINALPHA_SERVERLIST_ICON_NONPURE); } - iconPos_x += iconSize_x; + iconPos.x += iconSize.x; if(sflags >= 0 && (sflags & SERVERFLAG_PLAYERSTATS)) { draw_PreloadPictureWithFlags(n = strcat(SKINGFX_SERVERLIST_ICON, "_stats1"), 0); // PRECACHE_PIC_MIPMAP draw_Picture(iconPos, n, iconSize, '1 1 1', 1); } - iconPos_x += iconSize_x; + iconPos.x += iconSize.x; // -------------- // RENDER TEXT diff --git a/qcsrc/menu/xonotic/skinlist.qc b/qcsrc/menu/xonotic/skinlist.qc index 6d11fe9c6..8a75ee206 100644 --- a/qcsrc/menu/xonotic/skinlist.qc +++ b/qcsrc/menu/xonotic/skinlist.qc @@ -138,15 +138,15 @@ void XonoticSkinList_resizeNotify(entity me, vector relOrigin, vector relSize, v me.itemAbsSize = '0 0 0'; SUPER(XonoticSkinList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); - me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize_y * me.itemHeight)); - me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize_x * (1 - me.controlWidth))); - me.realUpperMargin1 = 0.5 * (1 - 2.5 * me.realFontSize_y); - me.realUpperMargin2 = me.realUpperMargin1 + 1.5 * me.realFontSize_y; + me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize.y * me.itemHeight)); + me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize.x * (1 - me.controlWidth))); + me.realUpperMargin1 = 0.5 * (1 - 2.5 * me.realFontSize.y); + me.realUpperMargin2 = me.realUpperMargin1 + 1.5 * me.realFontSize.y; me.columnPreviewOrigin = 0; - me.columnPreviewSize = me.itemAbsSize_y / me.itemAbsSize_x * 4 / 3; - me.columnNameOrigin = me.columnPreviewOrigin + me.columnPreviewSize + me.realFontSize_x; - me.columnNameSize = 1 - me.columnPreviewSize - 2 * me.realFontSize_x; + me.columnPreviewSize = me.itemAbsSize.y / me.itemAbsSize.x * 4 / 3; + me.columnNameOrigin = me.columnPreviewOrigin + me.columnPreviewSize + me.realFontSize.x; + me.columnNameSize = 1 - me.columnPreviewSize - 2 * me.realFontSize.x; } void XonoticSkinList_drawListBoxItem(entity me, float i, vector absSize, float isSelected) diff --git a/qcsrc/menu/xonotic/slider_resolution.qc b/qcsrc/menu/xonotic/slider_resolution.qc index 66f48f9e5..926de7956 100644 --- a/qcsrc/menu/xonotic/slider_resolution.qc +++ b/qcsrc/menu/xonotic/slider_resolution.qc @@ -40,19 +40,19 @@ float updateConwidths(float width, float height, float pixelheight) // calculate the base resolution c_z = 0; c_x = 800; - c_y = c_x * r_y * r_z / r_x; - if(c_y < 600) + c_y = c.x * r.y * r.z / r.x; + if(c.y < 600) { c_y = 600; - c_x = c_y * r_x / (r_y * r_z); + c_x = c.y * r.x / (r.y * r.z); } - f = min(r_x / c_x, r_y / c_y); + f = min(r.x / c.x, r.y / c.y); if(f < 1) c = c * f; // ensures that c_x <= r_x and c_y <= r_y - minfactor = min(1, 640 / c_x); // can be > 1 only if c_x is <640 - maxfactor = max(1, r_x / c_x, r_y / c_y); // can be < 1 only if r_x < c_x and r_y < c_y + minfactor = min(1, 640 / c.x); // can be > 1 only if c_x is <640 + maxfactor = max(1, r.x / c.x, r.y / c.y); // can be < 1 only if r_x < c_x and r_y < c_y dprint("min factor: ", ftos(minfactor), "\n"); dprint("max factor: ", ftos(maxfactor), "\n"); @@ -64,16 +64,16 @@ float updateConwidths(float width, float height, float pixelheight) f = 1; c = c * f; // fteqcc fail - c_x = rint(c_x); - c_y = rint(c_y); + c_x = rint(c.x); + c_y = rint(c.y); // Please reload resolutions list and such stuff. XonoticResolutionSlider_DataHasChanged = TRUE; - if (c_x != cvar("vid_conwidth") || c_y != cvar("vid_conheight")) + if (c.x != cvar("vid_conwidth") || c.y != cvar("vid_conheight")) { - cvar_set("vid_conwidth", ftos(c_x)); - cvar_set("vid_conheight", ftos(c_y)); + cvar_set("vid_conwidth", ftos(c.x)); + cvar_set("vid_conheight", ftos(c.y)); return 1; } return 0; @@ -146,16 +146,16 @@ void XonoticResolutionSlider_loadResolutions(entity me, float fullscreen) r = getresolution(i); if(r_x == 0 && r_y == 0) break; - if(r_x < 640 || r_y < 480) + if(r.x < 640 || r.y < 480) continue; - if(r_x > 2 * r_y) // likely dualscreen resolution, skip this one + if(r.x > 2 * r.y) // likely dualscreen resolution, skip this one if(autocvar_menu_vid_allowdualscreenresolution <= 0) continue; - me.addResolution(me, r_x, r_y, r_z); + me.addResolution(me, r.x, r.y, r.z); } r = getresolution(-1); - if(r_x != 0 || r_y != 0) - me.addResolution(me, r_x, r_y, r_z); + if(r.x != 0 || r.y != 0) + me.addResolution(me, r.x, r.y, r.z); dprint("Added system resolutions.\n"); } @@ -197,7 +197,7 @@ void XonoticResolutionSlider_saveCvars(entity me) cvar_set("_menu_vid_height", argv(1)); cvar_set("_menu_vid_pixelheight", argv(2)); vector r = getresolution(-1); - if (stof(argv(0)) == r_x && stof(argv(1)) == r_y && fabs(stof(argv(2)) - r_z) < 0.01) + if (stof(argv(0)) == r.x && stof(argv(1)) == r.y && fabs(stof(argv(2)) - r.z) < 0.01) cvar_set("_menu_vid_desktopfullscreen", "1"); else cvar_set("_menu_vid_desktopfullscreen", "0"); diff --git a/qcsrc/menu/xonotic/soundlist.qc b/qcsrc/menu/xonotic/soundlist.qc index 7d1515062..21fd2e663 100644 --- a/qcsrc/menu/xonotic/soundlist.qc +++ b/qcsrc/menu/xonotic/soundlist.qc @@ -90,15 +90,15 @@ void XonoticSoundList_resizeNotify(entity me, vector relOrigin, vector relSize, me.itemAbsSize = '0 0 0'; SUPER(XonoticSoundList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); - me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize_y * me.itemHeight)); - me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize_x * (1 - me.controlWidth))); - me.realUpperMargin = 0.5 * (1 - me.realFontSize_y); + me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize.y * me.itemHeight)); + me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize.x * (1 - me.controlWidth))); + me.realUpperMargin = 0.5 * (1 - me.realFontSize.y); me.columnNumberOrigin = 0; - me.columnNumberSize = me.realFontSize_x * 3; + me.columnNumberSize = me.realFontSize.x * 3; me.columnNameOrigin = me.columnNumberSize; - me.columnNameSize = 1 - me.columnNameOrigin - me.realFontSize_x; + me.columnNameSize = 1 - me.columnNameOrigin - me.realFontSize.x; } void XonoticSoundList_drawListBoxItem(entity me, float i, vector absSize, float isSelected) diff --git a/qcsrc/menu/xonotic/statslist.qc b/qcsrc/menu/xonotic/statslist.qc index c7b744a66..d905ac3c7 100644 --- a/qcsrc/menu/xonotic/statslist.qc +++ b/qcsrc/menu/xonotic/statslist.qc @@ -292,18 +292,18 @@ void XonoticStatsList_resizeNotify(entity me, vector relOrigin, vector relSize, me.itemAbsSize = '0 0 0'; SUPER(XonoticStatsList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); - me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize_y * me.itemHeight)); - me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize_x * (1 - me.controlWidth))); - me.realUpperMargin = 0.5 * (1 - me.realFontSize_y); + me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize.y * me.itemHeight)); + me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize.x * (1 - me.controlWidth))); + me.realUpperMargin = 0.5 * (1 - me.realFontSize.y); #if 0 - me.columnNameOrigin = me.realFontSize_x; - me.columnNameSize = 0.5 - me.realFontSize_x; // end halfway at maximum length + me.columnNameOrigin = me.realFontSize.x; + me.columnNameSize = 0.5 - me.realFontSize.x; // end halfway at maximum length me.columnDataOrigin = me.columnNameOrigin + me.columnNameSize; - me.columnDataSize = 1 - me.columnNameSize - me.realFontSize_x; // fill the rest of the control + me.columnDataSize = 1 - me.columnNameSize - me.realFontSize.x; // fill the rest of the control #else - me.columnNameOrigin = me.realFontSize_x; - me.columnNameSize = 1 - 2 * me.realFontSize_x; + me.columnNameOrigin = me.realFontSize.x; + me.columnNameSize = 1 - 2 * me.realFontSize.x; #endif } diff --git a/qcsrc/menu/xonotic/util.qc b/qcsrc/menu/xonotic/util.qc index cf4139fde..e5919fb7a 100644 --- a/qcsrc/menu/xonotic/util.qc +++ b/qcsrc/menu/xonotic/util.qc @@ -494,11 +494,11 @@ float preMenuInit() { draw_reset_cropped(); - sz = eX * 0.025 + eY * 0.025 * (draw_scale_x / draw_scale_y); - draw_CenterText('0.5 0.5 0' - 1.25 * sz_y * eY, _("Autogenerating mapinfo for newly added maps..."), sz, '1 1 1', 1, 0); + sz = eX * 0.025 + eY * 0.025 * (draw_scale.x / draw_scale.y); + draw_CenterText('0.5 0.5 0' - 1.25 * sz.y * eY, _("Autogenerating mapinfo for newly added maps..."), sz, '1 1 1', 1, 0); - boxA = '0.05 0.5 0' + 0.25 * sz_y * eY; - boxB = '0.95 0.5 0' + 1.25 * sz_y * eY; + boxA = '0.05 0.5 0' + 0.25 * sz.y * eY; + boxB = '0.95 0.5 0' + 1.25 * sz.y * eY; draw_Fill(boxA, boxB - boxA, '1 1 1', 1); boxA += sz * 0.1; @@ -536,8 +536,8 @@ void preMenuDraw() if(_Nex_ExtResponseSystem_UpdateTo != "") { // TODO rather turn this into a dialog - fs = ((1/draw_scale_x) * eX + (1/draw_scale_y) * eY) * 12; - line = eY * fs_y; + fs = ((1/draw_scale.x) * eX + (1/draw_scale.y) * eY) * 12; + line = eY * fs.y; string l1, l2; l1 = sprintf(_("Update to %s now!"), _Nex_ExtResponseSystem_UpdateTo); l2 = "http://www.xonotic.org/"; @@ -548,11 +548,11 @@ void preMenuDraw() draw_TextWidth(l1, 0, fs), draw_TextWidth(l2, 0, fs) ); - sz_y = 3 * fs_y; + sz_y = 3 * fs.y; draw_alpha = bound(0, sin(time * 0.112 - 0.3) * 10, 1); - mid = eX * (0.5 + 0.5 * (1 - sz_x) * cos(time * 0.071)) - + eY * (0.5 + 0.5 * (1 - sz_y) * sin(time * 0.071)); + mid = eX * (0.5 + 0.5 * (1 - sz.x) * cos(time * 0.071)) + + eY * (0.5 + 0.5 * (1 - sz.y) * sin(time * 0.071)); draw_Fill(mid - 0.5 * sz, sz, '1 1 0', 1); draw_CenterText(mid - 1 * line, l1, fs, '1 0 0', 1, 0); diff --git a/qcsrc/menu/xonotic/weaponslist.qc b/qcsrc/menu/xonotic/weaponslist.qc index 8a8e2205d..0a6f38f18 100644 --- a/qcsrc/menu/xonotic/weaponslist.qc +++ b/qcsrc/menu/xonotic/weaponslist.qc @@ -59,9 +59,9 @@ void XonoticWeaponsList_resizeNotify(entity me, vector relOrigin, vector relSize { SUPER(XonoticWeaponsList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); - me.realFontSize_y = me.fontSize / (absSize_y * me.itemHeight); - me.realFontSize_x = me.fontSize / (absSize_x * (1 - me.controlWidth)); - me.realUpperMargin = 0.5 * (1 - me.realFontSize_y); + me.realFontSize_y = me.fontSize / (absSize.y * me.itemHeight); + me.realFontSize_x = me.fontSize / (absSize.x * (1 - me.controlWidth)); + me.realUpperMargin = 0.5 * (1 - me.realFontSize.y); } float XonoticWeaponsList_mouseDrag(entity me, vector pos) { @@ -103,9 +103,9 @@ void XonoticWeaponsList_drawListBoxItem(entity me, float i, vector absSize, floa vector save_fontscale = draw_fontscale; float f = draw_CondensedFontFactor(msg, FALSE, me.realFontSize, 1); - draw_fontscale_x *= f; + draw_fontscale.x *= f; vector fs = me.realFontSize; - fs_x *= f; + fs.x *= f; draw_Text(me.realUpperMargin * eY, msg, fs, SKINCOLOR_TEXT, SKINALPHA_TEXT, 0); draw_fontscale = save_fontscale; } diff --git a/qcsrc/server/bot/aim.qc b/qcsrc/server/bot/aim.qc index 0ae331247..f4974157c 100644 --- a/qcsrc/server/bot/aim.qc +++ b/qcsrc/server/bot/aim.qc @@ -62,7 +62,7 @@ float findtrajectorywithleading(vector org, vector m1, vector m2, entity targ, f return TRUE; } - dir_z = dir_z + 0.1; // aim up a little more + dir_z = dir.z + 0.1; // aim up a little more c = c + 1; } targ.solid = savesolid; @@ -175,7 +175,7 @@ float bot_aimdir(vector v, float maxfiredeviation) //dprint("aim ", self.netname, ": old:", vtos(self.v_angle)); // make sure v_angle is sane first - self.v_angle_y = self.v_angle_y - floor(self.v_angle_y / 360) * 360; + self.v_angle_y = self.v_angle.y - floor(self.v_angle.y / 360) * 360; self.v_angle_z = 0; // get the desired angles to aim at @@ -189,10 +189,10 @@ float bot_aimdir(vector v, float maxfiredeviation) } desiredang = vectoangles(v) + self.bot_badaimoffset; //dprint(" desired:", vtos(desiredang)); - if (desiredang_x >= 180) - desiredang_x = desiredang_x - 360; - desiredang_x = bound(-90, 0 - desiredang_x, 90); - desiredang_z = self.v_angle_z; + if (desiredang.x >= 180) + desiredang_x = desiredang.x - 360; + desiredang_x = bound(-90, 0 - desiredang.x, 90); + desiredang_z = self.v_angle.z; //dprint(" / ", vtos(desiredang)); //// pain throws off aim @@ -205,9 +205,9 @@ float bot_aimdir(vector v, float maxfiredeviation) // calculate turn angles diffang = (desiredang - self.bot_olddesiredang); // wrap yaw turn - diffang_y = diffang_y - floor(diffang_y / 360) * 360; - if (diffang_y >= 180) - diffang_y = diffang_y - 360; + diffang_y = diffang.y - floor(diffang.y / 360) * 360; + if (diffang.y >= 180) + diffang_y = diffang.y - 360; self.bot_olddesiredang = desiredang; //dprint(" diff:", vtos(diffang)); @@ -239,9 +239,9 @@ float bot_aimdir(vector v, float maxfiredeviation) // calculate turn angles diffang = desiredang - self.bot_mouseaim; // wrap yaw turn - diffang_y = diffang_y - floor(diffang_y / 360) * 360; - if (diffang_y >= 180) - diffang_y = diffang_y - 360; + diffang_y = diffang.y - floor(diffang.y / 360) * 360; + if (diffang.y >= 180) + diffang_y = diffang.y - 360; //dprint(" diff:", vtos(diffang)); if (time >= self.bot_aimthinktime) @@ -254,17 +254,17 @@ float bot_aimdir(vector v, float maxfiredeviation) diffang = self.bot_mouseaim - desiredang; // wrap yaw turn - diffang_y = diffang_y - floor(diffang_y / 360) * 360; - if (diffang_y >= 180) - diffang_y = diffang_y - 360; + diffang_y = diffang.y - floor(diffang.y / 360) * 360; + if (diffang.y >= 180) + diffang_y = diffang.y - 360; desiredang = desiredang + diffang * bound(0,autocvar_bot_ai_aimskill_think,1); // calculate turn angles diffang = desiredang - self.v_angle; // wrap yaw turn - diffang_y = diffang_y - floor(diffang_y / 360) * 360; - if (diffang_y >= 180) - diffang_y = diffang_y - 360; + diffang_y = diffang.y - floor(diffang.y / 360) * 360; + if (diffang.y >= 180) + diffang_y = diffang.y - 360; //dprint(" diff:", vtos(diffang)); // jitter tracking @@ -282,7 +282,7 @@ float bot_aimdir(vector v, float maxfiredeviation) //self.v_angle = self.v_angle + diffang * bound(0, r * frametime * (skill * 0.5 + 2), 1); //self.v_angle = self.v_angle + diffang * (1/ blendrate); self.v_angle_z = 0; - self.v_angle_y = self.v_angle_y - floor(self.v_angle_y / 360) * 360; + self.v_angle_y = self.v_angle.y - floor(self.v_angle.y / 360) * 360; //dprint(" turn:", vtos(self.v_angle)); makevectors(self.v_angle); diff --git a/qcsrc/server/bot/havocbot/havocbot.qc b/qcsrc/server/bot/havocbot/havocbot.qc index e58e67097..47f7f3669 100644 --- a/qcsrc/server/bot/havocbot/havocbot.qc +++ b/qcsrc/server/bot/havocbot/havocbot.qc @@ -42,10 +42,10 @@ void havocbot_ai() if(distance>10000) continue; - if(head.origin_z < self.origin_z) + if(head.origin.z < self.origin.z) continue; - if(head.origin_z - self.origin_z - self.view_ofs_z > 100) + if(head.origin.z - self.origin.z - self.view_ofs.z > 100) continue; if (pointcontents(head.origin + head.maxs + '0 0 1') != CONTENT_EMPTY) @@ -202,13 +202,13 @@ void havocbot_keyboard_movement(vector destorg) // at skill < 2.5 only individual directions // at skill < 4.5 only individual directions, and forward diagonals // at skill >= 4.5, all cases allowed - if (keyboard_x > trigger) + if (keyboard.x > trigger) { keyboard_x = 1; if (sk < 2.5) keyboard_y = 0; } - else if (keyboard_x < trigger1 && sk > 1.5) + else if (keyboard.x < trigger1 && sk > 1.5) { keyboard_x = -1; if (sk < 4.5) @@ -223,16 +223,16 @@ void havocbot_keyboard_movement(vector destorg) if (sk < 4.5) keyboard_z = 0; - if (keyboard_y > trigger) + if (keyboard.y > trigger) keyboard_y = 1; - else if (keyboard_y < trigger1) + else if (keyboard.y < trigger1) keyboard_y = -1; else keyboard_y = 0; - if (keyboard_z > trigger) + if (keyboard.z > trigger) keyboard_z = 1; - else if (keyboard_z < trigger1) + else if (keyboard.z < trigger1) keyboard_z = -1; else keyboard_z = 0; @@ -317,17 +317,17 @@ void havocbot_bunnyhop(vector dir) if(self.aistatus & AI_STATUS_ROAMING) if(self.goalcurrent.classname=="waypoint") if (!(self.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL)) - if(fabs(gco_z - self.origin_z) < self.maxs_z - self.mins_z) + if(fabs(gco.z - self.origin.z) < self.maxs.z - self.mins.z) if(self.goalstack01!=world) { gno = (self.goalstack01.absmin + self.goalstack01.absmax) * 0.5; deviation = vectoangles(gno - self.origin) - vectoangles(gco - self.origin); - while (deviation_y < -180) deviation_y = deviation_y + 360; - while (deviation_y > 180) deviation_y = deviation_y - 360; + while (deviation.y < -180) deviation_y = deviation.y + 360; + while (deviation.y > 180) deviation_y = deviation.y - 360; - if(fabs(deviation_y) < 20) + if(fabs(deviation.y) < 20) if(bunnyhopdistance < vlen(self.origin - gno)) - if(fabs(gno_z - gco_z) < self.maxs_z - self.mins_z) + if(fabs(gno.z - gco.z) < self.maxs.z - self.mins.z) { if(vlen(gco - gno) > autocvar_bot_ai_bunnyhop_startdistance) if(checkpvs(self.origin + self.view_ofs, self.goalstack01)) @@ -365,7 +365,7 @@ void havocbot_bunnyhop(vector dir) if(!cvar("sv_pogostick")) if((self.flags & FL_ONGROUND) == 0) { - if(self.velocity_z < 0 || vlen(self.velocity)maxspeed) { deviation = vectoangles(dir) - vectoangles(self.velocity); - while (deviation_y < -180) deviation_y = deviation_y + 360; - while (deviation_y > 180) deviation_y = deviation_y - 360; + while (deviation.y < -180) deviation_y = deviation.y + 360; + while (deviation.y > 180) deviation_y = deviation.y - 360; - if(fabs(deviation_y)>10) + if(fabs(deviation.y)>10) self.movement_x = 0; - if(deviation_y>10) + if(deviation.y>10) self.movement_y = maxspeed * -1; - else if(deviation_y<10) + else if(deviation.y<10) self.movement_y = maxspeed; } @@ -430,7 +430,7 @@ void havocbot_movetogoal() self.aistatus |= AI_STATUS_JETPACK_FLYING; } - makevectors(self.v_angle_y * '0 1 0'); + makevectors(self.v_angle.y * '0 1 0'); dir = normalize(self.navigation_jetpack_point - self.origin); // Landing @@ -442,13 +442,13 @@ void havocbot_movetogoal() dxy = self.origin - ( ( self.goalcurrent.absmin + self.goalcurrent.absmax ) * 0.5 ); dxy_z = 0; d = vlen(dxy); - v = vlen(self.velocity - self.velocity_z * '0 0 1'); + v = vlen(self.velocity - self.velocity.z * '0 0 1'); db = (pow(v,2) / (autocvar_g_jetpack_acceleration_side * 2)) + 100; // dprint("distance ", ftos(ceil(d)), " velocity ", ftos(ceil(v)), " brake at ", ftos(ceil(db)), "\n"); if(d < db || d < 500) { // Brake - if(fabs(self.velocity_x)>maxspeed*0.3) + if(fabs(self.velocity.x)>maxspeed*0.3) { self.movement_x = dir * v_forward * -maxspeed; return; @@ -470,7 +470,7 @@ void havocbot_movetogoal() // Flying self.BUTTON_HOOK = TRUE; - if(self.navigation_jetpack_point_z - PL_MAX_z + PL_MIN_z < self.origin_z) + if(self.navigation_jetpack_point.z - PL_MAX_z + PL_MIN_z < self.origin.z) { self.movement_x = dir * v_forward * maxspeed; self.movement_y = dir * v_right * maxspeed; @@ -484,7 +484,7 @@ void havocbot_movetogoal() // If got stuck on the jump pad try to reach the farthest visible waypoint if(self.aistatus & AI_STATUS_OUT_JUMPPAD) { - if(fabs(self.velocity_z)<50) + if(fabs(self.velocity.z)<50) { entity head, newgoal = world; float distance, bestdistance = 0; @@ -522,7 +522,7 @@ void havocbot_movetogoal() } else { - if(self.velocity_z>0) + if(self.velocity.z>0) { float threshold, sxy; vector velxy = self.velocity; velxy_z = 0; @@ -555,7 +555,7 @@ void havocbot_movetogoal() tracebox(self.origin, self.mins, self.maxs, self.origin + '0 0 65536', MOVE_NOMONSTERS, self); if(tracebox_hits_trigger_hurt(self.origin, self.mins, self.maxs, trace_endpos + '0 0 1' )) { - if(self.velocity_z<0) + if(self.velocity.z<0) { self.BUTTON_HOOK = TRUE; } @@ -575,7 +575,7 @@ void havocbot_movetogoal() if(xyspeed < (maxspeed / 2)) { - makevectors(self.v_angle_y * '0 1 0'); + makevectors(self.v_angle.y * '0 1 0'); tracebox(self.origin, self.mins, self.maxs, self.origin + (dir * maxspeed * 3), MOVE_NOMONSTERS, self); if(trace_fraction==1) { @@ -592,7 +592,7 @@ void havocbot_movetogoal() } else if(self.health>WEP_CVAR(devastator, damage)*0.5) { - if(self.velocity_z < 0) + if(self.velocity.z < 0) if(client_hasweapon(self, WEP_DEVASTATOR, TRUE, FALSE)) { self.movement_x = maxspeed; @@ -629,11 +629,11 @@ void havocbot_movetogoal() dir = '0 0 0'; if(self.waterlevel>WATERLEVEL_SWIMMING) dir_z = 1; - else if(self.velocity_z >= 0 && !(self.waterlevel == WATERLEVEL_WETFEET && self.watertype == CONTENT_WATER)) + else if(self.velocity.z >= 0 && !(self.waterlevel == WATERLEVEL_WETFEET && self.watertype == CONTENT_WATER)) self.BUTTON_JUMP = TRUE; else self.BUTTON_JUMP = FALSE; - makevectors(self.v_angle_y * '0 1 0'); + makevectors(self.v_angle.y * '0 1 0'); self.movement_x = dir * v_forward * maxspeed; self.movement_y = dir * v_right * maxspeed; self.movement_z = dir * v_up * maxspeed; @@ -660,9 +660,9 @@ void havocbot_movetogoal() m1 = self.goalcurrent.origin + self.goalcurrent.mins; m2 = self.goalcurrent.origin + self.goalcurrent.maxs; destorg = self.origin; - destorg_x = bound(m1_x, destorg_x, m2_x); - destorg_y = bound(m1_y, destorg_y, m2_y); - destorg_z = bound(m1_z, destorg_z, m2_z); + destorg_x = bound(m1_x, destorg.x, m2_x); + destorg_y = bound(m1_y, destorg.y, m2_y); + destorg_z = bound(m1_z, destorg.z, m2_z); diff = destorg - self.origin; //dist = vlen(diff); dir = normalize(diff); @@ -686,14 +686,14 @@ void havocbot_movetogoal() } else { - if(self.velocity_z >= 0 && !(self.watertype == CONTENT_WATER && gco_z < self.origin_z) && + if(self.velocity.z >= 0 && !(self.watertype == CONTENT_WATER && gco.z < self.origin.z) && ( !(self.waterlevel == WATERLEVEL_WETFEET && self.watertype == CONTENT_WATER) || self.aistatus & AI_STATUS_OUT_WATER)) self.BUTTON_JUMP = TRUE; else self.BUTTON_JUMP = FALSE; } dir = normalize(flatdir); - makevectors(self.v_angle_y * '0 1 0'); + makevectors(self.v_angle.y * '0 1 0'); } else { @@ -704,12 +704,12 @@ void havocbot_movetogoal() // can walk up directly tracebox(self.origin, self.mins, self.maxs, self.origin + self.velocity * 0.2, FALSE, self); if (trace_fraction < 1) - if (trace_plane_normal_z < 0.7) + if (trace_plane_normal.z < 0.7) { s = trace_fraction; tracebox(self.origin + stepheightvec, self.mins, self.maxs, self.origin + self.velocity * 0.2 + stepheightvec, FALSE, self); if (trace_fraction < s + 0.01) - if (trace_plane_normal_z < 0.7) + if (trace_plane_normal.z < 0.7) { s = trace_fraction; tracebox(self.origin + jumpstepheightvec, self.mins, self.maxs, self.origin + self.velocity * 0.2 + jumpstepheightvec, FALSE, self); @@ -720,7 +720,7 @@ void havocbot_movetogoal() // avoiding dangers and obstacles vector dst_ahead, dst_down; - makevectors(self.v_angle_y * '0 1 0'); + makevectors(self.v_angle.y * '0 1 0'); dst_ahead = self.origin + self.view_ofs + (self.velocity * 0.4) + (v_forward * 32 * 3); dst_down = dst_ahead - '0 0 1500'; @@ -765,7 +765,7 @@ void havocbot_movetogoal() traceline(dst_ahead , dst_down, TRUE, world); // te_lightning2(world, self.origin, dst_ahead); // Draw "ahead" look // te_lightning2(world, dst_ahead, dst_down); // Draw "downwards" look - if(trace_endpos_z < self.origin_z + self.mins_z) + if(trace_endpos.z < self.origin.z + self.mins.z) { s = pointcontents(trace_endpos + '0 0 1'); if (s != CONTENT_SOLID) @@ -792,7 +792,7 @@ void havocbot_movetogoal() dir = flatdir; evadeobstacle_z = 0; evadelava_z = 0; - makevectors(self.v_angle_y * '0 1 0'); + makevectors(self.v_angle.y * '0 1 0'); if(evadeobstacle!='0 0 0'||evadelava!='0 0 0') self.aistatus |= AI_STATUS_DANGER_AHEAD; @@ -812,14 +812,14 @@ void havocbot_movetogoal() if(time < self.ladder_time) { - if(self.goalcurrent.origin_z + self.goalcurrent.mins_z > self.origin_z + self.mins_z) + if(self.goalcurrent.origin.z + self.goalcurrent.mins.z > self.origin.z + self.mins.z) { - if(self.origin_z + self.mins_z < self.ladder_entity.origin_z + self.ladder_entity.maxs_z) + if(self.origin.z + self.mins.z < self.ladder_entity.origin.z + self.ladder_entity.maxs.z) dir_z = 1; } else { - if(self.origin_z + self.mins_z > self.ladder_entity.origin_z + self.ladder_entity.mins_z) + if(self.origin.z + self.mins.z > self.ladder_entity.origin.z + self.ladder_entity.mins.z) dir_z = -1; } } diff --git a/qcsrc/server/bot/navigation.qc b/qcsrc/server/bot/navigation.qc index d676c8eb3..8c244bf8b 100644 --- a/qcsrc/server/bot/navigation.qc +++ b/qcsrc/server/bot/navigation.qc @@ -108,7 +108,7 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float { swimming = TRUE; org = trace_endpos - normalize(org - trace_endpos) * stepdist; - for(0; org_z < end_z + self.maxs_z; org_z += stepdist) + for(0; org.z < end.z + self.maxs.z; org.z += stepdist) { if(autocvar_bot_debug_tracewalk) debugnode(org); @@ -387,7 +387,7 @@ entity navigation_findnearestwaypoint_withdist_except(entity ent, float walkfrom } org = ent.origin + 0.5 * (ent.mins + ent.maxs); - org_z = ent.origin_z + ent.mins_z - PL_MIN_z; // player height + org_z = ent.origin.z + ent.mins.z - PL_MIN_z; // player height // TODO possibly make other code have the same support for bboxes if(ent.tag_entity) org = org + ent.tag_entity.origin; @@ -408,9 +408,9 @@ entity navigation_findnearestwaypoint_withdist_except(entity ent, float walkfrom vector wm1, wm2; wm1 = w.origin + w.mins; wm2 = w.origin + w.maxs; - v_x = bound(wm1_x, org_x, wm2_x); - v_y = bound(wm1_y, org_y, wm2_y); - v_z = bound(wm1_z, org_z, wm2_z); + v_x = bound(wm1_x, org.x, wm2_x); + v_y = bound(wm1_y, org.y, wm2_y); + v_z = bound(wm1_z, org.z, wm2_z); } else v = w.origin; @@ -454,14 +454,14 @@ float navigation_markroutes_nearestwaypoints(entity waylist, float maxdist) m1 = head.origin + head.mins; m2 = head.origin + head.maxs; v = self.origin; - v_x = bound(m1_x, v_x, m2_x); - v_y = bound(m1_y, v_y, m2_y); - v_z = bound(m1_z, v_z, m2_z); + v_x = bound(m1_x, v.x, m2_x); + v_y = bound(m1_y, v.y, m2_y); + v_z = bound(m1_z, v.z, m2_z); } else v = head.origin; diff = v - self.origin; - diff_z = max(0, diff_z); + diff_z = max(0, diff.z); if (vlen(diff) < maxdist) { head.wpconsidered = TRUE; @@ -491,9 +491,9 @@ void navigation_markroutes_checkwaypoint(entity w, entity wp, float cost2, vecto { m1 = wp.absmin; m2 = wp.absmax; - v_x = bound(m1_x, p_x, m2_x); - v_y = bound(m1_y, p_y, m2_y); - v_z = bound(m1_z, p_z, m2_z); + v_x = bound(m1_x, p.x, m2_x); + v_y = bound(m1_y, p.y, m2_y); + v_z = bound(m1_z, p.z, m2_z); } else v = wp.origin; @@ -716,10 +716,10 @@ void navigation_routerating(entity e, float f, float rangebias) npa = pointa + down; npb = pointb + down; - if(npa_z<=self.absmax_z) + if(npa.z<=self.absmax.z) break; - if(npb_z<=e.absmax_z) + if(npb.z<=e.absmax.z) break; traceline(npa, npb, MOVE_NORMAL, self); @@ -735,7 +735,7 @@ void navigation_routerating(entity e, float f, float rangebias) // Rough estimation of fuel consumption // (ignores acceleration and current xyz velocity) xydistance = vlen(pointa - pointb); - zdistance = fabs(pointa_z - self.origin_z); + zdistance = fabs(pointa.z - self.origin.z); t = zdistance / autocvar_g_jetpack_maxspeed_up; t += xydistance / autocvar_g_jetpack_maxspeed_side; @@ -1034,9 +1034,9 @@ void botframe_updatedangerousobjects(float maxupdate) while (head) { v = head.origin; - v_x = bound(m1_x, v_x, m2_x); - v_y = bound(m1_y, v_y, m2_y); - v_z = bound(m1_z, v_z, m2_z); + v_x = bound(m1_x, v.x, m2_x); + v_y = bound(m1_y, v.y, m2_y); + v_z = bound(m1_z, v.z, m2_z); o = (head.absmin + head.absmax) * 0.5; d = head.bot_dodgerating - vlen(o - v); if (d > 0) diff --git a/qcsrc/server/bot/scripting.qc b/qcsrc/server/bot/scripting.qc index 99c2ba830..71bc21779 100644 --- a/qcsrc/server/bot/scripting.qc +++ b/qcsrc/server/bot/scripting.qc @@ -626,8 +626,8 @@ float bot_cmd_barrier() float bot_cmd_turn() { - self.v_angle_y = self.v_angle_y + bot_cmd.bot_cmd_parm_float; - self.v_angle_y = self.v_angle_y - floor(self.v_angle_y / 360) * 360; + self.v_angle_y = self.v_angle.y + bot_cmd.bot_cmd_parm_float; + self.v_angle_y = self.v_angle.y - floor(self.v_angle.y / 360) * 360; return CMD_STATUS_FINISHED; } @@ -821,8 +821,8 @@ float bot_cmd_aim() self.bot_cmd_aim_begin = self.v_angle; - self.bot_cmd_aim_end_x = self.v_angle_x - stof(argv(1)); - self.bot_cmd_aim_end_y = self.v_angle_y + stof(argv(0)); + self.bot_cmd_aim_end_x = self.v_angle.x - stof(argv(1)); + self.bot_cmd_aim_end_y = self.v_angle.y + stof(argv(0)); self.bot_cmd_aim_end_z = 0; self.bot_cmd_aim_begintime = time; @@ -856,7 +856,7 @@ float bot_cmd_aimtarget() if(tokens==1) { self.v_angle = vectoangles(v - (self.origin + self.view_ofs)); - self.v_angle_x = -self.v_angle_x; + self.v_angle_x = -self.v_angle.x; return CMD_STATUS_FINISHED; } @@ -867,7 +867,7 @@ float bot_cmd_aimtarget() self.bot_cmd_aim_begin = self.v_angle; self.bot_cmd_aim_end = vectoangles(v - (self.origin + self.view_ofs)); - self.bot_cmd_aim_end_x = -self.bot_cmd_aim_end_x; + self.bot_cmd_aim_end_x = -self.bot_cmd_aim_end.x; self.bot_cmd_aim_begintime = time; self.bot_cmd_aim_endtime = time + step; diff --git a/qcsrc/server/bot/waypoints.qc b/qcsrc/server/bot/waypoints.qc index d7159c159..94f5cd56c 100644 --- a/qcsrc/server/bot/waypoints.qc +++ b/qcsrc/server/bot/waypoints.qc @@ -177,15 +177,15 @@ void waypoint_think() continue; } sv = e.origin; - sv_x = bound(sm1_x, sv_x, sm2_x); - sv_y = bound(sm1_y, sv_y, sm2_y); - sv_z = bound(sm1_z, sv_z, sm2_z); + sv_x = bound(sm1_x, sv.x, sm2_x); + sv_y = bound(sm1_y, sv.y, sm2_y); + sv_z = bound(sm1_z, sv.z, sm2_z); ev = self.origin; em1 = e.origin + e.mins; em2 = e.origin + e.maxs; - ev_x = bound(em1_x, ev_x, em2_x); - ev_y = bound(em1_y, ev_y, em2_y); - ev_z = bound(em1_z, ev_z, em2_z); + ev_x = bound(em1_x, ev.x, em2_x); + ev_y = bound(em1_y, ev.y, em2_y); + ev_z = bound(em1_z, ev.z, em2_z); dv = ev - sv; dv_z = 0; if (vlen(dv) >= 1050) // max search distance in XY diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index 45e8a077e..f3c64a696 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -103,9 +103,9 @@ void info_autoscreenshot_findtarget() return; } vector a = vectoangles(e.origin - self.origin); - a_x = -a_x; // don't ask - self.angles_x = a_x; - self.angles_y = a_y; + a_x = -a.x; // don't ask + self.angles_x = a.x; + self.angles_y = a.y; // we leave Rick Roll alone } void spawnfunc_info_autoscreenshot() @@ -241,7 +241,7 @@ float CheatImpulse(float i) if(MoveToRandomMapLocation(self, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, ((gamestart_sv_cheats < 2) ? 100 : 100000), 384, 384)) { sprint(self, "Emergency teleport used random location\n"); - self.angles_x = -self.angles_x; + self.angles_x = -self.angles.x; self.fixangle = TRUE; self.velocity = '0 0 0'; DID_CHEAT(); @@ -420,9 +420,9 @@ float CheatCommand(float argc) e.enemy.skin = 1; setsize(e.enemy, '0 0 0', '0 0 0'); end = normalize(self.origin + self.view_ofs - e.aiment.origin); - end_x = (end_x > 0) * 2 - 1; - end_y = (end_y > 0) * 2 - 1; - end_z = (end_z > 0) * 2 - 1; + end_x = (end.x > 0) * 2 - 1; + end_y = (end.y > 0) * 2 - 1; + end_z = (end.z > 0) * 2 - 1; if(argc == 4) setorigin(e.enemy, stov(argv(3))); else @@ -546,8 +546,8 @@ float CheatCommand(float argc) { fputs(f, "{\n"); fputs(f, "\"classname\" \"trigger_race_checkpoint\"\n"); - fputs(f, strcat("\"origin\" \"", ftos(e.absmin_x), " ", ftos(e.absmin_y), " ", ftos(e.absmin_z), "\"\n")); - fputs(f, strcat("\"maxs\" \"", ftos(e.absmax_x - e.absmin_x), " ", ftos(e.absmax_y - e.absmin_y), " ", ftos(e.absmax_z - e.absmin_z), "\"\n")); + fputs(f, strcat("\"origin\" \"", ftos(e.absmin.x), " ", ftos(e.absmin.y), " ", ftos(e.absmin.z), "\"\n")); + fputs(f, strcat("\"maxs\" \"", ftos(e.absmax.x - e.absmin.x), " ", ftos(e.absmax.y - e.absmin.y), " ", ftos(e.absmax.z - e.absmin.z), "\"\n")); fputs(f, strcat("\"cnt\" \"", ftos(e.cnt), "\"\n")); fputs(f, strcat("\"targetname\" \"checkpoint", ftos(e.cnt), "\"\n")); fputs(f, "}\n"); @@ -568,7 +568,7 @@ float CheatCommand(float argc) fputs(f, "{\n"); fputs(f, "\"classname\" \"info_player_race\"\n"); fputs(f, strcat("\"angle\" \"", ftos(vectoyaw(start - e.origin)), "\"\n")); - fputs(f, strcat("\"origin\" \"", ftos(e.origin_x), " ", ftos(e.origin_y), " ", ftos(e.origin_z), "\"\n")); + fputs(f, strcat("\"origin\" \"", ftos(e.origin.x), " ", ftos(e.origin.y), " ", ftos(e.origin.z), "\"\n")); if(e.cnt == -2) { fputs(f, "\"target\" \"checkpoint0\"\n"); @@ -892,7 +892,7 @@ void Drag_Begin(entity dragger, entity draggee, vector touchpoint) dragger.dragentity = draggee; dragger.dragdistance = vlen(touchpoint - dragger.origin - dragger.view_ofs); - dragger.draglocalangle = draggee.angles_y - dragger.v_angle_y; + dragger.draglocalangle = draggee.angles.y - dragger.v_angle.y; touchpoint = touchpoint - gettaginfo(draggee, 0); tagscale = pow(vlen(v_forward), -2); dragger.draglocalvector_x = touchpoint * v_forward * tagscale; @@ -994,21 +994,21 @@ void Drag_Update(entity dragger) draggee.flags &= ~FL_ONGROUND; curorigin = gettaginfo(draggee, 0); - curorigin = curorigin + v_forward * dragger.draglocalvector_x + v_right * dragger.draglocalvector_y + v_up * dragger.draglocalvector_z; + curorigin = curorigin + v_forward * dragger.draglocalvector.x + v_right * dragger.draglocalvector.y + v_up * dragger.draglocalvector.z; makevectors(dragger.v_angle); neworigin = dragger.origin + dragger.view_ofs + v_forward * dragger.dragdistance; goodvelocity = (neworigin - curorigin) * (1 / frametime); - while(draggee.angles_y - dragger.v_angle_y - dragger.draglocalangle > 180) + while(draggee.angles.y - dragger.v_angle.y - dragger.draglocalangle > 180) dragger.draglocalangle += 360; - while(draggee.angles_y - dragger.v_angle_y - dragger.draglocalangle <= -180) + while(draggee.angles.y - dragger.v_angle.y - dragger.draglocalangle <= -180) dragger.draglocalangle -= 360; f = min(frametime * 10, 1); draggee.velocity = draggee.velocity * (1 - f) + goodvelocity * f; if(Drag_MayChangeAngles(draggee)) - draggee.angles_y = draggee.angles_y * (1 - f) + (dragger.v_angle_y + dragger.draglocalangle) * f; + draggee.angles_y = draggee.angles.y * (1 - f) + (dragger.v_angle.y + dragger.draglocalangle) * f; draggee.ltime = max(servertime + serverframetime, draggee.ltime); // fixes func_train breakage @@ -1051,12 +1051,12 @@ void DragBox_Think() { if(self.aiment && self.enemy) { - self.origin_x = (self.aiment.origin_x + self.enemy.origin_x) * 0.5; - self.origin_y = (self.aiment.origin_y + self.enemy.origin_y) * 0.5; - self.origin_z = (self.aiment.origin_z + self.enemy.origin_z) * 0.5; - self.maxs_x = fabs(self.aiment.origin_x - self.enemy.origin_x) * 0.5; - self.maxs_y = fabs(self.aiment.origin_y - self.enemy.origin_y) * 0.5; - self.maxs_z = fabs(self.aiment.origin_z - self.enemy.origin_z) * 0.5; + self.origin_x = (self.aiment.origin.x + self.enemy.origin.x) * 0.5; + self.origin_y = (self.aiment.origin.y + self.enemy.origin.y) * 0.5; + self.origin_z = (self.aiment.origin.z + self.enemy.origin.z) * 0.5; + self.maxs_x = fabs(self.aiment.origin.x - self.enemy.origin.x) * 0.5; + self.maxs_y = fabs(self.aiment.origin.y - self.enemy.origin.y) * 0.5; + self.maxs_z = fabs(self.aiment.origin.z - self.enemy.origin.z) * 0.5; self.mins = -1 * self.maxs; setorigin(self, self.origin); setsize(self, self.mins, self.maxs); // link edict } diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 03ab777b9..f3f17cfb7 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -36,8 +36,8 @@ float ClientData_Send(entity to, float sf) if(sf & 8) { - WriteAngle(MSG_ENTITY, e.v_angle_x); - WriteAngle(MSG_ENTITY, e.v_angle_y); + WriteAngle(MSG_ENTITY, e.v_angle.x); + WriteAngle(MSG_ENTITY, e.v_angle.y); } return TRUE; @@ -536,7 +536,7 @@ void PutClientInServer (void) self.view_ofs = PL_VIEW_OFS; setsize (self, PL_MIN, PL_MAX); self.spawnorigin = spot.origin; - setorigin (self, spot.origin + '0 0 1' * (1 - self.mins_z - 24)); + setorigin (self, spot.origin + '0 0 1' * (1 - self.mins.z - 24)); // don't reset back to last position, even if new position is stuck in solid self.oldorigin = self.origin; self.prevorigin = self.origin; @@ -1327,7 +1327,7 @@ void UpdateChatBubble() self.chatbubbleentity.nextthink = time; setmodel(self.chatbubbleentity, "models/misc/chatbubble.spr"); // precision set below //setorigin(self.chatbubbleentity, self.origin + '0 0 15' + self.maxs_z * '0 0 1'); - setorigin(self.chatbubbleentity, '0 0 15' + self.maxs_z * '0 0 1'); + setorigin(self.chatbubbleentity, '0 0 15' + self.maxs.z * '0 0 1'); setattachment(self.chatbubbleentity, self, ""); // sticks to moving player better, also conserves bandwidth self.chatbubbleentity.mdl = self.chatbubbleentity.model; self.chatbubbleentity.model = ""; @@ -1607,12 +1607,12 @@ void SetZoomState(float z) void GetPressedKeys(void) { MUTATOR_CALLHOOK(GetPressedKeys); - if (self.movement_x > 0) // get if movement keys are pressed + if (self.movement.x > 0) // get if movement keys are pressed { // forward key pressed self.pressedkeys |= KEY_FORWARD; self.pressedkeys &= ~KEY_BACKWARD; } - else if (self.movement_x < 0) + else if (self.movement.x < 0) { // backward key pressed self.pressedkeys |= KEY_BACKWARD; self.pressedkeys &= ~KEY_FORWARD; @@ -1623,12 +1623,12 @@ void GetPressedKeys(void) { self.pressedkeys &= ~KEY_BACKWARD; } - if (self.movement_y > 0) + if (self.movement.y > 0) { // right key pressed self.pressedkeys |= KEY_RIGHT; self.pressedkeys &= ~KEY_LEFT; } - else if (self.movement_y < 0) + else if (self.movement.y < 0) { // left key pressed self.pressedkeys |= KEY_LEFT; self.pressedkeys &= ~KEY_RIGHT; @@ -1729,9 +1729,9 @@ void SpectateCopy(entity spectatee) { msg_entity = self; WriteByte (MSG_ONE, SVC_SETVIEWANGLES); - WriteAngle(MSG_ONE, spectatee.v_angle_x); - WriteAngle(MSG_ONE, spectatee.v_angle_y); - WriteAngle(MSG_ONE, spectatee.v_angle_z); + WriteAngle(MSG_ONE, spectatee.v_angle.x); + WriteAngle(MSG_ONE, spectatee.v_angle.y); + WriteAngle(MSG_ONE, spectatee.v_angle.z); //WriteByte (MSG_ONE, SVC_SETVIEW); // WriteEntity(MSG_ONE, self); @@ -2332,9 +2332,9 @@ void PlayerPreThink (void) if(self.vortex_charge > WEP_CVAR(vortex, charge_animlimit)) { - self.weaponentity_glowmod_x = self.weaponentity_glowmod_x + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_full * (self.vortex_charge - WEP_CVAR(vortex, charge_animlimit)) / (1 - WEP_CVAR(vortex, charge_animlimit)); - self.weaponentity_glowmod_y = self.weaponentity_glowmod_y + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_full * (self.vortex_charge - WEP_CVAR(vortex, charge_animlimit)) / (1 - WEP_CVAR(vortex, charge_animlimit)); - self.weaponentity_glowmod_z = self.weaponentity_glowmod_z + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_blue_full * (self.vortex_charge - WEP_CVAR(vortex, charge_animlimit)) / (1 - WEP_CVAR(vortex, charge_animlimit)); + self.weaponentity_glowmod_x = self.weaponentity_glowmod.x + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_full * (self.vortex_charge - WEP_CVAR(vortex, charge_animlimit)) / (1 - WEP_CVAR(vortex, charge_animlimit)); + self.weaponentity_glowmod_y = self.weaponentity_glowmod.y + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_full * (self.vortex_charge - WEP_CVAR(vortex, charge_animlimit)) / (1 - WEP_CVAR(vortex, charge_animlimit)); + self.weaponentity_glowmod_z = self.weaponentity_glowmod.z + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_blue_full * (self.vortex_charge - WEP_CVAR(vortex, charge_animlimit)) / (1 - WEP_CVAR(vortex, charge_animlimit)); } } else diff --git a/qcsrc/server/cl_physics.qc b/qcsrc/server/cl_physics.qc index fb283bb2a..d0ddefe35 100644 --- a/qcsrc/server/cl_physics.qc +++ b/qcsrc/server/cl_physics.qc @@ -40,7 +40,7 @@ float PlayerJump (void) if (autocvar_sv_doublejump) { tracebox(self.origin + '0 0 0.01', self.mins, self.maxs, self.origin - '0 0 0.01', MOVE_NORMAL, self); - if (trace_fraction < 1 && trace_plane_normal_z > 0.7) + if (trace_fraction < 1 && trace_plane_normal.z > 0.7) { doublejump = TRUE; @@ -76,8 +76,8 @@ float PlayerJump (void) minjumpspeed = mjumpheight * stof(autocvar_sv_jumpspeedcap_min); - if (self.velocity_z < minjumpspeed) - mjumpheight += minjumpspeed - self.velocity_z; + if (self.velocity.z < minjumpspeed) + mjumpheight += minjumpspeed - self.velocity.z; } if(autocvar_sv_jumpspeedcap_max != "") @@ -85,14 +85,14 @@ float PlayerJump (void) // don't do jump speedcaps on ramps to preserve old xonotic ramjump style tracebox(self.origin + '0 0 0.01', self.mins, self.maxs, self.origin - '0 0 0.01', MOVE_NORMAL, self); - if(!(trace_fraction < 1 && trace_plane_normal_z < 0.98 && autocvar_sv_jumpspeedcap_max_disable_on_ramps)) + if(!(trace_fraction < 1 && trace_plane_normal.z < 0.98 && autocvar_sv_jumpspeedcap_max_disable_on_ramps)) { float maxjumpspeed; maxjumpspeed = mjumpheight * stof(autocvar_sv_jumpspeedcap_max); - if (self.velocity_z > maxjumpspeed) - mjumpheight -= self.velocity_z - maxjumpspeed; + if (self.velocity.z > maxjumpspeed) + mjumpheight -= self.velocity.z - maxjumpspeed; } } @@ -110,8 +110,8 @@ float PlayerJump (void) self.jumppadcount = 0; } - self.velocity_z = self.velocity_z + mjumpheight; - self.oldvelocity_z = self.velocity_z; + self.velocity_z = self.velocity.z + mjumpheight; + self.oldvelocity_z = self.velocity.z; self.flags &= ~FL_ONGROUND; self.flags &= ~FL_JUMPRELEASED; @@ -132,14 +132,14 @@ void CheckWaterJump() // check for a jump-out-of-water makevectors (self.angles); start = self.origin; - start_z = start_z + 8; + start_z = start.z + 8; v_forward_z = 0; normalize(v_forward); end = start + v_forward*24; traceline (start, end, TRUE, self); if (trace_fraction < 1) { // solid at waist - start_z = start_z + self.maxs_z - 8; + start_z = start.z + self.maxs.z - 8; end = start + v_forward*24; self.movedir = trace_plane_normal * -50; traceline (start, end, TRUE, self); @@ -224,8 +224,8 @@ void RaceCarPhysics() vector angles_save, rigvel; angles_save = self.angles; - accel = bound(-1, self.movement_x / self.stat_sv_maxspeed, 1); - steer = bound(-1, self.movement_y / self.stat_sv_maxspeed, 1); + accel = bound(-1, self.movement.x / self.stat_sv_maxspeed, 1); + steer = bound(-1, self.movement.y / self.stat_sv_maxspeed, 1); if(g_bugrigs_reverse_speeding) { @@ -325,7 +325,7 @@ void RaceCarPhysics() vector rigvel_xy, neworigin, up; float mt; - rigvel_z -= frametime * autocvar_sv_gravity; // 4x gravity plays better + rigvel.z -= frametime * autocvar_sv_gravity; // 4x gravity plays better rigvel_xy = vec2(rigvel); if(g_bugrigs_planar_movement_car_jumping) @@ -341,7 +341,7 @@ void RaceCarPhysics() tracebox(trace_endpos, self.mins, self.maxs, trace_endpos + rigvel_xy * frametime, mt, self); // align to surface - tracebox(trace_endpos, self.mins, self.maxs, trace_endpos - up + '0 0 1' * rigvel_z * frametime, mt, self); + tracebox(trace_endpos, self.mins, self.maxs, trace_endpos - up + '0 0 1' * rigvel.z * frametime, mt, self); if(trace_fraction < 0.5) { @@ -355,11 +355,11 @@ void RaceCarPhysics() { // now set angles_x so that the car points parallel to the surface self.angles = vectoangles( - '1 0 0' * v_forward_x * trace_plane_normal_z + '1 0 0' * v_forward.x * trace_plane_normal.z + - '0 1 0' * v_forward_y * trace_plane_normal_z + '0 1 0' * v_forward.y * trace_plane_normal.z + - '0 0 1' * -(v_forward_x * trace_plane_normal_x + v_forward_y * trace_plane_normal_y) + '0 0 1' * -(v_forward.x * trace_plane_normal.x + v_forward.y * trace_plane_normal.y) ); self.flags |= FL_ONGROUND; } @@ -374,7 +374,7 @@ void RaceCarPhysics() } else { - rigvel_z -= frametime * autocvar_sv_gravity; // 4x gravity plays better + rigvel.z -= frametime * autocvar_sv_gravity; // 4x gravity plays better self.velocity = rigvel; self.movetype = MOVETYPE_FLY; } @@ -384,11 +384,11 @@ void RaceCarPhysics() if(trace_fraction != 1) { self.angles = vectoangles2( - '1 0 0' * v_forward_x * trace_plane_normal_z + '1 0 0' * v_forward.x * trace_plane_normal.z + - '0 1 0' * v_forward_y * trace_plane_normal_z + '0 1 0' * v_forward.y * trace_plane_normal.z + - '0 0 1' * -(v_forward_x * trace_plane_normal_x + v_forward_y * trace_plane_normal_y), + '0 0 1' * -(v_forward.x * trace_plane_normal.x + v_forward.y * trace_plane_normal.y), trace_plane_normal ); } @@ -400,8 +400,8 @@ void RaceCarPhysics() vel_local_y = v_right * self.velocity; vel_local_z = v_up * self.velocity; - self.angles_x = racecar_angle(vel_local_x, vel_local_z); - self.angles_z = racecar_angle(-vel_local_y, vel_local_z); + self.angles_x = racecar_angle(vel_local.x, vel_local.z); + self.angles_z = racecar_angle(-vel_local.y, vel_local.z); } // smooth the angles @@ -416,15 +416,15 @@ void RaceCarPhysics() vf1 = vf1 + v_forward * (1 - f); vu1 = vu1 + v_up * (1 - f); smoothangles = vectoangles2(vf1, vu1); - self.angles_x = -smoothangles_x; - self.angles_z = smoothangles_z; + self.angles_x = -smoothangles.x; + self.angles_z = smoothangles.z; } float IsMoveInDirection(vector mv, float angle) // key mix factor { if(mv_x == 0 && mv_y == 0) return 0; // avoid division by zero - angle -= RAD2DEG * atan2(mv_y, mv_x); + angle -= RAD2DEG * atan2(mv.y, mv.x); angle = remainder(angle, 360) / 45; if(angle > 1) return 0; @@ -458,7 +458,7 @@ void CPM_PM_Aircontrol(vector wishdir, float wishspeed) #if 0 // this doesn't play well with analog input - if(self.movement_x == 0 || self.movement_y != 0) + if(self.movement_x == 0 || self.movement.y != 0) return; // can't control movement if not moving forward or backward k = 32; #else @@ -469,7 +469,7 @@ void CPM_PM_Aircontrol(vector wishdir, float wishspeed) k *= bound(0, wishspeed / autocvar_sv_maxairspeed, 1); - zspeed = self.velocity_z; + zspeed = self.velocity.z; self.velocity_z = 0; xyspeed = vlen(self.velocity); self.velocity = normalize(self.velocity); @@ -500,7 +500,7 @@ float AdjustAirAccelQW(float accelqw, float factor) void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float accel, float accelqw, float stretchfactor, float sidefric, float speedlimit) { float vel_straight; - float vel_z; + float velZ; vector vel_perpend; float step; @@ -523,7 +523,7 @@ void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float acce wishspeed0 = wishspeed; vel_straight = self.velocity * wishdir; - vel_z = self.velocity_z; + velZ = self.velocity.z; vel_xy = vec2(self.velocity); vel_perpend = vel_xy - vel_straight * wishdir; @@ -571,7 +571,7 @@ void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float acce } } - self.velocity = vel_xy + vel_z * '0 0 1'; + self.velocity = vel_xy + velZ * '0 0 1'; } void PM_AirAccelerate(vector wishdir, float wishspeed) @@ -702,7 +702,7 @@ void SV_PlayerPhysics() anticheat_physics(); - buttons = self.BUTTON_ATCK + 2 * self.BUTTON_JUMP + 4 * self.BUTTON_ATCK2 + 8 * self.BUTTON_ZOOM + 16 * self.BUTTON_CROUCH + 32 * self.BUTTON_HOOK + 64 * self.BUTTON_USE + 128 * (self.movement_x < 0) + 256 * (self.movement_x > 0) + 512 * (self.movement_y < 0) + 1024 * (self.movement_y > 0); + buttons = self.BUTTON_ATCK + 2 * self.BUTTON_JUMP + 4 * self.BUTTON_ATCK2 + 8 * self.BUTTON_ZOOM + 16 * self.BUTTON_CROUCH + 32 * self.BUTTON_HOOK + 64 * self.BUTTON_USE + 128 * (self.movement.x < 0) + 256 * (self.movement.x > 0) + 512 * (self.movement.y < 0) + 1024 * (self.movement.y > 0); if(!buttons) c = "x"; @@ -829,9 +829,9 @@ void SV_PlayerPhysics() { if(autocvar_sv_dodging_frozen && IS_REAL_CLIENT(self)) { - self.movement_x = bound(-5, self.movement_x, 5); - self.movement_y = bound(-5, self.movement_y, 5); - self.movement_z = bound(-5, self.movement_z, 5); + self.movement_x = bound(-5, self.movement.x, 5); + self.movement_y = bound(-5, self.movement.y, 5); + self.movement_z = bound(-5, self.movement.z, 5); } else self.movement = '0 0 0'; @@ -910,7 +910,7 @@ void SV_PlayerPhysics() if (!self.fixangle && !g_bugrigs) { self.angles_x = 0; - self.angles_y = self.v_angle_y; + self.angles_y = self.v_angle.y; self.angles_z = 0; } @@ -945,8 +945,8 @@ void SV_PlayerPhysics() if (self.flags & FL_WATERJUMP ) { - self.velocity_x = self.movedir_x; - self.velocity_y = self.movedir_y; + self.velocity_x = self.movedir.x; + self.velocity_y = self.movedir.y; if (time > self.teleport_time || self.waterlevel == WATERLEVEL_NONE) { self.flags &= ~FL_WATERJUMP; @@ -965,7 +965,7 @@ void SV_PlayerPhysics() self.velocity = self.velocity * (1 - frametime * autocvar_sv_friction); makevectors(self.v_angle); //wishvel = v_forward * self.movement_x + v_right * self.movement_y + v_up * self.movement_z; - wishvel = v_forward * self.movement_x + v_right * self.movement_y + '0 0 1' * self.movement_z; + wishvel = v_forward * self.movement.x + v_right * self.movement.y + '0 0 1' * self.movement.z; // acceleration wishdir = normalize(wishvel); wishspeed = vlen(wishvel); @@ -981,7 +981,7 @@ void SV_PlayerPhysics() makevectors(self.v_angle); //wishvel = v_forward * self.movement_x + v_right * self.movement_y + v_up * self.movement_z; - wishvel = v_forward * self.movement_x + v_right * self.movement_y + '0 0 1' * self.movement_z; + wishvel = v_forward * self.movement.x + v_right * self.movement.y + '0 0 1' * self.movement.z; if (wishvel == '0 0 0') wishvel = '0 0 -60'; // drift towards bottom @@ -1015,7 +1015,7 @@ void SV_PlayerPhysics() self.velocity = self.velocity * (1 - frametime * autocvar_sv_friction); makevectors(self.v_angle); //wishvel = v_forward * self.movement_x + v_right * self.movement_y + v_up * self.movement_z; - wishvel = v_forward * self.movement_x + v_right * self.movement_y + '0 0 1' * self.movement_z; + wishvel = v_forward * self.movement.x + v_right * self.movement.y + '0 0 1' * self.movement.z; self.velocity_z += g; if (self.ladder_entity.classname == "func_water") { @@ -1024,12 +1024,12 @@ void SV_PlayerPhysics() wishvel = wishvel * (self.ladder_entity.speed / f); self.watertype = self.ladder_entity.skin; - f = self.ladder_entity.origin_z + self.ladder_entity.maxs_z; - if ((self.origin_z + self.view_ofs_z) < f) + f = self.ladder_entity.origin.z + self.ladder_entity.maxs.z; + if ((self.origin.z + self.view_ofs.z) < f) self.waterlevel = WATERLEVEL_SUBMERGED; - else if ((self.origin_z + (self.mins_z + self.maxs_z) * 0.5) < f) + else if ((self.origin.z + (self.mins.z + self.maxs.z) * 0.5) < f) self.waterlevel = WATERLEVEL_SWIMMING; - else if ((self.origin_z + self.mins_z + 1) < f) + else if ((self.origin.z + self.mins.z + 1) < f) self.waterlevel = WATERLEVEL_WETFEET; else { @@ -1052,7 +1052,7 @@ void SV_PlayerPhysics() { //makevectors(self.v_angle_y * '0 1 0'); makevectors(self.v_angle); - wishvel = v_forward * self.movement_x + v_right * self.movement_y; + wishvel = v_forward * self.movement.x + v_right * self.movement.y; // add remaining speed as Z component maxairspd = autocvar_sv_maxairspeed*max(1, maxspd_mod); // fix speedhacks :P @@ -1069,10 +1069,10 @@ void SV_PlayerPhysics() a_up = autocvar_g_jetpack_acceleration_up; a_add = autocvar_g_jetpack_antigravity * autocvar_sv_gravity; - wishvel_x *= a_side; - wishvel_y *= a_side; - wishvel_z *= a_up; - wishvel_z += a_add; + wishvel.x *= a_side; + wishvel.y *= a_side; + wishvel.z *= a_up; + wishvel.z += a_add; float best; best = 0; @@ -1115,15 +1115,15 @@ void SV_PlayerPhysics() //print("best possible acceleration: ", ftos(best), "\n"); float fxy, fz; - fxy = bound(0, 1 - (self.velocity * normalize(wishvel_x * '1 0 0' + wishvel_y * '0 1 0')) / autocvar_g_jetpack_maxspeed_side, 1); - if(wishvel_z - autocvar_sv_gravity > 0) - fz = bound(0, 1 - self.velocity_z / autocvar_g_jetpack_maxspeed_up, 1); + fxy = bound(0, 1 - (self.velocity * normalize(wishvel.x * '1 0 0' + wishvel.y * '0 1 0')) / autocvar_g_jetpack_maxspeed_side, 1); + if(wishvel.z - autocvar_sv_gravity > 0) + fz = bound(0, 1 - self.velocity.z / autocvar_g_jetpack_maxspeed_up, 1); else - fz = bound(0, 1 + self.velocity_z / autocvar_g_jetpack_maxspeed_up, 1); + fz = bound(0, 1 + self.velocity.z / autocvar_g_jetpack_maxspeed_up, 1); - wishvel_x *= fxy; - wishvel_y *= fxy; - wishvel_z = (wishvel_z - autocvar_sv_gravity) * fz + autocvar_sv_gravity; + wishvel.x *= fxy; + wishvel.y *= fxy; + wishvel_z = (wishvel.z - autocvar_sv_gravity) * fz + autocvar_sv_gravity; float fvel; fvel = min(1, vlen(wishvel) / best); @@ -1153,8 +1153,8 @@ void SV_PlayerPhysics() Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_JETPACK_NOFUEL); // walking - makevectors(self.v_angle_y * '0 1 0'); - wishvel = v_forward * self.movement_x + v_right * self.movement_y; + makevectors(self.v_angle.y * '0 1 0'); + wishvel = v_forward * self.movement.x + v_right * self.movement.y; if(!(self.lastflags & FL_ONGROUND)) { @@ -1232,8 +1232,8 @@ void SV_PlayerPhysics() airaccel = autocvar_sv_airaccelerate; } // airborn - makevectors(self.v_angle_y * '0 1 0'); - wishvel = v_forward * self.movement_x + v_right * self.movement_y; + makevectors(self.v_angle.y * '0 1 0'); + wishvel = v_forward * self.movement.x + v_right * self.movement.y; // acceleration wishdir = normalize(wishvel); wishspeed = wishspeed0 = vlen(wishvel); @@ -1280,7 +1280,7 @@ void SV_PlayerPhysics() airaccelqw = copysign(1-GeomLerp(1-fabs(self.stat_sv_airaccel_qw), strafity, 1-fabs(self.stat_sv_airstrafeaccel_qw)), ((strafity > 0.5) ? self.stat_sv_airstrafeaccel_qw : self.stat_sv_airaccel_qw)); // !CPM - if(autocvar_sv_warsowbunny_turnaccel && accelerating && self.movement_y == 0 && self.movement_x != 0) + if(autocvar_sv_warsowbunny_turnaccel && accelerating && self.movement_y == 0 && self.movement.x != 0) PM_AirAccelerate(wishdir, wishspeed); else PM_Accelerate(wishdir, wishspeed, wishspeed0, airaccel, airaccelqw, autocvar_sv_airaccel_qw_stretchfactor, autocvar_sv_airaccel_sideways_friction / maxairspd, self.stat_sv_airspeedlimit_nonqw); @@ -1292,9 +1292,9 @@ void SV_PlayerPhysics() if((g_cts || g_race) && !IS_OBSERVER(self)) { - if(vlen(self.velocity - self.velocity_z * '0 0 1') > speedaward_speed) + if(vlen(self.velocity - self.velocity.z * '0 0 1') > speedaward_speed) { - speedaward_speed = vlen(self.velocity - self.velocity_z * '0 0 1'); + speedaward_speed = vlen(self.velocity - self.velocity.z * '0 0 1'); speedaward_holder = self.netname; speedaward_uid = self.crypto_idfp; speedaward_lastupdate = time; @@ -1318,7 +1318,7 @@ void SV_PlayerPhysics() // WEAPONTODO float xyspeed; - xyspeed = vlen('1 0 0' * self.velocity_x + '0 1 0' * self.velocity_y); + xyspeed = vlen('1 0 0' * self.velocity.x + '0 1 0' * self.velocity.y); if(self.weapon == WEP_VORTEX && WEP_CVAR(vortex, charge) && WEP_CVAR(vortex, charge_velocity_rate) && xyspeed > WEP_CVAR(vortex, charge_minspeed)) { // add a maximum of charge_velocity_rate when going fast (f = 1), gradually increasing from minspeed (f = 0) to maxspeed diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index d899b3db3..de1996552 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -156,8 +156,8 @@ void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, float damage = max(damage - 5, 1); v = healtharmor_applydamage(self.armorvalue, autocvar_g_balance_armor_blockpercent, deathtype, damage); - take = v_x; - save = v_y; + take = v.x; + save = v.y; if(sound_allowed(MSG_BROADCAST, attacker)) { @@ -323,7 +323,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht vector d; float f; ear1 = self.origin; - ear1_z += 0.125 * self.view_ofs_z + 0.875 * self.maxs_z; // 7/8 + ear1_z += 0.125 * self.view_ofs.z + 0.875 * self.maxs.z; // 7/8 ear2 = ear1; makevectors(self.angles); ear1 += v_right * -10; @@ -352,8 +352,8 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht v = healtharmor_applydamage(self.armorvalue, autocvar_g_balance_armor_blockpercent, deathtype, damage); - take = v_x; - save = v_y; + take = v.x; + save = v.y; if(attacker == self) { @@ -456,9 +456,9 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht if(IS_BOT_CLIENT(self) && self.health >= 1) { shake = damage * 5 / (bound(0,skill,100) + 1); - self.v_angle_x = self.v_angle_x + (random() * 2 - 1) * shake; - self.v_angle_y = self.v_angle_y + (random() * 2 - 1) * shake; - self.v_angle_x = bound(-90, self.v_angle_x, 90); + self.v_angle_x = self.v_angle.x + (random() * 2 - 1) * shake; + self.v_angle_y = self.v_angle.y + (random() * 2 - 1) * shake; + self.v_angle_x = bound(-90, self.v_angle.x, 90); } } else @@ -603,7 +603,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht animdecide_setstate(self, self.anim_state | ANIMSTATE_DEAD1, TRUE); else animdecide_setstate(self, self.anim_state | ANIMSTATE_DEAD2, TRUE); - if (self.maxs_z > 5) + if (self.maxs.z > 5) { self.maxs_z = 5; setsize(self, self.mins, self.maxs); diff --git a/qcsrc/server/command/radarmap.qc b/qcsrc/server/command/radarmap.qc index f2205b68d..9706996a4 100644 --- a/qcsrc/server/command/radarmap.qc +++ b/qcsrc/server/command/radarmap.qc @@ -64,13 +64,13 @@ float RadarMapAtPoint_LineBlock(float x, float y, float w, float h, float zmin, ma = '1 0 0' * w + '0 1 0' * h + dz; o = '1 0 0' * x + '0 1 0' * y + '0 0 1' * zmin; - if(x < world.absmin_x - w) + if(x < world.absmin.x - w) return 0; - if(y < world.absmin_y - h) + if(y < world.absmin.y - h) return 0; - if(x > world.absmax_x) + if(x > world.absmax.x) return 0; - if(y > world.absmax_y) + if(y > world.absmax.y) return 0; r = 0; @@ -78,12 +78,12 @@ float RadarMapAtPoint_LineBlock(float x, float y, float w, float h, float zmin, { vector v1, v2; v1 = v2 = o + dz * i + mi; - v1_x += random() * (ma_x - mi_x); - v1_y += random() * (ma_y - mi_y); - v1_z += random() * (ma_z - mi_z); - v2_x += random() * (ma_x - mi_x); - v2_y += random() * (ma_y - mi_y); - v2_z += random() * (ma_z - mi_z); + v1_x += random() * (ma.x - mi.x); + v1_y += random() * (ma.y - mi.y); + v1_z += random() * (ma.z - mi.z); + v2_x += random() * (ma.x - mi.x); + v2_y += random() * (ma.y - mi.y); + v2_z += random() * (ma.z - mi.z); traceline(v1, v2, MOVE_WORLDONLY, world); if(trace_startsolid || trace_fraction < 1) ++r; @@ -104,13 +104,13 @@ float RadarMapAtPoint_Block(float x, float y, float w, float h, float zmin, floa ma = '1 0 0' * w + '0 1 0' * h + dz; o = '1 0 0' * x + '0 1 0' * y + '0 0 1' * zmin; - if(x < world.absmin_x - w) + if(x < world.absmin.x - w) return 0; - if(y < world.absmin_y - h) + if(y < world.absmin.y - h) return 0; - if(x > world.absmax_x) + if(x > world.absmax.x) return 0; - if(y > world.absmax_y) + if(y > world.absmax.y) return 0; r = 0; @@ -142,9 +142,9 @@ float RadarMapAtPoint_Sample(float x, float y, float w, float h, float zmin, flo for(i = 0; i < q; ++i) { vector v; - v_x = a_x + random() * b_x; - v_y = a_y + random() * b_y; - v_z = a_z + random() * b_z; + v_x = a.x + random() * b.x; + v_y = a.y + random() * b.y; + v_z = a.z + random() * b.z; traceline(v, v, MOVE_WORLDONLY, world); if(trace_startsolid) ++c; @@ -213,7 +213,7 @@ void RadarMap_Next() } else if(radarmapper.count & 2) { - localcmd(strcat("defer 1 \"sv_cmd radarmap --flags ", ftos(radarmapper.count), strcat(" --res ", ftos(radarmapper.size_x), " ", ftos(radarmapper.size_y), " --sharpen ", ftos(radarmapper.ltime), " --qual ", ftos(radarmapper.size_z)), "\"\n")); + localcmd(strcat("defer 1 \"sv_cmd radarmap --flags ", ftos(radarmapper.count), strcat(" --res ", ftos(radarmapper.size.x), " ", ftos(radarmapper.size.y), " --sharpen ", ftos(radarmapper.ltime), " --qual ", ftos(radarmapper.size.z)), "\"\n")); GotoNextMap(0); } remove(radarmapper); @@ -235,10 +235,10 @@ void RadarMap_Think() // initialize get_mi_min_max_texcoords(1); self.mins = mi_picmin; - self.maxs_x = (mi_picmax_x - mi_picmin_x) / self.size_x; - self.maxs_y = (mi_picmax_y - mi_picmin_y) / self.size_y; - self.maxs_z = mi_max_z - mi_min_z; - print("Picture mins/maxs: ", ftos(self.maxs_x), " and ", ftos(self.maxs_y), " should match\n"); + self.maxs_x = (mi_picmax.x - mi_picmin.x) / self.size.x; + self.maxs_y = (mi_picmax.y - mi_picmin.y) / self.size.y; + self.maxs_z = mi_max.z - mi_min.z; + print("Picture mins/maxs: ", ftos(self.maxs.x), " and ", ftos(self.maxs.y), " should match\n"); self.netname = strzone(strcat("gfx/", mi_shortname, "_radar.xpm")); if(!(self.count & 1)) { @@ -276,7 +276,7 @@ void RadarMap_Think() fputs(self.cnt, "/* XPM */\n"); fputs(self.cnt, "static char *RadarMap[] = {\n"); fputs(self.cnt, "/* columns rows colors chars-per-pixel */\n"); - fputs(self.cnt, strcat("\"", ftos(self.size_x), " ", ftos(self.size_y), " 256 2\",\n")); + fputs(self.cnt, strcat("\"", ftos(self.size.x), " ", ftos(self.size.y), " 256 2\",\n")); for(i = 0; i < 256; ++i) { si = substring(doublehex, i*2, 2); @@ -284,42 +284,42 @@ void RadarMap_Think() } self.frame += 1; self.nextthink = time; - sharpen_init(self.size_x); + sharpen_init(self.size.x); } - else if(self.frame <= self.size_y) + else if(self.frame <= self.size.y) { // fill the sharpen buffer with this line - sharpen_shift(self.size_x); + sharpen_shift(self.size.x); i = self.count & 24; switch(i) { case 0: default: - for(x = 0; x < self.size_x; ++x) + for(x = 0; x < self.size.x; ++x) { - l = RadarMapAtPoint_Block(self.mins_x + x * self.maxs_x, self.mins_y + (self.size_y - self.frame) * self.maxs_y, self.maxs_x, self.maxs_y, self.mins_z, self.maxs_z, self.size_z); + l = RadarMapAtPoint_Block(self.mins.x + x * self.maxs.x, self.mins.y + (self.size.y - self.frame) * self.maxs.y, self.maxs.x, self.maxs.y, self.mins.z, self.maxs.z, self.size.z); sharpen_set(x, l); } break; case 8: - for(x = 0; x < self.size_x; ++x) + for(x = 0; x < self.size.x; ++x) { - l = RadarMapAtPoint_Trace(self.mins_x + x * self.maxs_x, self.mins_y + (self.size_y - self.frame) * self.maxs_y, self.maxs_x, self.maxs_y, self.mins_z, self.maxs_z, self.size_z); + l = RadarMapAtPoint_Trace(self.mins.x + x * self.maxs.x, self.mins.y + (self.size.y - self.frame) * self.maxs.y, self.maxs.x, self.maxs.y, self.mins.z, self.maxs.z, self.size.z); sharpen_set(x, l); } break; case 16: - for(x = 0; x < self.size_x; ++x) + for(x = 0; x < self.size.x; ++x) { - l = RadarMapAtPoint_Sample(self.mins_x + x * self.maxs_x, self.mins_y + (self.size_y - self.frame) * self.maxs_y, self.maxs_x, self.maxs_y, self.mins_z, self.maxs_z, self.size_z); + l = RadarMapAtPoint_Sample(self.mins.x + x * self.maxs.x, self.mins.y + (self.size.y - self.frame) * self.maxs.y, self.maxs.x, self.maxs.y, self.mins.z, self.maxs.z, self.size.z); sharpen_set(x, l); } break; case 24: - for(x = 0; x < self.size_x; ++x) + for(x = 0; x < self.size.x; ++x) { - l = RadarMapAtPoint_LineBlock(self.mins_x + x * self.maxs_x, self.mins_y + (self.size_y - self.frame) * self.maxs_y, self.maxs_x, self.maxs_y, self.mins_z, self.maxs_z, self.size_z); + l = RadarMapAtPoint_LineBlock(self.mins.x + x * self.maxs.x, self.mins.y + (self.size.y - self.frame) * self.maxs.y, self.maxs.x, self.maxs.y, self.mins.z, self.maxs.z, self.size.z); sharpen_set(x, l); } break; @@ -330,37 +330,37 @@ void RadarMap_Think() { // write a pixel line fputs(self.cnt, "\""); - for(x = 0; x < self.size_x; ++x) + for(x = 0; x < self.size.x; ++x) { l = sharpen_get(x, self.ltime); fputs(self.cnt, substring(doublehex, 2 * floor(l * 256.0), 2)); } - if(self.frame == self.size_y) + if(self.frame == self.size.y) fputs(self.cnt, "\"\n"); else { fputs(self.cnt, "\",\n"); - print(ftos(self.size_y - self.frame), " lines left\n"); + print(ftos(self.size.y - self.frame), " lines left\n"); } } // is this the last line? then write back the missing line - if(self.frame == self.size_y) + if(self.frame == self.size.y) { - sharpen_shift(self.size_x); + sharpen_shift(self.size.x); // write a pixel line fputs(self.cnt, "\""); - for(x = 0; x < self.size_x; ++x) + for(x = 0; x < self.size.x; ++x) { l = sharpen_get(x, self.ltime); fputs(self.cnt, substring(doublehex, 2 * floor(l * 256.0), 2)); } - if(self.frame == self.size_y) + if(self.frame == self.size.y) fputs(self.cnt, "\"\n"); else { fputs(self.cnt, "\",\n"); - print(ftos(self.size_y - self.frame), " lines left\n"); + print(ftos(self.size.y - self.frame), " lines left\n"); } } diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index ad4f4da52..7ff97da65 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -272,77 +272,77 @@ void GameCommand_bbox(float request) { case CMD_REQUEST_COMMAND: { - print("Original size: ", ftos(world.absmin_x), " ", ftos(world.absmin_y), " ", ftos(world.absmin_z)); - print(" ", ftos(world.absmax_x), " ", ftos(world.absmax_y), " ", ftos(world.absmax_z), "\n"); - print("Currently set size: ", ftos(world.mins_x), " ", ftos(world.mins_y), " ", ftos(world.mins_z)); - print(" ", ftos(world.maxs_x), " ", ftos(world.maxs_y), " ", ftos(world.maxs_z), "\n"); + print("Original size: ", ftos(world.absmin.x), " ", ftos(world.absmin.y), " ", ftos(world.absmin.z)); + print(" ", ftos(world.absmax.x), " ", ftos(world.absmax.y), " ", ftos(world.absmax.z), "\n"); + print("Currently set size: ", ftos(world.mins.x), " ", ftos(world.mins.y), " ", ftos(world.mins.z)); + print(" ", ftos(world.maxs.x), " ", ftos(world.maxs.y), " ", ftos(world.maxs.z), "\n"); print("Solid bounding box size:"); - tracebox('1 0 0' * world.absmin_x, - '0 1 0' * world.absmin_y + '0 0 1' * world.absmin_z, - '0 1 0' * world.absmax_y + '0 0 1' * world.absmax_z, - '1 0 0' * world.absmax_x, + tracebox('1 0 0' * world.absmin.x, + '0 1 0' * world.absmin.y + '0 0 1' * world.absmin.z, + '0 1 0' * world.absmax.y + '0 0 1' * world.absmax.z, + '1 0 0' * world.absmax.x, MOVE_WORLDONLY, world); if(trace_startsolid) - print(" ", ftos(world.absmin_x)); + print(" ", ftos(world.absmin.x)); else - print(" ", ftos(trace_endpos_x)); + print(" ", ftos(trace_endpos.x)); - tracebox('0 1 0' * world.absmin_y, - '1 0 0' * world.absmin_x + '0 0 1' * world.absmin_z, - '1 0 0' * world.absmax_x + '0 0 1' * world.absmax_z, - '0 1 0' * world.absmax_y, + tracebox('0 1 0' * world.absmin.y, + '1 0 0' * world.absmin.x + '0 0 1' * world.absmin.z, + '1 0 0' * world.absmax.x + '0 0 1' * world.absmax.z, + '0 1 0' * world.absmax.y, MOVE_WORLDONLY, world); if(trace_startsolid) - print(" ", ftos(world.absmin_y)); + print(" ", ftos(world.absmin.y)); else - print(" ", ftos(trace_endpos_y)); + print(" ", ftos(trace_endpos.y)); - tracebox('0 0 1' * world.absmin_z, - '1 0 0' * world.absmin_x + '0 1 0' * world.absmin_y, - '1 0 0' * world.absmax_x + '0 1 0' * world.absmax_y, - '0 0 1' * world.absmax_z, + tracebox('0 0 1' * world.absmin.z, + '1 0 0' * world.absmin.x + '0 1 0' * world.absmin.y, + '1 0 0' * world.absmax.x + '0 1 0' * world.absmax.y, + '0 0 1' * world.absmax.z, MOVE_WORLDONLY, world); if(trace_startsolid) - print(" ", ftos(world.absmin_z)); + print(" ", ftos(world.absmin.z)); else - print(" ", ftos(trace_endpos_z)); + print(" ", ftos(trace_endpos.z)); - tracebox('1 0 0' * world.absmax_x, - '0 1 0' * world.absmin_y + '0 0 1' * world.absmin_z, - '0 1 0' * world.absmax_y + '0 0 1' * world.absmax_z, - '1 0 0' * world.absmin_x, + tracebox('1 0 0' * world.absmax.x, + '0 1 0' * world.absmin.y + '0 0 1' * world.absmin.z, + '0 1 0' * world.absmax.y + '0 0 1' * world.absmax.z, + '1 0 0' * world.absmin.x, MOVE_WORLDONLY, world); if(trace_startsolid) - print(" ", ftos(world.absmax_x)); + print(" ", ftos(world.absmax.x)); else - print(" ", ftos(trace_endpos_x)); + print(" ", ftos(trace_endpos.x)); - tracebox('0 1 0' * world.absmax_y, - '1 0 0' * world.absmin_x + '0 0 1' * world.absmin_z, - '1 0 0' * world.absmax_x + '0 0 1' * world.absmax_z, - '0 1 0' * world.absmin_y, + tracebox('0 1 0' * world.absmax.y, + '1 0 0' * world.absmin.x + '0 0 1' * world.absmin.z, + '1 0 0' * world.absmax.x + '0 0 1' * world.absmax.z, + '0 1 0' * world.absmin.y, MOVE_WORLDONLY, world); if(trace_startsolid) - print(" ", ftos(world.absmax_y)); + print(" ", ftos(world.absmax.y)); else - print(" ", ftos(trace_endpos_y)); + print(" ", ftos(trace_endpos.y)); - tracebox('0 0 1' * world.absmax_z, - '1 0 0' * world.absmin_x + '0 1 0' * world.absmin_y, - '1 0 0' * world.absmax_x + '0 1 0' * world.absmax_y, - '0 0 1' * world.absmin_z, + tracebox('0 0 1' * world.absmax.z, + '1 0 0' * world.absmin.x + '0 1 0' * world.absmin.y, + '1 0 0' * world.absmax.x + '0 1 0' * world.absmax.y, + '0 0 1' * world.absmin.z, MOVE_WORLDONLY, world); if(trace_startsolid) - print(" ", ftos(world.absmax_z)); + print(" ", ftos(world.absmax.z)); else - print(" ", ftos(trace_endpos_z)); + print(" ", ftos(trace_endpos.z)); print("\n"); return; @@ -838,14 +838,14 @@ void GameCommand_gettaginfo(float request, float argc) v = gettaginfo(tmp_entity, i); print("model ", tmp_entity.model, " frame ", ftos(tmp_entity.frame), " tag ", gettaginfo_name); print(" index ", ftos(i), " parent ", ftos(gettaginfo_parent), "\n"); - print(" vector = ", ftos(v_x), " ", ftos(v_y), " ", ftos(v_z), "\n"); - print(" offset = ", ftos(gettaginfo_offset_x), " ", ftos(gettaginfo_offset_y), " ", ftos(gettaginfo_offset_z), "\n"); - print(" forward = ", ftos(gettaginfo_forward_x), " ", ftos(gettaginfo_forward_y), " ", ftos(gettaginfo_forward_z), "\n"); - print(" right = ", ftos(gettaginfo_right_x), " ", ftos(gettaginfo_right_y), " ", ftos(gettaginfo_right_z), "\n"); - print(" up = ", ftos(gettaginfo_up_x), " ", ftos(gettaginfo_up_y), " ", ftos(gettaginfo_up_z), "\n"); + print(" vector = ", ftos(v.x), " ", ftos(v.y), " ", ftos(v.z), "\n"); + print(" offset = ", ftos(gettaginfo_offset.x), " ", ftos(gettaginfo_offset.y), " ", ftos(gettaginfo_offset.z), "\n"); + print(" forward = ", ftos(gettaginfo_forward.x), " ", ftos(gettaginfo_forward.y), " ", ftos(gettaginfo_forward.z), "\n"); + print(" right = ", ftos(gettaginfo_right.x), " ", ftos(gettaginfo_right.y), " ", ftos(gettaginfo_right.z), "\n"); + print(" up = ", ftos(gettaginfo_up.x), " ", ftos(gettaginfo_up.y), " ", ftos(gettaginfo_up.z), "\n"); if(argc >= 6) { - v_y = -v_y; + v_y = -v.y; localcmd(strcat(argv(4), vtos(v), argv(5), "\n")); } } @@ -1523,13 +1523,13 @@ void GameCommand_trace(float request, float argc) org = world.mins; delta = world.maxs - world.mins; - start_x = org_x + random() * delta_x; - start_y = org_y + random() * delta_y; - start_z = org_z + random() * delta_z; + start_x = org.x + random() * delta.x; + start_y = org.y + random() * delta.y; + start_z = org.z + random() * delta.z; - end_x = org_x + random() * delta_x; - end_y = org_y + random() * delta_y; - end_z = org_z + random() * delta_z; + end_x = org.x + random() * delta.x; + end_y = org.y + random() * delta.y; + end_z = org.z + random() * delta.z; start = stov(vtos(start)); end = stov(vtos(end)); @@ -1622,17 +1622,17 @@ void GameCommand_trace(float request, float argc) for(i = 0; i < 100000; ++i) { dv = randomvec(); - if(dv_z > 0) + if(dv.z > 0) dv = -1 * dv; tracebox(vv, e.mins, e.maxs, vv + dv, MOVE_NORMAL, e); if(trace_startsolid) print("bug 1\n"); if(trace_fraction == 1) - if(dv_z < f) + if(dv.z < f) { - print("bug 2: ", ftos(dv_x), " ", ftos(dv_y), " ", ftos(dv_z)); - print(" (", ftos(asin(dv_z / vlen(dv)) * 180 / M_PI), " degrees)\n"); - f = dv_z; + print("bug 2: ", ftos(dv.x), " ", ftos(dv.y), " ", ftos(dv.z)); + print(" (", ftos(asin(dv.z / vlen(dv)) * 180 / M_PI), " degrees)\n"); + f = dv.z; } } print("highest possible dist: ", ftos(f), "\n"); diff --git a/qcsrc/server/csqceffects.qc b/qcsrc/server/csqceffects.qc index ea13aedd5..82ae49133 100644 --- a/qcsrc/server/csqceffects.qc +++ b/qcsrc/server/csqceffects.qc @@ -3,11 +3,11 @@ void te_csqc_lightningarc(vector from,vector to) WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); WriteByte(MSG_BROADCAST, TE_CSQC_ARC); - WriteCoord(MSG_BROADCAST, from_x); - WriteCoord(MSG_BROADCAST, from_y); - WriteCoord(MSG_BROADCAST, from_z); - WriteCoord(MSG_BROADCAST, to_x); - WriteCoord(MSG_BROADCAST, to_y); - WriteCoord(MSG_BROADCAST, to_z); + WriteCoord(MSG_BROADCAST, from.x); + WriteCoord(MSG_BROADCAST, from.y); + WriteCoord(MSG_BROADCAST, from.z); + WriteCoord(MSG_BROADCAST, to.x); + WriteCoord(MSG_BROADCAST, to.y); + WriteCoord(MSG_BROADCAST, to.z); } diff --git a/qcsrc/server/ent_cs.qc b/qcsrc/server/ent_cs.qc index 7b3af04bf..4bec01a96 100644 --- a/qcsrc/server/ent_cs.qc +++ b/qcsrc/server/ent_cs.qc @@ -45,12 +45,12 @@ float entcs_send(entity to, float sf) WriteByte(MSG_ENTITY, num_for_edict(self.owner)-1); if(sf & 2) { - WriteShort(MSG_ENTITY, self.origin_x); - WriteShort(MSG_ENTITY, self.origin_y); - WriteShort(MSG_ENTITY, self.origin_z); + WriteShort(MSG_ENTITY, self.origin.x); + WriteShort(MSG_ENTITY, self.origin.y); + WriteShort(MSG_ENTITY, self.origin.z); } if(sf & 4) - WriteByte(MSG_ENTITY, self.angles_y * 256.0 / 360); + WriteByte(MSG_ENTITY, self.angles.y * 256.0 / 360); if(sf & 8) WriteByte(MSG_ENTITY, self.health / 10); // FIXME use a better scale? if(sf & 16) @@ -70,7 +70,7 @@ void entcs_think() setorigin(self, o.origin); self.SendFlags |= 2; } - if(o.angles_y != self.angles_y) + if(o.angles.y != self.angles.y) { self.angles = o.angles; self.SendFlags |= 4; diff --git a/qcsrc/server/func_breakable.qc b/qcsrc/server/func_breakable.qc index 0b936a1d1..7b4f08651 100644 --- a/qcsrc/server/func_breakable.qc +++ b/qcsrc/server/func_breakable.qc @@ -41,9 +41,9 @@ void LaunchDebris (string debrisname, vector force) { entity dbr = spawn(); setorigin(dbr, self.absmin - + '1 0 0' * random() * (self.absmax_x - self.absmin_x) - + '0 1 0' * random() * (self.absmax_y - self.absmin_y) - + '0 0 1' * random() * (self.absmax_z - self.absmin_z)); + + '1 0 0' * random() * (self.absmax.x - self.absmin.x) + + '0 1 0' * random() * (self.absmax.y - self.absmin.y) + + '0 0 1' * random() * (self.absmax.z - self.absmin.z)); setmodel (dbr, debrisname ); dbr.skin = self.debrisskin; dbr.colormap = self.colormap; // inherit team colors @@ -52,13 +52,13 @@ void LaunchDebris (string debrisname, vector force) dbr.solid = self.debrissolid; if(dbr.solid != SOLID_BSP) // SOLID_BSP has exact collision, MAYBE this works? TODO check this out setsize(dbr, '0 0 0', '0 0 0'); // needed for performance, until engine can deal better with it - dbr.velocity_x = self.debrisvelocity_x + self.debrisvelocityjitter_x * crandom(); - dbr.velocity_y = self.debrisvelocity_y + self.debrisvelocityjitter_y * crandom(); - dbr.velocity_z = self.debrisvelocity_z + self.debrisvelocityjitter_z * crandom(); + dbr.velocity_x = self.debrisvelocity.x + self.debrisvelocityjitter.x * crandom(); + dbr.velocity_y = self.debrisvelocity.y + self.debrisvelocityjitter.y * crandom(); + dbr.velocity_z = self.debrisvelocity.z + self.debrisvelocityjitter.z * crandom(); self.velocity = self.velocity + force * self.debrisdamageforcescale; - dbr.avelocity_x = random()*self.debrisavelocityjitter_x; - dbr.avelocity_y = random()*self.debrisavelocityjitter_y; - dbr.avelocity_z = random()*self.debrisavelocityjitter_z; + dbr.avelocity_x = random()*self.debrisavelocityjitter.x; + dbr.avelocity_y = random()*self.debrisavelocityjitter.y; + dbr.avelocity_z = random()*self.debrisavelocityjitter.z; dbr.damageforcescale = self.debrisdamageforcescale; if(dbr.damageforcescale) dbr.takedamage = DAMAGE_YES; @@ -83,7 +83,7 @@ void func_breakable_colormod() void func_breakable_look_destroyed() { - float floor_z; + float floorZ; if(self.solid == SOLID_BSP) // in case a misc_follow moved me, save the current origin first self.dropped_origin = self.origin; @@ -92,9 +92,9 @@ void func_breakable_look_destroyed() self.model = ""; else { if (self.origin == '0 0 0') { // probably no origin brush, so don't spawn in the middle of the map.. - floor_z = self.absmin_z; + floorZ = self.absmin.z; setorigin(self,((self.absmax+self.absmin)*.5)); - self.origin_z = floor_z; + self.origin_z = floorZ; } setmodel(self, self.mdl_dead); } diff --git a/qcsrc/server/g_casings.qc b/qcsrc/server/g_casings.qc index e2c1c2938..5dea2ce7d 100644 --- a/qcsrc/server/g_casings.qc +++ b/qcsrc/server/g_casings.qc @@ -2,13 +2,13 @@ float Casing_SendEntity(entity to, float sf) { WriteByte(MSG_ENTITY, ENT_CLIENT_CASING); WriteByte(MSG_ENTITY, self.state); // actually type - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); - WriteShort(MSG_ENTITY, self.oldorigin_x); // acrually compressed velocity - WriteByte(MSG_ENTITY, self.angles_x * 256 / 360); - WriteByte(MSG_ENTITY, self.angles_y * 256 / 360); - WriteByte(MSG_ENTITY, self.angles_z * 256 / 360); + WriteCoord(MSG_ENTITY, self.origin.x); + WriteCoord(MSG_ENTITY, self.origin.y); + WriteCoord(MSG_ENTITY, self.origin.z); + WriteShort(MSG_ENTITY, self.oldorigin.x); // acrually compressed velocity + WriteByte(MSG_ENTITY, self.angles.x * 256 / 360); + WriteByte(MSG_ENTITY, self.angles.y * 256 / 360); + WriteByte(MSG_ENTITY, self.angles.z * 256 / 360); return TRUE; } @@ -17,7 +17,7 @@ void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float ran entity e; vector org; - org = self.origin + self.view_ofs + self.weaponentity.spawnorigin_x * v_forward - self.weaponentity.spawnorigin_y * v_right + self.weaponentity.spawnorigin_z * v_up; + org = self.origin + self.view_ofs + self.weaponentity.spawnorigin.x * v_forward - self.weaponentity.spawnorigin.y * v_right + self.weaponentity.spawnorigin.z * v_up; if(!sound_allowed(MSG_BROADCAST, casingowner)) casingtype |= 0x80; diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 4840e15dd..9b7f45d0c 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -7,13 +7,13 @@ float Damage_DamageInfo_SendEntity(entity to, float sf) { WriteByte(MSG_ENTITY, ENT_CLIENT_DAMAGEINFO); WriteShort(MSG_ENTITY, self.projectiledeathtype); - WriteCoord(MSG_ENTITY, floor(self.origin_x)); - WriteCoord(MSG_ENTITY, floor(self.origin_y)); - WriteCoord(MSG_ENTITY, floor(self.origin_z)); + WriteCoord(MSG_ENTITY, floor(self.origin.x)); + WriteCoord(MSG_ENTITY, floor(self.origin.y)); + WriteCoord(MSG_ENTITY, floor(self.origin.z)); WriteByte(MSG_ENTITY, bound(1, self.dmg, 255)); WriteByte(MSG_ENTITY, bound(0, self.dmg_radius, 255)); WriteByte(MSG_ENTITY, bound(1, self.dmg_edge, 255)); - WriteShort(MSG_ENTITY, self.oldorigin_x); + WriteShort(MSG_ENTITY, self.oldorigin.x); WriteByte(MSG_ENTITY, self.species); return TRUE; } @@ -724,18 +724,18 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float if(autocvar_g_mirrordamage_virtual) { vector v = healtharmor_applydamage(attacker.armorvalue, autocvar_g_balance_armor_blockpercent, deathtype, mirrordamage); - attacker.dmg_take += v_x; - attacker.dmg_save += v_y; + attacker.dmg_take += v.x; + attacker.dmg_save += v.y; attacker.dmg_inflictor = inflictor; - mirrordamage = v_z; + mirrordamage = v.z; mirrorforce = 0; } if(autocvar_g_friendlyfire_virtual) { vector v = healtharmor_applydamage(targ.armorvalue, autocvar_g_balance_armor_blockpercent, deathtype, damage); - targ.dmg_take += v_x; - targ.dmg_save += v_y; + targ.dmg_take += v.x; + targ.dmg_save += v.y; targ.dmg_inflictor = inflictor; damage = 0; if(!autocvar_g_friendlyfire_virtual_force) @@ -815,7 +815,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float self.oldvelocity = self.velocity; self.spawnorigin = spot.origin; - setorigin (self, spot.origin + '0 0 1' * (1 - self.mins_z - 24)); + setorigin (self, spot.origin + '0 0 1' * (1 - self.mins.z - 24)); // don't reset back to last position, even if new position is stuck in solid self.oldorigin = self.origin; self.prevorigin = self.origin; @@ -1087,9 +1087,9 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in else hitloc = nearest; } - nearest_x = targ.origin_x + targ.mins_x + random() * targ.size_x; - nearest_y = targ.origin_y + targ.mins_y + random() * targ.size_y; - nearest_z = targ.origin_z + targ.mins_z + random() * targ.size_z; + nearest_x = targ.origin.x + targ.mins.x + random() * targ.size.x; + nearest_y = targ.origin.y + targ.mins.y + random() * targ.size.y; + nearest_z = targ.origin.z + targ.mins.z + random() * targ.size.z; } nearest = hitloc * (1 / max(1, hits)); diff --git a/qcsrc/server/g_hook.qc b/qcsrc/server/g_hook.qc index eab482618..cb1aedd73 100644 --- a/qcsrc/server/g_hook.qc +++ b/qcsrc/server/g_hook.qc @@ -99,15 +99,15 @@ float GrapplingHookSend(entity to, float sf) } if(sf & 2) { - WriteCoord(MSG_ENTITY, self.hook_start_x); - WriteCoord(MSG_ENTITY, self.hook_start_y); - WriteCoord(MSG_ENTITY, self.hook_start_z); + WriteCoord(MSG_ENTITY, self.hook_start.x); + WriteCoord(MSG_ENTITY, self.hook_start.y); + WriteCoord(MSG_ENTITY, self.hook_start.z); } if(sf & 4) { - WriteCoord(MSG_ENTITY, self.hook_end_x); - WriteCoord(MSG_ENTITY, self.hook_end_y); - WriteCoord(MSG_ENTITY, self.hook_end_z); + WriteCoord(MSG_ENTITY, self.hook_end.x); + WriteCoord(MSG_ENTITY, self.hook_end.y); + WriteCoord(MSG_ENTITY, self.hook_end.z); } return TRUE; } @@ -138,7 +138,7 @@ void GrapplingHookThink() vs = hook_shotorigin[s]; makevectors(self.realowner.v_angle); - org = self.realowner.origin + self.realowner.view_ofs + v_forward * vs_x + v_right * -vs_y + v_up * vs_z; + org = self.realowner.origin + self.realowner.view_ofs + v_forward * vs.x + v_right * -vs.y + v_up * vs.z; myorg = WarpZone_RefSys_TransformOrigin(self.realowner, self, org); if(self.hook_length < 0) @@ -239,7 +239,7 @@ void GrapplingHookThink() } } - makevectors(self.angles_x * '-1 0 0' + self.angles_y * '0 1 0'); + makevectors(self.angles.x * '-1 0 0' + self.angles.y * '0 1 0'); myorg = WarpZone_RefSys_TransformOrigin(self, self.realowner, self.origin); // + v_forward * (-9); if(myorg != self.hook_start) @@ -312,7 +312,7 @@ void FireGrapplingHook (void) // UGLY WORKAROUND: play this on CH_WEAPON_B so it can't cut off fire sounds sound (self, CH_WEAPON_B, "weapons/hook_fire.wav", VOL_BASE, ATTEN_NORM); - org = self.origin + self.view_ofs + v_forward * vs_x + v_right * -vs_y + v_up * vs_z; + org = self.origin + self.view_ofs + v_forward * vs.x + v_right * -vs.y + v_up * vs.z; tracebox(self.origin + self.view_ofs, '-3 -3 -3', '3 3 3', org, MOVE_NORMAL, self); org = trace_endpos; diff --git a/qcsrc/server/g_models.qc b/qcsrc/server/g_models.qc index 8a2fe9ef3..a594cd521 100644 --- a/qcsrc/server/g_models.qc +++ b/qcsrc/server/g_models.qc @@ -35,7 +35,7 @@ void g_model_dropbyspawnflags() else if((self.spawnflags & 3) == 3) // ALIGN_ORIGIN | ALIGN_BOTTOM { traceline(self.origin, self.origin - '0 0 4096', MOVE_NOMONSTERS, self); - setorigin(self, trace_endpos - '0 0 1' * self.mins_z); + setorigin(self, trace_endpos - '0 0 1' * self.mins.z); } } @@ -71,18 +71,18 @@ float g_clientmodel_genericsendentity (entity to, float sf) if(sf & 2) { - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); + WriteCoord(MSG_ENTITY, self.origin.x); + WriteCoord(MSG_ENTITY, self.origin.y); + WriteCoord(MSG_ENTITY, self.origin.z); } if(sf & 4) { if(sf & 0x10) { - WriteAngle(MSG_ENTITY, self.angles_x); - WriteAngle(MSG_ENTITY, self.angles_y); - WriteAngle(MSG_ENTITY, self.angles_z); + WriteAngle(MSG_ENTITY, self.angles.x); + WriteAngle(MSG_ENTITY, self.angles.y); + WriteAngle(MSG_ENTITY, self.angles.z); } } @@ -102,12 +102,12 @@ float g_clientmodel_genericsendentity (entity to, float sf) WriteShort(MSG_ENTITY, floor(self.scale * 256)); if(sf & 0x20) { - WriteCoord(MSG_ENTITY, self.mins_x); - WriteCoord(MSG_ENTITY, self.mins_y); - WriteCoord(MSG_ENTITY, self.mins_z); - WriteCoord(MSG_ENTITY, self.maxs_x); - WriteCoord(MSG_ENTITY, self.maxs_y); - WriteCoord(MSG_ENTITY, self.maxs_z); + WriteCoord(MSG_ENTITY, self.mins.x); + WriteCoord(MSG_ENTITY, self.mins.y); + WriteCoord(MSG_ENTITY, self.mins.z); + WriteCoord(MSG_ENTITY, self.maxs.x); + WriteCoord(MSG_ENTITY, self.maxs.y); + WriteCoord(MSG_ENTITY, self.maxs.z); } WriteString(MSG_ENTITY, self.bgmscript); if(self.bgmscript != "") @@ -116,9 +116,9 @@ float g_clientmodel_genericsendentity (entity to, float sf) WriteByte(MSG_ENTITY, floor(self.bgmscriptdecay * 64)); WriteByte(MSG_ENTITY, floor(self.bgmscriptsustain * 255)); WriteByte(MSG_ENTITY, floor(self.bgmscriptrelease * 64)); - WriteCoord(MSG_ENTITY, self.movedir_x); - WriteCoord(MSG_ENTITY, self.movedir_y); - WriteCoord(MSG_ENTITY, self.movedir_z); + WriteCoord(MSG_ENTITY, self.movedir.x); + WriteCoord(MSG_ENTITY, self.movedir.y); + WriteCoord(MSG_ENTITY, self.movedir.z); WriteByte(MSG_ENTITY, floor(self.lip * 255)); } } @@ -146,9 +146,9 @@ float g_clientmodel_genericsendentity (entity to, float sf) Net_LinkEntity(self, TRUE, 0, g_clientmodel_genericsendentity); // non-solid model entities: -void spawnfunc_misc_gamemodel() { self.angles_x = -self.angles_x; G_MODEL_INIT (SOLID_NOT) } // model entity -void spawnfunc_misc_clientmodel() { self.angles_x = -self.angles_x; G_CLIENTMODEL_INIT(SOLID_NOT) } // model entity -void spawnfunc_misc_models() { self.angles_x = -self.angles_x; G_MODEL_INIT (SOLID_NOT) } // DEPRECATED old compat entity with confusing name, do not use +void spawnfunc_misc_gamemodel() { self.angles_x = -self.angles.x; G_MODEL_INIT (SOLID_NOT) } // model entity +void spawnfunc_misc_clientmodel() { self.angles_x = -self.angles.x; G_CLIENTMODEL_INIT(SOLID_NOT) } // model entity +void spawnfunc_misc_models() { self.angles_x = -self.angles.x; G_MODEL_INIT (SOLID_NOT) } // DEPRECATED old compat entity with confusing name, do not use // non-solid brush entities: void spawnfunc_func_illusionary() { G_MODEL_INIT (SOLID_NOT) } // Q1 name (WARNING: MISPREDICTED) diff --git a/qcsrc/server/g_subs.qc b/qcsrc/server/g_subs.qc index 7f8fc68d3..63dc67c1f 100644 --- a/qcsrc/server/g_subs.qc +++ b/qcsrc/server/g_subs.qc @@ -29,9 +29,9 @@ void setanim(entity e, vector anim, float looping, float override, float restart else return; } - e.animstate_startframe = anim_x; - e.animstate_numframes = anim_y; - e.animstate_framerate = anim_z; + e.animstate_startframe = anim.x; + e.animstate_numframes = anim.y; + e.animstate_framerate = anim.z; e.animstate_starttime = servertime - 0.1 * serverframetime; // shift it a little bit into the past to prevent float inaccuracy hiccups e.animstate_endtime = e.animstate_starttime + e.animstate_numframes / e.animstate_framerate; e.animstate_looping = looping; @@ -180,12 +180,12 @@ void SUB_CalcMove_controller_think (void) vector destangle; destangle = delta + 2 * delta2 * phasepos; destangle = vectoangles(destangle); - destangle_x = -destangle_x; // flip up / down orientation + destangle_x = -destangle.x; // flip up / down orientation // take the shortest distance for the angles - self.owner.angles_x -= 360 * floor((self.owner.angles_x - destangle_x) / 360 + 0.5); - self.owner.angles_y -= 360 * floor((self.owner.angles_y - destangle_y) / 360 + 0.5); - self.owner.angles_z -= 360 * floor((self.owner.angles_z - destangle_z) / 360 + 0.5); + self.owner.angles_x -= 360 * floor((self.owner.angles.x - destangle.x) / 360 + 0.5); + self.owner.angles_y -= 360 * floor((self.owner.angles.y - destangle.y) / 360 + 0.5); + self.owner.angles_z -= 360 * floor((self.owner.angles.z - destangle.z) / 360 + 0.5); angloc = destangle - self.owner.angles; angloc = angloc * (1 / sys_frametime); // so it arrives for the next frame self.owner.avelocity = angloc; @@ -392,9 +392,9 @@ void SUB_CalcAngleMove (vector destangle, float tspeedtype, float tspeed, void() objerror ("No speed is defined!"); // take the shortest distance for the angles - self.angles_x -= 360 * floor((self.angles_x - destangle_x) / 360 + 0.5); - self.angles_y -= 360 * floor((self.angles_y - destangle_y) / 360 + 0.5); - self.angles_z -= 360 * floor((self.angles_z - destangle_z) / 360 + 0.5); + self.angles_x -= 360 * floor((self.angles.x - destangle.x) / 360 + 0.5); + self.angles_y -= 360 * floor((self.angles.y - destangle.y) / 360 + 0.5); + self.angles_z -= 360 * floor((self.angles.z - destangle.z) / 360 + 0.5); delta = destangle - self.angles; switch(tspeedtype) @@ -651,9 +651,9 @@ vector findbetterlocation (vector org, float mindist) } if (c & 1) { - h = vec_y; - vec_y = vec_x; - vec_x = vec_z; + h = vec.y; + vec_y = vec.x; + vec_x = vec.z; vec_z = h; } c = c + 1; @@ -809,24 +809,24 @@ void LODmodel_attach() void ApplyMinMaxScaleAngles(entity e) { - if(e.angles_x != 0 || e.angles_z != 0 || self.avelocity_x != 0 || self.avelocity_z != 0) // "weird" rotation + if(e.angles.x != 0 || e.angles.z != 0 || self.avelocity.x != 0 || self.avelocity.z != 0) // "weird" rotation { e.maxs = '1 1 1' * vlen( - '1 0 0' * max(-e.mins_x, e.maxs_x) + - '0 1 0' * max(-e.mins_y, e.maxs_y) + - '0 0 1' * max(-e.mins_z, e.maxs_z) + '1 0 0' * max(-e.mins.x, e.maxs.x) + + '0 1 0' * max(-e.mins.y, e.maxs.y) + + '0 0 1' * max(-e.mins.z, e.maxs.z) ); e.mins = -e.maxs; } - else if(e.angles_y != 0 || self.avelocity_y != 0) // yaw only is a bit better + else if(e.angles.y != 0 || self.avelocity.y != 0) // yaw only is a bit better { e.maxs_x = vlen( - '1 0 0' * max(-e.mins_x, e.maxs_x) + - '0 1 0' * max(-e.mins_y, e.maxs_y) + '1 0 0' * max(-e.mins.x, e.maxs.x) + + '0 1 0' * max(-e.mins.y, e.maxs.y) ); - e.maxs_y = e.maxs_x; - e.mins_x = -e.maxs_x; - e.mins_y = -e.maxs_x; + e.maxs_y = e.maxs.x; + e.mins_x = -e.maxs.x; + e.mins_y = -e.maxs.x; } if(e.scale) setsize(e, e.mins * e.scale, e.maxs * e.scale); diff --git a/qcsrc/server/g_tetris.qc b/qcsrc/server/g_tetris.qc index 72e2fbda0..d7e47c077 100644 --- a/qcsrc/server/g_tetris.qc +++ b/qcsrc/server/g_tetris.qc @@ -208,13 +208,13 @@ float PieceMetric(float x, float y, float rot, float pc) // x = X-cx // y = Y-cy t = y; - y = x - ce_x + ce_y; - x = -t + ce_x + ce_y; + y = x - ce.x + ce.y; + x = -t + ce.x + ce.y; } else if (rot == 2)//180 { - x = 2 * ce_x - x; - y = 2 * ce_y - y; + x = 2 * ce.x - x; + y = 2 * ce.y - y; } else if (rot == 3) // 270 { @@ -223,16 +223,16 @@ float PieceMetric(float x, float y, float rot, float pc) // x = X-cx // y = Y-cy t = y; - y = -x + ce_y + ce_x; - x = t - ce_y + ce_x; + y = -x + ce.y + ce.x; + x = t - ce.y + ce.x; } if (x < 1 || y < 1 || x > 4 || y > 2) return 0; ce = PieceShape(pc); if (y == 1) - return !!(ce_x & pow(4, x-1)); // first row + return !!(ce.x & pow(4, x-1)); // first row else if (y == 2) - return !!(ce_y & pow(4, x-1)); // second row + return !!(ce.y & pow(4, x-1)); // second row else return 0; // illegal parms } @@ -250,8 +250,8 @@ void PieceMinsMaxs(float rot, float pc) // 2 = 2..3 // 3 = 1..3 // 4 = 1..4 - tet_piecemins_x = floor(3.0 - sz_x * 0.5); - tet_piecemaxs_x = floor(2.0 + sz_x * 0.5); + tet_piecemins_x = floor(3.0 - sz.x * 0.5); + tet_piecemaxs_x = floor(2.0 + sz.x * 0.5); if(sz_y == 1) { // special case for "I" @@ -260,20 +260,20 @@ void PieceMinsMaxs(float rot, float pc) else { tet_piecemins_y = 1; - tet_piecemaxs_y = sz_y; + tet_piecemaxs_y = sz.y; } //printf("ce%v sz%v mi%v ma%v\n", ce, sz, tet_piecemins, tet_piecemaxs); if (rot == 1) // 90 degrees { - t = tet_piecemins_y; - tet_piecemins_y = -tet_piecemins_x + ce_y + ce_x; - tet_piecemins_x = t - ce_y + ce_x; - t = tet_piecemaxs_y; - tet_piecemaxs_y = -tet_piecemaxs_x + ce_y + ce_x; - tet_piecemaxs_x = t - ce_y + ce_x; + t = tet_piecemins.y; + tet_piecemins_y = -tet_piecemins.x + ce.y + ce.x; + tet_piecemins_x = t - ce.y + ce.x; + t = tet_piecemaxs.y; + tet_piecemaxs_y = -tet_piecemaxs.x + ce.y + ce.x; + tet_piecemaxs_x = t - ce.y + ce.x; // swap mins_y, maxs_y - t = tet_piecemins_y; - tet_piecemins_y = tet_piecemaxs_y; + t = tet_piecemins.y; + tet_piecemins_y = tet_piecemaxs.y; tet_piecemaxs_y = t; // TODO OPTIMIZE } @@ -285,24 +285,24 @@ void PieceMinsMaxs(float rot, float pc) } else if (rot == 3) // 270 { - t = tet_piecemins_y; - tet_piecemins_y = tet_piecemins_x - ce_x + ce_y; - tet_piecemins_x = -t + ce_x + ce_y; - t = tet_piecemaxs_y; - tet_piecemaxs_y = tet_piecemaxs_x - ce_x + ce_y; - tet_piecemaxs_x = -t + ce_x + ce_y; + t = tet_piecemins.y; + tet_piecemins_y = tet_piecemins.x - ce.x + ce.y; + tet_piecemins_x = -t + ce.x + ce.y; + t = tet_piecemaxs.y; + tet_piecemaxs_y = tet_piecemaxs.x - ce.x + ce.y; + tet_piecemaxs_x = -t + ce.x + ce.y; // swap mins_x, maxs_x - t = tet_piecemins_x; - tet_piecemins_x = tet_piecemaxs_x; + t = tet_piecemins.x; + tet_piecemins_x = tet_piecemaxs.x; tet_piecemaxs_x = t; // TODO OPTIMIZE } #ifdef VERIFY print(vtos(tet_piecemins), "-"); print(vtos(tet_piecemaxs), "\n"); - if(tet_piecemins_x > tet_piecemaxs_x) + if(tet_piecemins.x > tet_piecemaxs.x) error("inconsistent mins/maxs"); - if(tet_piecemins_y > tet_piecemaxs_y) + if(tet_piecemins.y > tet_piecemaxs.y) error("inconsistent mins/maxs"); float i, j; vector realmins, realmaxs; @@ -312,10 +312,10 @@ void PieceMinsMaxs(float rot, float pc) for(j = 1; j <= 4; ++j) if(PieceMetric(i, j, rot, pc)) { - realmins_x = min(realmins_x, i); - realmins_y = min(realmins_y, j); - realmaxs_x = max(realmaxs_x, i); - realmaxs_y = max(realmaxs_y, j); + realmins_x = min(realmins.x, i); + realmins_y = min(realmins.y, j); + realmaxs_x = max(realmaxs.x, i); + realmaxs_y = max(realmaxs.y, j); } if(realmins != tet_piecemins || realmaxs != tet_piecemaxs) error(sprintf("incorrect mins/maxs: %v %v in %d rot %d mins %v maxs %v\n", realmins, realmaxs, rot, pc, tet_piecemins, tet_piecemaxs)); @@ -394,9 +394,9 @@ void DrawPiece(float pc, float ln) piece_dat = PieceShape(pc); if (ln == 1) - piece_ln = piece_dat_x; + piece_ln = piece_dat.x; else - piece_ln = piece_dat_y; + piece_ln = piece_dat.y; for (x = 1; x <= 4; x = x + 1) { if (piece_ln & pow(4, x-1)) @@ -819,13 +819,13 @@ float CheckMetrics(float piece, float orgx, float orgy, float rot) /*FIXDECL*/ orgy = orgy - 1; PieceMinsMaxs(rot, piece); - if (tet_piecemins_x+orgx<1 || tet_piecemaxs_x+orgx > TET_WIDTH || tet_piecemins_y+orgy<1 || tet_piecemaxs_y+orgy> TET_LINES) + if (tet_piecemins.x+orgx<1 || tet_piecemaxs.x+orgx > TET_WIDTH || tet_piecemins.y+orgy<1 || tet_piecemaxs.y+orgy> TET_LINES) return FALSE; // ouside the level - for (y = tet_piecemins_y; y <= tet_piecemaxs_y; y = y + 1) + for (y = tet_piecemins.y; y <= tet_piecemaxs.y; y = y + 1) { l = GetLine(y + orgy); if(l != TET_EMPTY_LINE) - for (x = tet_piecemins_x; x <= tet_piecemaxs_x; x = x + 1) + for (x = tet_piecemins.x; x <= tet_piecemaxs.x; x = x + 1) if (PieceMetric(x, y, rot, piece)) if (GetXBlock(x + orgx, l)) return FALSE; // uhoh, gonna hit something. @@ -841,9 +841,9 @@ void ClearPiece(float piece, float orgx, float orgy, float rot) /*FIXDECL*/ orgy = orgy - 1; PieceMinsMaxs(rot, piece); - for (y = tet_piecemins_y; y <= tet_piecemaxs_y; y = y + 1) + for (y = tet_piecemins.y; y <= tet_piecemaxs.y; y = y + 1) { - for (x = tet_piecemins_x; x <= tet_piecemaxs_x; x = x + 1) + for (x = tet_piecemins.x; x <= tet_piecemaxs.x; x = x + 1) { if (PieceMetric(x, y, rot, piece)) { @@ -863,9 +863,9 @@ void CementPiece(float piece, float orgx, float orgy, float rot) /*FIXDECL*/ pcolor = PieceColor(piece); PieceMinsMaxs(rot, piece); - for (y = tet_piecemins_y; y <= tet_piecemaxs_y; y = y + 1) + for (y = tet_piecemins.y; y <= tet_piecemaxs.y; y = y + 1) { - for (x = tet_piecemins_x; x <= tet_piecemaxs_x; x = x + 1) + for (x = tet_piecemins.x; x <= tet_piecemaxs.x; x = x + 1) { if (PieceMetric(x, y, rot, piece)) { @@ -990,7 +990,7 @@ void HandleGame(float keyss) brand_new = 1; } else - ClearPiece(self.piece_type, self.piece_pos_x, self.piece_pos_y, self.piece_pos_z); + ClearPiece(self.piece_type, self.piece_pos.x, self.piece_pos.y, self.piece_pos.z); // next we need to check the piece metrics against what's on the level // based on the key order @@ -1001,36 +1001,36 @@ void HandleGame(float keyss) nudge = 0; if (keyss & TETKEY_RIGHT) { - check_pos_x = check_pos_x + 1; + check_pos_x = check_pos.x + 1; tetsnd("tetmove"); } else if (keyss & TETKEY_LEFT) { - check_pos_x = check_pos_x - 1; + check_pos_x = check_pos.x - 1; tetsnd("tetmove"); } else if (keyss & TETKEY_ROTRIGHT) { - check_pos_z = check_pos_z + 1; + check_pos_z = check_pos.z + 1; piece_data = PieceShape(self.piece_type); nudge = 1; tetsnd("tetrot"); } else if (keyss & TETKEY_ROTLEFT) { - check_pos_z = check_pos_z - 1; + check_pos_z = check_pos.z - 1; piece_data = PieceShape(self.piece_type); nudge = 1; tetsnd("tetrot"); } // bounds check - if (check_pos_z > 3) + if (check_pos.z > 3) check_pos_z = 0; - else if (check_pos_z < 0) + else if (check_pos.z < 0) check_pos_z = 3; // reality check - if (CheckMetrics(self.piece_type, check_pos_x, check_pos_y, check_pos_z)) + if (CheckMetrics(self.piece_type, check_pos.x, check_pos.y, check_pos.z)) self.piece_pos = check_pos; else if (brand_new) { @@ -1042,9 +1042,9 @@ void HandleGame(float keyss) { for(i = 1; i <= nudge; ++i) { - if(CheckMetrics(self.piece_type, check_pos_x + i, check_pos_y, check_pos_z)) + if(CheckMetrics(self.piece_type, check_pos.x + i, check_pos.y, check_pos.z)) self.piece_pos = check_pos + '1 0 0' * i; - else if(CheckMetrics(self.piece_type, check_pos_x - i, check_pos_y, check_pos_z)) + else if(CheckMetrics(self.piece_type, check_pos.x - i, check_pos.y, check_pos.z)) self.piece_pos = check_pos - '1 0 0' * i; else continue; @@ -1056,22 +1056,22 @@ void HandleGame(float keyss) { // drop to bottom, but do NOT cement it yet // this allows sliding it - ++check_pos_y; - while(CheckMetrics(self.piece_type, check_pos_x, check_pos_y + 1, check_pos_z)) - ++check_pos_y; + ++check_pos.y; + while(CheckMetrics(self.piece_type, check_pos.x, check_pos.y + 1, check_pos.z)) + ++check_pos.y; self.tet_autodown = time + 2 / (1 + Tetris_Level()); } else if (keyss & TETKEY_DOWN) { - check_pos_y = check_pos_y + 1; + check_pos_y = check_pos.y + 1; self.tet_autodown = time + 2 / (1 + Tetris_Level()); } else if (self.tet_autodown < time) { - check_pos_y = check_pos_y + 1; + check_pos_y = check_pos.y + 1; self.tet_autodown = time + 2 / (1 + Tetris_Level()); } - if (CheckMetrics(self.piece_type, check_pos_x, check_pos_y, check_pos_z)) + if (CheckMetrics(self.piece_type, check_pos.x, check_pos.y, check_pos.z)) { if(old_pos != check_pos) self.tet_drawtime = 0; @@ -1079,14 +1079,14 @@ void HandleGame(float keyss) } else { - CementPiece(self.piece_type, self.piece_pos_x, self.piece_pos_y, self.piece_pos_z); + CementPiece(self.piece_type, self.piece_pos.x, self.piece_pos.y, self.piece_pos.z); TetAddScore(1); CompletedLines(); self.piece_type = 0; self.tet_drawtime = 0; return; } - CementPiece(self.piece_type, self.piece_pos_x, self.piece_pos_y, self.piece_pos_z); + CementPiece(self.piece_type, self.piece_pos.x, self.piece_pos.y, self.piece_pos.z); } /* @@ -1218,16 +1218,16 @@ float TetrisPostFrame() if(self.tetris_on == 1) { - if(TetrisKeyRepeat(tetkey_down, self.movement_x < 0)) + if(TetrisKeyRepeat(tetkey_down, self.movement.x < 0)) keysa |= TETKEY_DOWN; - if(TetrisKeyRepeat(tetkey_rotright, self.movement_x > 0)) + if(TetrisKeyRepeat(tetkey_rotright, self.movement.x > 0)) keysa |= TETKEY_ROTRIGHT; - if(TetrisKeyRepeat(tetkey_left, self.movement_y < 0)) + if(TetrisKeyRepeat(tetkey_left, self.movement.y < 0)) keysa |= TETKEY_LEFT; - if(TetrisKeyRepeat(tetkey_right, self.movement_y > 0)) + if(TetrisKeyRepeat(tetkey_right, self.movement.y > 0)) keysa |= TETKEY_RIGHT; if(TetrisKeyRepeat(tetkey_rotleft, self.BUTTON_CROUCH)) diff --git a/qcsrc/server/g_triggers.qc b/qcsrc/server/g_triggers.qc index c5fb08c96..7d3c16eaf 100644 --- a/qcsrc/server/g_triggers.qc +++ b/qcsrc/server/g_triggers.qc @@ -847,9 +847,9 @@ float pointparticles_SendEntity(entity to, float fl) } if(fl & 4) { - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); + WriteCoord(MSG_ENTITY, self.origin.x); + WriteCoord(MSG_ENTITY, self.origin.y); + WriteCoord(MSG_ENTITY, self.origin.z); } if(fl & 1) { @@ -858,12 +858,12 @@ float pointparticles_SendEntity(entity to, float fl) WriteShort(MSG_ENTITY, self.modelindex); if(fl & 0x80) { - WriteCoord(MSG_ENTITY, self.mins_x); - WriteCoord(MSG_ENTITY, self.mins_y); - WriteCoord(MSG_ENTITY, self.mins_z); - WriteCoord(MSG_ENTITY, self.maxs_x); - WriteCoord(MSG_ENTITY, self.maxs_y); - WriteCoord(MSG_ENTITY, self.maxs_z); + WriteCoord(MSG_ENTITY, self.mins.x); + WriteCoord(MSG_ENTITY, self.mins.y); + WriteCoord(MSG_ENTITY, self.mins.z); + WriteCoord(MSG_ENTITY, self.maxs.x); + WriteCoord(MSG_ENTITY, self.maxs.y); + WriteCoord(MSG_ENTITY, self.maxs.z); } } else @@ -871,9 +871,9 @@ float pointparticles_SendEntity(entity to, float fl) WriteShort(MSG_ENTITY, 0); if(fl & 0x80) { - WriteCoord(MSG_ENTITY, self.maxs_x); - WriteCoord(MSG_ENTITY, self.maxs_y); - WriteCoord(MSG_ENTITY, self.maxs_z); + WriteCoord(MSG_ENTITY, self.maxs.x); + WriteCoord(MSG_ENTITY, self.maxs.y); + WriteCoord(MSG_ENTITY, self.maxs.z); } } WriteShort(MSG_ENTITY, self.cnt); @@ -1003,12 +1003,12 @@ float rainsnow_SendEntity(entity to, float sf) { WriteByte(MSG_ENTITY, ENT_CLIENT_RAINSNOW); WriteByte(MSG_ENTITY, self.state); - WriteCoord(MSG_ENTITY, self.origin_x + self.mins_x); - WriteCoord(MSG_ENTITY, self.origin_y + self.mins_y); - WriteCoord(MSG_ENTITY, self.origin_z + self.mins_z); - WriteCoord(MSG_ENTITY, self.maxs_x - self.mins_x); - WriteCoord(MSG_ENTITY, self.maxs_y - self.mins_y); - WriteCoord(MSG_ENTITY, self.maxs_z - self.mins_z); + WriteCoord(MSG_ENTITY, self.origin.x + self.mins.x); + WriteCoord(MSG_ENTITY, self.origin.y + self.mins.y); + WriteCoord(MSG_ENTITY, self.origin.z + self.mins.z); + WriteCoord(MSG_ENTITY, self.maxs.x - self.mins.x); + WriteCoord(MSG_ENTITY, self.maxs.y - self.mins.y); + WriteCoord(MSG_ENTITY, self.maxs.z - self.mins.z); WriteShort(MSG_ENTITY, compressShortVector(self.dest)); WriteShort(MSG_ENTITY, self.count); WriteByte(MSG_ENTITY, self.cnt); @@ -1040,7 +1040,7 @@ void spawnfunc_func_rain() self.cnt = 12; if (!self.count) self.count = 2000; - self.count = 0.01 * self.count * (self.size_x / 1024) * (self.size_y / 1024); + self.count = 0.01 * self.count * (self.size.x / 1024) * (self.size.y / 1024); if (self.count < 1) self.count = 1; if(self.count > 65535) @@ -1078,7 +1078,7 @@ void spawnfunc_func_snow() self.cnt = 12; if (!self.count) self.count = 2000; - self.count = 0.01 * self.count * (self.size_x / 1024) * (self.size_y / 1024); + self.count = 0.01 * self.count * (self.size.x / 1024) * (self.size.y / 1024); if (self.count < 1) self.count = 1; if(self.count > 65535) @@ -1107,7 +1107,7 @@ void misc_laser_aim() else { a = vectoangles(self.enemy.origin - self.origin); - a_x = -a_x; + a_x = -a.x; if(a != self.mangle) { self.mangle = a; @@ -1226,15 +1226,15 @@ float laser_SendEntity(entity to, float fl) WriteByte(MSG_ENTITY, fl); if(fl & 1) { - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); + WriteCoord(MSG_ENTITY, self.origin.x); + WriteCoord(MSG_ENTITY, self.origin.y); + WriteCoord(MSG_ENTITY, self.origin.z); } if(fl & 8) { - WriteByte(MSG_ENTITY, self.colormod_x * 255.0); - WriteByte(MSG_ENTITY, self.colormod_y * 255.0); - WriteByte(MSG_ENTITY, self.colormod_z * 255.0); + WriteByte(MSG_ENTITY, self.colormod.x * 255.0); + WriteByte(MSG_ENTITY, self.colormod.y * 255.0); + WriteByte(MSG_ENTITY, self.colormod.z * 255.0); if(fl & 0x40) WriteByte(MSG_ENTITY, self.alpha * 255.0); if(fl & 0x20) @@ -1249,14 +1249,14 @@ float laser_SendEntity(entity to, float fl) { if(fl & 0x80) { - WriteCoord(MSG_ENTITY, self.enemy.origin_x); - WriteCoord(MSG_ENTITY, self.enemy.origin_y); - WriteCoord(MSG_ENTITY, self.enemy.origin_z); + WriteCoord(MSG_ENTITY, self.enemy.origin.x); + WriteCoord(MSG_ENTITY, self.enemy.origin.y); + WriteCoord(MSG_ENTITY, self.enemy.origin.z); } else { - WriteAngle(MSG_ENTITY, self.mangle_x); - WriteAngle(MSG_ENTITY, self.mangle_y); + WriteAngle(MSG_ENTITY, self.mangle.x); + WriteAngle(MSG_ENTITY, self.mangle.y); } } if(fl & 4) @@ -1917,7 +1917,7 @@ string trigger_magicear_processmessage(entity ear, entity source, float teamsay, if (!(ear.spawnflags & 256)) return msgin; - if(!W_Tuba_HasPlayed(source, ear.message, ear.movedir_x, !(ear.spawnflags & 512), ear.movedir_y, ear.movedir_z)) + if(!W_Tuba_HasPlayed(source, ear.message, ear.movedir.x, !(ear.spawnflags & 512), ear.movedir.y, ear.movedir.z)) return msgin; magicear_matched = TRUE; diff --git a/qcsrc/server/g_violence.qc b/qcsrc/server/g_violence.qc index 34d384c28..f034c0c46 100644 --- a/qcsrc/server/g_violence.qc +++ b/qcsrc/server/g_violence.qc @@ -3,10 +3,10 @@ float Violence_GibSplash_SendEntity(entity to, float sf) WriteByte(MSG_ENTITY, ENT_CLIENT_GIBSPLASH); WriteByte(MSG_ENTITY, self.state); // actually type WriteByte(MSG_ENTITY, bound(1, self.cnt * 16, 255)); // gibbage amount multiplier - WriteShort(MSG_ENTITY, floor(self.origin_x / 4)); // not using a coord here, as gibs don't need this accuracy - WriteShort(MSG_ENTITY, floor(self.origin_y / 4)); // not using a coord here, as gibs don't need this accuracy - WriteShort(MSG_ENTITY, floor(self.origin_z / 4)); // not using a coord here, as gibs don't need this accuracy - WriteShort(MSG_ENTITY, self.oldorigin_x); // acrually compressed velocity + WriteShort(MSG_ENTITY, floor(self.origin.x / 4)); // not using a coord here, as gibs don't need this accuracy + WriteShort(MSG_ENTITY, floor(self.origin.y / 4)); // not using a coord here, as gibs don't need this accuracy + WriteShort(MSG_ENTITY, floor(self.origin.z / 4)); // not using a coord here, as gibs don't need this accuracy + WriteShort(MSG_ENTITY, self.oldorigin.x); // acrually compressed velocity return TRUE; } diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 1962d63c5..0f29b1cfa 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -442,9 +442,9 @@ void detect_maptype() for(0;;) { o = world.mins; - o_x += random() * (world.maxs_x - world.mins_x); - o_y += random() * (world.maxs_y - world.mins_y); - o_z += random() * (world.maxs_z - world.mins_z); + o.x += random() * (world.maxs.x - world.mins.x); + o.y += random() * (world.maxs.y - world.mins.y); + o.z += random() * (world.maxs.z - world.mins.z); tracebox(o, PL_MIN, PL_MAX, o - '0 0 32768', MOVE_WORLDONLY, world); if(trace_fraction == 1) diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 43ebb25d1..6e7d4b45d 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -202,7 +202,7 @@ entity findnearest(vector point, .string field, string value, vector axismod) else dist = localhead.origin; dist = dist - point; - dist = dist_x * axismod_x * '1 0 0' + dist_y * axismod_y * '0 1 0' + dist_z * axismod_z * '0 0 1'; + dist = dist.x * axismod.x * '1 0 0' + dist.y * axismod.y * '0 1 0' + dist.z * axismod.z * '0 0 1'; len = vlen(dist); for (i = 0; i < num_nearest; ++i) @@ -368,7 +368,7 @@ string formatmessage(string msg) if (replacement == "" || !cursor_ent) replacement = "nothing"; } else if (escape == "s") - replacement = ftos(vlen(self.velocity - self.velocity_z * '0 0 1')); + replacement = ftos(vlen(self.velocity - self.velocity.z * '0 0 1')); else if (escape == "S") replacement = ftos(vlen(self.velocity)); @@ -1121,9 +1121,9 @@ void soundtoat(float dest, entity e, vector o, float chan, string samp, float vo else WriteByte(dest, idx); - WriteCoord(dest, o_x); - WriteCoord(dest, o_y); - WriteCoord(dest, o_z); + WriteCoord(dest, o.x); + WriteCoord(dest, o.y); + WriteCoord(dest, o.z); } void soundto(float dest, entity e, float chan, string samp, float vol, float atten) { @@ -1163,9 +1163,9 @@ void stopsoundto(float dest, entity e, float chan) WriteShort(dest, idx); else WriteByte(dest, idx); - WriteCoord(dest, e.origin_x); - WriteCoord(dest, e.origin_y); - WriteCoord(dest, e.origin_z); + WriteCoord(dest, e.origin.x); + WriteCoord(dest, e.origin.y); + WriteCoord(dest, e.origin.z); } else { @@ -1703,11 +1703,11 @@ float trace_hits_box(vector start, vector end, vector thmi, vector thma) trace_hits_box_a0 = 0; trace_hits_box_a1 = 1; - if (!trace_hits_box_1d(end_x, thmi_x, thma_x)) + if (!trace_hits_box_1d(end.x, thmi.x, thma.x)) return FALSE; - if (!trace_hits_box_1d(end_y, thmi_y, thma_y)) + if (!trace_hits_box_1d(end.y, thmi.y, thma.y)) return FALSE; - if (!trace_hits_box_1d(end_z, thmi_z, thma_z)) + if (!trace_hits_box_1d(end.z, thmi.z, thma.z)) return FALSE; return TRUE; @@ -1847,14 +1847,14 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f for (i = 0; i < attempts; ++i) { - start_x = org_x + random() * delta_x; - start_y = org_y + random() * delta_y; - start_z = org_z + random() * delta_z; + start_x = org.x + random() * delta.x; + start_y = org.y + random() * delta.y; + start_z = org.z + random() * delta.z; // rule 1: start inside world bounds, and outside // solid, and don't start from somewhere where you can // fall down to evil - tracebox(start, e.mins, e.maxs, start - '0 0 1' * delta_z, MOVE_NORMAL, e); + tracebox(start, e.mins, e.maxs, start - '0 0 1' * delta.z, MOVE_NORMAL, e); if (trace_fraction >= 1) continue; if (trace_startsolid) @@ -1865,7 +1865,7 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f continue; // rule 2: if we are too high, lower the point - if (trace_fraction * delta_z > maxaboveground) + if (trace_fraction * delta.z > maxaboveground) start = trace_endpos + '0 0 1' * maxaboveground; enddown = trace_endpos; @@ -1874,19 +1874,19 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f // the map should have a convex outside hull. // these can be traceLINES as we already verified the starting box mstart = start + 0.5 * (e.mins + e.maxs); - traceline(mstart, mstart + '1 0 0' * delta_x, MOVE_NORMAL, e); + traceline(mstart, mstart + '1 0 0' * delta.x, MOVE_NORMAL, e); if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk") continue; - traceline(mstart, mstart - '1 0 0' * delta_x, MOVE_NORMAL, e); + traceline(mstart, mstart - '1 0 0' * delta.x, MOVE_NORMAL, e); if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk") continue; - traceline(mstart, mstart + '0 1 0' * delta_y, MOVE_NORMAL, e); + traceline(mstart, mstart + '0 1 0' * delta.y, MOVE_NORMAL, e); if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk") continue; - traceline(mstart, mstart - '0 1 0' * delta_y, MOVE_NORMAL, e); + traceline(mstart, mstart - '0 1 0' * delta.y, MOVE_NORMAL, e); if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk") continue; - traceline(mstart, mstart + '0 0 1' * delta_z, MOVE_NORMAL, e); + traceline(mstart, mstart + '0 0 1' * delta.z, MOVE_NORMAL, e); if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk") continue; @@ -1906,9 +1906,9 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f } // find a random vector to "look at" - end_x = org_x + random() * delta_x; - end_y = org_y + random() * delta_y; - end_z = org_z + random() * delta_z; + end_x = org.x + random() * delta.x; + end_y = org.y + random() * delta.y; + end_z = org.z + random() * delta.z; end = start + normalize(end - start) * vlen(delta); // rule 4: start TO end must not be too short @@ -1962,7 +1962,7 @@ vector shotorg_adjustfromclient(vector vecs, float y_is_right, float allowcenter break; case 4: // left - vecs_y = -vecs_y; + vecs_y = -vecs.y; break; case 1: @@ -1970,7 +1970,7 @@ vector shotorg_adjustfromclient(vector vecs, float y_is_right, float allowcenter { // center vecs_y = 0; - vecs_z -= 2; + vecs.z -= 2; } else { @@ -1983,12 +1983,12 @@ vector shotorg_adjustfromclient(vector vecs, float y_is_right, float allowcenter { // center vecs_y = 0; - vecs_z -= 2; + vecs.z -= 2; } else { // left - vecs_y = -vecs_y; + vecs_y = -vecs.y; } break; } @@ -2005,7 +2005,7 @@ vector shotorg_adjust_values(vector vecs, float y_is_right, float visual, float if (visual) { if (autocvar_g_shootfromclient) { vecs = shotorg_adjustfromclient(vecs, y_is_right, (autocvar_g_shootfromclient >= 2), algn); } - else { vecs_y = 0; vecs_z -= 2; } + else { vecs_y = 0; vecs.z -= 2; } } else { @@ -2016,17 +2016,17 @@ vector shotorg_adjust_values(vector vecs, float y_is_right, float visual, float else if (autocvar_g_shootfromcenter) { vecs_y = 0; - vecs_z -= 2; + vecs.z -= 2; } else if ((s = autocvar_g_shootfromfixedorigin) != "") { v = stov(s); if (y_is_right) - v_y = -v_y; - if (v_x != 0) - vecs_x = v_x; - vecs_y = v_y; - vecs_z = v_z; + v_y = -v.y; + if (v.x != 0) + vecs_x = v.x; + vecs_y = v.y; + vecs_z = v.z; } else if (autocvar_g_shootfromclient) { @@ -2142,26 +2142,26 @@ float modeleffect_SendEntity(entity to, float sf) WriteShort(MSG_ENTITY, self.modelindex); WriteByte(MSG_ENTITY, self.skin); WriteByte(MSG_ENTITY, self.frame); - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); + WriteCoord(MSG_ENTITY, self.origin.x); + WriteCoord(MSG_ENTITY, self.origin.y); + WriteCoord(MSG_ENTITY, self.origin.z); if(f & 1) { - WriteCoord(MSG_ENTITY, self.velocity_x); - WriteCoord(MSG_ENTITY, self.velocity_y); - WriteCoord(MSG_ENTITY, self.velocity_z); + WriteCoord(MSG_ENTITY, self.velocity.x); + WriteCoord(MSG_ENTITY, self.velocity.y); + WriteCoord(MSG_ENTITY, self.velocity.z); } if(f & 2) { - WriteCoord(MSG_ENTITY, self.angles_x); - WriteCoord(MSG_ENTITY, self.angles_y); - WriteCoord(MSG_ENTITY, self.angles_z); + WriteCoord(MSG_ENTITY, self.angles.x); + WriteCoord(MSG_ENTITY, self.angles.y); + WriteCoord(MSG_ENTITY, self.angles.z); } if(f & 4) { - WriteCoord(MSG_ENTITY, self.avelocity_x); - WriteCoord(MSG_ENTITY, self.avelocity_y); - WriteCoord(MSG_ENTITY, self.avelocity_z); + WriteCoord(MSG_ENTITY, self.avelocity.x); + WriteCoord(MSG_ENTITY, self.avelocity.y); + WriteCoord(MSG_ENTITY, self.avelocity.z); } WriteShort(MSG_ENTITY, self.scale * 256.0); WriteShort(MSG_ENTITY, self.scale2 * 256.0); @@ -2189,11 +2189,11 @@ void modeleffect_spawn(string m, float s, float f, vector o, vector v, vector an e.fade_time = t2; e.skin = s; if(s0 >= 0) - e.scale = s0 / max6(-e.mins_x, -e.mins_y, -e.mins_z, e.maxs_x, e.maxs_y, e.maxs_z); + e.scale = s0 / max6(-e.mins.x, -e.mins.y, -e.mins.z, e.maxs.x, e.maxs.y, e.maxs.z); else e.scale = -s0; if(s2 >= 0) - e.scale2 = s2 / max6(-e.mins_x, -e.mins_y, -e.mins_z, e.maxs_x, e.maxs_y, e.maxs_z); + e.scale2 = s2 / max6(-e.mins.x, -e.mins.y, -e.mins.z, e.maxs.x, e.maxs.y, e.maxs.z); else e.scale2 = -s2; sz = max(e.scale, e.scale2); diff --git a/qcsrc/server/movelib.qc b/qcsrc/server/movelib.qc index 0774dd1dc..66c13162f 100644 --- a/qcsrc/server/movelib.qc +++ b/qcsrc/server/movelib.qc @@ -182,7 +182,7 @@ void movelib_beak_simple(float force) mspeed = max(0,vlen(self.velocity) - force); mdir = normalize(self.velocity); - vz = self.velocity_z; + vz = self.velocity.z; self.velocity = mdir * mspeed; self.velocity_z = vz; } @@ -202,8 +202,8 @@ void movelib_groundalign4point(float spring_length, float spring_up, float blend e = v_up * spring_length; // Put springs slightly inside bbox - ahead = v_forward * (self.maxs_x * 0.8); - side = v_right * (self.maxs_y * 0.8); + ahead = v_forward * (self.maxs.x * 0.8); + side = v_right * (self.maxs.y * 0.8); a = r + ahead + side; b = r + ahead - side; @@ -226,21 +226,21 @@ void movelib_groundalign4point(float spring_length, float spring_up, float blend d_z = (1 - trace_fraction); r += trace_endpos; - a_x = r_z; + a_x = r.z; r = self.origin; - r_z = r_z; + r_z = r.z; - push_angle_x = (a_z - c_z) * _max; - push_angle_x += (b_z - d_z) * _max; + push_angle_x = (a.z - c.z) * _max; + push_angle.x += (b.z - d.z) * _max; - push_angle_z = (b_z - a_z) * _max; - push_angle_z += (d_z - c_z) * _max; + push_angle_z = (b.z - a.z) * _max; + push_angle.z += (d.z - c.z) * _max; //self.angles_x += push_angle_x * 0.95; //self.angles_z += push_angle_z * 0.95; - self.angles_x = ((1-blendrate) * self.angles_x) + (push_angle_x * blendrate); - self.angles_z = ((1-blendrate) * self.angles_z) + (push_angle_z * blendrate); + self.angles_x = ((1-blendrate) * self.angles.x) + (push_angle.x * blendrate); + self.angles_z = ((1-blendrate) * self.angles.z) + (push_angle.z * blendrate); //a = self.origin; setorigin(self,r); diff --git a/qcsrc/server/mutators/gamemode_ctf.qc b/qcsrc/server/mutators/gamemode_ctf.qc index 4e051d197..17158b402 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qc +++ b/qcsrc/server/mutators/gamemode_ctf.qc @@ -51,7 +51,7 @@ void ctf_FlagcarrierWaypoints(entity player) void ctf_CalculatePassVelocity(entity flag, vector to, vector from, float turnrate) { - float current_distance = vlen((('1 0 0' * to_x) + ('0 1 0' * to_y)) - (('1 0 0' * from_x) + ('0 1 0' * from_y))); // for the sake of this check, exclude Z axis + float current_distance = vlen((('1 0 0' * to.x) + ('0 1 0' * to.y)) - (('1 0 0' * from.x) + ('0 1 0' * from.y))); // for the sake of this check, exclude Z axis float initial_height = min(autocvar_g_ctf_pass_arc_max, (flag.pass_distance * tanh(autocvar_g_ctf_pass_arc))); float current_height = (initial_height * min(1, (current_distance / flag.pass_distance))); //print("current_height = ", ftos(current_height), ", initial_height = ", ftos(initial_height), ".\n"); @@ -331,7 +331,7 @@ void ctf_Handle_Throw(entity player, entity receiver, float droptype) WarpZone_RefSys_AddInverse(flag, receiver); // wz1^-1 ... wzn^-1 receiver targ_origin = WarpZone_RefSys_TransformOrigin(receiver, flag, (0.5 * (receiver.absmin + receiver.absmax))); // this is target origin as seen by the flag - flag.pass_distance = vlen((('1 0 0' * targ_origin_x) + ('0 1 0' * targ_origin_y)) - (('1 0 0' * player.origin_x) + ('0 1 0' * player.origin_y))); // for the sake of this check, exclude Z axis + flag.pass_distance = vlen((('1 0 0' * targ_origin.x) + ('0 1 0' * targ_origin.y)) - (('1 0 0' * player.origin.x) + ('0 1 0' * player.origin.y))); // for the sake of this check, exclude Z axis ctf_CalculatePassVelocity(flag, targ_origin, player.origin, FALSE); // main @@ -350,7 +350,7 @@ void ctf_Handle_Throw(entity player, entity receiver, float droptype) case DROP_THROW: { - makevectors((player.v_angle_y * '0 1 0') + (bound(autocvar_g_ctf_throw_angle_min, player.v_angle_x, autocvar_g_ctf_throw_angle_max) * '1 0 0')); + makevectors((player.v_angle.y * '0 1 0') + (bound(autocvar_g_ctf_throw_angle_min, player.v_angle.x, autocvar_g_ctf_throw_angle_max) * '1 0 0')); flag_velocity = (('0 0 1' * autocvar_g_ctf_throw_velocity_up) + ((v_forward * autocvar_g_ctf_throw_velocity_forward) * ((player.items & IT_STRENGTH) ? autocvar_g_ctf_throw_strengthmultiplier : 1))); flag.velocity = W_CalculateProjectileVelocity(player.velocity, flag_velocity, FALSE); @@ -1581,7 +1581,7 @@ void havocbot_role_ctf_middle() vector org; org = havocbot_ctf_middlepoint; - org_z = self.origin_z; + org_z = self.origin.z; self.bot_strategytime = time + autocvar_bot_ai_strategyinterval; navigation_goalrating_start(); diff --git a/qcsrc/server/mutators/gamemode_cts.qc b/qcsrc/server/mutators/gamemode_cts.qc index 9c674d45d..a773e4e8c 100644 --- a/qcsrc/server/mutators/gamemode_cts.qc +++ b/qcsrc/server/mutators/gamemode_cts.qc @@ -59,26 +59,26 @@ MUTATOR_HOOKFUNCTION(cts_PlayerPhysics) // ensure nothing EVIL is being done (i.e. div0_evade) // this hinders joystick users though // but it still gives SOME analog control - wishvel_x = fabs(self.movement_x); - wishvel_y = fabs(self.movement_y); - if(wishvel_x != 0 && wishvel_y != 0 && wishvel_x != wishvel_y) + wishvel_x = fabs(self.movement.x); + wishvel_y = fabs(self.movement.y); + if(wishvel.x != 0 && wishvel.y != 0 && wishvel.x != wishvel.y) { wishvel_z = 0; wishspeed = vlen(wishvel); - if(wishvel_x >= 2 * wishvel_y) + if(wishvel.x >= 2 * wishvel.y) { // pure X motion - if(self.movement_x > 0) + if(self.movement.x > 0) self.movement_x = wishspeed; else self.movement_x = -wishspeed; self.movement_y = 0; } - else if(wishvel_y >= 2 * wishvel_x) + else if(wishvel.y >= 2 * wishvel.x) { // pure Y motion self.movement_x = 0; - if(self.movement_y > 0) + if(self.movement.y > 0) self.movement_y = wishspeed; else self.movement_y = -wishspeed; @@ -86,11 +86,11 @@ MUTATOR_HOOKFUNCTION(cts_PlayerPhysics) else { // diagonal - if(self.movement_x > 0) + if(self.movement.x > 0) self.movement_x = M_SQRT1_2 * wishspeed; else self.movement_x = -M_SQRT1_2 * wishspeed; - if(self.movement_y > 0) + if(self.movement.y > 0) self.movement_y = M_SQRT1_2 * wishspeed; else self.movement_y = -M_SQRT1_2 * wishspeed; diff --git a/qcsrc/server/mutators/gamemode_keyhunt.qc b/qcsrc/server/mutators/gamemode_keyhunt.qc index c5cd477aa..ae7f66c59 100644 --- a/qcsrc/server/mutators/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/gamemode_keyhunt.qc @@ -200,7 +200,7 @@ vector kh_AttachedOrigin(entity e) // runs when a team captures the flag, it ca if(e.tag_entity) { makevectors(e.tag_entity.angles); - return e.tag_entity.origin + e.origin_x * v_forward - e.origin_y * v_right + e.origin_z * v_up; + return e.tag_entity.origin + e.origin.x * v_forward - e.origin.y * v_right + e.origin.z * v_up; } else return e.origin; @@ -237,7 +237,7 @@ void kh_Key_Attach(entity key) // runs when a player picks up a key and several #else setattachment(key, key.owner, ""); setorigin(key, '0 0 1' * KH_KEY_ZSHIFT); // fixing x, y in think - key.angles_y -= key.owner.angles_y; + key.angles_y -= key.owner.angles.y; #endif key.flags = 0; key.solid = SOLID_NOT; @@ -274,9 +274,9 @@ void kh_Key_Detach(entity key) // runs every time a key is dropped or lost. Runs setorigin(key, key.owner.origin + '0 0 1' * (PL_MIN_z - KH_KEY_MIN_z)); key.angles = key.owner.angles; #else - setorigin(key, key.owner.origin + key.origin_z * '0 0 1'); + setorigin(key, key.owner.origin + key.origin.z * '0 0 1'); setattachment(key, world, ""); - key.angles_y += key.owner.angles_y; + key.angles_y += key.owner.angles.y; #endif key.flags = FL_ITEM; key.solid = SOLID_TRIGGER; @@ -669,7 +669,7 @@ void kh_Key_Think() // runs all the time { #ifndef KH_PLAYER_USE_ATTACHMENT makevectors('0 1 0' * (self.cnt + (time % 360) * KH_KEY_XYSPEED)); - setorigin(self, v_forward * KH_KEY_XYDIST + '0 0 1' * self.origin_z); + setorigin(self, v_forward * KH_KEY_XYDIST + '0 0 1' * self.origin.z); #endif } diff --git a/qcsrc/server/mutators/gamemode_nexball.qc b/qcsrc/server/mutators/gamemode_nexball.qc index 92e707b06..52533e2c8 100644 --- a/qcsrc/server/mutators/gamemode_nexball.qc +++ b/qcsrc/server/mutators/gamemode_nexball.qc @@ -82,9 +82,9 @@ void relocate_nexball(void) if(!move_out_of_solid(self)) objerror("could not get out of solid at all!"); print("^1NOTE: this map needs FIXING. ", self.classname, " at ", vtos(o - '0 0 1')); - print(" needs to be moved out of solid, e.g. by '", ftos(self.origin_x - o_x)); - print(" ", ftos(self.origin_y - o_y)); - print(" ", ftos(self.origin_z - o_z), "'\n"); + print(" needs to be moved out of solid, e.g. by '", ftos(self.origin.x - o.x)); + print(" ", ftos(self.origin.y - o.y)); + print(" ", ftos(self.origin.z - o.z), "'\n"); self.origin = o; } } @@ -94,7 +94,7 @@ void DropOwner(void) entity ownr; ownr = self.owner; DropBall(self, ownr.origin, ownr.velocity); - makevectors(ownr.v_angle_y * '0 1 0'); + makevectors(ownr.v_angle.y * '0 1 0'); ownr.velocity += ('0 0 0.75' - v_forward) * 1000; ownr.flags &= ~FL_ONGROUND; } @@ -281,7 +281,7 @@ void football_touch(void) } else if(autocvar_g_nexball_football_physics == 2) // 2nd mod try: totally independant. Really playable! { - makevectors(other.v_angle_y * '0 1 0'); + makevectors(other.v_angle.y * '0 1 0'); self.velocity = other.velocity + v_forward * autocvar_g_nexball_football_boost_forward + v_up * autocvar_g_nexball_football_boost_up; } else // Revenant's original style (from the original mod's disassembly, acknowledged by Revenant) @@ -430,38 +430,38 @@ void nb_spawnteam(string teamname, float teamcolor) void nb_spawnteams(void) { - float t_r = 0, t_b = 0, t_y = 0, t_p = 0; + bool t_red = false, t_blue = false, t_yellow = false, t_pink = false; entity e; for(e = world; (e = find(e, classname, "nexball_goal"));) { switch(e.team) { case NUM_TEAM_1: - if(!t_r) + if(!t_red) { nb_spawnteam("Red", e.team-1) ; - t_r = 1; + t_red = true; } break; case NUM_TEAM_2: - if(!t_b) + if(!t_blue) { nb_spawnteam("Blue", e.team-1) ; - t_b = 1; + t_blue = true; } break; case NUM_TEAM_3: - if(!t_y) + if(!t_yellow) { nb_spawnteam("Yellow", e.team-1); - t_y = 1; + t_yellow = true; } break; case NUM_TEAM_4: - if(!t_p) + if(!t_pink) { nb_spawnteam("Pink", e.team-1) ; - t_p = 1; + t_pink = true; } break; } @@ -894,9 +894,9 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerPreThink) self.ballcarried.customizeentityforclient = ball_customize; setorigin(self.ballcarried, self.origin + self.view_ofs + - v_forward * autocvar_g_nexball_viewmodel_offset_x + - v_right * autocvar_g_nexball_viewmodel_offset_y + - v_up * autocvar_g_nexball_viewmodel_offset_z); + v_forward * autocvar_g_nexball_viewmodel_offset.x + + v_right * autocvar_g_nexball_viewmodel_offset.y + + v_up * autocvar_g_nexball_viewmodel_offset.z); // 'safe passing' if(autocvar_g_nexball_safepass_maxdist) diff --git a/qcsrc/server/mutators/gamemode_onslaught.qc b/qcsrc/server/mutators/gamemode_onslaught.qc index 74cba2897..6cfefdfe5 100644 --- a/qcsrc/server/mutators/gamemode_onslaught.qc +++ b/qcsrc/server/mutators/gamemode_onslaught.qc @@ -1150,54 +1150,54 @@ void onslaught_controlpoint_icon_think() self.owner.waslinked = self.owner.islinked; } - if (self.punchangle_x > 0) + if (self.punchangle.x > 0) { - self.punchangle_x = self.punchangle_x - 60 * sys_frametime; - if (self.punchangle_x < 0) + self.punchangle_x = self.punchangle.x - 60 * sys_frametime; + if (self.punchangle.x < 0) self.punchangle_x = 0; } - else if (self.punchangle_x < 0) + else if (self.punchangle.x < 0) { - self.punchangle_x = self.punchangle_x + 60 * sys_frametime; - if (self.punchangle_x > 0) + self.punchangle_x = self.punchangle.x + 60 * sys_frametime; + if (self.punchangle.x > 0) self.punchangle_x = 0; } - if (self.punchangle_y > 0) + if (self.punchangle.y > 0) { - self.punchangle_y = self.punchangle_y - 60 * sys_frametime; - if (self.punchangle_y < 0) + self.punchangle_y = self.punchangle.y - 60 * sys_frametime; + if (self.punchangle.y < 0) self.punchangle_y = 0; } - else if (self.punchangle_y < 0) + else if (self.punchangle.y < 0) { - self.punchangle_y = self.punchangle_y + 60 * sys_frametime; - if (self.punchangle_y > 0) + self.punchangle_y = self.punchangle.y + 60 * sys_frametime; + if (self.punchangle.y > 0) self.punchangle_y = 0; } - if (self.punchangle_z > 0) + if (self.punchangle.z > 0) { - self.punchangle_z = self.punchangle_z - 60 * sys_frametime; - if (self.punchangle_z < 0) + self.punchangle_z = self.punchangle.z - 60 * sys_frametime; + if (self.punchangle.z < 0) self.punchangle_z = 0; } - else if (self.punchangle_z < 0) + else if (self.punchangle.z < 0) { - self.punchangle_z = self.punchangle_z + 60 * sys_frametime; - if (self.punchangle_z > 0) + self.punchangle_z = self.punchangle.z + 60 * sys_frametime; + if (self.punchangle.z > 0) self.punchangle_z = 0; } - self.angles_x = self.punchangle_x; - self.angles_y = self.punchangle_y + self.mangle_y; - self.angles_z = self.punchangle_z; - self.mangle_y = self.mangle_y + 45 * sys_frametime; + self.angles_x = self.punchangle.x; + self.angles_y = self.punchangle.y + self.mangle.y; + self.angles_z = self.punchangle.z; + self.mangle_y = self.mangle.y + 45 * sys_frametime; self.cp_bob_origin_z = 4 * PI * (1 - cos(self.cp_bob_spd)); self.cp_bob_spd = self.cp_bob_spd + 1.875 * sys_frametime; - if(self.cp_bob_dmg_z > 0) - self.cp_bob_dmg_z = self.cp_bob_dmg_z - 3 * sys_frametime; + if(self.cp_bob_dmg.z > 0) + self.cp_bob_dmg_z = self.cp_bob_dmg.z - 3 * sys_frametime; else self.cp_bob_dmg_z = 0; setorigin(self,self.cp_origin + self.cp_bob_origin + self.cp_bob_dmg); @@ -1425,15 +1425,15 @@ float onslaught_link_send(entity to, float sendflags) WriteByte(MSG_ENTITY, sendflags); if(sendflags & 1) { - WriteCoord(MSG_ENTITY, self.goalentity.origin_x); - WriteCoord(MSG_ENTITY, self.goalentity.origin_y); - WriteCoord(MSG_ENTITY, self.goalentity.origin_z); + WriteCoord(MSG_ENTITY, self.goalentity.origin.x); + WriteCoord(MSG_ENTITY, self.goalentity.origin.y); + WriteCoord(MSG_ENTITY, self.goalentity.origin.z); } if(sendflags & 2) { - WriteCoord(MSG_ENTITY, self.enemy.origin_x); - WriteCoord(MSG_ENTITY, self.enemy.origin_y); - WriteCoord(MSG_ENTITY, self.enemy.origin_z); + WriteCoord(MSG_ENTITY, self.enemy.origin.x); + WriteCoord(MSG_ENTITY, self.enemy.origin.y); + WriteCoord(MSG_ENTITY, self.enemy.origin.z); } if(sendflags & 4) { diff --git a/qcsrc/server/mutators/gamemode_race.qc b/qcsrc/server/mutators/gamemode_race.qc index da5ca4c10..fd48a0fce 100644 --- a/qcsrc/server/mutators/gamemode_race.qc +++ b/qcsrc/server/mutators/gamemode_race.qc @@ -66,26 +66,26 @@ MUTATOR_HOOKFUNCTION(race_PlayerPhysics) // ensure nothing EVIL is being done (i.e. div0_evade) // this hinders joystick users though // but it still gives SOME analog control - wishvel_x = fabs(self.movement_x); - wishvel_y = fabs(self.movement_y); - if(wishvel_x != 0 && wishvel_y != 0 && wishvel_x != wishvel_y) + wishvel_x = fabs(self.movement.x); + wishvel_y = fabs(self.movement.y); + if(wishvel.x != 0 && wishvel.y != 0 && wishvel.x != wishvel.y) { wishvel_z = 0; wishspeed = vlen(wishvel); - if(wishvel_x >= 2 * wishvel_y) + if(wishvel.x >= 2 * wishvel.y) { // pure X motion - if(self.movement_x > 0) + if(self.movement.x > 0) self.movement_x = wishspeed; else self.movement_x = -wishspeed; self.movement_y = 0; } - else if(wishvel_y >= 2 * wishvel_x) + else if(wishvel.y >= 2 * wishvel.x) { // pure Y motion self.movement_x = 0; - if(self.movement_y > 0) + if(self.movement.y > 0) self.movement_y = wishspeed; else self.movement_y = -wishspeed; @@ -93,11 +93,11 @@ MUTATOR_HOOKFUNCTION(race_PlayerPhysics) else { // diagonal - if(self.movement_x > 0) + if(self.movement.x > 0) self.movement_x = M_SQRT1_2 * wishspeed; else self.movement_x = -M_SQRT1_2 * wishspeed; - if(self.movement_y > 0) + if(self.movement.y > 0) self.movement_y = M_SQRT1_2 * wishspeed; else self.movement_y = -M_SQRT1_2 * wishspeed; diff --git a/qcsrc/server/mutators/mutator_buffs.qc b/qcsrc/server/mutators/mutator_buffs.qc index 765619df7..8c2101fa5 100644 --- a/qcsrc/server/mutators/mutator_buffs.qc +++ b/qcsrc/server/mutators/mutator_buffs.qc @@ -46,7 +46,7 @@ float buff_Waypoint_visible_for_player(entity plr) void buff_Waypoint_Spawn(entity e) { - WaypointSprite_Spawn(Buff_Sprite(e.buffs), 0, autocvar_g_buffs_waypoint_distance, e, '0 0 1' * e.maxs_z, world, e.team, e, buff_waypoint, TRUE, RADARICON_POWERUP, e.glowmod); + WaypointSprite_Spawn(Buff_Sprite(e.buffs), 0, autocvar_g_buffs_waypoint_distance, e, '0 0 1' * e.maxs.z, world, e.team, e, buff_waypoint, TRUE, RADARICON_POWERUP, e.glowmod); WaypointSprite_UpdateTeamRadar(e.buff_waypoint, RADARICON_POWERUP, e.glowmod); e.buff_waypoint.waypointsprite_visible_for_player = buff_Waypoint_visible_for_player; } @@ -342,8 +342,8 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerDamage_SplitHealthArmor) if(frag_target.buffs & BUFF_RESISTANCE) { vector v = healtharmor_applydamage(50, autocvar_g_buffs_resistance_blockpercent, frag_deathtype, frag_damage); - damage_take = v_x; - damage_save = v_y; + damage_take = v.x; + damage_save = v.y; } return FALSE; @@ -636,7 +636,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerThink) setmodel(self.buff_model, "models/relics/relic.md3"); setsize(self.buff_model, '0 0 -40', '0 0 40'); setattachment(self.buff_model, self, ""); - setorigin(self.buff_model, '0 0 1' * (self.buff_model.maxs_z * 1)); + setorigin(self.buff_model, '0 0 1' * (self.buff_model.maxs.z * 1)); self.buff_model.owner = self; self.buff_model.scale = 0.7; self.buff_model.pflags = PFLAGS_FULLDYNAMIC; diff --git a/qcsrc/server/mutators/mutator_dodging.qc b/qcsrc/server/mutators/mutator_dodging.qc index b26fe1b9f..e20008197 100644 --- a/qcsrc/server/mutators/mutator_dodging.qc +++ b/qcsrc/server/mutators/mutator_dodging.qc @@ -9,8 +9,7 @@ .float last_RIGHT_KEY_time; // these store the movement direction at the time of the dodge action happening. -.float dodging_direction_x; -.float dodging_direction_y; +.vector dodging_direction; // this indicates the last time a dodge was executed. used to check if another one is allowed // and to ramp up the dodge acceleration in the physics hook. @@ -79,12 +78,12 @@ MUTATOR_HOOKFUNCTION(dodging_PlayerPhysics) { // ramp up dodging speed by adding some velocity each frame.. TODO: do it! :D if (self.dodging_action == 1) { //disable jump key during dodge accel phase - if (self.movement_z > 0) self.movement_z = 0; + if (self.movement.z > 0) self.movement_z = 0; self.velocity = self.velocity - + ((self.dodging_direction_y * velocity_difference) * v_right) - + ((self.dodging_direction_x * velocity_difference) * v_forward); + + ((self.dodging_direction.y * velocity_difference) * v_right) + + ((self.dodging_direction.x * velocity_difference) * v_forward); self.dodging_velocity_gain = self.dodging_velocity_gain - velocity_difference; } @@ -163,11 +162,7 @@ MUTATOR_HOOKFUNCTION(dodging_GetPressedKeys) { // print("dodging_PlayerPhysics\n"); float length; - float tap_direction_x; - float tap_direction_y; - - tap_direction_x = 0; - tap_direction_y = 0; + vector tap_direction = '0 0 0'; float frozen_dodging, frozen_no_doubletap; frozen_dodging = (self.frozen && autocvar_sv_dodging_frozen); @@ -187,7 +182,7 @@ MUTATOR_HOOKFUNCTION(dodging_GetPressedKeys) { && check_close_to_wall(autocvar_sv_dodging_wall_distance_threshold) != 1) return 0; - if (self.movement_x > 0) { + if (self.movement.x > 0) { // is this a state change? if (!(self.pressedkeys & KEY_FORWARD) || frozen_no_doubletap) { if ((time - self.last_FORWARD_KEY_time) < self.cvar_cl_dodging_timeout) { @@ -198,7 +193,7 @@ MUTATOR_HOOKFUNCTION(dodging_GetPressedKeys) { } } - if (self.movement_x < 0) { + if (self.movement.x < 0) { // is this a state change? if (!(self.pressedkeys & KEY_BACKWARD) || frozen_no_doubletap) { tap_direction_x = -1.0; @@ -209,7 +204,7 @@ MUTATOR_HOOKFUNCTION(dodging_GetPressedKeys) { } } - if (self.movement_y > 0) { + if (self.movement.y > 0) { // is this a state change? if (!(self.pressedkeys & KEY_RIGHT) || frozen_no_doubletap) { tap_direction_y = 1.0; @@ -220,7 +215,7 @@ MUTATOR_HOOKFUNCTION(dodging_GetPressedKeys) { } } - if (self.movement_y < 0) { + if (self.movement.y < 0) { // is this a state change? if (!(self.pressedkeys & KEY_LEFT) || frozen_no_doubletap) { tap_direction_y = -1.0; @@ -239,16 +234,16 @@ MUTATOR_HOOKFUNCTION(dodging_GetPressedKeys) { self.dodging_velocity_gain = autocvar_sv_dodging_horiz_speed; - self.dodging_direction_x = tap_direction_x; - self.dodging_direction_y = tap_direction_y; + self.dodging_direction_x = tap_direction.x; + self.dodging_direction_y = tap_direction.y; // normalize the dodging_direction vector.. (unlike UT99) XD - length = self.dodging_direction_x * self.dodging_direction_x; - length = length + self.dodging_direction_y * self.dodging_direction_y; + length = self.dodging_direction.x * self.dodging_direction.x; + length = length + self.dodging_direction.y * self.dodging_direction.y; length = sqrt(length); - self.dodging_direction_x = self.dodging_direction_x * 1.0/length; - self.dodging_direction_y = self.dodging_direction_y * 1.0/length; + self.dodging_direction_x = self.dodging_direction.x * 1.0/length; + self.dodging_direction_y = self.dodging_direction.y * 1.0/length; } return 0; diff --git a/qcsrc/server/mutators/mutator_multijump.qc b/qcsrc/server/mutators/mutator_multijump.qc index 868ddf246..f380865ad 100644 --- a/qcsrc/server/mutators/mutator_multijump.qc +++ b/qcsrc/server/mutators/mutator_multijump.qc @@ -16,13 +16,13 @@ MUTATOR_HOOKFUNCTION(multijump_PlayerJump) else self.multijump_ready = FALSE; - if(!player_multijump && self.multijump_ready && (autocvar_g_multijump == -1 || self.multijump_count < autocvar_g_multijump) && self.velocity_z > autocvar_g_multijump_speed) + if(!player_multijump && self.multijump_ready && (autocvar_g_multijump == -1 || self.multijump_count < autocvar_g_multijump) && self.velocity.z > autocvar_g_multijump_speed) { if (autocvar_g_multijump) { if (autocvar_g_multijump_add == 0) // in this case we make the z velocity == jumpvelocity { - if (self.velocity_z < autocvar_sv_jumpvelocity) + if (self.velocity.z < autocvar_sv_jumpvelocity) { player_multijump = TRUE; self.velocity_z = 0; @@ -33,7 +33,7 @@ MUTATOR_HOOKFUNCTION(multijump_PlayerJump) if(player_multijump) { - if(self.movement_x != 0 || self.movement_y != 0) // don't remove all speed if player isnt pressing any movement keys + if(self.movement.x != 0 || self.movement.y != 0) // don't remove all speed if player isnt pressing any movement keys { float curspeed; vector wishvel, wishdir; @@ -42,12 +42,12 @@ MUTATOR_HOOKFUNCTION(multijump_PlayerJump) vlen(vec2(self.velocity)), // current xy speed vlen(vec2(antilag_takebackavgvelocity(self, max(self.lastteleporttime + sys_frametime, time - 0.25), time))) // average xy topspeed over the last 0.25 secs ); - makevectors(self.v_angle_y * '0 1 0'); - wishvel = v_forward * self.movement_x + v_right * self.movement_y; + makevectors(self.v_angle.y * '0 1 0'); + wishvel = v_forward * self.movement.x + v_right * self.movement.y; wishdir = normalize(wishvel); - self.velocity_x = wishdir_x * curspeed; // allow "dodging" at a multijump - self.velocity_y = wishdir_y * curspeed; + self.velocity_x = wishdir.x * curspeed; // allow "dodging" at a multijump + self.velocity_y = wishdir.y * curspeed; // keep velocity_z unchanged! } self.multijump_count += 1; diff --git a/qcsrc/server/mutators/mutator_nades.qc b/qcsrc/server/mutators/mutator_nades.qc index 921544411..dda88a74f 100644 --- a/qcsrc/server/mutators/mutator_nades.qc +++ b/qcsrc/server/mutators/mutator_nades.qc @@ -49,9 +49,9 @@ void napalm_damage(float dist, float damage, float edgedamage, float burntime) if(!e.frozen) { p = e.origin; - p_x += e.mins_x + random() * (e.maxs_x - e.mins_x); - p_y += e.mins_y + random() * (e.maxs_y - e.mins_y); - p_z += e.mins_z + random() * (e.maxs_z - e.mins_z); + p.x += e.mins.x + random() * (e.maxs.x - e.mins.x); + p.y += e.mins.y + random() * (e.maxs.y - e.mins.y); + p.z += e.mins.z + random() * (e.maxs.z - e.mins.z); d = vlen(WarpZone_UnTransformOrigin(e, self.origin) - p); if(d < dist) { @@ -341,7 +341,7 @@ void nade_translocate_boom() if(self.realowner.vehicle) return; - vector locout = self.origin + '0 0 1' * (1 - self.realowner.mins_z - 24); + vector locout = self.origin + '0 0 1' * (1 - self.realowner.mins.z - 24); tracebox(locout, self.realowner.mins, self.realowner.maxs, locout, MOVE_NOMONSTERS, self.realowner); locout = trace_endpos; @@ -677,7 +677,7 @@ void toss_nade(entity e, vector _velocity, float _time) if (trace_startsolid) setorigin(_nade, e.origin); - if(self.v_angle_x >= 70 && self.v_angle_x <= 110) + if(self.v_angle.x >= 70 && self.v_angle.x <= 110) _nade.velocity = '0 0 100'; else if(autocvar_g_nades_nade_newton_style == 1) _nade.velocity = e.velocity + _velocity; @@ -921,7 +921,7 @@ MUTATOR_HOOKFUNCTION(nades_PlayerPreThink) self.nade.velocity = self.velocity; setorigin(self.nade, self.origin + self.view_ofs + v_forward * 8 + v_right * -8 + v_up * 0); - self.nade.angles_y = self.angles_y; + self.nade.angles_y = self.angles.y; } if(self.nade) diff --git a/qcsrc/server/mutators/mutator_spawn_near_teammate.qc b/qcsrc/server/mutators/mutator_spawn_near_teammate.qc index ffae9543b..8dc3bbc6c 100644 --- a/qcsrc/server/mutators/mutator_spawn_near_teammate.qc +++ b/qcsrc/server/mutators/mutator_spawn_near_teammate.qc @@ -31,10 +31,10 @@ MUTATOR_HOOKFUNCTION(msnt_Spawn_Score) if(RandomSelection_chosen_ent) { spawn_spot.msnt_lookat = RandomSelection_chosen_ent; - spawn_score_x += SPAWN_PRIO_NEAR_TEAMMATE_FOUND; + spawn_score.x += SPAWN_PRIO_NEAR_TEAMMATE_FOUND; } else if(self.team == spawn_spot.team) - spawn_score_x += SPAWN_PRIO_NEAR_TEAMMATE_SAMETEAM; // prefer same team, if we can't find a spawn near teammate + spawn_score.x += SPAWN_PRIO_NEAR_TEAMMATE_SAMETEAM; // prefer same team, if we can't find a spawn near teammate return 0; } @@ -136,7 +136,7 @@ MUTATOR_HOOKFUNCTION(msnt_PlayerSpawn) else if(spawn_spot.msnt_lookat) { self.angles = vectoangles(spawn_spot.msnt_lookat.origin - self.origin); - self.angles_x = -self.angles_x; + self.angles_x = -self.angles.x; self.angles_z = 0; // never spawn tilted even if the spot says to /* sprint(self, "You should be looking at ", spawn_spot.msnt_lookat.netname, "^7.\n"); diff --git a/qcsrc/server/mutators/mutator_touchexplode.qc b/qcsrc/server/mutators/mutator_touchexplode.qc index 5f02a8aba..3e7aa3f39 100644 --- a/qcsrc/server/mutators/mutator_touchexplode.qc +++ b/qcsrc/server/mutators/mutator_touchexplode.qc @@ -4,7 +4,7 @@ void PlayerTouchExplode(entity p1, entity p2) { vector org; org = (p1.origin + p2.origin) * 0.5; - org_z += (p1.mins_z + p2.mins_z) * 0.5; + org.z += (p1.mins.z + p2.mins.z) * 0.5; sound(self, CH_TRIGGER, "weapons/grenade_impact.wav", VOL_BASE, ATTEN_NORM); pointparticles(particleeffectnum("explosion_small"), org, '0 0 0', 1); diff --git a/qcsrc/server/mutators/sandbox.qc b/qcsrc/server/mutators/sandbox.qc index dec1bf3dd..fc6336bb6 100644 --- a/qcsrc/server/mutators/sandbox.qc +++ b/qcsrc/server/mutators/sandbox.qc @@ -172,7 +172,7 @@ entity sandbox_ObjectSpawn(float database) makevectors(self.v_angle); WarpZone_TraceLine(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * autocvar_g_sandbox_editor_distance_spawn, MOVE_NORMAL, self); setorigin(e, trace_endpos); - e.angles_y = self.v_angle_y; + e.angles_y = self.v_angle.y; } oldself = self; diff --git a/qcsrc/server/pathlib.qc b/qcsrc/server/pathlib.qc index 5a629e9ab..1848f258f 100644 --- a/qcsrc/server/pathlib.qc +++ b/qcsrc/server/pathlib.qc @@ -117,9 +117,9 @@ vector vsnap(vector point,float fsize) { vector vret; - vret_x = rint(point_x / fsize) * fsize; - vret_y = rint(point_y / fsize) * fsize; - vret_z = ceil(point_z / fsize) * fsize; + vret_x = rint(point.x / fsize) * fsize; + vret_y = rint(point.y / fsize) * fsize; + vret_z = ceil(point.z / fsize) * fsize; return vret; } @@ -220,8 +220,8 @@ vector pathlib_wateroutnode(vector start,vector end,float doedge) pathlib_movenode_goodnode = 0; - end_x = fsnap(end_x, pathlib_gridsize); - end_y = fsnap(end_y, pathlib_gridsize); + end_x = fsnap(end.x, pathlib_gridsize); + end_y = fsnap(end.y, pathlib_gridsize); traceline(end + ('0 0 0.25' * pathlib_gridsize),end - ('0 0 1' * pathlib_gridsize),MOVE_WORLDONLY,self); end = trace_endpos; @@ -229,7 +229,7 @@ vector pathlib_wateroutnode(vector start,vector end,float doedge) if(pointcontents(end - '0 0 1') != CONTENT_SOLID) return end; - for(surface = start ; surface_z < (end_z + 32); ++surface_z) + for(surface = start ; surface.z < (end.z + 32); ++surface.z) { if(pointcontents(surface) == CONTENT_EMPTY) break; @@ -242,7 +242,7 @@ vector pathlib_wateroutnode(vector start,vector end,float doedge) if(trace_fraction == 1) pathlib_movenode_goodnode = 1; - if(fabs(surface_z - end_z) > 32) + if(fabs(surface.z - end.z) > 32) pathlib_movenode_goodnode = 0; return end; @@ -255,8 +255,8 @@ vector pathlib_swimnode(vector start,vector end,float doedge) if(pointcontents(start) != CONTENT_WATER) return end; - end_x = fsnap(end_x, pathlib_gridsize); - end_y = fsnap(end_y, pathlib_gridsize); + end_x = fsnap(end.x, pathlib_gridsize); + end_y = fsnap(end.y, pathlib_gridsize); if(pointcontents(end) == CONTENT_EMPTY) return pathlib_wateroutnode( start, end); @@ -272,8 +272,8 @@ vector pathlib_flynode(vector start,vector end) { pathlib_movenode_goodnode = 0; - end_x = fsnap(end_x, pathlib_gridsize); - end_y = fsnap(end_y, pathlib_gridsize); + end_x = fsnap(end.x, pathlib_gridsize); + end_y = fsnap(end.y, pathlib_gridsize); tracebox(start, walknode_boxmin,walknode_boxmax, end, MOVE_WORLDONLY, self); if(trace_fraction == 1) @@ -340,8 +340,8 @@ vector pathlib_walknode(vector start,vector end,float doedge) point = last_point + direction * walknode_stepsize * laststep; - point_x = fsnap(point_x, pathlib_gridsize); - point_y = fsnap(point_y, pathlib_gridsize); + point_x = fsnap(point.x, pathlib_gridsize); + point_y = fsnap(point.y, pathlib_gridsize); s = point + walknode_stepup; e = point - walknode_maxdrop; @@ -403,8 +403,8 @@ float pathlib_h_manhattan(vector a,vector b) //h(n) = D * (abs(n.x-goal.x) + abs(n.y-goal.y)) float h; - h = fabs(a_x - b_x); - h += fabs(a_y - b_y); + h = fabs(a.x - b.x); + h += fabs(a.y - b.y); h *= pathlib_gridsize; return h; @@ -419,8 +419,8 @@ float pathlib_h_diagonal(vector a,vector b) //h(n) = D * max(abs(n.x-goal.x), abs(n.y-goal.y)) float h,x,y; - x = fabs(a_x - b_x); - y = fabs(a_y - b_y); + x = fabs(a.x - b.x); + y = fabs(a.y - b.y); h = pathlib_movecost * max(x,y); return h; @@ -450,8 +450,8 @@ float pathlib_h_diagonal2(vector a,vector b) h(n) = D2 * h_diagonal(n) + D * (h_straight(n) - 2*h_diagonal(n))) */ - x = fabs(a_x - b_x); - y = fabs(a_y - b_y); + x = fabs(a.x - b.x); + y = fabs(a.y - b.y); h_diag = min(x,y); h_str = x + y; @@ -476,9 +476,9 @@ float pathlib_h_diagonal2sdp(vector preprev,vector prev,vector point,vector end) //h_straight(n) = (abs(n.x-goal.x) + abs(n.y-goal.y)) //h(n) = D2 * h_diagonal(n) + D * (h_straight(n) - 2*h_diagonal(n))) - x = fabs(point_x - end_x); - y = fabs(point_y - end_y); - z = fabs(point_z - end_z); + x = fabs(point.x - end.x); + y = fabs(point.y - end.y); + z = fabs(point.z - end.z); h_diag = min3(x,y,z); h_str = x + y + z; @@ -506,9 +506,9 @@ float pathlib_h_diagonal3(vector a,vector b) //h_straight(n) = (abs(n.x-goal.x) + abs(n.y-goal.y)) //h(n) = D2 * h_diagonal(n) + D * (h_straight(n) - 2*h_diagonal(n))) - x = fabs(a_x - b_x); - y = fabs(a_y - b_y); - z = fabs(a_z - b_z); + x = fabs(a.x - b.x); + y = fabs(a.y - b.y); + z = fabs(a.z - b.z); h_diag = min3(x,y,z); h_str = x + y + z; @@ -782,9 +782,9 @@ float pathlib_expandnode_box(entity node, vector start, vector goal) { vector v; - for(v_z = node.origin_z - pathlib_gridsize; v_z <= node.origin_z + pathlib_gridsize; v_z += pathlib_gridsize) - for(v_y = node.origin_y - pathlib_gridsize; v_y <= node.origin_y + pathlib_gridsize; v_y += pathlib_gridsize) - for(v_x = node.origin_x - pathlib_gridsize; v_x <= node.origin_x + pathlib_gridsize; v_x += pathlib_gridsize) + for(v_z = node.origin.z - pathlib_gridsize; v.z <= node.origin.z + pathlib_gridsize; v.z += pathlib_gridsize) + for(v_y = node.origin.y - pathlib_gridsize; v.y <= node.origin.y + pathlib_gridsize; v.y += pathlib_gridsize) + for(v_x = node.origin.x - pathlib_gridsize; v.x <= node.origin.x + pathlib_gridsize; v.x += pathlib_gridsize) { if(vlen(v - node.origin)) pathlib_makenode(node,start,v,goal,pathlib_movecost); @@ -929,16 +929,16 @@ entity pathlib_astar(vector from,vector to) pathlib_edge_check_size = (vlen(walknode_boxmin - walknode_boxmax) * 0.5); - walknode_boxup = '0 0 2' * self.maxs_z; + walknode_boxup = '0 0 2' * self.maxs.z; walknode_stepsize = 32; walknode_stepup = '0 0 1' * walknode_stepsize; walknode_maxdrop = '0 0 3' * walknode_stepsize; - from_x = fsnap(from_x,pathlib_gridsize); - from_y = fsnap(from_y,pathlib_gridsize); + from_x = fsnap(from.x,pathlib_gridsize); + from_y = fsnap(from.y,pathlib_gridsize); - to_x = fsnap(to_x,pathlib_gridsize); - to_y = fsnap(to_y,pathlib_gridsize); + to_x = fsnap(to.x,pathlib_gridsize); + to_y = fsnap(to.y,pathlib_gridsize); dprint("AStar init. ", ftos(pathlib_scraplist_cnt), " nodes on scrap\n"); path = pathlib_mknode(from,world); diff --git a/qcsrc/server/pathlib/costs.qc b/qcsrc/server/pathlib/costs.qc index 86f32e218..0b2ee4559 100644 --- a/qcsrc/server/pathlib/costs.qc +++ b/qcsrc/server/pathlib/costs.qc @@ -34,8 +34,8 @@ float pathlib_h_manhattan(vector a,vector b) //h(n) = D * (abs(n.x-goal.x) + abs(n.y-goal.y)) float h; - h = fabs(a_x - b_x); - h += fabs(a_y - b_y); + h = fabs(a.x - b.x); + h += fabs(a.y - b.y); h *= pathlib_gridsize; return h; @@ -50,8 +50,8 @@ float pathlib_h_diagonal(vector a,vector b) //h(n) = D * max(abs(n.x-goal.x), abs(n.y-goal.y)) float h,x,y; - x = fabs(a_x - b_x); - y = fabs(a_y - b_y); + x = fabs(a.x - b.x); + y = fabs(a.y - b.y); h = pathlib_movecost * max(x,y); return h; @@ -81,8 +81,8 @@ float pathlib_h_diagonal2(vector a,vector b) h(n) = D2 * h_diagonal(n) + D * (h_straight(n) - 2*h_diagonal(n))) */ - x = fabs(a_x - b_x); - y = fabs(a_y - b_y); + x = fabs(a.x - b.x); + y = fabs(a.y - b.y); h_diag = min(x,y); h_str = x + y; @@ -105,9 +105,9 @@ float pathlib_h_diagonal2sdp(vector preprev,vector prev,vector point,vector end) //h_straight(n) = (abs(n.x-goal.x) + abs(n.y-goal.y)) //h(n) = D2 * h_diagonal(n) + D * (h_straight(n) - 2*h_diagonal(n))) - x = fabs(point_x - end_x); - y = fabs(point_y - end_y); - z = fabs(point_z - end_z); + x = fabs(point.x - end.x); + y = fabs(point.y - end.y); + z = fabs(point.z - end.z); h_diag = min3(x,y,z); h_str = x + y + z; @@ -130,9 +130,9 @@ float pathlib_h_diagonal3(vector a,vector b) { float h_diag,h_str,h,x,y,z; - x = fabs(a_x - b_x); - y = fabs(a_y - b_y); - z = fabs(a_z - b_z); + x = fabs(a.x - b.x); + y = fabs(a.y - b.y); + z = fabs(a.z - b.z); h_diag = min3(x,y,z); h_str = x + y + z; diff --git a/qcsrc/server/pathlib/expandnode.qc b/qcsrc/server/pathlib/expandnode.qc index a08c66b3a..70d6de7a8 100644 --- a/qcsrc/server/pathlib/expandnode.qc +++ b/qcsrc/server/pathlib/expandnode.qc @@ -220,9 +220,9 @@ float pathlib_expandnode_box(entity node, vector start, vector goal) { vector v; - for(v_z = node.origin_z - pathlib_gridsize; v_z <= node.origin_z + pathlib_gridsize; v_z += pathlib_gridsize) - for(v_y = node.origin_y - pathlib_gridsize; v_y <= node.origin_y + pathlib_gridsize; v_y += pathlib_gridsize) - for(v_x = node.origin_x - pathlib_gridsize; v_x <= node.origin_x + pathlib_gridsize; v_x += pathlib_gridsize) + for(v_z = node.origin.z - pathlib_gridsize; v.z <= node.origin.z + pathlib_gridsize; v.z += pathlib_gridsize) + for(v_y = node.origin.y - pathlib_gridsize; v.y <= node.origin.y + pathlib_gridsize; v.y += pathlib_gridsize) + for(v_x = node.origin.x - pathlib_gridsize; v.x <= node.origin.x + pathlib_gridsize; v.x += pathlib_gridsize) { //if(vlen(v - node.origin)) pathlib_makenode(node,start,v,goal,pathlib_movecost); diff --git a/qcsrc/server/pathlib/main.qc b/qcsrc/server/pathlib/main.qc index 897c0005d..5e1db5051 100644 --- a/qcsrc/server/pathlib/main.qc +++ b/qcsrc/server/pathlib/main.qc @@ -443,12 +443,12 @@ entity pathlib_astar(vector from,vector to) //movenode_maxdrop = '0 0 512'; movenode_boxup = '0 0 72'; - from_x = fsnap(from_x, pathlib_gridsize); - from_y = fsnap(from_y, pathlib_gridsize); + from_x = fsnap(from.x, pathlib_gridsize); + from_y = fsnap(from.y, pathlib_gridsize); //from_z += 32; - to_x = fsnap(to_x, pathlib_gridsize); - to_y = fsnap(to_y, pathlib_gridsize); + to_x = fsnap(to.x, pathlib_gridsize); + to_y = fsnap(to.y, pathlib_gridsize); //to_z += 32; dprint("AStar init\n"); diff --git a/qcsrc/server/pathlib/movenode.qc b/qcsrc/server/pathlib/movenode.qc index 997eaa420..202774196 100644 --- a/qcsrc/server/pathlib/movenode.qc +++ b/qcsrc/server/pathlib/movenode.qc @@ -4,8 +4,8 @@ vector pathlib_wateroutnode(vector start,vector end, float doedge) pathlib_movenode_goodnode = 0; - end_x = fsnap(end_x, pathlib_gridsize); - end_y = fsnap(end_y, pathlib_gridsize); + end_x = fsnap(end.x, pathlib_gridsize); + end_y = fsnap(end.y, pathlib_gridsize); traceline(end + ('0 0 0.25' * pathlib_gridsize),end - ('0 0 1' * pathlib_gridsize),MOVE_WORLDONLY,self); end = trace_endpos; @@ -13,7 +13,7 @@ vector pathlib_wateroutnode(vector start,vector end, float doedge) if (!(pointcontents(end - '0 0 1') == CONTENT_SOLID)) return end; - for(surface = start ; surface_z < (end_z + 32); ++surface_z) + for(surface = start ; surface.z < (end.z + 32); ++surface.z) { if(pointcontents(surface) == CONTENT_EMPTY) break; @@ -26,7 +26,7 @@ vector pathlib_wateroutnode(vector start,vector end, float doedge) if(trace_fraction == 1) pathlib_movenode_goodnode = 1; - if(fabs(surface_z - end_z) > 32) + if(fabs(surface.z - end.z) > 32) pathlib_movenode_goodnode = 0; return end; @@ -39,8 +39,8 @@ vector pathlib_swimnode(vector start,vector end, float doedge) if(pointcontents(start) != CONTENT_WATER) return end; - end_x = fsnap(end_x, pathlib_gridsize); - end_y = fsnap(end_y, pathlib_gridsize); + end_x = fsnap(end.x, pathlib_gridsize); + end_y = fsnap(end.y, pathlib_gridsize); if(pointcontents(end) == CONTENT_EMPTY) return pathlib_wateroutnode( start, end, doedge); @@ -56,8 +56,8 @@ vector pathlib_flynode(vector start,vector end, float doedge) { pathlib_movenode_goodnode = 0; - end_x = fsnap(end_x, pathlib_gridsize); - end_y = fsnap(end_y, pathlib_gridsize); + end_x = fsnap(end.x, pathlib_gridsize); + end_y = fsnap(end.y, pathlib_gridsize); tracebox(start, movenode_boxmin,movenode_boxmax, end, MOVE_WORLDONLY, self); if(trace_fraction == 1) @@ -84,10 +84,10 @@ vector pathlib_walknode(vector start,vector end,float doedge) pathlib_movenode_goodnode = 0; - end_x = fsnap(end_x,pathlib_gridsize); - end_y = fsnap(end_y,pathlib_gridsize); - start_x = fsnap(start_x,pathlib_gridsize); - start_y = fsnap(start_y,pathlib_gridsize); + end_x = fsnap(end.x,pathlib_gridsize); + end_y = fsnap(end.y,pathlib_gridsize); + start_x = fsnap(start.x,pathlib_gridsize); + start_y = fsnap(start.y,pathlib_gridsize); // Find the floor traceline(start + movenode_stepup, start - movenode_maxdrop, MOVE_WORLDONLY, self); @@ -128,8 +128,8 @@ vector pathlib_walknode(vector start,vector end,float doedge) } point = last_point + (direction * movenode_stepsize); - point_x = fsnap(point_x,pathlib_gridsize); - point_y = fsnap(point_y,pathlib_gridsize); + point_x = fsnap(point.x,pathlib_gridsize); + point_y = fsnap(point.y,pathlib_gridsize); //dprint("end_x: ",ftos(end_x), " end_y: ",ftos(end_y),"\n"); //dprint("point_x:",ftos(point_x)," point_y:",ftos(point_y),"\n\n"); diff --git a/qcsrc/server/pathlib/utility.qc b/qcsrc/server/pathlib/utility.qc index 7a0aec865..5a82e0845 100644 --- a/qcsrc/server/pathlib/utility.qc +++ b/qcsrc/server/pathlib/utility.qc @@ -7,9 +7,9 @@ vector vsnap(vector point,float fsize) { vector vret; - vret_x = rint(point_x / fsize) * fsize; - vret_y = rint(point_y / fsize) * fsize; - vret_z = ceil(point_z / fsize) * fsize; + vret_x = rint(point.x / fsize) * fsize; + vret_y = rint(point.y / fsize) * fsize; + vret_z = ceil(point.z / fsize) * fsize; return vret; } @@ -68,8 +68,8 @@ entity pathlib_nodeatpoint(vector where) ++pathlib_searched_cnt; - where_x = fsnap(where_x,pathlib_gridsize); - where_y = fsnap(where_y,pathlib_gridsize); + where_x = fsnap(where.x,pathlib_gridsize); + where_y = fsnap(where.y,pathlib_gridsize); node = findradius(where,pathlib_gridsize * 0.5); while(node) diff --git a/qcsrc/server/portals.qc b/qcsrc/server/portals.qc index 28cbfdaff..decd42dd5 100644 --- a/qcsrc/server/portals.qc +++ b/qcsrc/server/portals.qc @@ -13,9 +13,9 @@ float PlayerEdgeDistance(entity p, vector v) { vector vbest; - if(v_x < 0) vbest_x = p.mins_x; else vbest_x = p.maxs_x; - if(v_y < 0) vbest_y = p.mins_y; else vbest_y = p.maxs_y; - if(v_z < 0) vbest_z = p.mins_z; else vbest_z = p.maxs_z; + if(v.x < 0) vbest_x = p.mins.x; else vbest_x = p.maxs.x; + if(v.y < 0) vbest_y = p.mins.y; else vbest_y = p.maxs.y; + if(v.z < 0) vbest_z = p.mins.z; else vbest_z = p.maxs.z; return vbest * v; } @@ -36,7 +36,7 @@ vector Portal_ApplyTransformToPlayerAngle(vector transform, vector vangle) // PLAYERS use different math #ifndef POSITIVE_PITCH_IS_DOWN - ang_x = -ang_x; + ang_x = -ang.x; #endif //print("reference: ", vtos(AnglesTransform_ApplyToVAngles(transform, ang)), "\n"); @@ -44,7 +44,7 @@ vector Portal_ApplyTransformToPlayerAngle(vector transform, vector vangle) fixedmakevectors(ang); old_forward = v_forward; old_up = v_up; - fixedmakevectors(ang_y * '0 1 0'); + fixedmakevectors(ang.y * '0 1 0'); old_yawforward = v_forward; // their aiming directions are portalled... @@ -59,7 +59,7 @@ vector Portal_ApplyTransformToPlayerAngle(vector transform, vector vangle) // // new_up could now point forward OR backward... which direction to choose? - if(new_forward_z > 0.7 || new_forward_z < -0.7) // far up; in this case, the "up" vector points backwards + if(new_forward.z > 0.7 || new_forward.z < -0.7) // far up; in this case, the "up" vector points backwards { // new_yawforward and new_yawup define the new aiming half-circle // we "just" need to find out whether new_up or -new_up is in that half circle @@ -77,9 +77,9 @@ vector Portal_ApplyTransformToPlayerAngle(vector transform, vector vangle) } #ifndef POSITIVE_PITCH_IS_DOWN - ang_x = -ang_x; + ang_x = -ang.x; #endif - ang_z = vangle_z; + ang_z = vangle.z; return ang; } @@ -216,9 +216,9 @@ float Portal_WillHitPlane(vector eorg, vector emins, vector emaxs, vector evel, vector v; dist = (eorg - porg) * pnorm; - dist += min(emins_x * pnorm_x, emaxs_x * pnorm_x); - dist += min(emins_y * pnorm_y, emaxs_y * pnorm_y); - dist += min(emins_z * pnorm_z, emaxs_z * pnorm_z); + dist += min(emins.x * pnorm.x, emaxs.x * pnorm.x); + dist += min(emins.y * pnorm.y, emaxs.y * pnorm.y); + dist += min(emins.z * pnorm.z, emaxs.z * pnorm.z); if(dist < -1) // other side? return 0; #ifdef PORTALS_ARE_NOT_SOLID @@ -286,7 +286,7 @@ void Portal_Touch() return; // cannot go through someone else's portal fixedmakevectors(self.mangle); g = frametime * '0 0 -1' * autocvar_sv_gravity; - if(!Portal_WillHitPlane(other.origin, other.mins, other.maxs, other.velocity + g, self.origin, v_forward, self.maxs_x)) + if(!Portal_WillHitPlane(other.origin, other.mins, other.maxs, other.velocity + g, self.origin, v_forward, self.maxs.x)) return; /* @@ -424,7 +424,7 @@ void Portal_Damage(entity inflictor, entity attacker, float damage, float deatht void Portal_Think_TryTeleportPlayer(entity e, vector g) { - if(!Portal_WillHitPlane(e.origin, e.mins, e.maxs, e.velocity + g, self.origin, v_forward, self.maxs_x)) + if(!Portal_WillHitPlane(e.origin, e.mins, e.maxs, e.velocity + g, self.origin, v_forward, self.maxs.x)) return; // if e would hit the portal in a frame... @@ -612,7 +612,7 @@ entity Portal_Spawn(entity own, vector org, vector ang) setorigin(portal, org); portal.mangle = ang; portal.angles = ang; - portal.angles_x = -portal.angles_x; // is a bmodel + portal.angles_x = -portal.angles.x; // is a bmodel portal.think = Portal_Think; portal.nextthink = 0; portal.portal_activatetime = time + 0.1; diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index f3748f9ce..5c123ebc5 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -877,7 +877,7 @@ vector trigger_race_checkpoint_spawn_evalfunc(entity player, entity spot, vector return '-1 0 0'; // try reusing the previous spawn if(self == player.race_respawn_spotref || spot == player.race_respawn_spotref) - current_x += SPAWN_PRIO_RACE_PREVIOUS_SPAWN; + current.x += SPAWN_PRIO_RACE_PREVIOUS_SPAWN; if(self.race_checkpoint == 0) { float pl; @@ -905,7 +905,7 @@ void spawnfunc_trigger_race_checkpoint() self.touch = checkpoint_touch; o = (self.absmin + self.absmax) * 0.5; - tracebox(o, PL_MIN, PL_MAX, o - '0 0 1' * (o_z - self.absmin_z), MOVE_NORMAL, self); + tracebox(o, PL_MIN, PL_MAX, o - '0 0 1' * (o.z - self.absmin.z), MOVE_NORMAL, self); waypoint_spawnforitem_force(self, trace_endpos); self.nearestwaypointtimeout = time + 1000000000; @@ -954,7 +954,7 @@ void spawnfunc_target_checkpoint() // defrag entity self.touch = checkpoint_touch; o = (self.absmin + self.absmax) * 0.5; - tracebox(o, PL_MIN, PL_MAX, o - '0 0 1' * (o_z - self.absmin_z), MOVE_NORMAL, self); + tracebox(o, PL_MIN, PL_MAX, o - '0 0 1' * (o.z - self.absmin.z), MOVE_NORMAL, self); waypoint_spawnforitem_force(self, trace_endpos); self.nearestwaypointtimeout = time + 1000000000; diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc index d1a832ed7..d2ff30449 100644 --- a/qcsrc/server/scores.qc +++ b/qcsrc/server/scores.qc @@ -14,7 +14,7 @@ vector ScoreField_Compare(entity t1, entity t2, .float field, float fieldflags, { if(!strict && !(fieldflags & SFL_SORT_PRIO_MASK)) // column does not sort return previous; - if((fieldflags & SFL_SORT_PRIO_MASK) < previous_y) + if((fieldflags & SFL_SORT_PRIO_MASK) < previous.y) return previous; if(t1.field == t2.field) return previous; @@ -139,7 +139,7 @@ float TeamScore_Compare(entity t1, entity t2, float strict) if (result_x == 0 && strict) result_x = t1.team - t2.team; - return result_x; + return result.x; } /* @@ -376,7 +376,7 @@ float PlayerScore_Compare(entity t1, entity t2, float strict) if (result_x == 0 && strict) result_x = num_for_edict(t1.owner) - num_for_edict(t2.owner); - return result_x; + return result.x; } void WinningConditionHelper() diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index 3f4e72c3b..511db81c7 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -3,9 +3,9 @@ float SpawnPoint_Send(entity to, float sf) WriteByte(MSG_ENTITY, ENT_CLIENT_SPAWNPOINT); WriteByte(MSG_ENTITY, self.team); - WriteShort(MSG_ENTITY, self.origin_x); - WriteShort(MSG_ENTITY, self.origin_y); - WriteShort(MSG_ENTITY, self.origin_z); + WriteShort(MSG_ENTITY, self.origin.x); + WriteShort(MSG_ENTITY, self.origin.y); + WriteShort(MSG_ENTITY, self.origin.z); return TRUE; } @@ -19,9 +19,9 @@ float SpawnEvent_Send(entity to, float sf) if(autocvar_g_spawn_alloweffects) { WriteByte(MSG_ENTITY, num_for_edict(self.owner)); - WriteShort(MSG_ENTITY, self.owner.origin_x); - WriteShort(MSG_ENTITY, self.owner.origin_y); - WriteShort(MSG_ENTITY, self.owner.origin_z); + WriteShort(MSG_ENTITY, self.owner.origin.x); + WriteShort(MSG_ENTITY, self.owner.origin.y); + WriteShort(MSG_ENTITY, self.owner.origin.z); send = TRUE; } else if((to == self.owner) || (IS_SPEC(to) && (to.enemy == self.owner)) ) @@ -60,9 +60,9 @@ void relocate_spawnpoint() if (!move_out_of_solid(self)) objerror("could not get out of solid at all!"); print("^1NOTE: this map needs FIXING. Spawnpoint at ", vtos(o - '0 0 1')); - print(" needs to be moved out of solid, e.g. by '", ftos(self.origin_x - o_x)); - print(" ", ftos(self.origin_y - o_y)); - print(" ", ftos(self.origin_z - o_z), "'\n"); + print(" needs to be moved out of solid, e.g. by '", ftos(self.origin.x - o.x)); + print(" ", ftos(self.origin.y - o.y)); + print(" ", ftos(self.origin.z - o.z), "'\n"); if (autocvar_g_spawnpoints_auto_move_out_of_solid) { if (!spawnpoint_nag) @@ -205,7 +205,7 @@ vector Spawn_Score(entity spot, float mindist, float teamcheck) self = ent; spawn_score = ent.spawn_evalfunc(oldself, spot, spawn_score); self = oldself; - if(spawn_score_x < 0) + if(spawn_score.x < 0) return spawn_score; } } @@ -239,7 +239,7 @@ entity Spawn_FilterOutBadSpots(entity firstspot, float mindist, float teamcheck) for(spot = firstspot; spot; spot = spot.chain) { - if(spot.spawnpoint_score_x >= 0) // spawning allowed here + if(spot.spawnpoint_score.x >= 0) // spawning allowed here { if(spotlistend) spotlistend.chain = spot; @@ -262,7 +262,7 @@ entity Spawn_WeightedPoint(entity firstspot, float lower, float upper, float exp RandomSelection_Init(); for(spot = firstspot; spot; spot = spot.chain) - RandomSelection_Add(spot, 0, string_null, pow(bound(lower, spot.spawnpoint_score_y, upper), exponent) * spot.cnt, (spot.spawnpoint_score_y >= lower) * 0.5 + spot.spawnpoint_score_x); + RandomSelection_Add(spot, 0, string_null, pow(bound(lower, spot.spawnpoint_score.y, upper), exponent) * spot.cnt, (spot.spawnpoint_score.y >= lower) * 0.5 + spot.spawnpoint_score.x); return RandomSelection_chosen_ent; } diff --git a/qcsrc/server/steerlib.qc b/qcsrc/server/steerlib.qc index 2f59924df..fb243792b 100644 --- a/qcsrc/server/steerlib.qc +++ b/qcsrc/server/steerlib.qc @@ -420,7 +420,7 @@ vector steerlib_beamsteer(vector dir, float length, float step, float step_up, f float bm_forward, bm_right, bm_left,p; vector vr,vl; - dir_z *= 0.15; + dir.z *= 0.15; vr = vectoangles(dir); //vr_x *= -1; @@ -508,9 +508,9 @@ void flocker_think() vector dodgemove,swarmmove; vector reprellmove,wandermove,newmove; - self.angles_x = self.angles_x * -1; + self.angles_x = self.angles.x * -1; makevectors(self.angles); - self.angles_x = self.angles_x * -1; + self.angles_x = self.angles.x * -1; dodgemove = steerlib_traceavoid(0.35,1000); swarmmove = steerlib_flock(500,75,700,500); @@ -585,9 +585,9 @@ void flocker_hunter_think() entity e,ee; float d,bd; - self.angles_x = self.angles_x * -1; + self.angles_x = self.angles.x * -1; makevectors(self.angles); - self.angles_x = self.angles_x * -1; + self.angles_x = self.angles.x * -1; if(self.enemy) if(vlen(self.enemy.origin - self.origin) < 64) diff --git a/qcsrc/server/sv_main.qc b/qcsrc/server/sv_main.qc index b25528e16..c035f9865 100644 --- a/qcsrc/server/sv_main.qc +++ b/qcsrc/server/sv_main.qc @@ -379,20 +379,20 @@ void SV_OnEntityPreSpawnFunction() else if (self.angles == '0 -2 0') self.angles = '+90 0 0'; - if(self.originjitter_x != 0) - self.origin_x = self.origin_x + (random() * 2 - 1) * self.originjitter_x; - if(self.originjitter_y != 0) - self.origin_y = self.origin_y + (random() * 2 - 1) * self.originjitter_y; - if(self.originjitter_z != 0) - self.origin_z = self.origin_z + (random() * 2 - 1) * self.originjitter_z; - if(self.anglesjitter_x != 0) - self.angles_x = self.angles_x + (random() * 2 - 1) * self.anglesjitter_x; - if(self.anglesjitter_y != 0) - self.angles_y = self.angles_y + (random() * 2 - 1) * self.anglesjitter_y; - if(self.anglesjitter_z != 0) - self.angles_z = self.angles_z + (random() * 2 - 1) * self.anglesjitter_z; + if(self.originjitter.x != 0) + self.origin_x = self.origin.x + (random() * 2 - 1) * self.originjitter.x; + if(self.originjitter.y != 0) + self.origin_y = self.origin.y + (random() * 2 - 1) * self.originjitter.y; + if(self.originjitter.z != 0) + self.origin_z = self.origin.z + (random() * 2 - 1) * self.originjitter.z; + if(self.anglesjitter.x != 0) + self.angles_x = self.angles.x + (random() * 2 - 1) * self.anglesjitter.x; + if(self.anglesjitter.y != 0) + self.angles_y = self.angles.y + (random() * 2 - 1) * self.anglesjitter.y; + if(self.anglesjitter.z != 0) + self.angles_z = self.angles.z + (random() * 2 - 1) * self.anglesjitter.z; if(self.anglejitter != 0) - self.angles_y = self.angles_y + (random() * 2 - 1) * self.anglejitter; + self.angles_y = self.angles.y + (random() * 2 - 1) * self.anglejitter; if(MUTATOR_CALLHOOK(OnEntityPreSpawn)) { diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index 88b4c7a03..40d80c9d4 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -212,26 +212,26 @@ float ItemSend(entity to, float sf) //WriteByte(MSG_ENTITY, self.cnt); if(sf & ISF_LOCATION) { - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); + WriteCoord(MSG_ENTITY, self.origin.x); + WriteCoord(MSG_ENTITY, self.origin.y); + WriteCoord(MSG_ENTITY, self.origin.z); } if(sf & ISF_ANGLES) { - WriteCoord(MSG_ENTITY, self.angles_x); - WriteCoord(MSG_ENTITY, self.angles_y); - WriteCoord(MSG_ENTITY, self.angles_z); + WriteCoord(MSG_ENTITY, self.angles.x); + WriteCoord(MSG_ENTITY, self.angles.y); + WriteCoord(MSG_ENTITY, self.angles.z); } if(sf & ISF_SIZE) { - WriteCoord(MSG_ENTITY, self.mins_x); - WriteCoord(MSG_ENTITY, self.mins_y); - WriteCoord(MSG_ENTITY, self.mins_z); - WriteCoord(MSG_ENTITY, self.maxs_x); - WriteCoord(MSG_ENTITY, self.maxs_y); - WriteCoord(MSG_ENTITY, self.maxs_z); + WriteCoord(MSG_ENTITY, self.mins.x); + WriteCoord(MSG_ENTITY, self.mins.y); + WriteCoord(MSG_ENTITY, self.mins.z); + WriteCoord(MSG_ENTITY, self.maxs.x); + WriteCoord(MSG_ENTITY, self.maxs.y); + WriteCoord(MSG_ENTITY, self.maxs.z); } if(sf & ISF_STATUS) @@ -252,9 +252,9 @@ float ItemSend(entity to, float sf) if(sf & ISF_DROP) { - WriteCoord(MSG_ENTITY, self.velocity_x); - WriteCoord(MSG_ENTITY, self.velocity_y); - WriteCoord(MSG_ENTITY, self.velocity_z); + WriteCoord(MSG_ENTITY, self.velocity.x); + WriteCoord(MSG_ENTITY, self.velocity.y); + WriteCoord(MSG_ENTITY, self.velocity.z); } return TRUE; diff --git a/qcsrc/server/t_jumppads.qc b/qcsrc/server/t_jumppads.qc index f52b492a7..2b939028c 100644 --- a/qcsrc/server/t_jumppads.qc +++ b/qcsrc/server/t_jumppads.qc @@ -40,7 +40,7 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht) if(other.gravity) grav *= other.gravity; - zdist = torg_z - org_z; + zdist = torg.z - org.z; sdist = vlen(torg - org - zdist * '0 0 1'); sdir = normalize(torg - org - zdist * '0 0 1'); @@ -81,10 +81,10 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht) vector solution; solution = solve_quadratic(0.5 * grav, -vz, zdist); // equation "z(ti) = zdist" // ALWAYS solvable because jumpheight >= zdist - if(!solution_z) - solution_y = solution_x; // just in case it is not solvable due to roundoff errors, assume two equal solutions at their center (this is mainly for the usual case with ht == 0) + if(!solution.z) + solution_y = solution.x; // just in case it is not solvable due to roundoff errors, assume two equal solutions at their center (this is mainly for the usual case with ht == 0) if(zdist == 0) - solution_x = solution_y; // solution_x is 0 in this case, so don't use it, but rather use solution_y (which will be sqrt(0.5 * jumpheight / grav), actually) + solution_x = solution.y; // solution_x is 0 in this case, so don't use it, but rather use solution_y (which will be sqrt(0.5 * jumpheight / grav), actually) if(zdist < 0) { @@ -94,14 +94,14 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht) // almost straight line type // jump apex is before the jump // we must take the larger one - trigger_push_calculatevelocity_flighttime = solution_y; + trigger_push_calculatevelocity_flighttime = solution.y; } else { // regular jump // jump apex is during the jump // we must take the larger one too - trigger_push_calculatevelocity_flighttime = solution_y; + trigger_push_calculatevelocity_flighttime = solution.y; } } else @@ -112,14 +112,14 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht) // almost straight line type // jump apex is after the jump // we must take the smaller one - trigger_push_calculatevelocity_flighttime = solution_x; + trigger_push_calculatevelocity_flighttime = solution.x; } else { // regular jump // jump apex is during the jump // we must take the larger one - trigger_push_calculatevelocity_flighttime = solution_y; + trigger_push_calculatevelocity_flighttime = solution.y; } } vs = sdist / trigger_push_calculatevelocity_flighttime; @@ -254,7 +254,7 @@ void trigger_push_findtarget() // first calculate a typical start point for the jump org = (self.absmin + self.absmax) * 0.5; - org_z = self.absmax_z - PL_MIN_z; + org_z = self.absmax.z - PL_MIN_z; if (self.target) { diff --git a/qcsrc/server/t_plats.qc b/qcsrc/server/t_plats.qc index b6bf68e77..be3c6b07f 100644 --- a/qcsrc/server/t_plats.qc +++ b/qcsrc/server/t_plats.qc @@ -37,24 +37,24 @@ void plat_spawn_inside_trigger() tmin = self.absmin + '25 25 0'; tmax = self.absmax - '25 25 -8'; - tmin_z = tmax_z - (self.pos1_z - self.pos2_z + 8); + tmin_z = tmax.z - (self.pos1_z - self.pos2_z + 8); if (self.spawnflags & PLAT_LOW_TRIGGER) - tmax_z = tmin_z + 8; + tmax_z = tmin.z + 8; - if (self.size_x <= 50) + if (self.size.x <= 50) { - tmin_x = (self.mins_x + self.maxs_x) / 2; - tmax_x = tmin_x + 1; + tmin_x = (self.mins.x + self.maxs.x) / 2; + tmax_x = tmin.x + 1; } - if (self.size_y <= 50) + if (self.size.y <= 50) { - tmin_y = (self.mins_y + self.maxs_y) / 2; - tmax_y = tmin_y + 1; + tmin_y = (self.mins.y + self.maxs.y) / 2; + tmax_y = tmin.y + 1; } - if(tmin_x < tmax_x) - if(tmin_y < tmax_y) - if(tmin_z < tmax_z) + if(tmin.x < tmax.x) + if(tmin.y < tmax.y) + if(tmin.z < tmax.z) { setsize (trigger, tmin, tmax); return; @@ -270,11 +270,11 @@ void spawnfunc_func_plat() if (!self.lip) self.lip = 16; if (!self.height) - self.height = self.size_z - self.lip; + self.height = self.size.z - self.lip; self.pos1 = self.origin; self.pos2 = self.origin; - self.pos2_z = self.origin_z - self.height; + self.pos2_z = self.origin.z - self.height; self.reset = plat_reset; plat_reset(); @@ -309,7 +309,7 @@ void train_wait() else // linear movement ang = targ.origin - (self.origin - self.view_ofs); // use the origin of the next path_corner ang = vectoangles(ang); - ang_x = -ang_x; // flip up / down orientation + ang_x = -ang.x; // flip up / down orientation if(self.wait > 0) // slow turning SUB_CalcAngleMove(ang, TSPEED_TIME, self.ltime - time + self.wait, train_wait); @@ -536,7 +536,7 @@ void func_bobbing_controller_think() // calculate sinewave using makevectors makevectors((self.nextthink * self.owner.cnt + self.owner.phase * 360) * '0 1 0'); - v = self.owner.destvec + self.owner.movedir * v_forward_y; + v = self.owner.destvec + self.owner.movedir * v_forward.y; if(self.owner.classname == "func_bobbing") // don't brake stuff if the func_bobbing was killtarget'ed // * 10 so it will arrive in 0.1 sec self.owner.velocity = (v - self.owner.origin) * 10; @@ -620,11 +620,11 @@ void func_pendulum_controller_think() // calculate sinewave using makevectors makevectors((self.nextthink * self.owner.freq + self.owner.phase) * '0 360 0'); - v = self.owner.speed * v_forward_y + self.cnt; + v = self.owner.speed * v_forward.y + self.cnt; if(self.owner.classname == "func_pendulum") // don't brake stuff if the func_bobbing was killtarget'ed { // * 10 so it will arrive in 0.1 sec - self.owner.avelocity_z = (remainder(v - self.owner.angles_z, 360)) * 10; + self.owner.avelocity_z = (remainder(v - self.owner.angles.z, 360)) * 10; } } @@ -662,11 +662,11 @@ void spawnfunc_func_pendulum() if(!self.freq) { // find pendulum length (same formula as Q3A) - self.freq = 1 / (M_PI * 2) * sqrt(autocvar_sv_gravity / (3 * max(8, fabs(self.mins_z)))); + self.freq = 1 / (M_PI * 2) * sqrt(autocvar_sv_gravity / (3 * max(8, fabs(self.mins.z)))); } // copy initial angle - self.cnt = self.angles_z; + self.cnt = self.angles.z; // wait for targets to spawn controller = spawn(); @@ -1317,17 +1317,17 @@ entity LinkDoors_nextent(entity cur, entity near, entity pass) float LinkDoors_isconnected(entity e1, entity e2, entity pass) { float DELTA = 4; - if (e1.absmin_x > e2.absmax_x + DELTA) + if (e1.absmin.x > e2.absmax.x + DELTA) return FALSE; - if (e1.absmin_y > e2.absmax_y + DELTA) + if (e1.absmin.y > e2.absmax.y + DELTA) return FALSE; - if (e1.absmin_z > e2.absmax_z + DELTA) + if (e1.absmin.z > e2.absmax.z + DELTA) return FALSE; - if (e2.absmin_x > e1.absmax_x + DELTA) + if (e2.absmin.x > e1.absmax.x + DELTA) return FALSE; - if (e2.absmin_y > e1.absmax_y + DELTA) + if (e2.absmin.y > e1.absmax.y + DELTA) return FALSE; - if (e2.absmin_z > e1.absmax_z + DELTA) + if (e2.absmin.z > e1.absmax.z + DELTA) return FALSE; return TRUE; } @@ -1388,18 +1388,18 @@ void LinkDoors() self.targetname = t.targetname; if((t.message != "") && (self.message == "")) self.message = t.message; - if (t.absmin_x < cmins_x) - cmins_x = t.absmin_x; - if (t.absmin_y < cmins_y) - cmins_y = t.absmin_y; - if (t.absmin_z < cmins_z) - cmins_z = t.absmin_z; - if (t.absmax_x > cmaxs_x) - cmaxs_x = t.absmax_x; - if (t.absmax_y > cmaxs_y) - cmaxs_y = t.absmax_y; - if (t.absmax_z > cmaxs_z) - cmaxs_z = t.absmax_z; + if (t.absmin.x < cmins.x) + cmins_x = t.absmin.x; + if (t.absmin.y < cmins.y) + cmins_y = t.absmin.y; + if (t.absmin.z < cmins.z) + cmins_z = t.absmin.z; + if (t.absmax.x > cmaxs.x) + cmaxs_x = t.absmax.x; + if (t.absmax.y > cmaxs.y) + cmaxs_y = t.absmax.y; + if (t.absmax.z > cmaxs.z) + cmaxs_z = t.absmax.z; if(t.enemy == self) break; } @@ -1608,9 +1608,9 @@ void spawnfunc_func_door_rotating() else // Z self.movedir = '0 1 0'; - if (self.angles_y==0) self.angles_y = 90; + if (self.angles_y ==0) self.angles_y = 90; - self.movedir = self.movedir * self.angles_y; + self.movedir = self.movedir * self.angles.y; self.angles = '0 0 0'; self.max_health = self.health; @@ -1949,7 +1949,7 @@ void func_fourier_controller_think() for(i = 0; i < n; ++i) { makevectors((t * stof(argv(i*5)) + stof(argv(i*5+1)) * 360) * '0 1 0'); - v = v + ('1 0 0' * stof(argv(i*5+2)) + '0 1 0' * stof(argv(i*5+3)) + '0 0 1' * stof(argv(i*5+4))) * self.owner.height * v_forward_y; + v = v + ('1 0 0' * stof(argv(i*5+2)) + '0 1 0' * stof(argv(i*5+3)) + '0 0 1' * stof(argv(i*5+4))) * self.owner.height * v_forward.y; } if(self.owner.classname == "func_fourier") // don't brake stuff if the func_fourier was killtarget'ed diff --git a/qcsrc/server/t_teleporters.qc b/qcsrc/server/t_teleporters.qc index 2b99cef69..7923c9d26 100644 --- a/qcsrc/server/t_teleporters.qc +++ b/qcsrc/server/t_teleporters.qc @@ -13,12 +13,12 @@ void trigger_teleport_use() deathmax = (o) + player.maxs; \ if(telefragmin != telefragmax) \ { \ - if(deathmin_x > telefragmin_x) deathmin_x = telefragmin_x; \ - if(deathmin_y > telefragmin_y) deathmin_y = telefragmin_y; \ - if(deathmin_z > telefragmin_z) deathmin_z = telefragmin_z; \ - if(deathmax_x < telefragmax_x) deathmax_x = telefragmax_x; \ - if(deathmax_y < telefragmax_y) deathmax_y = telefragmax_y; \ - if(deathmax_z < telefragmax_z) deathmax_z = telefragmax_z; \ + if(deathmin.x > telefragmin.x) deathmin_x = telefragmin.x; \ + if(deathmin.y > telefragmin.y) deathmin_y = telefragmin.y; \ + if(deathmin.z > telefragmin.z) deathmin_z = telefragmin.z; \ + if(deathmax.x < telefragmax.x) deathmax_x = telefragmax.x; \ + if(deathmax.y < telefragmax.y) deathmax_y = telefragmax.y; \ + if(deathmax.z < telefragmax.z) deathmax_z = telefragmax.z; \ } \ deathradius = max(vlen(deathmin), vlen(deathmax)); \ for(head = findradius(o, deathradius); head; head = head.chain) \ @@ -170,7 +170,7 @@ entity Simple_TeleportPlayer(entity teleporter, entity player) p = 1; if(autocvar_g_telefrags_avoid) { - locout = e.origin + '0 0 1' * (1 - player.mins_z - 24); + locout = e.origin + '0 0 1' * (1 - player.mins.z - 24); if(check_tdeath(player, locout, '0 0 0', '0 0 0')) p = 0; } @@ -191,7 +191,7 @@ entity Simple_TeleportPlayer(entity teleporter, entity player) if(vlen(player.velocity) > autocvar_g_teleport_maxspeed) player.velocity = normalize(player.velocity) * max(0, autocvar_g_teleport_maxspeed); - locout = e.origin + '0 0 1' * (1 - player.mins_z - 24); + locout = e.origin + '0 0 1' * (1 - player.mins.z - 24); TeleportPlayer(teleporter, player, locout, e.mangle, v_forward * vlen(player.velocity), '0 0 0', '0 0 0', TELEPORT_FLAGS_TELEPORTER); return e; diff --git a/qcsrc/server/target_music.qc b/qcsrc/server/target_music.qc index cd1b374e6..61773234c 100644 --- a/qcsrc/server/target_music.qc +++ b/qcsrc/server/target_music.qc @@ -74,28 +74,28 @@ float trigger_music_SendEntity(entity to, float sf) WriteByte(MSG_ENTITY, sf); if(sf & 4) { - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); + WriteCoord(MSG_ENTITY, self.origin.x); + WriteCoord(MSG_ENTITY, self.origin.y); + WriteCoord(MSG_ENTITY, self.origin.z); } if(sf & 1) { if(self.model != "null") { WriteShort(MSG_ENTITY, self.modelindex); - WriteCoord(MSG_ENTITY, self.mins_x); - WriteCoord(MSG_ENTITY, self.mins_y); - WriteCoord(MSG_ENTITY, self.mins_z); - WriteCoord(MSG_ENTITY, self.maxs_x); - WriteCoord(MSG_ENTITY, self.maxs_y); - WriteCoord(MSG_ENTITY, self.maxs_z); + WriteCoord(MSG_ENTITY, self.mins.x); + WriteCoord(MSG_ENTITY, self.mins.y); + WriteCoord(MSG_ENTITY, self.mins.z); + WriteCoord(MSG_ENTITY, self.maxs.x); + WriteCoord(MSG_ENTITY, self.maxs.y); + WriteCoord(MSG_ENTITY, self.maxs.z); } else { WriteShort(MSG_ENTITY, 0); - WriteCoord(MSG_ENTITY, self.maxs_x); - WriteCoord(MSG_ENTITY, self.maxs_y); - WriteCoord(MSG_ENTITY, self.maxs_z); + WriteCoord(MSG_ENTITY, self.maxs.x); + WriteCoord(MSG_ENTITY, self.maxs.y); + WriteCoord(MSG_ENTITY, self.maxs.z); } WriteByte(MSG_ENTITY, self.volume * 255.0); WriteByte(MSG_ENTITY, self.fade_time * 16.0); diff --git a/qcsrc/server/target_spawn.qc b/qcsrc/server/target_spawn.qc index 4da6b13bb..93d7485bb 100644 --- a/qcsrc/server/target_spawn.qc +++ b/qcsrc/server/target_spawn.qc @@ -169,7 +169,7 @@ void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity if(valueoffset != "") { - switch(data_y) + switch(data.y) { case FIELD_STRING: value = strcat(value, valueoffset); @@ -188,7 +188,7 @@ void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity if(valueoffsetrandom != "") { - switch(data_y) + switch(data.y) { case FIELD_FLOAT: value = ftos(stof(value) + random() * stof(valueoffsetrandom)); @@ -225,7 +225,7 @@ void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity { if(data_y == FIELD_VECTOR) value = strreplace("'", "", value); // why?!? - putentityfieldstring(data_x, e, value); + putentityfieldstring(data.x, e, value); } } } diff --git a/qcsrc/server/tturrets/system/system_aimprocs.qc b/qcsrc/server/tturrets/system/system_aimprocs.qc index 1901e4e25..849ceb37d 100644 --- a/qcsrc/server/tturrets/system/system_aimprocs.qc +++ b/qcsrc/server/tturrets/system/system_aimprocs.qc @@ -45,12 +45,12 @@ vector turret_stdproc_aim_generic() if(self.enemy.movetype == MOVETYPE_WALK || self.enemy.movetype == MOVETYPE_TOSS || self.enemy.movetype == MOVETYPE_BOUNCE) { float vz; - prep_z = pre_pos_z; - vz = self.enemy.velocity_z; + prep_z = pre_pos.z; + vz = self.enemy.velocity.z; for(i = 0; i < impact_time; i += sys_frametime) { vz = vz - (autocvar_sv_gravity * sys_frametime); - prep_z = prep_z + vz * sys_frametime; + prep_z = prep.z + vz * sys_frametime; } } pre_pos = prep; diff --git a/qcsrc/server/tturrets/system/system_damage.qc b/qcsrc/server/tturrets/system/system_damage.qc index a8feaebc3..45b2e9b3b 100644 --- a/qcsrc/server/tturrets/system/system_damage.qc +++ b/qcsrc/server/tturrets/system/system_damage.qc @@ -109,8 +109,8 @@ void turret_stdproc_damage (entity inflictor, entity attacker, float damage, flo // thorw head slightly off aim when hit? if (self.damage_flags & TFL_DMG_HEADSHAKE) { - self.tur_head.angles_x = self.tur_head.angles_x + (-0.5 + random()) * damage; - self.tur_head.angles_y = self.tur_head.angles_y + (-0.5 + random()) * damage; + self.tur_head.angles_x = self.tur_head.angles.x + (-0.5 + random()) * damage; + self.tur_head.angles_y = self.tur_head.angles.y + (-0.5 + random()) * damage; self.SendFlags |= TNSF_ANG; } diff --git a/qcsrc/server/tturrets/system/system_main.qc b/qcsrc/server/tturrets/system/system_main.qc index d56a81bbf..8442af17c 100644 --- a/qcsrc/server/tturrets/system/system_main.qc +++ b/qcsrc/server/tturrets/system/system_main.qc @@ -24,37 +24,37 @@ float turret_send(entity to, float sf) { WriteByte(MSG_ENTITY, self.turret_type); - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); + WriteCoord(MSG_ENTITY, self.origin.x); + WriteCoord(MSG_ENTITY, self.origin.y); + WriteCoord(MSG_ENTITY, self.origin.z); - WriteAngle(MSG_ENTITY, self.angles_x); - WriteAngle(MSG_ENTITY, self.angles_y); + WriteAngle(MSG_ENTITY, self.angles.x); + WriteAngle(MSG_ENTITY, self.angles.y); } if(sf & TNSF_ANG) { - WriteShort(MSG_ENTITY, rint(self.tur_head.angles_x)); - WriteShort(MSG_ENTITY, rint(self.tur_head.angles_y)); + WriteShort(MSG_ENTITY, rint(self.tur_head.angles.x)); + WriteShort(MSG_ENTITY, rint(self.tur_head.angles.y)); } if(sf & TNSF_AVEL) { - WriteShort(MSG_ENTITY, rint(self.tur_head.avelocity_x)); - WriteShort(MSG_ENTITY, rint(self.tur_head.avelocity_y)); + WriteShort(MSG_ENTITY, rint(self.tur_head.avelocity.x)); + WriteShort(MSG_ENTITY, rint(self.tur_head.avelocity.y)); } if(sf & TNSF_MOVE) { - WriteShort(MSG_ENTITY, rint(self.origin_x)); - WriteShort(MSG_ENTITY, rint(self.origin_y)); - WriteShort(MSG_ENTITY, rint(self.origin_z)); + WriteShort(MSG_ENTITY, rint(self.origin.x)); + WriteShort(MSG_ENTITY, rint(self.origin.y)); + WriteShort(MSG_ENTITY, rint(self.origin.z)); - WriteShort(MSG_ENTITY, rint(self.velocity_x)); - WriteShort(MSG_ENTITY, rint(self.velocity_y)); - WriteShort(MSG_ENTITY, rint(self.velocity_z)); + WriteShort(MSG_ENTITY, rint(self.velocity.x)); + WriteShort(MSG_ENTITY, rint(self.velocity.y)); + WriteShort(MSG_ENTITY, rint(self.velocity.z)); - WriteShort(MSG_ENTITY, rint(self.angles_y)); + WriteShort(MSG_ENTITY, rint(self.angles.y)); } if(sf & TNSF_ANIM) @@ -346,8 +346,8 @@ void turret_stdproc_track() target_angle = vectoangles(normalize(self.tur_aimpos - self.tur_shotorg)); } - self.tur_head.angles_x = anglemods(self.tur_head.angles_x); - self.tur_head.angles_y = anglemods(self.tur_head.angles_y); + self.tur_head.angles_x = anglemods(self.tur_head.angles.x); + self.tur_head.angles_y = anglemods(self.tur_head.angles.y); // Find the diffrence between where we currently aim and where we want to aim //move_angle = target_angle - (self.angles + self.tur_head.angles); @@ -362,21 +362,21 @@ void turret_stdproc_track() f_tmp = self.aim_speed * self.ticrate; // dgr/sec -> dgr/tic if (self.track_flags & TFL_TRACK_PITCH) { - self.tur_head.angles_x += bound(-f_tmp,move_angle_x, f_tmp); - if(self.tur_head.angles_x > self.aim_maxpitch) + self.tur_head.angles_x += bound(-f_tmp,move_angle.x, f_tmp); + if(self.tur_head.angles.x > self.aim_maxpitch) self.tur_head.angles_x = self.aim_maxpitch; - if(self.tur_head.angles_x < -self.aim_maxpitch) + if(self.tur_head.angles.x < -self.aim_maxpitch) self.tur_head.angles_x = self.aim_maxpitch; } if (self.track_flags & TFL_TRACK_ROT) { - self.tur_head.angles_y += bound(-f_tmp, move_angle_y, f_tmp); - if(self.tur_head.angles_y > self.aim_maxrot) + self.tur_head.angles_y += bound(-f_tmp, move_angle.y, f_tmp); + if(self.tur_head.angles.y > self.aim_maxrot) self.tur_head.angles_y = self.aim_maxrot; - if(self.tur_head.angles_y < -self.aim_maxrot) + if(self.tur_head.angles.y < -self.aim_maxrot) self.tur_head.angles_y = self.aim_maxrot; } @@ -387,15 +387,15 @@ void turret_stdproc_track() case TFL_TRACKTYPE_FLUIDINERTIA: f_tmp = self.aim_speed * self.ticrate; // dgr/sec -> dgr/tic - move_angle_x = bound(-self.aim_speed, move_angle_x * self.track_accel_pitch * f_tmp, self.aim_speed); - move_angle_y = bound(-self.aim_speed, move_angle_y * self.track_accel_rot * f_tmp, self.aim_speed); + move_angle_x = bound(-self.aim_speed, move_angle.x * self.track_accel_pitch * f_tmp, self.aim_speed); + move_angle_y = bound(-self.aim_speed, move_angle.y * self.track_accel_rot * f_tmp, self.aim_speed); move_angle = (self.tur_head.avelocity * self.track_blendrate) + (move_angle * (1 - self.track_blendrate)); break; case TFL_TRACKTYPE_FLUIDPRECISE: - move_angle_y = bound(-self.aim_speed, move_angle_y, self.aim_speed); - move_angle_x = bound(-self.aim_speed, move_angle_x, self.aim_speed); + move_angle_y = bound(-self.aim_speed, move_angle.y, self.aim_speed); + move_angle_x = bound(-self.aim_speed, move_angle.x, self.aim_speed); break; } @@ -403,8 +403,8 @@ void turret_stdproc_track() // pitch if (self.track_flags & TFL_TRACK_PITCH) { - self.tur_head.avelocity_x = move_angle_x; - if((self.tur_head.angles_x + self.tur_head.avelocity_x * self.ticrate) > self.aim_maxpitch) + self.tur_head.avelocity_x = move_angle.x; + if((self.tur_head.angles.x + self.tur_head.avelocity.x * self.ticrate) > self.aim_maxpitch) { self.tur_head.avelocity_x = 0; self.tur_head.angles_x = self.aim_maxpitch; @@ -412,7 +412,7 @@ void turret_stdproc_track() self.SendFlags |= TNSF_ANG; } - if((self.tur_head.angles_x + self.tur_head.avelocity_x * self.ticrate) < -self.aim_maxpitch) + if((self.tur_head.angles.x + self.tur_head.avelocity.x * self.ticrate) < -self.aim_maxpitch) { self.tur_head.avelocity_x = 0; self.tur_head.angles_x = -self.aim_maxpitch; @@ -424,9 +424,9 @@ void turret_stdproc_track() // rot if (self.track_flags & TFL_TRACK_ROT) { - self.tur_head.avelocity_y = move_angle_y; + self.tur_head.avelocity_y = move_angle.y; - if((self.tur_head.angles_y + self.tur_head.avelocity_y * self.ticrate) > self.aim_maxrot) + if((self.tur_head.angles.y + self.tur_head.avelocity.y * self.ticrate) > self.aim_maxrot) { self.tur_head.avelocity_y = 0; self.tur_head.angles_y = self.aim_maxrot; @@ -434,7 +434,7 @@ void turret_stdproc_track() self.SendFlags |= TNSF_ANG; } - if((self.tur_head.angles_y + self.tur_head.avelocity_y * self.ticrate) < -self.aim_maxrot) + if((self.tur_head.angles.y + self.tur_head.avelocity.y * self.ticrate) < -self.aim_maxrot) { self.tur_head.avelocity_y = 0; self.tur_head.angles_y = -self.aim_maxrot; @@ -677,10 +677,10 @@ float turret_validate_target(entity e_turret, entity e_target, float validate_fl if (validate_flags & TFL_TARGETSELECT_ANGLELIMITS) { - if (fabs(tvt_tadv_x) > e_turret.aim_maxpitch) + if (fabs(tvt_tadv.x) > e_turret.aim_maxpitch) return -17; - if (fabs(tvt_tadv_y) > e_turret.aim_maxrot) + if (fabs(tvt_tadv.y) > e_turret.aim_maxrot) return -18; } @@ -1349,9 +1349,9 @@ float turret_stdproc_init (string cvar_base_name, string base, string head, floa while (vlen(self.tur_dbg_rvec) < 2) self.tur_dbg_rvec = randomvec() * 4; - self.tur_dbg_rvec_x = fabs(self.tur_dbg_rvec_x); - self.tur_dbg_rvec_y = fabs(self.tur_dbg_rvec_y); - self.tur_dbg_rvec_z = fabs(self.tur_dbg_rvec_z); + self.tur_dbg_rvec_x = fabs(self.tur_dbg_rvec.x); + self.tur_dbg_rvec_y = fabs(self.tur_dbg_rvec.y); + self.tur_dbg_rvec_z = fabs(self.tur_dbg_rvec.z); #endif // Its all good. diff --git a/qcsrc/server/tturrets/system/system_misc.qc b/qcsrc/server/tturrets/system/system_misc.qc index 3fdd5eb1e..8a1d2123a 100644 --- a/qcsrc/server/tturrets/system/system_misc.qc +++ b/qcsrc/server/tturrets/system/system_misc.qc @@ -83,11 +83,11 @@ vector angleofs(entity from, entity to) v_res = vectoangles(v_res); v_res = v_res - from.angles; - if (v_res_x < 0) v_res_x += 360; - if (v_res_x > 180) v_res_x -= 360; + if (v_res.x < 0) v_res.x += 360; + if (v_res.x > 180) v_res.x -= 360; - if (v_res_y < 0) v_res_y += 360; - if (v_res_y > 180) v_res_y -= 360; + if (v_res.y < 0) v_res.y += 360; + if (v_res.y > 180) v_res.y -= 360; return v_res; } @@ -100,11 +100,11 @@ vector angleofs3(vector from, vector from_a, entity to) v_res = vectoangles(v_res); v_res = v_res - from_a; - if (v_res_x < 0) v_res_x += 360; - if (v_res_x > 180) v_res_x -= 360; + if (v_res.x < 0) v_res.x += 360; + if (v_res.x > 180) v_res.x -= 360; - if (v_res_y < 0) v_res_y += 360; - if (v_res_y > 180) v_res_y -= 360; + if (v_res.y < 0) v_res.y += 360; + if (v_res.y > 180) v_res.y -= 360; return v_res; } diff --git a/qcsrc/server/tturrets/units/unit_ewheel.qc b/qcsrc/server/tturrets/units/unit_ewheel.qc index 1a4d6c4de..76283cde4 100644 --- a/qcsrc/server/tturrets/units/unit_ewheel.qc +++ b/qcsrc/server/tturrets/units/unit_ewheel.qc @@ -139,10 +139,10 @@ void ewheel_postthink() float vz; vector wish_angle, real_angle; - vz = self.velocity_z; + vz = self.velocity.z; - self.angles_x = anglemods(self.angles_x); - self.angles_y = anglemods(self.angles_y); + self.angles_x = anglemods(self.angles.x); + self.angles_y = anglemods(self.angles.y); fixedmakevectors(self.angles); @@ -151,9 +151,9 @@ void ewheel_postthink() real_angle = wish_angle - self.angles; real_angle = shortangle_vxy(real_angle, self.tur_head.angles); - self.tur_head.spawnshieldtime = fabs(real_angle_y); - real_angle_y = bound(-self.tur_head.aim_speed, real_angle_y, self.tur_head.aim_speed); - self.angles_y = (self.angles_y + real_angle_y); + self.tur_head.spawnshieldtime = fabs(real_angle.y); + real_angle_y = bound(-self.tur_head.aim_speed, real_angle.y, self.tur_head.aim_speed); + self.angles_y = (self.angles.y + real_angle.y); if(self.enemy) ewheel_move_enemy(); diff --git a/qcsrc/server/tturrets/units/unit_hk.qc b/qcsrc/server/tturrets/units/unit_hk.qc index 6ce6c72e2..89aaa9459 100644 --- a/qcsrc/server/tturrets/units/unit_hk.qc +++ b/qcsrc/server/tturrets/units/unit_hk.qc @@ -82,9 +82,9 @@ void turret_hk_missile_think() } self.angles = vectoangles(self.velocity); - self.angles_x = self.angles_x * -1; + self.angles_x = self.angles.x * -1; makevectors(self.angles); - self.angles_x = self.angles_x * -1; + self.angles_x = self.angles.x * -1; if (self.enemy) { diff --git a/qcsrc/server/tturrets/units/unit_walker.qc b/qcsrc/server/tturrets/units/unit_walker.qc index 660499a52..2ecf47406 100644 --- a/qcsrc/server/tturrets/units/unit_walker.qc +++ b/qcsrc/server/tturrets/units/unit_walker.qc @@ -342,7 +342,7 @@ void walker_postthink() } self.moveto = self.moveto * 0.9 + ((self.origin + v_forward * 500) + randomvec() * 400) * 0.1; - self.moveto_z = self.origin_z + 64; + self.moveto_z = self.origin.z + 64; walker_move_to(self.moveto, 0); } @@ -374,7 +374,7 @@ void walker_postthink() wish_angle = angleofs(self, self.enemy); if (self.animflag != ANIM_SWIM) - if (fabs(wish_angle_y) < 15) + if (fabs(wish_angle.y) < 15) { self.moveto = self.enemy.origin; self.steerto = steerlib_attract2(self.moveto, 0.5, 500, 0.95); @@ -419,7 +419,7 @@ void walker_postthink() float vz; real_angle = vectoangles(self.steerto) - self.angles; - vz = self.velocity_z; + vz = self.velocity.z; switch (self.animflag) { @@ -479,7 +479,7 @@ void walker_postthink() turny = autocvar_g_turrets_unit_walker_turn_swim; turnx = autocvar_g_turrets_unit_walker_turn_swim; - self.angles_x += bound(-10, shortangle_f(real_angle_x, self.angles_x), 10); + self.angles_x += bound(-10, shortangle_f(real_angle.x, self.angles.x), 10); movelib_move_simple(v_forward, autocvar_g_turrets_unit_walker_speed_swim, 0.3); vz = self.velocity_z + sin(time * 4) * 8; break; @@ -492,13 +492,13 @@ void walker_postthink() if(turny) { - turny = bound( turny * -1, shortangle_f(real_angle_y, self.angles_y), turny ); + turny = bound( turny * -1, shortangle_f(real_angle.y, self.angles.y), turny ); self.angles_y += turny; } if(turnx) { - turnx = bound( turnx * -1, shortangle_f(real_angle_x, self.angles_x), turnx ); + turnx = bound( turnx * -1, shortangle_f(real_angle.x, self.angles.x), turnx ); self.angles_x += turnx; } diff --git a/qcsrc/server/vehicles/bumblebee.qc b/qcsrc/server/vehicles/bumblebee.qc index 2400f8008..b63617fc4 100644 --- a/qcsrc/server/vehicles/bumblebee.qc +++ b/qcsrc/server/vehicles/bumblebee.qc @@ -157,7 +157,7 @@ float bumb_gunner_frame() vector vf = real_origin(gun.enemy); vector _vel = gun.enemy.velocity; if(gun.enemy.movetype == MOVETYPE_WALK) - _vel_z *= 0.1; + _vel.z *= 0.1; ad = vf; @@ -222,7 +222,7 @@ void bumb_gunner_exit(float _exitflag) WriteByte(MSG_ONE, SVC_SETVIEWANGLES); WriteAngle(MSG_ONE, 0); - WriteAngle(MSG_ONE, self.vehicle.angles_y); + WriteAngle(MSG_ONE, self.vehicle.angles.y); WriteAngle(MSG_ONE, 0); } @@ -321,8 +321,8 @@ float bumb_gunner_enter() WriteByte(MSG_ONE, SVC_SETVIEWPORT); WriteEntity(MSG_ONE, _gun.vehicle_viewport); WriteByte(MSG_ONE, SVC_SETVIEWANGLES); - WriteAngle(MSG_ONE, _gun.angles_x + self.angles_x); // tilt - WriteAngle(MSG_ONE, _gun.angles_y + self.angles_y); // yaw + WriteAngle(MSG_ONE, _gun.angles.x + self.angles.x); // tilt + WriteAngle(MSG_ONE, _gun.angles.y + self.angles.y); // yaw WriteAngle(MSG_ONE, 0); // roll _gun.vehicle_hudmodel.viewmodelforclient = other; @@ -428,58 +428,58 @@ float bumb_pilot_frame() vang = vehic.angles; newvel = vectoangles(normalize(trace_endpos - self.origin + '0 0 32')); - vang_x *= -1; - newvel_x *= -1; - if(newvel_x > 180) newvel_x -= 360; - if(newvel_x < -180) newvel_x += 360; - if(newvel_y > 180) newvel_y -= 360; - if(newvel_y < -180) newvel_y += 360; - - ftmp = shortangle_f(pilot.v_angle_y - vang_y, vang_y); + vang.x *= -1; + newvel.x *= -1; + if(newvel.x > 180) newvel.x -= 360; + if(newvel.x < -180) newvel.x += 360; + if(newvel.y > 180) newvel.y -= 360; + if(newvel.y < -180) newvel.y += 360; + + ftmp = shortangle_f(pilot.v_angle.y - vang.y, vang.y); if(ftmp > 180) ftmp -= 360; if(ftmp < -180) ftmp += 360; - vehic.avelocity_y = bound(-autocvar_g_vehicle_bumblebee_turnspeed, ftmp + vehic.avelocity_y * 0.9, autocvar_g_vehicle_bumblebee_turnspeed); + vehic.avelocity_y = bound(-autocvar_g_vehicle_bumblebee_turnspeed, ftmp + vehic.avelocity.y * 0.9, autocvar_g_vehicle_bumblebee_turnspeed); // Pitch ftmp = 0; - if(pilot.movement_x > 0 && vang_x < autocvar_g_vehicle_bumblebee_pitchlimit) + if(pilot.movement.x > 0 && vang.x < autocvar_g_vehicle_bumblebee_pitchlimit) ftmp = 4; - else if(pilot.movement_x < 0 && vang_x > -autocvar_g_vehicle_bumblebee_pitchlimit) + else if(pilot.movement.x < 0 && vang.x > -autocvar_g_vehicle_bumblebee_pitchlimit) ftmp = -8; - newvel_x = bound(-autocvar_g_vehicle_bumblebee_pitchlimit, newvel_x , autocvar_g_vehicle_bumblebee_pitchlimit); - ftmp = vang_x - bound(-autocvar_g_vehicle_bumblebee_pitchlimit, newvel_x + ftmp, autocvar_g_vehicle_bumblebee_pitchlimit); - vehic.avelocity_x = bound(-autocvar_g_vehicle_bumblebee_pitchspeed, ftmp + vehic.avelocity_x * 0.9, autocvar_g_vehicle_bumblebee_pitchspeed); + newvel_x = bound(-autocvar_g_vehicle_bumblebee_pitchlimit, newvel.x , autocvar_g_vehicle_bumblebee_pitchlimit); + ftmp = vang.x - bound(-autocvar_g_vehicle_bumblebee_pitchlimit, newvel.x + ftmp, autocvar_g_vehicle_bumblebee_pitchlimit); + vehic.avelocity_x = bound(-autocvar_g_vehicle_bumblebee_pitchspeed, ftmp + vehic.avelocity.x * 0.9, autocvar_g_vehicle_bumblebee_pitchspeed); - vehic.angles_x = anglemods(vehic.angles_x); - vehic.angles_y = anglemods(vehic.angles_y); - vehic.angles_z = anglemods(vehic.angles_z); + vehic.angles_x = anglemods(vehic.angles.x); + vehic.angles_y = anglemods(vehic.angles.y); + vehic.angles_z = anglemods(vehic.angles.z); - makevectors('0 1 0' * vehic.angles_y); + makevectors('0 1 0' * vehic.angles.y); newvel = vehic.velocity * -autocvar_g_vehicle_bumblebee_friction; - if(pilot.movement_x != 0) + if(pilot.movement.x != 0) { - if(pilot.movement_x > 0) + if(pilot.movement.x > 0) newvel += v_forward * autocvar_g_vehicle_bumblebee_speed_forward; - else if(pilot.movement_x < 0) + else if(pilot.movement.x < 0) newvel -= v_forward * autocvar_g_vehicle_bumblebee_speed_forward; } - if(pilot.movement_y != 0) + if(pilot.movement.y != 0) { - if(pilot.movement_y < 0) + if(pilot.movement.y < 0) newvel -= v_right * autocvar_g_vehicle_bumblebee_speed_strafe; - else if(pilot.movement_y > 0) + else if(pilot.movement.y > 0) newvel += v_right * autocvar_g_vehicle_bumblebee_speed_strafe; ftmp = newvel * v_right; ftmp *= frametime * 0.1; - vehic.angles_z = bound(-15, vehic.angles_z + ftmp, 15); + vehic.angles_z = bound(-15, vehic.angles.z + ftmp, 15); } else { vehic.angles_z *= 0.95; - if(vehic.angles_z >= -1 && vehic.angles_z <= -1) + if(vehic.angles.z >= -1 && vehic.angles.z <= -1) vehic.angles_z = 0; } @@ -791,8 +791,8 @@ void bumb_die() void bumb_impact() { - if(autocvar_g_vehicle_bumblebee_bouncepain_x) - vehicles_impact(autocvar_g_vehicle_bumblebee_bouncepain_x, autocvar_g_vehicle_bumblebee_bouncepain_y, autocvar_g_vehicle_bumblebee_bouncepain_z); + if(autocvar_g_vehicle_bumblebee_bouncepain.x) + vehicles_impact(autocvar_g_vehicle_bumblebee_bouncepain.x, autocvar_g_vehicle_bumblebee_bouncepain.y, autocvar_g_vehicle_bumblebee_bouncepain.z); } void bumb_spawn(float _f) @@ -937,16 +937,16 @@ float bumble_raygun_send(entity to, float sf) if(sf & BRG_START) { - WriteCoord(MSG_ENTITY, self.hook_start_x); - WriteCoord(MSG_ENTITY, self.hook_start_y); - WriteCoord(MSG_ENTITY, self.hook_start_z); + WriteCoord(MSG_ENTITY, self.hook_start.x); + WriteCoord(MSG_ENTITY, self.hook_start.y); + WriteCoord(MSG_ENTITY, self.hook_start.z); } if(sf & BRG_END) { - WriteCoord(MSG_ENTITY, self.hook_end_x); - WriteCoord(MSG_ENTITY, self.hook_end_y); - WriteCoord(MSG_ENTITY, self.hook_end_z); + WriteCoord(MSG_ENTITY, self.hook_end.x); + WriteCoord(MSG_ENTITY, self.hook_end.y); + WriteCoord(MSG_ENTITY, self.hook_end.z); } return TRUE; diff --git a/qcsrc/server/vehicles/racer.qc b/qcsrc/server/vehicles/racer.qc index 67e758223..038c10e46 100644 --- a/qcsrc/server/vehicles/racer.qc +++ b/qcsrc/server/vehicles/racer.qc @@ -99,7 +99,7 @@ void racer_align4point(float _delta) self.velocity += push_vector * _delta; // Anti ocilation - if(self.velocity_z > 0) + if(self.velocity.z > 0) self.velocity_z *= 1 - autocvar_g_vehicle_racer_upforcedamper * _delta; push_vector_x = (fl_push - bl_push); @@ -111,8 +111,8 @@ void racer_align4point(float _delta) push_vector_z *= 360; // Apply angle diffrance - self.angles_z += push_vector_z * _delta; - self.angles_x += push_vector_x * _delta; + self.angles_z += push_vector.z * _delta; + self.angles_x += push_vector.x * _delta; // Apply stabilizer self.angles_x *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * _delta); @@ -132,7 +132,7 @@ void racer_fire_cannon(string tagname) // Fix z-aim (for chase mode) v = normalize(trace_endpos - bolt.origin); - v_forward_z = v_z * 0.5; + v_forward_z = v.z * 0.5; bolt.velocity = v_forward * autocvar_g_vehicle_racer_cannon_speed; } @@ -215,7 +215,7 @@ void racer_rocket_tracker() newdir = normalize(predicted_origin - self.origin); //vector - float height_diff = predicted_origin_z - self.origin_z; + float height_diff = predicted_origin.z - self.origin.z; if(vlen(newdir - v_forward) > autocvar_g_vehicle_racer_rocket_locked_maxangle) { @@ -226,7 +226,7 @@ void racer_rocket_tracker() } if(trace_fraction != 1.0 && trace_ent != self.enemy) - newdir_z += 16 * sys_frametime; + newdir.z += 16 * sys_frametime; self.velocity = normalize(olddir + newdir * autocvar_g_vehicle_racer_rocket_turnrate) * newvel; self.velocity_z -= 800 * sys_frametime; @@ -288,16 +288,16 @@ float racer_frame() // Yaw ftmp = autocvar_g_vehicle_racer_turnspeed * frametime; - ftmp = bound(-ftmp, shortangle_f(player.v_angle_y - racer.angles_y, racer.angles_y), ftmp); - racer.angles_y = anglemods(racer.angles_y + ftmp); + ftmp = bound(-ftmp, shortangle_f(player.v_angle.y - racer.angles.y, racer.angles.y), ftmp); + racer.angles_y = anglemods(racer.angles.y + ftmp); // Roll racer.angles_z += -ftmp * autocvar_g_vehicle_racer_turnroll * frametime; // Pitch ftmp = autocvar_g_vehicle_racer_pitchspeed * frametime; - ftmp = bound(-ftmp, shortangle_f(player.v_angle_x - racer.angles_x, racer.angles_x), ftmp); - racer.angles_x = bound(-30, anglemods(racer.angles_x + ftmp), 30); + ftmp = bound(-ftmp, shortangle_f(player.v_angle.x - racer.angles.x, racer.angles.x), ftmp); + racer.angles_x = bound(-30, anglemods(racer.angles.x + ftmp), 30); makevectors(racer.angles); racer.angles_x *= -1; @@ -309,10 +309,10 @@ float racer_frame() if(vlen(player.movement) != 0) { if(player.movement_x) - df += v_forward * ((player.movement_x > 0) ? autocvar_g_vehicle_racer_speed_forward : -autocvar_g_vehicle_racer_speed_forward); + df += v_forward * ((player.movement.x > 0) ? autocvar_g_vehicle_racer_speed_forward : -autocvar_g_vehicle_racer_speed_forward); if(player.movement_y) - df += v_right * ((player.movement_y > 0) ? autocvar_g_vehicle_racer_speed_strafe : -autocvar_g_vehicle_racer_speed_strafe); + df += v_right * ((player.movement.y > 0) ? autocvar_g_vehicle_racer_speed_strafe : -autocvar_g_vehicle_racer_speed_strafe); if(self.sound_nexttime < time || self.sounds != 1) { @@ -460,10 +460,10 @@ void racer_think() tracebox(self.origin, self.mins, self.maxs, self.origin - ('0 0 1' * autocvar_g_vehicle_racer_springlength), MOVE_NORMAL, self); vector df = self.velocity * -autocvar_g_vehicle_racer_friction; - df_z += (1 - trace_fraction) * autocvar_g_vehicle_racer_hoverpower + sin(time * 2) * (autocvar_g_vehicle_racer_springlength * 2); + df.z += (1 - trace_fraction) * autocvar_g_vehicle_racer_hoverpower + sin(time * 2) * (autocvar_g_vehicle_racer_springlength * 2); self.velocity += df * pushdeltatime; - if(self.velocity_z > 0) + if(self.velocity.z > 0) self.velocity_z *= 1 - autocvar_g_vehicle_racer_upforcedamper * pushdeltatime; self.angles_x *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * pushdeltatime); @@ -528,8 +528,8 @@ void racer_exit(float eject) void racer_impact() { - if(autocvar_g_vehicle_racer_bouncepain_x) - vehicles_impact(autocvar_g_vehicle_racer_bouncepain_x, autocvar_g_vehicle_racer_bouncepain_y, autocvar_g_vehicle_racer_bouncepain_z); + if(autocvar_g_vehicle_racer_bouncepain.x) + vehicles_impact(autocvar_g_vehicle_racer_bouncepain.x, autocvar_g_vehicle_racer_bouncepain.y, autocvar_g_vehicle_racer_bouncepain.z); } void racer_blowup() @@ -578,9 +578,9 @@ void racer_die() pointparticles(particleeffectnum("explosion_medium"), self.origin, '0 0 0', 1); if(random() < 0.5) - self.avelocity_z = 32; + self.avelocity_z = 32; else - self.avelocity_z = -32; + self.avelocity_z = -32; self.avelocity_x = -vlen(self.velocity) * 0.2; self.velocity += '0 0 700'; diff --git a/qcsrc/server/vehicles/raptor.qc b/qcsrc/server/vehicles/raptor.qc index 4faf3d37e..86d63d10d 100644 --- a/qcsrc/server/vehicles/raptor.qc +++ b/qcsrc/server/vehicles/raptor.qc @@ -231,7 +231,7 @@ void raptor_land() self.frame = (hgt / 128) * 25; self.bomb1.gun1.avelocity_y = 90 + ((self.frame / 25) * 2000); - self.bomb1.gun2.avelocity_y = -self.bomb1.gun1.avelocity_y; + self.bomb1.gun2.avelocity_y = -self.bomb1.gun1.avelocity.y; if(hgt < 16) { @@ -307,9 +307,9 @@ float raptor_takeoff() if(raptor.frame < 25) { raptor.frame += 25 / (autocvar_g_vehicle_raptor_takeofftime / sys_frametime); - raptor.velocity_z = min(raptor.velocity_z * 1.5, 256); + raptor.velocity_z = min(raptor.velocity.z * 1.5, 256); self.bomb1.gun1.avelocity_y = 90 + ((raptor.frame / 25) * 25000); - self.bomb1.gun2.avelocity_y = -self.bomb1.gun1.avelocity_y; + self.bomb1.gun2.avelocity_y = -self.bomb1.gun1.avelocity.y; player.BUTTON_ATCK = player.BUTTON_ATCK2 = player.BUTTON_CROUCH = 0; setorigin(player, raptor.origin + '0 0 32'); @@ -417,58 +417,58 @@ float raptor_frame() vector vang; vang = raptor.angles; df = vectoangles(normalize(trace_endpos - self.origin + '0 0 32')); - vang_x *= -1; - df_x *= -1; - if(df_x > 180) df_x -= 360; - if(df_x < -180) df_x += 360; - if(df_y > 180) df_y -= 360; - if(df_y < -180) df_y += 360; - - ftmp = shortangle_f(player.v_angle_y - vang_y, vang_y); + vang.x *= -1; + df.x *= -1; + if(df.x > 180) df.x -= 360; + if(df.x < -180) df.x += 360; + if(df.y > 180) df.y -= 360; + if(df.y < -180) df.y += 360; + + ftmp = shortangle_f(player.v_angle.y - vang.y, vang.y); if(ftmp > 180) ftmp -= 360; if(ftmp < -180) ftmp += 360; - raptor.avelocity_y = bound(-autocvar_g_vehicle_raptor_turnspeed, ftmp + raptor.avelocity_y * 0.9, autocvar_g_vehicle_raptor_turnspeed); + raptor.avelocity_y = bound(-autocvar_g_vehicle_raptor_turnspeed, ftmp + raptor.avelocity.y * 0.9, autocvar_g_vehicle_raptor_turnspeed); // Pitch ftmp = 0; - if(player.movement_x > 0 && vang_x < autocvar_g_vehicle_raptor_pitchlimit) ftmp = 5; - else if(player.movement_x < 0 && vang_x > -autocvar_g_vehicle_raptor_pitchlimit) ftmp = -20; + if(player.movement.x > 0 && vang.x < autocvar_g_vehicle_raptor_pitchlimit) ftmp = 5; + else if(player.movement.x < 0 && vang.x > -autocvar_g_vehicle_raptor_pitchlimit) ftmp = -20; - df_x = bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x , autocvar_g_vehicle_raptor_pitchlimit); - ftmp = vang_x - bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x + ftmp, autocvar_g_vehicle_raptor_pitchlimit); - raptor.avelocity_x = bound(-autocvar_g_vehicle_raptor_pitchspeed, ftmp + raptor.avelocity_x * 0.9, autocvar_g_vehicle_raptor_pitchspeed); + df_x = bound(-autocvar_g_vehicle_raptor_pitchlimit, df.x , autocvar_g_vehicle_raptor_pitchlimit); + ftmp = vang.x - bound(-autocvar_g_vehicle_raptor_pitchlimit, df.x + ftmp, autocvar_g_vehicle_raptor_pitchlimit); + raptor.avelocity_x = bound(-autocvar_g_vehicle_raptor_pitchspeed, ftmp + raptor.avelocity.x * 0.9, autocvar_g_vehicle_raptor_pitchspeed); - raptor.angles_x = anglemods(raptor.angles_x); - raptor.angles_y = anglemods(raptor.angles_y); - raptor.angles_z = anglemods(raptor.angles_z); + raptor.angles_x = anglemods(raptor.angles.x); + raptor.angles_y = anglemods(raptor.angles.y); + raptor.angles_z = anglemods(raptor.angles.z); if(autocvar_g_vehicle_raptor_movestyle == 1) - makevectors('0 1 0' * raptor.angles_y); + makevectors('0 1 0' * raptor.angles.y); else makevectors(player.v_angle); df = raptor.velocity * -autocvar_g_vehicle_raptor_friction; - if(player.movement_x != 0) + if(player.movement.x != 0) { - if(player.movement_x > 0) + if(player.movement.x > 0) df += v_forward * autocvar_g_vehicle_raptor_speed_forward; - else if(player.movement_x < 0) + else if(player.movement.x < 0) df -= v_forward * autocvar_g_vehicle_raptor_speed_forward; } - if(player.movement_y != 0) + if(player.movement.y != 0) { - if(player.movement_y < 0) + if(player.movement.y < 0) df -= v_right * autocvar_g_vehicle_raptor_speed_strafe; - else if(player.movement_y > 0) + else if(player.movement.y > 0) df += v_right * autocvar_g_vehicle_raptor_speed_strafe; - raptor.angles_z = bound(-30,raptor.angles_z + (player.movement_y / autocvar_g_vehicle_raptor_speed_strafe),30); + raptor.angles_z = bound(-30,raptor.angles.z + (player.movement.y / autocvar_g_vehicle_raptor_speed_strafe),30); } else { raptor.angles_z *= 0.95; - if(raptor.angles_z >= -1 && raptor.angles_z <= -1) + if(raptor.angles.z >= -1 && raptor.angles.z <= -1) raptor.angles_z = 0; } @@ -516,7 +516,7 @@ float raptor_frame() UpdateAuxiliaryXhair(player, vf, '1 0 0', 1); vector _vel = raptor.gun1.enemy.velocity; if(raptor.gun1.enemy.movetype == MOVETYPE_WALK) - _vel_z *= 0.1; + _vel.z *= 0.1; if(autocvar_g_vehicle_raptor_cannon_predicttarget) { @@ -751,16 +751,16 @@ void raptor_die() void raptor_impact() { - if(autocvar_g_vehicle_raptor_bouncepain_x) - vehicles_impact(autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z); + if(autocvar_g_vehicle_raptor_bouncepain.x) + vehicles_impact(autocvar_g_vehicle_raptor_bouncepain.x, autocvar_g_vehicle_raptor_bouncepain.y, autocvar_g_vehicle_raptor_bouncepain.z); } // If we dont do this ever now and then, the raptors rotors // stop working, presumably due to angle overflow. cute. void raptor_rotor_anglefix() { - self.gun1.angles_y = anglemods(self.gun1.angles_y); - self.gun2.angles_y = anglemods(self.gun2.angles_y); + self.gun1.angles_y = anglemods(self.gun1.angles.y); + self.gun2.angles_y = anglemods(self.gun2.angles.y); self.nextthink = time + 15; } diff --git a/qcsrc/server/vehicles/spiderbot.qc b/qcsrc/server/vehicles/spiderbot.qc index 7b579b1c5..d51775787 100644 --- a/qcsrc/server/vehicles/spiderbot.qc +++ b/qcsrc/server/vehicles/spiderbot.qc @@ -143,7 +143,7 @@ vector spiberbot_calcartillery(vector org, vector tgt, float ht) vector sdir; grav = autocvar_sv_gravity; - zdist = tgt_z - org_z; + zdist = tgt.z - org.z; sdist = vlen(tgt - org - zdist * '0 0 1'); sdir = normalize(tgt - org - zdist * '0 0 1'); @@ -163,10 +163,10 @@ vector spiberbot_calcartillery(vector org, vector tgt, float ht) vector solution; solution = solve_quadratic(0.5 * grav, -vz, zdist); // equation "z(ti) = zdist" // ALWAYS solvable because jumpheight >= zdist - if(!solution_z) - solution_y = solution_x; // just in case it is not solvable due to roundoff errors, assume two equal solutions at their center (this is mainly for the usual case with ht == 0) + if(!solution.z) + solution_y = solution.x; // just in case it is not solvable due to roundoff errors, assume two equal solutions at their center (this is mainly for the usual case with ht == 0) if(zdist == 0) - solution_x = solution_y; // solution_x is 0 in this case, so don't use it, but rather use solution_y (which will be sqrt(0.5 * jumpheight / grav), actually) + solution_x = solution.y; // solution_x is 0 in this case, so don't use it, but rather use solution_y (which will be sqrt(0.5 * jumpheight / grav), actually) if(zdist < 0) { @@ -176,14 +176,14 @@ vector spiberbot_calcartillery(vector org, vector tgt, float ht) // almost straight line type // jump apex is before the jump // we must take the larger one - spiberbot_calcartillery_flighttime = solution_y; + spiberbot_calcartillery_flighttime = solution.y; } else { // regular jump // jump apex is during the jump // we must take the larger one too - spiberbot_calcartillery_flighttime = solution_y; + spiberbot_calcartillery_flighttime = solution.y; } } else @@ -194,14 +194,14 @@ vector spiberbot_calcartillery(vector org, vector tgt, float ht) // almost straight line type // jump apex is after the jump // we must take the smaller one - spiberbot_calcartillery_flighttime = solution_x; + spiberbot_calcartillery_flighttime = solution.x; } else { // regular jump // jump apex is during the jump // we must take the larger one - spiberbot_calcartillery_flighttime = solution_y; + spiberbot_calcartillery_flighttime = solution.y; } } vs = sdist / spiberbot_calcartillery_flighttime; @@ -292,7 +292,7 @@ void spiderbot_rocket_do() crosshair_trace(self.owner); rocket.pos1 = trace_endpos + randomvec() * (0.75 * autocvar_g_vehicle_spiderbot_rocket_radius); - rocket.pos1_z = trace_endpos_z; + rocket.pos1_z = trace_endpos.z; traceline(v, v + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, self); float h1 = 0.75 * vlen(v - trace_endpos); @@ -374,16 +374,16 @@ float spiderbot_frame() // Rotate head ftmp = autocvar_g_vehicle_spiderbot_head_turnspeed * sys_frametime; - ad_y = bound(-ftmp, ad_y, ftmp); - spider.tur_head.angles_y = bound(autocvar_g_vehicle_spiderbot_head_turnlimit * -1, spider.tur_head.angles_y + ad_y, autocvar_g_vehicle_spiderbot_head_turnlimit); + ad_y = bound(-ftmp, ad.y, ftmp); + spider.tur_head.angles_y = bound(autocvar_g_vehicle_spiderbot_head_turnlimit * -1, spider.tur_head.angles.y + ad.y, autocvar_g_vehicle_spiderbot_head_turnlimit); // Pitch head - ad_x = bound(ftmp * -1, ad_x, ftmp); - spider.tur_head.angles_x = bound(autocvar_g_vehicle_spiderbot_head_pitchlimit_down, spider.tur_head.angles_x + ad_x, autocvar_g_vehicle_spiderbot_head_pitchlimit_up); + ad_x = bound(ftmp * -1, ad.x, ftmp); + spider.tur_head.angles_x = bound(autocvar_g_vehicle_spiderbot_head_pitchlimit_down, spider.tur_head.angles.x + ad.x, autocvar_g_vehicle_spiderbot_head_pitchlimit_up); //fixedmakevectors(spider.angles); - makevectors(spider.angles + '-2 0 0' * spider.angles_x); + makevectors(spider.angles + '-2 0 0' * spider.angles.x); movelib_groundalign4point(autocvar_g_vehicle_spiderbot_springlength, autocvar_g_vehicle_spiderbot_springup, autocvar_g_vehicle_spiderbot_springblend, autocvar_g_vehicle_spiderbot_tiltlimit); @@ -423,29 +423,29 @@ float spiderbot_frame() else { // Turn Body - if(player.movement_x == 0 && player.movement_y != 0) + if(player.movement_x == 0 && player.movement.y != 0) ftmp = autocvar_g_vehicle_spiderbot_turnspeed_strafe * sys_frametime; else ftmp = autocvar_g_vehicle_spiderbot_turnspeed * sys_frametime; - ftmp = bound(-ftmp, spider.tur_head.angles_y, ftmp); - spider.angles_y = anglemods(spider.angles_y + ftmp); + ftmp = bound(-ftmp, spider.tur_head.angles.y, ftmp); + spider.angles_y = anglemods(spider.angles.y + ftmp); spider.tur_head.angles_y -= ftmp; - if(player.movement_x != 0) + if(player.movement.x != 0) { - if(player.movement_x > 0) + if(player.movement.x > 0) { player.movement_x = 1; spider.frame = 0; } - else if(player.movement_x < 0) + else if(player.movement.x < 0) { player.movement_x = -1; spider.frame = 1; } player.movement_y = 0; - movelib_move_simple(normalize(v_forward * player.movement_x),autocvar_g_vehicle_spiderbot_speed_walk,autocvar_g_vehicle_spiderbot_movement_inertia); + movelib_move_simple(normalize(v_forward * player.movement.x),autocvar_g_vehicle_spiderbot_speed_walk,autocvar_g_vehicle_spiderbot_movement_inertia); if(self.sound_nexttime < time || self.delay != 1) { @@ -455,19 +455,19 @@ float spiderbot_frame() //dprint("spiderbot_walk:", ftos(soundlength("vehicles/spiderbot_walk.wav")), "\n"); } } - else if(player.movement_y != 0) + else if(player.movement.y != 0) { - if(player.movement_y < 0) + if(player.movement.y < 0) { player.movement_y = -1; spider.frame = 2; } - else if(player.movement_y > 0) + else if(player.movement.y > 0) { player.movement_y = 1; spider.frame = 3; } - movelib_move_simple(normalize(v_right * player.movement_y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia); + movelib_move_simple(normalize(v_right * player.movement.y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia); if(self.sound_nexttime < time || self.delay != 2) { self.delay = 2; @@ -480,8 +480,8 @@ float spiderbot_frame() } } - self.angles_x = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, self.angles_x, autocvar_g_vehicle_spiderbot_tiltlimit); - self.angles_z = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, self.angles_z, autocvar_g_vehicle_spiderbot_tiltlimit); + self.angles_x = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, self.angles.x, autocvar_g_vehicle_spiderbot_tiltlimit); + self.angles_z = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, self.angles.z, autocvar_g_vehicle_spiderbot_tiltlimit); if(player.BUTTON_ATCK) { @@ -516,7 +516,7 @@ float spiderbot_frame() player.vehicle_ammo1 = (spider.vehicle_ammo1 / autocvar_g_vehicle_spiderbot_minigun_ammo_max) * 100; spider.gun1.angles_z += 45; spider.gun2.angles_z -= 45; - if(spider.gun1.angles_z >= 360) + if(spider.gun1.angles.z >= 360) { spider.gun1.angles_z = 0; spider.gun2.angles_z = 0; @@ -639,8 +639,8 @@ void spiderbot_exit(float eject) void spider_impact() { - if(autocvar_g_vehicle_spiderbot_bouncepain_x) - vehicles_impact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z); + if(autocvar_g_vehicle_spiderbot_bouncepain.x) + vehicles_impact(autocvar_g_vehicle_spiderbot_bouncepain.x, autocvar_g_vehicle_spiderbot_bouncepain.y, autocvar_g_vehicle_spiderbot_bouncepain.z); } void spiderbot_headfade() diff --git a/qcsrc/server/vehicles/vehicles.qc b/qcsrc/server/vehicles/vehicles.qc index 785d39516..4957d4d52 100644 --- a/qcsrc/server/vehicles/vehicles.qc +++ b/qcsrc/server/vehicles/vehicles.qc @@ -33,13 +33,13 @@ float SendAuxiliaryXhair(entity to, float sf) WriteByte(MSG_ENTITY, self.cnt); - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); + WriteCoord(MSG_ENTITY, self.origin.x); + WriteCoord(MSG_ENTITY, self.origin.y); + WriteCoord(MSG_ENTITY, self.origin.z); - WriteByte(MSG_ENTITY, rint(self.colormod_x * 255)); - WriteByte(MSG_ENTITY, rint(self.colormod_y * 255)); - WriteByte(MSG_ENTITY, rint(self.colormod_z * 255)); + WriteByte(MSG_ENTITY, rint(self.colormod.x * 255)); + WriteByte(MSG_ENTITY, rint(self.colormod.y * 255)); + WriteByte(MSG_ENTITY, rint(self.colormod.z * 255)); return TRUE; } @@ -678,14 +678,14 @@ void vehicles_enter() WriteByte (MSG_ONE, SVC_SETVIEWANGLES); if(self.tur_head) { - WriteAngle(MSG_ONE, self.tur_head.angles_x + self.angles_x); // tilt - WriteAngle(MSG_ONE, self.tur_head.angles_y + self.angles_y); // yaw + WriteAngle(MSG_ONE, self.tur_head.angles.x + self.angles.x); // tilt + WriteAngle(MSG_ONE, self.tur_head.angles.y + self.angles.y); // yaw WriteAngle(MSG_ONE, 0); // roll } else { - WriteAngle(MSG_ONE, self.angles_x * -1); // tilt - WriteAngle(MSG_ONE, self.angles_y); // yaw + WriteAngle(MSG_ONE, self.angles.x * -1); // tilt + WriteAngle(MSG_ONE, self.angles.y); // yaw WriteAngle(MSG_ONE, 0); // roll } } @@ -804,7 +804,7 @@ void vehicles_exit(float eject) WriteByte (MSG_ONE, SVC_SETVIEWANGLES); WriteAngle(MSG_ONE, 0); - WriteAngle(MSG_ONE, _vehicle.angles_y); + WriteAngle(MSG_ONE, _vehicle.angles.y); WriteAngle(MSG_ONE, 0); } @@ -1368,10 +1368,10 @@ vector vehicle_aimturret(entity _vehic, vector _target, entity _turrret, string vtmp = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(_vehic.angles), AnglesTransform_FromAngles(vtmp))) - _turrret.angles; vtmp = AnglesTransform_Normalize(vtmp, TRUE); ftmp = _aimspeed * frametime; - vtmp_y = bound(-ftmp, vtmp_y, ftmp); - vtmp_x = bound(-ftmp, vtmp_x, ftmp); - _turrret.angles_y = bound(_rotlimit_min, _turrret.angles_y + vtmp_y, _rotlimit_max); - _turrret.angles_x = bound(_pichlimit_min, _turrret.angles_x + vtmp_x, _pichlimit_max); + vtmp_y = bound(-ftmp, vtmp.y, ftmp); + vtmp_x = bound(-ftmp, vtmp.x, ftmp); + _turrret.angles_y = bound(_rotlimit_min, _turrret.angles.y + vtmp.y, _rotlimit_max); + _turrret.angles_x = bound(_pichlimit_min, _turrret.angles.x + vtmp.x, _pichlimit_max); return vtag; } diff --git a/qcsrc/server/waypointsprites.qc b/qcsrc/server/waypointsprites.qc index 736cc564c..5fffc4888 100644 --- a/qcsrc/server/waypointsprites.qc +++ b/qcsrc/server/waypointsprites.qc @@ -276,9 +276,9 @@ float WaypointSprite_SendEntity(entity to, float sendflags) if(sendflags & 64) { - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); + WriteCoord(MSG_ENTITY, self.origin.x); + WriteCoord(MSG_ENTITY, self.origin.y); + WriteCoord(MSG_ENTITY, self.origin.z); } if(sendflags & 1) @@ -313,9 +313,9 @@ float WaypointSprite_SendEntity(entity to, float sendflags) if(sendflags & 32) { WriteByte(MSG_ENTITY, self.cnt); // icon on radar - WriteByte(MSG_ENTITY, self.colormod_x * 255.0); - WriteByte(MSG_ENTITY, self.colormod_y * 255.0); - WriteByte(MSG_ENTITY, self.colormod_z * 255.0); + WriteByte(MSG_ENTITY, self.colormod.x * 255.0); + WriteByte(MSG_ENTITY, self.colormod.y * 255.0); + WriteByte(MSG_ENTITY, self.colormod.z * 255.0); if(WaypointSprite_isteammate(self.owner, WaypointSprite_getviewentity(to))) { diff --git a/qcsrc/server/weapons/csqcprojectile.qc b/qcsrc/server/weapons/csqcprojectile.qc index 3dd93c058..bf09e1585 100644 --- a/qcsrc/server/weapons/csqcprojectile.qc +++ b/qcsrc/server/weapons/csqcprojectile.qc @@ -30,15 +30,15 @@ float CSQCProjectile_SendEntity(entity to, float sf) if(sf & 1) { - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); + WriteCoord(MSG_ENTITY, self.origin.x); + WriteCoord(MSG_ENTITY, self.origin.y); + WriteCoord(MSG_ENTITY, self.origin.z); if(sf & 0x80) { - WriteCoord(MSG_ENTITY, self.velocity_x); - WriteCoord(MSG_ENTITY, self.velocity_y); - WriteCoord(MSG_ENTITY, self.velocity_z); + WriteCoord(MSG_ENTITY, self.velocity.x); + WriteCoord(MSG_ENTITY, self.velocity.y); + WriteCoord(MSG_ENTITY, self.velocity.z); if(sf & 0x10) WriteCoord(MSG_ENTITY, self.gravity); } diff --git a/qcsrc/server/weapons/hitplot.qc b/qcsrc/server/weapons/hitplot.qc index 685741dab..226601e85 100644 --- a/qcsrc/server/weapons/hitplot.qc +++ b/qcsrc/server/weapons/hitplot.qc @@ -20,14 +20,14 @@ vector W_HitPlotNormalizedUntransform(vector org, entity targ, vector screenforw for(i = 0; i < 2; ++i) for(j = 0; j < 2; ++j) for(k = 0; k < 2; ++k) { thisv = targ.origin; - if(i) thisv_x += targ.maxs_x; else thisv_x += targ.mins_x; - if(j) thisv_y += targ.maxs_y; else thisv_y += targ.mins_y; - if(k) thisv_z += targ.maxs_z; else thisv_z += targ.mins_z; + if(i) thisv.x += targ.maxs.x; else thisv.x += targ.mins.x; + if(j) thisv.y += targ.maxs.y; else thisv.y += targ.mins.y; + if(k) thisv.z += targ.maxs.z; else thisv.z += targ.mins.z; thisv = W_HitPlotUnnormalizedUntransform(screenforward, screenright, screenup, thisv); if(i || j || k) { - if(mi_x > thisv_x) mi_x = thisv_x; if(ma_x < thisv_x) ma_x = thisv_x; - if(mi_y > thisv_y) mi_y = thisv_y; if(ma_y < thisv_y) ma_y = thisv_y; + if(mi.x > thisv.x) mi_x = thisv.x; if(ma.x < thisv.x) ma_x = thisv.x; + if(mi.y > thisv.y) mi_y = thisv.y; if(ma.y < thisv.y) ma_y = thisv.y; //if(mi_z > thisv_z) mi_z = thisv_z; if(ma_z < thisv_z) ma_y = thisv_z; } else @@ -38,9 +38,9 @@ vector W_HitPlotNormalizedUntransform(vector org, entity targ, vector screenforw } thisv = W_HitPlotUnnormalizedUntransform(screenforward, screenright, screenup, v); - ret_x = (thisv_x - mi_x) / (ma_x - mi_x); - ret_y = (thisv_y - mi_y) / (ma_y - mi_y); - ret_z = thisv_z - myv_z; + ret_x = (thisv.x - mi.x) / (ma.x - mi.x); + ret_y = (thisv.y - mi.y) / (ma.y - mi.y); + ret_z = thisv.z - myv.z; return ret; } @@ -65,7 +65,7 @@ void W_HitPlotAnalysis(entity player, vector screenforward, vector screenright, antilag_takeback(trace_ent, time - lag); hitplot = W_HitPlotNormalizedUntransform(org, trace_ent, screenforward, screenright, screenup, trace_endpos); antilag_restore(trace_ent); - fputs(player.hitplotfh, strcat(ftos(hitplot_x), " ", ftos(hitplot_y), " ", ftos(hitplot_z), " ", ftos(player.switchweapon), "\n")); + fputs(player.hitplotfh, strcat(ftos(hitplot.x), " ", ftos(hitplot.y), " ", ftos(hitplot.z), " ", ftos(player.switchweapon), "\n")); //print(strcat(ftos(hitplot_x), " ", ftos(hitplot_y), " ", ftos(hitplot_z), "\n")); } } diff --git a/qcsrc/server/weapons/selection.qc b/qcsrc/server/weapons/selection.qc index f7f3cde51..b4f6930e5 100644 --- a/qcsrc/server/weapons/selection.qc +++ b/qcsrc/server/weapons/selection.qc @@ -85,7 +85,7 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain) WaypointSprite_Spawn( (get_weaponinfo(wpn)).wpmodel, 1, 0, - world, e.origin + ('0 0 1' * e.maxs_z) * 1.2, + world, e.origin + ('0 0 1' * e.maxs.z) * 1.2, self, 0, world, enemy, 0, diff --git a/qcsrc/server/weapons/tracing.qc b/qcsrc/server/weapons/tracing.qc index dfe318cf0..356095bdf 100644 --- a/qcsrc/server/weapons/tracing.qc +++ b/qcsrc/server/weapons/tracing.qc @@ -37,24 +37,24 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector m W_HitPlotAnalysis(ent, v_forward, v_right, v_up); - if(ent.weaponentity.movedir_x > 0) + if(ent.weaponentity.movedir.x > 0) vecs = ent.weaponentity.movedir; else vecs = '0 0 0'; - dv = v_right * -vecs_y + v_up * vecs_z; + dv = v_right * -vecs.y + v_up * vecs.z; w_shotorg = ent.origin + ent.view_ofs + dv; // now move the shotorg forward as much as requested if possible if(antilag) { if(ent.antilag_debug) - tracebox_antilag(ent, w_shotorg, mi, ma, w_shotorg + v_forward * (vecs_x + nudge), MOVE_NORMAL, ent, ent.antilag_debug); + tracebox_antilag(ent, w_shotorg, mi, ma, w_shotorg + v_forward * (vecs.x + nudge), MOVE_NORMAL, ent, ent.antilag_debug); else - tracebox_antilag(ent, w_shotorg, mi, ma, w_shotorg + v_forward * (vecs_x + nudge), MOVE_NORMAL, ent, ANTILAG_LATENCY(ent)); + tracebox_antilag(ent, w_shotorg, mi, ma, w_shotorg + v_forward * (vecs.x + nudge), MOVE_NORMAL, ent, ANTILAG_LATENCY(ent)); } else - tracebox(w_shotorg, mi, ma, w_shotorg + v_forward * (vecs_x + nudge), MOVE_NORMAL, ent); + tracebox(w_shotorg, mi, ma, w_shotorg + v_forward * (vecs.x + nudge), MOVE_NORMAL, ent); w_shotorg = trace_endpos - v_forward * nudge; // calculate the shotdir from the chosen shotorg w_shotdir = normalize(w_shotend - w_shotorg); @@ -146,7 +146,7 @@ void W_SetupProjVelocity_Explicit(entity proj, vector dir, vector upDir, float p error("Unowned missile"); dir = dir + upDir * (pUpSpeed / pSpeed); - dir_z += pZSpeed / pSpeed; + dir.z += pZSpeed / pSpeed; pSpeed *= vlen(dir); dir = normalize(dir); @@ -421,7 +421,7 @@ void fireBullet(vector start, vector dir, float spread, float max_solid_penetrat // go through solid! // outside the world? forget it - if(start_x > world.maxs_x || start_y > world.maxs_y || start_z > world.maxs_z || start_x < world.mins_x || start_y < world.mins_y || start_z < world.mins_z) + if(start.x > world.maxs.x || start.y > world.maxs.y || start.z > world.maxs.z || start.x < world.mins.x || start.y < world.mins.y || start.z < world.mins.z) break; float maxdist; diff --git a/qcsrc/server/weapons/weaponstats.qc b/qcsrc/server/weapons/weaponstats.qc index d83db8b82..c1bb87a7d 100644 --- a/qcsrc/server/weapons/weaponstats.qc +++ b/qcsrc/server/weapons/weaponstats.qc @@ -32,7 +32,7 @@ void WeaponStats_ready(entity fh, entity pass, float status) { //vector is: kills hits damage url_fputs(fh, sprintf("%s%d %d\t%d %d\t", prefix, i, ibot, j, jbot)); - url_fputs(fh, sprintf("%d %d %g\n", v_x, v_y, v_z)); + url_fputs(fh, sprintf("%d %d %g\n", v.x, v.y, v.z)); } } url_fputs(fh, "#end\n\n"); diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 25fce59a1..df21b4161 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -231,7 +231,7 @@ void CL_WeaponEntity_SetModel(string name) self.view_ofs = '0 0 0'; - if(self.movedir_x >= 0) + if(self.movedir.x >= 0) { vector v0; v0 = self.movedir; @@ -270,7 +270,7 @@ void CL_Weaponentity_Think() float tb; self.nextthink = time; if (intermission_running) - self.frame = self.anim_idle_x; + self.frame = self.anim_idle.x; if (self.owner.weaponentity != self) { if (self.weaponentity) @@ -587,7 +587,7 @@ void weapon_thinkf(float fr, float t, void() func) a = self.weaponentity.anim_fire2; else // if (fr == WFRAME_RELOAD) a = self.weaponentity.anim_reload; - a_z *= g_weaponratefactor; + a.z *= g_weaponratefactor; setanim(self.weaponentity, a, restartanim == FALSE, restartanim, restartanim); } @@ -794,7 +794,7 @@ void W_AttachToShotorg(entity flash, vector offset) flash.viewmodelforclient = self; - if(self.weaponentity.oldorigin_x > 0) + if(self.weaponentity.oldorigin.x > 0) { setattachment(xflash, self.exteriorweaponentity, ""); setorigin(xflash, self.weaponentity.oldorigin + offset); diff --git a/qcsrc/warpzonelib/anglestransform.qc b/qcsrc/warpzonelib/anglestransform.qc index 3233f6a31..b4ff61d9e 100644 --- a/qcsrc/warpzonelib/anglestransform.qc +++ b/qcsrc/warpzonelib/anglestransform.qc @@ -3,21 +3,21 @@ vector fixedvectoangles(vector a) { vector ang; ang = vectoangles(a); - ang_x = -ang_x; + ang_x = -ang.x; return ang; } vector fixedvectoangles2(vector a, vector b) { vector ang; ang = vectoangles2(a, b); - ang_x = -ang_x; + ang_x = -ang.x; return ang; } #else void fixedmakevectors(vector a) { // a makevectors that actually inverts vectoangles - a_x = -a_x; + a_x = -a.x; makevectors(a); } #endif @@ -27,9 +27,9 @@ void fixedmakevectors(vector a) vector AnglesTransform_Apply(vector transform, vector v) { fixedmakevectors(transform); - return v_forward * v_x - + v_right * (-v_y) - + v_up * v_z; + return v_forward * v.x + + v_right * (-v.y) + + v_up * v.z; } vector AnglesTransform_Multiply(vector t1, vector t2) @@ -48,12 +48,12 @@ vector AnglesTransform_Invert(vector transform) // but these are orthogonal unit vectors! // so to invert, we can simply fixedvectoangles the TRANSPOSED matrix // TODO is this always -transform? - i_forward_x = v_forward_x; - i_forward_y = -v_right_x; - i_forward_z = v_up_x; - i_up_x = v_forward_z; - i_up_y = -v_right_z; - i_up_z = v_up_z; + i_forward_x = v_forward.x; + i_forward_y = -v_right.x; + i_forward_z = v_up.x; + i_up_x = v_forward.z; + i_up_y = -v_right.z; + i_up_z = v_up.z; return fixedvectoangles2(i_forward, i_up); } @@ -63,9 +63,9 @@ vector AnglesTransform_TurnDirectionFR(vector transform) // changes in-direction to out-direction //fixedmakevectors(transform); //return fixedvectoangles2(-1 * v_forward, 1 * v_up); - transform_x = -transform_x; - transform_y = 180 + transform_y; - transform_z = -transform_z; + transform_x = -transform.x; + transform_y = 180 + transform.y; + transform_z = -transform.z; // pitch: -s +c // yaw: -s -c // roll: -s +c @@ -78,9 +78,9 @@ vector AnglesTransform_TurnDirectionFU(vector transform) // changes in-direction to out-direction //fixedmakevectors(transform); //return fixedvectoangles2(-1 * v_forward, 1 * v_up); - transform_x = -transform_x; - transform_y = 180 + transform_y; - transform_z = 180 - transform_z; + transform_x = -transform.x; + transform_y = 180 + transform.y; + transform_z = 180 - transform.z; return transform; } @@ -98,18 +98,18 @@ vector AnglesTransform_Normalize(vector t, float minimize_roll) { float need_flip; // first, bring all angles in their range... - t_x = t_x - 360 * rint(t_x / 360); - t_y = t_y - 360 * rint(t_y / 360); - t_z = t_z - 360 * rint(t_z / 360); + t_x = t.x - 360 * rint(t.x / 360); + t_y = t.y - 360 * rint(t.y / 360); + t_z = t.z - 360 * rint(t.z / 360); if(minimize_roll) - need_flip = (t_z > 90 || t_z <= -90); + need_flip = (t.z > 90 || t.z <= -90); else - need_flip = (t_x > 90 || t_x < -90); // for pitch we prefer to allow exactly -90 degrees for looking straight down + need_flip = (t.x > 90 || t.x < -90); // for pitch we prefer to allow exactly -90 degrees for looking straight down if(need_flip) { - if(t_x >= 0) t_x = 180 - t_x; else t_x = -180 - t_x; - if(t_y > 0) t_y -= 180; else t_y += 180; - if(t_z > 0) t_z -= 180; else t_z += 180; + if(t.x >= 0) t_x = 180 - t.x; else t_x = -180 - t.x; + if(t.y > 0) t.y -= 180; else t.y += 180; + if(t.z > 0) t.z -= 180; else t.z += 180; } return t; } @@ -126,20 +126,20 @@ vector AnglesTransform_CancelRoll(vector t) // FIXME find a better method - f = fabs(t_x - (-90)) / epsilon; + f = fabs(t.x - (-90)) / epsilon; if(f < 1) { //t_x = -90; - t_y += t_z; + t.y += t.z; t_z = 0; } else { - f = fabs(t_x - 90) / epsilon; + f = fabs(t.x - 90) / epsilon; if(f < 1) { //t_x = 90; - t_y -= t_z; + t.y -= t.z; t_z = 0; } } @@ -149,9 +149,9 @@ vector AnglesTransform_CancelRoll(vector t) #ifdef POSITIVE_PITCH_IS_DOWN vector AnglesTransform_ApplyToAngles(vector transform, vector v) { - v_x = -v_x; + v_x = -v.x; v = AnglesTransform_Multiply(transform, v); - v_x = -v_x; + v_x = -v.x; return v; } vector AnglesTransform_ApplyToVAngles(vector transform, vector v) @@ -161,12 +161,12 @@ vector AnglesTransform_ApplyToVAngles(vector transform, vector v) } vector AnglesTransform_FromAngles(vector v) { - v_x = -v_x; + v_x = -v.x; return v; } vector AnglesTransform_ToAngles(vector v) { - v_x = -v_x; + v_x = -v.x; return v; } vector AnglesTransform_FromVAngles(vector v) @@ -185,9 +185,9 @@ vector AnglesTransform_ApplyToAngles(vector transform, vector v) } vector AnglesTransform_ApplyToVAngles(vector transform, vector v) { - v_x = -v_x; + v_x = -v.x; v = AnglesTransform_Multiply(transform, v); - v_x = -v_x; + v_x = -v.x; return v; } vector AnglesTransform_FromAngles(vector v) @@ -200,12 +200,12 @@ vector AnglesTransform_ToAngles(vector v) } vector AnglesTransform_FromVAngles(vector v) { - v_x = -v_x; + v_x = -v.x; return v; } vector AnglesTransform_ToVAngles(vector v) { - v_x = -v_x; + v_x = -v.x; return v; } #endif diff --git a/qcsrc/warpzonelib/client.qc b/qcsrc/warpzonelib/client.qc index a1191f8d9..af47d6b01 100644 --- a/qcsrc/warpzonelib/client.qc +++ b/qcsrc/warpzonelib/client.qc @@ -185,12 +185,12 @@ vector WarpZone_FixNearClip(vector o, vector c0, vector c1, vector c2, vector c3 entity e; float pd; - mi_x = min(o_x, c0_x, c1_x, c2_x, c3_x); - ma_x = max(o_x, c0_x, c1_x, c2_x, c3_x); - mi_y = min(o_y, c0_y, c1_y, c2_y, c3_y); - ma_y = max(o_y, c0_y, c1_y, c2_y, c3_y); - mi_z = min(o_z, c0_z, c1_z, c2_z, c3_z); - ma_z = max(o_z, c0_z, c1_z, c2_z, c3_z); + mi_x = min(o.x, c0_x, c1_x, c2_x, c3_x); + ma_x = max(o.x, c0_x, c1_x, c2_x, c3_x); + mi_y = min(o.y, c0_y, c1_y, c2_y, c3_y); + ma_y = max(o.y, c0_y, c1_y, c2_y, c3_y); + mi_z = min(o.z, c0_z, c1_z, c2_z, c3_z); + ma_z = max(o.z, c0_z, c1_z, c2_z, c3_z); e = WarpZone_Find(mi, ma); if(e) @@ -254,7 +254,7 @@ void WarpZone_FixView() rick = getproperty(VF_CL_VIEWANGLES_Z); rick *= f; setproperty(VF_CL_VIEWANGLES_Z, rick); - ang_z *= f; + ang.z *= f; #endif setproperty(VF_ORIGIN, org); diff --git a/qcsrc/warpzonelib/common.qc b/qcsrc/warpzonelib/common.qc index 222d667ee..e8358435f 100644 --- a/qcsrc/warpzonelib/common.qc +++ b/qcsrc/warpzonelib/common.qc @@ -508,7 +508,7 @@ vector WarpZone_TransformVAngles(entity wz, vector ang) { #ifdef KEEP_ROLL float roll; - roll = ang_z; + roll = ang.z; ang_z = 0; #endif @@ -544,7 +544,7 @@ vector WarpZone_UnTransformVAngles(entity wz, vector ang) { float roll; - roll = ang_z; + roll = ang.z; ang_z = 0; ang = AnglesTransform_ApplyToVAngles(AnglesTransform_Invert(wz.warpzone_transform), ang); @@ -558,9 +558,9 @@ vector WarpZone_UnTransformVAngles(entity wz, vector ang) vector WarpZoneLib_NearestPointOnBox(vector mi, vector ma, vector org) { vector nearest; - nearest_x = bound(mi_x, org_x, ma_x); - nearest_y = bound(mi_y, org_y, ma_y); - nearest_z = bound(mi_z, org_z, ma_z); + nearest_x = bound(mi.x, org.x, ma.x); + nearest_y = bound(mi.y, org.y, ma.y); + nearest_z = bound(mi.z, org.z, ma.z); return nearest; } diff --git a/qcsrc/warpzonelib/mathlib.qc b/qcsrc/warpzonelib/mathlib.qc index 42262102e..a4421e85f 100644 --- a/qcsrc/warpzonelib/mathlib.qc +++ b/qcsrc/warpzonelib/mathlib.qc @@ -74,7 +74,7 @@ vector frexp(float x) vector v; v_z = 0; v_y = ilogb(x) + 1; - v_x = x / exp2(v_y); + v_x = x / exp2(v.y); return v; } int ilogb(float x) @@ -147,9 +147,9 @@ vector lgamma(float x) // lgamma(1-z) + lgamma(z) = log(pi) - log(sin(pi*z)) // sign of gamma(1-z) = sign of gamma(z) * sign of sin(pi*z) v_z = sin(M_PI * x); - v_x = log(M_PI) - log(fabs(v_z)) - v_x; - if(v_z < 0) - v_y = -v_y; + v_x = log(M_PI) - log(fabs(v.z)) - v.x; + if(v.z < 0) + v_y = -v.y; v_z = 0; return v; } @@ -162,7 +162,7 @@ float tgamma(float x) { vector v; v = lgamma(x); - return exp(v_x) * v_y; + return exp(v.x) * v.y; } float nearbyint(float x) @@ -187,7 +187,7 @@ vector remquo(float x, float y) vector v; v_z = 0; v_y = rint(x / y); - v_x = x - y * v_y; + v_x = x - y * v.y; return v; } diff --git a/qcsrc/warpzonelib/server.qc b/qcsrc/warpzonelib/server.qc index 7e83c3549..6786e3fd1 100644 --- a/qcsrc/warpzonelib/server.qc +++ b/qcsrc/warpzonelib/server.qc @@ -40,9 +40,9 @@ void WarpZone_TeleportPlayer(entity teleporter, entity player, vector to, vector float WarpZone_Teleported_Send(entity to, float sf) { WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE_TELEPORTED); - WriteCoord(MSG_ENTITY, self.angles_x); - WriteCoord(MSG_ENTITY, self.angles_y); - WriteCoord(MSG_ENTITY, self.angles_z); + WriteCoord(MSG_ENTITY, self.angles.x); + WriteCoord(MSG_ENTITY, self.angles.y); + WriteCoord(MSG_ENTITY, self.angles.z); return TRUE; } @@ -220,33 +220,33 @@ float WarpZone_Send(entity to, float sendflags) // we need THESE to render the warpzone (and cull properly)... if(f & 4) { - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); + WriteCoord(MSG_ENTITY, self.origin.x); + WriteCoord(MSG_ENTITY, self.origin.y); + WriteCoord(MSG_ENTITY, self.origin.z); } WriteShort(MSG_ENTITY, self.modelindex); - WriteCoord(MSG_ENTITY, self.mins_x); - WriteCoord(MSG_ENTITY, self.mins_y); - WriteCoord(MSG_ENTITY, self.mins_z); - WriteCoord(MSG_ENTITY, self.maxs_x); - WriteCoord(MSG_ENTITY, self.maxs_y); - WriteCoord(MSG_ENTITY, self.maxs_z); + WriteCoord(MSG_ENTITY, self.mins.x); + WriteCoord(MSG_ENTITY, self.mins.y); + WriteCoord(MSG_ENTITY, self.mins.z); + WriteCoord(MSG_ENTITY, self.maxs.x); + WriteCoord(MSG_ENTITY, self.maxs.y); + WriteCoord(MSG_ENTITY, self.maxs.z); WriteByte(MSG_ENTITY, bound(1, self.scale * 16, 255)); // we need THESE to calculate the proper transform - WriteCoord(MSG_ENTITY, self.warpzone_origin_x); - WriteCoord(MSG_ENTITY, self.warpzone_origin_y); - WriteCoord(MSG_ENTITY, self.warpzone_origin_z); - WriteCoord(MSG_ENTITY, self.warpzone_angles_x); - WriteCoord(MSG_ENTITY, self.warpzone_angles_y); - WriteCoord(MSG_ENTITY, self.warpzone_angles_z); - WriteCoord(MSG_ENTITY, self.warpzone_targetorigin_x); - WriteCoord(MSG_ENTITY, self.warpzone_targetorigin_y); - WriteCoord(MSG_ENTITY, self.warpzone_targetorigin_z); - WriteCoord(MSG_ENTITY, self.warpzone_targetangles_x); - WriteCoord(MSG_ENTITY, self.warpzone_targetangles_y); - WriteCoord(MSG_ENTITY, self.warpzone_targetangles_z); + WriteCoord(MSG_ENTITY, self.warpzone_origin.x); + WriteCoord(MSG_ENTITY, self.warpzone_origin.y); + WriteCoord(MSG_ENTITY, self.warpzone_origin.z); + WriteCoord(MSG_ENTITY, self.warpzone_angles.x); + WriteCoord(MSG_ENTITY, self.warpzone_angles.y); + WriteCoord(MSG_ENTITY, self.warpzone_angles.z); + WriteCoord(MSG_ENTITY, self.warpzone_targetorigin.x); + WriteCoord(MSG_ENTITY, self.warpzone_targetorigin.y); + WriteCoord(MSG_ENTITY, self.warpzone_targetorigin.z); + WriteCoord(MSG_ENTITY, self.warpzone_targetangles.x); + WriteCoord(MSG_ENTITY, self.warpzone_targetangles.y); + WriteCoord(MSG_ENTITY, self.warpzone_targetangles.z); if(f & 2) { @@ -271,27 +271,27 @@ float WarpZone_Camera_Send(entity to, float sendflags) // we need THESE to render the warpzone (and cull properly)... if(f & 4) { - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); + WriteCoord(MSG_ENTITY, self.origin.x); + WriteCoord(MSG_ENTITY, self.origin.y); + WriteCoord(MSG_ENTITY, self.origin.z); } WriteShort(MSG_ENTITY, self.modelindex); - WriteCoord(MSG_ENTITY, self.mins_x); - WriteCoord(MSG_ENTITY, self.mins_y); - WriteCoord(MSG_ENTITY, self.mins_z); - WriteCoord(MSG_ENTITY, self.maxs_x); - WriteCoord(MSG_ENTITY, self.maxs_y); - WriteCoord(MSG_ENTITY, self.maxs_z); + WriteCoord(MSG_ENTITY, self.mins.x); + WriteCoord(MSG_ENTITY, self.mins.y); + WriteCoord(MSG_ENTITY, self.mins.z); + WriteCoord(MSG_ENTITY, self.maxs.x); + WriteCoord(MSG_ENTITY, self.maxs.y); + WriteCoord(MSG_ENTITY, self.maxs.z); WriteByte(MSG_ENTITY, bound(1, self.scale * 16, 255)); // we need THESE to calculate the proper transform - WriteCoord(MSG_ENTITY, self.enemy.origin_x); - WriteCoord(MSG_ENTITY, self.enemy.origin_y); - WriteCoord(MSG_ENTITY, self.enemy.origin_z); - WriteCoord(MSG_ENTITY, self.enemy.angles_x); - WriteCoord(MSG_ENTITY, self.enemy.angles_y); - WriteCoord(MSG_ENTITY, self.enemy.angles_z); + WriteCoord(MSG_ENTITY, self.enemy.origin.x); + WriteCoord(MSG_ENTITY, self.enemy.origin.y); + WriteCoord(MSG_ENTITY, self.enemy.origin.z); + WriteCoord(MSG_ENTITY, self.enemy.angles.x); + WriteCoord(MSG_ENTITY, self.enemy.angles.y); + WriteCoord(MSG_ENTITY, self.enemy.angles.z); if(f & 2) { @@ -545,14 +545,14 @@ void WarpZone_InitStep_UpdateTransform() for(i_t = 0; i_t < n_t; ++i_t) { tri = getsurfacetriangle(self, i_s, i_t); - a = getsurfacepoint(self, i_s, tri_x); - b = getsurfacepoint(self, i_s, tri_y); - c = getsurfacepoint(self, i_s, tri_z); + a = getsurfacepoint(self, i_s, tri.x); + b = getsurfacepoint(self, i_s, tri.y); + c = getsurfacepoint(self, i_s, tri.z); p = b - a; q = c - a; - n = '1 0 0' * (q_y * p_z - q_z * p_y) - + '0 1 0' * (q_z * p_x - q_x * p_z) - + '0 0 1' * (q_x * p_y - q_y * p_x); + n = '1 0 0' * (q.y * p.z - q.z * p.y) + + '0 1 0' * (q.z * p.x - q.x * p.z) + + '0 0 1' * (q.x * p.y - q.y * p.x); area = area + vlen(n); norm = norm + n; point = point + vlen(n) * (a + b + c); @@ -585,7 +585,7 @@ void WarpZone_InitStep_UpdateTransform() norm = -1 * norm; } ang = vectoangles2(norm, v_up); // keep rotation, but turn exactly against plane - ang_x = -ang_x; + ang_x = -ang.x; if(norm * v_forward < 0.99) print("trigger_warpzone near ", vtos(self.aiment.origin), " has been turned to match plane orientation (", vtos(self.aiment.angles), " -> ", vtos(ang), "\n"); if(vlen(org - self.aiment.origin) > 0.5) @@ -596,7 +596,7 @@ void WarpZone_InitStep_UpdateTransform() { org = point; ang = vectoangles(norm); - ang_x = -ang_x; + ang_x = -ang.x; } else error("cannot infer origin/angles for this warpzone, please use a killtarget or a trigger_warpzone_position"); @@ -892,7 +892,7 @@ void WarpZone_PlayerPhysics_FixVAngle(void) { #ifndef WARPZONE_DONT_FIX_VANGLE if(IS_REAL_CLIENT(self)) - if(self.v_angle_z <= 360) // if not already adjusted + if(self.v_angle.z <= 360) // if not already adjusted if(time - self.ping * 0.001 < self.warpzone_teleport_time) { self.v_angle = WarpZone_TransformVAngles(self.warpzone_teleport_zone, self.v_angle); -- 2.39.2