X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fclient%2Fwaypointsprites.qc;h=c174d7656af19b8209faedbc05d5162d10b6751f;hp=39b60a66b0c767d1342bec2dcb5e8645d6cd332a;hb=ee3543c1c14ffc6cd14b6dbd07d76d4cb65e3bd6;hpb=0f6085c8ea46125d87ca81ec7f5e82f73c08f958 diff --git a/qcsrc/client/waypointsprites.qc b/qcsrc/client/waypointsprites.qc index 39b60a66b..c174d7656 100644 --- a/qcsrc/client/waypointsprites.qc +++ b/qcsrc/client/waypointsprites.qc @@ -38,14 +38,14 @@ float waypointsprite_alpha; .float build_starthealth; .float build_finished; -float SPRITE_HEALTHBAR_WIDTH = 144; -float SPRITE_HEALTHBAR_HEIGHT = 9; -float SPRITE_HEALTHBAR_MARGIN = 6; -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; +const float SPRITE_HEALTHBAR_WIDTH = 144; +const float SPRITE_HEALTHBAR_HEIGHT = 9; +const float SPRITE_HEALTHBAR_MARGIN = 6; +const float SPRITE_HEALTHBAR_BORDER = 2; +const float SPRITE_HEALTHBAR_BORDERALPHA = 1; +const float SPRITE_HEALTHBAR_HEALTHALPHA = 0.5; +const float SPRITE_ARROW_SCALE = 1.0; +const float SPRITE_HELPME_BLINK = 2; void drawrotpic(vector org, float rot, string pic, vector sz, vector hotspot, vector rgb, float a, float f) { @@ -96,7 +96,7 @@ void drawhealthbar(vector org, float rot, float h, vector sz, vector hotspot, fl o = hotspot; ri = '1 0 0'; 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); @@ -225,30 +225,20 @@ float spritelookupblinkvalue(string s) } vector spritelookupcolor(string s, vector def) { + if(substring(s, 0, 4) == "wpn-") + return (get_weaponinfo(stof(substring(s, 4, strlen(s)))).wpcolor); + 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; } } string spritelookuptext(string s) { + if(substring(s, 0, 4) == "wpn-") + return (get_weaponinfo(stof(substring(s, 4, strlen(s)))).message); + switch(s) { case "as-push": return _("Push"); @@ -288,22 +278,6 @@ string spritelookuptext(string s) case "nb-ball": return _("Ball"); case "ka-ball": return _("Ball"); case "ka-ballcarrier": return _("Ball carrier"); - case "wpn-laser": return _("Laser"); - case "wpn-shotgun": return _("Shotgun"); - case "wpn-uzi": return _("Machine Gun"); - case "wpn-gl": return _("Mortar"); - case "wpn-electro": return _("Electro"); - case "wpn-crylink": return _("Crylink"); - case "wpn-nex": return _("Nex"); - case "wpn-hagar": return _("Hagar"); - case "wpn-rl": return _("Rocket Launcher"); - case "wpn-porto": return _("Port-O-Launch"); - case "wpn-minstanex": return _("Minstanex"); - case "wpn-hookgun": return _("Hook"); - case "wpn-fireball": return _("Fireball"); - case "wpn-hlac": return _("HLAC"); - case "wpn-campingrifle": return _("Rifle"); - case "wpn-minelayer": return _("Mine Layer"); case "dom-neut": return _("Control point"); case "dom-red": return _("Control point"); case "dom-blue": return _("Control point"); @@ -423,7 +397,7 @@ void Draw_WaypointSprite() spriteimage = self.netname; break; case SPRITERULE_TEAMPLAY: - if(t == COLOR_SPECTATOR + 1) + if(t == NUM_SPECTATOR + 1) spriteimage = self.netname3; else if(self.team == t) spriteimage = self.netname2; @@ -439,10 +413,10 @@ void Draw_WaypointSprite() return; ++waypointsprite_newcount; - + float dist; dist = vlen(self.origin - view_origin); - + float a; a = self.alpha * autocvar_hud_panel_fg_alpha; @@ -457,7 +431,7 @@ void Draw_WaypointSprite() 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)); + printf("WARNING: sprite of name %s has no color, using pink so you notice it\n", spriteimage); } if(time - floor(time) > 0.5) @@ -483,10 +457,10 @@ void Draw_WaypointSprite() float ang; o = project_3d_to_2d(self.origin); - if(o_z < 0 - || o_x < (vid_conwidth * waypointsprite_edgeoffset_left) - || o_y < (vid_conheight * waypointsprite_edgeoffset_top) - || o_x > (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) + 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 @@ -543,9 +517,9 @@ void Draw_WaypointSprite() o_z = 0; float edgedistance_min, crosshairdistance; - edgedistance_min = min((o_y - (vid_conheight * waypointsprite_edgeoffset_top)), + 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_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) - o_x, (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)) - o_y); float vidscale; @@ -585,7 +559,7 @@ void Draw_WaypointSprite() } o = drawspritearrow(o, ang, rgb, a, SPRITE_ARROW_SCALE * t); - + string txt; if(autocvar_g_waypointsprite_spam && waypointsprite_count >= autocvar_g_waypointsprite_spam) txt = _("Spam"); @@ -656,6 +630,7 @@ void Ent_WaypointSprite() self.draw2d = Draw_WaypointSprite; InterpolateOrigin_Undo(); + self.iflags |= IFLAG_ORIGIN; if(sendflags & 0x80) {