]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
ctf flags on hud notify panel :)
authorFruitieX <rasse@rasse-lappy.localdomain>
Tue, 8 Jun 2010 16:12:30 +0000 (19:12 +0300)
committerFruitieX <rasse@rasse-lappy.localdomain>
Tue, 8 Jun 2010 16:12:30 +0000 (19:12 +0300)
qcsrc/client/hud.qc
qcsrc/common/constants.qh
qcsrc/server/ctf.qc

index df420d884a8601ab68847b9fb44b5c105dac4617..96af1bfbca8fe44cb18eecfeb93826cb3bbb3643 100644 (file)
@@ -2257,14 +2257,29 @@ void HUD_KillNotify(string s1, string s2, string s3, float type, float msg)
                                print ("^1",s1, "^1 needs a restart\n");
                        else
                                print ("^1",s1, "^1 died\n");
-       }
+               }
        } else if(msg == MSG_KILL_ACTION_SPREE) {
                HUD_KillNotify_Push(s1, "", DEATH_KILL);
                if(cvar("cl_gentle"))
                        print ("^1",s1,"^1 needs a restart after a ",s2," scoring spree\n");
                else
                        print ("^1",s1,"^1 died with a ",s2," kill spree\n");
+       } else if(msg == MSG_INFO) {
+               if(type == INFO_GOTFLAG) {
+                       HUD_KillNotify_Push(s1, s2, INFO_GOTFLAG);
+                       print(s1, "^7 got the ", s2, "\n");
+               } else if(type == INFO_LOSTFLAG) {
+                       HUD_KillNotify_Push(s1, s2, INFO_LOSTFLAG);
+                       print(s1, "^7 lost the ", s2, "\n");
+               } else if(type == INFO_PICKUPFLAG) {
+                       HUD_KillNotify_Push(s1, s2, INFO_GOTFLAG);
+                       print(s1, "^7 picked up the ", s2, "\n");
+               } else if(type == INFO_RETURNFLAG) {
+                       HUD_KillNotify_Push(s1, s2, INFO_RETURNFLAG);
+                       print(s1, "^7 returned the ", s2, "\n");
+               }
        }
+
 }
 
 #define DAMAGE_CENTERPRINT_SPACER NEWLINES
@@ -2383,25 +2398,60 @@ void HUD_Notify (void)
        float fadetime;
        fadetime = 2;
 
