// get the actual name of a notification and return it as a string
string Get_Field_Value(float field, float net_type, float net_name)
{
+ //dprint("Get_Field_Value(", ftos(field), ", ", ftos(net_type), ", ", ftos(net_name), ");\n");
+
#define GET_FIELD_VALUE_OUTPUT(field,name,strnum,flnum) switch(field) { \
case F_NAME: { return VAR_TO_TEXT(name); } \
case F_STRNUM: { return ftos(strnum); } \
case F_FLNUM: { return ftos(flnum); } }
- #define CLPSE_GETVALUE(name,type,field) \
+ #define GET_FIELD_VALUE_OUTPUT_PAIR(field,name,infoname,centername,strnum,flnum) switch(field) { \
+ case F_NAME: { return VAR_TO_TEXT(name); } \
+ case F_INFNAME: { return VAR_TO_TEXT(infoname); } \
+ case F_CENNAME: { return VAR_TO_TEXT(centername); } \
+ case F_INFVAL: { return ftos(infoname); } \
+ case F_CENVAL: { return ftos(centername); } \
+ case F_STRNUM: { return ftos(strnum); } \
+ case F_FLNUM: { return ftos(flnum); } }
+
+ #define CLPSE_GETVALUE(name,arg,earg) \
#if name != NO_MSG \
- stof(Get_Field_Value(field, type, name)) \
+ arg \
#else \
- 0 \
+ earg \
#endif
switch(net_type)
case MSG_INFO:
{
#define MSG_INFO_NOTIF(name,strnum,flnum,args,hudargs,icon,normal,gentle) case name: { GET_FIELD_VALUE_OUTPUT(field,name,strnum,flnum) }
-
NOTIF_SWITCH_LIST(MSG_INFO, net_name, return "")
-
#undef MSG_INFO_NOTIF
break;
}
case MSG_CENTER:
{
#define MSG_CENTER_NOTIF(name,strnum,flnum,args,cpid,durcnt,normal,gentle) case name: { GET_FIELD_VALUE_OUTPUT(field,name,strnum,flnum) }
-
NOTIF_SWITCH_LIST(MSG_CENTER, net_name, return "")
-
#undef MSG_CENTER_NOTIF
break;
}
case MSG_WEAPON:
{
- #define MSG_WEAPON_NOTIF(name,infoname,centername) case name: { GET_FIELD_VALUE_OUTPUT(field,name, \
- max(CLPSE_GETVALUE(infoname, MSG_INFO, F_STRNUM), CLPSE_GETVALUE(centername, MSG_CENTER, F_STRNUM)), \
- max(CLPSE_GETVALUE(infoname, MSG_INFO, F_FLNUM), CLPSE_GETVALUE(centername, MSG_CENTER, F_FLNUM))) }
-
+ #define MSG_WEAPON_NOTIF(name,infoname,centername) case name: { GET_FIELD_VALUE_OUTPUT_PAIR(field,name, \
+ CLPSE_GETVALUE(infoname, infoname, NO_MSG), CLPSE_GETVALUE(centername, centername, NO_MSG), \
+ max(CLPSE_GETVALUE(infoname, stof(Get_Field_Value(F_STRNUM, MSG_INFO, infoname)), 0), CLPSE_GETVALUE(centername, stof(Get_Field_Value(F_STRNUM, MSG_CENTER, centername)), 0)), \
+ max(CLPSE_GETVALUE(infoname, stof(Get_Field_Value(F_FLNUM, MSG_INFO, infoname)), 0), CLPSE_GETVALUE(centername, stof(Get_Field_Value(F_FLNUM, MSG_CENTER, centername)), 0))) }
NOTIF_SWITCH_LIST(MSG_WEAPON, net_name, return "")
-
#undef MSG_WEAPON_NOTIF
break;
}
case MSG_DEATH:
{
- #define MSG_DEATH_NOTIF(name,infoname,centername) case name: { GET_FIELD_VALUE_OUTPUT(field,name, \
- max(CLPSE_GETVALUE(infoname, MSG_INFO, F_STRNUM), CLPSE_GETVALUE(centername, MSG_CENTER, F_STRNUM)), \
- max(CLPSE_GETVALUE(infoname, MSG_INFO, F_FLNUM), CLPSE_GETVALUE(centername, MSG_CENTER, F_FLNUM))) }
-
+ #define MSG_DEATH_NOTIF(name,infoname,centername) case name: { GET_FIELD_VALUE_OUTPUT_PAIR(field,name, \
+ CLPSE_GETVALUE(infoname, infoname, NO_MSG), CLPSE_GETVALUE(centername, centername, NO_MSG), \
+ max(CLPSE_GETVALUE(infoname, stof(Get_Field_Value(F_STRNUM, MSG_INFO, infoname)), 0), CLPSE_GETVALUE(centername, stof(Get_Field_Value(F_STRNUM, MSG_CENTER, centername)), 0)), \
+ max(CLPSE_GETVALUE(infoname, stof(Get_Field_Value(F_FLNUM, MSG_INFO, infoname)), 0), CLPSE_GETVALUE(centername, stof(Get_Field_Value(F_FLNUM, MSG_CENTER, centername)), 0))) }
NOTIF_SWITCH_LIST(MSG_DEATH, net_name, return "")
-
#undef MSG_DEATH_NOTIF
break;
}
}
float w_deathtype;
-float Obituary_WeaponDeath(float murder, float deathtype, string s1, string s2, float f1)
+float Obituary_WeaponDeath(entity notif_target, float murder, float deathtype, string s1, string s2, float f1)
{
float death_weapon = DEATH_WEAPONOF(deathtype);
float death_message = weapon_action(death_weapon, ((murder) ? WR_KILLMESSAGE : WR_SUICIDEMESSAGE));
w_deathtype = FALSE;
- if(death_message) { Send_Notification_Legacy_Wrapper(NOTIF_ANY, world, MSG_WEAPON, death_message, s1, s2, f1, NO_FL_ARG, NO_FL_ARG); }
+ if(death_message)
+ {
+ Send_Notification_Legacy_Wrapper(NOTIF_ONE, notif_target, MSG_WEAPON, death_message, s1, s2, f1, NO_FL_ARG, NO_FL_ARG);
+ Send_Notification_Legacy_Wrapper(NOTIF_ANY_EXCEPT, notif_target, MSG_INFO, stof(Get_Field_Value(F_INFVAL, MSG_WEAPON, death_message)), s1, s2, f1, NO_FL_ARG, NO_FL_ARG);
+ //print(Get_Field_Value(F_INFVAL, MSG_WEAPON, death_message), "\n");
+ }
else { dprint(sprintf("Obituary_WeaponDeath(): ^1Deathtype ^7(%s-%d)^1 has no notification for weapon %d!\n", Deathtype_Name(deathtype), deathtype, death_weapon)); }
return TRUE;
Obituary_SpecialDeath(targ, FALSE, deathtype, s1, s2, f1, f2, NO_FL_ARG);
}
- else if not(Obituary_WeaponDeath(FALSE, deathtype, targ.netname, NO_STR_ARG, targ.killcount))
+ else if not(Obituary_WeaponDeath(targ, FALSE, deathtype, targ.netname, NO_STR_ARG, targ.killcount))
{
backtrace("SUICIDE: what the hell happened here?\n");
}
}
//print("targ_killcount = ", ftos(targ.killcount), ", attacker_killcount = ", ftos(attacker.killcount), ".\n");
- if not(Obituary_WeaponDeath(TRUE, deathtype, targ.netname, attacker.netname, targ.killcount))
+ if not(Obituary_WeaponDeath(targ, TRUE, deathtype, targ.netname, attacker.netname, targ.killcount))
Obituary_SpecialDeath(targ, TRUE, deathtype, s2, s1, targ.killcount, NO_FL_ARG, NO_FL_ARG);
}
}