From: Samual Lenks Date: Mon, 11 Feb 2013 20:32:12 +0000 (-0500) Subject: Fix handling of entities with MSG_WEAPON and MSG_DEATH subcalls X-Git-Tag: xonotic-v0.7.0~62^2~23^2~230 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=cf06cc28208c0049a6b38b3d6fea7d29d06b4c73;p=xonotic%2Fxonotic-data.pk3dir.git Fix handling of entities with MSG_WEAPON and MSG_DEATH subcalls --- diff --git a/qcsrc/common/notifications.qc b/qcsrc/common/notifications.qc index cea5d3de2..43b27082c 100644 --- a/qcsrc/common/notifications.qc +++ b/qcsrc/common/notifications.qc @@ -88,13 +88,13 @@ string Get_Field_Value(float field, float net_type, float net_name) dprint(sprintf("Get_Field_Value(%d, %d, %d); - name=%s, stringcount=%d, floatcount=%d...\n", field, net_type, net_name, e.nent_name, e.nent_stringcount, e.nent_floatcount)); - switch(net_type) + switch(field) { case F_NAME: { return e.nent_name; } - case F_INFVAL: { return ftos(e.nent_infoname); } - case F_CENVAL: { return ftos(e.nent_centername); } - case F_STRNUM: { return ftos(e.nent_stringcount); } - case F_FLNUM: { return ftos(e.nent_stringcount); } + case F_INFVAL: { return ftos(e.nent_infoname); } + case F_CENVAL: { return ftos(e.nent_centername); } + case F_STRNUM: { return ftos(e.nent_stringcount); } + case F_FLNUM: { return ftos(e.nent_floatcount); } } return ""; diff --git a/qcsrc/common/notifications.qh b/qcsrc/common/notifications.qh index a67f9af15..243aaaf3c 100644 --- a/qcsrc/common/notifications.qh +++ b/qcsrc/common/notifications.qh @@ -646,14 +646,26 @@ entity msg_death_notifs[NOTIF_MAX]; #define CREATE_NOTIF_ENTITY(type,name,infoname,centername,strnum,flnum,args,hudargs,icon,cpid,durcnt,normal,gentle,check_newline,subcalls) \ entity notif = spawn(); \ msg_##type##_notifs[name - 1] = notif; \ - notif.classname = "msg_##type##_notification"; \ + notif.classname = "msg_#type#_notification"; \ notif.nent_name = strzone(#name); \ #if subcalls \ #if (infoname == NO_MSG) && (centername == NO_MSG) \ print(sprintf("^1NOTIFICATION WITH NO SUBCALLS: ^7net_type = MSG_%s, net_name = %s.\n", strtoupper(#type), #name)); \ #else \ - if(infoname) { notif.nent_infoname = infoname; } \ - if(centername) { notif.nent_centername = centername; } \ + float infoname_stringcount = 0, infoname_floatcount = 0; \ + float centername_stringcount = 0, centername_floatcount = 0; \ + #if (infoname != NO_MSG) \ + notif.nent_infoname = infoname; \ + infoname_stringcount = msg_info_notifs[infoname - 1].nent_stringcount; \ + infoname_floatcount = msg_info_notifs[infoname - 1].nent_floatcount; \ + #endif \ + #if (centername != NO_MSG) \ + notif.nent_centername = centername; \ + centername_stringcount = msg_center_notifs[centername - 1].nent_stringcount; \ + centername_floatcount = msg_center_notifs[centername - 1].nent_floatcount; \ + #endif \ + notif.nent_stringcount = max(infoname_stringcount, centername_stringcount); \ + notif.nent_floatcount = max(infoname_floatcount, centername_floatcount); \ #endif \ #else \ notif.nent_stringcount = strnum; \ @@ -668,7 +680,8 @@ entity msg_death_notifs[NOTIF_MAX]; #else \ if(cpid != NO_MSG) { notif.nent_cpid = cpid; } \ #endif \ - #endif + #endif \ + eprint(notif); #define MSG_INFO_NOTIF(name,strnum,flnum,args,hudargs,icon,normal,gentle) \