From c3e3c3881774d89f2d10431d21f35705094ada5a Mon Sep 17 00:00:00 2001 From: auria Date: Fri, 20 Jan 2012 02:21:19 +0000 Subject: [PATCH] Show required points near each force field. Feedback welcome, I'm somewhat dubious git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10697 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/states_screens/race_gui_overworld.cpp | 17 ++++++++++++++++- src/tracks/track.cpp | 2 +- src/tracks/track.hpp | 4 +++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/states_screens/race_gui_overworld.cpp b/src/states_screens/race_gui_overworld.cpp index f827f7831..5e4fbcce0 100644 --- a/src/states_screens/race_gui_overworld.cpp +++ b/src/states_screens/race_gui_overworld.cpp @@ -46,6 +46,9 @@ using namespace irr; #include "utils/string_utils.hpp" #include "utils/translation.hpp" +#include +#include + const int LOCKED = 0; const int OPEN = 1; const int COMPLETED = 2; @@ -379,7 +382,19 @@ void RaceGUIOverworld::drawGlobalMiniMap() GUIEngine::getFont()->draw(_("Press fire to start the challenge"), pos2, video::SColor(255,255,150,60), true, true /* vcenter */, NULL); - break; + } + + // force field points + if ((kart_xyz - Vec3(challenges[n].m_force_field.m_position)).length2_2d() < 60*60) + { + int pts = challenges[n].m_force_field.m_required_points; + scene::ISceneCollisionManager* scm = irr_driver->getSceneManager()->getSceneCollisionManager(); + core::vector2di pos = scm->getScreenCoordinatesFrom3DPosition(challenges[n].m_force_field.m_position); + + GUIEngine::getTitleFont()->draw(core::stringw(StringUtils::toString(pts).c_str()), + core::rect(pos, pos + core::vector2di(100, 100)), + video::SColor(255,255,150,60), + false, false /* vcenter */, NULL); } } diff --git a/src/tracks/track.cpp b/src/tracks/track.cpp index 41fb27ae4..3e5a81ddc 100644 --- a/src/tracks/track.cpp +++ b/src/tracks/track.cpp @@ -750,7 +750,7 @@ bool Track::loadMainTrack(const XMLNode &root) bool shown = (unlock_manager->getCurrentSlot()->getPoints() < val); - m_force_fields.push_back(OverworldForceField(xyz, shown)); + m_force_fields.push_back(OverworldForceField(xyz, shown, val)); if (!shown) continue; } diff --git a/src/tracks/track.hpp b/src/tracks/track.hpp index 5a5dde67a..319dc735e 100644 --- a/src/tracks/track.hpp +++ b/src/tracks/track.hpp @@ -68,15 +68,17 @@ struct OverworldForceField { core::vector3df m_position; bool m_is_locked; + int m_required_points; OverworldForceField() { } - OverworldForceField(core::vector3df position, bool is_locked) + OverworldForceField(core::vector3df position, bool is_locked, int required_points) { m_position = position; m_is_locked = is_locked; + m_required_points = required_points; } }; struct OverworldChallenge