From 83703fdcf7cf8391ed5a9df68024370a2cfd163d Mon Sep 17 00:00:00 2001 From: thebohemian Date: Mon, 24 Sep 2007 12:28:19 +0000 Subject: [PATCH] - 3rd splitscreen player gets the whole width git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1259 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/camera.cpp | 16 +++++++++++++++- src/gui/race_gui.cpp | 32 ++++++++++++++++++++++++-------- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/src/camera.cpp b/src/camera.cpp index 16ce6b634..8a1b07f93 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -47,7 +47,21 @@ Camera::setScreenPosition ( int numPlayers, int pos ) break; } } - else if (numPlayers == 3 || numPlayers == 4) + else if (numPlayers == 3) + { + m_context -> setFOV ( 50.0f, 0.0f ); + switch ( pos ) + { + case 0 : m_x = 0.0f; m_y = 0.5f; m_w = 0.5f; m_h = 0.5f; + break; + case 1 : m_x = 0.5f; m_y = 0.5f; m_w = 0.5f; m_h = 0.5f; + break; + case 2 : m_x = 0.0f; m_y = 0.0f; m_w = 1.0f; m_h = 0.5f; + m_context -> setFOV ( 85.0f, 85.0f*3.0f/8.0f ) ; + break; + } + } + else if (numPlayers == 4) { m_context -> setFOV ( 50.0f, 0.0f ); switch ( pos ) diff --git a/src/gui/race_gui.cpp b/src/gui/race_gui.cpp index bb3b543c1..fd8fab296 100644 --- a/src/gui/race_gui.cpp +++ b/src/gui/race_gui.cpp @@ -946,22 +946,38 @@ void RaceGUI::drawStatusText (const RaceSetup& raceSetup, const float dt) if ( world->getPhase() == World::RACE_PHASE || world->getPhase() == World::DELAY_FINISH_PHASE ) { - for(int pla = 0; pla < raceSetup.getNumPlayers(); pla++) + const int numPlayers = raceSetup.getNumPlayers(); + + for(int pla = 0; pla < numPlayers; pla++) { int offset_x, offset_y; offset_x = offset_y = 0; - if(raceSetup.getNumPlayers() == 2) + if(numPlayers == 2) { - if(pla == 0) offset_y = user_config->m_height/2; + if(pla == 0) offset_y = user_config->m_height/2; } - else if(raceSetup.getNumPlayers() > 2) + else if (numPlayers == 3) { - if((pla == 0 && raceSetup.getNumPlayers() > 1) || (pla == 1)) - offset_y = user_config->m_height/2; + if (pla == 0 || pla == 1) + offset_y = user_config->m_height/2; + else + { + // Fixes width for player 3 + split_screen_ratio_x = 1.0; + } - if((pla == 1) || pla == 3) - offset_x = user_config->m_width/2; + if (pla == 1) + offset_x = user_config->m_width/2; + + } + else if(numPlayers == 4) + { + if(pla == 0 || pla == 1) + offset_y = user_config->m_height/2; + + if((pla == 1) || pla == 3) + offset_x = user_config->m_width/2; } Kart* player_kart=world->getPlayerKart(pla);