Remove unused parameter for race GUI message, plus use title font for the WRONG WAY message instead of this ugly pink font that was there before

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9731 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-09-03 20:23:55 +00:00
parent 1c43c1ace4
commit 68b56d0c05
11 changed files with 55 additions and 34 deletions

View File

@ -438,7 +438,7 @@ bool Flyable::hit(Kart *kart_hit, PhysicalObject* object)
); );
if(hit_message.size()>0) if(hit_message.size()>0)
gui->addMessage(translations->fribidize(hit_message), NULL, 3.0f, gui->addMessage(translations->fribidize(hit_message), NULL, 3.0f,
40, video::SColor(255, 255, 255, 255), false); video::SColor(255, 255, 255, 255), false);
} }
m_has_hit_something=true; m_has_hit_something=true;

View File

@ -191,7 +191,8 @@ bool Plunger::hit(Kart *kart, PhysicalObject *obj)
core::stringw(kart->getName()), core::stringw(kart->getName()),
core::stringw(m_owner->getName()) core::stringw(m_owner->getName())
).c_str(); ).c_str();
gui->addMessage(translations->fribidize(hit_message), NULL, 3.0f, 40, video::SColor(255, 255, 255, 255), false); gui->addMessage(translations->fribidize(hit_message), NULL, 3.0f,
video::SColor(255, 255, 255, 255), false);
} }
m_keep_alive = 0; m_keep_alive = 0;

View File

@ -223,7 +223,7 @@ void Powerup::use()
m_sound_use->position(m_owner->getXYZ()); m_sound_use->position(m_owner->getXYZ());
m_sound_use->play(); m_sound_use->play();
gui->addMessage(getSwapperString(), NULL, 3.0f, 40, gui->addMessage(getSwapperString(), NULL, 3.0f,
video::SColor(255, 255, 255, 255), false); video::SColor(255, 255, 255, 255), false);
break; break;
} }
@ -330,7 +330,8 @@ void Powerup::use()
irr::core::stringw anchor_message; irr::core::stringw anchor_message;
anchor_message += StringUtils::insertValues(getAnchorString(), core::stringw(kart->getName())); anchor_message += StringUtils::insertValues(getAnchorString(), core::stringw(kart->getName()));
gui->addMessage(translations->fribidize(anchor_message), NULL, 3.0f, 40, video::SColor(255, 255, 255, 255), false); gui->addMessage(translations->fribidize(anchor_message), NULL, 3.0f,
video::SColor(255, 255, 255, 255), false);
break; break;
} }
} }
@ -367,7 +368,8 @@ void Powerup::use()
m_sound_use->position(player_kart->getXYZ()); m_sound_use->position(player_kart->getXYZ());
m_sound_use->play(); m_sound_use->play();
gui->addMessage(getParachuteString(), NULL, 3.0f, 40, video::SColor(255, 255, 255, 255), false); gui->addMessage(getParachuteString(), NULL, 3.0f,
video::SColor(255, 255, 255, 255), false);
} }
break; break;

View File

@ -248,7 +248,8 @@ void RubberBand::hit(Kart *kart_hit, const Vec3 *track_xyz)
core::stringw(kart_hit->getName()), core::stringw(kart_hit->getName()),
core::stringw(m_owner->getName()) core::stringw(m_owner->getName())
).c_str(); ).c_str();
gui->addMessage(translations->fribidize(hit_message), NULL, 3.0f, 40, video::SColor(255, 255, 255, 255), false); gui->addMessage(translations->fribidize(hit_message), NULL, 3.0f,
video::SColor(255, 255, 255, 255), false);
return; return;
} }

View File

@ -290,8 +290,10 @@ void PlayerController::update(float dt)
RaceGUIBase* m=World::getWorld()->getRaceGUI(); RaceGUIBase* m=World::getWorld()->getRaceGUI();
if(m) if(m)
{ {
m->addMessage(_("Penalty time!!"), m_kart, 2.0f, 90, video::SColor(255, 255, 128, 0)); m->addMessage(_("Penalty time!!"), m_kart, 2.0f,
m->addMessage(_("Don't accelerate before go"), m_kart, 2.0f, 60, video::SColor(255, 210, 100, 50)); video::SColor(255, 255, 128, 0));
m->addMessage(_("Don't accelerate before go"), m_kart, 2.0f,
video::SColor(255, 210, 100, 50));
} }
m_bzzt_sound->play(); m_bzzt_sound->play();
} // if penalty_time = 0 } // if penalty_time = 0

View File

