From 6c4446c0a7fd41a7539ad2983aebef4d1c323911 Mon Sep 17 00:00:00 2001 From: Samual Lenks Date: Wed, 21 Aug 2013 20:35:10 -0400 Subject: [PATCH] I'm a goddamn genius, IT WORKS! --- qcsrc/Makefile | 1 + qcsrc/common/notifications.qc | 125 ++++++++++++++------ qcsrc/common/notifications.qh | 82 +++++++------ qcsrc/server/accuracy.qc | 4 +- qcsrc/server/cl_client.qc | 6 +- qcsrc/server/cl_player.qc | 2 +- qcsrc/server/command/cmd.qc | 2 +- qcsrc/server/command/common.qc | 2 +- qcsrc/server/command/vote.qc | 10 +- qcsrc/server/defs.qh | 2 +- qcsrc/server/g_damage.qc | 14 +-- qcsrc/server/g_world.qc | 4 +- qcsrc/server/miscfunctions.qc | 8 +- qcsrc/server/mutators/gamemode_ca.qc | 2 +- qcsrc/server/mutators/gamemode_onslaught.qc | 4 +- qcsrc/server/scores.qc | 2 +- qcsrc/server/sv_main.qc | 2 +- 17 files changed, 173 insertions(+), 99 deletions(-) diff --git a/qcsrc/Makefile b/qcsrc/Makefile index a92b06bc6..6f3a9b84c 100644 --- a/qcsrc/Makefile +++ b/qcsrc/Makefile @@ -34,6 +34,7 @@ QCCFLAGS ?= \ -funtyped-nil \ -fno-permissive \ -fvariadic-args \ + -DNOTIFICATIONS_DEBUG \ $(QCCFLAGS_EXTRA) $(QCCFLAGS_WATERMARK) # xonotic build system overrides this by command line argument to turn off the update-cvarcount step diff --git a/qcsrc/common/notifications.qc b/qcsrc/common/notifications.qc index 5c5c41e1e..d119269b5 100644 --- a/qcsrc/common/notifications.qc +++ b/qcsrc/common/notifications.qc @@ -445,6 +445,7 @@ void Create_Notification_Entity( string durcnt, string normal, string gentle, + float challow, float chtype, float optiona, float optionb) @@ -813,8 +814,15 @@ void Create_Notification_Entity( break; } } + notif.nent_challow = challow; // 0: never allowed, 1: allowed in warmup, 2: always allowed notif.nent_stringcount = max(notif.nent_optiona.nent_stringcount, notif.nent_optionb.nent_stringcount); notif.nent_floatcount = max(notif.nent_optiona.nent_floatcount, notif.nent_optionb.nent_floatcount); + print(sprintf("INIT NOTIF DEBUG: %d %d\n", notif.nent_stringcount, notif.nent_floatcount)); + print(sprintf("^ optiona: %s %s : %d %d\n", + Get_Notif_TypeName(notif.nent_optiona.nent_type), + notif.nent_optiona.nent_name, + notif.nent_optiona.nent_stringcount, + notif.nent_optiona.nent_floatcount)); } break; } @@ -1152,7 +1160,16 @@ string Local_Notification_sprintf( default: NOTIF_HIT_UNKNOWN(NOTIF_MAX_ARGS, "Local_Notification_sprintf") } } - return sprintf(strcat(input, "\n"), arg_slot[0], arg_slot[1], arg_slot[2], arg_slot[3], arg_slot[4], arg_slot[5], arg_slot[6]); + return sprintf( + strcat(input, "\n"), + arg_slot[0], + arg_slot[1], + arg_slot[2], + arg_slot[3], + arg_slot[4], + arg_slot[5], + arg_slot[6] + ); } #ifdef CSQC @@ -1453,13 +1470,19 @@ void Local_Notification(float net_type, float net_name, ...count) case MSG_CHOICE: { - entity found_choice; - switch(cvar_string(sprintf("notification_%s", notif.nent_name))) + entity found_choice; + + if(notif.nent_challow && (warmup_stage || (notif.nent_challow == 2))) { - case 1: found_choice = notif.nent_optiona; break; - case 2: found_choice = notif.nent_optionb; break; - default: return; // not enabled anyway + switch(cvar_string(sprintf("notification_%s", notif.nent_name))) + { + case 1: found_choice = notif.nent_optiona; break; + case 2: found_choice = notif.nent_optionb; break; + default: return; // not enabled anyway + } } + else { found_choice = notif.nent_optiona; } + Local_Notification_WOVA( found_choice.nent_type, found_choice.nent_id, @@ -1707,6 +1730,26 @@ void Send_Notification( entity notif = Get_Notif_Ent(net_type, net_name); if not(notif) { backtrace("Send_Notification: Could not find notification entity!\n"); return; } + string s1 = ((0 < notif.nent_stringcount) ? ...(0, string) : ""); + string s2 = ((1 < notif.nent_stringcount) ? ...(1, string) : ""); + string s3 = ((2 < notif.nent_stringcount) ? ...(2, string) : ""); + string s4 = ((3 < notif.nent_stringcount) ? ...(3, string) : ""); + float f1 = ((0 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 0), float) : 0); + float f2 = ((1 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 1), float) : 0); + float f3 = ((2 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 2), float) : 0); + float f4 = ((3 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 3), float) : 0); + + #ifdef NOTIFICATIONS_DEBUG + Debug_Notification(sprintf( + "Send_Notification(%d, %s, %s, %s, %s);\n", + broadcast, + Get_Notif_TypeName(net_type), + notif.nent_name, + MakeConsoleSafe(sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)), + sprintf("%d, %d, %d, %d", f1, f2, f3, f4) + )); + #endif + if((notif.nent_stringcount + notif.nent_floatcount) > count) { backtrace(sprintf( @@ -1734,26 +1777,6 @@ void Send_Notification( return; } - string s1 = ((0 < notif.nent_stringcount) ? ...(0, string) : ""); - string s2 = ((1 < notif.nent_stringcount) ? ...(1, string) : ""); - string s3 = ((2 < notif.nent_stringcount) ? ...(2, string) : ""); - string s4 = ((3 < notif.nent_stringcount) ? ...(3, string) : ""); - float f1 = ((0 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 0), float) : 0); - float f2 = ((1 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 1), float) : 0); - float f3 = ((2 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 2), float) : 0); - float f4 = ((3 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 3), float) : 0); - - #ifdef NOTIFICATIONS_DEBUG - Debug_Notification(sprintf( - "Send_Notification(%d, %s, %s, %s, %s);\n", - broadcast, - Get_Notif_TypeName(net_type), - notif.nent_name, - MakeConsoleSafe(sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)), - sprintf("%d, %d, %d, %d", f1, f2, f3, f4) - )); - #endif - if( server_is_dedicated && @@ -1780,8 +1803,8 @@ void Send_Notification( if(net_type == MSG_CHOICE) { - // float verbose_allowed = (autocvar_notification_server_allows_frag_verbose && ((autocvar_notification_server_allows_frag_verbose == 2) || inWarmupStage)); - // THIS GETS TRICKY... now we have to cycle through each possible player (checking broadcast) + // float verbose_allowed = (autocvar_notification_server_allows_frag_verbose && ((autocvar_notification_server_allows_frag_verbose == 2) || warmup_stage)); + // THIS GETS TRICKY... now we have to cycle through each possible player (checking broadcast)nent_challow // and then do an individual NOTIF_ONE_ONLY recursive call for each one depending on their option... // It's slow, but it's better than the alternatives: // 1. Constantly networking all info and letting client decide @@ -1789,17 +1812,23 @@ void Send_Notification( entity found_choice; #define RECURSE_FROM_CHOICE(ent,action) \ - switch(ent.msg_choice_choices[net_name]) \ + if(notif.nent_challow && (warmup_stage || (notif.nent_challow == 2))) \ { \ - case 1: found_choice = notif.nent_optiona; break; \ - case 2: found_choice = notif.nent_optionb; break; \ - default: action; \ + switch(ent.msg_choice_choices[net_name]) \ + { \ + case 1: found_choice = notif.nent_optiona; break; \ + case 2: found_choice = notif.nent_optionb; break; \ + default: action; \ + } \ } \ + else { found_choice = notif.nent_optiona; } \ Send_Notification_WOVA( \ NOTIF_ONE_ONLY, \ ent, \ found_choice.nent_type, \ found_choice.nent_id, \ + found_choice.nent_stringcount, \ + found_choice.nent_floatcount, \ s1, s2, s3, s4, \ f1, f2, f3, f4); @@ -1854,6 +1883,36 @@ void Send_Notification( // WOVA = Without Variable Arguments void Send_Notification_WOVA( + float broadcast, entity client, + float net_type, float net_name, + float stringcount, float floatcount, + string s1, string s2, string s3, string s4, + float f1, float f2, float f3, float f4) +{ + #ifdef NOTIFICATIONS_DEBUG + entity notif = Get_Notif_Ent(net_type, net_name); + Debug_Notification(sprintf( + "Send_Notification_WOVA(%d, %s, %d, %d, %d, %s, %s);\n", + broadcast, + Get_Notif_TypeName(net_type), + notif.nent_name, + stringcount, + floatcount, + MakeConsoleSafe(sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)), + sprintf("%d, %d, %d, %d", f1, f2, f3, f4) + )); + #endif + + #define VARITEM(stringc,floatc,args) \ + if((stringcount == stringc) && (floatcount == floatc)) \ + { Send_Notification(broadcast, client, net_type, net_name, args); return; } + EIGHT_VARS_TO_VARARGS_VARLIST + #undef VARITEM + Send_Notification(broadcast, client, net_type, net_name); // some notifications don't have any arguments at all +} + +// WOCOVA = Without Counts Or Variable Arguments +void Send_Notification_WOCOVA( float broadcast, entity client, float net_type, float net_name, string s1, string s2, string s3, string s4, @@ -1863,7 +1922,7 @@ void Send_Notification_WOVA( #ifdef NOTIFICATIONS_DEBUG Debug_Notification(sprintf( - "Send_Notification_WOVA(%d, %s, %s, %s, %s);\n", + "Send_Notification_WOCOVA(%d, %s, %s, %s, %s);\n", broadcast, Get_Notif_TypeName(net_type), notif.nent_name, diff --git a/qcsrc/common/notifications.qh b/qcsrc/common/notifications.qh index ce0c61831..317642676 100644 --- a/qcsrc/common/notifications.qh +++ b/qcsrc/common/notifications.qh @@ -62,6 +62,7 @@ void Create_Notification_Entity( string durcnt, string normal, string gentle, + float challow, float chtype, float optiona, float optionb); @@ -104,6 +105,12 @@ void Send_Notification( float net_type, float net_name, ...count); void Send_Notification_WOVA( + float broadcast, entity client, + float net_type, float net_name, + float stringcount, float floatcount, + string s1, string s2, string s3, string s4, + float f1, float f2, float f3, float f4); +void Send_Notification_WOCOVA( float broadcast, entity client, float net_type, float net_name, string s1, string s2, string s3, string s4, @@ -705,20 +712,20 @@ void Send_Notification_WOVA( MSG_MULTI_NOTIF(1, WEAPON_UZI_MURDER_SNIPE, NO_MSG, INFO_WEAPON_UZI_MURDER_SNIPE, NO_MSG) \ MSG_MULTI_NOTIF(1, WEAPON_UZI_MURDER_SPRAY, NO_MSG, INFO_WEAPON_UZI_MURDER_SPRAY, NO_MSG) -#define MULTITEAM_CHOICE(default,prefix,teams,chtype,optiona,optionb) \ - MSG_CHOICE_NOTIF(default, prefix##RED, chtype, optiona##RED, optionb##RED) \ - MSG_CHOICE_NOTIF(default, prefix##BLUE, chtype, optiona##BLUE, optionb##BLUE) \ +#define MULTITEAM_CHOICE(default,challow,prefix,teams,chtype,optiona,optionb) \ + MSG_CHOICE_NOTIF(default, challow, prefix##RED, chtype, optiona##RED, optionb##RED) \ + MSG_CHOICE_NOTIF(default, challow, prefix##BLUE, chtype, optiona##BLUE, optionb##BLUE) \ #if teams >= 3 \ - MSG_CHOICE_NOTIF(default, prefix##YELLOW, chtype, optiona##YELLOW, optionb##YELLOW) \ + MSG_CHOICE_NOTIF(default, challow, prefix##YELLOW, chtype, optiona##YELLOW, optionb##YELLOW) \ #endif \ #if teams >= 4 \ - MSG_CHOICE_NOTIF(default, prefix##PINK, chtype, optiona##PINK, optionb##PINK) \ + MSG_CHOICE_NOTIF(default, challow, prefix##PINK, chtype, optiona##PINK, optionb##PINK) \ #endif #define MSG_CHOICE_NOTIFICATIONS \ - MSG_CHOICE_NOTIF(1, CHOICE_FRAG, MSG_CENTER, CENTER_DEATH_MURDER_FRAG, CENTER_DEATH_MURDER_FRAG_VERBOSE) \ - MSG_CHOICE_NOTIF(1, CHOICE_FRAGGED, MSG_CENTER, CENTER_DEATH_MURDER_FRAGGED, CENTER_DEATH_MURDER_FRAGGED_VERBOSE) \ - MSG_CHOICE_NOTIF(1, CHOICE_TYPEFRAG, MSG_CENTER, CENTER_DEATH_MURDER_TYPEFRAG, CENTER_DEATH_MURDER_TYPEFRAG_VERBOSE) \ - MSG_CHOICE_NOTIF(1, CHOICE_TYPEFRAGGED, MSG_CENTER, CENTER_DEATH_MURDER_TYPEFRAGGED, CENTER_DEATH_MURDER_TYPEFRAGGED_VERBOSE) + MSG_CHOICE_NOTIF(1, 1, CHOICE_FRAG, MSG_CENTER, CENTER_DEATH_MURDER_FRAG, CENTER_DEATH_MURDER_FRAG_VERBOSE) \ + MSG_CHOICE_NOTIF(1, 1, CHOICE_FRAGGED, MSG_CENTER, CENTER_DEATH_MURDER_FRAGGED, CENTER_DEATH_MURDER_FRAGGED_VERBOSE) \ + MSG_CHOICE_NOTIF(1, 1, CHOICE_TYPEFRAG, MSG_CENTER, CENTER_DEATH_MURDER_TYPEFRAG, CENTER_DEATH_MURDER_TYPEFRAG_VERBOSE) \ + MSG_CHOICE_NOTIF(1, 1, CHOICE_TYPEFRAGGED, MSG_CENTER, CENTER_DEATH_MURDER_TYPEFRAGGED, CENTER_DEATH_MURDER_TYPEFRAGGED_VERBOSE) //MSG_CHOICE_NOTIF(2, CHOICE_) @@ -1114,6 +1121,7 @@ float NOTIF_CPID_COUNT; .float nent_cpid; .string nent_durcnt; .string nent_string; +.float nent_challow; .entity nent_optiona; .entity nent_optionb; @@ -1157,6 +1165,7 @@ float NOTIF_CPID_COUNT; "", /* durcnt */ \ "", /* normal */ \ "", /* gentle */ \ + NO_MSG, /* challow */ \ NO_MSG, /* chtype */ \ NO_MSG, /* optiona */ \ NO_MSG); /* optionb */ \ @@ -1192,6 +1201,7 @@ float NOTIF_CPID_COUNT; "", /* durcnt */ \ normal, /* normal */ \ gentle, /* gentle */ \ + NO_MSG, /* challow */ \ NO_MSG, /* chtype */ \ NO_MSG, /* optiona */ \ NO_MSG); /* optionb */ \ @@ -1229,6 +1239,7 @@ float NOTIF_CPID_COUNT; durcnt, /* durcnt */ \ normal, /* normal */ \ gentle, /* gentle */ \ + NO_MSG, /* challow */ \ NO_MSG, /* chtype */ \ NO_MSG, /* optiona */ \ NO_MSG); /* optionb */ \ @@ -1264,44 +1275,47 @@ float NOTIF_CPID_COUNT; "", /* durcnt */ \ "", /* normal */ \ "", /* gentle */ \ + NO_MSG, /* challow */ \ NO_MSG, /* chtype */ \ NO_MSG, /* optiona */ \ NO_MSG); /* optionb */ \ } \ ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name) -#define MSG_CHOICE_NOTIF(default,name,chtype,optiona,optionb) \ +#define MSG_CHOICE_NOTIF(default,challow,name,chtype,optiona,optionb) \ NOTIF_ADD_AUTOCVAR(name, default) \ + NOTIF_ADD_AUTOCVAR(name##_ALLOWED, challow) \ float name; \ void RegisterNotification_##name() \ { \ SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_CHOICE_COUNT) \ CHECK_MAX_COUNT(name, NOTIF_CHOICE_MAX, NOTIF_CHOICE_COUNT, "MSG_CHOICE") \ Create_Notification_Entity( \ - default, /* var_default */ \ - autocvar_notification_##name, /* var_cvar */ \ - MSG_CHOICE, /* typeid */ \ - name, /* nameid */ \ - strtoupper(#name), /* namestring */ \ - NO_MSG, /* anncename */ \ - NO_MSG, /* infoname */ \ - NO_MSG, /* centername */ \ - NO_MSG, /* channel */ \ - "", /* snd */ \ - NO_MSG, /* vol */ \ - NO_MSG, /* position */ \ - NO_MSG, /* strnum */ \ - NO_MSG, /* flnum */ \ - "", /* args */ \ - "", /* hudargs */ \ - "", /* icon */ \ - NO_MSG, /* cpid */ \ - "", /* durcnt */ \ - "", /* normal */ \ - "", /* gentle */ \ - chtype, /* chtype */ \ - optiona, /* optiona */ \ - optionb); /* optionb */ \ + default, /* var_default */ \ + autocvar_notification_##name, /* var_cvar */ \ + MSG_CHOICE, /* typeid */ \ + name, /* nameid */ \ + strtoupper(#name), /* namestring */ \ + NO_MSG, /* anncename */ \ + NO_MSG, /* infoname */ \ + NO_MSG, /* centername */ \ + NO_MSG, /* channel */ \ + "", /* snd */ \ + NO_MSG, /* vol */ \ + NO_MSG, /* position */ \ + NO_MSG, /* strnum */ \ + NO_MSG, /* flnum */ \ + "", /* args */ \ + "", /* hudargs */ \ + "", /* icon */ \ + NO_MSG, /* cpid */ \ + "", /* durcnt */ \ + "", /* normal */ \ + "", /* gentle */ \ + autocvar_notification_##name##_ALLOWED, /* challow */ \ + chtype, /* chtype */ \ + optiona, /* optiona */ \ + optionb); /* optionb */ \ } \ ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name) diff --git a/qcsrc/server/accuracy.qc b/qcsrc/server/accuracy.qc index 3c737f6e6..b8b167beb 100644 --- a/qcsrc/server/accuracy.qc +++ b/qcsrc/server/accuracy.qc @@ -109,7 +109,7 @@ void accuracy_add(entity e, float w, float fired, float hit) float accuracy_isgooddamage(entity attacker, entity targ) { - if(!inWarmupStage) + if(!warmup_stage) if(IS_CLIENT(targ)) if(targ.deadflag == DEAD_NO) if(IsDifferentTeam(attacker, targ)) @@ -119,7 +119,7 @@ float accuracy_isgooddamage(entity attacker, entity targ) float accuracy_canbegooddamage(entity attacker) { - if(!inWarmupStage) + if(!warmup_stage) return TRUE; return FALSE; } diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index d7ca62ba0..90a7eeed8 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -170,7 +170,7 @@ void PutObserverInServer (void) if(self.alivetime) { - if(!inWarmupStage) + if(!warmup_stage) PlayerStats_Event(self, PLAYERSTATS_ALIVETIME, time - self.alivetime); self.alivetime = 0; } @@ -424,7 +424,7 @@ void PutClientInServer (void) self.nex_charge = autocvar_g_balance_nex_charge_start; } - if(inWarmupStage) + if(warmup_stage) { self.ammo_shells = warmup_start_ammo_shells; self.ammo_nails = warmup_start_ammo_nails; @@ -593,7 +593,7 @@ void PutClientInServer (void) self.weaponname = ""; self.switchingweapon = 0; - if(!inWarmupStage) + if(!warmup_stage) if(!self.alivetime) self.alivetime = time; diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index fbe6d7aea..4b28f88b8 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -857,7 +857,7 @@ float Say(entity source, float teamsay, entity privatesay, string msgin, float f if not(IS_PLAYER(source)) { if not(intermission_running) - if(teamsay || (autocvar_g_chat_nospectators == 1) || (autocvar_g_chat_nospectators == 2 && !(inWarmupStage || gameover))) + if(teamsay || (autocvar_g_chat_nospectators == 1) || (autocvar_g_chat_nospectators == 2 && !(warmup_stage || gameover))) teamsay = -1; // spectators } diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index ec9c33b19..4850049e5 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -190,7 +190,7 @@ void ClientCommand_ready(float request) // todo: anti-spam for toggling readynes { if(IS_CLIENT(self)) { - if(inWarmupStage || autocvar_sv_ready_restart || g_race_qualifying == 2) + if(warmup_stage || autocvar_sv_ready_restart || g_race_qualifying == 2) { if(!readyrestart_happened || autocvar_sv_ready_restart_repeatable) { diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc index 73bf0df4f..2cbed75d3 100644 --- a/qcsrc/server/command/common.qc +++ b/qcsrc/server/command/common.qc @@ -554,7 +554,7 @@ void CommonCommand_timeout(float request, entity caller) // DEAR GOD THIS COMMAN if(timeout_status) { print_to(caller, "^7Error: A timeout is already active."); } else if(vote_called) { print_to(caller, "^7Error: You can not call a timeout while a vote is active."); } - else if(inWarmupStage && !g_warmup_allow_timeout) { print_to(caller, "^7Error: You can not call a timeout in warmup-stage."); } + else if(warmup_stage && !g_warmup_allow_timeout) { print_to(caller, "^7Error: You can not call a timeout in warmup-stage."); } else if(time < game_starttime) { print_to(caller, "^7Error: You can not call a timeout while the map is being restarted."); } else if(caller && (caller.allowed_timeouts < 1)) { print_to(caller, "^7Error: You already used all your timeout calls for this map."); } else if(caller && !IS_PLAYER(caller)) { print_to(caller, "^7Error: You must be a player to call a timeout."); } diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index c7010dfb7..3a6de430c 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -33,7 +33,7 @@ float Nagger_SendEntity(entity to, float sendflags) if(to.vote_selection == 0) nags |= 8; } - if(inWarmupStage) + if(warmup_stage) nags |= 16; if(sendflags & 64) @@ -191,7 +191,7 @@ void VoteCount(float first_count) vote_accept_count = vote_reject_count = vote_abstain_count = 0; float spectators_allowed = ((autocvar_sv_vote_nospectators != 2) - || ((autocvar_sv_vote_nospectators == 1) && (inWarmupStage || gameover)) + || ((autocvar_sv_vote_nospectators == 1) && (warmup_stage || gameover)) || (autocvar_sv_vote_nospectators == 0)); float vote_player_count = 0, notvoters = 0; @@ -429,7 +429,7 @@ void ReadyRestart_force() restart_mapalreadyrestarted = 0; // reset this var, needed when cvar sv_ready_restart_repeatable is in use // disable the warmup global for the server - inWarmupStage = 0; // once the game is restarted the game is in match stage + warmup_stage = 0; // once the game is restarted the game is in match stage // reset the .ready status of all players (also spectators) FOR_EACH_REALCLIENT(tmp_player) { tmp_player.ready = 0; } @@ -778,7 +778,7 @@ void VoteCommand_call(float request, entity caller, float argc, string vote_comm case CMD_REQUEST_COMMAND: { float spectators_allowed = ((autocvar_sv_vote_nospectators != 2) - || ((autocvar_sv_vote_nospectators == 1) && inWarmupStage) + || ((autocvar_sv_vote_nospectators == 1) && warmup_stage) || (autocvar_sv_vote_nospectators == 0)); float tmp_playercount = 0; @@ -883,7 +883,7 @@ void VoteCommand_master(float request, entity caller, float argc, string vote_co default: // calling a vote for master { float spectators_allowed = ((autocvar_sv_vote_nospectators != 2) - || ((autocvar_sv_vote_nospectators == 1) && inWarmupStage) + || ((autocvar_sv_vote_nospectators == 1) && warmup_stage) || (autocvar_sv_vote_nospectators == 0)); if not(autocvar_sv_vote_master_callable) { print_to(caller, "^1Vote to become vote master is not allowed."); } diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 74d4345b8..2b1826691 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -21,7 +21,7 @@ float g_warmup_limit; float g_warmup_allguns; float g_warmup_allow_timeout; float g_race_qualifying; -float inWarmupStage; +float warmup_stage; float g_pickup_respawntime_weapon; float g_pickup_respawntime_superweapon; float g_pickup_respawntime_ammo; diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 7e764ccf5..6832a54d9 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -143,7 +143,7 @@ void GiveFrags (entity attacker, entity targ, float f, float deathtype) GiveFrags_randomweapons.classname = "GiveFrags_randomweapons"; } - if(inWarmupStage) + if(warmup_stage) WEPSET_COPY_EA(GiveFrags_randomweapons, warmup_start_weapons); else WEPSET_COPY_EA(GiveFrags_randomweapons, start_weapons); @@ -247,7 +247,7 @@ void Obituary_SpecialDeath( { if(deathent.death_msgmurder) { - Send_Notification_WOVA( + Send_Notification_WOCOVA( NOTIF_ONE, notif_target, MSG_MULTI, @@ -255,7 +255,7 @@ void Obituary_SpecialDeath( s1, s2, s3, "", f1, f2, f3, 0 ); - Send_Notification_WOVA( + Send_Notification_WOCOVA( NOTIF_ALL_EXCEPT, notif_target, MSG_INFO, @@ -269,7 +269,7 @@ void Obituary_SpecialDeath( { if(deathent.death_msgself) { - Send_Notification_WOVA( + Send_Notification_WOCOVA( NOTIF_ONE, notif_target, MSG_MULTI, @@ -277,7 +277,7 @@ void Obituary_SpecialDeath( s1, s2, s3, "", f1, f2, f3, 0 ); - Send_Notification_WOVA( + Send_Notification_WOCOVA( NOTIF_ALL_EXCEPT, notif_target, MSG_INFO, @@ -308,7 +308,7 @@ float Obituary_WeaponDeath( if(death_message) { - Send_Notification_WOVA( + Send_Notification_WOCOVA( NOTIF_ONE, notif_target, MSG_MULTI, @@ -316,7 +316,7 @@ float Obituary_WeaponDeath( s1, s2, s3, "", f1, f2, 0, 0 ); - Send_Notification_WOVA( + Send_Notification_WOCOVA( NOTIF_ALL_EXCEPT, notif_target, MSG_INFO, diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index e8b345098..52cf96430 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -1709,7 +1709,7 @@ float WinningCondition_Onslaught() WinningConditionHelper(); // set worldstatus - if(inWarmupStage) + if(warmup_stage) return WINNING_NO; // first check if the game has ended @@ -2102,7 +2102,7 @@ void CheckRules_World() fraglimit = autocvar_fraglimit; leadlimit = autocvar_leadlimit; - if(inWarmupStage || time <= game_starttime) // NOTE: this is <= to prevent problems in the very tic where the game starts + if(warmup_stage || time <= game_starttime) // NOTE: this is <= to prevent problems in the very tic where the game starts { if(timelimit > 0) timelimit = 0; // timelimit is not made for warmup diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index ef05b5a5b..ea0dacdfe 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -806,7 +806,7 @@ void readplayerstartcvars() start_ammo_fuel = cvar("g_start_ammo_fuel"); } - if (inWarmupStage) + if (warmup_stage) { warmup_start_ammo_shells = start_ammo_shells; warmup_start_ammo_nails = start_ammo_nails; @@ -961,13 +961,13 @@ void readlevelcvars(void) sv_autotaunt = cvar("sv_autotaunt"); sv_taunt = cvar("sv_taunt"); - inWarmupStage = cvar("g_warmup"); + warmup_stage = cvar("g_warmup"); g_warmup_limit = cvar("g_warmup_limit"); g_warmup_allguns = cvar("g_warmup_allguns"); g_warmup_allow_timeout = cvar("g_warmup_allow_timeout"); if ((g_race && g_race_qualifying == 2) || g_arena || g_assault || cvar("g_campaign")) - inWarmupStage = 0; // these modes cannot work together, sorry + warmup_stage = 0; // these modes cannot work together, sorry g_pickup_respawntime_weapon = cvar("g_pickup_respawntime_weapon"); g_pickup_respawntime_superweapon = cvar("g_pickup_respawntime_superweapon"); @@ -1033,7 +1033,7 @@ void readlevelcvars(void) if(!g_weapon_stay) g_weapon_stay = cvar("g_weapon_stay"); - if not(inWarmupStage) + if not(warmup_stage) game_starttime = time + cvar("g_start_delay"); readplayerstartcvars(); diff --git a/qcsrc/server/mutators/gamemode_ca.qc b/qcsrc/server/mutators/gamemode_ca.qc index 7c4904565..364396883 100644 --- a/qcsrc/server/mutators/gamemode_ca.qc +++ b/qcsrc/server/mutators/gamemode_ca.qc @@ -100,7 +100,7 @@ float CA_CheckWinner() void CA_RoundStart() { - if(inWarmupStage) + if(warmup_stage) allowed_to_spawn = TRUE; else allowed_to_spawn = FALSE; diff --git a/qcsrc/server/mutators/gamemode_onslaught.qc b/qcsrc/server/mutators/gamemode_onslaught.qc index e4be2d7ab..d9c1bafab 100644 --- a/qcsrc/server/mutators/gamemode_onslaught.qc +++ b/qcsrc/server/mutators/gamemode_onslaught.qc @@ -576,7 +576,7 @@ void onslaught_generator_damage(entity inflictor, entity attacker, float damage, float i; if (damage <= 0) return; - if(inWarmupStage) + if(warmup_stage) return; if (attacker != self) { @@ -614,7 +614,7 @@ void onslaught_generator_damage(entity inflictor, entity attacker, float damage, #endif self.lasthealth = self.health; } - else if not(inWarmupStage) + else if not(warmup_stage) { if (attacker == self) bprint(Team_ColoredFullName(self.team), " generator spontaneously exploded due to overtime!\n"); diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc index 0769a4f03..6a9f866ed 100644 --- a/qcsrc/server/scores.qc +++ b/qcsrc/server/scores.qc @@ -349,7 +349,7 @@ float PlayerScore_Add(entity player, float scorefield, float score) if(score) if(scores_label[scorefield] != "") s.SendFlags |= pow(2, scorefield); - if(!inWarmupStage) + if(!warmup_stage) PlayerStats_Event(s.owner, strcat(PLAYERSTATS_TOTAL, scores_label[scorefield]), score); return (s.(scores[scorefield]) += score); } diff --git a/qcsrc/server/sv_main.qc b/qcsrc/server/sv_main.qc index a9b2443b7..2dc7ab190 100644 --- a/qcsrc/server/sv_main.qc +++ b/qcsrc/server/sv_main.qc @@ -220,7 +220,7 @@ void StartFrame (void) game_delay_last = game_delay; // if in warmup stage and limit for warmup is hit start match - if (inWarmupStage) + if (warmup_stage) if ((g_warmup_limit > 0 && time >= g_warmup_limit) || (g_warmup_limit == 0 && autocvar_timelimit != 0 && time >= autocvar_timelimit * 60)) { -- 2.39.2