Add a few more hit messages
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11044 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
2e43a1b24a
commit
84cfaba0f6
@ -141,7 +141,7 @@ void Cake::init(const XMLNode &node, scene::IMesh *cake_model)
|
||||
*/
|
||||
const core::stringw Cake::getHitString(const AbstractKart *kart) const
|
||||
{
|
||||
const int CAKE_STRINGS_AMOUNT = 3;
|
||||
const int CAKE_STRINGS_AMOUNT = 4;
|
||||
RandomGenerator r;
|
||||
switch (r.get(CAKE_STRINGS_AMOUNT))
|
||||
{
|
||||
@ -151,6 +151,8 @@ const core::stringw Cake::getHitString(const AbstractKart *kart) const
|
||||
case 1: return _LTR("%0 is dubious of %1's cooking skills");
|
||||
//I18N: shown when hit by cake. %1 is the attacker, %0 is the victim.
|
||||
case 2: return _LTR("%0 should not play with %1's lunch");
|
||||
//I18N: shown when hit by cake. %1 is the attacker, %0 is the victim.
|
||||
case 4: return _LTR("%1 ruins %0's cakeless diet");
|
||||
default: assert(false); return L""; // avoid compiler warning
|
||||
}
|
||||
} // getHitString
|
||||
|
@ -283,6 +283,17 @@ void Swatter::squashThingsAround()
|
||||
if(dist2 >= min_dist2) continue; // too far away, ignore this kart
|
||||
|
||||
kart->setSquash(kp->getSquashDuration(), kp->getSquashSlowdown());
|
||||
|
||||
RaceGUIBase* gui = World::getWorld()->getRaceGUI();
|
||||
irr::core::stringw hit_message =
|
||||
StringUtils::insertValues(getHitString(kart),
|
||||
core::stringw(kart->getName()),
|
||||
core::stringw(m_kart->getName())
|
||||
);
|
||||
if(hit_message.size()>0)
|
||||
gui->addMessage(translations->fribidize(hit_message), NULL, 3.0f,
|
||||
video::SColor(255, 255, 255, 255), false);
|
||||
|
||||
if (kart->getAttachment()->getType()==Attachment::ATTACH_BOMB)
|
||||
{ // make bomb explode
|
||||
kart->getAttachment()->update(10000);
|
||||
@ -297,3 +308,27 @@ void Swatter::squashThingsAround()
|
||||
|
||||
// TODO: squash items
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Picks a random message to be displayed when a kart is hit by a swatter
|
||||
* \param kart The kart that was hit.
|
||||
* \returns The string to display.
|
||||
*/
|
||||
const core::stringw Swatter::getHitString(const AbstractKart *kart) const
|
||||
{
|
||||
RandomGenerator r;
|
||||
|
||||
const int SWATTER_STRINGS_AMOUNT = 3;
|
||||
switch (r.get(SWATTER_STRINGS_AMOUNT))
|
||||
{
|
||||
//I18N: shown when hit by swatter. %1 is the attacker, %0 is the victim.
|
||||
case 0 : return _LTR("%1 thinks %0 is a big fly");
|
||||
//I18N: shown when hit by swatter. %1 is the attacker, %0 is the victim.
|
||||
case 1 : return _LTR("%1 flattens %0");
|
||||
//I18N: shown when hit by bowling ball. %1 is the attacker, %0 is the victim.
|
||||
case 2 : return _LTR("%0 feels flat today");
|
||||
default: assert(false); return L""; // avoid compiler warning
|
||||
}
|
||||
}
|
@ -67,6 +67,8 @@ private:
|
||||
/** For some reason the built-in animation system doesn't work correctly here?? */
|
||||
float m_swat_bomb_frame;
|
||||
|
||||
const core::stringw getHitString(const AbstractKart *kart) const;
|
||||
|
||||
public:
|
||||
Swatter(AbstractKart *kart, bool was_bomb,
|
||||
scene::ISceneNode* bomb_scene_node);
|
||||
|
Loading…
Reference in New Issue
Block a user