X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fwaypointsprites.qc;h=78ddc8b793c22f4b080100ace1df2a94538979be;hb=4d2ad369ac78aceff6427b547d47b8d9f1d88c69;hp=12e8b954321b9a817a8265b6ef8ad6aa901b7d4e;hpb=e66324147613c5838abc85b951def3388df27e0f;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/waypointsprites.qc b/qcsrc/client/waypointsprites.qc index 12e8b9543..78ddc8b79 100644 --- a/qcsrc/client/waypointsprites.qc +++ b/qcsrc/client/waypointsprites.qc @@ -10,6 +10,10 @@ float waypointsprite_fontsize; float waypointsprite_edgefadealpha; float waypointsprite_edgefadescale; float waypointsprite_edgefadedistance; +float waypointsprite_edgeoffset_bottom; +float waypointsprite_edgeoffset_left; +float waypointsprite_edgeoffset_right; +float waypointsprite_edgeoffset_top; float waypointsprite_crosshairfadealpha; float waypointsprite_crosshairfadescale; float waypointsprite_crosshairfadedistance; @@ -18,6 +22,7 @@ float waypointsprite_distancefadescale; float waypointsprite_distancefadedistance; float waypointsprite_alpha; +.float helpme; .float rule; .string netname; // primary picture .string netname2; // secondary picture @@ -40,6 +45,7 @@ float SPRITE_HEALTHBAR_BORDER = 2; float SPRITE_HEALTHBAR_BORDERALPHA = 1; float SPRITE_HEALTHBAR_HEALTHALPHA = 0.5; float SPRITE_ARROW_SCALE = 1.0; +float SPRITE_HELPME_BLINK = 2; void drawrotpic(vector org, float rot, string pic, vector sz, vector hotspot, vector rgb, float a, float f) { @@ -114,6 +120,7 @@ vector drawspritearrow(vector o, float ang, vector rgb, float a, float t) float TSIZE; TSIZE = 8 * t; float RLENGTH; RLENGTH = 8 * t; float RWIDTH; RWIDTH = 4 * t; + float MLENGTH; MLENGTH = 4 * t; R_BeginPolygon("", DRAWFLAG_NORMAL); R_PolygonVertex(o + rotate(eX * -(TSIZE + BORDER * (1 + SQRT2)) + eY * (TSIZE + BORDER), ang), '0 0 0', '0 0 0', a); @@ -140,7 +147,7 @@ vector drawspritearrow(vector o, float ang, vector rgb, float a, float t) R_EndPolygon(); return - o + rotate('0 20 0'*t, ang); + o + rotate(eY * (TSIZE + RLENGTH + MLENGTH), ang); } // returns location of sprite healthbar @@ -209,9 +216,10 @@ float spritelookupblinkvalue(string s) case "item-extralife": return 2; case "item-speed": return 2; case "item-strength": return 2; - case "item-shueld": return 2; + case "item-shield": return 2; case "item-fuelregen": return 2; case "item-jetpack": return 2; + case "tagged-target": return 2; default: return 1; } } @@ -220,6 +228,22 @@ vector spritelookupcolor(string s, vector def) switch(s) { case "keycarrier-friend": return '0 1 0'; + case "wpn-laser": return '1 0.5 0.5'; + case "wpn-shotgun": return '0.5 0.25 0'; + case "wpn-uzi": return '1 1 0'; + case "wpn-gl": return '1 0 0'; + case "wpn-electro": return '0 0.5 1'; + case "wpn-crylink": return '1 0.5 1'; + case "wpn-nex": return '0.5 1 1'; + case "wpn-hagar": return '1 1 0.5'; + case "wpn-rl": return '1 1 0'; + case "wpn-porto": return '0.5 0.5 0.5'; + case "wpn-minstanex": return '0.5 1 1'; + case "wpn-hookgun": return '0 0.5 0'; + case "wpn-fireball": return '1 0.5 0'; + case "wpn-hlac": return '0 1 0'; + case "wpn-campingrifle": return '0.5 1 0'; + case "wpn-minelayer": return '0.75 1 0'; default: return def; } } @@ -259,6 +283,7 @@ string spritelookuptext(string s) case "race-checkpoint": return _("Checkpoint"); case "race-finish": return _("Finish"); case "race-start": return _("Start"); + case "race-start-finish": return (race_checkpointtime || race_mycheckpointtime) ? _("Finish") : _("Start"); case "nb-ball": return _("Ball"); case "ka-ball": return _("Ball"); case "ka-ballcarrier": return _("Ball carrier"); @@ -292,6 +317,7 @@ string spritelookuptext(string s) case "item-jetpack": return _("Jet Pack"); case "freezetag_frozen": return _("Frozen!"); case "tagged-target": return _("Tagged"); + case "vehicle": return _("Vehicle"); default: return s; } } @@ -354,6 +380,7 @@ vector fixrgbexcess(vector rgb) return rgb; } +float waypointsprite_count, waypointsprite_newcount; void Draw_WaypointSprite() { string spriteimage; @@ -376,7 +403,7 @@ void Draw_WaypointSprite() InterpolateOrigin_Do(); - t = GetPlayerColor(player_localentnum - 1) + 1; + t = GetPlayerColor(player_localnum) + 1; spriteimage = ""; @@ -409,6 +436,8 @@ void Draw_WaypointSprite() if(spriteimage == "") return; + + ++waypointsprite_newcount; float dist; dist = vlen(self.origin - view_origin); @@ -424,9 +453,19 @@ void Draw_WaypointSprite() vector rgb; rgb = self.teamradar_color; rgb = spritelookupcolor(spriteimage, rgb); + if(rgb == '0 0 0') + { + self.teamradar_color = '1 0 1'; + print(sprintf("WARNING: sprite of name %s has no color, using pink so you notice it\n", spriteimage)); + } if(time - floor(time) > 0.5) - a *= spritelookupblinkvalue(spriteimage); + { + if(self.helpme && time < self.helpme) + a *= SPRITE_HELPME_BLINK; + else + a *= spritelookupblinkvalue(spriteimage); + } if(a > 1) { @@ -443,7 +482,11 @@ void Draw_WaypointSprite() float ang; o = project_3d_to_2d(self.origin); - if(o_z < 0 || o_x < 0 || o_y < 0 || o_x > vid_conwidth || o_y > vid_conheight) + 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; @@ -462,12 +505,12 @@ void Draw_WaypointSprite() if(d_z * f1 > 0) { // RIGHT edge - d = d * (0.5 / f1); + d = d * ((0.5 - waypointsprite_edgeoffset_right) / f1); } else { // LEFT edge - d = d * (-0.5 / f1); + d = d * (-(0.5 - waypointsprite_edgeoffset_left) / f1); } } else @@ -475,12 +518,12 @@ void Draw_WaypointSprite() if(d_z * f2 > 0) { // BOTTOM edge - d = d * (0.5 / f2); + d = d * ((0.5 - waypointsprite_edgeoffset_bottom) / f2); } else { // TOP edge - d = d * (-0.5 / f2); + d = d * (-(0.5 - waypointsprite_edgeoffset_top) / f2); } } @@ -488,12 +531,21 @@ void Draw_WaypointSprite() } else { +#if 1 ang = M_PI; +#else + vector d; + d = o - '0.5 0 0' * vid_conwidth - '0 0.5 0' * vid_conheight; + ang = atan2(-d_x, -d_y); +#endif } o_z = 0; float edgedistance_min, crosshairdistance; - edgedistance_min = min4(o_y, o_x,vid_conwidth - o_x, vid_conheight - 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); @@ -534,7 +586,12 @@ void Draw_WaypointSprite() o = drawspritearrow(o, ang, rgb, a, SPRITE_ARROW_SCALE * t); string txt; - txt = spritelookuptext(spriteimage); + if(autocvar_g_waypointsprite_spam && waypointsprite_count >= autocvar_g_waypointsprite_spam) + txt = _("Spam"); + else + txt = spritelookuptext(spriteimage); + if(self.helpme && time < self.helpme) + txt = sprintf(_("%s needing help!"), txt); if(autocvar_g_waypointsprite_uppercase) txt = strtoupper(txt); @@ -677,6 +734,9 @@ void Ent_WaypointSprite() self.teamradar_color_x = ReadByte() / 255.0; self.teamradar_color_y = ReadByte() / 255.0; self.teamradar_color_z = ReadByte() / 255.0; + self.helpme = ReadByte() * 0.1; + if(self.helpme > 0) + self.helpme += servertime; } InterpolateOrigin_Note(); @@ -720,6 +780,10 @@ void WaypointSprite_Load() waypointsprite_edgefadealpha = autocvar_g_waypointsprite_edgefadealpha; waypointsprite_edgefadescale = autocvar_g_waypointsprite_edgefadescale; waypointsprite_edgefadedistance = autocvar_g_waypointsprite_edgefadedistance; + waypointsprite_edgeoffset_bottom = autocvar_g_waypointsprite_edgeoffset_bottom; + waypointsprite_edgeoffset_left = autocvar_g_waypointsprite_edgeoffset_left; + waypointsprite_edgeoffset_right = autocvar_g_waypointsprite_edgeoffset_right; + waypointsprite_edgeoffset_top = autocvar_g_waypointsprite_edgeoffset_top; waypointsprite_crosshairfadealpha = autocvar_g_waypointsprite_crosshairfadealpha; waypointsprite_crosshairfadescale = autocvar_g_waypointsprite_crosshairfadescale; waypointsprite_crosshairfadedistance = autocvar_g_waypointsprite_crosshairfadedistance; @@ -734,4 +798,7 @@ void WaypointSprite_Load() WaypointSprite_Load_Frames(".jpg"); waypointsprite_initialized = true; } + + waypointsprite_count = waypointsprite_newcount; + waypointsprite_newcount = 0; }