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