]> git.jsancho.org Git - lugaru.git/blobdiff - Source/GameDraw.cpp
Some cleans, fullscreen is back if "--windowed" isn't passed as option.
[lugaru.git] / Source / GameDraw.cpp
index 6031cf5f21a8387db64c7a7079562adefa1f807d..c1fb5532b20768efb0b010629316312cd603fdc7 100644 (file)
@@ -2021,6 +2021,14 @@ vector<string> Game::ListCampaigns() {
 void Game::LoadCampaign() {
        if(!accountactive)
                return;
+       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);
+               } else {
+                       LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0);
+               }
+       }
        ifstream ipstream(ConvertFileName((":Data:Campaigns:"+accountactive->getCurrentCampaign()+".txt").c_str()));
        ipstream.ignore(256,':');
        ipstream >> campaignnumlevels;
@@ -2396,7 +2404,7 @@ void Game::DrawMenu()
                        endy[5]=starty[5]+20;
                        
                        sprintf (menustring[6], "Campaign : %s", accountactive->getCurrentCampaign().c_str());
-                       startx[6]=100;
+                       startx[6]=200;
                        endx[6]=startx[6]+strlen(menustring[6])*10;
                        starty[6]=420;
                        endy[6]=starty[6]+20;
@@ -2684,12 +2692,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;
@@ -2930,10 +2938,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;