Goodbye hit messages (note: I had to rebuild from scratch

to avoid some strange crashes).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14581 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2013-11-27 21:43:34 +00:00
parent e877e27f4f
commit 05607e862e
12 changed files with 1 additions and 176 deletions

View File

@ -110,51 +110,6 @@ void Bowling::init(const XMLNode &node, scene::IMesh *bowling)
node.get("force-to-target", &m_st_force_to_target);
} // init
// ----------------------------------------------------------------------------
/** Picks a random message to be displayed when a kart is hit by a bowling
* ball. This function picks a different message if a kart hit itself.
* \param kart The kart that was hit.
* \returns The string to display.
*/
const core::stringw Bowling::getHitString(const AbstractKart *kart) const
{
RandomGenerator r;
if(kart!=m_owner)
{
const int BOWLING_STRINGS_AMOUNT = 3;
switch (r.get(BOWLING_STRINGS_AMOUNT))
{
//I18N: shown when hit by bowling ball. %1 is the attacker, %0 is
// the victim.
case 0 : return _LTR("%0 will not go bowling with %1 again");
//I18N: shown when hit by bowling ball. %1 is the attacker, %0 is
// the victim.
case 1 : return _LTR("%1 strikes %0");
//I18N: shown when hit by bowling ball. %1 is the attacker, %0 is
// the victim.
case 2 : return _LTR("%0 is bowled over by %1");
default: assert(false); return L""; // avoid compiler warning
}
}
else
{
const int SELFBOWLING_STRINGS_AMOUNT = 3;
switch (r.get(SELFBOWLING_STRINGS_AMOUNT))
{
//I18N: shown when hit by own bowling ball. %s is the kart.
case 0 : return _LTR("%s is practicing with a blue, big, spheric yo-yo");
//I18N: shown when hit by own bowling ball. %s is the kart.
case 1 : return _LTR("%s is the world master of the boomerang ball");
//I18N: shown when hit by own bowling ball. %s is the kart.
case 2 : return _LTR("%s should play (rubber) darts instead of bowling");
default: assert(false); return L""; // avoid compiler warning
} // switch
} // if kart_hit==owner
} // getHitString
// ----------------------------------------------------------------------------
/** Updates the bowling ball ineach frame. If this function returns true, the
* object will be removed by the projectile manager.

View File

@ -54,7 +54,6 @@ public:
virtual ~Bowling();
static void init(const XMLNode &node, scene::IMesh *bowling);
virtual bool updateAndDelete(float dt);
virtual const core::stringw getHitString(const AbstractKart *kart) const;
virtual bool hit(AbstractKart* kart, PhysicalObject* obj=NULL);
virtual HitEffect *getHitEffect() const;

View File

@ -136,28 +136,6 @@ void Cake::init(const XMLNode &node, scene::IMesh *cake_model)
m_st_max_distance_squared = max_distance*max_distance;
} // init
// ----------------------------------------------------------------------------
/** Picks a random message to be displayed when a kart is hit by a cake.
* \param The kart that was hit (ignored here).
* \returns The string to display.
*/
const core::stringw Cake::getHitString(const AbstractKart *kart) const
{
const int CAKE_STRINGS_AMOUNT = 4;
RandomGenerator r;
switch (r.get(CAKE_STRINGS_AMOUNT))
{
//I18N: shown when hit by cake. %1 is the attacker, %0 is the victim.
case 0: return _LTR("%0 eats too much of %1's cake");
//I18N: shown when hit by cake. %1 is the attacker, %0 is the victim.
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 3: return _LTR("%1 ruins %0's cakeless diet");
default: assert(false); return L""; // avoid compiler warning
}
} // getHitString
// ----------------------------------------------------------------------------
/** Callback from the physics in case that a kart or physical object is hit.
* The cake triggers an explosion when hit.

View File

@ -49,8 +49,6 @@ private:
public:
Cake (AbstractKart *kart);
static void init (const XMLNode &node, scene::IMesh *cake_model);
virtual const core::stringw
getHitString(const AbstractKart *kart) const;
virtual bool hit(AbstractKart* kart, PhysicalObject* obj=NULL);
// ------------------------------------------------------------------------
virtual void hitTrack () { hit(NULL); }

View File

@ -446,20 +446,6 @@ bool Flyable::hit(AbstractKart *kart_hit, PhysicalObject* object)
{
// the owner of this flyable should not be hit by his own flyable
if(isOwnerImmunity(kart_hit)) return false;
if (kart_hit != NULL)
{ //TODO: reduce shield time; add other string ?
RaceGUIBase* gui = World::getWorld()->getRaceGUI();
irr::core::stringw hit_message =
StringUtils::insertValues(getHitString(kart_hit),
core::stringw(kart_hit->getName()),
core::stringw(m_owner ->getName())
);
if(hit_message.size()>0)
gui->addMessage(translations->fribidize(hit_message), NULL, 3.0f,
video::SColor(255, 255, 255, 255), false);
}
m_has_hit_something=true;
return true;

View File

@ -167,7 +167,6 @@ public:
static void init (const XMLNode &node, scene::IMesh *model,
PowerupManager::PowerupType type);
virtual bool updateAndDelete(float);
virtual const core::stringw getHitString(const AbstractKart *kart) const = 0;
virtual HitEffect* getHitEffect() const;
void updateFromServer(const FlyableInfo &f, float dt);
bool isOwnerImmunity(const AbstractKart *kart_hit) const;

View File

@ -118,25 +118,6 @@ void Plunger::init(const XMLNode &node, scene::IMesh *plunger_model)
Flyable::init(node, plunger_model, PowerupManager::POWERUP_PLUNGER);
} // init
// ----------------------------------------------------------------------------
/** Picks a random message to be displayed when a kart is hit by a plunger.
* \param The kart that was hit (ignored here).
* \returns The string to display.
*/
const core::stringw Plunger::getHitString(const AbstractKart *kart) const
{
const int PLUNGER_IN_FACE_STRINGS_AMOUNT = 2;
RandomGenerator r;
switch (r.get(PLUNGER_IN_FACE_STRINGS_AMOUNT))
{
//I18N: shown when a player receives a plunger in his face
case 0: return _LTR("%0 gets a fancy mask from %1");
//I18N: shown when a player receives a plunger in his face
case 1: return _LTR("%1 merges %0's face with a plunger");
default:assert(false); return L""; // avoid compiler warning
}
} // getHitString
// ----------------------------------------------------------------------------
/** Updates the bowling ball ineach frame. If this function returns true, the
* object will be removed by the projectile manager.
@ -180,9 +161,6 @@ bool Plunger::hit(AbstractKart *kart, PhysicalObject *obj)
{
if(isOwnerImmunity(kart)) return false;
RaceGUIBase* gui = World::getWorld()->getRaceGUI();
irr::core::stringw hit_message;
// pulling back makes no sense in battle mode, since this mode is not a race.
// so in battle mode, always hide view
if( m_reverse_mode || race_manager->isBattleMode() )
@ -192,13 +170,6 @@ bool Plunger::hit(AbstractKart *kart, PhysicalObject *obj)
kart->blockViewWithPlunger();
if (kart->getController()->isPlayerController())
sfx_manager->quickSound("plunger");
hit_message += StringUtils::insertValues(getHitString(kart),
core::stringw(kart->getName()),
core::stringw(m_owner->getName())
).c_str();
gui->addMessage(translations->fribidize(hit_message), NULL, 3.0f,
video::SColor(255, 255, 255, 255), false);
}
m_keep_alive = 0;

View File

@ -51,7 +51,6 @@ public:
static void init(const XMLNode &node, scene::IMesh* missile);
virtual bool updateAndDelete(float dt);
virtual void hitTrack ();
virtual const core::stringw getHitString(const AbstractKart *kart) const;
virtual bool hit (AbstractKart *kart, PhysicalObject *obj=NULL);
// ------------------------------------------------------------------------

View File

@ -293,28 +293,6 @@ void RubberBall::init(const XMLNode &node, scene::IMesh *rubberball)
Flyable::init(node, rubberball, PowerupManager::POWERUP_RUBBERBALL);
} // init
// ----------------------------------------------------------------------------
/** Picks a random message to be displayed when a kart is hit by the
* rubber ball.
* \param The kart that was hit (ignored here).
* \returns The string to display.
*/
const core::stringw RubberBall::getHitString(const AbstractKart *kart) const
{
const int COUNT = 2;
RandomGenerator r;
switch (r.get(COUNT))
{
//I18N: shown when a player is hit by a rubber ball. %1 is the
// attacker, %0 is the victim.
case 0: return _LTR("%s is being bounced around.");
//I18N: shown when a player is hit by a rubber ball. %1 is the
// attacker, %0 is the victim.
case 1: return _LTR("Fetch the ball, %0!");
default:assert(false); return L""; // avoid compiler warning
}
} // getHitString
// ----------------------------------------------------------------------------
/** Updates the rubber ball.
* \param dt Time step size.

View File

@ -207,8 +207,6 @@ public:
static void init(const XMLNode &node, scene::IMesh *rubberball);
virtual bool updateAndDelete(float dt);
virtual bool hit(AbstractKart* kart, PhysicalObject* obj=NULL);
virtual const core::stringw getHitString(const AbstractKart *kart) const;
static float getTimeBetweenRubberBalls() {return m_time_between_balls;}
// ------------------------------------------------------------------------
/** This object does not create an explosion, all affects on

View File

@ -295,16 +295,6 @@ void Swatter::squashThingsAround()
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);
@ -318,28 +308,4 @@ void Swatter::squashThingsAround()
} // for i < num_kartrs
// 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 swatter. %s is the victim
case 2 : return _LTR("%s feels flat today");
default: assert(false); return L""; // avoid compiler warning
}
}
} // squashThingsAround

View File

@ -67,8 +67,6 @@ 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);