예제 #1
0
void antilag( )
{
    int votes;
	
	if ( match_in_progress )
	{
        G_sprint(self, 2, "%s mode %s\n", redtext("Antilag"), OnOff(2 == cvar("sv_antilag")));
        return;
	}

	// admin may turn this status alone on server...
	if ( !is_adm( self ) )
	{
		// Dont need to bother if less than 2 players
		if ( CountPlayers() < 2 )
		{
			G_sprint(self, 2, "You need at least 2 players to do this.\n");
			return;
		}
	}

	self->v.antilag = !self->v.antilag;

	G_bprint(2, "%s %s!%s\n", self->s.v.netname, 
			(self->v.antilag ? redtext(va("votes for antilag %s", OnOff(!(2 == cvar("sv_antilag"))))) : 
							   redtext(va("withdraws %s antilag vote", g_his(self)))),
			((votes = get_votes_req( OV_ANTILAG, true )) ? va(" (%d)", votes) : ""));

	vote_check_antilag ();
}
예제 #2
0
void Menu::optionsMenu()
{
	int selection;
	cout << '\n';
	do {
		stringstream output;
		output << "Options menu:\n 1. Always display area discription after moving:  " << OnOff(DisplayDescription)
			<< "\n 2. Always display actions on a new turn:  " << OnOff(DisplayActions)
			<< "\n 3. Show item descriptions in inventory screen:  " << OnOff(UtilitiesOptions::getDisplayItemDescriptions())
			<< "\n 4. Set screen dimensions:  " << UtilitiesOptions::getScreenWidth() << 'x' << UtilitiesOptions::getScreenHeight()
			<< "\n 0. Return to main menu.\n";
		display(output.str());
		selection = getSelection();
		switch (selection) {
			case 0:
				break;
			case 1:
				DisplayDescription = (DisplayDescription ? false : true);
				if (DisplayDescription)
					display("\nDescriptions will now always be displayed upon moving.\n");
				else
					display("\nDescriptions will now only be displayed when the \"observe\" command is entered.\n");
				break;
			case 3:
				UtilitiesOptions::setDisplayItemDescriptions(UtilitiesOptions::getDisplayItemDescriptions() ? false : true);
				if (UtilitiesOptions::getDisplayItemDescriptions())
					display("\nThe inventory screen will now show item descriptions.\n");
				else
					display("\nThe inventory screen will now only show item names and quantities.\n");
				break;
			case 2:
				DisplayActions = (DisplayActions ? false : true);
				if (DisplayActions)
					display("\nActions will now always be displayed at the beginning of a turn.\n");
				else
					display("\nActions will now only be displayed when the \"actions\" command is entered.\n");
				break;
			case 4:
				int input;
				cout << "\nEnter screen width:\n";
				input = getSelection();
				if (input < 80)
					cout << "Screen width too short.\n";
				else
					UtilitiesOptions::setScreenWidth((unsigned int) input);
				cout << "Enter screen height:\n";
				input = getSelection();
				if (input < 24)
					cout << "Screen height too short.\n";
				else
					UtilitiesOptions::setScreenHeight((unsigned int) input);
				cout << "Screen dimensions set to " << UtilitiesOptions::getScreenWidth() << 'x' << UtilitiesOptions::getScreenHeight() << ".\n";
				break;
			default:
				cout << "Invalid selection.  Try again.\n";
		}
		if (selection != 0)
			cout << '\n';
	} while (selection != 0);
}
예제 #3
0
void nospecs( )
{
    int votes;
	
	if ( match_in_progress )
	{
        G_sprint(self, 2, "%s mode %s\n", redtext("No spectators"), OnOff(cvar("_k_nospecs")));
        return;
	}

	// admin may turn this status alone on server...
	if ( !is_adm( self ) )
	{
		// Dont need to bother if less than 2 players
		if ( CountPlayers() < 2 )
		{
			G_sprint(self, 2, "You need at least 2 players to do this.\n");
			return;
		}
	}

	self->v.nospecs = !self->v.nospecs;

	G_bprint(2, "%s %s!%s\n", self->s.v.netname, 
			(self->v.nospecs ? redtext(va("votes for nospecs %s", OnOff(!cvar("_k_nospecs")))) : 
							   redtext(va("withdraws %s nospecs vote", g_his(self)))),
			((votes = get_votes_req( OV_NOSPECS, true )) ? va(" (%d)", votes) : ""));

	vote_check_nospecs ();
}
예제 #4
0
void vote_check_antilag ()
{
	int veto;

	if ( match_in_progress || intermission_running || match_over )
		return;

	if ( !get_votes( OV_ANTILAG ) )
		return;

	veto = is_admins_vote( OV_ANTILAG );

	if( veto || !get_votes_req( OV_ANTILAG, true ) )
	{
		vote_clear( OV_ANTILAG );

		// toggle antilag mode.
		trap_cvar_set_float( "sv_antilag", (float)(cvar( "sv_antilag" ) ? 0 : 2));

		if ( veto )
			G_bprint(2, "%s\n", redtext(va("Antilag mode %s by admin veto", OnOff(2 == cvar("sv_antilag")))));
		else
			G_bprint(2, "%s\n", redtext(va("Antilag mode %s by majority vote", OnOff(2 == cvar("sv_antilag")))));

		return;
	}
}
예제 #5
0
// { votecoop
void vote_check_coop ()
{
	int veto;

	if ( ( deathmatch && match_in_progress ) || intermission_running || match_over )
		return;

	if ( !get_votes( OV_COOP ) )
		return;

	veto = is_admins_vote( OV_COOP );

	if( veto || !get_votes_req( OV_COOP, true ) )
	{
		vote_clear( OV_COOP );

		// toggle coop mode
		cvar_fset( "coop", coop = !cvar("coop") );
		// set appropriate deathmatch
		cvar_fset( "deathmatch", deathmatch = !coop );

		if ( veto )
			G_bprint( 2, "%s\n", redtext(va("Coop mode %s by admin veto", OnOff(cvar("coop")))) );
		else
			G_bprint( 2, "%s\n", redtext(va("Coop mode %s by majority vote", OnOff(cvar("coop")))) );

		// and reload map
		if ( cvar("k_bloodfest") )
			changelevel( coop ? g_globalvars.mapname : cvar_string( "k_defmap" ) );
		else
			changelevel( coop ? "start" : g_globalvars.mapname );
			
		return;
	}
}
예제 #6
0
파일: vote.c 프로젝트: deurk/ktx
void teamoverlay( )
{
    int votes;

    if ( match_in_progress )
    {
        G_sprint(self, 2, "%s %s\n", redtext("Teamoverlay"), OnOff(cvar("k_teamoverlay")));
        return;
    }

	// admin may turn this status alone on server...
	if ( !is_adm( self ) )
	{
		// Dont need to bother if less than 2 players
		if ( CountPlayers() < 2 )
		{
			G_sprint(self, 2, "You need at least 2 players to do this.\n");
			return;
		}
	}

	self->v.teamoverlay = !self->v.teamoverlay;

	G_bprint(2, "%s %s!%s\n", self->netname, 
			(self->v.teamoverlay ? redtext(va("votes for teamoverlay %s", OnOff(!cvar("k_teamoverlay")))) : 
							       redtext(va("withdraws %s teamoverlay vote", g_his(self)))),
			((votes = get_votes_req( OV_TEAMOVERLAY, true )) ? va(" (%d)", votes) : ""));

    vote_check_teamoverlay ();
}
예제 #7
0
파일: vote.c 프로젝트: deurk/ktx
void vote_check_teamoverlay ()
{
	int veto;

	if ( match_in_progress || intermission_running || match_over )
		return;

	if ( !get_votes( OV_TEAMOVERLAY ) )
		return;

	veto = is_admins_vote( OV_TEAMOVERLAY );

	if( veto || !get_votes_req( OV_TEAMOVERLAY, true ) )
	{
		vote_clear( OV_TEAMOVERLAY );

		// Toggle teamoverlay.
		cvar_fset("k_teamoverlay", !cvar("k_teamoverlay"));

		if ( veto )
			G_bprint(2, "%s\n", redtext(va("Teamoverlay %s by admin veto", OnOff(cvar("k_teamoverlay")))));
		else
			G_bprint(2, "%s\n", redtext(va("Teamoverlay %s by majority vote", OnOff(cvar("k_teamoverlay")))));

		return;
	}
}
예제 #8
0
void vote_check_nospecs ()
{
	int veto;

	if ( match_in_progress || intermission_running || match_over )
		return;

	if ( !get_votes( OV_NOSPECS ) )
		return;

	veto = is_admins_vote( OV_NOSPECS );

	if( veto || !get_votes_req( OV_NOSPECS, true ) )
	{
		vote_clear( OV_NOSPECS );

		// set no specs mode
		cvar_fset("_k_nospecs", !cvar("_k_nospecs"));

		if ( veto )
			G_bprint(2, "%s\n", redtext(va("No spectators mode %s by admin veto", OnOff(cvar("_k_nospecs")))));
		else
			G_bprint(2, "%s\n", redtext(va("No spectators mode %s by majority vote", OnOff(cvar("_k_nospecs")))));

		// kick specs
		if ( cvar("_k_nospecs") )
		{
			gedict_t *spec;

			for ( spec = world; (spec = find_spc( spec )); )
			{
				if ( VIP( spec ) & ALLOWED_NOSPECS_VIPS )
					continue; // don't kick this VIP
    
				if ( is_real_adm(spec) )
					continue; // don't kick real admin
    
				stuffcmd(spec, "disconnect\n");  // FIXME: stupid way
			}
		}

		return;
	}
}
예제 #9
0
LRESULT FSplitterWindow::OnButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
    if (GetSplitterPos() <= MinOpenSplitterWidth)
        OnOff();
    else
    {
        CSplitterWindowImpl<FSplitterWindow>::OnLButtonDown(uMsg, wParam, lParam, bHandled);
    }
    return 0;
}
예제 #10
0
void votecoop( )
{
    int votes;

	if ( deathmatch && match_in_progress )
	{
        G_sprint(self, 2, "Match in progress and deathmatch is non zero, you can't vote for coop\n");
        return;
	}

	self->v.coop = !self->v.coop;

	G_bprint(2, "%s %s!%s\n", self->s.v.netname, 
			(self->v.coop ? redtext(va("votes for coop %s", OnOff(!cvar("coop")))) : 
							redtext(va("withdraws %s coop vote", g_his(self)))),
			((votes = get_votes_req( OV_COOP, true )) ? va(" (%d)", votes) : ""));

	vote_check_coop ();
}
예제 #11
0
/** @brief Initialize all HD44780 control pins, set default mode, and return home
  * @retval None
  */
