// legacy stuff
void Send_CSQC_Centerprint_Generic(entity e, float id, string s, float duration, float countdown_num);
#define Send_CSQC_Centerprint_Generic_Expire(e,id) Send_CSQC_Centerprint_Generic(e, id, "", 1, 0)
-float CPID_KH_MSG = 10;
#endif
MSG_INFO_NOTIF(2, INFO_JOIN_PLAY, 1, 0, "s1", "", "", _("^BG%s^F3 is now playing\n"), "") \
MSG_INFO_NOTIF(1, INFO_KEEPAWAY_DROPPED, 1, 0, "s1", "s1", "notify_balldropped", _("^BG%s^BG has dropped the ball!\n"), "") \
MSG_INFO_NOTIF(1, INFO_KEEPAWAY_PICKUP, 1, 0, "s1", "s1", "notify_ballpickedup", _("^BG%s^BG has picked up the ball!\n"), "") \
+ MSG_INFO_NOTIF(1, INFO_KEYHUNT_CAPTURE, 2, 0, "s1 s2", "", "", _("^BG%s captured the keys for the %s\n"), "") \
+ MSG_INFO_NOTIF(1, INFO_KEYHUNT_DROP, 2, 0, "s1 s2", "", "", _("^BG%s^BG dropped the %s\n"), "") \
+ MSG_INFO_NOTIF(1, INFO_KEYHUNT_LOST, 2, 0, "s1 s2", "", "", _("^BGThe %s^BG could not take care of the %s\n"), "") \
+ MSG_INFO_NOTIF(1, INFO_KEYHUNT_PICKUP, 2, 0, "s1 s2", "", "", _("^BG%s^BG picked up the %s\n"), "") \
MSG_INFO_NOTIF(1, INFO_LMS_NOLIVES, 1, 0, "s1", "", "", _("^BG%s^F3 has no more lives left\n"), "") \
MSG_INFO_NOTIF(1, INFO_LMS_FORFEIT, 1, 0, "s1", "", "", _("^BG%s^F3 forfeited\n"), "") \
MSG_INFO_NOTIF(1, INFO_POWERUP_INVISIBILITY, 1, 0, "s1", "s1", "strength", _("^BG%s^K1 picked up Invisibility\n"), "") \
MSG_CENTER_NOTIF(1, CENTER_KEEPAWAY_DROPPED, 1, 0, "s1", CPID_KEEPAWAY, "0 0", _("^BG%s^BG has dropped the ball!"), "") \
MSG_CENTER_NOTIF(1, CENTER_KEEPAWAY_PICKUP, 1, 0, "s1", CPID_KEEPAWAY, "0 0", _("^BG%s^BG has picked up the ball!"), "") \
MSG_CENTER_NOTIF(1, CENTER_KEEPAWAY_WARN, 0, 0, "", CPID_KA_WARN, "0 0", _("^BGKilling people while you don't have the ball gives no points!"), "") \
+ MSG_CENTER_NOTIF(1, CENTER_KEYHUNT_HELP, 0, 0, "", CPID_KEYHUNT, "0 0", _("^BGAll keys are in your team's hands!"), _("Help the key carriers to meet!")) \
+ MSG_CENTER_NOTIF(1, CENTER_KEYHUNT_INTERFERE, 1, 0, "s1", CPID_KEYHUNT, "0 0", _("^BGAll keys are in %s's hands!"), _("Interfere ^F4NOW^BG!")) \
+ MSG_CENTER_NOTIF(1, CENTER_KEYHUNT_MEET, 0, 0, "", CPID_KEYHUNT, "0 0", _("^BGAll keys are in your team's hands!"), _("Meet the other key carriers ^F4NOW^BG!")) \
+ MSG_CENTER_NOTIF(1, CENTER_KEYHUNT_SCAN, 0, 0, "", CPID_KEYHUNT, "-1 0", _("^BGScanning frequency range..."), "") \
+ MSG_CENTER_NOTIF(1, CENTER_KEYHUNT_START, 1, 0, "s1", CPID_KEYHUNT, "0 0", _("^BGYou are starting with the %s"), "") \
+ MSG_CENTER_NOTIF(1, CENTER_KEYHUNT_WAIT, 1, 0, "s1", CPID_KEYHUNT, "-1 0", _("^BGWaiting for players to join..."), _("Need active players for: %s")) \
MSG_CENTER_NOTIF(1, CENTER_LMS_CAMPCHECK, 0, 0, "", CPID_LMS_CAMP, "0 0", _("^F2Don't camp!"), "") \
MSG_CENTER_NOTIF(1, CENTER_MOTD, 1, 0, "s1", CPID_MOTD, "-1 0", _("^BG%s"), "") \
MSG_CENTER_NOTIF(1, CENTER_MINSTA_FINDAMMO, 0, 0, "", CPID_MINSTA_FINDAMMO, "1 9", _("^F4^COUNT^BG left to find some ammo!"), "") \
- MSG_CENTER_NOTIF(1, CENTER_MINSTA_FINDAMMO_FIRST, 0, 0, "", CPID_MINSTA_FINDAMMO, "1 10", _("^BGGet some ammo or you'll be dead in ^F4^COUNT^BG!"), _("Get some ammo! ^F4^COUNT^BG left!")) \
+ MSG_CENTER_NOTIF(1, CENTER_MINSTA_FINDAMMO_FIRST, 0, 0, "", CPID_MINSTA_FINDAMMO, "1 10", _("^BGGet some ammo or you'll be dead in ^F4^COUNT^BG!"), _("^BGGet some ammo! ^F4^COUNT^BG left!")) \
MSG_CENTER_NOTIF(1, CENTER_NIX_COUNTDOWN, 0, 2, "item_wepname", CPID_NIX, "1 f2", _("^F2^COUNT^BG until weapon change...\nNext weapon: ^F1%s"), "") \
MSG_CENTER_NOTIF(1, CENTER_NIX_NEWWEAPON, 0, 1, "item_wepname", CPID_NIX, "0 0", _("^F2Active weapon: ^F1%s"), "") \
MSG_CENTER_NOTIF(1, CENTER_JOIN_NOSPAWNS, 0, 0, "", CPID_PREVENT_JOIN, "0 0", _("^K1No spawnpoints available!\nHope your team can fix it..."), "") \
ARG_CASE(ARG_DC, "item_centime", ftos(autocvar_notification_item_centerprinttime)) \
ARG_CASE(ARG_SV, "death_team", Team_ColoredFullName(f1)) \
ARG_CASE(ARG_CS, "death_team", Team_ColoredFullName(f1 - 1)) \
+ ARG_CASE(ARG_CS, "kh_teams", notif_arg_kh_teams(f1, f2, f3, f4)) \
ARG_CASE(ARG_CS_SV, "race_time", mmssss(f2)) \
ARG_CASE(ARG_CS_SV, "race_diff", ((f2 > f3) ? sprintf(CCR("^1[+%s]"), mmssss(f2 - f3)) : sprintf(CCR("^2[-%s]"), mmssss(f3 - f2))))
SPREE_ITEM(30, 30, _("ARMAGEDDON! "), _("%s^K1 unleashes ARMAGEDDON! %s^BG"), _("%s^K1 made THIRTY SCORES IN A ROW! %s^BG"))
#ifdef CSQC
+string notif_arg_kh_teams(float f1, float f2, float f3, float f4)
+{
+ return sprintf("%s%s%s%s",
+ (f1 ?
+ sprintf("%s%s", Team_ColoredFullName(f1), ((f2 + f3 + f4) ? ", " : ""))
+ :
+ ""
+ ),
+ (f2 ?
+ sprintf("%s%s", Team_ColoredFullName(f2), ((f3 + f4) ? ", " : ""))
+ :
+ ""
+ ),
+ (f3 ?
+ sprintf("%s%s", Team_ColoredFullName(f3), (f4 ? ", " : ""))
+ :
+ ""
+ ),
+ (f4 ?
+ Team_ColoredFullName(f4)
+ :
+ ""
+ )
+ );
+}
+
string notif_arg_spree_cen(float spree)
{
// 0 = off, 1 = target (but only for first victim) and attacker
vector KH_KEY_MAX = '10 10 3';
float KH_KEY_BRIGHTNESS = 2;
-string kh_Controller_Waitmsg;
float kh_no_radar_circles;
// kh_state
var kh_Think_t kh_Controller_Thinkfunc;
-void kh_Controller_SetThink(float t, string msg, float centerprint_duration, kh_Think_t func) // runs occasionaly
+void kh_Controller_SetThink(float t, kh_Think_t func) // runs occasionaly
{
kh_Controller_Thinkfunc = func;
kh_controller.cnt = ceil(t);
- if(kh_Controller_Waitmsg != "")
- strunzone(kh_Controller_Waitmsg);
- if(msg == "")
- kh_Controller_Waitmsg = "";
- else
- {
- kh_controller.kh_cp_duration = centerprint_duration;
- kh_Controller_Waitmsg = strzone(msg);
- }
if(t == 0)
kh_controller.nextthink = time; // force
}
-void kh_Controller_SetThink_NoMsg(float t, kh_Think_t func) // runs occasionaly
-{
- kh_Controller_SetThink(t, "", 0, func);
-}
void kh_Controller_Think() // called a lot
{
- entity e;
if(intermission_running)
return;
- if(self.cnt > 0)
- {
- if(kh_Controller_Waitmsg != "")
- {
- string s;
- if(substring(kh_Controller_Waitmsg, strlen(kh_Controller_Waitmsg)-1, 1) == " ")
- s = strcat(kh_Controller_Waitmsg, ftos(self.cnt));
- else
- s = kh_Controller_Waitmsg;
-
- //dprint(s, "\n");
-
- FOR_EACH_PLAYER(e)
- if(clienttype(e) == CLIENTTYPE_REAL)
- Send_CSQC_Centerprint_Generic(e, CPID_KH_MSG, s, self.kh_cp_duration, 0);
- }
- self.cnt -= 1;
- }
- else if(self.cnt == 0)
- {
- self.cnt -= 1;
- kh_Controller_Thinkfunc();
- }
self.nextthink = time + 1;
}
PlayerScore_Add(player, SP_KH_PICKUPS, 1);
}
key.kh_dropperteam = 0;
- bprint(player.netname, "^7 picked up the ", key.netname, "\n");
+ Send_Notification(NOTIF_ANY, world, MSG_INFO, INFO_KEYHUNT_PICKUP, player.netname, key.netname);
kh_Key_AssignTo(key, player); // this also updates .kh_state
}
kh_Key_Remove(key);
kh_no_radar_circles = FALSE;
- kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_round, "Round starts in ", 1, kh_StartRound);
+ Send_Notification(NOTIF_ANY, world, MSG_CENTER, CENTER_ARENA_ROUNDSTART, autocvar_g_balance_keyhunt_delay_round);
+ kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_round, kh_StartRound);
}
void kh_WinnerTeam(float teem) // runs when a team wins
}
first = TRUE;
+ string keyowner = "";
FOR_EACH_KH_KEY(key)
if(key.owner.kh_next == key)
{
if(!first)
- bprint("^7, ");
- bprint(key.owner.netname);
+ keyowner = strcat(keyowner, ", ");
+ keyowner = key.owner.netname;
first = FALSE;
}
- bprint("^7 captured the keys for the ", Team_ColoredFullName(teem), "\n");
+
+ Send_Notification(NOTIF_ANY, world, MSG_INFO, INFO_KEYHUNT_CAPTURE, keyowner, Team_ColoredFullName(teem));
first = TRUE;
midpoint = '0 0 0';
// don't actually GIVE him the -nn points, just log
kh_Scores_Event(attacker, world, "push", autocvar_g_balance_keyhunt_score_push, 0);
PlayerScore_Add(attacker, SP_KH_PUSHES, 1);
- centerprint(attacker, "Your push is the best!");
- bprint("The ", Team_ColoredFullName(teem), "^7 could not take care of the ", lostkey.netname, "^7 when ", attacker.netname, "^7 came\n");
+ //centerprint(attacker, "Your push is the best!"); // does this really need to exist?
}
else
{
--j;
}
-
- bprint("The ", Team_ColoredFullName(teem), "^7 could not take care of the ", lostkey.netname, "\n");
}
+
+ Send_Notification(NOTIF_ANY, world, MSG_INFO, INFO_KEYHUNT_LOST, Team_ColoredFullName(teem), lostkey.netname);
+
play2all(kh_sound_destroy);
te_tarexplosion(lostkey.origin);
{
if(head.team == kh_interferemsg_team)
if(head.kh_next)
- Send_CSQC_Centerprint_Generic(head, CPID_KH_MSG, "All keys are in your team's hands!\n\nMeet the other key carriers ^1NOW^7!", 0, 0);
+ Send_Notification(NOTIF_ONE, head, MSG_CENTER, CENTER_KEYHUNT_MEET);
else
- Send_CSQC_Centerprint_Generic(head, CPID_KH_MSG, "All keys are in your team's hands!\n\nHelp the key carriers to meet!", 0, 0);
+ Send_Notification(NOTIF_ONE, head, MSG_CENTER, CENTER_KEYHUNT_HELP);
else
- Send_CSQC_Centerprint_Generic(head, CPID_KH_MSG, strcat("All keys are in the ", Team_ColoredFullName(kh_interferemsg_team), "^7's hands!\n\nInterfere ^1NOW^7!"), 0, 0);
+ Send_Notification(NOTIF_ONE, head, MSG_CENTER, CENTER_KEYHUNT_INTERFERE, Team_ColoredFullName(kh_interferemsg_team));
}
}
key.kh_worldkeynext = kh_worldkeylist;
kh_worldkeylist = key;
- centerprint(initial_owner, strcat("You are starting with the ", key.netname, "\n")); // message to player at start of round
+ Send_Notification(NOTIF_ONE, initial_owner, MSG_CENTER, CENTER_KEYHUNT_START, key.netname);
WaypointSprite_Spawn("key-dropped", 0, 0, key, '0 0 1' * KH_KEY_WP_ZSHIFT, world, key.team, key, waypointsprite_attachedforcarrier, FALSE, RADARICON_FLAG, '0 1 1');
key.waypointsprite_attachedforcarrier.waypointsprite_visible_for_player = kh_Key_waypointsprite_visible_for_player;
kh_Scores_Event(player, key, "dropkey", 0, 0);
PlayerScore_Add(player, SP_KH_LOSSES, 1);
- bprint(player.netname, "^7 dropped the ", key.netname, "\n");
+ Send_Notification(NOTIF_ANY, world, MSG_INFO, INFO_KEYHUNT_DROP, player.netname, key.netname);
+
kh_Key_AssignTo(key, world);
makevectors(player.v_angle);
key.velocity = W_CalculateProjectileVelocity(player.velocity, autocvar_g_balance_keyhunt_throwvelocity * v_forward, FALSE);
{
kh_Scores_Event(player, key, "losekey", 0, 0);
PlayerScore_Add(player, SP_KH_LOSSES, 1);
- bprint(player.netname, "^7 died and lost the ", key.netname, "\n");
+ Send_Notification(NOTIF_ANY, world, MSG_INFO, INFO_KEYHUNT_LOST, player.netname, key.netname);
kh_Key_AssignTo(key, world);
makevectors('-1 0 0' * (45 + 45 * random()) + '0 360 0' * random());
key.velocity = W_CalculateProjectileVelocity(player.velocity, autocvar_g_balance_keyhunt_dropvelocity * v_forward, FALSE);
if(time < game_starttime)
{
- kh_Controller_SetThink_NoMsg(game_starttime - time + 0.1, kh_WaitForPlayers);
+ kh_Controller_SetThink(game_starttime - time + 0.1, kh_WaitForPlayers);
return;
}
teams_missing = kh_CheckEnoughPlayers();
if(teams_missing == "")
- kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_round, "Round starts in ", 1, kh_StartRound);
+ {
+ Send_Notification(NOTIF_ANY, world, MSG_CENTER, CENTER_ARENA_ROUNDSTART, autocvar_g_balance_keyhunt_delay_round);
+ kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_round, kh_StartRound);
+ }
else
- kh_Controller_SetThink(1, strcat("Waiting for players to join...\n\nNeed active players for: ", teams_missing), -1, kh_WaitForPlayers);
+ {
+ Send_Notification(NOTIF_ANY, world, MSG_CENTER, CENTER_KEYHUNT_WAIT, teams_missing);
+ kh_Controller_SetThink(1, kh_WaitForPlayers);
+ }
}
void kh_EnableTrackingDevice() // runs after each round
{
- entity player;
-
- FOR_EACH_PLAYER(player)
- if(clienttype(player) == CLIENTTYPE_REAL)
- Send_CSQC_Centerprint_Generic_Expire(player, CPID_KH_MSG);
+ Kill_Notification(NOTIF_ANY, world, MSG_CENTER, CENTER_KEYHUNT_HELP);
kh_tracking_enabled = TRUE;
}
if(time < game_starttime)
{
- kh_Controller_SetThink_NoMsg(game_starttime - time + 0.1, kh_WaitForPlayers);
+ kh_Controller_SetThink(game_starttime - time + 0.1, kh_WaitForPlayers);
return;
}
teams_missing = kh_CheckEnoughPlayers();
if(teams_missing != "")
{
- kh_Controller_SetThink(1, strcat("Waiting for players to join...\n\nNeed active players for: ", teams_missing), -1, kh_WaitForPlayers);
+ kh_Controller_SetThink(1, kh_WaitForPlayers);
+ Send_Notification(NOTIF_ANY, world, MSG_CENTER, CENTER_KEYHUNT_WAIT, teams_missing);
return;
}
-
- FOR_EACH_PLAYER(player)
- if(clienttype(player) == CLIENTTYPE_REAL)
- Send_CSQC_Centerprint_Generic_Expire(player, CPID_KH_MSG);
+
+ Kill_Notification(NOTIF_ANY, world, MSG_CENTER, CENTER_KEYHUNT_HELP);
for(i = 0; i < kh_teams; ++i)
{
}
kh_tracking_enabled = FALSE;
- kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_tracking, "Scanning frequency range...", -1, kh_EnableTrackingDevice);
+ Send_Notification(NOTIF_ANY, world, MSG_CENTER, CENTER_KEYHUNT_SCAN);
+ kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_tracking, kh_EnableTrackingDevice);
}
float kh_HandleFrags(entity attacker, entity targ, float f) // adds to the player score
// make a KH entity for controlling the game
kh_controller = spawn();
kh_controller.think = kh_Controller_Think;
- kh_Controller_SetThink_NoMsg(0, kh_WaitForPlayers);
+ kh_Controller_SetThink(0, kh_WaitForPlayers);
setmodel(kh_controller, "models/keyhunt/key.md3");
kh_key_dropped = kh_controller.modelindex;