X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmutators%2Fmutator%2Fwaypoints%2Fwaypointsprites.qc;h=9e20392236ea32ccb73948c1a5707d93c304f1df;hb=19e5fa4ee9a0bb59c1cec92a1b0501b14f8ccb63;hp=638edfbff25aac5aaed0d6b44ce59da6a936809d;hpb=983fffdaf97ec2d7299643b14a87c754bb94107f;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc index 638edfbff..9e2039223 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc @@ -1,7 +1,5 @@ #include "waypointsprites.qh" -#ifdef IMPLEMENTATION - REGISTER_MUTATOR(waypointsprites, true); REGISTER_NET_LINKED(waypointsprites) @@ -18,10 +16,12 @@ bool WaypointSprite_SendEntity(entity this, entity to, float sendflags) sendflags |= 0x80; int f = 0; - if(this.currentammo) + if(this.currentammo == 1) f |= 1; // hideable if(this.exteriormodeltoclient == to) f |= 2; // my own + if(this.currentammo == 2) + f |= 2; // radar only MUTATOR_CALLHOOK(SendWaypoint, this, to, sendflags, f); sendflags = M_ARGV(2, int); @@ -259,9 +259,9 @@ string spritelookuptext(entity this, string s) } // need to loop, as our netname could be one of three - FOREACH(Waypoints, it.netname == s, LAMBDA( + FOREACH(Waypoints, it.netname == s, { return it.m_name; - )); + }); return s; } @@ -282,10 +282,10 @@ void drawrotpic(vector org, float rot, string pic, vector sz, vector hotspot, ve // rotate them, and make them absolute rot = -rot; // rotate by the opposite angle, as our coordinate system is reversed - v1 = rotate(v1, rot) + org; - v2 = rotate(v2, rot) + org; - v3 = rotate(v3, rot) + org; - v4 = rotate(v4, rot) + org; + v1 = Rotate(v1, rot) + org; + v2 = Rotate(v2, rot) + org; + v3 = Rotate(v3, rot) + org; + v4 = Rotate(v4, rot) + org; // draw them R_BeginPolygon(pic, f); @@ -319,9 +319,9 @@ void drawhealthbar(vector org, float rot, float h, vector sz, vector hotspot, fl up = '0 1 0'; rot = -rot; // rotate by the opposite angle, as our coordinate system is reversed - o = rotate(o, rot) + org; - ri = rotate(ri, rot); - up = rotate(up, rot); + o = Rotate(o, rot) + org; + ri = Rotate(ri, rot); + up = Rotate(up, rot); owidth = width + 2 * border; o = o - up * (margin + border + theheight) + ri * (sz.x - owidth) * 0.5; @@ -348,19 +348,19 @@ vector drawspritearrow(vector o, float ang, vector rgb, float a, float t) R_BeginPolygon("", DRAWFLAG_NORMAL); R_PolygonVertex(o, '0 0 0', '0 0 0', a); - R_PolygonVertex(o + rotate(arrowY - borderX, ang), '0 0 0', '0 0 0', a); - R_PolygonVertex(o + rotate(borderY - borderX, ang), '0 0 0', '0 0 0', a); - R_PolygonVertex(o + rotate(borderY + borderX, ang), '0 0 0', '0 0 0', a); - R_PolygonVertex(o + rotate(arrowY + borderX, ang), '0 0 0', '0 0 0', a); + R_PolygonVertex(o + Rotate(arrowY - borderX, ang), '0 0 0', '0 0 0', a); + R_PolygonVertex(o + Rotate(borderY - borderX, ang), '0 0 0', '0 0 0', a); + R_PolygonVertex(o + Rotate(borderY + borderX, ang), '0 0 0', '0 0 0', a); + R_PolygonVertex(o + Rotate(arrowY + borderX, ang), '0 0 0', '0 0 0', a); R_EndPolygon(); R_BeginPolygon("", DRAWFLAG_ADDITIVE); - R_PolygonVertex(o + rotate(eY * borderDiag, ang), '0 0 0', rgb, a); - R_PolygonVertex(o + rotate(arrowY - arrowX, ang), '0 0 0', rgb, a); - R_PolygonVertex(o + rotate(arrowY + arrowX, ang), '0 0 0', rgb, a); + R_PolygonVertex(o + Rotate(eY * borderDiag, ang), '0 0 0', rgb, a); + R_PolygonVertex(o + Rotate(arrowY - arrowX, ang), '0 0 0', rgb, a); + R_PolygonVertex(o + Rotate(arrowY + arrowX, ang), '0 0 0', rgb, a); R_EndPolygon(); - return o + rotate(eY * (borderDiag+size+margin), ang); + return o + Rotate(eY * (borderDiag+size+margin), ang); } // returns location of sprite healthbar @@ -460,9 +460,7 @@ vector fixrgbexcess(vector rgb) void Draw_WaypointSprite(entity this) { if (this.lifetime > 0) - this.alpha = pow(bound(0, (this.fadetime - time) / this.lifetime, 1), waypointsprite_timealphaexponent); - else if (this.lifetime < 0) - this.alpha = (time < this.fadetime) ? 1 : 0; // no fading out effect + this.alpha = (bound(0, (this.fadetime - time) / this.lifetime, 1) ** waypointsprite_timealphaexponent); else this.alpha = 1; @@ -472,14 +470,12 @@ void Draw_WaypointSprite(entity this) if (autocvar_cl_hidewaypoints >= 2) return; - if (this.hideflags & 1) - if (autocvar_cl_hidewaypoints) - return; // fixed waypoint + if (this.hideflags & 1 && autocvar_cl_hidewaypoints) + return; // fixed waypoint InterpolateOrigin_Do(this); float t = entcs_GetTeam(player_localnum) + 1; - string spriteimage = ""; // choose the sprite @@ -522,16 +518,13 @@ void Draw_WaypointSprite(entity this) ++waypointsprite_newcount; - float dist; - dist = vlen(this.origin - view_origin); - - float a; - a = this.alpha * autocvar_hud_panel_fg_alpha; + float dist = vlen(this.origin - view_origin); + float a = this.alpha * autocvar_hud_panel_fg_alpha; if (this.maxdistance > waypointsprite_normdistance) - a *= pow(bound(0, (this.maxdistance - dist) / (this.maxdistance - waypointsprite_normdistance), 1), waypointsprite_distancealphaexponent); + a *= (bound(0, (this.maxdistance - dist) / (this.maxdistance - waypointsprite_normdistance), 1) ** waypointsprite_distancealphaexponent); else if (this.maxdistance > 0) - a *= pow(bound(0, (waypointsprite_fadedistance - dist) / (waypointsprite_fadedistance - waypointsprite_normdistance), 1), waypointsprite_distancealphaexponent) * (1 - waypointsprite_minalpha) + waypointsprite_minalpha; + a *= (bound(0, (waypointsprite_fadedistance - dist) / (waypointsprite_fadedistance - waypointsprite_normdistance), 1) ** waypointsprite_distancealphaexponent) * (1 - waypointsprite_minalpha) + waypointsprite_minalpha; vector rgb = spritelookupcolor(this, spriteimage, this.teamradar_color); if (rgb == '0 0 0') @@ -618,11 +611,9 @@ void Draw_WaypointSprite(entity this) (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); + float crosshairdistance = sqrt( ((o.x - vid_conwidth/2) ** 2) + ((o.y - vid_conheight/2) ** 2) ); - float crosshairdistance = sqrt( pow(o.x - vid_conwidth/2, 2) + pow(o.y - vid_conheight/2, 2) ); - - t = waypointsprite_scale * vidscale; + t = waypointsprite_scale; a *= waypointsprite_alpha; { @@ -870,8 +861,7 @@ void WaypointSprite_FadeOutIn(entity e, float t) // ensure: // (e.teleport_time - time) / wp.fade_time stays // e.teleport_time = time + fadetime - float current_fadetime; - current_fadetime = e.teleport_time - time; + float current_fadetime = e.teleport_time - time; e.teleport_time = time + t; if (e.fade_time < 0) e.fade_time = -e.fade_time; @@ -1155,4 +1145,3 @@ void WaypointSprite_PlayerGone(entity this) WaypointSprite_DetachCarrier(this); } #endif -#endif