void hd44780_c::Start(void){
  GPIO_InitTypeDef GPIO_InitStructure;
  //init EN pin
	RCC_APB2PeriphClockCmd(HD44780_EN_CLK, ENABLE);
	GPIO_InitStructure.GPIO_Pin   = HD44780_EN_PIN;
  GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_Out_PP;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_Init(HD44780_EN_PORT, &GPIO_InitStructure);
  GPIO_ResetBits(HD44780_EN_PORT, HD44780_EN_PIN);
  //init RS pin
  RCC_APB2PeriphClockCmd(HD44780_RS_CLK, ENABLE);
	GPIO_InitStructure.GPIO_Pin   = HD44780_RS_PIN;
  GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_Out_PP;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_Init(HD44780_RS_PORT, &GPIO_InitStructure);
  //init RW pin
  RCC_APB2PeriphClockCmd(HD44780_RW_CLK, ENABLE);
	GPIO_InitStructure.GPIO_Pin   = HD44780_RW_PIN;
  GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_Out_PP;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_Init(HD44780_RW_PORT, &GPIO_InitStructure);
  //init DATA pins
  RCC_APB2PeriphClockCmd(HD44780_DATA_CLK, ENABLE);
	GPIO_InitStructure.GPIO_Pin   = HD44780_DATA_PIN_4| HD44780_DATA_PIN_5| HD44780_DATA_PIN_6| HD44780_DATA_PIN_7;
	GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_Out_PP;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(HD44780_DATA_PORT, &GPIO_InitStructure);

  FunctionSet(false, false);
  FunctionSet(false, false);
  OnOff(true, true, true);
  EntryMode(false, true);
  Clear();
  Home();
  HLib::LoopDelay(1000000);
  Print("Wellcome to HLib");
}
예제 #12
0
파일: dialog.c 프로젝트: Mirppc/twin
static byte ParseArgs(int argc, char *argv[]) {
    int eaten;
    
    if (++argv, !--argc) {
	Usage();
	return FALSE;
    }
    while (argc) {
	eaten = 1;
	
	if (!strcmp(*argv, "--separate-output"))
	    separate_output = TRUE;
	else if (argc >= 2 && !strcmp(*argv, "--title"))
	    title = argv[1], eaten = 2;
	else if (argc >= 2 && !strcmp(*argv, "--backtitle"))
	    backtitle = argv[1], eaten = 2;
	else if (argc == 4 && !strcmp(*argv, "--yesno")) {
	    eaten = argc; mode = InitYesNoBox;
	    text = argv[1]; height = atoi(argv[2]); width = atoi(argv[3]);
	} else if (argc == 4 && !strcmp(*argv, "--msgbox")) {
	    eaten = argc; mode = InitMsgBox;
	    text = argv[1]; height = atoi(argv[2]); width = atoi(argv[3]);
	} else if (argc == 4 && !strcmp(*argv, "--infobox")) {
	    eaten = argc; mode = InitInfoBox;
	    text = argv[1]; height = atoi(argv[2]); width = atoi(argv[3]);
	} else if ((argc == 4 || argc == 5) && !strcmp(*argv, "--inputbox")) {
	    eaten = argc; mode = InitInputBox;
	    text = argv[1]; height = atoi(argv[2]); width = atoi(argv[3]);
	    if (argc == 5)
		input = argv[4];
	} else if (argc == 4 && !strcmp(*argv, "--textbox")) {
	    eaten = argc; mode = InitTextBox;
	    text = argv[1]; height = atoi(argv[2]); width = atoi(argv[3]);
	} else if (argc >= 7 && (argc % 2) == 1 && !strcmp(*argv, "--menu") && (listN = atoi(argv[4]))*2 + 5 == argc) {
	    mode = InitMenuBox;
	    text = argv[1]; height = atoi(argv[2]); width = atoi(argv[3]);
	    AllocList();
	    for (eaten = 0; eaten < listN; eaten++) {
		list[eaten].tag  = argv[5 + eaten*2];
		list[eaten].item = argv[6 + eaten*2];
	    }
	    eaten = argc;
	} else if (argc >= 8 && (argc % 3) == 2 && !strcmp(*argv, "--checklist") && (listN = atoi(argv[4]))*3 + 5 == argc) {
	    mode = InitCheckBox;
	    text = argv[1]; height = atoi(argv[2]); width = atoi(argv[3]);
	    AllocList();
	    for (eaten = 0; eaten < listN; eaten++) {
		list[eaten].tag  = argv[5 + eaten*3];
		list[eaten].item = argv[6 + eaten*3];
		list[eaten].status = OnOff(argv[7 + eaten*3]);
	    }
	    eaten = argc;
	} else if (argc >= 8 && (argc % 3) == 2 && !strcmp(*argv, "--radiolist") && (listN = atoi(argv[4]))*3 + 5 == argc) {
	    mode = InitRadioBox;
	    text = argv[1]; height = atoi(argv[2]); width = atoi(argv[3]);
	    AllocList();
	    for (eaten = 0; eaten < listN; eaten++) {
		list[eaten].tag  = argv[5 + eaten*3];
		list[eaten].item = argv[6 + eaten*3];
		list[eaten].status = OnOff(argv[7 + eaten*3]);
	    }
	    eaten = argc;
	} else if (argc == 5 && !strcmp(*argv, "--gauge")) {
	    eaten = argc; mode = InitGaugeBox;
	    text = argv[1]; height = atoi(argv[2]); width = atoi(argv[3]);
	    percent = atoi(argv[4]);
	} else {
	    Usage();
	    return FALSE;
	}
	argc -= eaten;
	argv += eaten;
    }
    width -= 2;
    height -= 2;
    return TRUE;
}
예제 #13
0
eOSState cMenuEpgTimers::ProcessKey(eKeys Key)
{
  //int TimerNumber = HasSubMenu() ? Count() : -1;

  eOSState state = cOsdMenu::ProcessKey(Key);

#if REELVDR && APIVERSNUM >= 10718
  if (Key != kNone && state != osUnknown)
      ShowEventDetailsInSideNote();
#endif

  if (state == osUnknown) {
     switch (Key) {
       /// Löschen | Neu | Ein/Aus | (frei) | Info
       case kOk:     Timers.Count() ? state = Edit() : state = New(); break;
       case kRed:    state = Delete(); break; // must go through SetHelpKeys()!
       case kGreen:  return New(); break;
       case kYellow: state = OnOff(); break;
       case kBlue:   return osContinue; break;
       case kInfo:   return Info(); break;
       default: break;
       }
     }
/* redraw osd *ONLY* if Timers were modified and it is not a submenu, not with everykey stroke! */
#if 0
#ifdef USEMYSQL
if (!HasSubMenu() && (Timers.Modified(TimerState_) || (Timers.GetLastEventID() != LastEventID_)))
#else
if (!HasSubMenu() && (Timers.Modified(TimerState_) || (lastSet != time(0))))
#endif
#else
// We want to see changes in timers flag so we need to poll...
if (!HasSubMenu() && (lastSet != time(0)))
#endif
{
	Set();
	SetHelpKeys();
	Display();
#ifdef USEMYSQL
    LastEventID_ = Timers.GetLastEventID();
#endif
}
else if (!HasSubMenu())
    switch(Key) // update the info buttons
    {
        default: break;
        case kUp:
        case kUp|k_Repeat:
        case kDown:
        case kDown|k_Repeat:
        case kRight:
        case kRight|k_Repeat:
        case kLeft:
        case kLeft|k_Repeat:
            //activity of current timer may have chanched
            helpKeys = -1;
            SetHelpKeys();
            break;
    }
/*
  if (TimerNumber != -1 && TimerNumber != Timers.Count()) {
     Set();
     SetHelpKeys();
     Display();
  } else if (Key != kNone && !HasSubMenu()) {
     Set();
     SetHelpKeys();
     //Display();
  }
*/

  return state;
}