Give a go at the 3-spare-tires idea for 3 strikes battle
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9603 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
a49fefcd3b
commit
6ba44be4f7
@ -18,6 +18,16 @@
|
||||
released under Creative Commons Attribution-Share Alike 3.0
|
||||
[http://creativecommons.org/licenses/by-sa/3.0/]
|
||||
|
||||
* gplose
|
||||
released under CC-BY-SA 3.0 [http://creativecommons.org/licenses/by-sa/3.0/]
|
||||
oak by Julius Krischan Makowka, released un CC-BY-SA 3.0
|
||||
Tires by Thomas Oppl, released under CC-BY-SA 3.0
|
||||
scene and finishing touches by Marianne Gagnon
|
||||
|
||||
* tire
|
||||
based on work by Thomas Oppl, released under CC-BY-SA 3.0
|
||||
with modifications by Marianne Gagnon
|
||||
|
||||
* village
|
||||
released under CC-BY-SA 3.0 [http://creativecommons.org/licenses/by-sa/3.0/]
|
||||
oak by Julius Krischan Makowka, released un CC-BY-SA 3.0
|
||||
@ -33,4 +43,7 @@
|
||||
* zipper_collect
|
||||
by Dakal, released under CC-BY-SA 3.0
|
||||
|
||||
* swatter
|
||||
by Funto
|
||||
|
||||
Others are GPL, by the original (super)TuxKart team
|
||||
|
BIN
data/models/tire.b3d
Executable file
BIN
data/models/tire.b3d
Executable file
Binary file not shown.
@ -75,7 +75,10 @@ void LODNode::OnRegisterSceneNode()
|
||||
if (m_nodes_set.find(*it) == m_nodes_set.end())
|
||||
{
|
||||
assert(*it != NULL);
|
||||
(*it)->OnRegisterSceneNode();
|
||||
if ((*it)->isVisible())
|
||||
{
|
||||
(*it)->OnRegisterSceneNode();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1846,6 +1846,8 @@ void Kart::loadData(RaceManager::KartType type, bool is_first_kart,
|
||||
m_kart_properties->getShadowScale(),
|
||||
m_kart_properties->getShadowXOffset(),
|
||||
m_kart_properties->getShadowYOffset());
|
||||
|
||||
World::getWorld()->kartAdded(this, m_node);
|
||||
} // loadData
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -18,9 +18,11 @@
|
||||
#include "modes/three_strikes_battle.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <IMeshSceneNode.h>
|
||||
|
||||
#include "states_screens/race_gui_base.hpp"
|
||||
#include "audio/music_manager.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "states_screens/race_gui_base.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -29,6 +31,8 @@ ThreeStrikesBattle::ThreeStrikesBattle() : WorldWithRank()
|
||||
{
|
||||
WorldStatus::setClockMode(CLOCK_CHRONO);
|
||||
m_use_highscores = false;
|
||||
|
||||
m_tire = irr_driver->getMesh( file_manager->getModelFile("tire.b3d") );
|
||||
} // ThreeStrikesBattle
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -71,8 +75,37 @@ void ThreeStrikesBattle::init()
|
||||
ThreeStrikesBattle::~ThreeStrikesBattle()
|
||||
{
|
||||
delete[] m_kart_display_info;
|
||||
// TODO: need to drop the mesh? I got a crash when I added this line so
|
||||
// not sure this is right
|
||||
//m_tire->drop();
|
||||
} // ~ThreeStrikesBattle
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void ThreeStrikesBattle::kartAdded(Kart* kart, scene::ISceneNode* node)
|
||||
{
|
||||
//int coord = node->getBoundingBox().MinEdge.Z;
|
||||
float coord = -kart->getKartLength()*0.5f;
|
||||
|
||||
scene::IMeshSceneNode* tire_node = irr_driver->addMesh(m_tire, node);
|
||||
tire_node->setPosition(core::vector3df(0.0f, 0.55f, coord - 0.2f));
|
||||
tire_node->setScale(core::vector3df(0.4f, 0.4f, 0.4f));
|
||||
tire_node->setRotation(core::vector3df(90.0f, 0.0f, 0.0f));
|
||||
tire_node->setName("tire1");
|
||||
|
||||
tire_node = irr_driver->addMesh(m_tire, node);
|
||||
tire_node->setPosition(core::vector3df(-0.2f, 0.3f, coord - 0.25f));
|
||||
tire_node->setScale(core::vector3df(0.4f, 0.4f, 0.4f));
|
||||
tire_node->setRotation(core::vector3df(90.0f, 0.0f, 0.0f));
|
||||
tire_node->setName("tire2");
|
||||
|
||||
tire_node = irr_driver->addMesh(m_tire, node);
|
||||
tire_node->setPosition(core::vector3df(0.2f, 0.3f, coord - 0.25f));
|
||||
tire_node->setScale(core::vector3df(0.4f, 0.4f, 0.4f));
|
||||
tire_node->setRotation(core::vector3df(90.0f, 0.0f, 0.0f));
|
||||
tire_node->setName("tire3");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void ThreeStrikesBattle::kartHit(const int kart_id)
|
||||
{
|
||||
@ -111,6 +144,28 @@ void ThreeStrikesBattle::kartHit(const int kart_id)
|
||||
music_manager->switchToFastMusic();
|
||||
m_faster_music_active = true;
|
||||
}
|
||||
|
||||
scene::ISceneNode* kart_node = m_karts[kart_id]->getNode();
|
||||
|
||||
// FIXME: sorry for this ugly const_cast, irrlicht doesn't seem to allow getting a writable list of children, wtf??
|
||||
core::list<scene::ISceneNode*>& children = const_cast<core::list<scene::ISceneNode*>&>(kart_node->getChildren());
|
||||
for (core::list<scene::ISceneNode*>::Iterator it = children.begin(); it != children.end(); it++)
|
||||
{
|
||||
scene::ISceneNode* curr = *it;
|
||||
|
||||
if (core::stringc(curr->getName()) == "tire1")
|
||||
{
|
||||
curr->setVisible(m_kart_info[kart_id].m_lives >= 1);
|
||||
}
|
||||
else if (core::stringc(curr->getName()) == "tire2")
|
||||
{
|
||||
curr->setVisible(m_kart_info[kart_id].m_lives >= 2);
|
||||
}
|
||||
else if (core::stringc(curr->getName()) == "tire3")
|
||||
{
|
||||
curr->setVisible(m_kart_info[kart_id].m_lives >= 3);
|
||||
}
|
||||
}
|
||||
} // kartHit
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "modes/world_with_rank.hpp"
|
||||
#include "states_screens/race_gui_base.hpp"
|
||||
|
||||
|
||||
/**
|
||||
* \brief An implementation of World, to provide the 3 strikes battle game mode
|
||||
* \ingroup modes
|
||||
@ -43,6 +44,8 @@ private:
|
||||
*/
|
||||
std::vector<BattleInfo> m_kart_info;
|
||||
|
||||
irr::scene::IMesh* m_tire;
|
||||
|
||||
public:
|
||||
|
||||
/** Used to show a nice graph when battle is over */
|
||||
@ -74,7 +77,11 @@ public:
|
||||
virtual std::string getIdent() const;
|
||||
|
||||
virtual void kartHit(const int kart_id);
|
||||
virtual void update(float dt);
|
||||
virtual void update(float dt);
|
||||
|
||||
virtual void kartAdded(Kart* kart, scene::ISceneNode* node);
|
||||
|
||||
|
||||
void updateKartRanks();
|
||||
}; // ThreeStrikesBattles
|
||||
|
||||
|
@ -217,6 +217,11 @@ public:
|
||||
bool shouldDrawTimer() const { return isRacePhase() &&
|
||||
getClockMode() != CLOCK_NONE; }
|
||||
|
||||
/**
|
||||
* If you want to do something to karts or their graphics at the start of the race, override this
|
||||
*/
|
||||
virtual void kartAdded(Kart* kart, scene::ISceneNode* node) {}
|
||||
|
||||
/** \return whether this world can generate/have highscores */
|
||||
bool useHighScores() const { return m_use_highscores; }
|
||||
|
||||
@ -243,6 +248,7 @@ public:
|
||||
*/
|
||||
virtual void kartHit(const int kart_id) {};
|
||||
|
||||
|
||||
bool clearBackBuffer() const { return m_clear_back_buffer; }
|
||||
|
||||
const irr::video::SColor& getClearColor() const { return m_clear_color; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user