#include <common/teams.qh>
#include <common/util.qh>
+#ifdef CSQC
+#include <client/autocvars.qh>
+#endif
+
/** main types/groups of notifications */
ENUMCLASS(MSG)
/** "Global" AND "personal" announcer messages */
float var_cvar,
MSG typeId,
string namestring,
- string cvarnamestring,
int teamnum);
void Create_Notification_Entity_Annce(entity notif,
float var_cvar,
if (fh >= 0)
{
Dump_Notifications(fh, alsoprint);
- LOG_INFOF("Dumping notifications... File located in ^2data/data/%s^7.\n", filename);
+ LOG_INFOF("Dumping notifications... File located in ^2data/data/%s^7.", filename);
fclose(fh);
}
else
{
- LOG_INFOF("^1Error: ^7Could not open file '%s'!\n", filename);
+ LOG_INFOF("^1Error: ^7Could not open file '%s'!", filename);
}
#else
- LOG_INFO(_("Notification dump command only works with cl_cmd and sv_cmd.\n"));
+ LOG_INFO(_("Notification dump command only works with cl_cmd and sv_cmd."));
#endif
return;
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpnotifs [filename]"));
- LOG_INFO(" Where 'filename' is the file to write (default is notifications_dump.cfg),\n");
- LOG_INFO(" if supplied with '-' output to console as well as default,\n");
- LOG_INFO(" if left blank, it will only write to default.\n");
+ LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " dumpnotifs [filename]");
+ LOG_INFO(" Where 'filename' is the file to write (default is notifications_dump.cfg),");
+ LOG_INFO(" if supplied with '-' output to console as well as default,");
+ LOG_INFO(" if left blank, it will only write to default.");
return;
}
}
ARG_CASE(ARG_CS_SV_DC, "f2", ftos(f2)) \
ARG_CASE(ARG_CS_SV, "f3", ftos(f3)) \
ARG_CASE(ARG_CS_SV, "f4", ftos(f4)) \
- ARG_CASE(ARG_CS_SV, "f1p2dec", ftos_decimals(f1/100, 2)) \
- ARG_CASE(ARG_CS_SV, "f2p2dec", ftos_decimals(f2/100, 2)) \
+ ARG_CASE(ARG_CS_SV, "f1dtime", ftos_decimals(TIME_DECODE(f1), 2)) \
+ ARG_CASE(ARG_CS_SV, "f2dtime", ftos_decimals(TIME_DECODE(f2), 2)) \
ARG_CASE(ARG_CS, "f2primsec", (f2 ? _("secondary") : _("primary"))) \
ARG_CASE(ARG_CS, "f3primsec", (f3 ? _("secondary") : _("primary"))) \
ARG_CASE(ARG_CS, "f1secs", count_seconds(f1)) \
ARG_CASE(ARG_CS, "f1points", (f1 == 1 ? _("point") : _("points"))) \
ARG_CASE(ARG_CS_SV, "f1ord", count_ordinal(f1)) \
- ARG_CASE(ARG_CS, "f1time", process_time(2, f1)) \
+ ARG_CASE(ARG_CS_SV, "f1time", process_time(2, f1)) \
ARG_CASE(ARG_CS_SV_HA, "f1race_time", mmssss(f1)) \
ARG_CASE(ARG_CS_SV_HA, "f2race_time", mmssss(f2)) \
ARG_CASE(ARG_CS_SV_HA, "f3race_time", mmssss(f3)) \
string notif_arg_missing_teams(float f1)
{
- return sprintf("%s%s%s%s",
- ((f1 & BIT(0)) ? sprintf("%s%s", Team_ColoredFullName(NUM_TEAM_1), (f1 & (BIT(1) | BIT(2) | BIT(3)) ? ", " : "")) : ""),
- ((f1 & BIT(1)) ? sprintf("%s%s", Team_ColoredFullName(NUM_TEAM_2), (f1 & ( BIT(2) | BIT(3)) ? ", " : "")) : ""),
- ((f1 & BIT(2)) ? sprintf("%s%s", Team_ColoredFullName(NUM_TEAM_3), (f1 & ( BIT(3)) ? ", " : "")) : ""),
- ((f1 & BIT(3)) ? Team_ColoredFullName(NUM_TEAM_4) : "")
+ return strcat(
+ ((f1 & BIT(0)) ? strcat(Team_ColoredFullName(NUM_TEAM_1), (f1 >> 1) ? ", " : "") : ""),
+ ((f1 & BIT(1)) ? strcat(Team_ColoredFullName(NUM_TEAM_2), (f1 >> 2) ? ", " : "") : ""),
+ ((f1 & BIT(2)) ? strcat(Team_ColoredFullName(NUM_TEAM_3), (f1 >> 3) ? ", " : "") : ""),
+ ((f1 & BIT(3)) ? Team_ColoredFullName(NUM_TEAM_4) : "")
);
}
.bool nent_enabled;
.MSG nent_type;
.string nent_name;
-.string nent_cvarname;
.int nent_stringcount;
.int nent_floatcount;
-.bool nent_teamnum;
+.int nent_teamnum;
// MSG_ANNCE entity values
.int nent_channel;
}
}
+string Get_Notif_CvarName(Notification notif)
+{
+ if(!notif.nent_teamnum)
+ return notif.nent_name;
+ return substring(notif.nent_name, 0, -strlen(Static_Team_ColorName(notif.nent_teamnum)) - 2);
+}
+
Notification Get_Notif_Ent(MSG net_type, int net_name)
{
Notification it = _Notifications_from(net_name, NULL);
#define MSG_ANNCE_NOTIF_(teamnum, name, cvarname, default, sound, channel, volume, position) \
REGISTER(Notifications, name, m_id, new_pure(msg_annce_notification)) { \
- Create_Notification_Entity (this, default, ACVNN(cvarname), MSG_ANNCE, strtoupper(#name), #cvarname, teamnum); \
+ Create_Notification_Entity (this, default, ACVNN(cvarname), MSG_ANNCE, strtoupper(#name), teamnum); \
Create_Notification_Entity_Annce(this, ACVNN(cvarname), strtoupper(#name), \
channel, /* channel */ \
sound, /* snd */ \
#define MSG_INFO_NOTIF_(teamnum, name, cvarname, default, strnum, flnum, args, hudargs, icon, normal, gentle) \
REGISTER(Notifications, name, m_id, new_pure(msg_info_notification)) { \
- Create_Notification_Entity (this, default, ACVNN(cvarname), MSG_INFO, strtoupper(#name), #cvarname, teamnum); \
+ Create_Notification_Entity (this, default, ACVNN(cvarname), MSG_INFO, strtoupper(#name), teamnum); \
Create_Notification_Entity_InfoCenter(this, ACVNN(cvarname), strtoupper(#name), strnum, flnum, \
args, /* args */ \
hudargs, /* hudargs */ \
#define MULTIICON_INFO_(name, default, strnum, flnum, args, hudargs, iconargs, icon, normal, gentle) \
NOTIF_ADD_AUTOCVAR(name, default) \
REGISTER(Notifications, name, m_id, new_pure(msg_info_notification)) { \
- Create_Notification_Entity (this, default, ACVNN(name), MSG_INFO, strtoupper(#name), #name, 0); \
+ Create_Notification_Entity (this, default, ACVNN(name), MSG_INFO, strtoupper(#name), 0); \
Create_Notification_Entity_InfoCenter(this, ACVNN(name), strtoupper(#name), strnum, flnum, \
args, /* args */ \
hudargs, /* hudargs */ \
#define MSG_CENTER_NOTIF_(teamnum, name, cvarname, default, strnum, flnum, args, cpid, durcnt, normal, gentle) \
REGISTER(Notifications, name, m_id, new_pure(msg_center_notification)) { \
- Create_Notification_Entity (this, default, ACVNN(cvarname), MSG_CENTER, strtoupper(#name), #cvarname, teamnum); \
+ Create_Notification_Entity (this, default, ACVNN(cvarname), MSG_CENTER, strtoupper(#name), teamnum); \
Create_Notification_Entity_InfoCenter(this, ACVNN(cvarname), strtoupper(#name), strnum, flnum, \
args, /* args */ \
"", /* hudargs */ \
#define MSG_MULTI_NOTIF(name, default, anncename, infoname, centername) \
NOTIF_ADD_AUTOCVAR(name, default) \
REGISTER(Notifications, name, m_id, new_pure(msg_multi_notification)) { \
- Create_Notification_Entity (this, default, ACVNN(name), MSG_MULTI, strtoupper(#name), #name, 0); \
+ Create_Notification_Entity (this, default, ACVNN(name), MSG_MULTI, strtoupper(#name), 0); \
Create_Notification_Entity_Multi(this, ACVNN(name), strtoupper(#name), \
anncename, /* anncename */ \
infoname, /* infoname */ \
#define MSG_CHOICE_NOTIF_(teamnum, name, cvarname, default, challow, chtype, optiona, optionb) \
REGISTER(Notifications, name, m_id, new_pure(msg_choice_notification)) { \
this.nent_choice_idx = nent_choice_count++; \
- Create_Notification_Entity (this, default, ACVNN(cvarname), MSG_CHOICE, strtoupper(#name), #cvarname, teamnum); \
+ Create_Notification_Entity (this, default, ACVNN(cvarname), MSG_CHOICE, strtoupper(#name), teamnum); \
Create_Notification_Entity_Choice(this, ACVNN(cvarname), strtoupper(#name), \
challow, /* challow_def */ \
autocvar_notification_##cvarname##_ALLOWED, /* challow_var */ \