Merge branch 'master' into game_protocol
This commit is contained in:
commit
ea3f9f8945
@ -9,6 +9,16 @@
|
||||
|
||||
<spacer height="15" width="10"/>
|
||||
|
||||
<div width="75%" height="fit" layout="horizontal-row" >
|
||||
<label proportion="1" height="100%" text_align="right" I18N="In the multitouch settings screen" text="Device enabled"/>
|
||||
<div proportion="1" height="fit" layout="horizontal-row" >
|
||||
<spacer width="40" height="100%" />
|
||||
<checkbox id="buttons_enabled" width="40" height="40"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<spacer height="15" width="10"/>
|
||||
|
||||
<div width="75%" height="fit" layout="horizontal-row" >
|
||||
<label proportion="1" height="100%" text_align="right" I18N="In the multitouch settings screen" text="Buttons scale"/>
|
||||
<div proportion="1" height="fit" layout="horizontal-row" >
|
||||
|
@ -409,6 +409,11 @@ namespace UserConfigParams
|
||||
&m_multitouch_group,
|
||||
"Enable multitouch support.") );
|
||||
|
||||
PARAM_PREFIX IntUserConfigParam m_multitouch_mode
|
||||
PARAM_DEFAULT( IntUserConfigParam(1, "multitouch_mode",
|
||||
&m_multitouch_group,
|
||||
"Steering mode: 0 = off, 1 = buttons, 2 = accelerometer") );
|
||||
|
||||
PARAM_PREFIX FloatUserConfigParam m_multitouch_deadzone_center
|
||||
PARAM_DEFAULT( FloatUserConfigParam(0.1f, "multitouch_deadzone_center",
|
||||
&m_multitouch_group,
|
||||
|
@ -1129,30 +1129,26 @@ EventPropagation InputManager::input(const SEvent& event)
|
||||
|
||||
// Simulate touch event on non-android devices
|
||||
#if !defined(ANDROID)
|
||||
if (UserConfigParams::m_multitouch_enabled == true &&
|
||||
(type == EMIE_LMOUSE_PRESSED_DOWN || type == EMIE_LMOUSE_LEFT_UP ||
|
||||
type == EMIE_MOUSE_MOVED))
|
||||
MultitouchDevice* device = m_device_manager->getMultitouchDevice();
|
||||
|
||||
if (device != NULL && (type == EMIE_LMOUSE_PRESSED_DOWN ||
|
||||
type == EMIE_LMOUSE_LEFT_UP || type == EMIE_MOUSE_MOVED))
|
||||
{
|
||||
MultitouchDevice* device = m_device_manager->getMultitouchDevice();
|
||||
device->m_events[0].id = 0;
|
||||
device->m_events[0].x = event.MouseInput.X;
|
||||
device->m_events[0].y = event.MouseInput.Y;
|
||||
|
||||
if (device != NULL)
|
||||
if (type == EMIE_LMOUSE_PRESSED_DOWN)
|
||||
{
|
||||
device->m_events[0].id = 0;
|
||||
device->m_events[0].x = event.MouseInput.X;
|
||||
device->m_events[0].y = event.MouseInput.Y;
|
||||
|
||||
if (type == EMIE_LMOUSE_PRESSED_DOWN)
|
||||
{
|
||||
device->m_events[0].touched = true;
|
||||
}
|
||||
else if (type == EMIE_LMOUSE_LEFT_UP)
|
||||
{
|
||||
device->m_events[0].touched = false;
|
||||
}
|
||||
|
||||
m_device_manager->updateMultitouchDevice();
|
||||
device->updateDeviceState(0);
|
||||
device->m_events[0].touched = true;
|
||||
}
|
||||
else if (type == EMIE_LMOUSE_LEFT_UP)
|
||||
{
|
||||
device->m_events[0].touched = false;
|
||||
}
|
||||
|
||||
m_device_manager->updateMultitouchDevice();
|
||||
device->updateDeviceState(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -170,6 +170,7 @@ namespace Online
|
||||
curl_easy_setopt(m_curl_session, CURLOPT_CONNECTTIMEOUT, 20);
|
||||
curl_easy_setopt(m_curl_session, CURLOPT_LOW_SPEED_LIMIT, 10);
|
||||
curl_easy_setopt(m_curl_session, CURLOPT_LOW_SPEED_TIME, 20);
|
||||
curl_easy_setopt(m_curl_session, CURLOPT_NOSIGNAL, 1);
|
||||
//curl_easy_setopt(m_curl_session, CURLOPT_VERBOSE, 1L);
|
||||
if (m_url.substr(0, 8) == "https://")
|
||||
{
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "states_screens/dialogs/multitouch_settings_dialog.hpp"
|
||||
|
||||
#include "config/user_config.hpp"
|
||||
#include "guiengine/widgets/check_box_widget.hpp"
|
||||
#include "guiengine/widgets/spinner_widget.hpp"
|
||||
#include "input/device_manager.hpp"
|
||||
#include "input/input_manager.hpp"
|
||||
@ -74,6 +75,10 @@ GUIEngine::EventPropagation MultitouchSettingsDialog::processEvent(
|
||||
UserConfigParams::m_multitouch_deadzone_center =
|
||||
(float)deadzone_center->getValue() / 100.0f;
|
||||
|
||||
CheckBoxWidget* buttons_en = getWidget<CheckBoxWidget>("buttons_enabled");
|
||||
assert(buttons_en != NULL);
|
||||
UserConfigParams::m_multitouch_mode = buttons_en->getState() ? 1 : 0;
|
||||
|
||||
MultitouchDevice* touch_device = input_manager->getDeviceManager()->
|
||||
getMultitouchDevice();
|
||||
|
||||
@ -92,6 +97,7 @@ GUIEngine::EventPropagation MultitouchSettingsDialog::processEvent(
|
||||
UserConfigParams::m_multitouch_scale.revertToDefaults();
|
||||
UserConfigParams::m_multitouch_deadzone_edge.revertToDefaults();
|
||||
UserConfigParams::m_multitouch_deadzone_center.revertToDefaults();
|
||||
UserConfigParams::m_multitouch_mode.revertToDefaults();
|
||||
|
||||
updateValues();
|
||||
|
||||
@ -118,6 +124,10 @@ void MultitouchSettingsDialog::updateValues()
|
||||
assert(deadzone_center != NULL);
|
||||
deadzone_center->setValue(
|
||||
(int)(UserConfigParams::m_multitouch_deadzone_center * 100.0f));
|
||||
|
||||
CheckBoxWidget* buttons_en = getWidget<CheckBoxWidget>("buttons_enabled");
|
||||
assert(buttons_en != NULL);
|
||||
buttons_en->setState(UserConfigParams::m_multitouch_mode);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -85,7 +85,7 @@ RaceGUI::RaceGUI()
|
||||
const float top_margin = 3.5f * m_font_height;
|
||||
|
||||
// Check if we have enough space for minimap when touch steering is enabled
|
||||
if (UserConfigParams::m_multitouch_enabled)
|
||||
if (m_multitouch_gui != NULL)
|
||||
{
|
||||
const float map_bottom = (float)(m_multitouch_gui->getMinimapBottom());
|
||||
|
||||
@ -115,7 +115,7 @@ RaceGUI::RaceGUI()
|
||||
{
|
||||
m_map_left = irr_driver->getActualScreenSize().Width - m_map_width;
|
||||
}
|
||||
else if (UserConfigParams::m_multitouch_enabled)
|
||||
else if (m_multitouch_gui != NULL)
|
||||
{
|
||||
m_map_left = (int)((irr_driver->getActualScreenSize().Width -
|
||||
m_map_width) * 0.95f);
|
||||
@ -248,7 +248,7 @@ void RaceGUI::renderPlayerView(const Camera *camera, float dt)
|
||||
|
||||
drawPowerupIcons(kart, viewport, scaling);
|
||||
|
||||
if (!UserConfigParams::m_multitouch_enabled)
|
||||
if (m_multitouch_gui == NULL)
|
||||
{
|
||||
drawSpeedEnergyRank(kart, viewport, scaling, dt);
|
||||
}
|
||||
|
@ -103,6 +103,7 @@ RaceGUIBase::RaceGUIBase()
|
||||
m_multitouch_gui = NULL;
|
||||
|
||||
if (UserConfigParams::m_multitouch_enabled &&
|
||||
UserConfigParams::m_multitouch_mode != 0 &&
|
||||
race_manager->getNumLocalPlayers() == 1)
|
||||
{
|
||||
m_multitouch_gui = new RaceGUIMultitouch(this);
|
||||
@ -721,7 +722,7 @@ void RaceGUIBase::drawGlobalPlayerIcons(int bottom_margin)
|
||||
{
|
||||
y_icons_limit = irr_driver->getActualScreenSize().Height - ICON_WIDTH;
|
||||
}
|
||||
else if (UserConfigParams::m_multitouch_enabled)
|
||||
else if (m_multitouch_gui != NULL)
|
||||
{
|
||||
y_icons_limit = irr_driver->getActualScreenSize().Height / 2;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ RaceGUIOverworld::RaceGUIOverworld()
|
||||
const float map_size = 250.0f;
|
||||
|
||||
// Check if we have enough space for minimap when touch steering is enabled
|
||||
if (UserConfigParams::m_multitouch_enabled)
|
||||
if (m_multitouch_gui != NULL)
|
||||
{
|
||||
const float map_bottom = (float)(m_multitouch_gui->getMinimapBottom());
|
||||
|
||||
@ -115,7 +115,7 @@ RaceGUIOverworld::RaceGUIOverworld()
|
||||
{
|
||||
m_map_left = irr_driver->getActualScreenSize().Width - m_map_width;
|
||||
}
|
||||
else if (UserConfigParams::m_multitouch_enabled)
|
||||
else if (m_multitouch_gui != NULL)
|
||||
{
|
||||
m_map_left = (int)((irr_driver->getActualScreenSize().Width -
|
||||
m_map_width) * 0.9f);
|
||||
@ -190,7 +190,7 @@ void RaceGUIOverworld::renderGlobal(float dt)
|
||||
if(!world->isRacePhase()) return;
|
||||
if (!m_enabled) return;
|
||||
|
||||
if (!UserConfigParams::m_multitouch_enabled)
|
||||
if (m_multitouch_gui == NULL)
|
||||
{
|
||||
drawTrophyPoints();
|
||||
}
|
||||
@ -351,7 +351,7 @@ void RaceGUIOverworld::drawGlobalMiniMap()
|
||||
if(draw_at.getX()>right_most) right_most = draw_at.getX();
|
||||
}
|
||||
|
||||
if (UserConfigParams::m_multitouch_enabled)
|
||||
if (m_multitouch_gui != NULL)
|
||||
{
|
||||
m_map_left += m_map_width - (int)right_most;
|
||||
}
|
||||
|
@ -104,6 +104,20 @@ void SoccerSetupScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
getWidget<SpinnerWidget>("goalamount")->setActive(!timed);
|
||||
getWidget<SpinnerWidget>("timeamount")->setActive(timed);
|
||||
}
|
||||
else if (name == "red_team")
|
||||
{
|
||||
if (m_kart_view_info.size() == 1)
|
||||
{
|
||||
changeTeam(0, SOCCER_TEAM_RED);
|
||||
}
|
||||
}
|
||||
else if (name == "blue_team")
|
||||
{
|
||||
if (m_kart_view_info.size() == 1)
|
||||
{
|
||||
changeTeam(0, SOCCER_TEAM_BLUE);
|
||||
}
|
||||
}
|
||||
} // eventCallback
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -271,6 +285,37 @@ void SoccerSetupScreen::tearDown()
|
||||
Screen::tearDown();
|
||||
} // tearDown
|
||||
|
||||
void SoccerSetupScreen::changeTeam(int player_id, SoccerTeam team)
|
||||
{
|
||||
if (team == SOCCER_TEAM_NONE)
|
||||
return;
|
||||
|
||||
if (team == m_kart_view_info[player_id].team)
|
||||
return;
|
||||
|
||||
// Change the kart color
|
||||
if (m_kart_view_info[player_id].support_colorization)
|
||||
{
|
||||
KartRenderType krt = team == SOCCER_TEAM_RED ? KRT_RED : KRT_BLUE;
|
||||
m_kart_view_info[player_id].view->getModelViewRenderInfo()
|
||||
->setKartModelRenderInfo(krt);
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < m_kart_view_info.size(); i++)
|
||||
{
|
||||
m_kart_view_info[i].view->unsetBadge(BAD_BADGE);
|
||||
}
|
||||
|
||||
if (m_kart_view_info.size() == 1)
|
||||
{
|
||||
UserConfigParams::m_soccer_default_team = (int)team;
|
||||
}
|
||||
|
||||
race_manager->setKartSoccerTeam(player_id, team);
|
||||
m_kart_view_info[player_id].team = team;
|
||||
updateKartViewsLayout();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
GUIEngine::EventPropagation SoccerSetupScreen::filterActions(PlayerAction action,
|
||||
int deviceID,
|
||||
@ -283,50 +328,27 @@ GUIEngine::EventPropagation SoccerSetupScreen::filterActions(PlayerAction action
|
||||
|
||||
ButtonWidget* bt_continue = getWidget<ButtonWidget>("continue");
|
||||
BubbleWidget* bubble = getWidget<BubbleWidget>("lblLeftRight");
|
||||
GUIEngine::EventPropagation result = EVENT_LET;
|
||||
SoccerTeam team_switch = SOCCER_TEAM_NONE;
|
||||
int nb_players = (int)m_kart_view_info.size();
|
||||
|
||||
switch(action)
|
||||
switch (action)
|
||||
{
|
||||
case PA_MENU_LEFT:
|
||||
if ((bt_continue->isFocusedForPlayer(PLAYER_ID_GAME_MASTER) ||
|
||||
bubble->isFocusedForPlayer(PLAYER_ID_GAME_MASTER)) &&
|
||||
m_kart_view_info[playerId].confirmed == false)
|
||||
if (bt_continue->isFocusedForPlayer(PLAYER_ID_GAME_MASTER) ||
|
||||
bubble->isFocusedForPlayer(PLAYER_ID_GAME_MASTER))
|
||||
{
|
||||
team_switch = SOCCER_TEAM_RED;
|
||||
if (m_kart_view_info[playerId].confirmed == false)
|
||||
changeTeam(playerId, SOCCER_TEAM_RED);
|
||||
|
||||
// Change the kart color
|
||||
if (m_kart_view_info[playerId].support_colorization)
|
||||
{
|
||||
m_kart_view_info[playerId].view->getModelViewRenderInfo()
|
||||
->setKartModelRenderInfo(KRT_RED);
|
||||
}
|
||||
|
||||
for(int i=0 ; i < nb_players ; i++)
|
||||
{
|
||||
m_kart_view_info[i].view->unsetBadge(BAD_BADGE);
|
||||
}
|
||||
return EVENT_BLOCK;
|
||||
}
|
||||
break;
|
||||
case PA_MENU_RIGHT:
|
||||
if ((bt_continue->isFocusedForPlayer(PLAYER_ID_GAME_MASTER) ||
|
||||
bubble->isFocusedForPlayer(PLAYER_ID_GAME_MASTER)) &&
|
||||
m_kart_view_info[playerId].confirmed == false)
|
||||
if (bt_continue->isFocusedForPlayer(PLAYER_ID_GAME_MASTER) ||
|
||||
bubble->isFocusedForPlayer(PLAYER_ID_GAME_MASTER))
|
||||
{
|
||||
team_switch = SOCCER_TEAM_BLUE;
|
||||
if (m_kart_view_info[playerId].confirmed == false)
|
||||
changeTeam(playerId, SOCCER_TEAM_BLUE);
|
||||
|
||||
// Change the kart color
|
||||
if (m_kart_view_info[playerId].support_colorization)
|
||||
{
|
||||
m_kart_view_info[playerId].view->getModelViewRenderInfo()
|
||||
->setKartModelRenderInfo(KRT_BLUE);
|
||||
}
|
||||
|
||||
for(int i=0 ; i < nb_players ; i++)
|
||||
{
|
||||
m_kart_view_info[i].view->unsetBadge(BAD_BADGE);
|
||||
}
|
||||
return EVENT_BLOCK;
|
||||
}
|
||||
break;
|
||||
case PA_MENU_UP:
|
||||
@ -339,42 +361,53 @@ GUIEngine::EventPropagation SoccerSetupScreen::filterActions(PlayerAction action
|
||||
break;
|
||||
case PA_MENU_SELECT:
|
||||
{
|
||||
if (!bt_continue->isFocusedForPlayer(PLAYER_ID_GAME_MASTER) ||
|
||||
areAllKartsConfirmed())
|
||||
if (!bt_continue->isFocusedForPlayer(PLAYER_ID_GAME_MASTER) &&
|
||||
!bubble->isFocusedForPlayer(PLAYER_ID_GAME_MASTER) &&
|
||||
playerId == PLAYER_ID_GAME_MASTER)
|
||||
{
|
||||
return result;
|
||||
return EVENT_LET;
|
||||
}
|
||||
|
||||
if (bt_continue->isFocusedForPlayer(PLAYER_ID_GAME_MASTER) &&
|
||||
m_kart_view_info[playerId].confirmed)
|
||||
if (!m_kart_view_info[playerId].confirmed)
|
||||
{
|
||||
return EVENT_BLOCK;
|
||||
// Confirm team selection
|
||||
m_kart_view_info[playerId].confirmed = true;
|
||||
m_kart_view_info[playerId].view->setRotateTo(
|
||||
KART_CONFIRMATION_TARGET_ANGLE,
|
||||
KART_CONFIRMATION_ROTATION_SPEED);
|
||||
m_kart_view_info[playerId].view->setBadge(OK_BADGE);
|
||||
m_kart_view_info[playerId].view->unsetBadge(BAD_BADGE);
|
||||
SFXManager::get()->quickSound( "wee" );
|
||||
}
|
||||
|
||||
if (areAllKartsConfirmed())
|
||||
{
|
||||
m_schedule_continue = true;
|
||||
}
|
||||
|
||||
// Confirm team selection
|
||||
m_kart_view_info[playerId].confirmed = true;
|
||||
m_kart_view_info[playerId].view->setRotateTo( KART_CONFIRMATION_TARGET_ANGLE, KART_CONFIRMATION_ROTATION_SPEED );
|
||||
m_kart_view_info[playerId].view->setBadge(OK_BADGE);
|
||||
m_kart_view_info[playerId].view->unsetBadge(BAD_BADGE);
|
||||
SFXManager::get()->quickSound( "wee" );
|
||||
return EVENT_BLOCK;
|
||||
}
|
||||
case PA_MENU_CANCEL:
|
||||
{
|
||||
if (!bt_continue->isFocusedForPlayer(PLAYER_ID_GAME_MASTER) &&
|
||||
!bubble->isFocusedForPlayer(PLAYER_ID_GAME_MASTER) &&
|
||||
playerId == PLAYER_ID_GAME_MASTER)
|
||||
{
|
||||
return result;
|
||||
return EVENT_LET;
|
||||
}
|
||||
|
||||
// Un-confirm team selection
|
||||
m_kart_view_info[playerId].confirmed = false;
|
||||
m_kart_view_info[playerId].view->setRotateContinuously( KART_CONTINUOUS_ROTATION_SPEED );
|
||||
m_kart_view_info[playerId].view->unsetBadge(OK_BADGE);
|
||||
|
||||
for(int i=0 ; i < nb_players ; i++)
|
||||
if (m_kart_view_info[playerId].confirmed)
|
||||
{
|
||||
m_kart_view_info[i].view->unsetBadge(BAD_BADGE);
|
||||
// Un-confirm team selection
|
||||
m_kart_view_info[playerId].confirmed = false;
|
||||
m_kart_view_info[playerId].view->setRotateContinuously(
|
||||
KART_CONTINUOUS_ROTATION_SPEED);
|
||||
m_kart_view_info[playerId].view->unsetBadge(OK_BADGE);
|
||||
|
||||
for (unsigned int i = 0; i < m_kart_view_info.size(); i++)
|
||||
{
|
||||
m_kart_view_info[i].view->unsetBadge(BAD_BADGE);
|
||||
}
|
||||
}
|
||||
|
||||
return EVENT_BLOCK;
|
||||
@ -383,16 +416,7 @@ GUIEngine::EventPropagation SoccerSetupScreen::filterActions(PlayerAction action
|
||||
break;
|
||||
}
|
||||
|
||||
if(team_switch != SOCCER_TEAM_NONE) // A player wants to change his team?
|
||||
{
|
||||
if (nb_players == 1)
|
||||
UserConfigParams::m_soccer_default_team = (int)team_switch;
|
||||
race_manager->setKartSoccerTeam(playerId, team_switch);
|
||||
m_kart_view_info[playerId].team = team_switch;
|
||||
updateKartViewsLayout();
|
||||
}
|
||||
|
||||
return result;
|
||||
return EVENT_LET;
|
||||
} // filterActions
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -82,6 +82,7 @@ private:
|
||||
bool areAllKartsConfirmed() const;
|
||||
int getNumConfirmedKarts();
|
||||
void updateKartViewsLayout();
|
||||
void changeTeam(int player_id, SoccerTeam team);
|
||||
};
|
||||
|
||||
#endif // HEADER_SOCCER_SETUP_SCREEN_HPP
|
||||
|
Loading…
Reference in New Issue
Block a user