]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Work more on Obituary notifications/deathtypes
authorSamual Lenks <samual@xonotic.org>
Sun, 7 Oct 2012 07:21:43 +0000 (03:21 -0400)
committerSamual Lenks <samual@xonotic.org>
Sun, 7 Oct 2012 07:21:43 +0000 (03:21 -0400)
qcsrc/client/hud.qc
qcsrc/common/deathtypes.qh
qcsrc/server/cl_player.qc
qcsrc/server/g_damage.qc

index 87ba6060848cce13bab83b03556b60658913a4c0..e91e09e0785182b77d28ee532f78f25ba255879e 100644 (file)
@@ -2077,8 +2077,6 @@ void HUD_KillCenterprint(string s1, string s2, float type, float msg)
                                centerprint_hud(_("^1Don't go against team mates!"));
                        else
                                centerprint_hud(_("^1Don't shoot your team mates!"));
-               } else if (type == DEATH_QUIET) {
-                       // do nothing
                } else { // generic message
                        if(gentle)
                                centerprint_hud(_("^1You need to be more careful!"));
index dc243b35db16767378906c6b70eaaba2962bc8fa..4a9fa0f2bccda865d1ded70ea089aa8d85bfdacc 100644 (file)
@@ -36,7 +36,6 @@ float DT_COUNT;
        DEATHTYPE(DEATH_TOUCHEXPLODE, FALSE, FALSE, NORMAL_POS) \
        DEATHTYPE(DEATH_CHEAT, FALSE, FALSE, NORMAL_POS) \
        DEATHTYPE(DEATH_FIRE, FALSE, FALSE, NORMAL_POS) \
-       DEATHTYPE(DEATH_QUIET, FALSE, FALSE, NORMAL_POS) \
        DEATHTYPE(DEATH_VHCRUSH, FALSE, FALSE, DEATH_VHFIRST) \
        DEATHTYPE(DEATH_SBMINIGUN, FALSE, FALSE, NORMAL_POS) \
        DEATHTYPE(DEATH_SBROCKET, FALSE, FALSE, NORMAL_POS) \
index 1d8bae63687d21a91a13feb47ed6700c99e0d8b3..db82486b953a8cf6ab2c2c7e79b7cd0356726185 100644 (file)
@@ -1417,12 +1417,13 @@ void MoveToTeam(entity client, float team_colour, float type, float show_message
 
        TeamchangeFrags(client);  // move the players frags
        SetPlayerColors(client, team_colour - 1);  // set the players colour
-       Damage(client, client, client, 100000, ((show_message & 2) ? DEATH_QUIET : DEATH_AUTOTEAMCHANGE), client.origin, '0 0 0');  // kill the player
+       Damage(client, client, client, 100000, DEATH_AUTOTEAMCHANGE, client.origin, '0 0 0');  // kill the player
 
        lockteams = lockteams_backup;  // restore the team lock
 
        LogTeamchange(client.playerid, client.team, type);
 
+       // TODO FIXME FIXNOTIF
        if not(show_message & 1) // admin message
                sprint(client, strcat("\{1}\{13}^3", admin_name(), "^7: You have been moved to the ", Team_ColorName_Lower(team_colour), " team\n"));  // send a chat message
 
index 3a211853c4634b58d6f14b32c72d3eab577ace25..3ef53466365235e447ffc1c420dc2df6525bd343 100644 (file)
@@ -308,76 +308,107 @@ void LogDeath(string mode, float deathtype, entity killer, entity killed)
        GameLogEcho(s);
 }
 
-void Obituary_Notification(entity notif_target, string s1, string s2, string s3, float deathtype)
+string Deathtype_Name(float deathtype)
 {
-       /*if(deathtype)
+       if(DEATH_ISSPECIAL(deathtype))
        {
-               #define DEATHTYPE(name,type,notification,first,last) \
-                       { if((deathtype == max(0, name)) && max(0, type) && max(0, notification)) { Send_Notification(type, notif_target, notification, s1, s2, s3); return; } }
+               #define DEATHTYPE(name,msg_info,msg_center,position) \
+                       { if(deathtype == max(0, name)) return VAR_TO_TEXT(name); }
+
+               DEATHTYPES
+       }
+       return "foobar";
+}
+
+void Obituary_SpecialDeath(entity notif_target, float deathtype, string s1, string s2, float f1, float f2, float f3)
+{
+       if(DEATH_ISSPECIAL(deathtype))
+       {
+               #define DEATHTYPE(name,msg_info,msg_center,position) \
+                       { if(deathtype == max(0, name)) \
+                       { \
+                               if(max(0, msg_info)) { Send_Notification(world, MSG_INFO, msg_info, s1, s2, f1, f2, f3); } \
+                               if(max(0, msg_center)) { Send_Notification(notif_target, MSG_CENTER, msg_center, s1, s2, f1, f2, f3); } \
+                               return; \
+                       } }
 
                DEATHTYPES
                backtrace("Unhandled deathtype. Please notify Samual!\n");
-       }*/
+       }
 }
 
