Tabs into spaces
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14255 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
b16973dd8f
commit
c452bf9d97
@ -54,7 +54,7 @@ void SoccerWorld::init()
|
||||
WorldWithRank::init();
|
||||
m_display_rank = false;
|
||||
m_goal_timer = 0.f;
|
||||
m_lastKartToHitBall = -1;
|
||||
m_lastKartToHitBall = -1;
|
||||
|
||||
// check for possible problems if AI karts were incorrectly added
|
||||
if(getNumKarts() > race_manager->getNumPlayers())
|
||||
@ -80,11 +80,11 @@ void SoccerWorld::reset()
|
||||
// Reset original positions for the soccer balls
|
||||
TrackObjectManager* tom = getTrack()->getTrackObjectManager();
|
||||
assert(tom);
|
||||
m_redScorers.clear();
|
||||
m_redScoreTimes.clear();
|
||||
m_blueScorers.clear();
|
||||
m_blueScoreTimes.clear();
|
||||
m_lastKartToHitBall = -1;
|
||||
m_redScorers.clear();
|
||||
m_redScoreTimes.clear();
|
||||
m_blueScorers.clear();
|
||||
m_blueScoreTimes.clear();
|
||||
m_lastKartToHitBall = -1;
|
||||
PtrVector<TrackObject>& objects = tom->getObjects();
|
||||
for(int i=0; i<objects.size(); i++)
|
||||
{
|
||||
@ -147,17 +147,17 @@ void SoccerWorld::onCheckGoalTriggered(bool first_goal)
|
||||
World *world = World::getWorld();
|
||||
world->setPhase(WorldStatus::GOAL_PHASE);
|
||||
m_goal_sound->play();
|
||||
if(m_lastKartToHitBall != -1)
|
||||
if(m_lastKartToHitBall != -1)
|
||||
{
|
||||
if(first_goal){
|
||||
m_redScorers.push_back(m_lastKartToHitBall);
|
||||
m_redScoreTimes.push_back(world->getTime());
|
||||
}
|
||||
else{
|
||||
m_blueScorers.push_back(m_lastKartToHitBall);
|
||||
m_blueScoreTimes.push_back(world->getTime());
|
||||
}
|
||||
}
|
||||
if(first_goal){
|
||||
m_redScorers.push_back(m_lastKartToHitBall);
|
||||
m_redScoreTimes.push_back(world->getTime());
|
||||
}
|
||||
else{
|
||||
m_blueScorers.push_back(m_lastKartToHitBall);
|
||||
m_blueScoreTimes.push_back(world->getTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//m_check_goals_enabled = false; // TODO: remove?
|
||||
@ -198,7 +198,7 @@ void SoccerWorld::onCheckGoalTriggered(bool first_goal)
|
||||
* identify the scorer later.
|
||||
*/
|
||||
void SoccerWorld::setLastKartTohitBall(unsigned int kartId){
|
||||
m_lastKartToHitBall = kartId;
|
||||
m_lastKartToHitBall = kartId;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
/** The battle is over if only one kart is left, or no player kart.
|
||||
|
@ -513,9 +513,9 @@ void RaceResultGUI::onUpdate(float dt, irr::video::IVideoDriver*)
|
||||
*/
|
||||
void RaceResultGUI::renderGlobal(float dt)
|
||||
{
|
||||
bool isSoccerWorld = race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER;
|
||||
|
||||
m_timer += dt;
|
||||
bool isSoccerWorld = race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER;
|
||||
|
||||
m_timer += dt;
|
||||
assert(World::getWorld()->getPhase()==WorldStatus::RESULT_DISPLAY_PHASE);
|
||||
unsigned int num_karts = m_all_row_infos.size();
|
||||
|
||||
@ -662,9 +662,9 @@ void RaceResultGUI::renderGlobal(float dt)
|
||||
break;
|
||||
} // switch
|
||||
if(isSoccerWorld)
|
||||
displaySoccerResults();
|
||||
else
|
||||
displayOneEntry((unsigned int)x, (unsigned int)y, i, true);
|
||||
displaySoccerResults();
|
||||
else
|
||||
displayOneEntry((unsigned int)x, (unsigned int)y, i, true);
|
||||
} // for i
|
||||
|
||||
// Display highscores
|
||||
@ -834,117 +834,117 @@ void RaceResultGUI::displayOneEntry(unsigned int x, unsigned int y,
|
||||
void RaceResultGUI::displaySoccerResults()
|
||||
{
|
||||
|
||||
//Draw win text
|
||||
core::stringw resultText;
|
||||
static video::SColor color = video::SColor(255, 255, 255, 255);
|
||||
gui::IGUIFont* font = GUIEngine::getTitleFont();
|
||||
int currX = UserConfigParams::m_width/2;
|
||||
RowInfo *ri = &(m_all_row_infos[0]);
|
||||
int currY = (int)ri->m_y_pos;
|
||||
SoccerWorld* soccerWorld = (SoccerWorld*)World::getWorld();
|
||||
int teamScore[2] = {soccerWorld->getScore(0), soccerWorld->getScore(1)};
|
||||
//Draw win text
|
||||
core::stringw resultText;
|
||||
static video::SColor color = video::SColor(255, 255, 255, 255);
|
||||
gui::IGUIFont* font = GUIEngine::getTitleFont();
|
||||
int currX = UserConfigParams::m_width/2;
|
||||
RowInfo *ri = &(m_all_row_infos[0]);
|
||||
int currY = (int)ri->m_y_pos;
|
||||
SoccerWorld* soccerWorld = (SoccerWorld*)World::getWorld();
|
||||
int teamScore[2] = {soccerWorld->getScore(0), soccerWorld->getScore(1)};
|
||||
|
||||
if(teamScore[0] > teamScore[1])
|
||||
if(teamScore[0] > teamScore[1])
|
||||
{
|
||||
resultText = _("Red Team Wins");
|
||||
}
|
||||
else if(teamScore[1] > teamScore[0])
|
||||
resultText = _("Red Team Wins");
|
||||
}
|
||||
else if(teamScore[1] > teamScore[0])
|
||||
{
|
||||
resultText = _("Blue Team Wins");
|
||||
}
|
||||
else
|
||||
resultText = _("Blue Team Wins");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Cannot really happen now. Only in time limited matches.
|
||||
resultText = _("It's a draw");
|
||||
}
|
||||
core::rect<s32> pos(currX, currY, currX, currY);
|
||||
font->draw(resultText.c_str(), pos, color, true, true);
|
||||
resultText = _("It's a draw");
|
||||
}
|
||||
core::rect<s32> pos(currX, currY, currX, currY);
|
||||
font->draw(resultText.c_str(), pos, color, true, true);
|
||||
|
||||
//Draw team scores:
|
||||
currY += 20;
|
||||
currX /= 2;
|
||||
irr::video::ITexture* redTeamIcon = irr_driver->getTexture(
|
||||
file_manager->getTextureFile("soccer_ball_red.png"));
|
||||
irr::video::ITexture* blueTeamIcon = irr_driver->getTexture(
|
||||
file_manager->getTextureFile("soccer_ball_blue.png"));
|
||||
//Draw team scores:
|
||||
currY += 20;
|
||||
currX /= 2;
|
||||
irr::video::ITexture* redTeamIcon = irr_driver->getTexture(
|
||||
file_manager->getTextureFile("soccer_ball_red.png"));
|
||||
irr::video::ITexture* blueTeamIcon = irr_driver->getTexture(
|
||||
file_manager->getTextureFile("soccer_ball_blue.png"));
|
||||
|
||||
core::recti sourceRect(core::vector2di(0,0), redTeamIcon->getSize());
|
||||
core::recti destRect(currX, currY, currX+redTeamIcon->getSize().Width/2,
|
||||
currY+redTeamIcon->getSize().Height/2);
|
||||
irr_driver->getVideoDriver()->draw2DImage(redTeamIcon, destRect,sourceRect,
|
||||
NULL,NULL, true);
|
||||
currX += UserConfigParams::m_width/2 - redTeamIcon->getSize().Width/2;
|
||||
destRect = core::recti(currX, currY, currX+redTeamIcon->getSize().Width/2,
|
||||
currY+redTeamIcon->getSize().Height/2);
|
||||
irr_driver->getVideoDriver()->draw2DImage(blueTeamIcon,destRect,sourceRect,
|
||||
NULL, NULL, true);
|
||||
|
||||
currX += redTeamIcon->getSize().Width/4;
|
||||
currY += 10 + redTeamIcon->getSize().Height/2;
|
||||
resultText = StringUtils::toWString(teamScore[1]);
|
||||
pos = core::rect<s32>(currX, currY, currX, currY);
|
||||
color = video::SColor(255,255,255,255);
|
||||
font->draw(resultText.c_str(), pos, color, true, false);
|
||||
core::recti sourceRect(core::vector2di(0,0), redTeamIcon->getSize());
|
||||
core::recti destRect(currX, currY, currX+redTeamIcon->getSize().Width/2,
|
||||
currY+redTeamIcon->getSize().Height/2);
|
||||
irr_driver->getVideoDriver()->draw2DImage(redTeamIcon, destRect,sourceRect,
|
||||
NULL,NULL, true);
|
||||
currX += UserConfigParams::m_width/2 - redTeamIcon->getSize().Width/2;
|
||||
destRect = core::recti(currX, currY, currX+redTeamIcon->getSize().Width/2,
|
||||
currY+redTeamIcon->getSize().Height/2);
|
||||
irr_driver->getVideoDriver()->draw2DImage(blueTeamIcon,destRect,sourceRect,
|
||||
NULL, NULL, true);
|
||||
|
||||
currX += redTeamIcon->getSize().Width/4;
|
||||
currY += 10 + redTeamIcon->getSize().Height/2;
|
||||
resultText = StringUtils::toWString(teamScore[1]);
|
||||
pos = core::rect<s32>(currX, currY, currX, currY);
|
||||
color = video::SColor(255,255,255,255);
|
||||
font->draw(resultText.c_str(), pos, color, true, false);
|
||||
|
||||
currX -= UserConfigParams::m_width/2 - redTeamIcon->getSize().Width/2;
|
||||
resultText = StringUtils::toWString(teamScore[0]);
|
||||
pos = core::rect<s32>(currX,currY,currX,currY);
|
||||
font->draw(resultText.c_str(), pos, color, true, false);
|
||||
|
||||
resultText = "-";
|
||||
int centerX = UserConfigParams::m_width/2;
|
||||
pos = core::rect<s32>(centerX, currY, centerX, currY);
|
||||
font->draw(resultText.c_str(), pos, color, true, false);
|
||||
currX -= UserConfigParams::m_width/2 - redTeamIcon->getSize().Width/2;
|
||||
resultText = StringUtils::toWString(teamScore[0]);
|
||||
pos = core::rect<s32>(currX,currY,currX,currY);
|
||||
font->draw(resultText.c_str(), pos, color, true, false);
|
||||
|
||||
resultText = "-";
|
||||
int centerX = UserConfigParams::m_width/2;
|
||||
pos = core::rect<s32>(centerX, currY, centerX, currY);
|
||||
font->draw(resultText.c_str(), pos, color, true, false);
|
||||
|
||||
//Draw goal scorers:
|
||||
//The red scorers:
|
||||
//Draw goal scorers:
|
||||
//The red scorers:
|
||||
currY += GUIEngine::getFont()->getDimension(resultText.c_str()).Height + 20;
|
||||
font = GUIEngine::getSmallFont();
|
||||
std::vector<int> scorers = soccerWorld->getScorers(0);
|
||||
std::vector<float> scoreTimes = soccerWorld->getScoreTimes(0);
|
||||
irr::video::ITexture* scorerIcon;
|
||||
font = GUIEngine::getSmallFont();
|
||||
std::vector<int> scorers = soccerWorld->getScorers(0);
|
||||
std::vector<float> scoreTimes = soccerWorld->getScoreTimes(0);
|
||||
irr::video::ITexture* scorerIcon;
|
||||
|
||||
for(unsigned int i=0; i<scorers.size(); i++)
|
||||
for(unsigned int i=0; i<scorers.size(); i++)
|
||||
{
|
||||
resultText = soccerWorld->getKart(scorers.at(i))->
|
||||
resultText = soccerWorld->getKart(scorers.at(i))->
|
||||
getKartProperties()->getName();
|
||||
resultText.append(" ");
|
||||
resultText.append(StringUtils::timeToString(scoreTimes.at(i)).c_str());
|
||||
pos = core::rect<s32>(currX,currY,currX,currY);
|
||||
font->draw(resultText,pos, color, true, false);
|
||||
resultText.append(" ");
|
||||
resultText.append(StringUtils::timeToString(scoreTimes.at(i)).c_str());
|
||||
pos = core::rect<s32>(currX,currY,currX,currY);
|
||||
font->draw(resultText,pos, color, true, false);
|
||||
scorerIcon = soccerWorld->getKart(scorers.at(i))->
|
||||
getKartProperties()->getIconMaterial()->getTexture();
|
||||
sourceRect = core::recti(core::vector2di(0,0), scorerIcon->getSize());
|
||||
sourceRect = core::recti(core::vector2di(0,0), scorerIcon->getSize());
|
||||
irr::u32 offsetX = GUIEngine::getFont()->getDimension(resultText.c_str()).Width/2;
|
||||
destRect = core::recti(currX-offsetX-30, currY, currX-offsetX, currY+ 30);
|
||||
irr_driver->getVideoDriver()->draw2DImage(scorerIcon, destRect, sourceRect,
|
||||
NULL, NULL, true);
|
||||
currY += 30;
|
||||
}
|
||||
destRect = core::recti(currX-offsetX-30, currY, currX-offsetX, currY+ 30);
|
||||
irr_driver->getVideoDriver()->draw2DImage(scorerIcon, destRect, sourceRect,
|
||||
NULL, NULL, true);
|
||||
currY += 30;
|
||||
}
|
||||
|
||||
//The blue scorers:
|
||||
currY -= 30*scorers.size();
|
||||
currX += UserConfigParams::m_width/2 - redTeamIcon->getSize().Width/2;
|
||||
scorers = soccerWorld->getScorers(1);
|
||||
scoreTimes = soccerWorld->getScoreTimes(1);
|
||||
for(unsigned int i=0; i<scorers.size(); i++)
|
||||
//The blue scorers:
|
||||
currY -= 30*scorers.size();
|
||||
currX += UserConfigParams::m_width/2 - redTeamIcon->getSize().Width/2;
|
||||
scorers = soccerWorld->getScorers(1);
|
||||
scoreTimes = soccerWorld->getScoreTimes(1);
|
||||
for(unsigned int i=0; i<scorers.size(); i++)
|
||||
{
|
||||
resultText = soccerWorld->getKart(scorers.at(i))->
|
||||
resultText = soccerWorld->getKart(scorers.at(i))->
|
||||
getKartProperties()->getName();
|
||||
resultText.append(" ");
|
||||
resultText.append(StringUtils::timeToString(scoreTimes.at(i)).c_str());
|
||||
pos = core::rect<s32>(currX,currY,currX,currY);
|
||||
font->draw(resultText,pos, color, true, false);
|
||||
resultText.append(" ");
|
||||
resultText.append(StringUtils::timeToString(scoreTimes.at(i)).c_str());
|
||||
pos = core::rect<s32>(currX,currY,currX,currY);
|
||||
font->draw(resultText,pos, color, true, false);
|
||||
scorerIcon = soccerWorld->getKart(scorers.at(i))->
|
||||
getKartProperties()->getIconMaterial()->getTexture();
|
||||
sourceRect = core::recti(core::vector2di(0,0), scorerIcon->getSize());
|
||||
sourceRect = core::recti(core::vector2di(0,0), scorerIcon->getSize());
|
||||
irr::u32 offsetX = GUIEngine::getFont()->getDimension(resultText.c_str()).Width/2;
|
||||
|
||||
destRect = core::recti(currX-offsetX-30, currY, currX-offsetX, currY+ 30);
|
||||
irr_driver->getVideoDriver()->draw2DImage(scorerIcon, destRect, sourceRect,
|
||||
NULL, NULL, true);
|
||||
currY += 30;
|
||||
}
|
||||
destRect = core::recti(currX-offsetX-30, currY, currX-offsetX, currY+ 30);
|
||||
irr_driver->getVideoDriver()->draw2DImage(scorerIcon, destRect, sourceRect,
|
||||
NULL, NULL, true);
|
||||
currY += 30;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -196,7 +196,7 @@ private:
|
||||
void displayGPProgress();
|
||||
void cleanupGPProgress();
|
||||
void displayHighScores();
|
||||
void displaySoccerResults();
|
||||
void displaySoccerResults();
|
||||
public:
|
||||
|
||||
RaceResultGUI();
|
||||
|
Loading…
Reference in New Issue
Block a user