Show explainatory message when some player tries to perform an action that is reserved to the game master. Hopefully this will help reduce confusion
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5080 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -66,6 +66,12 @@ namespace GUIEngine
|
||||
return dt;
|
||||
}
|
||||
|
||||
float masterOnlyMessageTime = 0.0f;
|
||||
void showMasterOnlyString()
|
||||
{
|
||||
masterOnlyMessageTime = 5.0f;
|
||||
}
|
||||
|
||||
Widget* getFocusForPlayer(const int playerID)
|
||||
{
|
||||
assert(playerID >= 0);
|
||||
@@ -307,6 +313,24 @@ void render(float elapsed_time)
|
||||
else World::getWorld()->getRaceGUI()->renderGlobal(elapsed_time);
|
||||
}
|
||||
|
||||
|
||||
if (masterOnlyMessageTime > 0)
|
||||
{
|
||||
masterOnlyMessageTime -= dt;
|
||||
|
||||
core::dimension2d<u32> screen_size = irr_driver->getFrameSize();
|
||||
const int text_height = getFontHeight() + 20;
|
||||
const int y_from = screen_size.Height - text_height;
|
||||
|
||||
//I18N: message shown when a player that isn't game master tries to modify options that
|
||||
//I18N: only the game master is allowed to
|
||||
Private::g_font->draw(_("Only the Game Master may act at this point!"),
|
||||
core::rect<s32>( core::position2d<s32>(0,y_from),
|
||||
core::dimension2d<s32>(screen_size.Width, text_height) ),
|
||||
video::SColor(255, 255, 0, 0),
|
||||
true /* hcenter */, true /* vcenter */);
|
||||
}
|
||||
|
||||
#if (IRRLICHT_VERSION_MAJOR == 1) && (IRRLICHT_VERSION_MINOR >= 7)
|
||||
g_driver->enableMaterial2D(false);
|
||||
#endif
|
||||
|
||||
@@ -286,8 +286,11 @@ namespace GUIEngine
|
||||
|
||||
float getLatestDt();
|
||||
|
||||
/** show a warning message to explain to the player that only the game master cn act at this point */
|
||||
void showMasterOnlyString();
|
||||
|
||||
/** Add a cutscene to the list of screens known by the gui engine */
|
||||
void addScreenToList(Screen* screen);
|
||||
void addScreenToList(Screen* screen);
|
||||
|
||||
// Widgets that need to be notified at every frame can add themselves there
|
||||
extern ptr_vector<Widget, REF> needsUpdate;
|
||||
|
||||
@@ -420,7 +420,11 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID, int btnID,
|
||||
|
||||
// When in master-only mode, we can safely assume that players are set up, contrarly to
|
||||
// early menus where we accept every input because players are not set-up yet
|
||||
if (m_master_player_only && player == NULL) return;
|
||||
if (m_master_player_only && player == NULL)
|
||||
{
|
||||
GUIEngine::showMasterOnlyString();
|
||||
return;
|
||||
}
|
||||
|
||||
// menu input
|
||||
if (!m_timer_in_use)
|
||||
@@ -434,7 +438,12 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID, int btnID,
|
||||
int playerID = (player == NULL ? 0 : player->getID());
|
||||
|
||||
// If only the master player can act, and this player is not the master, ignore his input
|
||||
if (m_device_manager->getAssignMode() == ASSIGN && m_master_player_only && playerID != 0) return;
|
||||
if (m_device_manager->getAssignMode() == ASSIGN && m_master_player_only && playerID != 0)
|
||||
{
|
||||
GUIEngine::showMasterOnlyString();
|
||||
return;
|
||||
}
|
||||
|
||||
GUIEngine::EventHandler::get()->processAction(action, abs(value), type, playerID);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user