Added a red line to the energy meter that indicates the required number
of coins needed for the two coin collection challenges. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1858 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
032e5b71b7
commit
f13f9018a6
@ -38,6 +38,7 @@ void EnergyMathClass::setRace() const {
|
||||
race_manager->setNumLaps(3);
|
||||
race_manager->setNumKarts(1);
|
||||
race_manager->setNumPlayers(1);
|
||||
race_manager->setCoinTarget(6);
|
||||
} // setRace
|
||||
\
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -40,6 +40,7 @@ void EnergyShiftingSands::setRace() const {
|
||||
race_manager->setNumLaps(3);
|
||||
race_manager->setNumKarts(1);
|
||||
race_manager->setNumPlayers(1);
|
||||
race_manager->setCoinTarget(9);
|
||||
} // setRace
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -509,6 +509,7 @@ void RaceGUI::drawCollectableIcons ( Kart* player_kart, int offset_x,
|
||||
// Meter border color (0.0 - 1.0)
|
||||
#define METER_BORDER_BLACK 0.0, 0.0, 0.0
|
||||
#define METER_BORDER_WHITE 1.0, 1.0, 1.0
|
||||
#define METER_TARGET_RED 1.0, 0.0, 0.0
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void RaceGUI::drawEnergyMeter ( Kart *player_kart, int offset_x, int offset_y,
|
||||
@ -525,6 +526,8 @@ void RaceGUI::drawEnergyMeter ( Kart *player_kart, int offset_x, int offset_y,
|
||||
wl = 1;
|
||||
const int GRADS = (int)(MAX_HERRING_EATEN/5); // each graduation equals 5 herring
|
||||
int gh = (int)(h/GRADS); //graduation height
|
||||
float coin_target = (float)race_manager->getCoinTarget();
|
||||
int th = (int)(h*(coin_target/MAX_HERRING_EATEN));
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
// Draw a Meter border
|
||||
@ -610,6 +613,18 @@ void RaceGUI::drawEnergyMeter ( Kart *player_kart, int offset_x, int offset_y,
|
||||
gh+=gh_incr;
|
||||
}
|
||||
|
||||
//Target line
|
||||
if (coin_target > 0)
|
||||
{
|
||||
glBegin ( GL_QUADS );
|
||||
glColor3f(METER_TARGET_RED);
|
||||
glVertex2i(x, y+th);
|
||||
glVertex2i(x+w, y+th);
|
||||
glVertex2i(x+w, y+th+wl);
|
||||
glVertex2i(x, y+th+wl);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
// up side
|
||||
glBegin ( GL_QUADS ) ;
|
||||
glColor3f ( METER_BORDER_WHITE ) ;
|
||||
|
@ -43,6 +43,7 @@ RaceManager::RaceManager()
|
||||
m_score_for_position = stk_config->m_scores;
|
||||
setTrack("race");
|
||||
setPlayerKart(0, "tuxkart");
|
||||
m_coin_target = 0;
|
||||
} // RaceManager
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -85,6 +85,7 @@ private:
|
||||
int m_num_karts;
|
||||
unsigned int m_num_finished_karts;
|
||||
unsigned int m_num_finished_players;
|
||||
int m_coin_target;
|
||||
|
||||
void startNextRace(); // start a next race
|
||||
|
||||
@ -111,6 +112,7 @@ public:
|
||||
void setTrack(const std::string& track);
|
||||
void setRaceMode(RaceModeType mode) { m_race_mode = mode; }
|
||||
void setNumKarts(int num) { m_num_karts = num; }
|
||||
void setCoinTarget(int num) { m_coin_target = num; }
|
||||
void addKartResult(int kart, int pos, float time);
|
||||
RaceModeType getRaceMode() const { return m_race_mode; }
|
||||
unsigned int getNumKarts() const { return m_num_karts; }
|
||||
@ -128,6 +130,7 @@ public:
|
||||
int getKartScore(int krt) const { return m_kart_status[krt].m_score;}
|
||||
int getPositionScore(int p) const { return m_score_for_position[p-1]; }
|
||||
double getOverallTime(int kart) const { return m_kart_status[kart].m_overall_time;}
|
||||
int getCoinTarget() const { return m_coin_target; }
|
||||
bool isEliminated(int kart) const { return m_kart_status[kart].m_is_eliminated;}
|
||||
bool raceHasLaps() const { return m_race_mode!=RM_FOLLOW_LEADER;}
|
||||
void eliminate(int kart) { m_kart_status[kart].m_is_eliminated=true;}
|
||||
|
@ -18,6 +18,7 @@
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "unlock_manager.hpp"
|
||||
#include "race_manager.hpp"
|
||||
|
||||
#include "challenges/energy_math_class.hpp"
|
||||
#include "challenges/penguin_playground_gp.hpp"
|
||||
@ -162,6 +163,7 @@ void UnlockManager::raceFinished()
|
||||
unlockFeature(i->second);
|
||||
} // if isActive && challenge solved
|
||||
}
|
||||
race_manager->setCoinTarget(0); //reset
|
||||
} // raceFinished
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -175,6 +177,7 @@ void UnlockManager::grandPrixFinished()
|
||||
unlockFeature(i->second);
|
||||
}
|
||||
}
|
||||
race_manager->setCoinTarget(0);
|
||||
} // grandPrixFinished
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user