Exemplo n.º 1
0
/*
 * G_EndLevel
 *
 * The time limit, frag limit, etc.. has been exceeded.
 */
static void G_EndLevel(void) {
	unsigned int i;

	// try maplist
	if (g_map_list.count > 0) {

		if (g_random_map->value) { // random weighted selection
			g_map_list.index = g_map_list.weighted_index[rand()
					% MAP_LIST_WEIGHT];
		} else { // incremental, so long as wieght is not 0

			i = g_map_list.index;

			while (true) {
				g_map_list.index = (g_map_list.index + 1) % g_map_list.count;

				if (!g_map_list.maps[g_map_list.index].weight)
					continue;

				if (g_map_list.index == i) // wrapped around, all weights were 0
					break;

				break;
			}
		}

		G_BeginIntermission(g_map_list.maps[g_map_list.index].name);
		return;
	}

	// or stay on current level
	G_BeginIntermission(g_level.name);
}
Exemplo n.º 2
0
/*
 * G_CheckVote
 */
static void G_CheckVote(void) {
	int i, count = 0;

	if (!g_voting->value)
		return;

	if (g_level.vote_time == 0)
		return;

	if (g_level.time - g_level.vote_time > MAX_VOTE_TIME) {
		gi.BroadcastPrint(PRINT_HIGH, "Vote \"%s\" expired\n", g_level.vote_cmd);
		G_ResetVote();
		return;
	}

	for (i = 0; i < sv_max_clients->integer; i++) {
		if (!g_game.edicts[i + 1].in_use)
			continue;
		count++;
	}

	if (g_level.votes[VOTE_YES] >= count * VOTE_MAJORITY) { // vote passed

		gi.BroadcastPrint(PRINT_HIGH, "Vote \"%s\" passed\n", g_level.vote_cmd);

		if (!strncmp(g_level.vote_cmd, "map ", 4)) { // special case for map
			G_BeginIntermission(g_level.vote_cmd + 4);
		} else if (!strcmp(g_level.vote_cmd, "restart")) { // and restart
			G_RestartGame(false);
		} else if (!strncmp(g_level.vote_cmd, "mute ", 5)) { // and mute
			G_MuteClient(g_level.vote_cmd + 5, true);
		} else if (!strncmp(g_level.vote_cmd, "unmute ", 7)) {
			G_MuteClient(g_level.vote_cmd + 7, false);
		} else { // general case, just execute the command
			gi.AddCommandString(g_level.vote_cmd);
		}
		G_ResetVote();
	} else if (g_level.votes[VOTE_NO] >= count * VOTE_MAJORITY) { // vote failed
		gi.BroadcastPrint(PRINT_HIGH, "Vote \"%s\" failed\n", g_level.vote_cmd);
		G_ResetVote();
	}
}
Exemplo n.º 3
0
/*
 * @brief The time limit, frag limit, etc.. has been exceeded.
 */
static void G_EndLevel(void) {
	G_BeginIntermission(G_SelectNextmap());
}