@ -615,7 +615,7 @@ void Kart::finishedRace(float time)
if(m) if(m)
{ {
m->addMessage((getPosition() == 1 ? _("You won the race!") : _("You finished the race!")) , m->addMessage((getPosition() == 1 ? _("You won the race!") : _("You finished the race!")) ,
this, 2.0f, 60); this, 2.0f);
} }
} }
else if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_FOLLOW_LEADER) else if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_FOLLOW_LEADER)
@ -634,7 +634,7 @@ void Kart::finishedRace(float time)
if(m) if(m)
{ {
m->addMessage((getPosition() == 2 ? _("You won the race!") : _("You finished the race!")) , m->addMessage((getPosition() == 2 ? _("You won the race!") : _("You finished the race!")) ,
this, 2.0f, 60); this, 2.0f);
} }
} }
else if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_3_STRIKES) else if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_3_STRIKES)

View File

@ -226,7 +226,7 @@ void LinearWorld::newLap(unsigned int kart_index)
if(kart_info.m_race_lap+1 == lap_count) if(kart_info.m_race_lap+1 == lap_count)
{ {
m_race_gui->addMessage(_("Final lap!"), kart, m_race_gui->addMessage(_("Final lap!"), kart,
3.0f, 40, video::SColor(255, 210, 100, 50), true); 3.0f, video::SColor(255, 210, 100, 50), true);
if(!m_last_lap_sfx_played && lap_count > 1) if(!m_last_lap_sfx_played && lap_count > 1)
{ {
if (UserConfigParams::m_music) if (UserConfigParams::m_music)
@ -251,7 +251,7 @@ void LinearWorld::newLap(unsigned int kart_index)
else if (kart_info.m_race_lap > 0 && kart_info.m_race_lap+1 < lap_count) else if (kart_info.m_race_lap > 0 && kart_info.m_race_lap+1 < lap_count)
{ {
m_race_gui->addMessage(_("Lap %i", kart_info.m_race_lap+1), m_race_gui->addMessage(_("Lap %i", kart_info.m_race_lap+1),
kart, 3.0f, 40, video::SColor(255, 210, 100, 50), true); kart, 3.0f, video::SColor(255, 210, 100, 50), true);
} }
// The race positions must be updated here: consider the situation where // The race positions must be updated here: consider the situation where
@ -309,10 +309,10 @@ void LinearWorld::newLap(unsigned int kart_index)
m_fastest_lap_message += _("%s by %s", s.c_str(), core::stringw(kart->getName())); m_fastest_lap_message += _("%s by %s", s.c_str(), core::stringw(kart->getName()));
m_race_gui->addMessage(m_fastest_lap_message, NULL, m_race_gui->addMessage(m_fastest_lap_message, NULL,
3.0f, 40, video::SColor(255, 255, 255, 255), false); 3.0f, video::SColor(255, 255, 255, 255), false);
m_race_gui->addMessage(_("New fastest lap"), NULL, m_race_gui->addMessage(_("New fastest lap"), NULL,
3.0f, 40, video::SColor(255, 255, 255, 255), false); 3.0f, video::SColor(255, 255, 255, 255), false);
} // end if new fastest lap } // end if new fastest lap
@ -753,7 +753,9 @@ void LinearWorld::checkForWrongDirection(unsigned int i)
kart->getVelocityLC().getY() > 0.0f && kart->getVelocityLC().getY() > 0.0f &&
!kart->hasFinishedRace() ) !kart->hasFinishedRace() )
{ {
m_race_gui->addMessage(_("WRONG WAY!"), kart, -1.0f, 60); m_race_gui->addMessage(_("WRONG WAY!"), kart, -1.0f /* time */,
video::SColor(255,255,255,255), true /* important */,
true /* big font */);
} // if angle is too big } // if angle is too big
} // checkForWrongDirection } // checkForWrongDirection

View File

@ -790,12 +790,12 @@ void World::removeKart(int kart_number, bool notifyOfElimination)
if(!(*i)->getCamera()) continue; if(!(*i)->getCamera()) continue;
if(*i==kart) if(*i==kart)
{ {
m_race_gui->addMessage(_("You have been eliminated!"), *i, 2.0f, 60); m_race_gui->addMessage(_("You have been eliminated!"), *i, 2.0f);
} }
else else
{ {
m_race_gui->addMessage(_("'%s' has been eliminated.", core::stringw(kart->getName())), m_race_gui->addMessage(_("'%s' has been eliminated.",
*i, 2.0f, 60); core::stringw(kart->getName())), *i, 2.0f);
} }
} // for i in kart } // for i in kart
} }

View File

