/// \brief Number of kills needed to advance to the next weapon.
int autocvar_g_gg_kills_per_weapon;
-int gungame_max_level; ///< Player who reaches this level wins.
+int gungame_win_level; ///< Player who reaches this level wins.
string gungame_weapons; ///< Holds weapons corresponding to levels.
entity gungame_leading_player; ///< Holds the leading player.
void GunGame_Reset()
{
strcpy(gungame_weapons, cvar_string(GUNGAME_WEAPONS_CVAR));
- gungame_max_level = tokenize_console(gungame_weapons) *
+ gungame_win_level = tokenize_console(gungame_weapons) *
autocvar_g_gg_kills_per_weapon;
- if (gungame_max_level == 0)
+ if (gungame_win_level == 0)
{
LOG_FATAL("GunGame: Invalid weapon configuration.");
}
- GameRules_limit_score(gungame_max_level);
+ GameRules_limit_score(gungame_win_level);
gungame_leading_player = NULL;
gungame_leading_level = 0;
gungame_leading_weapon = GunGame_GetWeapon(0);
entity GunGame_GetWeapon(int level)
{
- if (level >= gungame_max_level)
+ if (level >= gungame_win_level)
{
return NULL;
}
void GunGame_GivePlayerWeapon(entity player)
{
int level = GunGame_GetPlayerLevel(player);
- if (level >= gungame_max_level)
+ if (level >= gungame_win_level)
{
return;
}
entity weapon = GunGame_GetWeapon(level);
STAT(WEAPONS, player) |= weapon.m_wepset;
- Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_GUNGAME_NEW_LEVEL,
- level + 1, weapon.m_id);
- Send_Notification(NOTIF_ONE, player, MSG_INFO, INFO_GUNGAME_NEW_LEVEL,
- level + 1, weapon.m_id);
+ int levels_left = gungame_win_level - level;
+ if (levels_left > 3)
+ {
+ Send_Notification(NOTIF_ONE, player, MSG_CENTER,
+ CENTER_GUNGAME_NEW_LEVEL, level + 1, weapon.m_id);
+ Send_Notification(NOTIF_ONE, player, MSG_INFO, INFO_GUNGAME_NEW_LEVEL,
+ level + 1, weapon.m_id);
+ return;
+ }
+ if (levels_left > 1)
+ {
+ Send_Notification(NOTIF_ONE, player, MSG_CENTER,
+ CENTER_GUNGAME_LEVELS_LEFT, levels_left, weapon.m_id);
+ Send_Notification(NOTIF_ONE, player, MSG_INFO, INFO_GUNGAME_LEVELS_LEFT,
+ levels_left, weapon.m_id);
+ return;
+ }
+ Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_GUNGAME_LAST_LEVEL,
+ weapon.m_id);
+ Send_Notification(NOTIF_ONE, player, MSG_INFO, INFO_GUNGAME_LAST_LEVEL,
+ weapon.m_id);
}
//============================= Hooks ========================================
GunGame_UpdateLeadingPlayer();
entity attacker = M_ARGV(1, entity);
if (!IS_PLAYER(attacker) || IS_DEAD(attacker) || (GunGame_GetPlayerLevel(
- attacker) >= gungame_max_level))
+ attacker) >= gungame_win_level))
{
return;
}
MSG_INFO_NOTIF(GODMODE_OFF, N_CONSOLE, 0, 1, "f1", "", "", _("^BGGodmode saved you %s units of damage, cheater!"), "")
MSG_INFO_NOTIF(GUNGAME_NEW_LEVEL, N_CONSOLE, 0, 2, "f1 item_wepname2", "", "", _("^BGYou are on level %s: ^F1%s"), "")
+ MSG_INFO_NOTIF(GUNGAME_LEVELS_LEFT, N_CONSOLE, 0, 2, "f1 item_wepname2", "", "", _("^BG%s levels left: ^F1%s"), "")
+ MSG_INFO_NOTIF(GUNGAME_LAST_LEVEL, N_CONSOLE, 0, 1, "item_wepname", "", "", _("^BGLAST LEVEL: ^F1%s"), "")
MSG_INFO_NOTIF(ITEM_BUFF, N_CONSOLE, 1, 1, "s1 item_buffname", "", "", _("^BG%s^BG got the %s^BG buff!"), "")
MSG_INFO_NOTIF(ITEM_BUFF_LOST, N_CONSOLE, 1, 1, "s1 item_buffname", "", "", _("^BG%s^BG lost the %s^BG buff!"), "")
MSG_CENTER_NOTIF(FREEZETAG_SPAWN_LATE, N_ENABLE, 0, 0, "", CPID_Null, "0 0", _("^K1Round already started, you spawn as frozen"), "")
MSG_CENTER_NOTIF(GUNGAME_NEW_LEVEL, N_ENABLE, 0, 2, "f1 item_wepname2", CPID_Null, "0 0", _("^F2Level %s: ^F1%s"), "")
+ MSG_CENTER_NOTIF(GUNGAME_LEVELS_LEFT, N_ENABLE, 0, 2, "f1 item_wepname2", CPID_Null, "0 0", _("^F2%s levels left: ^F1%s"), "")
+ MSG_CENTER_NOTIF(GUNGAME_LAST_LEVEL, N_ENABLE, 0, 1, "item_wepname", CPID_Null, "0 0", _("^F2LAST LEVEL: ^F1%s"), "")
MSG_CENTER_NOTIF(INVASION_SUPERMONSTER, N_ENABLE, 1, 0, "s1", CPID_Null, "0 0", _("^K1A %s has arrived!"), "")