Show powerups and nitro in spectator mode on android

This commit is contained in:
Deve 2019-01-12 21:51:02 +01:00
parent 43885eacf2
commit 9d42b70dda
3 changed files with 9 additions and 6 deletions

View File

@ -127,7 +127,7 @@ RaceGUI::RaceGUI()
}
// Check if we have enough space for minimap when touch steering is enabled
if (m_multitouch_gui != NULL)
if (m_multitouch_gui != NULL && !m_multitouch_gui->isSpectatorMode())
{
const float map_bottom = (float)(irr_driver->getActualScreenSize().Height -
m_multitouch_gui->getHeight());
@ -172,7 +172,7 @@ RaceGUI::RaceGUI()
m_map_width - (int)( 10.0f * scaling);
m_map_bottom = (int)( 10.0f * scaling);
}
else if (m_multitouch_gui != NULL)
else if (m_multitouch_gui != NULL && !m_multitouch_gui->isSpectatorMode())
{
m_map_left = (int)((irr_driver->getActualScreenSize().Width -
m_map_width) * 0.95f);
@ -342,7 +342,7 @@ void RaceGUI::renderPlayerView(const Camera *camera, float dt)
if(!World::getWorld()->isRacePhase()) return;
if (m_multitouch_gui == NULL)
if (m_multitouch_gui == NULL || m_multitouch_gui->isSpectatorMode())
{
drawPowerupIcons(kart, viewport, scaling);
drawSpeedEnergyRank(kart, viewport, scaling, dt);
@ -496,7 +496,7 @@ void RaceGUI::drawGlobalMiniMap()
if (UserConfigParams::m_minimap_display == 2) /*map hidden*/
return;
if (m_multitouch_gui != NULL)
if (m_multitouch_gui != NULL && !m_multitouch_gui->isSpectatorMode())
{
float max_scale = 1.3f;

View File

@ -44,6 +44,7 @@ RaceGUIMultitouch::RaceGUIMultitouch(RaceGUIBase* race_gui)
{
m_race_gui = race_gui;
m_gui_action = false;
m_is_spectator_mode = false;
m_height = 0;
m_steering_wheel_tex = NULL;
m_up_down_tex = NULL;
@ -129,6 +130,7 @@ void RaceGUIMultitouch::init()
if (cl && cl->isSpectator())
{
createSpectatorGUI();
m_is_spectator_mode = true;
}
else
{
@ -246,7 +248,6 @@ void RaceGUIMultitouch::createSpectatorGUI()
{
const float scale = UserConfigParams::m_multitouch_scale;
const int w = irr_driver->getActualScreenSize().Width;
const int h = irr_driver->getActualScreenSize().Height;
const float btn_size = 0.125f * h * scale;
const float margin = 0.075f * h * scale;
@ -271,7 +272,7 @@ void RaceGUIMultitouch::createSpectatorGUI()
int(btn_size), int(btn_size), onCustomButtonPress);
m_device->addButton(BUTTON_CUSTOM,
int(w - margin - btn_size), int(h - margin - btn_size),
int(margin * 3 + btn_size * 2), int(h - margin - btn_size),
int(btn_size), int(btn_size), onCustomButtonPress);
} // createSpectatorGUI

View File

@ -36,6 +36,7 @@ private:
MultitouchDevice* m_device;
bool m_gui_action;
bool m_is_spectator_mode;
unsigned int m_height;
video::ITexture* m_steering_wheel_tex;
@ -66,6 +67,7 @@ public:
const core::vector2df &scaling);
unsigned int getHeight() {return m_height;}
bool isSpectatorMode() {return m_is_spectator_mode;}
void setGuiAction(bool enabled = true) {m_gui_action = enabled;}
void reset();