+       string s;
+
        float i;
        for(i = 0; i <= entries; ++i)
        {
                a = bound(0, when + (fadetime - (time - killnotify_times[i]))/fadetime, 1);
-               drawcolorcodedstring(pos + eY * 0.33 * height + eY * i * height, textShortenToWidth(killnotify_attackers[i], 0.5 * mySize_x - height, fontsize, stringwidth_colors), fontsize, hud_alpha_fg * a, DRAWFLAG_NORMAL);
-               drawcolorcodedstring(pos + eY * 0.33 * height + eX * 0.5 * mySize_x + eX * height + eY * i * height, textShortenToWidth(killnotify_victims[i], 0.5 * mySize_x - height, fontsize, stringwidth_colors), fontsize, hud_alpha_fg * a, DRAWFLAG_NORMAL);
                
+               // X [did action to] Y
                if(WEP_VALID(killnotify_deathtype[i]))
                {
                        self = get_weaponinfo(killnotify_deathtype[i]);
-                       drawpic_skin(pos + eX * 0.5 * mySize_x - eX * (mySize_y/entries) + eY * i * (mySize_y/entries), strcat("weapon", self.netname), '2 1 0' * (mySize_y/entries), '1 1 1', hud_alpha_fg * a, DRAWFLAG_NORMAL);
+                       drawpic_skin(pos + eX * 0.5 * mySize_x - eX * 0.5 * height + eY * 0.25 * height + eY * i * height, strcat("weapon", self.netname), '1 0.5 0' * height, '1 1 1', hud_alpha_fg * a, DRAWFLAG_NORMAL);
+                       drawcolorcodedstring(pos + eY * 0.33 * height + eY * i * height, textShortenToWidth(killnotify_attackers[i], 0.5 * mySize_x - 0.5 * height, fontsize, stringwidth_colors), fontsize, hud_alpha_fg * a, DRAWFLAG_NORMAL);
+                       drawcolorcodedstring(pos + eY * 0.33 * height + eX * 0.5 * mySize_x + eX * 0.5 * height + eY * i * height, textShortenToWidth(killnotify_victims[i], 0.5 * mySize_x - 0.5 * height, fontsize, stringwidth_colors), fontsize, hud_alpha_fg * a, DRAWFLAG_NORMAL);
+               }
+               else if(killnotify_deathtype[i] == DEATH_FALL)
+               {
+                       drawpic_skin(pos + eX * 0.5 * mySize_x - eX * 0.5 * height + eY * 0.25 * height + eY * i * height, "notify_pushoffedge", '1 0.5 0' * height, '1 1 1', hud_alpha_fg * a, DRAWFLAG_NORMAL);       
+                       drawcolorcodedstring(pos + eY * 0.33 * height + eY * i * height, textShortenToWidth(killnotify_attackers[i], 0.5 * mySize_x - 0.5 * height, fontsize, stringwidth_colors), fontsize, hud_alpha_fg * a, DRAWFLAG_NORMAL);
+                       drawcolorcodedstring(pos + eY * 0.33 * height + eX * 0.5 * mySize_x + eX * 0.5 * height + eY * i * height, textShortenToWidth(killnotify_victims[i], 0.5 * mySize_x - 0.5 * height, fontsize, stringwidth_colors), fontsize, hud_alpha_fg * a, DRAWFLAG_NORMAL);
                }
+
+               // Y [used by] X
                else if(killnotify_deathtype[i] == DEATH_KILL)
                {
-                       drawpic_skin(pos + eX * 0.5 * mySize_x - eX * (mySize_y/entries) + eY * i * (mySize_y/entries), "notify_selfkill", '2 1 0' * (mySize_y/entries), '1 1 1', hud_alpha_fg * a, DRAWFLAG_NORMAL);   
+                       drawpic_skin(pos + eY * 0.25 * height + eY * i * height, "notify_selfkill", '1 0.5 0' * height, '1 1 1', hud_alpha_fg * a, DRAWFLAG_NORMAL);    
+                       drawcolorcodedstring(pos + eX * height + eY * 0.33 * height + eY * i * height, textShortenToWidth(killnotify_attackers[i], mySize_x - height, fontsize, stringwidth_colors), fontsize, hud_alpha_fg * a, DRAWFLAG_NORMAL);
                }
-               else if(killnotify_deathtype[i] == DEATH_FALL)
+               else if(killnotify_deathtype[i] == INFO_GOTFLAG)
+               {
+                       if(killnotify_victims[i] == "^1RED^7 flag")
+                               s = "red";
+                       else
+                               s = "blue";
+                       drawpic_skin(pos + eY * i * height, strcat("flag_", s, "_carrying"), '1 1 0' * height, '1 1 1', hud_alpha_fg * a, DRAWFLAG_NORMAL);     
+                       drawcolorcodedstring(pos + eX * height + eY * 0.33 * height + eY * i * height, textShortenToWidth(killnotify_attackers[i], mySize_x - height, fontsize, stringwidth_colors), fontsize, hud_alpha_fg * a, DRAWFLAG_NORMAL);
+               }
+               else if(killnotify_deathtype[i] == INFO_RETURNFLAG)
                {
-                       drawpic_skin(pos + eX * 0.5 * mySize_x - eX * (mySize_y/entries) + eY * i * (mySize_y/entries), "notify_pushoffedge", '2 1 0' * (mySize_y/entries), '1 1 1', hud_alpha_fg * a, DRAWFLAG_NORMAL);        
+                       if(killnotify_victims[i] == "^1RED^7 flag")
+                               s = "red";
+                       else
+                               s = "blue";
+                       drawpic_skin(pos + eY * i * height, strcat("flag_", s, "_taken"), '1 1 0' * height, '1 1 1', hud_alpha_fg * a, DRAWFLAG_NORMAL);        
+                       drawcolorcodedstring(pos + eX * height + eY * 0.33 * height + eY * i * height, textShortenToWidth(killnotify_attackers[i], mySize_x - height, fontsize, stringwidth_colors), fontsize, hud_alpha_fg * a, DRAWFLAG_NORMAL);
+               }
+               else if(killnotify_deathtype[i] == INFO_LOSTFLAG)
+               {
+                       if(killnotify_victims[i] == "^1RED^7 flag")
+                               s = "red";
+                       else
+                               s = "blue";
+                       drawpic_skin(pos + eY * i * height, strcat("flag_", s, "_lost"), '1 1 0' * height, '1 1 1', hud_alpha_fg * a, DRAWFLAG_NORMAL); 
+                       drawcolorcodedstring(pos + eX * height + eY * 0.33 * height + eY * i * height, textShortenToWidth(killnotify_attackers[i], mySize_x - height, fontsize, stringwidth_colors), fontsize, hud_alpha_fg * a, DRAWFLAG_NORMAL);
                }
        }
        /* This will come later.
index 5f1afb54289560c244f0b23978b158a922a09f74..7fcbec7bf1f606caecb2d99258cf59efc0e61adb 100644 (file)
@@ -528,6 +528,7 @@ float MSG_KILL = 1;
 float MSG_SPREE = 2;
 float MSG_KILL_ACTION = 3;
 float MSG_KILL_ACTION_SPREE = 4;
+float MSG_INFO = 5;
 
 float KILL_TEAM = 10301;
 float KILL_TEAM_SPREE = 10302;
@@ -547,6 +548,11 @@ float KILL_SPREE_20 = 10315;
 float KILL_SPREE_25 = 10316;
 float KILL_SPREE_30 = 10317;
 
+float INFO_GOTFLAG = 10318;
+float INFO_PICKUPFLAG = 10319;
+float INFO_LOSTFLAG = 10320;
+float INFO_RETURNFLAG = 10321;
+
 // weapon requests
 float WR_SETUP         = 1; // (SVQC) setup weapon data
 float WR_THINK         = 2; // (SVQC) logic to run every frame
index 1d40efcc2c5bcfd67b15485ea2b75e6155d0ca27..4148136daf62dd0454c3c80f9c92c3359edeb75e 100644 (file)
@@ -290,7 +290,8 @@ void DropFlag(entity e, entity penalty_receiver, entity attacker)
                dprint("FLAG: drop - owner is not carrying this flag??\n");
                return;
        }
-       bprint(p.netname, "^7 lost the ", e.netname, "\n");
+       //bprint(p.netname, "^7 lost the ", e.netname, "\n");
+       Send_KillNotification (p.netname, e.netname, "", INFO_LOSTFLAG, MSG_INFO);
 
        if(penalty_receiver)
                UpdateFrags(penalty_receiver, -ctf_score_value("penalty_suicidedrop"));
@@ -542,7 +543,8 @@ void FlagTouch()
                other.flagcarried = self;
                self.cnt = FLAG_CARRY;
                self.angles = '0 0 0';
-               bprint(other.netname, "^7 got the ", self.netname, "\n");
+               //bprint(other.netname, "^7 got the ", self.netname, "\n");
+               Send_KillNotification (other.netname, self.netname, "", INFO_GOTFLAG, MSG_INFO);
                UpdateFrags(other, ctf_score_value("score_pickup_base"));
                self.dropperid = other.playerid;
                PlayerScore_Add(other, SP_CTF_PICKUPS, 1);
@@ -569,7 +571,8 @@ void FlagTouch()
                if (other.team == self.team || (other.team != COLOR_TEAM1 && other.team != COLOR_TEAM2))
                {
                        // return flag
-                       bprint(other.netname, "^7 returned the ", self.netname, "\n");
+                       Send_KillNotification (other.netname, self.netname, "", INFO_RETURNFLAG, MSG_INFO);
+                       //bprint(other.netname, "^7 returned the ", self.netname, "\n");
 
                        // punish the player who last had it
                        FOR_EACH_PLAYER(player)
@@ -619,7 +622,8 @@ void FlagTouch()
                        self.owner = other;
                        other.flagcarried = self;
                        self.cnt = FLAG_CARRY;
-                       bprint(other.netname, "^7 picked up the ", self.netname, "\n");
+                       Send_KillNotification (other.netname, self.netname, "", INFO_PICKUPFLAG, MSG_INFO);
+                       //bprint(other.netname, "^7 picked up the ", self.netname, "\n");
 
                        float f;
                        f = bound(0, (self.pain_finished - time) / cvar("g_ctf_flag_returntime"), 1);