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;
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;
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);
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;
}
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)
}
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) \
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)
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';
// 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).
{
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); }
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));
{
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)
{
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);
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"));
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");
// 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)
{
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
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)
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;
}
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;
{
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");
/* 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; }) \
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'; }
}
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)
{
{
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:
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;
}
}
// 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;
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);
}
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);
}
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);
}
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);
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;
}
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);
}
}
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);
}
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);
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)
// 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;
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;
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
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;
}
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
{
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);
}
}
}
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
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)
// 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
// 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)
}
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(
{
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);
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;
}
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);
}
}
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);
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;
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;
}
{
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),
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();
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)
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';
{
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;
}
}
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
{
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;
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);
}
}
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;
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);
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
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;
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;
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)
);
}
+ (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);
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;
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<team_count; ++i) {
if (i == floor((entries - 2) / players_per_team) || (entries == 1 && i == 0))
- HUD_Panel_DrawHighlight(pos + eX * score_size * i, eX * score_size + eY * fontsize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect(pos + eX * score_size * i, ftos(175 - 23*i), eX * score_size + eY * fontsize_y, Team_ColorRGB(ColorByTeam(i)) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
+ HUD_Panel_DrawHighlight(pos + eX * score_size * i, eX * score_size + eY * fontsize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(pos + eX * score_size * i, ftos(175 - 23*i), eX * score_size + eY * fontsize.y, Team_ColorRGB(ColorByTeam(i)) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
}
first_pl = 1;
- pos_y += fontsize_y;
+ pos.y += fontsize.y;
}
score = 10 + SCOREPANEL_MAX_ENTRIES * 3;
for (i=first_pl; i<entries; ++i)
if (i == entries-1 && autocvar_hud_panel_score_rankings == 1)
{
rgb = '1 1 0';
- drawfill(pos, eX * mySize_x + eY * fontsize_y, rgb, highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawfill(pos, eX * mySize.x + eY * fontsize.y, rgb, highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
s = GetPlayerName(player_localnum);
score = 7;
}
s = textShortenToWidth(s, name_size, fontsize, stringwidth_colors);
drawcolorcodedstring(pos + eX * (name_size - stringwidth(s, TRUE, fontsize)), s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
drawstring(pos + eX * (name_size + spacing_size), ftos(score), fontsize, score_color, panel_fg_alpha, DRAWFLAG_NORMAL);
- pos_y += fontsize_y;
+ pos.y += fontsize.y;
}
return;
}
if (team_count)
{
// show team scores in the first line
- float score_size = mySize_x / team_count;
+ float score_size = mySize.x / team_count;
for(tm = teams.sort_next; tm; tm = tm.sort_next) {
if(tm.team == NUM_SPECTATOR)
continue;
if (tm.team == myteam)
- drawfill(pos + eX * score_size * i, eX * score_size + eY * fontsize_y, '1 1 1', highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect(pos + eX * score_size * i, ftos(tm.(teamscores[ts_primary])), eX * score_size + eY * fontsize_y, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawfill(pos + eX * score_size * i, eX * score_size + eY * fontsize.y, '1 1 1', highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(pos + eX * score_size * i, ftos(tm.(teamscores[ts_primary])), eX * score_size + eY * fontsize.y, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
++i;
}
first_pl = 1;
- pos_y += fontsize_y;
+ pos.y += fontsize.y;
tm = teams.sort_next;
}
i = first_pl;
if (i == first_pl)
rgb = '0 1 0'; //first: green
me_printed = 1;
- drawfill(pos, eX * mySize_x + eY * fontsize_y, rgb, highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawfill(pos, eX * mySize.x + eY * fontsize.y, rgb, highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
}
if (team_count)
score_color = Team_ColorRGB(pl.team) * 0.8;
s = textShortenToWidth(GetPlayerName(pl.sv_entnum), name_size, fontsize, stringwidth_colors);
drawcolorcodedstring(pos + eX * (name_size - stringwidth(s, TRUE, fontsize)), s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
drawstring(pos + eX * (name_size + spacing_size), ftos(pl.(scores[ps_primary])), fontsize, score_color, panel_fg_alpha, DRAWFLAG_NORMAL);
- pos_y += fontsize_y;
+ pos.y += fontsize.y;
++i;
}
while (i<entries && team_count && (tm = tm.sort_next) && (tm.team != NUM_SPECTATOR || (tm = tm.sort_next)));
distribution_color = '1 0 0';
sign = "+";
}
- drawstring_aspect(pos + eX * 0.75 * mySize_x, strcat(sign, distrtimer), eX * 0.25 * mySize_x + eY * (1/3) * mySize_y, distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(pos + eX * 0.75 * mySize.x, strcat(sign, distrtimer), eX * 0.25 * mySize.x + eY * (1/3) * mySize.y, distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL);
}
// race record display
if (distribution <= 0)
- HUD_Panel_DrawHighlight(pos, eX * 0.75 * mySize_x + eY * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect(pos, timer, 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, timer, eX * 0.75 * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
draw_endBoldFont();
} else if (!teamplay) { // non-teamgames
if ((spectatee_status == -1 && !autocvar__hud_configure) || autocvar_hud_panel_score_rankings)
{
if (distribution > 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;
}
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;
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);
}
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;
}
}
// 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;
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)
{
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)
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;
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
{
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)
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);
}
}
}
// 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();
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);
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);
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<team_count; ++i)
{
- pos = myPos + eX * column * itemSize_x + eY * row * itemSize_y;
+ pos = myPos + eX * column * itemSize.x + eY * row * itemSize.y;
DrawCAItem(pos, itemSize, aspect_ratio, layout, i);
break;
}
- if(mySize_x > 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);
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;
}
}
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;
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);
}
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
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;
}
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;
}
//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();
}
}
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);
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<team_count; ++i)
{
- pos = myPos + eX * column * itemSize_x + eY * row * itemSize_y;
+ pos = myPos + eX * column * itemSize.x + eY * row * itemSize.y;
DrawDomItem(pos, itemSize, aspect_ratio, layout, i);
if(aspect)
{
vector newSize = '0 0 0';
- if(mySize_x/mySize_y > 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)
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)
{
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;
}
}
}
//
#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)
// 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;
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;
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)
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;
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);
}
//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)
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);
}
}
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
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;
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);
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);
}
}
// 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<CENTERPRINT_MAX_MSGS; ++i, ++j)
{
getWrappedLine_remaining = argv(k);
while(getWrappedLine_remaining)
{
- ts = getWrappedLine(panel_size_x * sz, fontsize, stringwidth_colors);
+ ts = getWrappedLine(panel_size.x * sz, fontsize, stringwidth_colors);
if (ts != "")
- pos_y -= fontsize_y;
+ pos.y -= fontsize.y;
else
- pos_y -= fontsize_y * CENTERPRINT_SPACING/2;
+ pos.y -= fontsize.y * CENTERPRINT_SPACING/2;
}
}
- current_msg_pos_y = pos_y; // save starting pos (first line) of the current message
+ current_msg_posY = pos.y; // save starting pos (first line) of the current message
}
- msg_size = pos_y;
+ msg_size = pos.y;
for(k = 0; k < n; ++k)
{
getWrappedLine_remaining = argv(k);
while(getWrappedLine_remaining)
{
- ts = getWrappedLine(panel_size_x * sz, fontsize, stringwidth_colors);
+ ts = getWrappedLine(panel_size.x * sz, fontsize, stringwidth_colors);
if (ts != "")
{
if (align)
- pos_x = panel_pos_x + (panel_size_x - stringwidth(ts, TRUE, fontsize)) * align;
+ pos_x = panel_pos.x + (panel_size.x - stringwidth(ts, TRUE, fontsize)) * align;
if (a > 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;
}
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;
// 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) {
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);
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);
}
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];
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:
//
// 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);
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|
// 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);
// 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);
}
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
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);
}
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);
}
}
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)
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;
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;
}
}
// 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;
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
//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;
}
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;
}
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);
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);
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);
{
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)
{
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);
}
{
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);
}
}
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()
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;
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;
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 != "")
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 != "")
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);
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';
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);
}
{
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)
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;
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;
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)
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);
}
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;
}
{
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;
}
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;
}
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));
}
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)
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;
}
}
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)
}
#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;
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
// 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)
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...
{
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;
// 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();
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);
}
}
// 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);
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;
// 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();
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_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;
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);
}
}
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();
}
vector point;
point = ent.move_origin;
- point_z += (ent.mins_z + 1);
+ point_z += (ent.mins.z + 1);
nativecontents = pointcontents(point);
{
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;
}
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;
{
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;
}
{
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;
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;
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;
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')
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
}
}
{
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);
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;
}
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;
}
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);
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)
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;
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)
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;
}
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;
}
}
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)
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;
//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
{
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)
{
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;
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
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;
}
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;
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?
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;
}
}
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;
}
// 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);
}
// update position
- pos_y += 1.25 * hud_fontsize_y;
+ pos.y += 1.25 * hud_fontsize.y;
return pos;
}
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);
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;
}
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;
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)
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();
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);
}
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;
}
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
}
}
- 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
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;
}
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;
}
}
- 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)
{
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)
{
{
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);
}
}
}
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';
}
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;
}
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;
}
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';
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);
// 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
{
// 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)
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;
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)
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)
{
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;
}
}
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;
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;
}
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);
// 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
// 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
// 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
// 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
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);
}
}
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);
// 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
// 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
// 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();
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);
// 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
// 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
// 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
// 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);
}
}
{
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);
}
}
}
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);
}
}
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);
// 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
// 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
// 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
// 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
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);
}
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);
}
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);
}
}
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);
// 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
// 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
// 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
// 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
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);
}
}
// 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
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);
w = sw;
else
w = minwidth;
- h = fontsize_y;
+ h = fontsize.y;
// how do corners work?
aspect = vid_conwidth / vid_conheight;
}
// 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;
}
}
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;
}
}
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);
}
else
{
- if(d_z * f2 > 0)
+ if(d.z * f2 > 0)
{
// BOTTOM edge
d = d * ((0.5 - waypointsprite_edgeoffset_bottom) / f2);
#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;
// force the effect even for stationary firemine
if(self.cnt == PROJECTILE_FIREMINE)
if(from == to)
- from_z += 1;
+ from.z += 1;
if (self.traileffect)
{
vector ang;
ang = self.angles;
- ang_x = -ang_x;
+ ang_x = -ang.x;
makevectors(ang);
a = 1 - (time - self.fade_time) * self.fade_rate;
{
// 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)
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)
{
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
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
}
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)
//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;
}
}
#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;
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")
{
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);
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);
}
{
pos_z = random() * 200;
if(random() >= 0.5)
- pos_z *= -1;
+ pos.z *= -1;
}
}
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");
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);
}
}
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)
{
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;
}
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;
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);
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;
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);
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;
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:
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");
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;
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;
}
}
}
// 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
// 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;
{
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)
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;
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)
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;
}
{
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)
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))
);
}
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
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
// 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
{
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");
}
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");
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;
}
}
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
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;
}
{
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';
}
}
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;
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));
}
}
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
{
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
// 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
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;
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
{
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)
);
// 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
}
// 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);
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)
{
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);
}
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);
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;
{
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));
);
// 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)
// 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(
// 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); }
// 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); }
{
// 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);
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();
// _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;
}
}
//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
}
}
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)
}
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;
}
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));
}
#elif WEP_MAXCOUNT > 24
WriteInt48_t(dst, w);
#else
- WriteInt24_t(dst, w_x);
+ WriteInt24_t(dst, w.x);
#endif
}
#endif
CSQCPlayer_SetMinsMaxs();
- self.angles_y = input_angles_y;
+ self.angles_y = input_angles.y;
}
// relink
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)
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);
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);
{
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)
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;
}
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);
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);
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);
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);
}
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);
}
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);
}
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);
}
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;
}
//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)
{
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;
}
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;
}
// 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;
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));
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;
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)
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)
}
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)
{
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;
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;
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);
}
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)
{
{
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));
}
}
}
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;
}
}
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)
{
}
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;
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).
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;
}
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;
}
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;
}
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?
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
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;
}
{
// 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;
}
{
// 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;
}
{
// 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;
{
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;
}
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;
}
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;
}
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;
}
// 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;
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)
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;
}
// 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);
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
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)
{
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
}
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);
else
{
me.pressed = 1;
- me.pressOffset = pos_y;
+ me.pressOffset = pos.y;
me.previousValue = me.scrollPos;
}
}
// 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;
}
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)
{
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?
{
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();
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
// 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);
{
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;
}
}
// 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;
}
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);
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)
{
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);
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)
{
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);
}
{
// 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;
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)
{
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);
}
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;
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
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;
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;
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;
}
}
}
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
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);
}
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;
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)
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;
{
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;
{
me.mouseMove(me, coords);
- if(me.focusedCell_x >= 0)
+ if(me.focusedCell.x >= 0)
{
me.pressed = 1;
me.previouslyFocusedCell = me.focusedCell;
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) == "")
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);
{
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);
}
}
// 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;
}
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;
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)));
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);
{
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)
{
}
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);
{
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);
}
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)
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;
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)
{
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) != "$");
}
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) == "$")
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;
{
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;
}
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;
}
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
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));
}
}
{
// 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)
{
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)
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)
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)
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
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)
{
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)
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;
{
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);
// 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)
{
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)
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")
{
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
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)
// 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");
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;
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");
}
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");
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)
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
}
{
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;
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/";
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);
{
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)
{
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;
}
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;
//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
}
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
// 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));
// 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)
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
//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);
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)
// 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)
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;
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))
if(!cvar("sv_pogostick"))
if((self.flags & FL_ONGROUND) == 0)
{
- if(self.velocity_z < 0 || vlen(self.velocity)<maxspeed)
+ if(self.velocity.z < 0 || vlen(self.velocity)<maxspeed)
self.BUTTON_JUMP = FALSE;
// Strafe
if(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;
}
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
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;
// 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;
// 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;
}
else
{
- if(self.velocity_z>0)
+ if(self.velocity.z>0)
{
float threshold, sxy;
vector velxy = self.velocity; velxy_z = 0;
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;
}
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)
{
}
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;
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;
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);
}
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
{
// 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);
// 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';
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)
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;
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;
}
}
{
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);
}
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;
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;
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;
{
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;
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);
// 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;
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)
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;
}
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;
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;
}
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;
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
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()
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();
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
{
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");
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");
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;
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
{
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
}
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;
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;
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 = "";
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;
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;
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);
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
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;
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 != "")
// 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;
}
}
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;
// 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);
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)
{
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)
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)
{
{
// 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;
}
}
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;
}
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
);
}
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
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;
#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
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);
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;
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;
}
}
- self.velocity = vel_xy + vel_z * '0 0 1';
+ self.velocity = vel_xy + velZ * '0 0 1';
}
void PM_AirAccelerate(vector wishdir, float wishspeed)
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";
{
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';
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;
}
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;
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);
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
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")
{
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
{
{
//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
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;
//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);
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))
{
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);
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);
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;
// 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
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))
{
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;
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)
{
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
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);
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;
{
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;
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;
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;
}
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);
// 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))
{
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);
}
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;
{
// 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");
}
}
{
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;
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"));
}
}
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));
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");
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);
}
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)
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;
{
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
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;
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;
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);
}
{
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;
}
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;
{
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;
}
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)
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;
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));
}
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;
}
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)
}
}
- 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)
// 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;
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);
}
}
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);
}
}
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 != "")
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));
}
}
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)
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;
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;
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)
}
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;
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);
// 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
{
// 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
}
// 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"
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
}
}
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;
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));
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))
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.
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))
{
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))
{
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
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)
{
{
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;
{
// 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;
}
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);
}
/*
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))
}
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)
{
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
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);
{
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);
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)
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)
else
{
a = vectoangles(self.enemy.origin - self.origin);
- a_x = -a_x;
+ a_x = -a.x;
if(a != self.mangle)
{
self.mangle = a;
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)
{
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)
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;
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;
}
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)
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)
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));
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)
{
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
{
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;
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)
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;
// 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;
}
// 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
break;
case 4: // left
- vecs_y = -vecs_y;
+ vecs_y = -vecs.y;
break;
case 1:
{
// center
vecs_y = 0;
- vecs_z -= 2;
+ vecs.z -= 2;
}
else
{
{
// center
vecs_y = 0;
- vecs_z -= 2;
+ vecs.z -= 2;
}
else
{
// left
- vecs_y = -vecs_y;
+ vecs_y = -vecs.y;
}
break;
}
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
{
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)
{
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);
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);
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;
}
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;
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);
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");
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
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);
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();
// 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;
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;
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;
#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;
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;
{
#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
}
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;
}
}
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;
}
}
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)
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;
}
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)
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);
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)
{
// 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;
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;
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;
}
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;
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;
.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.
// 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;
}
// 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);
&& 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) {
}
}
- 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;
}
}
- 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;
}
}
- 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;
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;
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;
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;
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;
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)
{
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;
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;
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)
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;
}
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");
{
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);
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;
{
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;
}
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;
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;
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;
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);
{
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)
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;
//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;
//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;
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;
//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;
//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;
{
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);
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);
//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;
//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;
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;
//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;
{
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;
{
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);
//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");
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;
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;
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;
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);
{
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)
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);
}
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");
{
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;
}
++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)
{
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;
}
// 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");
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...
//
// 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
}
#ifndef POSITIVE_PITCH_IS_DOWN
- ang_x = -ang_x;
+ ang_x = -ang.x;
#endif
- ang_z = vangle_z;
+ ang_z = vangle.z;
return ang;
}
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
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;
/*
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...
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;
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;
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;
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;
{
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;
if (result_x == 0 && strict)
result_x = t1.team - t2.team;
- return result_x;
+ return result.x;
}
/*
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()
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;
}
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)) )
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)
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;
}
}
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;
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;
}
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;
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);
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)
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))
{
//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)
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;
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');
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)
{
// 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
// 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;
// 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)
{
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;
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();
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);
// 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;
// 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;
}
}
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();
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;
}
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;
}
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;
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
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) \
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;
}
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;
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);
if(valueoffset != "")
{
- switch(data_y)
+ switch(data.y)
{
case FIELD_STRING:
value = strcat(value, valueoffset);
if(valueoffsetrandom != "")
{
- switch(data_y)
+ switch(data.y)
{
case FIELD_FLOAT:
value = ftos(stof(value) + random() * stof(valueoffsetrandom));
{
if(data_y == FIELD_VECTOR)
value = strreplace("'", "", value); // why?!?
- putentityfieldstring(data_x, e, value);
+ putentityfieldstring(data.x, e, value);
}
}
}
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;
// 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;
}
{
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)
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);
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;
}
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;
}
// 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;
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;
// 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;
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;
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;
}
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.
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;
}
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;
}
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);
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();
}
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)
{
}
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);
}
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);
float vz;
real_angle = vectoangles(self.steerto) - self.angles;
- vz = self.velocity_z;
+ vz = self.velocity.z;
switch (self.animflag)
{
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;
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;
}
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;
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);
}
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;
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;
}
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)
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;
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);
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);
// 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;
}
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)
{
}
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;
// 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;
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)
{
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);
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()
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';
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)
{
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');
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;
}
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)
{
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;
}
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');
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)
{
// 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
// 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;
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);
// 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);
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)
{
//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;
}
}
- 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)
{
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;
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()
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;
}
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
}
}
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);
}
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;
}
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)
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)))
{
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);
}
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
}
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;
}
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"));
}
}
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,
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);
error("Unowned missile");
dir = dir + upDir * (pUpSpeed / pSpeed);
- dir_z += pZSpeed / pSpeed;
+ dir.z += pZSpeed / pSpeed;
pSpeed *= vlen(dir);
dir = normalize(dir);
// 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;
{
//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");
self.view_ofs = '0 0 0';
- if(self.movedir_x >= 0)
+ if(self.movedir.x >= 0)
{
vector v0;
v0 = self.movedir;
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)
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);
}
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);
{
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
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)
// 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);
}
// 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
// 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;
}
{
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;
}
// 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;
}
}
#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)
}
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)
}
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)
}
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
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)
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);
{
#ifdef KEEP_ROLL
float roll;
- roll = ang_z;
+ roll = ang.z;
ang_z = 0;
#endif
{
float roll;
- roll = ang_z;
+ roll = ang.z;
ang_z = 0;
ang = AnglesTransform_ApplyToVAngles(AnglesTransform_Invert(wz.warpzone_transform), 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;
}
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)
// 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;
}
{
vector v;
v = lgamma(x);
- return exp(v_x) * v_y;
+ return exp(v.x) * v.y;
}
float nearbyint(float x)
vector v;
v_z = 0;
v_y = rint(x / y);
- v_x = x - y * v_y;
+ v_x = x - y * v.y;
return v;
}
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;
}
// 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)
{
// 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)
{
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);
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)
{
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");
{
#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);