X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fwaypointsprites.qc;h=78ddc8b793c22f4b080100ace1df2a94538979be;hb=c6c371883dde697e1f237d498c08e09788b6af6b;hp=3b5deca87134d8a4438e54a33fd76938a0bd0d05;hpb=0e5d97682e9478c51d8033a3ab9624471da0579d;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/waypointsprites.qc b/qcsrc/client/waypointsprites.qc index 3b5deca87..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) { @@ -210,7 +216,7 @@ 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; @@ -222,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; } } @@ -261,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"); @@ -357,6 +380,7 @@ vector fixrgbexcess(vector rgb) return rgb; } +float waypointsprite_count, waypointsprite_newcount; void Draw_WaypointSprite() { string spriteimage; @@ -379,7 +403,7 @@ void Draw_WaypointSprite() InterpolateOrigin_Do(); - t = GetPlayerColor(player_localentnum - 1) + 1; + t = GetPlayerColor(player_localnum) + 1; spriteimage = ""; @@ -412,6 +436,8 @@ void Draw_WaypointSprite() if(spriteimage == "") return; + + ++waypointsprite_newcount; float dist; dist = vlen(self.origin - view_origin); @@ -434,7 +460,12 @@ void Draw_WaypointSprite() } 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) { @@ -451,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; @@ -470,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 @@ -483,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); } } @@ -507,7 +542,10 @@ void Draw_WaypointSprite() 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); @@ -548,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); @@ -691,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(); @@ -734,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; @@ -748,4 +798,7 @@ void WaypointSprite_Load() WaypointSprite_Load_Frames(".jpg"); waypointsprite_initialized = true; } + + waypointsprite_count = waypointsprite_newcount; + waypointsprite_newcount = 0; }