@ -232,6 +232,8 @@ void RaceGUIBase::drawAllMessages(const Kart* kart,
y = (int)(viewport.UpperLeftCorner.Y + 164*scaling.Y); y = (int)(viewport.UpperLeftCorner.Y + 164*scaling.Y);
gui::ScalableFont* font = GUIEngine::getFont(); gui::ScalableFont* font = GUIEngine::getFont();
gui::ScalableFont* big_font = GUIEngine::getTitleFont();
int font_height = m_max_font_height; int font_height = m_max_font_height;
if (race_manager->getNumLocalPlayers() > 2) if (race_manager->getNumLocalPlayers() > 2)
{ {
@ -257,11 +259,20 @@ void RaceGUIBase::drawAllMessages(const Kart* kart,
core::rect<s32> pos(x - w/2, y, x + w/2, y + font_height); core::rect<s32> pos(x - w/2, y, x + w/2, y + font_height);
font->draw(core::stringw(msg.m_message.c_str()).c_str(), if (msg.m_big_font)
pos, msg.m_color, true /* hcenter */, {
true /* vcenter */); big_font->draw(core::stringw(msg.m_message.c_str()).c_str(),
pos, msg.m_color, true /* hcenter */,
y += font_height; true /* vcenter */);
y += GUIEngine::getTitleFontHeight();
}
else
{
font->draw(core::stringw(msg.m_message.c_str()).c_str(),
pos, msg.m_color, true /* hcenter */,
true /* vcenter */);
y += font_height;
}
} // for i in all messages } // for i in all messages
} // drawAllMessages } // drawAllMessages
@ -398,11 +409,10 @@ void RaceGUIBase::renderPlayerView(const Kart *kart)
* once). * once).
**/ **/
void RaceGUIBase::addMessage(const core::stringw &msg, const Kart *kart, void RaceGUIBase::addMessage(const core::stringw &msg, const Kart *kart,
float time, int font_size, float time, const video::SColor &color,
const video::SColor &color, bool important) bool important, bool big_font)
{ {
m_messages.push_back(TimedMessage(msg, kart, time, font_size, color, m_messages.push_back(TimedMessage(msg, kart, time, color, important, big_font));
important));
} // addMessage } // addMessage
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -78,23 +78,25 @@ private:
irr::core::stringw m_message; //!< message to display irr::core::stringw m_message; //!< message to display
float m_remaining_time; //!< time remaining before removing this message from screen float m_remaining_time; //!< time remaining before removing this message from screen
video::SColor m_color; //!< color of message video::SColor m_color; //!< color of message
int m_font_size; //!< size
const Kart *m_kart; const Kart *m_kart;
bool m_important; //!< Important msgs are displayed in the middle of the screen bool m_important; //!< Important msgs are displayed in the middle of the screen
bool m_big_font;
// ----------------------------------------------------- // -----------------------------------------------------
// std::vector needs standard copy-ctor and std-assignment op. // std::vector needs standard copy-ctor and std-assignment op.
// let compiler create defaults .. they'll do the job, no // let compiler create defaults .. they'll do the job, no
// deep copies here .. // deep copies here ..
TimedMessage(const irr::core::stringw &message, TimedMessage(const irr::core::stringw &message,
const Kart *kart, float time, int size, const Kart *kart, float time,
const video::SColor &color, const bool important) const video::SColor &color, const bool important,
bool big_font)
{ {
m_message = message; m_message = message;
m_font_size = size;
m_kart = kart; m_kart = kart;
m_remaining_time = ( time < 0.0f ) ? -1.0f : time; m_remaining_time = ( time < 0.0f ) ? -1.0f : time;
m_color = color; m_color = color;
m_important = important; m_important = important;
m_big_font = big_font;
} // TimedMessage } // TimedMessage
// ----------------------------------------------------- // -----------------------------------------------------
// in follow leader the clock counts backwards // in follow leader the clock counts backwards
@ -164,10 +166,11 @@ public:
virtual void renderGlobal(float dt); virtual void renderGlobal(float dt);
virtual void renderPlayerView(const Kart *kart); virtual void renderPlayerView(const Kart *kart);
virtual void addMessage(const irr::core::stringw &m, const Kart *kart, virtual void addMessage(const irr::core::stringw &m, const Kart *kart,
float time, int fonst_size, float time,
const video::SColor &color= const video::SColor &color=
video::SColor(255, 255, 0, 255), video::SColor(255, 255, 0, 255),
bool important=true); bool important=true,
bool big_font=false);
/** Returns the size of the texture on which to render the minimap to. */ /** Returns the size of the texture on which to render the minimap to. */
virtual const core::dimension2du virtual const core::dimension2du
getMiniMapSize() const = 0; getMiniMapSize() const = 0;

View File

@ -219,7 +219,7 @@ public:
* than one lap). So do nothing in this case. * than one lap). So do nothing in this case.
*/ */
virtual void addMessage(const irr::core::stringw &m, const Kart *kart, virtual void addMessage(const irr::core::stringw &m, const Kart *kart,
float time, int fonst_size, float time,
const video::SColor &color= const video::SColor &color=
video::SColor(255, 255, 0, 255), video::SColor(255, 255, 0, 255),
bool important=true) { } bool important=true) { }