Merge branch 'master' into win-64bit
This commit is contained in:
+69
-65
@@ -109,7 +109,7 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
|
||||
// When no players... a cutscene
|
||||
if (race_manager->getNumPlayers() == 0 && world != NULL && value > 0 &&
|
||||
(key == KEY_SPACE || key == KEY_RETURN))
|
||||
(key == IRR_KEY_SPACE || key == IRR_KEY_RETURN))
|
||||
{
|
||||
world->onFirePressed(NULL);
|
||||
}
|
||||
@@ -128,39 +128,39 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
#ifdef DEBUG
|
||||
// Special debug options for profile mode: switch the
|
||||
// camera to show a different kart.
|
||||
case KEY_KEY_1:
|
||||
case KEY_KEY_2:
|
||||
case KEY_KEY_3:
|
||||
case KEY_KEY_4:
|
||||
case KEY_KEY_5:
|
||||
case KEY_KEY_6:
|
||||
case KEY_KEY_7:
|
||||
case KEY_KEY_8:
|
||||
case KEY_KEY_9:
|
||||
case IRR_KEY_1:
|
||||
case IRR_KEY_2:
|
||||
case IRR_KEY_3:
|
||||
case IRR_KEY_4:
|
||||
case IRR_KEY_5:
|
||||
case IRR_KEY_6:
|
||||
case IRR_KEY_7:
|
||||
case IRR_KEY_8:
|
||||
case IRR_KEY_9:
|
||||
{
|
||||
if(!ProfileWorld::isProfileMode() || !world) break;
|
||||
int kart_id = key - KEY_KEY_1;
|
||||
int kart_id = key - IRR_KEY_1;
|
||||
if(kart_id<0 || kart_id>=(int)world->getNumKarts()) break;
|
||||
Camera::getCamera(0)->setKart(world->getKart(kart_id));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
case KEY_CONTROL:
|
||||
case KEY_RCONTROL:
|
||||
case KEY_LCONTROL:
|
||||
case KEY_RMENU:
|
||||
case KEY_LMENU:
|
||||
case KEY_LWIN:
|
||||
case IRR_KEY_CONTROL:
|
||||
case IRR_KEY_RCONTROL:
|
||||
case IRR_KEY_LCONTROL:
|
||||
case IRR_KEY_RMENU:
|
||||
case IRR_KEY_LMENU:
|
||||
case IRR_KEY_LWIN:
|
||||
control_is_pressed = value!=0;
|
||||
break;
|
||||
case KEY_LSHIFT:
|
||||
case KEY_RSHIFT:
|
||||
case KEY_SHIFT:
|
||||
case IRR_KEY_LSHIFT:
|
||||
case IRR_KEY_RSHIFT:
|
||||
case IRR_KEY_SHIFT:
|
||||
shift_is_pressed = value!=0; break;
|
||||
|
||||
// Flying up and down
|
||||
case KEY_KEY_I:
|
||||
case IRR_KEY_I:
|
||||
{
|
||||
if (!world || !UserConfigParams::m_artist_debug_mode) break;
|
||||
|
||||
@@ -170,7 +170,7 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
kart->flyUp();
|
||||
break;
|
||||
}
|
||||
case KEY_KEY_K:
|
||||
case IRR_KEY_K:
|
||||
{
|
||||
if (!world || !UserConfigParams::m_artist_debug_mode) break;
|
||||
|
||||
@@ -181,7 +181,7 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
break;
|
||||
}
|
||||
// Moving the first person camera
|
||||
case KEY_KEY_W:
|
||||
case IRR_KEY_W:
|
||||
{
|
||||
CameraFPS *cam = dynamic_cast<CameraFPS*>(Camera::getActiveCamera());
|
||||
if (world && UserConfigParams::m_artist_debug_mode && cam )
|
||||
@@ -192,7 +192,7 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case KEY_KEY_S:
|
||||
case IRR_KEY_S:
|
||||
{
|
||||
CameraFPS *cam = dynamic_cast<CameraFPS*>(Camera::getActiveCamera());
|
||||
if (world && UserConfigParams::m_artist_debug_mode && cam)
|
||||
@@ -203,7 +203,7 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case KEY_KEY_D:
|
||||
case IRR_KEY_D:
|
||||
{
|
||||
CameraFPS *cam = dynamic_cast<CameraFPS*>(Camera::getActiveCamera());
|
||||
if (world && !UserConfigParams::m_artist_debug_mode && cam)
|
||||
@@ -214,7 +214,7 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case KEY_KEY_A:
|
||||
case IRR_KEY_A:
|
||||
{
|
||||
CameraFPS *cam = dynamic_cast<CameraFPS*>(Camera::getActiveCamera());
|
||||
if (world && UserConfigParams::m_artist_debug_mode && cam)
|
||||
@@ -225,7 +225,7 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case KEY_KEY_R:
|
||||
case IRR_KEY_R:
|
||||
{
|
||||
CameraFPS *cam = dynamic_cast<CameraFPS*>(Camera::getActiveCamera());
|
||||
if (world && UserConfigParams::m_artist_debug_mode && cam)
|
||||
@@ -236,7 +236,7 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case KEY_KEY_F:
|
||||
case IRR_KEY_F:
|
||||
{
|
||||
CameraFPS *cam = dynamic_cast<CameraFPS*>(Camera::getActiveCamera());
|
||||
if (world && UserConfigParams::m_artist_debug_mode && cam)
|
||||
@@ -248,7 +248,7 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
break;
|
||||
}
|
||||
// Rotating the first person camera
|
||||
case KEY_KEY_Q:
|
||||
case IRR_KEY_Q:
|
||||
{
|
||||
CameraFPS *cam = dynamic_cast<CameraFPS*>(Camera::getActiveCamera());
|
||||
if (world && UserConfigParams::m_artist_debug_mode && cam )
|
||||
@@ -258,7 +258,7 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case KEY_KEY_E:
|
||||
case IRR_KEY_E:
|
||||
{
|
||||
CameraFPS *cam = dynamic_cast<CameraFPS*>(Camera::getActiveCamera());
|
||||
if (world && UserConfigParams::m_artist_debug_mode && cam)
|
||||
@@ -269,8 +269,8 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
break;
|
||||
}
|
||||
|
||||
case KEY_SNAPSHOT:
|
||||
case KEY_PRINT:
|
||||
case IRR_KEY_SNAPSHOT:
|
||||
case IRR_KEY_PRINT:
|
||||
// on windows we don't get a press event, only release. So
|
||||
// save on release only (to avoid saving twice on other platforms)
|
||||
if (value == 0)
|
||||
@@ -286,7 +286,7 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case KEY_F11:
|
||||
case IRR_KEY_F11:
|
||||
if(value && shift_is_pressed && world && RewindManager::isEnabled())
|
||||
{
|
||||
printf("Enter rewind to time:");
|
||||
@@ -317,7 +317,7 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case KEY_F2:
|
||||
case IRR_KEY_F2:
|
||||
if (UserConfigParams::m_artist_debug_mode && world)
|
||||
{
|
||||
AbstractKart* kart = world->getLocalPlayerKart(0);
|
||||
@@ -325,42 +325,42 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
kart->setPowerup(PowerupManager::POWERUP_PLUNGER, 10000);
|
||||
}
|
||||
break;
|
||||
case KEY_F3:
|
||||
case IRR_KEY_F3:
|
||||
if (UserConfigParams::m_artist_debug_mode && world)
|
||||
{
|
||||
AbstractKart* kart = world->getLocalPlayerKart(0);
|
||||
kart->setPowerup(PowerupManager::POWERUP_CAKE, 10000);
|
||||
}
|
||||
break;
|
||||
case KEY_F4:
|
||||
case IRR_KEY_F4:
|
||||
if (UserConfigParams::m_artist_debug_mode && world)
|
||||
{
|
||||
AbstractKart* kart = world->getLocalPlayerKart(0);
|
||||
kart->setPowerup(PowerupManager::POWERUP_SWITCH, 10000);
|
||||
}
|
||||
break;
|
||||
case KEY_F5:
|
||||
case IRR_KEY_F5:
|
||||
if (UserConfigParams::m_artist_debug_mode && world)
|
||||
{
|
||||
AbstractKart* kart = world->getLocalPlayerKart(0);
|
||||
kart->setPowerup(PowerupManager::POWERUP_BOWLING, 10000);
|
||||
}
|
||||
break;
|
||||
case KEY_F6:
|
||||
case IRR_KEY_F6:
|
||||
if (UserConfigParams::m_artist_debug_mode && world)
|
||||
{
|
||||
AbstractKart* kart = world->getLocalPlayerKart(0);
|
||||
kart->setPowerup(PowerupManager::POWERUP_BUBBLEGUM, 10000);
|
||||
}
|
||||
break;
|
||||
case KEY_F7:
|
||||
case IRR_KEY_F7:
|
||||
if (UserConfigParams::m_artist_debug_mode && world)
|
||||
{
|
||||
AbstractKart* kart = world->getLocalPlayerKart(0);
|
||||
kart->setPowerup(PowerupManager::POWERUP_ZIPPER, 10000);
|
||||
}
|
||||
break;
|
||||
case KEY_F8:
|
||||
case IRR_KEY_F8:
|
||||
if (UserConfigParams::m_artist_debug_mode && value && world)
|
||||
{
|
||||
if (control_is_pressed)
|
||||
@@ -383,7 +383,7 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case KEY_F9:
|
||||
case IRR_KEY_F9:
|
||||
if (UserConfigParams::m_artist_debug_mode && world)
|
||||
{
|
||||
AbstractKart* kart = world->getLocalPlayerKart(0);
|
||||
@@ -396,7 +396,7 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
}
|
||||
break;
|
||||
*/
|
||||
case KEY_F10:
|
||||
case IRR_KEY_F10:
|
||||
if(world && value)
|
||||
{
|
||||
if(control_is_pressed)
|
||||
@@ -406,7 +406,7 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
}
|
||||
break;
|
||||
/*
|
||||
case KEY_F11:
|
||||
case IRR_KEY_F11:
|
||||
if (UserConfigParams::m_artist_debug_mode && value &&
|
||||
control_is_pressed && world)
|
||||
{
|
||||
@@ -414,7 +414,7 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
}
|
||||
break;
|
||||
*/
|
||||
case KEY_F12:
|
||||
case IRR_KEY_F12:
|
||||
if(value)
|
||||
UserConfigParams::m_display_fps =
|
||||
!UserConfigParams::m_display_fps;
|
||||
@@ -488,11 +488,13 @@ void InputManager::inputSensing(Input::InputType type, int deviceID,
|
||||
// We have to save the direction in which the axis was moved.
|
||||
// This is done by storing it as a sign (and since button can
|
||||
// be zero, we add one before changing the sign).
|
||||
int input_id = value>=0 ? 1+button : -(1+button);
|
||||
int input_button_id = value>=0 ? 1+button : -(1+button);
|
||||
std::tuple<int, int> input_id(deviceID, input_button_id);
|
||||
std::tuple<int, int> input_id_inv(deviceID, -input_button_id);
|
||||
|
||||
bool id_was_high = m_sensed_input_high_gamepad.find(input_id)
|
||||
!= m_sensed_input_high_gamepad.end();
|
||||
bool inverse_id_was_high = m_sensed_input_high_gamepad.find(-input_id)
|
||||
bool inverse_id_was_high = m_sensed_input_high_gamepad.find(input_id_inv)
|
||||
!= m_sensed_input_high_gamepad.end();
|
||||
bool id_was_zero = m_sensed_input_zero_gamepad.find(button)
|
||||
!= m_sensed_input_zero_gamepad.end();
|
||||
@@ -656,13 +658,13 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID,
|
||||
{
|
||||
action = PA_BEFORE_FIRST;
|
||||
|
||||
if (button == KEY_UP) action = PA_MENU_UP;
|
||||
else if (button == KEY_DOWN) action = PA_MENU_DOWN;
|
||||
else if (button == KEY_LEFT) action = PA_MENU_LEFT;
|
||||
else if (button == KEY_RIGHT) action = PA_MENU_RIGHT;
|
||||
else if (button == KEY_SPACE) action = PA_MENU_SELECT;
|
||||
else if (button == KEY_RETURN) action = PA_MENU_SELECT;
|
||||
else if (button == KEY_TAB)
|
||||
if (button == IRR_KEY_UP) action = PA_MENU_UP;
|
||||
else if (button == IRR_KEY_DOWN) action = PA_MENU_DOWN;
|
||||
else if (button == IRR_KEY_LEFT) action = PA_MENU_LEFT;
|
||||
else if (button == IRR_KEY_RIGHT) action = PA_MENU_RIGHT;
|
||||
else if (button == IRR_KEY_SPACE) action = PA_MENU_SELECT;
|
||||
else if (button == IRR_KEY_RETURN) action = PA_MENU_SELECT;
|
||||
else if (button == IRR_KEY_TAB)
|
||||
{
|
||||
if (shift_mask)
|
||||
{
|
||||
@@ -674,7 +676,7 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID,
|
||||
}
|
||||
}
|
||||
|
||||
if (button == KEY_RETURN)
|
||||
if (button == IRR_KEY_RETURN)
|
||||
{
|
||||
if (GUIEngine::ModalDialog::isADialogActive() &&
|
||||
!GUIEngine::ScreenKeyboard::isActive())
|
||||
@@ -973,7 +975,7 @@ EventPropagation InputManager::input(const SEvent& event)
|
||||
if (event.KeyInput.PressedDown)
|
||||
{
|
||||
// escape is a little special
|
||||
if (key == KEY_ESCAPE)
|
||||
if (key == IRR_KEY_ESCAPE)
|
||||
{
|
||||
StateManager::get()->escapePressed();
|
||||
return EVENT_BLOCK;
|
||||
@@ -984,11 +986,12 @@ EventPropagation InputManager::input(const SEvent& event)
|
||||
// single letter). Same for spacebar. Same for letters.
|
||||
if (GUIEngine::isWithinATextBox())
|
||||
{
|
||||
if (key == KEY_BACK || key == KEY_SPACE || key == KEY_SHIFT)
|
||||
if (key == IRR_KEY_BACK || key == IRR_KEY_SPACE ||
|
||||
key == IRR_KEY_SHIFT)
|
||||
{
|
||||
return EVENT_LET;
|
||||
}
|
||||
if (key >= KEY_KEY_0 && key <= KEY_KEY_Z)
|
||||
if (key >= IRR_KEY_0 && key <= IRR_KEY_Z)
|
||||
{
|
||||
return EVENT_LET;
|
||||
}
|
||||
@@ -1016,11 +1019,12 @@ EventPropagation InputManager::input(const SEvent& event)
|
||||
// single letter). Same for spacebar. Same for letters.
|
||||
if (GUIEngine::isWithinATextBox())
|
||||
{
|
||||
if (key == KEY_BACK || key == KEY_SPACE || key == KEY_SHIFT)
|
||||
if (key == IRR_KEY_BACK || key == IRR_KEY_SPACE ||
|
||||
key == IRR_KEY_SHIFT)
|
||||
{
|
||||
return EVENT_LET;
|
||||
}
|
||||
if (key >= KEY_KEY_0 && key <= KEY_KEY_Z)
|
||||
if (key >= IRR_KEY_0 && key <= IRR_KEY_Z)
|
||||
{
|
||||
return EVENT_LET;
|
||||
}
|
||||
@@ -1140,8 +1144,8 @@ EventPropagation InputManager::input(const SEvent& event)
|
||||
// Simulate touch event on non-android devices
|
||||
#if !defined(ANDROID)
|
||||
MultitouchDevice* device = m_device_manager->getMultitouchDevice();
|
||||
|
||||
if (device != NULL && (type == EMIE_LMOUSE_PRESSED_DOWN ||
|
||||
|
||||
if (device != NULL && (type == EMIE_LMOUSE_PRESSED_DOWN ||
|
||||
type == EMIE_LMOUSE_LEFT_UP || type == EMIE_MOUSE_MOVED))
|
||||
{
|
||||
device->m_events[0].id = 0;
|
||||
@@ -1178,13 +1182,13 @@ EventPropagation InputManager::input(const SEvent& event)
|
||||
else if (event.EventType == EET_ACCELEROMETER_EVENT)
|
||||
{
|
||||
MultitouchDevice* device = m_device_manager->getMultitouchDevice();
|
||||
|
||||
if (device)
|
||||
|
||||
if (device && device->isAccelerometerActive())
|
||||
{
|
||||
for (unsigned int i = 0; i < device->getButtonsCount(); i++)
|
||||
{
|
||||
MultitouchButton* button = device->getButton(i);
|
||||
|
||||
|
||||
if (button->type != BUTTON_STEERING)
|
||||
continue;
|
||||
|
||||
@@ -1196,7 +1200,7 @@ EventPropagation InputManager::input(const SEvent& event)
|
||||
else if (UserConfigParams::m_multitouch_accelerometer == 2)
|
||||
{
|
||||
button->axis_x = (float)event.AccelerometerEvent.Y / 5.0f;
|
||||
device->handleControls(button);
|
||||
device->handleControls(button);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user