コード例 #1
0
void createContextMenu() {
  // destroy old menu
  if(menu_now_playing != NULL)  Menu_Destroy(menu_now_playing);
  
  // create new menu
  menu_now_playing = Menu_Create(fnt_silkscreen_8, 64, 32); 
  Menu_SetAutoIO(menu_now_playing, 1);

  parseCurrentStation();
  
  Menu_AddItem(menu_now_playing, _lng(CANCEL));
  Menu_AddItem(menu_now_playing, _lng(SNOOZE));
  if(!NowPlaying_IsFavorite) Menu_AddItem(menu_now_playing, _lng(AS_FAVORITE));
}
コード例 #2
0
// ---------------------------------------------------------------------------
void exit_Settings() {
  Menu_Destroy(menu_settings);
}
コード例 #3
0
// ---------------------------------------------------------------------------
void exit_WifiScan() {
  Menu_Destroy(menu_wifi_scan);
}
コード例 #4
0
// ---------------------------------------------------------------------------
void exit_NowPlaying() {
  Menu_Destroy(menu_now_playing);
}
コード例 #5
0
ファイル: l_vote.c プロジェクト: mattayres/li2mod
void Vote_RunFrame(void) {
	int i;
	edict_t *cl_ent;
	static int last_time;
	qboolean stop = false;
	qboolean pass = false;
	qboolean timeup = false;

	if(!voting) {
		last_time = 0;
		return;
	}

	if(level.time - last_time < 1)
		return;

	last_time = level.time;

	vote_need = mapvote_need->value * Vote_CountPlaying() / 100 - 0.001;
	vote_pass = mapvote_pass->value * Vote_CountPlaying() / 100 - 0.001;

	vote_yes = 0;
	vote_no = 0;

	for(i = 0; i < game.maxclients; i++) {
		cl_ent = g_edicts + 1 + i;
		if(!cl_ent->inuse)
			continue;
		if(!cl_ent->lclient)
			continue;
		if(!Vote_IsPlaying(cl_ent))
			continue;
		if(cl_ent->lclient->vote == 0)
			vote_no++;
		else if(cl_ent->lclient->vote == 1)
			vote_yes++;
	}

	pass = vote_yes + vote_no > vote_need && vote_yes > vote_pass;

	if(mapvote_time->value - level.time + vote_time < 0)
		timeup = true;

	if(pass || vote_cancel || timeup || level.intermissiontime)
		stop = true;

	for(i = 0; i < game.maxclients; i++) {
		cl_ent = g_edicts + 1 + i;
		if(!cl_ent->inuse)
			continue;
		if(stop)
			Menu_Destroy(cl_ent);
		else {
			// semi-hacky stuff here...
			if(cl_ent->menu && cl_ent->menu->firstline && cl_ent->menu->firstline->next && !strcmp(cl_ent->menu->firstline->next->text, "Map Vote")) {
				qboolean lastline;
				if(cl_ent->menu->sel == cl_ent->menu->lastline)
					lastline = 1;
				else
					lastline = 0;
				Vote_Menu(cl_ent);
				if(cl_ent->lclient->vote == -1 || cl_ent == vote_ent) {
					if(lastline)
						cl_ent->menu->sel = cl_ent->menu->lastline;
					else
						cl_ent->menu->sel = cl_ent->menu->lastline->prev;
				}
			}
		}
	}

	if(stop) {
		if(vote_cancel)
			gi.bprintf(PRINT_HIGH, "%s has canceled the map vote.\n", vote_ent->client->pers.netname);
		else if(timeup)
			gi.bprintf(PRINT_HIGH, "Voting time up, no map change.\n");
		else if(pass) {
			gi.bprintf(PRINT_HIGH, "Voting passed, new map set: %s.\n", vote_map);
			Mapqueue_Override(vote_map);
			if(vote_instant)
				end_time = level.time + 0.5;
		}
		voting = false;
		vote_ent = NULL;
		vote_cancel = false;
	}
}