Exemplo n.º 1
0
Arquivo: HSv3.c Projeto: thducng/C
void user_dialog(int *stop){
  int i = 0, classnum = 0;
  char choice[100];
  char *choicep = choice;
  
  printf( "\n __________________________________ \n"
            ": Command list below:              :\n"
            ": -------------------------------- :\n"
            ": New Arena                -> 1    :\n"
            ": Delete Arena             -> 2    :\n"
            ": View Latest              -> 3    :\n"
            ": View Most Wins           -> 4    :\n"
            ": Quit                     -> 5    :\n"
            ": -------------------------------- :\n"
            ": Enter class name to get specific :\n"
            ": class statistics or 'all'        :\n"
            ": 'Hunter' or 'Warrior' or 'Mage'  :\n"
            ":__________________________________:\n\n");

  scanf("%s",&choice);
  system("cls");
  
  if(strcmp(choicep, "1") == 0 || strcmp(choicep, "2") == 0 || strcmp(choicep, "3") == 0 ||
     strcmp(choicep, "4") == 0 || strcmp(choicep, "5") == 0){
    i = atoi(choicep);   
    switch(i){
      case 1:
        new_arena();
        break;
      case 2:
        delete_arena();
        break;
      case 3:
        view_late();
        break;
      case 4:
        view_m_win();
        break;
      default:
        *stop = TRUE;
        break;
    }
  }
  else{
    classnum = class_number(choice);
    commandlist(classnum);
  }
}
Exemplo n.º 2
0
void update_inputport(void)
{
	int i;
	UINT32 buttons;

	buttons = poll_gamepad();

	if (readHomeButton())
	{
		showmenu();
		setup_autofire();
		buttons = poll_gamepad();
	}
	else if ((buttons & PSP_CTRL_RTRIGGER) && (buttons & PSP_CTRL_SELECT))
	{
		commandlist(1);
		buttons = poll_gamepad();
	}

	buttons = update_autofire(buttons);

	for (i = 0; i < MAX_INPUTS; i++)
		input_flag[i] = (buttons & input_map[i]) != 0;

	update_inputport0();
	update_inputport1();
	update_inputport2();

	if (input_flag[SNAPSHOT])
	{
		save_snapshot();
	}
	if (input_flag[SWPLAYER])
	{
		if (!input_ui_wait)
		{
			option_controller ^= 1;
			ui_popup(TEXT(CONTROLLER_PLAYERx), option_controller + 1);
			input_ui_wait = 30;
		}
	}
	if (input_ui_wait > 0) input_ui_wait--;
}
Exemplo n.º 3
0
void update_inputport(void)
{
	int i, serv_switch = 0;
	UINT32 buttons;

#ifdef ADHOC
	if (adhoc_enable)
	{
#if !ADHOC_UPDATE_EVERY_FRAME
		if (adhoc_frame & 1)
		{
			adhoc_frame++;
		}
		else
#endif
		{
			while (adhoc_update && Loop == LOOP_EXEC)
			{
				sceKernelDelayThread(1);
			}

			cps1_port_value[0] = send_data.port_value[0] & recv_data.port_value[0];
			cps1_port_value[1] = send_data.port_value[1] & recv_data.port_value[1];
			cps1_port_value[2] = send_data.port_value[2] & recv_data.port_value[2];
			cps1_port_value[3] = send_data.port_value[3] & recv_data.port_value[3];

			if (machine_input_type == INPTYPE_forgottn)
			{
				if (adhoc_server)
				{
					input_analog_value[0] = send_data.port_value[4];
					input_analog_value[1] = recv_data.port_value[5];
				}
				else
				{
					input_analog_value[0] = recv_data.port_value[4];
					input_analog_value[1] = send_data.port_value[5];
				}
			}

			if (Loop == LOOP_EXEC)
				Loop = recv_data.loop_flag;

			if (recv_data.paused)
				adhoc_paused = recv_data.paused;

			if (adhoc_paused)
			{
				adhoc_pause();
			}
			
			service_switch = 0;
			p12_start_pressed = 0;
			
			buttons = poll_gamepad();

			if (systembuttons_available ? readHomeButton() : (buttons & PSP_CTRL_START) && (buttons & PSP_CTRL_SELECT))
			{
				buttons = 0;
				adhoc_paused = adhoc_server + 1;
			}
			else if ((buttons & PSP_CTRL_LTRIGGER) && (buttons & PSP_CTRL_RTRIGGER))
			{
				if (buttons & PSP_CTRL_SELECT)
				{
					buttons &= ~(PSP_CTRL_SELECT | PSP_CTRL_LTRIGGER | PSP_CTRL_RTRIGGER);
					serv_switch = 1;
				}
				else if (buttons & PSP_CTRL_START)
				{
					buttons &= ~(PSP_CTRL_START | PSP_CTRL_LTRIGGER | PSP_CTRL_RTRIGGER);
					p12_start_pressed = 1;
				}
			}

			buttons = adjust_input(buttons);
			buttons = update_autofire(buttons);

			for (i = 0; i < MAX_INPUTS; i++)
				input_flag[i] = (buttons & input_map[i]) != 0;

			if (serv_switch) input_flag[SERV_SWITCH] = 1;

			update_inputport0();
			update_inputport1();
			update_inputport2();
			update_inputport3();
			if (machine_input_type == INPTYPE_forgottn) forgottn_update_dial();

			send_data.buttons   = buttons;
			send_data.paused    = adhoc_paused;
			send_data.loop_flag = Loop;
			send_data.frame     = adhoc_frame++;

			sceKernelDelayThread(100);

			adhoc_update = 1;
		}
	}
	else
#endif
	{
		service_switch = 0;
		p12_start_pressed = 0;
		
		buttons = poll_gamepad();

		if (systembuttons_available ? readHomeButton() : (buttons & PSP_CTRL_START) && (buttons & PSP_CTRL_SELECT))
		{
			showmenu();
			setup_autofire();
			buttons = poll_gamepad();
		}

		if ((buttons & PSP_CTRL_LTRIGGER) && (buttons & PSP_CTRL_RTRIGGER))
		{
			if (buttons & PSP_CTRL_SELECT)
			{
				buttons &= ~(PSP_CTRL_SELECT | PSP_CTRL_LTRIGGER | PSP_CTRL_RTRIGGER);
				serv_switch = 1;
			}
			else if (buttons & PSP_CTRL_START)
			{
				buttons &= ~(PSP_CTRL_START | PSP_CTRL_LTRIGGER | PSP_CTRL_RTRIGGER);
				p12_start_pressed = 1;
			}
		}

		buttons = adjust_input(buttons);
		buttons = update_autofire(buttons);

		for (i = 0; i < MAX_INPUTS; i++)
			input_flag[i] = (buttons & input_map[i]) != 0;

		if (serv_switch) input_flag[SERV_SWITCH] = 1;

		update_inputport0();
		update_inputport1();
		update_inputport2();
		update_inputport3();
		if (machine_input_type == INPTYPE_forgottn) forgottn_update_dial();

		if (input_flag[SNAPSHOT])
		{
			save_snapshot();
		}
		
		if (input_flag[SWPLAYER])
		{
			if (!input_ui_wait)
			{
				option_controller++;
				if (option_controller == input_max_players)
					option_controller = INPUT_PLAYER1;
				ui_popup(TEXT(CONTROLLER_PLAYERx), option_controller + 1);
				input_ui_wait = 30;
			}
		}

		if (input_flag[COMMANDLIST])
		{
			commandlist(1);
			buttons = poll_gamepad();
		}
		
		if (input_ui_wait > 0) input_ui_wait--;
	}
}