Esempio n. 1
0
int HandleGameKey(int key)
{
	switch (key) {

		case KEY_1 + KEY_SHIFTED:
		case KEY_2 + KEY_SHIFTED:
		case KEY_3 + KEY_SHIFTED:
		case KEY_4 + KEY_SHIFTED:
		case KEY_5 + KEY_SHIFTED:
		case KEY_6 + KEY_SHIFTED:
		case KEY_7 + KEY_SHIFTED:
		case KEY_8 + KEY_SHIFTED:
		case KEY_9 + KEY_SHIFTED:
		case KEY_0 + KEY_SHIFTED:
			if (PlayerCfg.EscortHotKeys)
			{
				if (!(Game_mode & GM_MULTI))
					set_escort_special_goal(key);
				else
					HUD_init_message_literal(HM_DEFAULT, "No Guide-Bot in Multiplayer!");
				game_flush_inputs();
				return 1;
			}
			else
				return 0;

		case KEY_ALTED+KEY_F7:
		KEY_MAC(case KEY_COMMAND+KEY_ALTED+KEY_7:)
			PlayerCfg.HudMode=(PlayerCfg.HudMode+1)%GAUGE_HUD_NUMMODES;
			write_player_file();
			switch (PlayerCfg.HudMode)
			{
				case 0: HUD_init_message_literal(HM_DEFAULT, "Standard HUD"); break;
				case 1: HUD_init_message_literal(HM_DEFAULT, "Alternative HUD #1"); break;
				case 2: HUD_init_message_literal(HM_DEFAULT, "Alternative HUD #2"); break;
				case 3: HUD_init_message_literal(HM_DEFAULT, "No HUD"); break;
			}
			return 1;

#ifdef NETWORK
		KEY_MAC(case KEY_COMMAND+KEY_6:)
		case KEY_F6:
			if (Netgame.RefusePlayers && WaitForRefuseAnswer && !(Game_mode & GM_TEAM))
			{
				RefuseThisPlayer=1;
				HUD_init_message_literal(HM_MULTI, "Player accepted!");
			} else {
				Show_network_stats = ! Show_network_stats; 
			}
			return 1;
		case KEY_ALTED + KEY_1:
			if (Netgame.RefusePlayers && WaitForRefuseAnswer && (Game_mode & GM_TEAM))
				{
					RefuseThisPlayer=1;
					HUD_init_message_literal(HM_MULTI, "Player accepted!");
					RefuseTeam=1;
					game_flush_inputs();
				}
			return 1;
		case KEY_ALTED + KEY_2:
			if (Netgame.RefusePlayers && WaitForRefuseAnswer && (Game_mode & GM_TEAM))
				{
					RefuseThisPlayer=1;
					HUD_init_message_literal(HM_MULTI, "Player accepted!");
					RefuseTeam=2;
					game_flush_inputs();
				}
			return 1;
#endif

		default:
			break;

	}	 //switch (key)

	if (!Player_is_dead)
		switch (key)
		{
#if 0 
// weapon selection handled in kconfig_read_controls, d1x-style
				// MWA changed the weapon select cases to have each case call
				// do_weapon_select the macintosh keycodes aren't consecutive from 1
				// -- 0 on the keyboard -- boy is that STUPID!!!!
				//	Select primary or secondary weapon.
			case KEY_1:
				do_weapon_select(0 , 0);
				break;
			case KEY_2:
				do_weapon_select(1 , 0);
				break;
			case KEY_3:
				do_weapon_select(2 , 0);
				break;
			case KEY_4:
				do_weapon_select(3 , 0);
				break;
			case KEY_5:
				do_weapon_select(4 , 0);
				break;

			case KEY_6:
				do_weapon_select(0 , 1);
				break;
			case KEY_7:
				do_weapon_select(1 , 1);
				break;
			case KEY_8:
				do_weapon_select(2 , 1);
				break;
			case KEY_9:
				do_weapon_select(3 , 1);
				break;
			case KEY_0:
				do_weapon_select(4 , 1);
				break;
#endif

				KEY_MAC(case KEY_COMMAND+KEY_SHIFTED+KEY_5:)
			case KEY_F5 + KEY_SHIFTED:
				DropCurrentWeapon();
				break;

			KEY_MAC(case KEY_COMMAND+KEY_SHIFTED+KEY_6:)
			case KEY_F6 + KEY_SHIFTED:
				DropSecondaryWeapon();
				break;

#ifdef NETWORK
			case KEY_0 + KEY_ALTED:
				DropFlag ();
				game_flush_inputs();
				break;
#endif

			KEY_MAC(case KEY_COMMAND+KEY_4:)
			case KEY_F4:
				if (!DefiningMarkerMessage)
					InitMarkerInput();
				break;

			default:
				return 0;
		}
	else
		return 0;
Esempio n. 2
0
void HandleGameKey(int key)
{
	switch (key) {

#ifndef D2X_KEYS // weapon selection handled in ControlsReadAll, d1x-style
// MWA changed the weapon select cases to have each case call
// DoSelectWeapon the macintosh keycodes aren't consecutive from 1
// -- 0 on the keyboard -- boy is that STUPID!!!!

		//	Select primary or secondary weapon.
		case KEY_1:
			DoSelectWeapon(0 , 0);
			break;
		case KEY_2:
			DoSelectWeapon(1 , 0);
			break;
		case KEY_3:
			DoSelectWeapon(2 , 0);
			break;
		case KEY_4:
			DoSelectWeapon(3 , 0);
			break;
		case KEY_5:
			DoSelectWeapon(4 , 0);
			break;
		case KEY_6:
			DoSelectWeapon(0 , 1);
			break;
		case KEY_7:
			DoSelectWeapon(1 , 1);
			break;
		case KEY_8:
			DoSelectWeapon(2 , 1);
			break;
		case KEY_9:
			DoSelectWeapon(3 , 1);
			break;
		case KEY_0:
			DoSelectWeapon(4 , 1);
			break;
#endif

		case KEY_1 + KEY_SHIFTED:
		case KEY_2 + KEY_SHIFTED:
		case KEY_3 + KEY_SHIFTED:
		case KEY_4 + KEY_SHIFTED:
		case KEY_5 + KEY_SHIFTED:
		case KEY_6 + KEY_SHIFTED:
		case KEY_7 + KEY_SHIFTED:
		case KEY_8 + KEY_SHIFTED:
		case KEY_9 + KEY_SHIFTED:
		case KEY_0 + KEY_SHIFTED:
		if (gameOpts->gameplay.bEscortHotKeys) {
			if (IsMultiGame)
				HUDInitMessage (TXT_GB_MULTIPLAYER);
			else
				EscortSetSpecialGoal (key);
			break;
			}

		case KEY_ALTED + KEY_M:
			gameStates.app.bMultiThreaded = !gameStates.app.bMultiThreaded;
			HUDMessage (0, "multi-threading %s", gameStates.app.bMultiThreaded ? "ON" : "OFF");
			break;

		case KEY_ALTED + KEY_P:
#if PROFILING
			if ((gameStates.render.bShowProfiler = !gameStates.render.bShowProfiler))
				memset (&gameData.profiler, 0, sizeof (gameData.profiler));
#endif
			break;

		case KEY_ALTED + KEY_F:
			gameStates.render.bShowFrameRate = ++gameStates.render.bShowFrameRate % (6 + (gameStates.render.bPerPixelLighting == 2));
			break;

		case KEY_ALTED + KEY_R:
			ToggleRadar ();
			break;

		case KEY_ALTED + KEY_T:
			gameStates.render.bShowTime = !gameStates.render.bShowTime;
			break;

		case KEY_CTRLED + KEY_ALTED + KEY_R:
			gr_renderstats = !gr_renderstats;
			break;

		case KEY_CTRLED + KEY_ALTED + KEY_ESC:
			gameStates.app.bSingleStep = 1;
			break;

		case KEY_F5 + KEY_SHIFTED:
		   DropCurrentWeapon ();
			break;

		case KEY_F6 + KEY_SHIFTED:
	 DropSecondaryWeapon(-1);
	 break;

		case KEY_0 + KEY_ALTED:
			DropFlag ();
			break;

		case KEY_F4:
			if (!gameData.marker.nDefiningMsg)
				InitMarkerInput ();
			break;

		case KEY_F4 + KEY_CTRLED:
			if (!gameData.marker.nDefiningMsg)
				DropSpawnMarker ();
			break;

		case KEY_ALTED + KEY_CTRLED + KEY_T:
			SwitchTeam (gameData.multiplayer.nLocalPlayer, 0);
			break;
		case KEY_F6:
			if (netGame.bRefusePlayers && networkData.refuse.bWaitForAnswer && !(gameData.app.nGameMode & GM_TEAM))
			 {
					networkData.refuse.bThisPlayer=1;
					HUDInitMessage (TXT_ACCEPT_PLR);
				}
			break;
		case KEY_ALTED + KEY_1:
			if (netGame.bRefusePlayers && networkData.refuse.bWaitForAnswer && (gameData.app.nGameMode & GM_TEAM))
			 {
					networkData.refuse.bThisPlayer=1;
					HUDInitMessage (TXT_ACCEPT_PLR);
					networkData.refuse.bTeam=1;
				}
			break;
		case KEY_ALTED + KEY_2:
			if (netGame.bRefusePlayers && networkData.refuse.bWaitForAnswer && (gameData.app.nGameMode & GM_TEAM))
			 {
					networkData.refuse.bThisPlayer=1;
					HUDInitMessage (TXT_ACCEPT_PLR);
					networkData.refuse.bTeam=2;
				}
			break;

		default:
			break;

	}	 //switch (key)
}