-void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
+void Obituary(entity attacker, entity inflictor, entity targ, float deathtype)
 {
+       print(sprintf("Obituary(): Deathtype = %s (%d), Attacker = %s, Inflictor = %s, Target = %s...\n", Deathtype_Name(deathtype), deathtype, attacker.netname, inflictor.netname, targ.netname));
        string  s, a, msg;
        float w, type;
 
-       string s1, s2, s3;
+       string s1, s2;
+       float f1, f2, f3;
 
        if (targ.classname == "player")
        {
-               s = targ.netname;
-               a = attacker.netname;
-
                if (targ == attacker) // suicides
                {
-                       s1 = ((deathtype == DEATH_TEAMCHANGE || deathtype == DEATH_AUTOTEAMCHANGE) ? Team_ColoredFullName(targ.team) : "");
-
-                       // no "killed your own dumb self" message in CTS
-            if(!g_cts) { Obituary_Notification(targ, s1, "", "", deathtype); }
+                       if(DEATH_ISSPECIAL(deathtype))
+                       {
+                               if(deathtype == DEATH_TEAMCHANGE || deathtype == DEATH_AUTOTEAMCHANGE)
+                               {
+                                       s1 = targ.netname;
+                                       f1 = targ.team;
+                                       f2 = NO_FL_ARG;
+                               }
+                               else
+                               {
+                                       if(deathtype == DEATH_MIRRORDAMAGE)
+                                       {
+                                               s1 = targ.netname;
+                                               f1 = targ.team;
+                                               f2 = targ.killcount;
+                                       }
+                                       else
+                                       {
+                                               s1 = targ.netname;
+                                               f1 = targ.killcount;
+                                               f2 = NO_FL_ARG;
+                                       }
+                                       
+                                       // Do this manually inside of each if statement where necessary,
+                                       // DEATH_TEAMCHANGE and such are not supposed to have this.
+                                       LogDeath("suicide", deathtype, targ, targ);
+                                       GiveFrags(attacker, targ, -1, deathtype);
+                               }
 
-                       if(deathtype != DEATH_TEAMCHANGE && deathtype != DEATH_QUIET)
+                               Obituary_SpecialDeath(targ, deathtype, s1, NO_STR_ARG, f1, f2, NO_FL_ARG);
+                       }
+                       else if(DEATH_WEAPONOF(deathtype))
                        {
-                               LogDeath("suicide", deathtype, targ, targ);
-                               GiveFrags(attacker, targ, -1, deathtype);
+                               print("death was a weapon!\n");
+                       }
+                       else
+                       {
+                               backtrace("what the hell happened here?\n");
                        }
-
-                       s1 = targ.netname;
-                       s2 = ((targ.killcount > 2) ? ftos(targ.killcount) : "");
-                               
-                       //if(teamplay && deathtype == DEATH_MIRRORDAMAGE)
-                       //      { deathtype = ((attacker.team == FL_TEAM_1) ? KILL_TEAM_SUICIDE_RED : KILL_TEAM_SUICIDE_BLUE); }
-
-                       Obituary_Notification(world, s1, s2, "", deathtype);
-                       //Send_KillNotification(s, s2, ftos(w), deathtype, MSG_SUICIDE);
                }
-               else if (attacker.classname == "player")
+               else if(attacker.classname == "player")
                {
                        if(!IsDifferentTeam(attacker, targ))
                        {
-                               //type = ((attacker.team == FL_TEAM_1) ? KILL_TEAM_FRAG_RED : KILL_TEAM_FRAG_BLUE);
-
-                               GiveFrags(attacker, targ, -1, deathtype);
-
-                               //Send_CSQC_KillCenterprint(attacker, s, "", type);
-
-                               if (targ.killcount > 2)
-                                       msg = ftos(targ.killcount);
+                               if(DEATH_ISSPECIAL(deathtype))
+                               {
+                                       print("hmm death was special?\n");
+                               }
+                               else if(DEATH_WEAPONOF(deathtype))
+                               {
+                                       print("death was a weapon!\n");
+                               }
                                else
-                                       msg = "";
-
-                               if (attacker.killcount > 2) {
-                                       msg = ftos(attacker.killcount);
-                                       type = KILL_TEAM_SPREE;
+                               {
+                                       backtrace("what the hell happened here?\n");
                                }
-                               Send_KillNotification(a, s, msg, type, MSG_KILL);
-
-                               attacker.killcount = 0;
-
+                               
                                LogDeath("tk", deathtype, attacker, targ);
+                               GiveFrags(attacker, targ, -1, deathtype);
                        }
                        else
                        {
@@ -547,7 +578,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                        }
        }
 
-       if(deathtype == DEATH_KILL || deathtype == DEATH_TEAMCHANGE || deathtype == DEATH_AUTOTEAMCHANGE || deathtype == DEATH_QUIET)
+       if(deathtype == DEATH_KILL || deathtype == DEATH_TEAMCHANGE || deathtype == DEATH_AUTOTEAMCHANGE)
        {
                // These are ALWAYS lethal
                // No damage modification here