// Last updated: August, 2013
// ================================================
-string Get_Notif_TypeName(float net_type)
+string Get_Notif_TypeName(int net_type)
{
switch(net_type)
{
return "";
}
-entity Get_Notif_Ent(float net_type, float net_name)
+entity Get_Notif_Ent(int net_type, int net_name)
{
switch(net_type)
{
void Destroy_All_Notifications(void)
{
entity notif;
- float i;
+ int i;
#define DESTROY_LOOP(type,count) \
for(i = 1; i <= count; ++i) \
}
string Process_Notif_Line(
- float typeid,
- float chat,
+ int typeId,
+ bool chat,
string input,
string notiftype,
string notifname,
string stringtype)
{
#ifdef CSQC
- if(typeid == MSG_INFO)
+ if(typeId == MSG_INFO)
{
if((chat && autocvar_notification_allow_chatboxprint)
|| (autocvar_notification_allow_chatboxprint == 2))
// done to both MSG_INFO and MSG_CENTER
if(substring(input, (strlen(input) - 1), 1) == "\n")
{
- print(sprintf(
+ printf(
strcat(
"^1TRAILING NEW LINE AT END OF NOTIFICATION: ",
"^7net_type = %s, net_name = %s, string = %s.\n"
notiftype,
notifname,
stringtype
- ));
+ );
notif_error = TRUE;
input = substring(input, 1, (strlen(input) - 1));
}
string selected, remaining = args;
float sel_num = 0;
- for(;(remaining != "");)
+ for(0;(remaining != "");)
{
selected = car(remaining); remaining = cdr(remaining);
{
if(sel_num == NOTIF_MAX_ARGS)
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION HAS TOO MANY ARGUMENTS: ",
"^7net_type = %s, net_name = %s, max args = %d.\n"
notiftype,
notifname,
NOTIF_MAX_ARGS
- ));
+ );
notif_error = TRUE;
break;
}
#undef ARG_CASE_ARG_CS_SV_HA
default:
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: ",
"^7net_type = %s, net_name = %s, args arg = '%s'.\n"
notiftype,
notifname,
selected
- ));
+ );
notif_error = TRUE;
break;
}
{
if(sel_num == NOTIF_MAX_HUDARGS)
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION HAS TOO MANY ARGUMENTS: ",
"^7net_type = %s, net_name = %s, max hudargs = %d.\n"
notiftype,
notifname,
NOTIF_MAX_HUDARGS
- ));
+ );
notif_error = TRUE;
break;
}
#undef ARG_CASE_ARG_CS_SV_HA
default:
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: ",
"^7net_type = %s, net_name = %s, hudargs arg = '%s'.\n"
notiftype,
notifname,
selected
- ));
+ );
notif_error = TRUE;
break;
}
{
if(sel_num == NOTIF_MAX_DURCNT)
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION HAS TOO MANY ARGUMENTS: ",
"^7net_type = %s, net_name = %s, max durcnt = %d.\n"
notiftype,
notifname,
NOTIF_MAX_DURCNT
- ));
+ );
notif_error = TRUE;
break;
}
if(ftos(stof(selected)) != "") { ++sel_num; }
else
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: ",
"^7net_type = %s, net_name = %s, durcnt arg = '%s'.\n"
notiftype,
notifname,
selected
- ));
+ );
notif_error = TRUE;
}
break;
void Create_Notification_Entity(
float var_default,
float var_cvar,
- float typeid,
- float nameid,
+ int typeId,
+ int nameid,
string namestring,
float strnum,
float flnum,
string normal,
string gentle,
/* MSG_MULTI */
- float anncename,
- float infoname,
- float centername,
+ int anncename,
+ int infoname,
+ int centername,
/* MSG_CHOICE */
float challow_def,
float challow_var,
- float chtype,
- float optiona,
- float optionb)
+ int chtype,
+ int optiona,
+ int optionb)
{
// =====================
// Global Entity Setup
// =====================
entity notif = spawn();
- switch(typeid)
+ switch(typeId)
{
case MSG_ANNCE:
{
"^1NOTIFICATION WITH IMPROPER TYPE: ",
"^7net_type = %d, net_name = %s.\n"
),
- typeid,
+ typeId,
namestring
));
return; // It's not possible to recover from this one
}
notif.nent_default = var_default;
notif.nent_enabled = (1 <= var_cvar);
- notif.nent_type = typeid;
+ notif.nent_type = typeId;
notif.nent_id = nameid;
notif.nent_name = strzone(namestring);
- string typestring = Get_Notif_TypeName(typeid);
+ string typestring = Get_Notif_TypeName(typeId);
// Other pre-notif-setup requisites
notif_error = FALSE;
// ====================
// Notification Setup
// ====================
- switch(typeid)
+ switch(typeId)
{
case MSG_ANNCE:
{
}
else
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION WITH NO SOUND: ",
"^7net_type = %s, net_name = %s.\n"
),
typestring,
namestring
- ));
+ );
notif_error = TRUE;
}
}
}
else if((hudargs == "") && (durcnt ==""))
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION HAS ARG COUNTS BUT NO ARGS OR HUDARGS OR DURCNT: ",
"^7net_type = %s, net_name = %s, strnum = %d, flnum = %d\n"
namestring,
strnum,
flnum
- ));
+ );
notif_error = TRUE;
}
}
if(icon != "") { notif.nent_icon = strzone(icon); }
else
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION HAS HUDARGS BUT NO ICON: ",
"^7net_type = %s, net_name = %s.\n"
),
typestring,
namestring
- ));
+ );
notif_error = TRUE;
}
}
else if(icon != "")
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION HAS ICON BUT NO HUDARGS: ",
"^7net_type = %s, net_name = %s.\n"
),
typestring,
namestring
- ));
+ );
notif_error = TRUE;
}
if(cpid != NO_MSG) { notif.nent_cpid = cpid; }
else
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION HAS DURCNT BUT NO CPID: ",
"^7net_type = %s, net_name = %s.\n"
),
typestring,
namestring
- ));
+ );
notif_error = TRUE;
}
}
#define SET_NOTIF_STRING(string,stringname) \
notif.nent_string = strzone(CCR( \
Process_Notif_Line( \
- typeid, \
+ typeId, \
(var_cvar > 1), \
string, \
typestring, \
// Check to make sure a string was chosen
if(notif.nent_string == "")
{
- print(sprintf(
+ printf(
strcat(
"^1EMPTY NOTIFICATION: ",
"^7net_type = %s, net_name = %s.\n"
),
typestring,
namestring
- ));
+ );
notif_error = TRUE;
}
}
// Set MSG_MULTI string/float counts
if((anncename == NO_MSG) && (infoname == NO_MSG) && (centername == NO_MSG))
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION WITH NO SUBCALLS: ",
"^7net_type = %s, net_name = %s.\n"
),
typestring,
namestring
- ));
+ );
notif_error = TRUE;
}
else
{
if((chtype == NO_MSG) || (optiona == NO_MSG) || (optionb == NO_MSG))
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION IS MISSING CHOICE PARAMS: ",
"^7net_type = %s, net_name = %s.\n"
),
typestring,
namestring
- ));
+ );
notif_error = TRUE;
}
else
default:
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION WITH IMPROPER TYPE: ",
"^7net_type = %d, net_name = %s.\n"
),
- typeid,
+ typeId,
namestring
- ));
+ );
notif_error = TRUE;
break;
}
default:
{
- print(sprintf(
+ printf(
strcat(
"^1NOTIFICATION WITH IMPROPER TYPE: ",
"^7net_type = %d, net_name = %s.\n"
),
- typeid,
+ typeId,
namestring
- ));
+ );
notif_error = TRUE;
break;
}
NOTIF_WRITE(notif_msg) }
string notif_msg;
- float i;
+ int i;
entity e;
// Note: This warning only applies to the notifications.cfg file that is output...
if (!e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
NOTIF_WRITE_ENTITY(
- "Notification control cvar: 0 = disabled, 1 = enabled if gentle mode is off, 2 = always enabled)"
+ "0 = disabled, 1 = enabled if gentle mode is off, 2 = always enabled"
);
}
if (!e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
NOTIF_WRITE_ENTITY(
- "Notification control cvar: 0 = off, 1 = print to console, "
+ "0 = off, 1 = print to console, "
"2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
);
}
if (!e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
NOTIF_WRITE_ENTITY(
- "Notification control cvar: 0 = off, 1 = centerprint"
+ "0 = off, 1 = centerprint"
);
}
if (!e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
NOTIF_WRITE_ENTITY(
- "Notification control cvar: 0 = off, 1 = trigger subcalls"
+ "Enable this multiple notification"
);
}
if (!e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
NOTIF_WRITE_ENTITY_CHOICE(
- "Notification control cvar: 0 = off, 1 = trigger option A subcall, 2 = trigger option B subcall",
- "Notification control cvar: 0 = off, 1 = allowed in warmup mode, 2 = always allowed"
+ "Choice for this notification 0 = off, 1 = default message, 2 = verbose message",
+ "Allow choice for this notification 0 = off, 1 = only in warmup mode, 2 = always"
);
}
NOTIF_WRITE_HARDCODED(
"allow_chatboxprint", "1",
- "Allow notifications to be printed to chat box by setting notification cvar to 2 "
- "(You can also set this cvar to 2 to force ALL notifications to be printed to the chatbox)"
+ "Allow INFO notifications to be printed to chat box"
+ "0 = do not allow, "
+ "1 = allow only if allowed by individual notification_INFO* cvars, "
+ "2 = force all INFO notifications to be printed to the chatbox"
);
NOTIF_WRITE_HARDCODED(
string Local_Notification_sprintf(
string input, string args,
string s1, string s2, string s3, string s4,
- float f1, float f2, float f3, float f4)
+ int f1, float f2, float f3, float f4)
{
#ifdef NOTIFICATIONS_DEBUG
Debug_Notification(sprintf(
#endif
string selected;
- float sel_num;
+ int sel_num;
for(sel_num = 0; sel_num < NOTIF_MAX_ARGS; ++sel_num) { arg_slot[sel_num] = ""; }
string tmp_s;
void Local_Notification_HUD_Notify_Push(
string icon, string hudargs,
- string s1, string s2, string s3, string s4)
+ string s1, string s2, string s3, string s4,
+ float f1, float f2, float f3, float f4)
{
string selected;
- float sel_num;
arg_slot[0] = ""; arg_slot[1] = "";
+ int sel_num;
for(sel_num = 0;(hudargs != "");)
{
selected = car(hudargs); hudargs = cdr(hudargs);
}
#ifdef NOTIFICATIONS_DEBUG
Debug_Notification(sprintf(
- "Local_Notification_HUD_Notify_Push('%s^7', '%s', %s, %s);\n",
+ "Local_Notification_HUD_Notify_Push('%s^7', '%s', %s, %s, %s);\n",
icon,
hudargs,
MakeConsoleSafe(sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
+ sprintf("%d, %d, %d, %d", f1, f2, f3, f4),
MakeConsoleSafe(sprintf("'%s^7', '%s^7'", stof(arg_slot[0]), stof(arg_slot[1])))
));
#endif
Local_Notification_HUD_Notify_Push(
notif.nent_icon,
notif.nent_hudargs,
- s1, s2, s3, s4);
+ s1, s2, s3, s4,
+ f1, f2, f3, f4);
}
#endif
break;
#define RECURSE_FROM_CHOICE(ent,action) \
if(notif.nent_challow_var && (warmup_stage || (notif.nent_challow_var == 2))) \
{ \
- switch(ent.msg_choice_choices[net_name]) \
+ switch(ent.msg_choice_choices[net_name - 1]) \
{ \
case 1: found_choice = notif.nent_optiona; break; \
case 2: found_choice = notif.nent_optionb; break; \