Differenciate between locked and unlocked challenges on minimap
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10660 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
26b9d63103
commit
25716c2b5b
@ -100,7 +100,7 @@ RaceGUIOverworld::RaceGUIOverworld()
|
||||
}
|
||||
|
||||
m_lock = irr_driver->getTexture( file_manager->getTextureFile("gui_lock.png") );
|
||||
|
||||
m_open_challenge = irr_driver->getTexture( file_manager->getGUIDir() + "challenge.png" );
|
||||
} // RaceGUIOverworld
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -295,24 +295,27 @@ void RaceGUIOverworld::drawGlobalMiniMap()
|
||||
} // for only_draw_player_kart
|
||||
|
||||
|
||||
const std::vector<OverworldChallenge>& challenges = t->getChallengeList();
|
||||
//const std::vector<OverworldChallenge>& challenges = t->getChallengeList();
|
||||
const std::vector<OverworldForceField>& challenges = t->getForceFieldList();
|
||||
|
||||
for (unsigned int n=0; n<challenges.size(); n++)
|
||||
{
|
||||
Vec3 draw_at;
|
||||
t->mapPoint2MiniMap(challenges[n].m_position, &draw_at);
|
||||
|
||||
const ChallengeData* c = unlock_manager->getChallenge(challenges[n].m_challenge_id);
|
||||
bool locked = (m_locked_challenges.find(c) != m_locked_challenges.end());
|
||||
//const ChallengeData* c = unlock_manager->getChallenge(challenges[n].m_challenge_id);
|
||||
// bool locked = (m_locked_challenges.find(c) != m_locked_challenges.end());
|
||||
bool locked = challenges[n].m_is_locked;
|
||||
|
||||
const core::rect<s32> source(core::position2d<s32>(0,0),
|
||||
m_lock->getOriginalSize());
|
||||
(locked ? m_lock : m_open_challenge)->getOriginalSize());
|
||||
|
||||
core::rect<s32> dest(m_map_left+(int)(draw_at.getX()-m_marker_challenge_size/2),
|
||||
lower_y -(int)(draw_at.getY()+m_marker_challenge_size/2),
|
||||
m_map_left+(int)(draw_at.getX()+m_marker_challenge_size/2),
|
||||
lower_y -(int)(draw_at.getY()-m_marker_challenge_size/2));
|
||||
irr_driver->getVideoDriver()->draw2DImage(m_lock, dest,
|
||||
source, NULL, NULL, true);
|
||||
irr_driver->getVideoDriver()->draw2DImage(locked ? m_lock : m_open_challenge,
|
||||
dest, source, NULL, NULL, true);
|
||||
}
|
||||
} // drawGlobalMiniMap
|
||||
|
||||
|
@ -60,7 +60,8 @@ private:
|
||||
|
||||
video::ITexture *m_trophy;
|
||||
video::ITexture *m_lock;
|
||||
|
||||
video::ITexture *m_open_challenge;
|
||||
|
||||
/** The size of a single marker on the screen for AI karts,
|
||||
* need not be a power of 2. */
|
||||
int m_marker_challenge_size;
|
||||
|
@ -612,6 +612,7 @@ bool Track::loadMainTrack(const XMLNode &root)
|
||||
assert(m_gfx_effect_mesh==NULL);
|
||||
|
||||
m_challenges.clear();
|
||||
m_force_fields.clear();
|
||||
|
||||
m_track_mesh = new TriangleMesh();
|
||||
m_gfx_effect_mesh = new TriangleMesh();
|
||||
@ -696,6 +697,14 @@ bool Track::loadMainTrack(const XMLNode &root)
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
core::vector3df xyz(0,0,0);
|
||||
n->get("xyz", &xyz);
|
||||
core::vector3df hpr(0,0,0);
|
||||
n->get("hpr", &hpr);
|
||||
core::vector3df scale(1.0f, 1.0f, 1.0f);
|
||||
n->get("scale", &scale);
|
||||
|
||||
// some static meshes are conditional
|
||||
std::string condition;
|
||||
n->get("if", &condition);
|
||||
@ -722,15 +731,11 @@ bool Track::loadMainTrack(const XMLNode &root)
|
||||
condition.c_str());
|
||||
}
|
||||
|
||||
if (unlock_manager->getCurrentSlot()->getPoints() < val)
|
||||
{
|
||||
// show object
|
||||
}
|
||||
else
|
||||
{
|
||||
// don't show object
|
||||
continue;
|
||||
}
|
||||
bool shown = (unlock_manager->getCurrentSlot()->getPoints() < val);
|
||||
|
||||
m_force_fields.push_back(OverworldForceField(xyz, shown));
|
||||
|
||||
if (!shown) continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -762,13 +767,6 @@ bool Track::loadMainTrack(const XMLNode &root)
|
||||
n->get("model", &model_name);
|
||||
full_path = m_root+"/"+model_name;
|
||||
|
||||
core::vector3df xyz(0,0,0);
|
||||
n->get("xyz", &xyz);
|
||||
core::vector3df hpr(0,0,0);
|
||||
n->get("hpr", &hpr);
|
||||
core::vector3df scale(1.0f, 1.0f, 1.0f);
|
||||
n->get("scale", &scale);
|
||||
|
||||
// a special challenge orb object for overworld
|
||||
std::string challenge;
|
||||
n->get("challenge", &challenge);
|
||||
|
@ -75,6 +75,18 @@ struct OverworldChallenge
|
||||
m_challenge_id = challenge_id;
|
||||
}
|
||||
};
|
||||
struct OverworldForceField
|
||||
{
|
||||
core::vector3df m_position;
|
||||
bool m_is_locked;
|
||||
|
||||
OverworldForceField(core::vector3df position, bool is_locked)
|
||||
{
|
||||
m_position = position;
|
||||
m_is_locked = is_locked;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \ingroup tracks
|
||||
@ -95,6 +107,8 @@ private:
|
||||
/** Will only be sued on overworld */
|
||||
std::vector<OverworldChallenge> m_challenges;
|
||||
|
||||
std::vector<OverworldForceField> m_force_fields;
|
||||
|
||||
/** Start transforms of karts (either the default, or the ones taken
|
||||
* from the scene file). */
|
||||
AlignedArray<btTransform> m_start_transforms;
|
||||
@ -418,6 +432,11 @@ public:
|
||||
const std::vector<OverworldChallenge>& getChallengeList() const
|
||||
{ return m_challenges; }
|
||||
|
||||
/** Get list of force fields placed on that world. Works only for overworld. */
|
||||
const std::vector<OverworldForceField>& getForceFieldList() const
|
||||
{ return m_force_fields; }
|
||||
|
||||
|
||||
}; // class Track
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user