]> git.jsancho.org Git - lugaru.git/blobdiff - Source/GameDraw.cpp
bugfix (world texture was messed when fullscreen/windowed switch) and cleanups
[lugaru.git] / Source / GameDraw.cpp
index dd74893d7a9e80aa6b0b1f43e3247113f7eb3f02..b4f6ee715f3a97f963228ad47c6fdb86fd6690c4 100644 (file)
@@ -2024,9 +2024,9 @@ void Game::LoadCampaign() {
        if(!Mainmenuitems[7]) {
                ifstream test(ConvertFileName((":Data:Textures:"+accountactive->getCurrentCampaign()+":World.png").c_str()));
                if(test.good()) {
-                       LoadTexture((":Data:Textures:"+accountactive->getCurrentCampaign()+":World.png").c_str(),&Mainmenuitems[7],0,0);
+                       LoadTextureData((":Data:Textures:"+accountactive->getCurrentCampaign()+":World.png").c_str(),&Mainmenuitems[7],0,0);
                } else {
-                       LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0);
+                       LoadTextureData(":Data:Textures:World.png",&Mainmenuitems[7],0,0);
                }
        }
        ifstream ipstream(ConvertFileName((":Data:Campaigns:"+accountactive->getCurrentCampaign()+".txt").c_str()));
@@ -2087,8 +2087,7 @@ void Game::LoadCampaign() {
        }
 }
 
-void Game::DrawMenu()
-{
+void Game::DrawMenu() {
        int i,j;
        static float lastcheck;
 
@@ -2692,12 +2691,12 @@ void Game::DrawMenu()
 
        for(i=0;i<nummenuitems;i++) {
                if((mousecoordh/screenwidth*640)>startx[i]&&(mousecoordh/screenwidth*640)<endx[i]&&480-(mousecoordv/screenheight*480)>starty[i]&&480-(mousecoordv/screenheight*480)<endy[i]) {
-                       if(mainmenu!=5) selected=i;
+                       if((mainmenu!=5) && (mainmenu!=1) && (mainmenu!=2)) selected=i; // username in menu 5 and game title in menu 1&2 can't be selected
                        else if( (i>0) && (i!=NB_CAMPAIGN_MENU_ITEM) ) selected=i;
                }
        }
 
-       for(i=0;i<nummenuitems;i++){
+       for(i=0;i<nummenuitems;i++) {
                if(selected==i) {
                        selectedlong[i]+=multiplier*5;
                        if(selectedlong[i]>1) selectedlong[i]=1;
@@ -2938,10 +2937,10 @@ void Game::DrawMenu()
                                                                //float linestartx,lineendx,linestarty,lineendy,offsetx,offsety;
                                                                linestart.x=(startx[j]+endx[j])/2;
                                                                linestart.y=(starty[j]+endy[j])/2;
-                                                               if(j>=NB_CAMPAIGN_MENU_ITEM+(accountactive?accountactive->getCampaignChoicesMade():0)){
-                                                                       linestart.x=(startx[6+(accountactive?accountactive->getCampaignChoicesMade():0)]+endx[6+(accountactive?accountactive->getCampaignChoicesMade():0)])/2;
-                                                                       linestart.y=(starty[6+(accountactive?accountactive->getCampaignChoicesMade():0)]+endy[6+(accountactive?accountactive->getCampaignChoicesMade():0)])/2;
-                                                               }
+                                                               //~ if(j>=NB_CAMPAIGN_MENU_ITEM-1+(accountactive?accountactive->getCampaignChoicesMade():0)){
+                                                                       //~ linestart.x=(startx[NB_CAMPAIGN_MENU_ITEM-1+(accountactive?accountactive->getCampaignChoicesMade():0)]+endx[NB_CAMPAIGN_MENU_ITEM-1+(accountactive?accountactive->getCampaignChoicesMade():0)])/2;
+                                                                       //~ linestart.y=(starty[NB_CAMPAIGN_MENU_ITEM-1+(accountactive?accountactive->getCampaignChoicesMade():0)]+endy[NB_CAMPAIGN_MENU_ITEM-1+(accountactive?accountactive->getCampaignChoicesMade():0)])/2;
+                                                               //~ } // what was this if for?
                                                                lineend.x=(startx[j+1]+endx[j+1])/2;
                                                                lineend.y=(starty[j+1]+endy[j+1])/2;
                                                                offset=lineend-linestart;